From 8d59df4531c543cb9dfedf61339591f34e6d2799 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Sun, 12 Jul 2026 12:06:02 -0700 Subject: [PATCH] test(engine): add wrapToolsWithRtkRewrite/PermanentAgentGating/ActionGate to pi.js mocks (openclaw + reviewer) --- packages/engine/src/__tests__/openclaw-runtime-e2e.test.ts | 4 ++++ .../engine/src/__tests__/openclaw-runtime-integration.test.ts | 4 ++++ packages/engine/src/__tests__/reviewer.test.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/packages/engine/src/__tests__/openclaw-runtime-e2e.test.ts b/packages/engine/src/__tests__/openclaw-runtime-e2e.test.ts index 960b4e2fe9..f06b47017a 100644 --- a/packages/engine/src/__tests__/openclaw-runtime-e2e.test.ts +++ b/packages/engine/src/__tests__/openclaw-runtime-e2e.test.ts @@ -39,6 +39,10 @@ vi.mock("../pi.js", () => ({ createFnAgent: mockCreateFnAgent, promptWithFallback: mockPromptWithFallback, describeModel: mockDescribeModel, + // FNXC: pi.js tool-policy wrappers (wrapToolsWithRtkRewrite, wrapToolsWithPermanentAgentGating, wrapToolsWithActionGate) are now imported by agent-session-helpers.ts (wrapCustomToolsForPluginRuntime, called from createResolvedAgentSession). Mocks pass tools through unchanged. + wrapToolsWithRtkRewrite: vi.fn((tools) => tools), + wrapToolsWithPermanentAgentGating: vi.fn((tools) => tools), + wrapToolsWithActionGate: vi.fn((tools) => tools), })); vi.mock("node:child_process", () => ({ diff --git a/packages/engine/src/__tests__/openclaw-runtime-integration.test.ts b/packages/engine/src/__tests__/openclaw-runtime-integration.test.ts index 72268884f9..fa9b8923d7 100644 --- a/packages/engine/src/__tests__/openclaw-runtime-integration.test.ts +++ b/packages/engine/src/__tests__/openclaw-runtime-integration.test.ts @@ -19,6 +19,10 @@ vi.mock("../pi.js", () => ({ createFnAgent: mockCreateFnAgent, promptWithFallback: vi.fn().mockResolvedValue(undefined), describeModel: vi.fn().mockReturnValue("pi/default"), + // FNXC: pi.js tool-policy wrappers (wrapToolsWithRtkRewrite, wrapToolsWithPermanentAgentGating, wrapToolsWithActionGate) are now imported by agent-session-helpers.ts (wrapCustomToolsForPluginRuntime, called from createResolvedAgentSession). Mocks pass tools through unchanged. + wrapToolsWithRtkRewrite: vi.fn((tools) => tools), + wrapToolsWithPermanentAgentGating: vi.fn((tools) => tools), + wrapToolsWithActionGate: vi.fn((tools) => tools), })); function isAgentRuntime(value: unknown): value is AgentRuntime { diff --git a/packages/engine/src/__tests__/reviewer.test.ts b/packages/engine/src/__tests__/reviewer.test.ts index 7604589463..67e7067f6a 100644 --- a/packages/engine/src/__tests__/reviewer.test.ts +++ b/packages/engine/src/__tests__/reviewer.test.ts @@ -18,6 +18,10 @@ vi.mock("../pi.js", () => ({ await session.promptWithFallback(prompt, options); } }), + // FNXC: pi.js tool-policy wrappers (wrapToolsWithRtkRewrite, wrapToolsWithPermanentAgentGating, wrapToolsWithActionGate) are now imported by agent-session-helpers.ts (wrapCustomToolsForPluginRuntime, called from createResolvedAgentSession). Mocks pass tools through unchanged. + wrapToolsWithRtkRewrite: vi.fn((tools) => tools), + wrapToolsWithPermanentAgentGating: vi.fn((tools) => tools), + wrapToolsWithActionGate: vi.fn((tools) => tools), })); import { resolveAgentPrompt } from "@fusion/core";