test(engine): add wrapToolsWithRtkRewrite/PermanentAgentGating/ActionGate to pi.js mocks (openclaw + reviewer)

This commit is contained in:
gsxdsm
2026-07-12 12:06:02 -07:00
parent fb3e843bc2
commit 8d59df4531
3 changed files with 12 additions and 0 deletions

View File

@@ -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", () => ({

View File

@@ -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 {

View File

@@ -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";