diff --git a/src/agents/bash-process-registry.e2e.test.ts b/src/agents/bash-process-registry.e2e.test.ts index 43389544d0..07e816e445 100644 --- a/src/agents/bash-process-registry.e2e.test.ts +++ b/src/agents/bash-process-registry.e2e.test.ts @@ -20,7 +20,7 @@ describe("bash process registry", () => { const session: ProcessSession = { id: "sess", command: "echo test", - child: { pid: 123, removeAllListeners: vi.fn() } as ChildProcessWithoutNullStreams, + child: { pid: 123, removeAllListeners: vi.fn() } as unknown as ChildProcessWithoutNullStreams, startedAt: Date.now(), cwd: "/tmp", maxOutputChars: 10, @@ -51,7 +51,7 @@ describe("bash process registry", () => { const session: ProcessSession = { id: "sess", command: "echo test", - child: { pid: 123, removeAllListeners: vi.fn() } as ChildProcessWithoutNullStreams, + child: { pid: 123, removeAllListeners: vi.fn() } as unknown as ChildProcessWithoutNullStreams, startedAt: Date.now(), cwd: "/tmp", maxOutputChars: 100_000, @@ -85,7 +85,7 @@ describe("bash process registry", () => { const session: ProcessSession = { id: "sess", command: "echo test", - child: { pid: 123, removeAllListeners: vi.fn() } as ChildProcessWithoutNullStreams, + child: { pid: 123, removeAllListeners: vi.fn() } as unknown as ChildProcessWithoutNullStreams, startedAt: Date.now(), cwd: "/tmp", maxOutputChars: 5_000, @@ -116,7 +116,7 @@ describe("bash process registry", () => { const session: ProcessSession = { id: "sess", command: "echo test", - child: { pid: 123, removeAllListeners: vi.fn() } as ChildProcessWithoutNullStreams, + child: { pid: 123, removeAllListeners: vi.fn() } as unknown as ChildProcessWithoutNullStreams, startedAt: Date.now(), cwd: "/tmp", maxOutputChars: 100, @@ -150,7 +150,7 @@ describe("bash process registry", () => { const session: ProcessSession = { id: "sess", command: "echo test", - child: { pid: 123, removeAllListeners: vi.fn() } as ChildProcessWithoutNullStreams, + child: { pid: 123, removeAllListeners: vi.fn() } as unknown as ChildProcessWithoutNullStreams, startedAt: Date.now(), cwd: "/tmp", maxOutputChars: 100, diff --git a/src/agents/bash-tools.exec.background-abort.e2e.test.ts b/src/agents/bash-tools.exec.background-abort.e2e.test.ts index 74282b6c8c..0a8779faf4 100644 --- a/src/agents/bash-tools.exec.background-abort.e2e.test.ts +++ b/src/agents/bash-tools.exec.background-abort.e2e.test.ts @@ -4,9 +4,9 @@ import { getFinishedSession, getSession, resetProcessRegistryForTests, -} from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; -import { killProcessTree } from "./shell-utils"; +} from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; +import { killProcessTree } from "./shell-utils.js"; afterEach(() => { resetProcessRegistryForTests(); diff --git a/src/agents/bash-tools.exec.pty-cleanup.test.ts b/src/agents/bash-tools.exec.pty-cleanup.test.ts index efe6f01d60..015d97a47e 100644 --- a/src/agents/bash-tools.exec.pty-cleanup.test.ts +++ b/src/agents/bash-tools.exec.pty-cleanup.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, test, vi } from "vitest"; -import { resetProcessRegistryForTests } from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; +import { resetProcessRegistryForTests } from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; const { ptySpawnMock } = vi.hoisted(() => ({ ptySpawnMock: vi.fn(), diff --git a/src/agents/bash-tools.exec.pty-fallback-failure.test.ts b/src/agents/bash-tools.exec.pty-fallback-failure.test.ts index 2caad66a83..31ad679e3f 100644 --- a/src/agents/bash-tools.exec.pty-fallback-failure.test.ts +++ b/src/agents/bash-tools.exec.pty-fallback-failure.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, test, vi } from "vitest"; -import { listRunningSessions, resetProcessRegistryForTests } from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; +import { listRunningSessions, resetProcessRegistryForTests } from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; const { supervisorSpawnMock } = vi.hoisted(() => ({ supervisorSpawnMock: vi.fn(), diff --git a/src/agents/bash-tools.exec.pty-fallback.e2e.test.ts b/src/agents/bash-tools.exec.pty-fallback.e2e.test.ts index 9aa42a4c46..7ee383b5dc 100644 --- a/src/agents/bash-tools.exec.pty-fallback.e2e.test.ts +++ b/src/agents/bash-tools.exec.pty-fallback.e2e.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, test, vi } from "vitest"; -import { resetProcessRegistryForTests } from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; +import { resetProcessRegistryForTests } from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; vi.mock("@lydell/node-pty", () => ({ spawn: () => { diff --git a/src/agents/bash-tools.exec.pty.e2e.test.ts b/src/agents/bash-tools.exec.pty.e2e.test.ts index 699e0ac65b..3db7e924d2 100644 --- a/src/agents/bash-tools.exec.pty.e2e.test.ts +++ b/src/agents/bash-tools.exec.pty.e2e.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, test } from "vitest"; -import { resetProcessRegistryForTests } from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; +import { resetProcessRegistryForTests } from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; afterEach(() => { resetProcessRegistryForTests(); diff --git a/src/agents/bash-tools.process.send-keys.e2e.test.ts b/src/agents/bash-tools.process.send-keys.e2e.test.ts index a6f35cd946..4034db49f8 100644 --- a/src/agents/bash-tools.process.send-keys.e2e.test.ts +++ b/src/agents/bash-tools.process.send-keys.e2e.test.ts @@ -1,8 +1,8 @@ import { afterEach, expect, test } from "vitest"; -import { sleep } from "../utils"; -import { resetProcessRegistryForTests } from "./bash-process-registry"; -import { createExecTool } from "./bash-tools.exec"; -import { createProcessTool } from "./bash-tools.process"; +import { sleep } from "../utils.js"; +import { resetProcessRegistryForTests } from "./bash-process-registry.js"; +import { createExecTool } from "./bash-tools.exec.js"; +import { createProcessTool } from "./bash-tools.process.js"; afterEach(() => { resetProcessRegistryForTests(); diff --git a/src/agents/compaction.retry.test.ts b/src/agents/compaction.retry.test.ts index 0513d64d89..50fe043cb9 100644 --- a/src/agents/compaction.retry.test.ts +++ b/src/agents/compaction.retry.test.ts @@ -24,15 +24,15 @@ describe("compaction retry integration", () => { vi.clearAllTimers(); vi.useRealTimers(); }); - const testMessages: AgentMessage[] = [ + const testMessages = [ { role: "user", content: "Test message" }, { role: "assistant", content: "Test response" }, - ]; + ] as unknown as AgentMessage[]; - const testModel: NonNullable = { + const testModel = { provider: "anthropic", model: "claude-3-opus", - }; + } as unknown as NonNullable; it("should successfully call generateSummary with retry wrapper", async () => { mockGenerateSummary.mockResolvedValueOnce("Test summary"); diff --git a/src/agents/compaction.tool-result-details.e2e.test.ts b/src/agents/compaction.tool-result-details.e2e.test.ts index 42db974f8b..79c883a729 100644 --- a/src/agents/compaction.tool-result-details.e2e.test.ts +++ b/src/agents/compaction.tool-result-details.e2e.test.ts @@ -30,7 +30,7 @@ describe("compaction toolResult details stripping", () => { role: "assistant", content: [{ type: "toolUse", id: "call_1", name: "browser", input: { action: "tabs" } }], timestamp: 1, - } as AgentMessage, + } as unknown as AgentMessage, { role: "toolResult", toolCallId: "call_1", @@ -57,7 +57,9 @@ describe("compaction toolResult details stripping", () => { expect(summary).toBe("summary"); expect(piCodingAgentMocks.generateSummary).toHaveBeenCalled(); - const [chunk] = piCodingAgentMocks.generateSummary.mock.calls[0] ?? []; + const chunk = ( + piCodingAgentMocks.generateSummary.mock.calls as unknown as Array<[unknown]> + )[0]?.[0]; const serialized = JSON.stringify(chunk); expect(serialized).not.toContain("Ignore previous instructions"); expect(serialized).not.toContain('"details"'); diff --git a/src/agents/ollama-stream.test.ts b/src/agents/ollama-stream.test.ts index 177f1d0173..ff0a1796de 100644 --- a/src/agents/ollama-stream.test.ts +++ b/src/agents/ollama-stream.test.ts @@ -287,7 +287,7 @@ describe("createOllamaStreamFn", () => { expect(events.at(-1)?.type).toBe("done"); expect(fetchMock).toHaveBeenCalledTimes(1); - const [url, requestInit] = fetchMock.mock.calls[0] as [string, RequestInit]; + const [url, requestInit] = fetchMock.mock.calls[0] as unknown as [string, RequestInit]; expect(url).toBe("http://ollama-host:11434/api/chat"); expect(requestInit.signal).toBe(signal); if (typeof requestInit.body !== "string") { diff --git a/src/agents/openclaw-tools.sessions.e2e.test.ts b/src/agents/openclaw-tools.sessions.e2e.test.ts index 14e0ffc1e9..100e32e749 100644 --- a/src/agents/openclaw-tools.sessions.e2e.test.ts +++ b/src/agents/openclaw-tools.sessions.e2e.test.ts @@ -140,7 +140,11 @@ describe("sessions tools", () => { const result = await tool.execute("call1", { messageLimit: 1 }); const details = result.details as { - sessions?: Array>; + sessions?: Array<{ + key?: string; + channel?: string; + messages?: Array<{ role?: string }>; + }>; }; expect(details.sessions).toHaveLength(3); const main = details.sessions?.find((s) => s.key === "main"); @@ -178,7 +182,7 @@ describe("sessions tools", () => { } const result = await tool.execute("call3", { sessionKey: "main" }); - const details = result.details as { messages?: unknown[] }; + const details = result.details as { messages?: Array<{ role?: string }> }; expect(details.messages).toHaveLength(1); expect(details.messages?.[0]?.role).toBe("assistant"); @@ -764,6 +768,8 @@ describe("sessions tools", () => { .spyOn(sessionsModule, "loadSessionStore") .mockImplementation(() => ({ "agent:main:subagent:usage-active": { + sessionId: "session-usage-active", + updatedAt: now, modelProvider: "anthropic", model: "claude-opus-4-6", inputTokens: 12, diff --git a/src/agents/session-tool-result-guard.e2e.test.ts b/src/agents/session-tool-result-guard.e2e.test.ts index 5d00901f2f..79fbf4cc5f 100644 --- a/src/agents/session-tool-result-guard.e2e.test.ts +++ b/src/agents/session-tool-result-guard.e2e.test.ts @@ -269,7 +269,7 @@ describe("installSessionToolResultGuard", () => { ? ({ ...(message as unknown as Record), provenance: { kind: "inter_session", sourceTool: "sessions_send" }, - } as AgentMessage) + } as unknown as AgentMessage) : message, }); diff --git a/src/agents/session-tool-result-guard.tool-result-persist-hook.e2e.test.ts b/src/agents/session-tool-result-guard.tool-result-persist-hook.e2e.test.ts index f55e9bc807..93c67bf40b 100644 --- a/src/agents/session-tool-result-guard.tool-result-persist-hook.e2e.test.ts +++ b/src/agents/session-tool-result-guard.tool-result-persist-hook.e2e.test.ts @@ -34,12 +34,13 @@ function writeTempPlugin(params: { dir: string; id: string; body: string }): str } function appendToolCallAndResult(sm: ReturnType) { - sm.appendMessage({ + const appendMessage = sm.appendMessage.bind(sm) as unknown as (message: AgentMessage) => void; + appendMessage({ role: "assistant", content: [{ type: "toolCall", id: "call_1", name: "read", arguments: {} }], } as AgentMessage); - sm.appendMessage({ + appendMessage({ role: "toolResult", toolCallId: "call_1", isError: false,