crosscheck-mcp 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,20 +48,24 @@ var pricing_default = {
48
48
  notes: "Prices reflect public list pricing per provider. cached_per_1k applies to prompt tokens served from prompt-cache (Anthropic) or input-cache (OpenAI) when supported. Update when providers change rates. Missing models fall back to cost=0 with estimated=true. 2026-06-07: removed decommissioned gemini-2.0-flash / gemini-2.0-flash-lite (Google returns 404) and replaced the low-tier lite model with gemini-2.5-flash-lite. 2026-06-08: bumped the default Anthropic model to claude-opus-4-8. Kept gemini-2.5-pro as the Gemini default (gemini-3.1-pro-preview measured ~2.2x the cost at $2/$12 per M \u2014 output-token dominated by ~1.5k thinking tokens \u2014 so not worth it for a 1-of-4 panel voice). 2026-06-09: corrected rates verified against live provider pricing pages \u2014 gemini-2.5-pro output $5->$10/M; gemini-2.5-flash $0.15/$0.60 -> $0.30/$2.50; gpt-5 $5/$15 -> $1.25/$10 (cached $0.125); grok-4-latest input $5->$3/M (legacy grok-4 tier). Anthropic opus/sonnet/haiku rates confirmed unchanged. Older/unused models (gpt-4o, o1, o3, grok-3) not all re-verified. 2026-07-02: added claude-fable-5 as the optional reasoning-upgrade model (used only for the lead reasoning seat when the operator bumps a heavy task). 2026-07-04: set claude-fable-5 to its real pay-as-you-go API price effective 2026-07-07 \u2014 $10/M input ($0.01/1k), $50/M output ($0.05/1k), cached at 10% of input ($0.001/1k). Dropped the estimated flag. Note: Fable 5 is cheaper than opus-4-8 on both input and output. 2026-07-09: Google retired gemini-2.5-pro AND gemini-3-pro-preview (both now 404 'no longer available'). Moved the Gemini default to gemini-3.1-pro-preview ($2/M in, $12/M out, cache $0.20/M \u2014 the newest working pro; note it's a preview and may need another bump) and added gemini-3.5-flash ($1.50/M in, $9/M out, cache $0.15/M \u2014 GA) to the low/cheap tier. Removed the dead gemini-2.5-pro rate. IMPORTANT: gemini-3.x are heavy thinking models \u2014 thoughtsTokenCount (billed as output) is now folded into completion_tokens in the adapter, so cost reflects reasoning tokens. 2026-07-13: bumped the default OpenAI model to gpt-5.5 ($5/M in, $30/M out, cached $0.50/M \u2014 verified live). Note gpt-5.5 is markedly pricier than gpt-5 ($1.25/$10): ~4x input, 3x output. Kept gpt-5 in the table for cost lookups on pinned installs. 2026-07-16: added gpt-5.6 at the Sol (flagship) tier \u2014 $5/M in, $30/M out, cached $0.50/M (cache-write $6.25/M not modeled). gpt-5.6 is the second premium voice for the max-reasoning co-reasoner (runs alongside claude-fable-5 when an OpenAI key is set). Terra/Luna tiers not added (unused). 2026-07-17: added Moonshot AI (Kimi) provider with kimi-k3, base URL https://api.moonshot.ai/v1. Confirmed real rates \u2014 $3.00/M input (cache miss, $0.003/1k), $15.00/M output ($0.015/1k), $0.30/M cache-hit input ($0.0003/1k); 1M-token context. Kimi K3 is reasoning-class (temperature must be 1; uses max_completion_tokens). 2026-07-24: added claude-opus-5 ($5/M in, $25/M out, cached $0.50/M -- 10% of input, matching this table's existing cache-discount ratio) and made it the default anthropic model (was claude-opus-4-8). Fable 5 remains the reasoning-upgrade/super-mode target, unchanged. 2026-08-04: added Alibaba Cloud Qwen provider (OpenAI-compatible, DashScope international endpoint https://dashscope-intl.aliyuncs.com/compatible-mode/v1) with default model qwen3.8-max -- confirmed business pricing $2.00/M input ($0.002/1k), $6.00/M output ($0.006/1k), cache estimated at 10% of input ($0.0002/1k, not independently confirmed). Also added qwen3.7-max as a fallback tier at $1.25/M in ($0.00125/1k) / $3.75/M out ($0.00375/1k). Note: the model string initially configured (qwen-v3.8 / qwen-v3.7) does not exist on DashScope and 404s -- live-probed the real key against qwen3.8-max, qwen3.7-max, qwen3-max, qwen-max, and qwen-plus, all of which work; corrected the default and pricing keys to qwen3.8-max/qwen3.7-max and fixed QWEN_MODEL in both .env files to match. Qwen's Max tier is a standard instruct model, not reasoning-class -- normal temperature/max_tokens handling. 2026-09-06: added gpt-6-astra at published list rates ($10/$50 per Mtok, $1/Mtok cache read; the $12.50/Mtok cache-WRITE rate has no field in this schema and is not modelled). gemini-3.8-flash now carries Google's published paid-tier rates ($0.75/$3.75/$0.075 per Mtok). THESE DOUBLE ON 2027-01-01 ($1.50/$7.50/$0.15) and this schema has no effective-date support, so they must be updated by hand on that date or every Gemini cost will read half of actual. claude-fable-5-1 now carries published rates ($10/$50/$0.25 per Mtok). Note its cache-read rate is 4x cheaper than claude-fable-5's, so the two must not be assumed to track each other. No inferred rows remain. All three were previously absent, which silently recorded their cost as $0."
49
49
  },
