|
1 | 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import { resolveAgentDir } from "../agents/agent-scope.js"; |
2 | 3 | import { clearAgentHarnesses, registerAgentHarness } from "../agents/harness/registry.js"; |
3 | 4 | import { selectAgentHarness } from "../agents/harness/selection.js"; |
4 | 5 | import { resolveRunWorkspaceDir } from "../agents/workspace-run.js"; |
5 | 6 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
6 | 7 | import { SYSTEM_AGENT_ID } from "./agent-id.js"; |
7 | | -import { resolveSystemAgentConfiguredRouteFromConfig } from "./inference-route.js"; |
| 8 | +import { |
| 9 | + projectDefaultInferenceRoute, |
| 10 | + resolveSystemAgentConfiguredRouteFromConfig, |
| 11 | + sameDefaultInferenceRoute, |
| 12 | +} from "./inference-route.js"; |
8 | 13 |
|
9 | 14 | function devConfig(agentRuntime?: string): OpenClawConfig { |
10 | 15 | return { |
@@ -42,6 +47,31 @@ afterEach(() => { |
42 | 47 | }); |
43 | 48 |
|
44 | 49 | describe("resolveSystemAgentConfiguredRouteFromConfig", () => { |
| 50 | + it("treats a setup-materialized first-agent roster as inference-route neutral", async () => { |
| 51 | + const withoutRoster: OpenClawConfig = { |
| 52 | + agents: { defaults: { model: "openai/gpt-5.5" } }, |
| 53 | + }; |
| 54 | + const withFirstAgent: OpenClawConfig = { |
| 55 | + agents: { |
| 56 | + defaults: withoutRoster.agents?.defaults, |
| 57 | + entries: { |
| 58 | + main: { |
| 59 | + default: true, |
| 60 | + workspace: "/tmp/openclaw-main", |
| 61 | + agentDir: resolveAgentDir(withoutRoster, "main"), |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + }; |
| 66 | + |
| 67 | + expect( |
| 68 | + sameDefaultInferenceRoute( |
| 69 | + await projectDefaultInferenceRoute(withoutRoster), |
| 70 | + await projectDefaultInferenceRoute(withFirstAgent), |
| 71 | + ), |
| 72 | + ).toBe(true); |
| 73 | + }); |
| 74 | + |
45 | 75 | it.each([ |
46 | 76 | { label: "main", agentIds: ["main"], owner: "main" }, |
47 | 77 | { label: "non-main", agentIds: ["dev"], owner: "dev" }, |
|
0 commit comments