Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
feat(probe): show each hop's API, URL and fields from its catalog wire
Jack Rudenkoe7f4cef92578
diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.tsindex f54f4514..19526246 100644--- a/packages/cli/src/cli.ts+++ b/packages/cli/src/cli.ts@@ -1637,6 +1637,8 @@ async function probeModelRouting(supportsVision: boolean;transportOverride: string | null;effectiveStreamFormat: string;+ /** How the catalog connection is called, from its wire; absent off-catalog. */+ wireSummary?: string;};/** One model in `--probe --json`: the routing decision, as `explainRoute` made it. */@@ -1787,36 +1789,48 @@ async function probeModelRouting(const resolvedSpec = resolveRemoteProvider(firstReadyRoute.modelSpec);const modelName = resolvedSpec?.modelName || parsedModel;+ // A catalog connection is described by its WIRE: the same resolution the+ // request uses (`buildWireHandler`), so --probe cannot show a composition+ // the request does not have. This used to be a hand-written provider table+ // plus a model-name check, i.e. a second guess beside the request's own.+ const { resolveConnection } = await import("./providers/connection-resolver.js");+ const { describeConnectionWire } = await import("./providers/wire-handler.js");+ const { lookupModelForProvider } = await import("./adapters/model-catalog.js");+ const definitionName = providerName === "gemini" ? "google" : providerName;+ const resolution = resolveConnection(definitionName, modelName);+ if (resolution.ok) {+ const { wire } = resolution.connection;+ const byApi: Record<string, [string, string]> = {+ "chat-completions": [+ definitionName === "openrouter" ? "OpenRouterAPIFormat" : "OpenAIAPIFormat",+ "openai-sse",+ ],+ responses: ["CodexAPIFormat", "openai-responses-sse"],+ "anthropic-messages": ["AnthropicAPIFormat", "anthropic-sse"],+ gemini: ["GeminiAPIFormat", "gemini-sse"],+ };+ const [adapter, stream] =+ wire.status === "known" ? byApi[wire.api] : ["(tried in turn)", "(per API)"];+ return {+ formatAdapter: adapter,+ declaredStreamFormat: stream,+ modelTranslator: "wire",+ contextWindow: lookupModelForProvider(modelName, definitionName) ?? 0,+ supportsVision: false,+ transportOverride: null,+ effectiveStreamFormat: stream,+ wireSummary: describeConnectionWire(resolution.connection),+ };+ }++ // Not a catalog connection (dynamic subscription, local, LiteLLM, custom+ // endpoint): each has one fixed composition per provider.let formatAdapterName = "OpenAIAPIFormat";let declaredStreamFormat = "openai-sse";- const anthropicCompatProviders = [- "minimax",- "minimax-coding",- "kimi",- "kimi-coding",- "qwen-token-plan",- "qwen-coding",- "qwen-payg",- "z-ai",- ];- const isMinimaxModel = modelName.toLowerCase().includes("minimax");-- if (anthropicCompatProviders.includes(providerName)) {- formatAdapterName = "AnthropicAPIFormat";- declaredStreamFormat = "anthropic-sse";- } else if (- (providerName === "opencode-zen" || providerName === "opencode-zen-go") &&- isMinimaxModel- ) {- formatAdapterName = "AnthropicAPIFormat";- declaredStreamFormat = "anthropic-sse";- } else if (providerName === "gemini" || providerName === "antigravity") {+ if (providerName === "antigravity") {formatAdapterName = "GeminiAPIFormat";declaredStreamFormat = "gemini-sse";- } else if (providerName === "ollamacloud") {- formatAdapterName = "OllamaAPIFormat";- declaredStreamFormat = "openai-sse";} else if (providerName === "litellm") {formatAdapterName = "LiteLLMAPIFormat";declaredStreamFormat = "openai-sse";diff --git a/packages/cli/src/probe/probe-results-printer.test.ts b/packages/cli/src/probe/probe-results-printer.test.tsindex 8a7928a1..f1c71ca9 100644--- a/packages/cli/src/probe/probe-results-printer.test.ts+++ b/packages/cli/src/probe/probe-results-printer.test.ts@@ -127,3 +127,25 @@ describe("printProbeResults calculated-route headings", () => {expect(output).not.toContain("auto-route@");});});++test("the Wire line renders the catalog wire summary", () => {+ const wireSummary = "fixture/direct-api · opaque: responses · limit max_output_tokens";+ const output = render({+ model: "fixture@opaque",+ routingSource: "explicit",+ routingExplanation: "explicit · fixture",+ chain: [],+ dropped: [],+ wiring: {+ formatAdapter: "CodexAPIFormat",+ declaredStreamFormat: "openai-responses-sse",+ effectiveStreamFormat: "openai-responses-sse",+ modelTranslator: "wire",+ contextWindow: 100000,+ supportsVision: false,+ transportOverride: null,+ wireSummary,+ },+ });+ expect(output).toContain(wireSummary);+});diff --git a/packages/cli/src/probe/probe-results-printer.ts b/packages/cli/src/probe/probe-results-printer.tsindex a59c287a..4a0981a0 100644--- a/packages/cli/src/probe/probe-results-printer.ts+++ b/packages/cli/src/probe/probe-results-printer.ts@@ -384,6 +384,12 @@ export interface WiringInfo {supportsVision: boolean;transportOverride: string | null;effectiveStreamFormat: string;+ /**+ * How the catalog connection is called, from its `wire` (API + URL, limit+ * field, reasoning encoding, modes, speeds). Absent for a provider the+ * catalog does not route.+ */+ wireSummary?: string;}/**@@ -785,7 +791,7 @@ function buildKeyLine(activeEntry?: ChainEntry, directKeyVar?: string): string {function buildWireLine(wiring: WiringInfo, activeProvider: string | undefined): string {const ctx = formatContextWindow(wiring.contextWindow);const head = activeProvider ? `${activeProvider} → ` : "";- return `${pc.bold}Wire${pc.reset} ${head}${wiring.effectiveStreamFormat} · ${wiring.modelTranslator} · ${ctx}`;+ return `${pc.bold}Wire${pc.reset} ${head}${wiring.wireSummary ?? `${wiring.effectiveStreamFormat} · ${wiring.modelTranslator}`} · ${ctx}`;}/**diff --git a/packages/cli/src/probe/probe-tui-app.tsx b/packages/cli/src/probe/probe-tui-app.tsxindex b10f5ca2..ada8c6fb 100644--- a/packages/cli/src/probe/probe-tui-app.tsx+++ b/packages/cli/src/probe/probe-tui-app.tsx@@ -123,6 +123,7 @@ export interface ProbeModelResult {supportsVision: boolean;transportOverride: string | null;effectiveStreamFormat: string;+ wireSummary?: string;};}@@ -1039,7 +1040,7 @@ function DetailModel({const wiring = result.wiring;const wireLine =winner && wiring- ? `wire (${winner.displayName}): ${wiring.effectiveStreamFormat} · ${wiring.modelTranslator} · ${formatContextWindow(wiring.contextWindow)} ctx`+ ? `wire (${winner.displayName}): ${wiring.wireSummary ?? `${wiring.effectiveStreamFormat} · ${wiring.modelTranslator}`} · ${formatContextWindow(wiring.contextWindow)} ctx`: "wire: —";// ── Routing advisor ────────────────────────────────────────────────