test: refresh agent harness and latest-main type fixes

This commit is contained in:
Peter Steinberger
2026-04-06 16:42:51 +01:00
parent 2fef1ccbe7
commit 821a30981a
2 changed files with 14 additions and 4 deletions

View File

@@ -770,9 +770,12 @@ describe("discord component interactions", () => {
const acknowledge = vi.fn().mockResolvedValue(undefined);
const reply = vi.fn().mockResolvedValue(undefined);
const update = vi.fn().mockResolvedValue(undefined);
const baseInteraction = createComponentButtonInteraction().interaction;
const baseInteraction = createComponentButtonInteraction().interaction as unknown as Record<
string,
unknown
>;
const interaction = {
...(baseInteraction as object),
...baseInteraction,
acknowledge,
reply,
update,
@@ -822,9 +825,12 @@ describe("discord component interactions", () => {
const button = createDiscordComponentButton(createComponentContext());
const acknowledge = vi.fn().mockResolvedValue(undefined);
const followUp = vi.fn().mockResolvedValue(undefined);
const baseInteraction = createComponentButtonInteraction().interaction;
const baseInteraction = createComponentButtonInteraction().interaction as unknown as Record<
string,
unknown
>;
const interaction = {
...(baseInteraction as object),
...baseInteraction,
acknowledge,
followUp,
} as unknown as ButtonInteraction;

View File

@@ -155,6 +155,8 @@ vi.mock("@mariozechner/pi-coding-agent", () => {
AuthStorage,
createAgentSession: (...args: unknown[]) => hoisted.createAgentSessionMock(...args),
DefaultResourceLoader,
estimateTokens: () => 0,
generateSummary: async () => "",
ModelRegistry,
SessionManager: {
open: (...args: unknown[]) => hoisted.sessionManagerOpenMock(...args),
@@ -264,6 +266,8 @@ vi.mock("../../session-write-lock.js", () => ({
}));
vi.mock("../tool-result-context-guard.js", () => ({
formatContextLimitTruncationNotice: (truncatedChars: number) =>
`[... ${Math.max(1, Math.floor(truncatedChars))} more characters truncated]`,
installToolResultContextGuard: (...args: unknown[]) =>
(hoisted.installToolResultContextGuardMock as (...args: unknown[]) => unknown)(...args),
}));