File size: 1,468 Bytes
e249c6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | // Runtime plan tool-diagnostics tests cover the legacy provider diagnostic path
// used when no runtime plan owns tool schema diagnostics.
import { describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({
logProviderToolSchemaDiagnostics: vi.fn(),
normalizeProviderToolSchemas: vi.fn((params: { tools: unknown[] }) => params.tools),
}));
vi.mock("../embedded-agent-runner/tool-schema-runtime.js", () => ({
logProviderToolSchemaDiagnostics: mocks.logProviderToolSchemaDiagnostics,
normalizeProviderToolSchemas: mocks.normalizeProviderToolSchemas,
}));
const { logAgentRuntimeToolDiagnostics } = await import("./tools.js");
describe("AgentRuntimePlan tool diagnostics legacy fallback", () => {
it("falls back to provider diagnostics when no RuntimePlan is available", () => {
const tools = [{ name: "alpha" }] as never;
logAgentRuntimeToolDiagnostics({
tools,
provider: "openai",
modelId: "gpt-5.4",
modelApi: "openai-responses",
workspaceDir: "/tmp/openclaw-runtime-plan-tools",
});
expect(mocks.logProviderToolSchemaDiagnostics).toHaveBeenCalledTimes(1);
expect(mocks.logProviderToolSchemaDiagnostics.mock.calls.at(0)?.[0]).toEqual({
tools,
provider: "openai",
config: undefined,
workspaceDir: "/tmp/openclaw-runtime-plan-tools",
env: process.env,
modelId: "gpt-5.4",
modelApi: "openai-responses",
model: undefined,
});
});
});
|