50
50
  anthropic: {
51
+ _source: {
52
+ url: "https://platform.claude.com/docs/en/about-claude/pricing",
53
+ verified_at: "2026-09-27"
54
+ },
51
55
  "claude-opus-4-5": {
52
- prompt_per_1k: 0.015,
53
- completion_per_1k: 0.075,
54
- cached_per_1k: 15e-4
56
+ prompt_per_1k: 5e-3,
57
+ completion_per_1k: 0.025,
58
+ cached_per_1k: 5e-4
55
59
  },
56
60
  "claude-opus-4-7": {
57
- prompt_per_1k: 0.015,
58
- completion_per_1k: 0.075,
59
- cached_per_1k: 15e-4
61
+ prompt_per_1k: 5e-3,
62
+ completion_per_1k: 0.025,
63
+ cached_per_1k: 5e-4
60
64
  },
61
65
  "claude-opus-4-8": {
62
- prompt_per_1k: 0.015,
63
- completion_per_1k: 0.075,
64
- cached_per_1k: 15e-4
66
+ prompt_per_1k: 5e-3,
67
+ completion_per_1k: 0.025,
68
+ cached_per_1k: 5e-4
65
69
  },
66
70
  "claude-opus-5-5": {
67
71
  prompt_per_1k: 4e-3,
@@ -110,10 +114,44 @@ var pricing_default = {
110
114
  }
111
115
  },
112
116
  openai: {
117
+ _source: {
118
+ url: "https://developers.openai.com/api/docs/pricing",
119
+ verified_at: "2026-09-27"
120
+ },
121
+ "gpt-6-astra": {
122
+ prompt_per_1k: 0.01,
123
+ completion_per_1k: 0.05,
124
+ cached_per_1k: 1e-3
125
+ },
126
+ "gpt-6-sol": {
127
+ prompt_per_1k: 2e-3,
128
+ completion_per_1k: 0.01,
129
+ cached_per_1k: 2e-4
130
+ },
131
+ "gpt-6-luna": {
132
+ prompt_per_1k: 1e-4,
133
+ completion_per_1k: 5e-4,
134
+ cached_per_1k: 1e-5
135
+ },
136
+ "gpt-5.6-sol": {
137
+ prompt_per_1k: 4e-3,
138
+ completion_per_1k: 0.02,
139
+ cached_per_1k: 4e-4
140
+ },
141
+ "gpt-5.6-terra": {
142
+ prompt_per_1k: 2e-3,
143
+ completion_per_1k: 0.012,
144
+ cached_per_1k: 2e-4
145
+ },
146
+ "gpt-5.6-luna": {
147
+ prompt_per_1k: 2e-4,
148
+ completion_per_1k: 12e-4,
149
+ cached_per_1k: 2e-5
150
+ },
113
151
  "gpt-5.6": {
114
- prompt_per_1k: 5e-3,
115
- completion_per_1k: 0.03,
116
- cached_per_1k: 5e-4
152
+ prompt_per_1k: 4e-3,
153
+ completion_per_1k: 0.02,
154
+ cached_per_1k: 4e-4
117
155
  },
118
156
  "gpt-5.5": {
119
157
  prompt_per_1k: 5e-3,
@@ -126,9 +164,14 @@ var pricing_default = {
126
164
  cached_per_1k: 125e-6
127
165
  },
128
166
  "gpt-5-mini": {
129
- prompt_per_1k: 5e-4,
130
- completion_per_1k: 15e-4,
131
- cached_per_1k: 25e-5
167
+ prompt_per_1k: 25e-5,
168
+ completion_per_1k: 2e-3,
169
+ cached_per_1k: 25e-6
170
+ },
171
+ "gpt-5-nano": {
172
+ prompt_per_1k: 5e-5,
173
+ completion_per_1k: 4e-4,
174
+ cached_per_1k: 5e-6
132
175
  },
133
176
  "gpt-4o": {
134
177
  prompt_per_1k: 25e-4,
@@ -151,19 +194,44 @@ var pricing_default = {
151
194
  cached_per_1k: 15e-4
152
195
  },
153
196
  o3: {
154
- prompt_per_1k: 0.01,
155
- completion_per_1k: 0.04,
156
- cached_per_1k: 5e-3
197
+ prompt_per_1k: 2e-3,
198
+ completion_per_1k: 8e-3,
199
+ cached_per_1k: 5e-4
157
200
  },
158
201
  "o3-mini": {
159
202
  prompt_per_1k: 11e-4,
160
203
  completion_per_1k: 44e-4,
161
204
  cached_per_1k: 55e-5
162
205
  },
163
- "gpt-6-astra": {
164
- prompt_per_1k: 0.01,
165
- completion_per_1k: 0.05,
166
- cached_per_1k: 1e-3
206
+ "gpt-5-pro": {
207
+ prompt_per_1k: 0.015,
208
+ completion_per_1k: 0.12,
209
+ cached_per_1k: 0
210
+ },
211
+ "gpt-5.2-pro": {
212
+ prompt_per_1k: 0.021,
213
+ completion_per_1k: 0.168,
214
+ cached_per_1k: 0
215
+ },
216
+ "gpt-5.4-pro": {
217
+ prompt_per_1k: 0.03,
218
+ completion_per_1k: 0.18,
219
+ cached_per_1k: 0
220
+ },
221
+ "gpt-5.5-pro": {
222
+ prompt_per_1k: 0.03,
223
+ completion_per_1k: 0.18,
224
+ cached_per_1k: 0
225
+ },
226
+ "o1-pro": {
227
+ prompt_per_1k: 0.15,
228
+ completion_per_1k: 0.6,
229
+ cached_per_1k: 0
230
+ },
231
+ "o3-pro": {
232
+ prompt_per_1k: 0.02,
233
+ completion_per_1k: 0.08,
234
+ cached_per_1k: 0
167
235
  }
168
236
  },
169
237
  xai: {
@@ -398,20 +466,30 @@ function modelPricing(pricing, provider, model) {
398
466
  const block = pricing[provider];
399
467
  if (!block || typeof block !== "object" || Array.isArray(block)) return null;
400
468
  const table = block;
469
+ if (model.startsWith("_")) return null;
401
470
  let entry = table[model];
402
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
403
- const best = Object.keys(table).filter((k) => model.startsWith(k)).sort((a, b) => b.length - a.length)[0];
404
- entry = best !== void 0 ? table[best] : void 0;
471
+ let match = "exact";
472
+ if (!isRates(entry)) {
473
+ const best = Object.keys(table).filter((k) => !k.startsWith("_")).filter((k) => model.startsWith(k) && DATE_STAMP.test(model.slice(k.length))).sort((a, b) => b.length - a.length)[0];
474
+ if (best !== void 0) {
475
+ entry = table[best];
476
+ match = "stamp";
477
+ }
405
478
  }
406
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) return null;
479
+ if (!isRates(entry)) return null;
407
480
  const e = entry;
408
481
  return {
409
482
  prompt_per_1k: numberOrZero(e["prompt_per_1k"]),
410
483
  completion_per_1k: numberOrZero(e["completion_per_1k"]),
411
484
  cached_per_1k: numberOrZero(e["cached_per_1k"]),
412
- ...e["estimated"] === true ? { estimated: true } : {}
485
+ ...e["estimated"] === true ? { estimated: true } : {},
486
+ match
413
487
  };
414
488
  }
489
+ var DATE_STAMP = /^-\d{8}$/;
490
+ function isRates(v) {
491
+ return Boolean(v) && typeof v === "object" && !Array.isArray(v);
492
+ }
415
493
  function numberOrZero(v) {
416
494
  if (typeof v === "number" && Number.isFinite(v)) return v;
417
495
  if (typeof v === "string") {
@@ -491,8 +569,20 @@ var PROVIDER_CAPS = {
491
569
  gemini: {
492
570
  family: "gemini",
493
571
  system_role: "separate",
494
- supports_temperature: true,
495
- reasoning_prefixes: ["gemini-3.1-pro", "gemini-3.5-flash", "gemini-2.5-pro"]
572
+ // No sampling, on any Gemini model. Ignored since 3.6 Flash and rejected
573
+ // by upcoming models (Google, 2026-10). "model" means "omit for reasoning
574
+ // models", and every Gemini model is reasoning-class (below) — so this
575
+ // resolves to never, through the same rule the other providers use. The
576
+ // adapter also never sends it; this keeps the record honest for anything
577
+ // else that reads it.
578
+ supports_temperature: "model",
579
+ // EVERY Gemini model is reasoning-class. The old list named three
580
+ // families and missed gemini-3.8-flash — the DEFAULT — so the default
581
+ // model got the small non-reasoning budgets (768 tokens for an audit)
582
+ // while spending up to ~480 tokens of each call thinking. Google's docs
583
+ // say thinking cannot be switched off on current models, so a list of
584
+ // which ones think is a list that can only ever be incomplete.
585
+ reasoning_prefixes: ["gemini-"]
496
586
  },
497
587
  // Qwen's "Max" tier (qwen-v3.8, qwen-v3.7) is a standard instruct/chat
498
588
  // model, not a visible-reasoning model like QwQ — normal temperature and
@@ -615,6 +705,73 @@ function httpFailureToProviderError(provider, status, bodyText, retryAfterS, mod
615
705
  );
616
706
  }
617
707
 
708
+ // src/providers/network-errors.ts
709
+ function codeOf(e) {
710
+ if (!e || typeof e !== "object") return null;
711
+ const c = e.code;
712
+ return typeof c === "string" && c.length > 0 ? c : null;
713
+ }
714
+ function rootCause(e, depth = 0) {
715
+ if (depth > 5 || !e || typeof e !== "object") return e;
716
+ const o = e;
717
+ if (Array.isArray(o.errors) && o.errors.length > 0) {
718
+ const coded = o.errors.find((x) => codeOf(x) !== null);
719
+ return rootCause(coded ?? o.errors[0], depth + 1);
720
+ }
721
+ if (o.cause !== void 0 && o.cause !== null) return rootCause(o.cause, depth + 1);
722
+ return e;
723
+ }
724
+ var BY_CODE = {
725
+ ENOTFOUND: { cause: "dns", detail: "the provider's hostname did not resolve \u2014 DNS, or a typo'd base URL", transient: false, kind: "network" },
726
+ EAI_AGAIN: { cause: "dns", detail: "DNS lookup failed temporarily \u2014 resolver or network is flapping", transient: true, kind: "network" },
727
+ ECONNREFUSED: { cause: "refused", detail: "the connection was refused \u2014 nothing is listening, or a proxy blocked it", transient: false, kind: "network" },
728
+ ECONNRESET: { cause: "reset", detail: "the peer closed the connection mid-request \u2014 flaky path, or an upstream error behind a proxy", transient: true, kind: "network" },
729
+ EPIPE: { cause: "reset", detail: "the connection closed while we were still writing", transient: true, kind: "network" },
730
+ ETIMEDOUT: { cause: "connect_timeout", detail: "the connection timed out before it was established", transient: true, kind: "timeout" },
731
+ EHOSTUNREACH: { cause: "unreachable", detail: "no route to the provider \u2014 VPN, or offline", transient: true, kind: "network" },
732
+ ENETUNREACH: { cause: "unreachable", detail: "the network is unreachable \u2014 offline, or a routing change", transient: true, kind: "network" },
733
+ ENETDOWN: { cause: "unreachable", detail: "the local network is down", transient: true, kind: "network" },
734
+ EPROTO: { cause: "tls", detail: "the TLS handshake failed \u2014 an intercepting proxy, or a protocol mismatch", transient: false, kind: "network" },
735
+ ERR_TLS_CERT_ALTNAME_INVALID: { cause: "tls", detail: "the certificate did not match the hostname \u2014 traffic is being intercepted", transient: false, kind: "network" },
736
+ CERT_HAS_EXPIRED: { cause: "tls", detail: "the server certificate has expired, or this machine's clock is wrong", transient: false, kind: "network" },
737
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: { cause: "tls", detail: "the certificate chain could not be verified \u2014 a corporate proxy's root is probably not trusted here", transient: false, kind: "network" },
738
+ UND_ERR_CONNECT_TIMEOUT: { cause: "connect_timeout", detail: "could not open a connection within the timeout \u2014 firewall, or the host is down", transient: true, kind: "timeout" },
739
+ UND_ERR_HEADERS_TIMEOUT: { cause: "read_timeout", detail: "connected, but the provider sent no response headers in time \u2014 it is overloaded or thinking too long", transient: true, kind: "timeout" },
740
+ UND_ERR_BODY_TIMEOUT: { cause: "read_timeout", detail: "the response body stalled mid-stream", transient: true, kind: "timeout" },
741
+ UND_ERR_SOCKET: { cause: "reset", detail: "the socket closed unexpectedly", transient: true, kind: "network" },
742
+ UND_ERR_ABORTED: { cause: "aborted", detail: "the request was cancelled", transient: false, kind: "network" },
743
+ ABORT_ERR: { cause: "aborted", detail: "the request was cancelled", transient: false, kind: "network" }
744
+ };
745
+ function diagnoseNetworkError(e) {
746
+ const root = rootCause(e);
747
+ const code = codeOf(root) ?? codeOf(e);
748
+ if (code && BY_CODE[code]) return { ...BY_CODE[code], code };
749
+ const name = root && typeof root === "object" ? root.name : void 0;
750
+ if (name === "AbortError" || name === "TimeoutError") {
751
+ return {
752
+ cause: name === "TimeoutError" ? "read_timeout" : "aborted",
753
+ code: code ?? String(name),
754
+ detail: name === "TimeoutError" ? "the request exceeded its timeout" : "the request was cancelled",
755
+ transient: name === "TimeoutError",
756
+ kind: name === "TimeoutError" ? "timeout" : "network"
757
+ };
758
+ }
759
+ return {
760
+ cause: "unknown",
761
+ code,
762
+ detail: code ? `the connection failed with ${code}` : "the connection failed and the underlying error carried no code",
763
+ transient: true,
764
+ kind: "network"
765
+ };
766
+ }
767
+ function looksLikeNetworkFailure(d) {
768
+ return d.code !== null || d.cause !== "unknown";
769
+ }
770
+ function networkErrorMessage(provider, d) {
771
+ const code = d.code ? ` [${d.code}]` : "";
772
+ return `${provider}: ${d.detail}${code}`;
773
+ }
774
+
618
775
  // src/providers/retry.ts
619
776
  var override = null;
620
777
  function resolveRetryConfig() {
@@ -937,7 +1094,11 @@ async function sendAnthropic(args) {
937
1094
  try {
938
1095
  respLike = await doFetch(url, init);
939
1096
  } catch (e) {
940
- throw new ProviderError("network", `anthropic: fetch failed: ${e.message}`);
1097
+ const d = diagnoseNetworkError(e);
1098
+ if (!looksLikeNetworkFailure(d)) throw e;
1099
+ throw new ProviderError(d.kind, networkErrorMessage("anthropic", d), {
1100
+ transient: d.transient
1101
+ });
941
1102
  }
942
1103
  const status = respLike.status;
943
1104
  if (status >= 200 && status < 300) {
@@ -1010,6 +1171,11 @@ function jsonSchemaToGeminiSchema(schema) {
1010
1171
  }
1011
1172
  return out;
1012
1173
  }
1174
+ var GEMINI_THINKING_HEADROOM_TOKENS = 16384;
1175
+ function thinkingHeadroom() {
1176
+ const raw = Number(process.env["CROSSCHECK_GEMINI_THINKING_HEADROOM_TOKENS"]);
1177
+ return Number.isFinite(raw) && raw >= 0 ? Math.trunc(raw) : GEMINI_THINKING_HEADROOM_TOKENS;
1178
+ }
1013
1179
  function buildGeminiRequest(opts) {
1014
1180
  const contents = [];
1015
1181
  let systemText = null;
@@ -1028,8 +1194,9 @@ function buildGeminiRequest(opts) {
1028
1194
  const body = {
1029
1195
  contents,
1030
1196
  generationConfig: {
1031
- maxOutputTokens: opts.maxTokens,
1032
- temperature: opts.temperature
1197
+ // Answer budget + thinking headroom. No temperature / topP / topK /
1198
+ // thinkingBudget, on any model — see the header note.
1199
+ maxOutputTokens: opts.maxTokens + thinkingHeadroom()
1033
1200
  }
1034
1201
  };
1035
1202
  if (systemText !== null && systemText !== "") {
@@ -1039,8 +1206,8 @@ function buildGeminiRequest(opts) {
1039
1206
  body.generationConfig.responseMimeType = "application/json";
1040
1207
  body.generationConfig.responseSchema = jsonSchemaToGeminiSchema(opts.jsonSchema);
1041
1208
  }
1042
- const url = `${GEMINI_API_URL_BASE}/${encodeURIComponent(opts.model)}:generateContent?key=${encodeURIComponent(opts.apiKey)}`;
1043
- return { url, headers: {}, body };
1209
+ const url = `${GEMINI_API_URL_BASE}/${encodeURIComponent(opts.model)}:generateContent`;
1210
+ return { url, headers: { "x-goog-api-key": opts.apiKey }, body };
1044
1211
  }
1045
1212
  function parseGeminiResponse(opts) {
1046
1213
  const r = opts.resp ?? {};
@@ -1070,16 +1237,19 @@ function parseGeminiResponse(opts) {
1070
1237
  }
1071
1238
  try {
1072
1239
  const first = cands[0];
1073
- const content = first["content"];
1074
- const parts = content["parts"];
1240
+ const finishReason = typeof first["finishReason"] === "string" ? first["finishReason"] : void 0;
1241
+ const content = first["content"] ?? {};
1242
+ const parts = Array.isArray(content["parts"]) ? content["parts"] : [];
1075
1243
  let text = "";
1076
1244
  for (const p of parts) {
1077
1245
  if (p && typeof p === "object") {
1078
- const t = p["text"];
1246
+ const part = p;
1247
+ if (part["thought"] === true) continue;
1248
+ const t = part["text"];
1079
1249
  if (typeof t === "string") text += t;
1080
1250
  }
1081
1251
  }
1082
- return { text, usage };
1252
+ return { text, usage, ...finishReason ? { finishReason } : {} };
1083
1253
  } catch (e) {
1084
1254
  throw new ProviderError(
1085
1255
  "parse",
@@ -1108,7 +1278,8 @@ async function sendGemini(args) {
1108
1278
  apiKey: args.apiKey,
1109
1279
  messages: args.messages,
1110
1280
  maxTokens: args.maxTokens,
1111
- temperature: args.temperature,
1281
+ // args.temperature is deliberately NOT forwarded: Gemini ignores it and
1282
+ // upcoming models reject it. See the header note.
1112
1283
  ...args.jsonSchema ? { jsonSchema: args.jsonSchema } : {}
1113
1284
  });
1114
1285
  const doFetch = args.fetchImpl ?? globalThis.fetch;
@@ -1123,7 +1294,11 @@ async function sendGemini(args) {
1123
1294
  try {
1124
1295
  respLike = await doFetch(url, init);
1125
1296
  } catch (e) {
1126
- throw new ProviderError("network", `gemini: fetch failed: ${e.message}`);
1297
+ const d = diagnoseNetworkError(e);
1298
+ if (!looksLikeNetworkFailure(d)) throw e;
1299
+ throw new ProviderError(d.kind, networkErrorMessage("gemini", d), {
1300
+ transient: d.transient
1301
+ });
1127
1302
  }
1128
1303
  const status = respLike.status;
1129
1304
  if (status >= 200 && status < 300) {
@@ -1133,11 +1308,18 @@ async function sendGemini(args) {
1133
1308
  } catch (e) {
1134
1309
  throw new ProviderError("parse", `gemini: response body not JSON: ${e.message}`);
1135
1310
  }
1136
- const { text, usage } = parseGeminiResponse({
1311
+ const { text, usage, finishReason } = parseGeminiResponse({
1137
1312
  resp: parsed,
1138
1313
  model: args.model,
1139
1314
  purpose: args.purpose ?? "worker"
1140
1315
  });
1316
+ if (text.trim() === "" && finishReason === "MAX_TOKENS") {
1317
+ throw new ProviderError(
1318
+ "parse",
1319
+ `gemini: the answer was cut off before any visible text \u2014 thinking used the whole output budget (${usage.completion_tokens} tokens). Raise CROSSCHECK_GEMINI_THINKING_HEADROOM_TOKENS or the purpose's budget.`,
1320
+ { transient: false }
1321
+ );
1322
+ }
1141
1323
  return { text, attempts: 1, usage: applyPricing2(usage, args.pricing) };
1142
1324
  }
1143
1325
  const bodyText = await respLike.text().catch(() => "");
@@ -1304,7 +1486,11 @@ async function sendOpenAICompatible(args) {
1304
1486
  try {
1305
1487
  respLike = await doFetch(url, init);
1306
1488
  } catch (e) {
1307
- throw new ProviderError("network", `${args.provider}: fetch failed: ${e.message}`);
1489
+ const d = diagnoseNetworkError(e);
1490
+ if (!looksLikeNetworkFailure(d)) throw e;
1491
+ throw new ProviderError(d.kind, networkErrorMessage(args.provider, d), {
1492
+ transient: d.transient
1493
+ });
1308
1494
  }
1309
1495
  const status = respLike.status;
1310
1496
  if (status >= 200 && status < 300) {
@@ -1332,7 +1518,7 @@ async function sendOpenAICompatible(args) {
1332
1518
  // src/providers/registry.ts
1333
1519
  var DEFAULT_MODELS = {
1334
1520
  anthropic: "claude-opus-5-5",
1335
- openai: "gpt-5.6-sol",
1521
+ openai: "gpt-6-sol",
1336
1522
  xai: "grok-4-latest",
1337
1523
  mistral: "mistral-large-latest",
1338
1524
  groq: "llama-3.3-70b-versatile",
@@ -1478,7 +1664,7 @@ var import_zod = require("zod");
1478
1664
 
1479
1665
  // src/server-meta.ts
1480
1666
  var SERVER_NAME = "crosscheck-agent";
1481
- var SERVER_VERSION = true ? "0.2.26" : "0.0.0-dev";
1667
+ var SERVER_VERSION = true ? "0.2.28" : "0.0.0-dev";
1482
1668
 
1483
1669
  // src/tools/audit.ts
1484
1670
  var import_node_fs4 = require("fs");
@@ -1701,6 +1887,31 @@ function pyReprType(t) {
1701
1887
  return String(t);
1702
1888
  }
1703
1889
 
1890
+ // src/core/session.ts
1891
+ var import_node_crypto = require("crypto");
1892
+ var processSessionId = null;
1893
+ var startedAt = null;
1894
+ function engineSessionId() {
1895
+ if (processSessionId === null) {
1896
+ processSessionId = (0, import_node_crypto.randomUUID)();
1897
+ startedAt = Date.now();
1898
+ }
1899
+ return processSessionId;
1900
+ }
1901
+ function resolveSessionId(callerSupplied) {
1902
+ const trimmed = typeof callerSupplied === "string" ? callerSupplied.trim() : "";
1903
+ return trimmed.length > 0 ? trimmed : engineSessionId();
1904
+ }
1905
+ function localSessionRecordingEnabled(env = globalThis.process?.env ?? {}) {
1906
+ const v = (env["CROSSCHECK_RECORD_SESSIONS"] ?? "").trim().toLowerCase();
1907
+ return !["0", "false", "off", "no"].includes(v);
1908
+ }
1909
+ function recordingSessionId(callerSupplied) {
1910
+ if (localSessionRecordingEnabled()) return resolveSessionId(callerSupplied);
1911
+ const trimmed = typeof callerSupplied === "string" ? callerSupplied.trim() : "";
1912
+ return trimmed.length > 0 ? trimmed : null;
1913
+ }
1914
+
1704
1915
  // src/core/usage.ts
1705
1916
  function emptyUsage(provider, model, purpose = "worker") {
1706
1917
  return {
@@ -1806,11 +2017,11 @@ function withCommas(n) {
1806
2017
  function renderRunSummary(opts) {
1807
2018
  const endedAt = opts.endedAtS ?? Math.trunc(Date.now() / 1e3);
1808
2019
  let scope = "call";
1809
- let startedAt = null;
2020
+ let startedAt2 = null;
1810
2021
  let rows = [];
1811
2022
  if (opts.sessionScope && opts.sessionScope.rows.length > 0) {
1812
2023
  scope = "session";
1813
- startedAt = opts.sessionScope.startedAt;
2024
+ startedAt2 = opts.sessionScope.startedAt;
1814
2025
  rows = opts.sessionScope.rows.map((r) => ({ ...r }));
1815
2026
  } else {
1816
2027
  const byPurpose = /* @__PURE__ */ new Map();
@@ -1841,6 +2052,7 @@ function renderRunSummary(opts) {
1841
2052
  row.cpu_ms += a.cpu_ms ?? 0;
1842
2053
  if (a.cache_hit) row.cache_hits += 1;
1843
2054
  if (a.error) row.errors += 1;
2055
+ if (a.usage?.estimated) row.estimated = true;
1844
2056
  }
1845
2057
  rows = Array.from(byPurpose.values());
1846
2058
  }
@@ -1853,16 +2065,18 @@ function renderRunSummary(opts) {
1853
2065
  wall_ms: rows.reduce((s, r) => s + r.wall_ms, 0),
1854
2066
  cpu_ms: rows.reduce((s, r) => s + r.cpu_ms, 0),
1855
2067
  cache_hits: rows.reduce((s, r) => s + r.cache_hits, 0),
1856
- errors: rows.reduce((s, r) => s + r.errors, 0)
2068
+ errors: rows.reduce((s, r) => s + r.errors, 0),
2069
+ ...rows.some((r) => r.estimated) ? { estimated: true } : {}
1857
2070
  };
1858
2071
  const titleLeft = scope === "session" ? `session: ${opts.sessionId ?? ""}` : `call: ${opts.toolName}`;
1859
- const header = `${titleLeft} (${totals.calls} calls, ${withCommas(totals.total_tokens)} tokens, $${totals.cost_usd.toFixed(4)}, ${(totals.wall_ms / 1e3).toFixed(1)}s wall, ${(totals.cpu_ms / 1e3).toFixed(3)}s cpu)`;
2072
+ const costText = totals.estimated ? `$${totals.cost_usd.toFixed(4)}+ (some calls unpriced)` : `$${totals.cost_usd.toFixed(4)}`;
2073
+ const header = `${titleLeft} (${totals.calls} calls, ${withCommas(totals.total_tokens)} tokens, ${costText}, ${(totals.wall_ms / 1e3).toFixed(1)}s wall, ${(totals.cpu_ms / 1e3).toFixed(3)}s cpu)`;
1860
2074
  const bodyLines = [];
1861
2075
  for (let i = 0; i < rows.length; i++) {
1862
2076
  const r = rows[i];
1863
2077
  const glyph = i === rows.length - 1 ? "`-" : "|-";
1864
2078
  bodyLines.push(
1865
- `${glyph} purpose: ${r.purpose} (calls=${r.calls} tokens=${withCommas(r.total_tokens)} cost=$${r.cost_usd.toFixed(4)} wall=${(r.wall_ms / 1e3).toFixed(1)}s cpu=${(r.cpu_ms / 1e3).toFixed(3)}s)`
2079
+ `${glyph} purpose: ${r.purpose} (calls=${r.calls} tokens=${withCommas(r.total_tokens)} cost=$${r.cost_usd.toFixed(4)}${r.estimated ? "+" : ""} wall=${(r.wall_ms / 1e3).toFixed(1)}s cpu=${(r.cpu_ms / 1e3).toFixed(3)}s)`
1866
2080
  );
1867
2081
  }
1868
2082
  const callByModel = rollupSpendByModel(
@@ -1910,7 +2124,7 @@ function renderRunSummary(opts) {
1910
2124
  tool: opts.toolName,
1911
2125
  scope,
1912
2126
  currency: "USD",
1913
- started_at: startedAt,
2127
+ started_at: startedAt2,
1914
2128
  ended_at: endedAt,
1915
2129
  rows,
1916
2130
  totals,
@@ -2035,14 +2249,15 @@ async function attachUsageBlock(result, answers, opts) {
2035
2249
  delete result["_suppress_run_summary"];
2036
2250
  }
2037
2251
  async function appendUsageLog(storage, sessionId, toolName, answers, nowS) {
2038
- if (!sessionId || answers.length === 0) return;
2252
+ const sid = recordingSessionId(sessionId);
2253
+ if (!sid || answers.length === 0) return;
2039
2254
  const now = nowS ?? Math.trunc(Date.now() / 1e3);
2040
2255
  const rows = [];
2041
2256
  for (const a of answers) {
2042
2257
  const u = a.usage;
2043
2258
  if (!u || typeof u.provider !== "string" || u.provider === "") continue;
2044
2259
  rows.push({
2045
- session_id: sessionId,
2260
+ session_id: sid,
2046
2261
  ts: now,
2047
2262
  tool: toolName,
2048
2263
  purpose: u.purpose ?? "worker",
@@ -2065,13 +2280,14 @@ async function appendUsageLog(storage, sessionId, toolName, answers, nowS) {
2065
2280
  }
2066
2281
  }
2067
2282
  async function recordSessionCall(storage, sessionId, answers, wallMs, cpuMs, nowS) {
2068
- if (!sessionId) return;
2283
+ const sid = recordingSessionId(sessionId);
2284
+ if (!sid) return;
2069
2285
  const now = nowS ?? Math.trunc(Date.now() / 1e3);
2070
2286
  try {
2071
- let existing = await storage.getSession(sessionId);
2287
+ let existing = await storage.getSession(sid);
2072
2288
  if (!existing) {
2073
2289
  await storage.upsertSession({
2074
- session_id: sessionId,
2290
+ session_id: sid,
2075
2291
  started_at: now,
2076
2292
  last_at: now,
2077
2293
  calls: 0,
@@ -2084,7 +2300,7 @@ async function recordSessionCall(storage, sessionId, answers, wallMs, cpuMs, now
2084
2300
  total_cost_usd: 0,
2085
2301
  total_cpu_ms: 0
2086
2302
  });
2087
- existing = await storage.getSession(sessionId);
2303
+ existing = await storage.getSession(sid);
2088
2304
  }
2089
2305
  if (!existing) return;
2090
2306
  let promptDelta = 0;
@@ -2104,7 +2320,7 @@ async function recordSessionCall(storage, sessionId, answers, wallMs, cpuMs, now
2104
2320
  }
2105
2321
  if (a.cache_hit) cacheHitDelta += 1;
2106
2322
  }
2107
- await storage.accumulateSessionTotals(sessionId, {
2323
+ await storage.accumulateSessionTotals(sid, {
2108
2324
  calls: answers.length,
2109
2325
  wall_ms: wallMs,
2110
2326
  cache_hits: cacheHitDelta,
@@ -2486,7 +2702,7 @@ function buildPersonaInjection(opts) {
2486
2702
  }
2487
2703
 
2488
2704
  // src/core/canary.ts
2489
- var import_node_crypto = require("crypto");
2705
+ var import_node_crypto2 = require("crypto");
2490
2706
 
2491
2707
  // src/core/injection.ts
2492
2708
  var INJECTION_PHRASES_RE = new RegExp(
@@ -2504,8 +2720,8 @@ var UNTRUSTED_SYSTEM_NOTE = "Some inputs in this conversation are wrapped in <un
2504
2720
  function mintCanary() {
2505
2721
  const t = process.hrtime.bigint().toString();
2506
2722
  const pid = String(process.pid);
2507
- const r = (0, import_node_crypto.randomBytes)(16).toString("hex");
2508
- const hex = (0, import_node_crypto.createHash)("sha256").update(`${t}-${pid}-${r}`).digest("hex").slice(0, 16).toUpperCase();
2723
+ const r = (0, import_node_crypto2.randomBytes)(16).toString("hex");
2724
+ const hex = (0, import_node_crypto2.createHash)("sha256").update(`${t}-${pid}-${r}`).digest("hex").slice(0, 16).toUpperCase();
2509
2725
  return `CC_CANARY_${hex}`;
2510
2726
  }
2511
2727
  function wrapUntrusted(content, canary) {
@@ -2692,7 +2908,7 @@ var import_node_fs3 = require("fs");
2692
2908
  var import_node_path2 = __toESM(require("path"), 1);
2693
2909
 
2694
2910
  // src/core/redact.ts
2695
- var import_node_crypto2 = require("crypto");
2911
+ var import_node_crypto3 = require("crypto");
2696
2912
  function builtinRedactionRules() {
2697
2913
  return [
2698
2914
  { pattern: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, label: "EMAIL", prefix_group: false },
@@ -2719,7 +2935,7 @@ function hmacSuffix(cfg, label, value) {
2719
2935
  const sid = cfg.session_id ?? "";
2720
2936
  const sidBytes = Buffer.from(sid, "utf8");
2721
2937
  const key = Buffer.concat([Buffer.from(secret), sidBytes]);
2722
- const digest = (0, import_node_crypto2.createHmac)("sha256", key).update(`${label}:${value}`, "utf8").digest("hex");
2938
+ const digest = (0, import_node_crypto3.createHmac)("sha256", key).update(`${label}:${value}`, "utf8").digest("hex");
2723
2939
  return digest.slice(0, 8);
2724
2940
  }
2725
2941
  function redactText(s, cfg) {
@@ -3052,13 +3268,25 @@ function numberOrNull(v) {
3052
3268
  var import_node_perf_hooks = require("perf_hooks");
3053
3269
 
3054
3270
  // src/core/co-reason.ts
3055
- var CO_REASON_MODEL = "gpt-5.6-sol";
3271
+ var CO_REASON_MODEL = "gpt-6-sol";
3272
+ var CO_REASON_ALTERNATE = "gpt-6-astra";
3273
+ var LABELS = {
3274
+ "gpt-6-sol": "GPT-6 Sol",
3275
+ "gpt-6-astra": "GPT-6 Astra",
3276
+ "gpt-5.6-sol": "GPT-5.6 Sol"
3277
+ };
3278
+ function coReasonLabel(model) {
3279
+ return LABELS[model] ?? model;
3280
+ }
3281
+ var CO_REASON_LABEL = coReasonLabel(CO_REASON_MODEL);
3056
3282
  var CO_REASON_PROVIDER = "openai";
3057
- var CO_REASON_LABEL = "GPT-5.6";
3058
- function pickCoReasoner(providers, upgradeRequested) {
3283
+ function pickCoReasoner(providers, upgradeRequested, openAiSeatModel) {
3059
3284
  if (!upgradeRequested) return null;
3060
3285
  const base = providers[CO_REASON_PROVIDER];
3061
- return base ? retargetProvider(base, CO_REASON_MODEL) : null;
3286
+ if (!base) return null;
3287
+ const seat = openAiSeatModel ?? base.model;
3288
+ const model = seat === CO_REASON_MODEL ? CO_REASON_ALTERNATE : CO_REASON_MODEL;
3289
+ return retargetProvider(base, model);
3062
3290
  }
3063
3291
  async function coReasonThenInject(opts) {
3064
3292
  const { provider, messages, maxTokens } = opts;
@@ -3284,7 +3512,7 @@ function buildSuggestedUpgrade(toolName, assessment) {
3284
3512
  model: UPGRADE_MODEL,
3285
3513
  label: UPGRADE_LABEL,
3286
3514
  reason: assessment.reason,
3287
- how: `re-run \`${toolName}\` with reasoning:"max" (or upgrade:true) to route the lead reasoning seat to ${UPGRADE_LABEL}, and \u2014 when an OpenAI key is configured \u2014 add a GPT-5.6 second-opinion pass that ${UPGRADE_LABEL} weighs before finalizing. Other panel seats stay on their normal models.`
3515
+ how: `re-run \`${toolName}\` with reasoning:"max" (or upgrade:true) to route the lead reasoning seat to ${UPGRADE_LABEL}, and \u2014 when an OpenAI key is configured \u2014 add an OpenAI second-opinion pass that ${UPGRADE_LABEL} weighs before finalizing (the result names which model ran). Other panel seats stay on their normal models.`
3288
3516
  };
3289
3517
  }
3290
3518
 
@@ -3587,8 +3815,9 @@ ${rubricText}`;
3587
3815
  const upgradeRequested = isUpgradeRequested(args);
3588
3816
  const upgraded = upgradeRequested && opts.providers["anthropic"] !== void 0;
3589
3817
  const auditorForCall = upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : auditor;
3818
+ const coProvider = pickCoReasoner(opts.providers, upgradeRequested);
3590
3819
  const coReason = await coReasonThenInject({
3591
- provider: pickCoReasoner(opts.providers, upgradeRequested),
3820
+ provider: coProvider,
3592
3821
  messages: msgs,
3593
3822
  maxTokens: 2048,
3594
3823
  purpose: "audit-coreason"
@@ -3672,7 +3901,7 @@ ${rubricText}`;
3672
3901
  model: UPGRADE_MODEL,
3673
3902
  label: UPGRADE_LABEL,
3674
3903
  seat: "auditor",
3675
- ...coReasoned ? { co_reasoner: { model: CO_REASON_MODEL, label: CO_REASON_LABEL } } : {}
3904
+ ...coReasoned ? { co_reasoner: { model: coProvider.model, label: coReasonLabel(coProvider.model) } } : {}
3676
3905
  };
3677
3906
  } else if (upgradeRequested) {
3678
3907
  result["reasoning_upgrade"] = {
@@ -4403,8 +4632,12 @@ var SUPER_MODELS = {
4403
4632
  // Fable 5.1 verified present on the account; 5 as the fallback for accounts
4404
4633
  // that haven't been granted 5.1 yet.
4405
4634
  anthropic: ["claude-fable-5-1", UPGRADE_MODEL],
4406
- // Astra when it exists; gpt-5.6 until then. See the note above.
4407
- openai: ["gpt-6-astra", CO_REASON_MODEL],
4635
+ // Astra is live (verified against the account's model list 2026-09-23).
4636
+ // The fallback is named explicitly rather than reusing CO_REASON_MODEL:
4637
+ // that constant means "OpenAI's top reasoning model" for the max-reasoning
4638
+ // co-reasoner, which is a different question from "what should super fall
4639
+ // back to". Sharing the symbol silently coupled two unrelated decisions.
4640
+ openai: ["gpt-6-astra", "gpt-6-sol"],
4408
4641
  // Explicitly left as-is per product decision. Note grok-4-latest is not in
4409
4642
  // xAI's published model list, but it resolves in practice — real panel calls
4410
4643
  // on it succeeded as recently as 2026-08-30 — so it is an unlisted alias
@@ -5019,10 +5252,6 @@ If you need supporting evidence, you may emit ONE \`<tool_call>...</tool_call>\`
5019
5252
  }
5020
5253
 
5021
5254
  // src/tools/confer.ts
5022
- var DEFERRED_OPTS = [
5023
- // empty — every confer opt runs natively except worker_tools, which
5024
- // is gated below (non-empty list → defer).
5025
- ];
5026
5255
  async function runConfer(args, opts) {
5027
5256
  const callStartedWall = import_node_perf_hooks2.performance.now();
5028
5257
  const callStartedCpu = process.cpuUsage();
@@ -5038,16 +5267,11 @@ async function runConfer(args, opts) {
5038
5267
  rejectedWorkerTools.push(t);
5039
5268
  }
5040
5269
  }
5041
- const workerToolsNeedsBridge = acceptedWorkerTools.length > 0 && !opts.innerCallers;
5042
- const needsBridge = DEFERRED_OPTS.some((k) => Boolean(args[k])) || workerToolsNeedsBridge;
5043
- if (needsBridge) {
5044
- if (opts.bridge && opts.bridge.toolNames.has("confer")) {
5045
- return await deferConfer(args, opts.bridge);
5046
- }
5270
+ if (acceptedWorkerTools.length > 0 && !opts.innerCallers) {
5047
5271
  return errorEnvelope2(
5048
5272
  "CONFER_OPT_NOT_NATIVE",
5049
5273
  "worker_tools requested but innerCallers are not wired",
5050
- "Native confer covers untrusted_input + early_stop + extract_claims + inject_session_memory + auto_panel. worker_tools needs innerCallers wired by the host (or CROSSCHECK_BRIDGE_PYTHON=1 as a backstop)."
5274
+ "Native confer covers untrusted_input + early_stop + extract_claims + inject_session_memory + auto_panel. worker_tools needs innerCallers wired by the host."
5051
5275
  );
5052
5276
  }
5053
5277
  const question = typeof args["question"] === "string" ? args["question"] : String(args["question"] ?? "");
@@ -5398,21 +5622,6 @@ function unknownProviderError(unknownNames, available) {
5398
5622
  available_now: Object.keys(available).sort()
5399
5623
  };
5400
5624
  }
5401
- async function deferConfer(args, bridge) {
5402
- const r = await bridge.callTool("confer", args);
5403
- const text = r.content[0]?.text;
5404
- if (typeof text === "string") {
5405
- try {
5406
- return JSON.parse(text);
5407
- } catch {
5408
- }
5409
- }
5410
- return errorEnvelope2(
5411
- "CONFER_BRIDGE_BAD_ENVELOPE",
5412
- "bridge returned an unparseable envelope for confer",
5413
- "Check that the Python child is healthy."
5414
- );
5415
- }
5416
5625
  function errorEnvelope2(code, message, hint) {
5417
5626
  return {
5418
5627
  tool: "confer",
@@ -5784,7 +5993,7 @@ function errorEnvelope3(code, message, hint) {
5784
5993
  transient: false
5785
5994
  };
5786
5995
  }
5787
- async function runVerify(args, bridge, fetchConfig) {
5996
+ async function runVerify(args, fetchConfig) {
5788
5997
  const checks = args["checks"];
5789
5998
  if (!Array.isArray(checks) || checks.length === 0) {
5790
5999
  return {
@@ -5796,7 +6005,6 @@ async function runVerify(args, bridge, fetchConfig) {
5796
6005
  )
5797
6006
  };
5798
6007
  }
5799
- void bridge;
5800
6008
  const allowShell = Boolean(args["allow_shell"] ?? false);
5801
6009
  const wallStart = import_node_perf_hooks3.performance.now();
5802
6010
  const cpuStart = process.cpuUsage();
@@ -6098,7 +6306,6 @@ async function runBench(args, opts) {
6098
6306
  const innerOpts = {
6099
6307
  providers: opts.providers,
6100
6308
  allowlist: opts.allowlist ?? null,
6101
- ...opts.bridge ? { bridge: opts.bridge } : {},
6102
6309
  ...opts.moderator ? { moderator: opts.moderator } : {}
6103
6310
  };
6104
6311
  let inner;
@@ -6310,7 +6517,7 @@ function isObj4(v) {
6310
6517
  }
6311
6518
 
6312
6519
  // src/tools/config-pin.ts
6313
- var import_node_crypto3 = require("crypto");
6520
+ var import_node_crypto4 = require("crypto");
6314
6521
  var import_node_fs6 = require("fs");
6315
6522
  var import_node_path6 = __toESM(require("path"), 1);
6316
6523
  var DEFAULT_PIN_PATH = ".crosscheck/config_pins.json";
@@ -6465,7 +6672,7 @@ function hashFile(abs) {
6465
6672
  return "";
6466
6673
  }
6467
6674
  const normalized = stripCrBeforeLf(raw);
6468
- return "sha256:" + (0, import_node_crypto3.createHash)("sha256").update(normalized).digest("hex");
6675
+ return "sha256:" + (0, import_node_crypto4.createHash)("sha256").update(normalized).digest("hex");
6469
6676
  }
6470
6677
  function stripCrBeforeLf(buf) {
6471
6678
  const out = [];
@@ -6542,7 +6749,7 @@ function pyRepr2(v) {
6542
6749
  }
6543
6750
 
6544
6751
  // src/tools/create.ts
6545
- var import_node_crypto6 = require("crypto");
6752
+ var import_node_crypto7 = require("crypto");
6546
6753
  var import_node_fs9 = require("fs");
6547
6754
  var import_node_path9 = __toESM(require("path"), 1);
6548
6755
 
@@ -6628,7 +6835,7 @@ function isDeadModelError(err) {
6628
6835
  }
6629
6836
 
6630
6837
  // src/core/node-cache.ts
6631
- var import_node_crypto4 = require("crypto");
6838
+ var import_node_crypto5 = require("crypto");
6632
6839
  var import_node_fs7 = require("fs");
6633
6840
  var import_node_path7 = require("path");
6634
6841
  var NODE_CACHE_KEY_VERSION = "v2";
@@ -6655,7 +6862,7 @@ function canonicalizeNodeText(s) {
6655
6862
  return out;
6656
6863
  }
6657
6864
  function sha256Hex(s) {
6658
- return (0, import_node_crypto4.createHash)("sha256").update(s, "utf8").digest("hex");
6865
+ return (0, import_node_crypto5.createHash)("sha256").update(s, "utf8").digest("hex");
6659
6866
  }
6660
6867
  function nodeCacheKey(node, upstreamOutputs, provider, model) {
6661
6868
  const canonUpstream = {};
@@ -6775,7 +6982,6 @@ var EST_TOKENS = {
6775
6982
  med: [1500, 800],
6776
6983
  high: [2500, 1500]
6777
6984
  };
6778
- var DEFERRED_OPTS2 = [];
6779
6985
  var REACTIVE_SIGNAL_RE = /<signals>\s*(\{[\s\S]*?\})\s*<\/signals>/g;
6780
6986
  function parseReactiveSignals(output) {
6781
6987
  if (typeof output !== "string" || !output.includes("<signals>")) return [];
@@ -6815,17 +7021,6 @@ async function runOrchestrate(args, opts) {
6815
7021
  );
6816
7022
  if (breakerEnv) return breakerEnv;
6817
7023
  }
6818
- const needsBridge = DEFERRED_OPTS2.some((k) => Boolean(args[k]));
6819
- if (needsBridge) {
6820
- if (opts.bridge && opts.bridge.toolNames.has("orchestrate")) {
6821
- return await deferOrchestrate(args, opts.bridge);
6822
- }
6823
- return errorEnvelope5(
6824
- "ORCHESTRATE_OPT_NOT_NATIVE",
6825
- "this orchestrate opt-in requires the Python bridge in v1",
6826
- "v1 native covers the plain DAG flow + cheap_mode. reactive (mid-flight DAG updates) still defers. Set CROSSCHECK_BRIDGE_PYTHON=1 to enable."
6827
- );
6828
- }
6829
7024
  const goal = typeof args["goal"] === "string" ? args["goal"] : null;
6830
7025
  const dagIn = isObj5(args["dag"]) ? args["dag"] : null;
6831
7026
  if (goal === null === (dagIn === null)) {
@@ -7368,8 +7563,9 @@ ${recombineSys}` : recombineSys },
7368
7563
  provider: synthProvider.name
7369
7564
  } }
7370
7565
  );
7566
+ const coProvider = pickCoReasoner(opts.providers, upgradeRequested);
7371
7567
  const coReason = await coReasonThenInject({
7372
- provider: pickCoReasoner(opts.providers, upgradeRequested),
7568
+ provider: coProvider,
7373
7569
  messages: recMsgs,
7374
7570
  maxTokens,
7375
7571
  purpose: "orchestrate-coreason"
@@ -7428,7 +7624,7 @@ ${recombineSys}` : recombineSys },
7428
7624
  model: UPGRADE_MODEL,
7429
7625
  label: UPGRADE_LABEL,
7430
7626
  seat: "recombine/synthesis",
7431
- ...coReasoned ? { co_reasoner: { model: CO_REASON_MODEL, label: CO_REASON_LABEL } } : {}
7627
+ ...coReasoned ? { co_reasoner: { model: coProvider.model, label: coReasonLabel(coProvider.model) } } : {}
7432
7628
  };
7433
7629
  } else if (upgradeRequested) {
7434
7630
  result["reasoning_upgrade"] = {
@@ -7766,21 +7962,6 @@ function resolveProviders3(names, available, allowlist) {
7766
7962
  }
7767
7963
  return out;
7768
7964
  }
7769
- async function deferOrchestrate(args, bridge) {
7770
- const r = await bridge.callTool("orchestrate", args);
7771
- const text = r.content[0]?.text;
7772
- if (typeof text === "string") {
7773
- try {
7774
- return JSON.parse(text);
7775
- } catch {
7776
- }
7777
- }
7778
- return errorEnvelope5(
7779
- "ORCHESTRATE_BRIDGE_BAD_ENVELOPE",
7780
- "bridge returned an unparseable envelope for orchestrate",
7781
- "Check that the Python child is healthy."
7782
- );
7783
- }
7784
7965
  function errorEnvelope5(code, message, hint, kind = "client") {
7785
7966
  return {
7786
7967
  tool: "orchestrate",
@@ -7828,7 +8009,7 @@ function pyRound6(x) {
7828
8009
  }
7829
8010
 
7830
8011
  // src/tools/fetch.ts
7831
- var import_node_crypto5 = require("crypto");
8012
+ var import_node_crypto6 = require("crypto");
7832
8013
  var import_node_fs8 = require("fs");
7833
8014
  var import_node_path8 = __toESM(require("path"), 1);
7834
8015
  var DEFAULT_CONFIG = {
@@ -8042,10 +8223,10 @@ function extractHost(url) {
8042
8223
  }
8043
8224
  }
8044
8225
  function sha256Hex2(s) {
8045
- return (0, import_node_crypto5.createHash)("sha256").update(s, "utf8").digest("hex");
8226
+ return (0, import_node_crypto6.createHash)("sha256").update(s, "utf8").digest("hex");
8046
8227
  }
8047
8228
  function sha256HexBytes(bytes) {
8048
- return (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex");
8229
+ return (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex");
8049
8230
  }
8050
8231
  function resolveEvidenceDir(configured, repoRoot) {
8051
8232
  if (import_node_path8.default.isAbsolute(configured)) return configured;
@@ -8143,7 +8324,6 @@ ${documentsPayload}`;
8143
8324
  }, {
8144
8325
  providers: opts.providers,
8145
8326
  allowlist: opts.allowlist ?? null,
8146
- ...opts.bridge ? { bridge: opts.bridge } : {},
8147
8327
  ctx
8148
8328
  });
8149
8329
  const scopeAnswer = Array.isArray(scope["answers"]) ? scope["answers"].filter((a) => typeof a["response"] === "string" && a["response"]).map((a) => `[${a["provider"]}]
@@ -8166,7 +8346,6 @@ ${scopeAnswer || "(none)"}
8166
8346
  providers: opts.providers,
8167
8347
  allowlist: opts.allowlist ?? null,
8168
8348
  moderator,
8169
- ...opts.bridge ? { bridge: opts.bridge } : {},
8170
8349
  ctx
8171
8350
  });
8172
8351
  let attempts = 1;
@@ -8201,7 +8380,6 @@ ${scopeAnswer || "(none)"}
8201
8380
  }, {
8202
8381
  providers: opts.providers,
8203
8382
  allowlist: opts.allowlist ?? null,
8204
- ...opts.bridge ? { bridge: opts.bridge } : {},
8205
8383
  ctx
8206
8384
  });
8207
8385
  }
@@ -8224,7 +8402,6 @@ ${scopeAnswer || "(none)"}
8224
8402
  }, {
8225
8403
  providers: opts.providers,
8226
8404
  allowlist: opts.allowlist ?? null,
8227
- ...opts.bridge ? { bridge: opts.bridge } : {},
8228
8405
  ctx
8229
8406
  });
8230
8407
  let overallF = toNumberOrNull(auditEnvelope["overall_score"]);
@@ -8249,7 +8426,6 @@ ${documentsPayload}`
8249
8426
  providers: opts.providers,
8250
8427
  allowlist: opts.allowlist ?? null,
8251
8428
  moderator,
8252
- ...opts.bridge ? { bridge: opts.bridge } : {},
8253
8429
  ctx
8254
8430
  }
8255
8431
  );
@@ -8269,7 +8445,6 @@ ${documentsPayload}`
8269
8445
  }, {
8270
8446
  providers: opts.providers,
8271
8447
  allowlist: opts.allowlist ?? null,
8272
- ...opts.bridge ? { bridge: opts.bridge } : {},
8273
8448
  ctx
8274
8449
  });
8275
8450
  overallF = toNumberOrNull(auditEnvelope["overall_score"]);
@@ -8406,7 +8581,7 @@ async function ingestDocuments(documents, sessionId, opts) {
8406
8581
  source: ref,
8407
8582
  type: "file",
8408
8583
  status: "ok",
8409
- hash: (0, import_node_crypto6.createHash)("sha256").update(text, "utf8").digest("hex"),
8584
+ hash: (0, import_node_crypto7.createHash)("sha256").update(text, "utf8").digest("hex"),
8410
8585
  content: ""
8411
8586
  }, text));
8412
8587
  }
@@ -8443,7 +8618,7 @@ ${d.content}
8443
8618
  function makeSessionId(opts, supplied) {
8444
8619
  if (typeof supplied === "string" && supplied) return supplied;
8445
8620
  const stamp = opts.nowEpochSeconds ? opts.nowEpochSeconds() : Math.floor(Date.now() / 1e3);
8446
- const rnd = opts.randomBytes ? opts.randomBytes() : (0, import_node_crypto6.createHash)("sha256").update(`${stamp}-${process.pid}-${Math.random()}`).digest("hex");
8621
+ const rnd = opts.randomBytes ? opts.randomBytes() : (0, import_node_crypto7.createHash)("sha256").update(`${stamp}-${process.pid}-${Math.random()}`).digest("hex");
8447
8622
  const suffix = rnd.slice(0, 8);
8448
8623
  return `${opts.toolName}-${stamp}-${suffix}`;
8449
8624
  }
@@ -8507,11 +8682,6 @@ function errorEnvelope6(toolName, code, message, hint) {
8507
8682
 
8508
8683
  // src/tools/coordinate.ts
8509
8684
  var import_node_perf_hooks7 = require("perf_hooks");
8510
- var DEFERRED_OPTS3 = [
8511
- // empty — every coordinate opt runs natively when its deps
8512
- // (storage / innerCallers) are wired. Without them the
8513
- // worker_tools gate still triggers a bridge defer.
8514
- ];
8515
8685
  var COORDINATE_DEFAULT_TEMP = 0.4;
8516
8686
  var ROLE_TURN_SCHEMA = {
8517
8687
  type: "object",
@@ -8566,23 +8736,18 @@ async function runCoordinate(args, opts) {
8566
8736
  rejectedWorkerTools.push(t);
8567
8737
  }
8568
8738
  }
8569
- const workerToolsNeedsBridge = acceptedWorkerTools.length > 0 && !opts.innerCallers;
8570
- const needsBridge = DEFERRED_OPTS3.some((k) => Boolean(args[k])) || workerToolsNeedsBridge;
8571
- if (needsBridge) {
8739
+ if (acceptedWorkerTools.length > 0 && !opts.innerCallers) {
8572
8740
  if (superRequested) {
8573
8741
  return errorEnvelope7(
8574
8742
  "COORDINATE_SUPER_NOT_NATIVE",
8575
- "super mode requested but worker_tools needs the Python bridge",
8576
- "worker_tools without innerCallers wired defers to the Python bridge, which doesn't support super mode. Drop worker_tools, or wire innerCallers, to use super."
8743
+ "super mode requested with worker_tools, but innerCallers are not wired",
8744
+ "worker_tools needs innerCallers wired by the host. Drop worker_tools, or wire innerCallers, to use super."
8577
8745
  );
8578
8746
  }
8579
- if (opts.bridge && opts.bridge.toolNames.has("coordinate")) {
8580
- return await deferCoordinate(args, opts.bridge);
8581
- }
8582
8747
  return errorEnvelope7(
8583
8748
  "COORDINATE_OPT_NOT_NATIVE",
8584
8749
  "worker_tools requested but innerCallers are not wired",
8585
- "Native coordinate covers the three-role flow + untrusted_input + inject_session_memory. worker_tools needs innerCallers wired by the host (or CROSSCHECK_BRIDGE_PYTHON=1 as a backstop)."
8750
+ "Native coordinate covers the three-role flow + untrusted_input + inject_session_memory. worker_tools needs innerCallers wired by the host."
8586
8751
  );
8587
8752
  }
8588
8753
  const untrusted = Boolean(args["untrusted_input"]);
@@ -8774,8 +8939,9 @@ CRITIQUES:
8774
8939
  ${critiqueBlock}`
8775
8940
  }
8776
8941
  ];
8942
+ const coProvider = pickCoReasoner(opts.providers, upgradeRequested);
8777
8943
  const coReason = await coReasonThenInject({
8778
- provider: pickCoReasoner(opts.providers, upgradeRequested),
8944
+ provider: coProvider,
8779
8945
  messages: synthMessages,
8780
8946
  maxTokens,
8781
8947
  purpose: "coordinate-coreason"
@@ -8839,7 +9005,7 @@ ${critiqueBlock}`
8839
9005
  model: superRequested ? superPrimary("anthropic") ?? UPGRADE_MODEL : UPGRADE_MODEL,
8840
9006
  label: UPGRADE_LABEL,
8841
9007
  seat: "synthesizer",
8842
- ...coReasonAns ? { co_reasoner: { model: CO_REASON_MODEL, label: CO_REASON_LABEL } } : {}
9008
+ ...coReasonAns ? { co_reasoner: { model: coProvider.model, label: coReasonLabel(coProvider.model) } } : {}
8843
9009
  };
8844
9010
  } else if (upgradeRequested) {
8845
9011
  result["reasoning_upgrade"] = {
@@ -8981,21 +9147,6 @@ function unknownProviderError3(unknownNames, available) {
8981
9147
  available_now: Object.keys(available).sort()
8982
9148
  };
8983
9149
  }
8984
- async function deferCoordinate(args, bridge) {
8985
- const r = await bridge.callTool("coordinate", args);
8986
- const text = r.content[0]?.text;
8987
- if (typeof text === "string") {
8988
- try {
8989
- return JSON.parse(text);
8990
- } catch {
8991
- }
8992
- }
8993
- return errorEnvelope7(
8994
- "COORDINATE_BRIDGE_BAD_ENVELOPE",
8995
- "bridge returned an unparseable envelope for coordinate",
8996
- "Check that the Python child is healthy."
8997
- );
8998
- }
8999
9150
  function errorEnvelope7(code, message, hint) {
9000
9151
  return {
9001
9152
  tool: "coordinate",
@@ -9323,10 +9474,6 @@ function buildModeratorTranscript(transcript) {
9323
9474
 
9324
9475
  // src/tools/debate.ts
9325
9476
  var import_node_perf_hooks9 = require("perf_hooks");
9326
- var DEFERRED_OPTS4 = [
9327
- // empty — every debate opt runs natively when its deps
9328
- // (storage / innerCallers) are wired.
9329
- ];
9330
9477
  async function runDebate(args, opts) {
9331
9478
  const callStartedWall = import_node_perf_hooks9.performance.now();
9332
9479
  const callStartedCpu = process.cpuUsage();
@@ -9344,23 +9491,18 @@ async function runDebate(args, opts) {
9344
9491
  rejectedWorkerTools.push(t);
9345
9492
  }
9346
9493
  }
9347
- const workerToolsNeedsBridge = acceptedWorkerTools.length > 0 && !opts.innerCallers;
9348
- const needsBridge = DEFERRED_OPTS4.some((k) => Boolean(args[k])) || workerToolsNeedsBridge;
9349
- if (needsBridge) {
9494
+ if (acceptedWorkerTools.length > 0 && !opts.innerCallers) {
9350
9495
  if (superRequested) {
9351
9496
  return errorEnvelope9(
9352
9497
  "DEBATE_SUPER_NOT_NATIVE",
9353
- "super mode requested but worker_tools needs the Python bridge",
9354
- "worker_tools without innerCallers wired defers to the Python bridge, which doesn't support super mode. Drop worker_tools, or wire innerCallers, to use super."
9498
+ "super mode requested with worker_tools, but innerCallers are not wired",
9499
+ "worker_tools needs innerCallers wired by the host. Drop worker_tools, or wire innerCallers, to use super."
9355
9500
  );
9356
9501
  }
9357
- if (opts.bridge && opts.bridge.toolNames.has("debate")) {
9358
- return await deferDebate(args, opts.bridge);
9359
- }
9360
9502
  return errorEnvelope9(
9361
9503
  "DEBATE_OPT_NOT_NATIVE",
9362
9504
  "worker_tools requested but innerCallers are not wired",
9363
- "Native debate covers N-round + plain/structured moderator synthesis + inject_session_memory + auto_panel + extract_claims + early_stop. worker_tools needs innerCallers wired by the host (or CROSSCHECK_BRIDGE_PYTHON=1 as a backstop)."
9505
+ "Native debate covers N-round + plain/structured moderator synthesis + inject_session_memory + auto_panel + extract_claims + early_stop. worker_tools needs innerCallers wired by the host."
9364
9506
  );
9365
9507
  }
9366
9508
  const topic = typeof args["topic"] === "string" ? args["topic"] : String(args["topic"] ?? "");
@@ -9561,6 +9703,7 @@ ${prior.body}` });
9561
9703
  let synthesisErrors = [];
9562
9704
  let personaMeta = null;
9563
9705
  let coReasoned = false;
9706
+ let coReasonerModel = null;
9564
9707
  if (moderator) {
9565
9708
  const synthProvider = superRequested && opts.providers["anthropic"] ? retargetForSuper(opts.providers["anthropic"]) : upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : moderator;
9566
9709
  const condensed = buildModeratorTranscript(transcript);
@@ -9588,13 +9731,16 @@ TRANSCRIPT:
9588
9731
  ${condensed}`
9589
9732
  }
9590
9733
  ];
9734
+ const openAiSeat = selected.find((p) => p.name === "openai")?.model;
9735
+ const coProvider = pickCoReasoner(opts.providers, upgradeRequested, openAiSeat);
9591
9736
  const coReason = await coReasonThenInject({
9592
- provider: pickCoReasoner(opts.providers, upgradeRequested),
9737
+ provider: coProvider,
9593
9738
  messages: synthMessages,
9594
9739
  maxTokens,
9595
9740
  purpose: "debate-coreason"
9596
9741
  });
9597
9742
  synthMessages = coReason.messages;
9743
+ coReasonerModel = coProvider?.model ?? null;
9598
9744
  if (coReason.answer) extraAnswers.push(coReason.answer);
9599
9745
  coReasoned = coReason.answer !== null;
9600
9746
  if (structuredOpt) {
@@ -9653,7 +9799,7 @@ ${condensed}`
9653
9799
  model: superRequested ? superPrimary("anthropic") ?? UPGRADE_MODEL : UPGRADE_MODEL,
9654
9800
  label: UPGRADE_LABEL,
9655
9801
  seat: "moderator synthesis",
9656
- ...coReasoned ? { co_reasoner: { model: CO_REASON_MODEL, label: CO_REASON_LABEL } } : {}
9802
+ ...coReasoned && coReasonerModel ? { co_reasoner: { model: coReasonerModel, label: coReasonLabel(coReasonerModel) } } : {}
9657
9803
  };
9658
9804
  } else if (upgradeRequested) {
9659
9805
  result["reasoning_upgrade"] = {
@@ -9793,21 +9939,6 @@ function unknownProviderError5(unknownNames, available) {
9793
9939
  available_now: Object.keys(available).sort()
9794
9940
  };
9795
9941
  }
9796
- async function deferDebate(args, bridge) {
9797
- const r = await bridge.callTool("debate", args);
9798
- const text = r.content[0]?.text;
9799
- if (typeof text === "string") {
9800
- try {
9801
- return JSON.parse(text);
9802
- } catch {
9803
- }
9804
- }
9805
- return errorEnvelope9(
9806
- "DEBATE_BRIDGE_BAD_ENVELOPE",
9807
- "bridge returned an unparseable envelope for debate",
9808
- "Check that the Python child is healthy."
9809
- );
9810
- }
9811
9942
  function errorEnvelope9(code, message, hint) {
9812
9943
  return {
9813
9944
  tool: "debate",
@@ -9827,9 +9958,6 @@ var DEFAULT_DELEGATION_LIMITS = {
9827
9958
  };
9828
9959
  async function runDelegate(args, opts) {
9829
9960
  if (!opts.storage) {
9830
- if (opts.bridge && opts.bridge.toolNames.has("delegate")) {
9831
- return await deferDelegate(args, opts.bridge);
9832
- }
9833
9961
  return errorEnvelope10(
9834
9962
  "DELEGATE_STORAGE_UNAVAILABLE",
9835
9963
  "delegate needs the local database (for quota tracking), which isn't available",
@@ -9901,7 +10029,6 @@ async function runDelegate(args, opts) {
9901
10029
  const innerOpts = {
9902
10030
  providers: opts.providers,
9903
10031
  allowlist: opts.allowlist ?? null,
9904
- ...opts.bridge ? { bridge: opts.bridge } : {},
9905
10032
  ...opts.moderator ? { moderator: opts.moderator } : {}
9906
10033
  };
9907
10034
  let result;
@@ -9940,21 +10067,6 @@ async function record(storage, sessionId, requester, toolCall, via, accepted, no
9940
10067
  created_at: nowEpochSeconds
9941
10068
  });
9942
10069
  }
9943
- async function deferDelegate(args, bridge) {
9944
- const r = await bridge.callTool("delegate", args);
9945
- const text = r.content[0]?.text;
9946
- if (typeof text === "string") {
9947
- try {
9948
- return JSON.parse(text);
9949
- } catch {
9950
- }
9951
- }
9952
- return errorEnvelope10(
9953
- "DELEGATE_BRIDGE_BAD_ENVELOPE",
9954
- "bridge returned an unparseable envelope for delegate",
9955
- "Check that the Python child is healthy."
9956
- );
9957
- }
9958
10070
  function errorEnvelope10(code, message, hint) {
9959
10071
  return {
9960
10072
  tool: "delegate",
@@ -9997,9 +10109,6 @@ async function runExplain(args, opts) {
9997
10109
  );
9998
10110
  }
9999
10111
  if (!opts.storage) {
10000
- if (opts.bridge && opts.bridge.toolNames.has("explain")) {
10001
- return await deferExplain(args, opts.bridge);
10002
- }
10003
10112
  return errorEnvelope11(
10004
10113
  "EXPLAIN_STORAGE_UNAVAILABLE",
10005
10114
  "explain needs the local transcript/stats database, which isn't available",
@@ -10281,21 +10390,6 @@ function pyRepr5(v) {
10281
10390
  }
10282
10391
  return String(v);
10283
10392
  }
10284
- async function deferExplain(args, bridge) {
10285
- const r = await bridge.callTool("explain", args);
10286
- const text = r.content[0]?.text;
10287
- if (typeof text === "string") {
10288
- try {
10289
- return JSON.parse(text);
10290
- } catch {
10291
- }
10292
- }
10293
- return errorEnvelope11(
10294
- "EXPLAIN_BRIDGE_BAD_ENVELOPE",
10295
- "bridge returned an unparseable envelope for explain",
10296
- "Check that the Python child is healthy."
10297
- );
10298
- }
10299
10393
  function errorEnvelope11(code, message, hint, kind = "client", extra = {}) {
10300
10394
  return {
10301
10395
  tool: "explain",
@@ -10848,9 +10942,6 @@ async function runRecall(args, opts) {
10848
10942
  if (k < 1) k = 1;
10849
10943
  if (k > 50) k = 50;
10850
10944
  if (!opts.storage) {
10851
- if (opts.bridge && opts.bridge.toolNames.has("recall")) {
10852
- return await deferRecall(args, opts.bridge);
10853
- }
10854
10945
  return errorEnvelope12(
10855
10946
  "RECALL_STORAGE_UNAVAILABLE",
10856
10947
  "recall needs the local database, which isn't available",
@@ -10903,21 +10994,6 @@ async function runRecall(args, opts) {
10903
10994
  applied_filters: applied
10904
10995
  };
10905
10996
  }
10906
- async function deferRecall(args, bridge) {
10907
- const r = await bridge.callTool("recall", args);
10908
- const text = r.content[0]?.text;
10909
- if (typeof text === "string") {
10910
- try {
10911
- return JSON.parse(text);
10912
- } catch {
10913
- }
10914
- }
10915
- return errorEnvelope12(
10916
- "RECALL_BRIDGE_BAD_ENVELOPE",
10917
- "bridge returned an unparseable envelope for recall",
10918
- "Check that the Python child is healthy."
10919
- );
10920
- }
10921
10997
  function errorEnvelope12(code, message, hint) {
10922
10998
  return {
10923
10999
  tool: "recall",
@@ -10940,9 +11016,6 @@ async function runRecommendPanel(args, opts) {
10940
11016
  );
10941
11017
  }
10942
11018
  if (!opts.storage) {
10943
- if (opts.bridge && opts.bridge.toolNames.has("recommend_panel")) {
10944
- return await deferRecommendPanel(args, opts.bridge);
10945
- }
10946
11019
  return errorEnvelope13(
10947
11020
  "RECOMMEND_PANEL_STORAGE_UNAVAILABLE",
10948
11021
  "recommend_panel needs the local stats database, which isn't available",
@@ -11005,21 +11078,6 @@ async function runRecommendPanel(args, opts) {
11005
11078
  meta: result.meta
11006
11079
  };
11007
11080
  }
11008
- async function deferRecommendPanel(args, bridge) {
11009
- const r = await bridge.callTool("recommend_panel", args);
11010
- const text = r.content[0]?.text;
11011
- if (typeof text === "string") {
11012
- try {
11013
- return JSON.parse(text);
11014
- } catch {
11015
- }
11016
- }
11017
- return errorEnvelope13(
11018
- "RECOMMEND_PANEL_BRIDGE_BAD_ENVELOPE",
11019
- "bridge returned an unparseable envelope for recommend_panel",
11020
- "Check that the Python child is healthy."
11021
- );
11022
- }
11023
11081
  function errorEnvelope13(code, message, hint) {
11024
11082
  return {
11025
11083
  tool: "recommend_panel",
@@ -11049,9 +11107,6 @@ function toStringArray3(v) {
11049
11107
  var import_node_fs11 = require("fs");
11050
11108
  async function runScoreboard(args, opts) {
11051
11109
  if (!opts.storage) {
11052
- if (opts.bridge && opts.bridge.toolNames.has("scoreboard")) {
11053
- return await deferScoreboard(args, opts.bridge);
11054
- }
11055
11110
  return errorEnvelope14(
11056
11111
  "SCOREBOARD_STORAGE_UNAVAILABLE",
11057
11112
  "scoreboard needs the local stats database, which isn't available",
@@ -11174,21 +11229,6 @@ function clampInt3(raw, min, max, fallback) {
11174
11229
  if (!Number.isFinite(n)) return fallback;
11175
11230
  return Math.min(max, Math.max(min, Math.trunc(n)));
11176
11231
  }
11177
- async function deferScoreboard(args, bridge) {
11178
- const r = await bridge.callTool("scoreboard", args);
11179
- const text = r.content[0]?.text;
11180
- if (typeof text === "string") {
11181
- try {
11182
- return JSON.parse(text);
11183
- } catch {
11184
- }
11185
- }
11186
- return errorEnvelope14(
11187
- "SCOREBOARD_BRIDGE_BAD_ENVELOPE",
11188
- "bridge returned an unparseable envelope for scoreboard",
11189
- "Check that the Python child is healthy."
11190
- );
11191
- }
11192
11232
  function errorEnvelope14(code, message, hint) {
11193
11233
  return {
11194
11234
  tool: "scoreboard",
@@ -11225,9 +11265,6 @@ async function runSessionMemory(args, opts) {
11225
11265
  );
11226
11266
  }
11227
11267
  if (!opts.storage) {
11228
- if (opts.bridge && opts.bridge.toolNames.has("session_memory")) {
11229
- return await deferSessionMemory(args, opts.bridge);
11230
- }
11231
11268
  return errorEnvelope15(
11232
11269
  "SESSION_MEMORY_STORAGE_UNAVAILABLE",
11233
11270
  "session_memory needs the local database, which isn't available",
@@ -11332,21 +11369,6 @@ function clampInt4(raw, min, max, fallback) {
11332
11369
  if (!Number.isFinite(n)) return fallback;
11333
11370
  return Math.min(max, Math.max(min, Math.trunc(n)));
11334
11371
  }
11335
- async function deferSessionMemory(args, bridge) {
11336
- const r = await bridge.callTool("session_memory", args);
11337
- const text = r.content[0]?.text;
11338
- if (typeof text === "string") {
11339
- try {
11340
- return JSON.parse(text);
11341
- } catch {
11342
- }
11343
- }
11344
- return errorEnvelope15(
11345
- "SESSION_MEMORY_BRIDGE_BAD_ENVELOPE",
11346
- "bridge returned an unparseable envelope for session_memory",
11347
- "Check that the Python child is healthy."
11348
- );
11349
- }
11350
11372
  function errorEnvelope15(code, message, hint) {
11351
11373
  return {
11352
11374
  tool: "session_memory",
@@ -11677,7 +11699,7 @@ Re-emit the FULL solution. No commentary.`
11677
11699
  model: UPGRADE_MODEL,
11678
11700
  label: UPGRADE_LABEL,
11679
11701
  seat: "solver",
11680
- ...coReasoned ? { co_reasoner: { model: CO_REASON_MODEL, label: CO_REASON_LABEL } } : {}
11702
+ ...coReasoned ? { co_reasoner: { model: coProvider.model, label: coReasonLabel(coProvider.model) } } : {}
11681
11703
  };
11682
11704
  } else if (upgradeRequested) {
11683
11705
  result["reasoning_upgrade"] = {
@@ -11966,7 +11988,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
11966
11988
  var DEFAULT_PACKAGE = "crosscheck-cli";
11967
11989
  var FETCH_TIMEOUT_MS = 3e3;
11968
11990
  function engineVersion() {
11969
- return true ? "0.2.26" : "0.0.0-dev";
11991
+ return true ? "0.2.28" : "0.0.0-dev";
11970
11992
  }
11971
11993
  function defaultUpdateCachePath() {
11972
11994
  const base = process.env["CROSSCHECK_DATA_DIR"] || import_node_path12.default.join(import_node_os2.default.homedir() || import_node_os2.default.tmpdir(), ".crosscheck");
@@ -12738,12 +12760,11 @@ function helpTool() {
12738
12760
  }
12739
12761
  });
12740
12762
  }
12741
- function registerCoreTools(opts = {}) {
12742
- const o = opts && typeof opts === "object" && "toolNames" in opts ? { bridge: opts } : opts;
12763
+ function registerCoreTools(o = {}) {
12743
12764
  const tools = /* @__PURE__ */ new Map();
12744
12765
  const list = [
12745
12766
  pingTool(),
12746
- verifyTool(o.bridge, o.fetchConfig),
12767
+ verifyTool(o.fetchConfig),
12747
12768
  pickTool(
12748
12769
  o.providers ?? {},
12749
12770
  o.providerAllowlist ?? null,
@@ -12755,7 +12776,6 @@ function registerCoreTools(opts = {}) {
12755
12776
  auditTool(
12756
12777
  o.providers ?? {},
12757
12778
  o.providerAllowlist ?? null,
12758
- o.bridge,
12759
12779
  o.transcriptsDir,
12760
12780
  o.pricing,
12761
12781
  o.storage,
@@ -12765,7 +12785,6 @@ function registerCoreTools(opts = {}) {
12765
12785
  conferTool(
12766
12786
  o.providers ?? {},
12767
12787
  o.providerAllowlist ?? null,
12768
- o.bridge,
12769
12788
  o.moderatorDefault ?? "anthropic",
12770
12789
  o.pricing,
12771
12790
  o.storage,
@@ -12778,7 +12797,6 @@ function registerCoreTools(opts = {}) {
12778
12797
  debateTool(
12779
12798
  o.providers ?? {},
12780
12799
  o.providerAllowlist ?? null,
12781
- o.bridge,
12782
12800
  buildInnerCallers(o),
12783
12801
  o.storage,
12784
12802
  o.pricing,
@@ -12790,7 +12808,6 @@ function registerCoreTools(opts = {}) {
12790
12808
  coordinateTool(
12791
12809
  o.providers ?? {},
12792
12810
  o.providerAllowlist ?? null,
12793
- o.bridge,
12794
12811
  buildInnerCallers(o),
12795
12812
  o.storage,
12796
12813
  o.circuitBreakers,
@@ -12801,7 +12818,6 @@ function registerCoreTools(opts = {}) {
12801
12818
  triangulateTool(
12802
12819
  o.providers ?? {},
12803
12820
  o.providerAllowlist ?? null,
12804
- o.bridge,
12805
12821
  o.storage,
12806
12822
  o.circuitBreakers,
12807
12823
  o.transcriptsDir,
@@ -12810,7 +12826,6 @@ function registerCoreTools(opts = {}) {
12810
12826
  planTool(
12811
12827
  o.providers ?? {},
12812
12828
  o.providerAllowlist ?? null,
12813
- o.bridge,
12814
12829
  o.storage,
12815
12830
  o.circuitBreakers,
12816
12831
  o.transcriptsDir,
@@ -12819,7 +12834,6 @@ function registerCoreTools(opts = {}) {
12819
12834
  critiqueTool(
12820
12835
  o.providers ?? {},
12821
12836
  o.providerAllowlist ?? null,
12822
- o.bridge,
12823
12837
  o.storage,
12824
12838
  o.circuitBreakers,
12825
12839
  o.transcriptsDir,
@@ -12828,7 +12842,6 @@ function registerCoreTools(opts = {}) {
12828
12842
  reviewTool(
12829
12843
  o.providers ?? {},
12830
12844
  o.providerAllowlist ?? null,
12831
- o.bridge,
12832
12845
  o.storage,
12833
12846
  o.circuitBreakers,
12834
12847
  o.transcriptsDir,
@@ -12836,25 +12849,23 @@ function registerCoreTools(opts = {}) {
12836
12849
  ),
12837
12850
  listProvidersTool(o.providers ?? {}, o.activeProviders ?? null, o.moderatorDefault ?? "anthropic"),
12838
12851
  modelsTool(o.providers ?? {}, o.activeProviders ?? null),
12839
- recallTool(o.storage, o.bridge),
12840
- sessionMemoryTool(o.storage, o.bridge),
12841
- scoreboardTool(o.storage, o.bridge, o.eventsPath),
12842
- explainTool(o.storage, o.bridge, o.transcriptsDir),
12852
+ recallTool(o.storage),
12853
+ sessionMemoryTool(o.storage),
12854
+ scoreboardTool(o.storage, o.eventsPath),
12855
+ explainTool(o.storage, o.transcriptsDir),
12843
12856
  delegateTool(
12844
12857
  o.providers ?? {},
12845
12858
  o.providerAllowlist ?? null,
12846
12859
  o.storage,
12847
- o.bridge,
12848
12860
  o.moderatorDefault ?? "anthropic"
12849
12861
  ),
12850
12862
  fetchTool(o.storage, o.fetchConfig, o.repoRoot),
12851
- recommendPanelTool(o.providers ?? {}, o.storage, o.bridge),
12863
+ recommendPanelTool(o.providers ?? {}, o.storage),
12852
12864
  updateCrosscheckTool(o.repoRoot ?? null),
12853
12865
  benchTool(
12854
12866
  o.providers ?? {},
12855
12867
  o.providerAllowlist ?? null,
12856
12868
  o.storage,
12857
- o.bridge,
12858
12869
  o.moderatorDefault ?? "anthropic",
12859
12870
  o.benchGoldensDir,
12860
12871
  o.circuitBreakers,
@@ -12865,7 +12876,6 @@ function registerCoreTools(opts = {}) {
12865
12876
  solveTool(
12866
12877
  o.providers ?? {},
12867
12878
  o.providerAllowlist ?? null,
12868
- o.bridge,
12869
12879
  o.storage,
12870
12880
  o.circuitBreakers,
12871
12881
  o.transcriptsDir,
@@ -12874,7 +12884,6 @@ function registerCoreTools(opts = {}) {
12874
12884
  orchestrateTool(
12875
12885
  o.providers ?? {},
12876
12886
  o.providerAllowlist ?? null,
12877
- o.bridge,
12878
12887
  o.moderatorDefault ?? "anthropic",
12879
12888
  o.storage,
12880
12889
  o.pricing,
@@ -12921,7 +12930,6 @@ function createTool(o, toolName, cheapDefault) {
12921
12930
  providers: o.providers ?? {},
12922
12931
  allowlist: o.providerAllowlist ?? null,
12923
12932
  ...o.storage ? { storage: o.storage } : {},
12924
- ...o.bridge ? { bridge: o.bridge } : {},
12925
12933
  ...o.moderatorDefault ? { moderator: o.moderatorDefault } : {},
12926
12934
  ...o.fetchConfig ? { fetchConfig: o.fetchConfig } : {},
12927
12935
  ...o.repoRoot ? { repoRoot: o.repoRoot } : {},
@@ -12930,7 +12938,7 @@ function createTool(o, toolName, cheapDefault) {
12930
12938
  })
12931
12939
  };
12932
12940
  }
12933
- function orchestrateTool(providers, allowlist, bridge, moderator, storage, pricing, breakers, transcriptsDir, repoRoot, nodeCache) {
12941
+ function orchestrateTool(providers, allowlist, moderator, storage, pricing, breakers, transcriptsDir, repoRoot, nodeCache) {
12934
12942
  return {
12935
12943
  name: "orchestrate",
12936
12944
  description: "Plan and execute a DAG of LLM subtasks. Either supply a `goal` (planner will draft the DAG) OR a hand-authored `dag`. Workers run topologically; recombine produces a single `final`. Covers the sequential flow, cheap_mode (per-node tier picking), and reactive (mid-flight DAG updates) \u2014 all native.",
@@ -12955,7 +12963,6 @@ function orchestrateTool(providers, allowlist, bridge, moderator, storage, prici
12955
12963
  providers,
12956
12964
  allowlist,
12957
12965
  moderator,
12958
- ...bridge ? { bridge } : {},
12959
12966
  ...storage ? { storage } : {},
12960
12967
  ...pricing ? { pricing } : {},
12961
12968
  ...breakers ? { breakers } : {},
@@ -12965,7 +12972,7 @@ function orchestrateTool(providers, allowlist, bridge, moderator, storage, prici
12965
12972
  })
12966
12973
  };
12967
12974
  }
12968
- function solveTool(providers, allowlist, bridge, storage, breakers, transcriptsDir, repoRoot) {
12975
+ function solveTool(providers, allowlist, storage, breakers, transcriptsDir, repoRoot) {
12969
12976
  return {
12970
12977
  name: "solve",
12971
12978
  description: "Iterative LLM solver. Generates a proposal, verifies it against the supplied verifier, and retries with feedback up to max_attempts. Verifier kinds: regex_response and shell (run in a native sandbox with wall-clock + optional memory/CPU limits). With target_path, returns a unified-diff patch.",
@@ -12987,7 +12994,6 @@ function solveTool(providers, allowlist, bridge, storage, breakers, transcriptsD
12987
12994
  handler: (args) => runSolve(args, {
12988
12995
  providers,
12989
12996
  allowlist,
12990
- ...bridge ? { bridge } : {},
12991
12997
  ...storage ? { storage } : {},
12992
12998
  ...breakers ? { breakers } : {},
12993
12999
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13026,7 +13032,7 @@ function configPinTool(repoRoot, config, rejectDriftEnv) {
13026
13032
  }
13027
13033
  };
13028
13034
  }
13029
- function benchTool(providers, allowlist, storage, bridge, moderator, defaultGoldensDir, breakers, transcriptsDir, repoRoot) {
13035
+ function benchTool(providers, allowlist, storage, moderator, defaultGoldensDir, breakers, transcriptsDir, repoRoot) {
13030
13036
  return {
13031
13037
  name: "bench",
13032
13038
  description: "Run benchmark goldens against each provider's confer/review output. Each golden: {name, tool_call: confer|review, args, verifiers[]}. Returns per-provider pass/fail/error + a ranking sorted by score. Records ballots into provider_stats when storage is wired (used by triangulate's win-rate weights).",
@@ -13045,7 +13051,6 @@ function benchTool(providers, allowlist, storage, bridge, moderator, defaultGold
13045
13051
  allowlist,
13046
13052
  moderator,
13047
13053
  ...storage ? { storage } : {},
13048
- ...bridge ? { bridge } : {},
13049
13054
  ...defaultGoldensDir ? { defaultGoldensDir } : {},
13050
13055
  ...breakers ? { breakers } : {},
13051
13056
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13072,7 +13077,7 @@ function updateCrosscheckTool(repoRoot) {
13072
13077
  }
13073
13078
  };
13074
13079
  }
13075
- function recommendPanelTool(providers, storage, bridge) {
13080
+ function recommendPanelTool(providers, storage) {
13076
13081
  return {
13077
13082
  name: "recommend_panel",
13078
13083
  description: "Recommend a minimal effective panel for a given purpose, based on historical usage_log + provider_stats. Cold-start falls back to the configured panel ordered by win-rate.",
@@ -13090,8 +13095,7 @@ function recommendPanelTool(providers, storage, bridge) {
13090
13095
  },
13091
13096
  handler: (args) => runRecommendPanel(args, {
13092
13097
  providers,
13093
- ...storage ? { storage } : {},
13094
- ...bridge ? { bridge } : {}
13098
+ ...storage ? { storage } : {}
13095
13099
  })
13096
13100
  };
13097
13101
  }
@@ -13116,7 +13120,7 @@ function fetchTool(storage, fetchConfig, repoRoot) {
13116
13120
  })
13117
13121
  };
13118
13122
  }
13119
- function delegateTool(providers, allowlist, storage, bridge, moderator) {
13123
+ function delegateTool(providers, allowlist, storage, moderator) {
13120
13124
  return {
13121
13125
  name: "delegate",
13122
13126
  description: "Run a delegable tool (confer | review) restricted to a single named provider, with explicit quota check. Records every attempt (accepted or refused) to the delegations table; quota in the response reflects counts AFTER the current call.",
@@ -13136,12 +13140,11 @@ function delegateTool(providers, allowlist, storage, bridge, moderator) {
13136
13140
  providers,
13137
13141
  allowlist,
13138
13142
  moderator,
13139
- ...storage ? { storage } : {},
13140
- ...bridge ? { bridge } : {}
13143
+ ...storage ? { storage } : {}
13141
13144
  })
13142
13145
  };
13143
13146
  }
13144
- function explainTool(storage, bridge, transcriptsDir) {
13147
+ function explainTool(storage, transcriptsDir) {
13145
13148
  return {
13146
13149
  name: "explain",
13147
13150
  description: "Replay a session as a navigable tree with cost/latency annotations. Reads usage_log + optionally walks the transcripts directory for per-tool summaries.",
@@ -13159,12 +13162,11 @@ function explainTool(storage, bridge, transcriptsDir) {
13159
13162
  },
13160
13163
  handler: (args) => runExplain(args, {
13161
13164
  ...storage ? { storage } : {},
13162
- ...bridge ? { bridge } : {},
13163
13165
  ...transcriptsDir ? { transcriptsDir } : {}
13164
13166
  })
13165
13167
  };
13166
13168
  }
13167
- function scoreboardTool(storage, bridge, eventsPath) {
13169
+ function scoreboardTool(storage, eventsPath) {
13168
13170
  return {
13169
13171
  name: "scoreboard",
13170
13172
  description: "Aggregate provider ballot stats + delegation counts + table totals. Supports top_k (rank limit) and recent_limit (tail of events.jsonl when configured). Reads the engine's local stats database (auto-created at <data dir>/db.sqlite).",
@@ -13178,12 +13180,11 @@ function scoreboardTool(storage, bridge, eventsPath) {
13178
13180
  },
13179
13181
  handler: (args) => runScoreboard(args, {
13180
13182
  ...storage ? { storage } : {},
13181
- ...bridge ? { bridge } : {},
13182
13183
  ...eventsPath ? { eventsPath } : {}
13183
13184
  })
13184
13185
  };
13185
13186
  }
13186
- function sessionMemoryTool(storage, bridge) {
13187
+ function sessionMemoryTool(storage) {
13187
13188
  return {
13188
13189
  name: "session_memory",
13189
13190
  description: "CRUD over the per-session working memory ledger. Actions: list, add, mark_stale, clear. Uses the engine's local database (auto-created at <data dir>/db.sqlite).",
@@ -13206,15 +13207,14 @@ function sessionMemoryTool(storage, bridge) {
13206
13207
  required: ["action", "session_id"]
13207
13208
  },
13208
13209
  handler: (args) => runSessionMemory(args, {
13209
- ...storage ? { storage } : {},
13210
- ...bridge ? { bridge } : {}
13210
+ ...storage ? { storage } : {}
13211
13211
  })
13212
13212
  };
13213
13213
  }
13214
- function recallTool(storage, bridge) {
13214
+ function recallTool(storage) {
13215
13215
  return {
13216
13216
  name: "recall",
13217
- description: "Full-text search across persisted transcripts via SQLite FTS5. Returns rows ordered by relevance with a windowed snippet. Requires a wired Storage adapter; falls back to the Python bridge when not available.",
13217
+ description: "Full-text search across persisted transcripts via SQLite FTS5. Returns rows ordered by relevance with a windowed snippet. Requires a wired Storage adapter.",
13218
13218
  inputSchema: {
13219
13219
  type: "object",
13220
13220
  additionalProperties: true,
@@ -13228,8 +13228,7 @@ function recallTool(storage, bridge) {
13228
13228
  required: ["query"]
13229
13229
  },
13230
13230
  handler: (args) => runRecall(args, {
13231
- ...storage ? { storage } : {},
13232
- ...bridge ? { bridge } : {}
13231
+ ...storage ? { storage } : {}
13233
13232
  })
13234
13233
  };
13235
13234
  }
@@ -13265,7 +13264,7 @@ function modelsTool(providers, activeProviders) {
13265
13264
  handler: async (args) => runModels(args, { providers, activeProviders })
13266
13265
  };
13267
13266
  }
13268
- function reviewTool(providers, allowlist, bridge, storage, breakers, transcriptsDir, repoRoot) {
13267
+ function reviewTool(providers, allowlist, storage, breakers, transcriptsDir, repoRoot) {
13269
13268
  return {
13270
13269
  name: "review",
13271
13270
  description: "Have an LLM panel peer-review a code or proposal snippet. Returns the confer envelope (one answer per provider).",
@@ -13284,7 +13283,6 @@ function reviewTool(providers, allowlist, bridge, storage, breakers, transcripts
13284
13283
  handler: (args) => runReview(args, {
13285
13284
  providers,
13286
13285
  allowlist,
13287
- ...bridge ? { bridge } : {},
13288
13286
  ...storage ? { storage } : {},
13289
13287
  ...breakers ? { breakers } : {},
13290
13288
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13292,7 +13290,7 @@ function reviewTool(providers, allowlist, bridge, storage, breakers, transcripts
13292
13290
  })
13293
13291
  };
13294
13292
  }
13295
- function critiqueTool(providers, allowlist, bridge, storage, breakers, transcriptsDir, repoRoot) {
13293
+ function critiqueTool(providers, allowlist, storage, breakers, transcriptsDir, repoRoot) {
13296
13294
  return {
13297
13295
  name: "critique",
13298
13296
  description: "Have each LLM panelist list the top weaknesses of a proposed answer or approach (severity-rated). Returns per-provider weakness lists + a merged list ordered by severity.",
@@ -13312,7 +13310,6 @@ function critiqueTool(providers, allowlist, bridge, storage, breakers, transcrip
13312
13310
  handler: (args) => runCritique(args, {
13313
13311
  providers,
13314
13312
  allowlist,
13315
- ...bridge ? { bridge } : {},
13316
13313
  ...storage ? { storage } : {},
13317
13314
  ...breakers ? { breakers } : {},
13318
13315
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13320,7 +13317,7 @@ function critiqueTool(providers, allowlist, bridge, storage, breakers, transcrip
13320
13317
  })
13321
13318
  };
13322
13319
  }
13323
- function planTool(providers, allowlist, bridge, storage, breakers, transcriptsDir, repoRoot) {
13320
+ function planTool(providers, allowlist, storage, breakers, transcriptsDir, repoRoot) {
13324
13321
  return {
13325
13322
  name: "plan",
13326
13323
  description: 'Have an LLM panel debate a step-by-step plan for the stated goal under the given constraints. Returns the debate envelope with a moderator-synthesised plan. Defaults to `mode: "fast"` (2 rounds + early_stop) \u2014 set `mode: "thorough"` for 5 rounds without early_stop. Explicit `max_rounds` / `early_stop` / `early_stop_threshold` always override the mode preset. Use `structured: true` for schema-validated synthesis.',
@@ -13347,7 +13344,6 @@ function planTool(providers, allowlist, bridge, storage, breakers, transcriptsDi
13347
13344
  handler: (args) => runPlan(args, {
13348
13345
  providers,
13349
13346
  allowlist,
13350
- ...bridge ? { bridge } : {},
13351
13347
  ...storage ? { storage } : {},
13352
13348
  ...breakers ? { breakers } : {},
13353
13349
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13355,7 +13351,7 @@ function planTool(providers, allowlist, bridge, storage, breakers, transcriptsDi
13355
13351
  })
13356
13352
  };
13357
13353
  }
13358
- function triangulateTool(providers, allowlist, bridge, storage, breakers, transcriptsDir, repoRoot) {
13354
+ function triangulateTool(providers, allowlist, storage, breakers, transcriptsDir, repoRoot) {
13359
13355
  return {
13360
13356
  name: "triangulate",
13361
13357
  description: "Run a coordinate flow and reshape the output as a consensus + minority report with per-provider weights. v1 uses 1.0 weights (matches a fresh provider_stats DB); future versions thread real win-rate weights when the DB layer ports.",
@@ -13376,7 +13372,6 @@ function triangulateTool(providers, allowlist, bridge, storage, breakers, transc
13376
13372
  handler: (args) => runTriangulate(args, {
13377
13373
  providers,
13378
13374
  allowlist,
13379
- ...bridge ? { bridge } : {},
13380
13375
  ...storage ? { storage } : {},
13381
13376
  ...breakers ? { breakers } : {},
13382
13377
  ...transcriptsDir ? { transcriptsDir } : {},
@@ -13384,7 +13379,7 @@ function triangulateTool(providers, allowlist, bridge, storage, breakers, transc
13384
13379
  })
13385
13380
  };
13386
13381
  }
13387
- function coordinateTool(providers, allowlist, bridge, innerCallers, storage, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13382
+ function coordinateTool(providers, allowlist, innerCallers, storage, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13388
13383
  return {
13389
13384
  name: "coordinate",
13390
13385
  description: "Run a three-role coordination flow (proposer \u2192 critics \u2192 synthesizer) with structured output at every step. Native opts: untrusted_input (canary + neutralize), worker_tools (bounded ReAct on proposer + critic roles; synth never sees inner tools), inject_session_memory (storage-backed working-memory block prepended to the topic).",
@@ -13409,7 +13404,6 @@ function coordinateTool(providers, allowlist, bridge, innerCallers, storage, bre
13409
13404
  handler: (args) => runCoordinate(args, {
13410
13405
  providers,
13411
13406
  allowlist,
13412
- ...bridge ? { bridge } : {},
13413
13407
  innerCallers,
13414
13408
  ...storage ? { storage } : {},
13415
13409
  ...breakers ? { breakers } : {},
@@ -13419,7 +13413,7 @@ function coordinateTool(providers, allowlist, bridge, innerCallers, storage, bre
13419
13413
  })
13420
13414
  };
13421
13415
  }
13422
- function debateTool(providers, allowlist, bridge, innerCallers, storage, pricing, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13416
+ function debateTool(providers, allowlist, innerCallers, storage, pricing, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13423
13417
  return {
13424
13418
  name: "debate",
13425
13419
  description: "Run a multi-round debate between LLM providers and synthesise the result via a moderator. Native opts: inject_session_memory, auto_panel, worker_tools, structured synthesis (schema-validated), extract_claims (final-round distillation), early_stop (post-round agreement check).",
@@ -13449,7 +13443,6 @@ function debateTool(providers, allowlist, bridge, innerCallers, storage, pricing
13449
13443
  handler: (args) => runDebate(args, {
13450
13444
  providers,
13451
13445
  allowlist,
13452
- ...bridge ? { bridge } : {},
13453
13446
  innerCallers,
13454
13447
  ...storage ? { storage } : {},
13455
13448
  ...pricing ? { pricing } : {},
@@ -13469,10 +13462,10 @@ function buildInnerCallers(o) {
13469
13462
  ...o.repoRoot ? { repoRoot: o.repoRoot } : {}
13470
13463
  });
13471
13464
  }
13472
- out.verify = (args) => runVerify(args, o.bridge, o.fetchConfig);
13465
+ out.verify = (args) => runVerify(args, o.fetchConfig);
13473
13466
  return out;
13474
13467
  }
13475
- function conferTool(providers, allowlist, bridge, moderator, pricing, storage, innerCallers, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13468
+ function conferTool(providers, allowlist, moderator, pricing, storage, innerCallers, breakers, transcriptsDir, repoRoot, workerToolsCfg) {
13476
13469
  return {
13477
13470
  name: "confer",
13478
13471
  description: "Ask a panel of LLM providers the same question; return one answer per provider. Native opts: untrusted_input (canary + neutralization), early_stop (cheap-tier agreement check after first 2 panelists when N>=3), extract_claims (cheap-tier extractor with per-provider support maps), inject_session_memory (storage-backed working-memory block prepended to the first user message), auto_panel (router-driven top-N panel pick), worker_tools (bounded ReAct loop per panelist when innerCallers are wired by the host).",
@@ -13499,7 +13492,6 @@ function conferTool(providers, allowlist, bridge, moderator, pricing, storage, i
13499
13492
  handler: (args) => runConfer(args, {
13500
13493
  providers,
13501
13494
  allowlist,
13502
- ...bridge ? { bridge } : {},
13503
13495
  moderator,
13504
13496
  ...pricing ? { pricing } : {},
13505
13497
  ...storage ? { storage } : {},
@@ -13511,7 +13503,7 @@ function conferTool(providers, allowlist, bridge, moderator, pricing, storage, i
13511
13503
  })
13512
13504
  };
13513
13505
  }
13514
- function auditTool(providers, allowlist, bridge, transcriptsDir, pricing, storage, breakers, repoRoot) {
13506
+ function auditTool(providers, allowlist, transcriptsDir, pricing, storage, breakers, repoRoot) {
13515
13507
  return {
13516
13508
  name: "audit",
13517
13509
  description: "Score a piece of output against an audit rubric. Single-judge by default; coalesce-mode (multi-judge consensus) and panel-exhausted self-audit run natively. cheap_mode picks the cheapest 'med'-tier model as auditor when a pricing.json is wired. session_id-only inputs load the latest transcript automatically when a transcripts directory is wired.",
@@ -13537,7 +13529,6 @@ function auditTool(providers, allowlist, bridge, transcriptsDir, pricing, storag
13537
13529
  handler: (args) => runAudit(args, {
13538
13530
  providers,
13539
13531
  allowlist,
13540
- ...bridge ? { bridge } : {},
13541
13532
  ...transcriptsDir ? { transcriptsDir } : {},
13542
13533
  ...pricing ? { pricing } : {},
13543
13534
  ...storage ? { storage } : {},
@@ -13601,7 +13592,7 @@ function pickTool(providers, allowlist, storage, breakers, transcriptsDir, repoR
13601
13592
  })
13602
13593
  };
13603
13594
  }
13604
- function verifyTool(bridge, fetchConfig) {
13595
+ function verifyTool(fetchConfig) {
13605
13596
  return {
13606
13597
  name: "verify",
13607
13598
  description: "Run a list of deterministic property checks against caller-supplied data. No LLM calls; everything is local. Returns per-check {passed, reason} plus all_passed / summary / timing fields. Supports the text kinds (contains, not_contains, regex_match, contains_any, contains_all, min_length), shell (sandboxed subprocess with timeout + Unix pgid isolation), and url_head (HEAD request gated by fetch.url_allowlist). All kinds run natively.",
@@ -13619,7 +13610,7 @@ function verifyTool(bridge, fetchConfig) {
13619
13610
  },
13620
13611
  required: ["checks"]
13621
13612
  },
13622
- handler: (args) => runVerify(args, bridge, fetchConfig)
13613
+ handler: (args) => runVerify(args, fetchConfig)
13623
13614
  };
13624
13615
  }
13625
13616
  function pingTool() {
@@ -13669,7 +13660,7 @@ function createCrosscheck(opts) {
13669
13660
  // Direct runConfer call with a streaming hook — bypasses the tool
13670
13661
  // registry (whose handler signature can't carry a callback). Uses the
13671
13662
  // same opts the registry wires for confer in a browser build: providers
13672
- // + pricing + default moderator; storage/bridge/innerCallers aren't
13663
+ // + pricing + default moderator; storage/innerCallers aren't
13673
13664
  // available here, matching the non-streaming path.
13674
13665
  conferStream: (args, onAnswer) => runConfer(args, { providers, pricing: pricingDoc, moderator: "anthropic", onAnswer }),
13675
13666
  debateStream: (args, { onTurn, onSynthesis } = {}) => runDebate(args, {