























@@ -23,7 +23,6 @@ const effectiveInventoryState = vi.hoisted(() => ({
2323pluginMeta: {} as Record<string, { pluginId: string } | undefined>,
2424channelMeta: {} as Record<string, { channelId: string } | undefined>,
2525effectivePolicy: {} as { profile?: string; providerProfile?: string },
26-resolvedModelCompat: undefined as Record<string, unknown> | undefined,
2726createToolsMock: vi.fn<typeof createOpenClawCodingTools>(
2827(_options) =>
2928[
@@ -48,16 +47,6 @@ vi.mock("./pi-tools.js", () => ({
4847effectiveInventoryState.createToolsMock(options),
4948}));
504951-vi.mock("./pi-embedded-runner/model.js", () => ({
52-resolveModel: vi.fn(() => ({
53-model: effectiveInventoryState.resolvedModelCompat
54- ? { compat: effectiveInventoryState.resolvedModelCompat }
55- : undefined,
56-authStorage: {} as never,
57-modelRegistry: {} as never,
58-})),
59-}));
60-6150vi.mock("../plugins/tools.js", () => ({
6251getPluginToolMeta: (tool: { name: string }) => effectiveInventoryState.pluginMeta[tool.name],
6352}));
@@ -79,7 +68,6 @@ async function loadHarness(options?: {
7968pluginMeta?: Record<string, { pluginId: string } | undefined>;
8069channelMeta?: Record<string, { channelId: string } | undefined>;
8170effectivePolicy?: { profile?: string; providerProfile?: string };
82-resolvedModelCompat?: Record<string, unknown>;
8371}) {
8472effectiveInventoryState.tools = options?.tools ?? [
8573mockTool({ name: "exec", label: "Exec", description: "Run shell commands" }),
@@ -88,7 +76,6 @@ async function loadHarness(options?: {
8876effectiveInventoryState.pluginMeta = options?.pluginMeta ?? {};
8977effectiveInventoryState.channelMeta = options?.channelMeta ?? {};
9078effectiveInventoryState.effectivePolicy = options?.effectivePolicy ?? {};
91-effectiveInventoryState.resolvedModelCompat = options?.resolvedModelCompat;
9279effectiveInventoryState.createToolsMock =
9380options?.createToolsMock ??
9481vi.fn<typeof createOpenClawCodingTools>((_options) => effectiveInventoryState.tools);
@@ -111,7 +98,6 @@ describe("resolveEffectiveToolInventory", () => {
11198effectiveInventoryState.pluginMeta = {};
11299effectiveInventoryState.channelMeta = {};
113100effectiveInventoryState.effectivePolicy = {};
114-effectiveInventoryState.resolvedModelCompat = undefined;
115101effectiveInventoryState.createToolsMock = vi.fn<typeof createOpenClawCodingTools>(
116102(_options) => effectiveInventoryState.tools,
117103);
@@ -312,11 +298,31 @@ describe("resolveEffectiveToolInventory", () => {
312298]);
313299const { resolveEffectiveToolInventory } = await loadHarness({
314300 createToolsMock,
315-resolvedModelCompat: { supportsTools: true, supportsNativeWebSearch: true },
316301});
317302318303resolveEffectiveToolInventory({
319-cfg: {},
304+cfg: {
305+models: {
306+providers: {
307+xai: {
308+baseUrl: "https://api.x.ai/v1",
309+models: [
310+{
311+id: "grok-test",
312+name: "Grok Test",
313+api: "openai-completions",
314+reasoning: false,
315+input: ["text"],
316+cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
317+contextWindow: 128_000,
318+maxTokens: 8_192,
319+compat: { supportsTools: true, nativeWebSearchTool: true },
320+},
321+],
322+},
323+},
324+},
325+},
320326agentDir: "/tmp/agents/main/agent",
321327modelProvider: "xai",
322328modelId: "grok-test",
@@ -325,7 +331,7 @@ describe("resolveEffectiveToolInventory", () => {
325331expect(createToolsMock).toHaveBeenCalledWith(
326332expect.objectContaining({
327333allowGatewaySubagentBinding: true,
328-modelCompat: { supportsTools: true, supportsNativeWebSearch: true },
334+modelCompat: { supportsTools: true, nativeWebSearchTool: true },
329335}),
330336);
331337});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。