github-router 0.3.315 → 0.3.317

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.
Files changed (105) hide show
  1. package/dist/{aic-ledger-BS47yb_C.js → aic-ledger-DY03LbBM.js} +2 -2
  2. package/dist/{aic-ledger-BS47yb_C.js.map → aic-ledger-DY03LbBM.js.map} +1 -1
  3. package/dist/{attribution-settings-DXmmyuEE.js → attribution-settings-D6dAkP4e.js} +120 -21
  4. package/dist/attribution-settings-D6dAkP4e.js.map +1 -0
  5. package/dist/{auth-D8t41c5D.js → auth-Iun7ftd8.js} +4 -4
  6. package/dist/{auth-D8t41c5D.js.map → auth-Iun7ftd8.js.map} +1 -1
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/{check-usage-BpBKOjGZ.js → check-usage-1c-0z3iy.js} +4 -4
  9. package/dist/{check-usage-BpBKOjGZ.js.map → check-usage-1c-0z3iy.js.map} +1 -1
  10. package/dist/{claude-Cmmu3-cL.js → claude-aZ6OaFP5.js} +178 -49
  11. package/dist/claude-aZ6OaFP5.js.map +1 -0
  12. package/dist/{codex-DqTKKoEx.js → codex-PTdWu7er.js} +6 -6
  13. package/dist/codex-PTdWu7er.js.map +1 -0
  14. package/dist/{copilot-discount-IbXR5A28.js → copilot-discount-C3jx9Q-o.js} +2 -2
  15. package/dist/{copilot-discount-IbXR5A28.js.map → copilot-discount-C3jx9Q-o.js.map} +1 -1
  16. package/dist/{debug-CA7pg8V9.js → debug-CDyXUPcC.js} +2 -2
  17. package/dist/{debug-CA7pg8V9.js.map → debug-CDyXUPcC.js.map} +1 -1
  18. package/dist/engine-D5GNXylB.js +2 -0
  19. package/dist/{gate-discovery-CPk6Z8yc.js → gate-discovery-B17pvgE0.js} +5 -5
  20. package/dist/{gate-discovery-CPk6Z8yc.js.map → gate-discovery-B17pvgE0.js.map} +1 -1
  21. package/dist/{get-copilot-usage-FSQE8szQ.js → get-copilot-usage-BWCAzmSc.js} +3 -3
  22. package/dist/{get-copilot-usage-FSQE8szQ.js.map → get-copilot-usage-BWCAzmSc.js.map} +1 -1
  23. package/dist/hooks.mjs +125 -117
  24. package/dist/hooks.sha256 +1 -1
  25. package/dist/{internal-aic-status-BN0xRLSF.js → internal-aic-status-BiblmImt.js} +13 -6
  26. package/dist/{internal-aic-status-BN0xRLSF.js.map → internal-aic-status-BiblmImt.js.map} +1 -1
  27. package/dist/{internal-artifact-open-B3stUu74.js → internal-artifact-open-CA1trJ15.js} +2 -2
  28. package/dist/{internal-artifact-open-B3stUu74.js.map → internal-artifact-open-CA1trJ15.js.map} +1 -1
  29. package/dist/{internal-fast-dispatch-guard-CAwYj_Yz.js → internal-fast-dispatch-guard-CZ4BZuAG.js} +2 -2
  30. package/dist/{internal-fast-dispatch-guard-CAwYj_Yz.js.map → internal-fast-dispatch-guard-CZ4BZuAG.js.map} +1 -1
  31. package/dist/{internal-fast-dispatch-guard-2QjUlhqO.js → internal-fast-dispatch-guard-D5kozMpo.js} +1 -1
  32. package/dist/{internal-first-mate-guard-VgnHBp0s.js → internal-first-mate-guard-B_or0eN3.js} +1 -1
  33. package/dist/{internal-first-mate-guard-B0rbLb0L.js → internal-first-mate-guard-CiFH6X1H.js} +3 -3
  34. package/dist/{internal-first-mate-guard-B0rbLb0L.js.map → internal-first-mate-guard-CiFH6X1H.js.map} +1 -1
  35. package/dist/{internal-max-dispatch-guard-BzKsY9ze.js → internal-max-dispatch-guard-BGOHRYRt.js} +1 -1
  36. package/dist/{internal-max-dispatch-guard-l1NGYHtF.js → internal-max-dispatch-guard-CnBZxo5l.js} +3 -3
  37. package/dist/{internal-max-dispatch-guard-l1NGYHtF.js.map → internal-max-dispatch-guard-CnBZxo5l.js.map} +1 -1
  38. package/dist/{internal-plan-review-QUvNZmMR.js → internal-plan-review-C73snnD8.js} +3 -3
  39. package/dist/{internal-plan-review-QUvNZmMR.js.map → internal-plan-review-C73snnD8.js.map} +1 -1
  40. package/dist/{internal-prompt-submit-fj5ccft_.js → internal-prompt-submit-dov4UvBo.js} +4 -4
  41. package/dist/{internal-prompt-submit-fj5ccft_.js.map → internal-prompt-submit-dov4UvBo.js.map} +1 -1
  42. package/dist/{internal-session-bind-0Hmak8PR.js → internal-session-bind-C3hrb9rP.js} +2 -2
  43. package/dist/{internal-session-bind-0Hmak8PR.js.map → internal-session-bind-C3hrb9rP.js.map} +1 -1
  44. package/dist/{internal-stop-hook-BKiKYeda.js → internal-stop-hook-DZ6CCP4C.js} +5 -5
  45. package/dist/{internal-stop-hook-BKiKYeda.js.map → internal-stop-hook-DZ6CCP4C.js.map} +1 -1
  46. package/dist/{internal-stop-review-8v2llYDB.js → internal-stop-review-MBVYtrYS.js} +2 -2
  47. package/dist/{internal-stop-review-8v2llYDB.js.map → internal-stop-review-MBVYtrYS.js.map} +1 -1
  48. package/dist/{internal-worker-guard-BI4Pl0Ew.js → internal-worker-guard-dxGawAY3.js} +2 -2
  49. package/dist/{internal-worker-guard-BI4Pl0Ew.js.map → internal-worker-guard-dxGawAY3.js.map} +1 -1
  50. package/dist/{internal-workspace-header-kg9FoNXK.js → internal-workspace-header-_aEXOz5q.js} +2 -2
  51. package/dist/{internal-workspace-header-kg9FoNXK.js.map → internal-workspace-header-_aEXOz5q.js.map} +1 -1
  52. package/dist/{lifecycle-IwotwedG.js → lifecycle-CJB2BwSJ.js} +2 -2
  53. package/dist/{lifecycle-IwotwedG.js.map → lifecycle-CJB2BwSJ.js.map} +1 -1
  54. package/dist/lifecycle-D0KsoSqz.js +2 -0
  55. package/dist/lifecycle-DimEguJO.js +2 -0
  56. package/dist/{lifecycle-Cx1wVrLb.js → lifecycle-_BE0SnNs.js} +2 -2
  57. package/dist/{lifecycle-Cx1wVrLb.js.map → lifecycle-_BE0SnNs.js.map} +1 -1
  58. package/dist/main.js +20 -20
  59. package/dist/{max-profile-contract-BcrMlrmo.js → max-profile-contract-Bl7I_EOC.js} +2 -2
  60. package/dist/{max-profile-contract-BcrMlrmo.js.map → max-profile-contract-Bl7I_EOC.js.map} +1 -1
  61. package/dist/{mcp-workspace-header-BYgWioLH.js → mcp-workspace-header-mXRLE8kg.js} +2 -2
  62. package/dist/{mcp-workspace-header-BYgWioLH.js.map → mcp-workspace-header-mXRLE8kg.js.map} +1 -1
  63. package/dist/{models-DgLeb-Dv.js → models-CSFIVxAH.js} +3 -3
  64. package/dist/{models-DgLeb-Dv.js.map → models-CSFIVxAH.js.map} +1 -1
  65. package/dist/{orchestration-Dc3mO0G3.js → orchestration-B8kypXcZ.js} +2 -2
  66. package/dist/{orchestration-Dc3mO0G3.js.map → orchestration-B8kypXcZ.js.map} +1 -1
  67. package/dist/{paths-CMxlQEfQ.js → paths-CHBAj_t9.js} +36 -4
  68. package/dist/{paths-CMxlQEfQ.js.map → paths-CHBAj_t9.js.map} +1 -1
  69. package/dist/paths-eHoOwFzZ.js +2 -0
  70. package/dist/{peer-mcp-personas-CYWJSxPK.js → peer-mcp-personas-CRMVuMVF.js} +201 -61
  71. package/dist/peer-mcp-personas-CRMVuMVF.js.map +1 -0
  72. package/dist/{plan-review-hook-BIMwWkh6.js → plan-review-hook-BMmw7wxR.js} +3 -3
  73. package/dist/{plan-review-hook-BIMwWkh6.js.map → plan-review-hook-BMmw7wxR.js.map} +1 -1
  74. package/dist/{prompt-submit-hook-BcFpjHXg.js → prompt-submit-hook-CGgT5m4Q.js} +3 -3
  75. package/dist/{prompt-submit-hook-BcFpjHXg.js.map → prompt-submit-hook-CGgT5m4Q.js.map} +1 -1
  76. package/dist/{provision-AwSjt-vR.js → provision-Bn8-NDp7.js} +4 -4
  77. package/dist/{provision-AwSjt-vR.js.map → provision-Bn8-NDp7.js.map} +1 -1
  78. package/dist/{self-invocation-cRl4RqfW.js → self-invocation-DahN1gw9.js} +2 -2
  79. package/dist/{self-invocation-cRl4RqfW.js.map → self-invocation-DahN1gw9.js.map} +1 -1
  80. package/dist/{serve-BG2O6Slz.js → serve-CX4Ifk5p.js} +13 -13
  81. package/dist/{serve-BG2O6Slz.js.map → serve-CX4Ifk5p.js.map} +1 -1
  82. package/dist/{server-setup-D7ABbEs1.js → server-setup-0PaS4m2B.js} +254 -66
  83. package/dist/server-setup-0PaS4m2B.js.map +1 -0
  84. package/dist/{start-Dpwpnq99.js → start-Bz_559ua.js} +3 -3
  85. package/dist/{start-Dpwpnq99.js.map → start-Bz_559ua.js.map} +1 -1
  86. package/dist/{state-B8adscCv.js → state-BlMpEFAt.js} +2 -1
  87. package/dist/{state-B8adscCv.js.map → state-BlMpEFAt.js.map} +1 -1
  88. package/dist/{stop-gate-hook-BUCxa5Kc.js → stop-gate-hook-D7N759TG.js} +72 -4
  89. package/dist/{stop-gate-hook-BUCxa5Kc.js.map → stop-gate-hook-D7N759TG.js.map} +1 -1
  90. package/dist/{stop-gate-policy--bpyxxXU.js → stop-gate-policy-C0gt04R0.js} +2 -2
  91. package/dist/{stop-gate-policy--bpyxxXU.js.map → stop-gate-policy-C0gt04R0.js.map} +1 -1
  92. package/dist/{token-ClzS23Y2.js → token-86uk6y4P.js} +3 -3
  93. package/dist/{token-ClzS23Y2.js.map → token-86uk6y4P.js.map} +1 -1
  94. package/dist/{worker-dispatch-DMIdrlsF.js → worker-dispatch-B-OA7tvU.js} +2 -2
  95. package/dist/{worker-dispatch-DMIdrlsF.js.map → worker-dispatch-B-OA7tvU.js.map} +1 -1
  96. package/package.json +1 -1
  97. package/dist/attribution-settings-DXmmyuEE.js.map +0 -1
  98. package/dist/claude-Cmmu3-cL.js.map +0 -1
  99. package/dist/codex-DqTKKoEx.js.map +0 -1
  100. package/dist/engine-b9XaKLp0.js +0 -2
  101. package/dist/lifecycle-BpqAyaAj.js +0 -2
  102. package/dist/lifecycle-CL2WiyeQ.js +0 -2
  103. package/dist/paths-BXXCVFvA.js +0 -2
  104. package/dist/peer-mcp-personas-CYWJSxPK.js.map +0 -1
  105. package/dist/server-setup-D7ABbEs1.js.map +0 -1
@@ -1,18 +1,18 @@
1
1
  import { n as explicitPackageRoot } from "./package-root-B-osctCk.js";
2
2
  import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
3
- import { t as PATHS } from "./paths-CMxlQEfQ.js";
4
- import { t as state } from "./state-B8adscCv.js";
5
- import { C as GITHUB_GRAPHQL_URL, D as githubAgentGraphQLHeaders, E as copilotVersion, O as githubAgentHeaders, S as GITHUB_API_BASE_URL, T as copilotHeaders, b as sanitizeTransportText, d as resolveModel, f as sleep$2, g as HTTPError, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as classifyTransportError, w as copilotBaseUrl, x as withTransientRetry, y as fetchWithTransientRetry } from "./token-ClzS23Y2.js";
3
+ import { t as PATHS } from "./paths-CHBAj_t9.js";
4
+ import { t as state } from "./state-BlMpEFAt.js";
5
+ import { C as GITHUB_GRAPHQL_URL, D as githubAgentGraphQLHeaders, E as copilotVersion, O as githubAgentHeaders, S as GITHUB_API_BASE_URL, T as copilotHeaders, b as sanitizeTransportText, d as resolveModel, f as sleep$2, g as HTTPError, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as classifyTransportError, w as copilotBaseUrl, x as withTransientRetry, y as fetchWithTransientRetry } from "./token-86uk6y4P.js";
6
6
  import { a as parseIntEnv, i as parseBoolEnv, l as runManagedExeCapture, o as resolveExecutable, u as spawnTaskkillBestEffort } from "./exec-COUT4QsS.js";
7
7
  import { a as FAST_PROFILE_ASTRA_MODEL, c as FAST_PROFILE_MODELS, d as FAST_PROFILE_NATIVE_MODELS, f as FAST_PROFILE_ORACLE_EFFORT, n as FAST_PROFILE_ADVISOR_EFFORT, p as FAST_PROFILE_ORACLE_MODEL, r as FAST_PROFILE_ADVISOR_MODEL, u as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-_DhIWank.js";
8
- import { A as normalizeTrailingOneMSuffix, D as maxPeerInstructions, E as maxPeerDescription, O as fastEndpointForCatalogId, b as MAX_ADVISOR_SYSTEM_PROMPT, f as maxCodexReviewerModel, g as maxProReplacementModel, h as maxOpusModel, i as MAX_PROFILE_MODELS, k as fastEndpointForModel, m as maxGrokModel, p as maxGeminiModel, r as MAX_PROFILE_LEAD_MODEL, v as maxSonnetModel } from "./max-profile-contract-BcrMlrmo.js";
9
- import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-IwotwedG.js";
10
- import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-BYgWioLH.js";
8
+ import { A as normalizeTrailingOneMSuffix, D as maxPeerInstructions, E as maxPeerDescription, O as fastEndpointForCatalogId, b as MAX_ADVISOR_SYSTEM_PROMPT, f as maxCodexReviewerModel, g as maxProReplacementModel, h as maxOpusModel, i as MAX_PROFILE_MODELS, k as fastEndpointForModel, m as maxGrokModel, p as maxGeminiModel, r as MAX_PROFILE_LEAD_MODEL, v as maxSonnetModel } from "./max-profile-contract-Bl7I_EOC.js";
9
+ import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-CJB2BwSJ.js";
10
+ import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-mXRLE8kg.js";
11
11
  import { n as ArtifactError, r as applyInsecureTls, t as ArtifactClient } from "./client-CQMfroGV.js";
12
- import { n as isPidAlive$1, r as registerColbertExitHandlers, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-Cx1wVrLb.js";
13
- import { c as recordAic, d as extractCopilotUsage, i as extractAndRecordAic } from "./aic-ledger-BS47yb_C.js";
14
- import { f as resolveSealedGate, m as runGateChecks, p as sealedGateIds } from "./stop-gate-hook-BUCxa5Kc.js";
15
- import { t as liveExec } from "./orchestration-Dc3mO0G3.js";
12
+ import { n as isPidAlive$1, r as registerColbertExitHandlers, s as trackChild, t as getColbertInstanceUuid } from "./lifecycle-_BE0SnNs.js";
13
+ import { c as recordAic, d as extractCopilotUsage, i as extractAndRecordAic } from "./aic-ledger-DY03LbBM.js";
14
+ import { h as runGateChecks, m as sealedGateIds, p as resolveSealedGate } from "./stop-gate-hook-D7N759TG.js";
15
+ import { t as liveExec } from "./orchestration-B8kypXcZ.js";
16
16
  import { createRequire } from "node:module";
17
17
  import consola from "consola";
18
18
  import { chmodSync, closeSync, constants, cpSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
@@ -160,6 +160,54 @@ const CHEAP_PROFILE_ORACLE_EFFORT = "medium";
160
160
  const CHEAP_PROFILE_ASTRA_MODEL = CHEAP_PROFILE_MODELS.astra;
161
161
  const CHEAP_PROFILE_ASTRA_EFFORT = "medium";
162
162
  //#endregion
163
+ //#region src/lib/cheapest-profile-contract.ts
164
+ const CHEAPEST_PROFILE_MODELS = Object.freeze({
165
+ lead: "gpt-5.6-luna",
166
+ explore: "gpt-5.6-luna",
167
+ plan: "gpt-5.6-sol",
168
+ "general-purpose": "gpt-5.6-luna",
169
+ implementer: "gpt-5.6-luna",
170
+ reviewer: "gemini-3.8-flash",
171
+ advisor: "gemini-3.8-flash",
172
+ oracle: "gpt-5.6-sol"
173
+ });
174
+ const CHEAPEST_PROFILE_NATIVE_AGENT_NAMES = [
175
+ "Explore",
176
+ "Plan",
177
+ "general-purpose",
178
+ "implementer",
179
+ "reviewer"
180
+ ];
181
+ const CHEAPEST_PROFILE_NATIVE_MODELS = Object.freeze({
182
+ Explore: CHEAPEST_PROFILE_MODELS.explore,
183
+ Plan: CHEAPEST_PROFILE_MODELS.plan,
184
+ "general-purpose": CHEAPEST_PROFILE_MODELS["general-purpose"],
185
+ implementer: CHEAPEST_PROFILE_MODELS.implementer,
186
+ reviewer: CHEAPEST_PROFILE_MODELS.reviewer
187
+ });
188
+ const CHEAPEST_PROFILE_NATIVE_EFFORTS = Object.freeze({
189
+ Explore: "high",
190
+ Plan: "high",
191
+ "general-purpose": "xhigh",
192
+ implementer: "max",
193
+ reviewer: "high"
194
+ });
195
+ /**
196
+ * Subagent/peer context window (tokens). Every non-lead role (and the lead
197
+ * as well) runs at Claude Code's DEFAULT (bare-slug) budget — 200K.
198
+ */
199
+ const CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS = 2e5;
200
+ const CHEAPEST_PROFILE_ADVISOR_MODEL = CHEAPEST_PROFILE_MODELS.advisor;
201
+ /**
202
+ * Client-visible Advisor identity for cheapest mode. The BARE Gemini slug
203
+ * (no `[1m]` bracket): Claude Code budgets the Advisor tool as a 200K-model
204
+ * and forwards no more than ~200K of the lead's transcript, and the proxy
205
+ * mirrors that with `CHEAPEST_PROFILE_ADVISOR_CONTEXT_TOKENS`.
206
+ */
207
+ const CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL = CHEAPEST_PROFILE_MODELS.advisor;
208
+ const CHEAPEST_PROFILE_ORACLE_MODEL = CHEAPEST_PROFILE_MODELS.oracle;
209
+ const CHEAPEST_PROFILE_ORACLE_EFFORT = "high";
210
+ //#endregion
163
211
  //#region src/lib/one-m-context.ts
164
212
  /**
165
213
  * Context-window threshold at which Claude Code's `[1m]` accounting unlock is
@@ -528,6 +576,12 @@ const FAST_LEAD_MODEL = FAST_PROFILE_MODELS.lead;
528
576
  * successor that keeps the leader at its full 1M window.
529
577
  */
530
578
  const CHEAP_LEAD_MODEL = CHEAP_PROFILE_MODELS.lead;
579
+ /**
580
+ * The lead `-m cheapest` selects. Luna at the 200K DEFAULT window (BARE
581
+ * slug, no `[1m]`) — the cheapest tier runs every role, lead included, at
582
+ * the default budget.
583
+ */
584
+ const CHEAPEST_LEAD_MODEL = CHEAPEST_PROFILE_MODELS.lead;
531
585
  /** Small/fast tier for a budget lead, in the two forms this codebase needs.
532
586
  *
533
587
  * `SLUG` is the Anthropic-published DASHED form and is what goes into
@@ -548,16 +602,18 @@ const BUDGET_SMALL_FAST_CATALOG_ID = "claude-haiku-4.5";
548
602
  * of the original cheap launch: Gemini leader at 1M)
549
603
  * - `cheap` → `CHEAP_LEAD_MODEL` BARE (the cost-lean launch: Gemini
550
604
  * leader at the 200K DEFAULT window, no astra peer)
605
+ * - `cheapest` → `CHEAPEST_LEAD_MODEL` BARE (the cheapest launch: Luna
606
+ * leader at the 200K DEFAULT window, no astra peer)
551
607
  * - `N.M` → the best variant of that Opus family, via `pickClaudeDefault`
552
608
  * - a full slug → unchanged, including Copilot slugs a power user pins
553
609
  * - absent → the ordinary default
554
610
  *
555
- * Every branch except `cheap` is `[1m]`-decorated against the live catalog,
556
- * by `pickClaudeDefault` on the two Opus-family branches and by
557
- * `withOneMSuffixForLead` on the rest — the decoration is catalog-gated per
558
- * model, so a genuinely 200K model (`claude-haiku-4.5`) still comes back
559
- * bare. `cheap` deliberately skips the decoration entirely because its whole
560
- * cost lever is the 200K default lead window.
611
+ * Every branch except `cheap`/`cheapest` is `[1m]`-decorated against the
612
+ * live catalog, by `pickClaudeDefault` on the two Opus-family branches and
613
+ * by `withOneMSuffixForLead` on the rest — the decoration is catalog-gated
614
+ * per model, so a genuinely 200K model (`claude-haiku-4-5`) still comes back
615
+ * bare. `cheap`/`cheapest` deliberately skip the decoration entirely because
616
+ * their whole cost lever is the 200K default lead window.
561
617
  *
562
618
  * `fast` resolves to an ordinary slug rather than setting a mode flag —
563
619
  * `resolveLaunchProfile` (`./launch-profile`) is keyed off the SAME raw
@@ -581,6 +637,7 @@ function resolveLeadSlugArg(modelArg) {
581
637
  if (arg.toLowerCase() === "max") return withOneMSuffixForLead(MAX_PROFILE_LEAD_MODEL);
582
638
  if (arg.toLowerCase() === "cheap1m") return withOneMSuffixForLead(CHEAP_LEAD_MODEL);
583
639
  if (arg.toLowerCase() === "cheap") return CHEAP_LEAD_MODEL;
640
+ if (arg.toLowerCase() === "cheapest") return CHEAPEST_LEAD_MODEL;
584
641
  const opusFamilyShorthand = arg.match(/^(\d+\.\d+)$/)?.[1];
585
642
  if (opusFamilyShorthand) return pickClaudeDefault(opusFamilyShorthand);
586
643
  return withOneMSuffixForLead(arg);
@@ -17251,7 +17308,8 @@ async function runInit(workspace) {
17251
17308
  * `provisionAndIndexColbert()` is the fire-and-forget call site the
17252
17309
  * `start` / `claude` / `codex` launchers invoke after `setupAndServe`
17253
17310
  * (mirroring `provisionToolbelt()` / `runSelfUpdate()`):
17254
- * 1. Bail if opted out (`GH_ROUTER_DISABLE_SEMANTIC_SEARCH=1`).
17311
+ * 1. Bail unless opted in (`--search` / `GH_ROUTER_ENABLE_SEMANTIC_SEARCH=1`);
17312
+ * `GH_ROUTER_DISABLE_SEMANTIC_SEARCH=1` hard-disables.
17255
17313
  * 2. Register the exit handlers (tree-kill tracked colgrep children).
17256
17314
  * 3. Provision the binary/model/ORT under a lock + smoke test
17257
17315
  * (best-effort, never throws to the launcher).
@@ -17263,15 +17321,20 @@ async function runInit(workspace) {
17263
17321
  * for an unindexed workspace and reports `unavailable` meanwhile).
17264
17322
  */
17265
17323
  /**
17266
- * True unless the operator opted out via
17267
- * `GH_ROUTER_DISABLE_SEMANTIC_SEARCH=1`. Semantic search is ON BY
17268
- * DEFAULT (the proxy auto-provisions + background-indexes); the
17269
- * capability gate additionally requires the artifacts to be present on
17270
- * disk + smoke-passed, so in any environment where provisioning hasn't
17271
- * completed the tool simply doesn't appear (no regression).
17324
+ * True only when the operator opted in via `--search`
17325
+ * (`state.searchEnabled`, set by `setupAndServe`) or
17326
+ * `GH_ROUTER_ENABLE_SEMANTIC_SEARCH=1`. Semantic search is OFF BY
17327
+ * DEFAULT (no auto-provision, no background-index); the capability gate
17328
+ * additionally requires the artifacts to be present on disk +
17329
+ * smoke-passed, so the `code` tool stays lexical until both the opt-in
17330
+ * and provisioning have completed.
17331
+ *
17332
+ * `GH_ROUTER_DISABLE_SEMANTIC_SEARCH=1` hard-disables and wins over every
17333
+ * opt-in signal (escape hatch for tests and managed environments).
17272
17334
  */
17273
17335
  function semanticSearchOptedIn() {
17274
- return parseBoolEnv(process$1.env.GH_ROUTER_DISABLE_SEMANTIC_SEARCH) !== true;
17336
+ if (parseBoolEnv(process$1.env.GH_ROUTER_DISABLE_SEMANTIC_SEARCH) === true) return false;
17337
+ return state.searchEnabled === true || process$1.env.GH_ROUTER_ENABLE_SEMANTIC_SEARCH === "1";
17275
17338
  }
17276
17339
  /**
17277
17340
  * Availability predicate for ColBERT semantic search — the single
@@ -17534,7 +17597,7 @@ async function runUnifiedCodeSearch(input, signal) {
17534
17597
  const r = await runLexical(input, "lexical", "lexical-fallback", signal);
17535
17598
  return {
17536
17599
  ...r,
17537
- notice: joinNotice(r.notice, "semantic search unavailable on this host; returned lexical results")
17600
+ notice: joinNotice(r.notice, "semantic search is off (launch with --search to enable); returned lexical results")
17538
17601
  };
17539
17602
  }
17540
17603
  let sem;
@@ -19032,7 +19095,7 @@ function logAudit$1(record) {
19032
19095
  try {
19033
19096
  const fs = await import("node:fs/promises");
19034
19097
  const path = await import("node:path");
19035
- const { PATHS } = await import("./paths-BXXCVFvA.js");
19098
+ const { PATHS } = await import("./paths-eHoOwFzZ.js");
19036
19099
  const dir = path.join(PATHS.APP_DIR, "browser-mcp");
19037
19100
  await fs.mkdir(dir, { recursive: true });
19038
19101
  const line = JSON.stringify({
@@ -20871,7 +20934,9 @@ async function callViaChat(model, systemPrompt, userMessage, tool, signal) {
20871
20934
  function: { name: tool.name }
20872
20935
  }
20873
20936
  };
20874
- const msg = (await createChatCompletions(payload, void 0, signal, true)).choices?.[0]?.message;
20937
+ const resp = await createChatCompletions(payload, void 0, signal, true);
20938
+ extractAndRecordAic(model, resp);
20939
+ const msg = resp.choices?.[0]?.message;
20875
20940
  const toolArgs = msg?.tool_calls?.[0]?.function?.arguments;
20876
20941
  if (typeof toolArgs === "string" && toolArgs.length > 0) return JSON.parse(toolArgs);
20877
20942
  const text = typeof msg?.content === "string" ? msg.content : "";
@@ -20909,6 +20974,7 @@ async function callViaResponses(model, systemPrompt, userMessage, tool, signal)
20909
20974
  stablePrefix: systemPrompt
20910
20975
  });
20911
20976
  const resp = await createResponses(payload, void 0, signal, true);
20977
+ extractAndRecordAic(model, resp);
20912
20978
  const output = Array.isArray(resp.output) ? resp.output : [];
20913
20979
  for (const item of output) {
20914
20980
  if (!item || typeof item !== "object") continue;
@@ -25193,6 +25259,7 @@ async function runChatAttempt(stream, payload, opts, signal, state) {
25193
25259
  let activeTextIndex = null;
25194
25260
  const toolPiIndexByOAI = /* @__PURE__ */ new Map();
25195
25261
  let sawDone = false;
25262
+ let aicRecorded = false;
25196
25263
  for await (const evt of sseStream) {
25197
25264
  const data = evt?.data;
25198
25265
  if (data == null) continue;
@@ -25206,6 +25273,9 @@ async function runChatAttempt(stream, payload, opts, signal, state) {
25206
25273
  } catch {
25207
25274
  continue;
25208
25275
  }
25276
+ if (!aicRecorded) {
25277
+ if (extractAndRecordAic(resolved.modelId, chunk) !== void 0) aicRecorded = true;
25278
+ }
25209
25279
  try {
25210
25280
  opts.onChunk?.(chunk);
25211
25281
  } catch {}
@@ -25560,6 +25630,7 @@ async function runResponsesAttempt(stream, payload, opts, signal, state) {
25560
25630
  activeTextIndex = null;
25561
25631
  };
25562
25632
  let sawTerminal = false;
25633
+ let aicRecorded = false;
25563
25634
  for await (const evt of sseStream) {
25564
25635
  const data = evt?.data;
25565
25636
  if (data == null) continue;
@@ -25706,6 +25777,9 @@ async function runResponsesAttempt(stream, payload, opts, signal, state) {
25706
25777
  case "response.completed":
25707
25778
  case "response.incomplete":
25708
25779
  sawTerminal = true;
25780
+ if (!aicRecorded) {
25781
+ if (extractAndRecordAic(resolved.modelId, ev) !== void 0) aicRecorded = true;
25782
+ }
25709
25783
  accum.usage = mapResponsesUsage(ev.response?.usage);
25710
25784
  if (ev.type === "response.incomplete" && ev.response?.incomplete_details?.reason === "max_output_tokens") accum.finishReason = "length";
25711
25785
  if (opts.onChunk && accum.usage) try {
@@ -27963,6 +28037,39 @@ function cheapReviewerModel() {
27963
28037
  if (fastEndpointForModel(found) !== "responses") return void 0;
27964
28038
  return CHEAP_PROFILE_MODELS.reviewer;
27965
28039
  }
28040
+ /** Gemini/high Advisor for the cheapest profile at the 200K default window. */
28041
+ function cheapestAdvisorModel() {
28042
+ const found = state.models?.data.find((m) => m.id === CHEAPEST_PROFILE_ADVISOR_MODEL);
28043
+ if (!found) return void 0;
28044
+ if ((found.capabilities?.limits?.max_context_window_tokens ?? 0) < 2e5) return void 0;
28045
+ if (found.capabilities?.supports?.tool_calls !== true) return void 0;
28046
+ const efforts = found.capabilities?.supports?.reasoning_effort;
28047
+ if (!Array.isArray(efforts) || !efforts.includes("high")) return void 0;
28048
+ if (fastEndpointForModel(found) !== "chat") return void 0;
28049
+ return CHEAPEST_PROFILE_ADVISOR_MODEL;
28050
+ }
28051
+ /** Sol/high Oracle for the cheapest profile at the 200K default window. */
28052
+ function cheapestOracleModel() {
28053
+ const found = state.models?.data.find((m) => m.id === CHEAPEST_PROFILE_ORACLE_MODEL);
28054
+ if (!found) return void 0;
28055
+ if ((found.capabilities?.limits?.max_context_window_tokens ?? 0) < 2e5) return void 0;
28056
+ if ((found.capabilities?.limits?.max_prompt_tokens ?? 0) <= 0) return void 0;
28057
+ const efforts = found.capabilities?.supports?.reasoning_effort;
28058
+ if (!Array.isArray(efforts) || !efforts.includes("high")) return void 0;
28059
+ if (fastEndpointForModel(found) !== "responses") return void 0;
28060
+ return CHEAPEST_PROFILE_ORACLE_MODEL;
28061
+ }
28062
+ /** Gemini/high reviewer for the cheapest profile at the 200K default window. */
28063
+ function cheapestReviewerModel() {
28064
+ const reviewer = state.models?.data.find((m) => m.id === "gemini-3.8-flash");
28065
+ if (!reviewer) return void 0;
28066
+ if (reviewer.capabilities?.supports?.tool_calls !== true) return void 0;
28067
+ if ((reviewer.capabilities?.limits?.max_context_window_tokens ?? 0) < 2e5) return void 0;
28068
+ const efforts = reviewer.capabilities?.supports?.reasoning_effort;
28069
+ if (!Array.isArray(efforts) || !efforts.includes(CHEAPEST_PROFILE_NATIVE_EFFORTS.reviewer)) return void 0;
28070
+ if (fastEndpointForModel(reviewer) !== "chat") return void 0;
28071
+ return "gemini-3.8-flash";
28072
+ }
27966
28073
  /** Exact GPT-6 Astra only: cheap escalation consultant at 200K/medium. */
27967
28074
  function cheapAstraModel() {
27968
28075
  const found = state.models?.data.find((m) => m.id === CHEAP_PROFILE_ASTRA_MODEL);
@@ -28272,10 +28379,10 @@ function activePersonas(launch) {
28272
28379
  };
28273
28380
  });
28274
28381
  }
28275
- function oracleToolEntry(isCheap = false, astraAvailable = true) {
28382
+ function oracleToolEntry(isCheap = false, astraAvailable = true, oracleDescriptor) {
28276
28383
  return {
28277
28384
  name: "oracle",
28278
- description: `Expert consultant backed by ${isCheap ? "Grok 4.6 (200K context, medium effort)" : "exact Opus 5 (1M context, high effort)"} for complex conceptual, algorithmic, spec/protocol, or architectural trade-offs. Stateless and cold-start: evaluates a self-contained brief.\n\nWhen to invoke: use for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs before implementation when repository evidence alone cannot settle them. Preferred over advisor for self-contained technical briefs.\n\nWhen NOT to invoke: not for transcript-aware framing (consult Advisor), ${astraAvailable ? "terminal dead ends (consult Astra), " : "terminal dead ends (no escalation peer on this profile; report the dead end with evidence to the lead), "}routine code lookup, or mechanical facts verifiable by tests.\n\nPass complete context, constraints, minimal code excerpts with path:line, and one precise unresolved question.`,
28385
+ description: `Expert consultant backed by ${oracleDescriptor ?? (isCheap ? "Grok 4.6 (200K context, medium effort)" : "exact Opus 5 (1M context, high effort)")} for complex conceptual, algorithmic, spec/protocol, or architectural trade-offs. Stateless and cold-start: evaluates a self-contained brief.\n\nWhen to invoke: use for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs before implementation when repository evidence alone cannot settle them. Preferred over advisor for self-contained technical briefs.\n\nWhen NOT to invoke: not for transcript-aware framing (consult Advisor), ${astraAvailable ? "terminal dead ends (consult Astra), " : "terminal dead ends (no escalation peer on this profile; report the dead end with evidence to the lead), "}routine code lookup, or mechanical facts verifiable by tests.\n\nPass complete context, constraints, minimal code excerpts with path:line, and one precise unresolved question.`,
28279
28386
  inputSchema: {
28280
28387
  type: "object",
28281
28388
  required: ["query", "context"],
@@ -28391,7 +28498,7 @@ function fastToolIsEnabled(tool) {
28391
28498
  }
28392
28499
  /** Shared Fast projection for list and call, including non-persona dispatch kind. */
28393
28500
  function fastAllowsTool(scope, launch, item) {
28394
- if (launch.profileId !== "fast" && launch.profileId !== "cheap" && launch.profileId !== "cheap1m") return true;
28501
+ if (launch.profileId !== "fast" && launch.profileId !== "cheap" && launch.profileId !== "cheap1m" && launch.profileId !== "cheapest") return true;
28395
28502
  if (scope !== "all" && item.group !== scope) return false;
28396
28503
  if (!launch.allowedGroups?.has(item.group)) return false;
28397
28504
  if (item.persona) return false;
@@ -28443,12 +28550,15 @@ function toolEntries(scope, launch, audience = "shared") {
28443
28550
  }));
28444
28551
  return [...personaEntries, ...nonPersonaEntries];
28445
28552
  }
28446
- if (launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m") {
28447
- const isCheap = launch.profileId === "cheap" || launch.profileId === "cheap1m";
28553
+ if (launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m" || launch.profileId === "cheapest") {
28554
+ const isCheap = launch.profileId === "cheap" || launch.profileId === "cheap1m" || launch.profileId === "cheapest";
28555
+ const isCheapest = launch.profileId === "cheapest";
28448
28556
  const astraWired = launch.profileId === "fast" || launch.profileId === "cheap1m";
28449
- const astraAvailable = astraWired && (isCheap ? cheapAstraModel() : fastAstraModel()) != null;
28557
+ const astraAvailable = astraWired && (isCheap && !isCheapest ? cheapAstraModel() : isCheapest ? void 0 : fastAstraModel()) != null;
28558
+ const oracleGate = isCheapest ? cheapestOracleModel() : isCheap ? cheapOracleModel() : fastOracleModel();
28559
+ const oracleDescriptor = isCheapest ? "GPT-5.6 Sol (200K context, high effort)" : void 0;
28450
28560
  const entries = [];
28451
- if ((scope === "all" || scope === "peers") && launch.allowedGroups?.has("peers") && launch.allowedPersonas?.has("oracle") && (isCheap ? cheapOracleModel() : fastOracleModel())) entries.push(oracleToolEntry(isCheap, astraAvailable));
28561
+ if ((scope === "all" || scope === "peers") && launch.allowedGroups?.has("peers") && launch.allowedPersonas?.has("oracle") && oracleGate) entries.push(oracleToolEntry(isCheap, astraAvailable, oracleDescriptor));
28452
28562
  if ((scope === "all" || scope === "peers") && launch.allowedGroups?.has("peers") && launch.allowedPersonas?.has("astra") && audience === "lead-peers" && astraWired && (isCheap ? cheapAstraModel() : fastAstraModel())) entries.push(astraToolEntry(isCheap));
28453
28563
  for (const tool of NON_PERSONA_MCP_TOOLS) {
28454
28564
  if (!fastAllowsTool(scope, launch, {
@@ -28756,10 +28866,12 @@ async function dispatchModelCall(args) {
28756
28866
  stream: false,
28757
28867
  reasoning: { effort: args.effort }
28758
28868
  }, { workload: "reusable-prefix" });
28759
- return extractResponsesText(await withTransientRetry(() => createResponses(payload, void 0, args.signal), {
28869
+ const response = await withTransientRetry(() => createResponses(payload, void 0, args.signal), {
28760
28870
  signal: args.signal,
28761
28871
  label: resolvedModel
28762
- }));
28872
+ });
28873
+ extractAndRecordAic(resolvedModel, response);
28874
+ return extractResponsesText(response);
28763
28875
  }
28764
28876
  if (args.endpoint === "/v1/messages") {
28765
28877
  const maxTokens = args.effort === "low" ? 4096 : args.effort === "medium" ? 8192 : args.effort === "high" ? 16384 : 32768;
@@ -28787,10 +28899,12 @@ async function dispatchModelCall(args) {
28787
28899
  content: args.userText
28788
28900
  }]
28789
28901
  }), { workload: "reusable-prefix" });
28790
- return extractMessagesText(await (await withTransientRetry(() => createMessages(body, void 0, args.signal), {
28902
+ const json = await (await withTransientRetry(() => createMessages(body, void 0, args.signal), {
28791
28903
  signal: args.signal,
28792
28904
  label: resolvedModel
28793
- })).json());
28905
+ })).json();
28906
+ extractAndRecordAic(resolvedModel, json);
28907
+ return extractMessagesText(json);
28794
28908
  }
28795
28909
  const payload = {
28796
28910
  model: resolvedModel,
@@ -28813,10 +28927,12 @@ async function dispatchModelCall(args) {
28813
28927
  stream: false,
28814
28928
  reasoning_effort: args.effort
28815
28929
  };
28816
- return extractChatCompletionText(await withTransientRetry(() => createChatCompletions(payload, void 0, args.signal), {
28930
+ const response = await withTransientRetry(() => createChatCompletions(payload, void 0, args.signal), {
28817
28931
  signal: args.signal,
28818
28932
  label: resolvedModel
28819
- }));
28933
+ });
28934
+ extractAndRecordAic(resolvedModel, response);
28935
+ return extractChatCompletionText(response);
28820
28936
  }
28821
28937
  async function callPersona(persona, prompt, context, effort, signal, images) {
28822
28938
  const userText = buildUserText(prompt, context);
@@ -28889,7 +29005,7 @@ async function handleToolsCall(body, scope, launch, audience = "shared", session
28889
29005
  tool: maxTool
28890
29006
  }) : false)) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
28891
29007
  }
28892
- if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m") && name !== "oracle" && name !== "astra") {
29008
+ if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m" || launch.profileId === "cheapest") && name !== "oracle" && name !== "astra") {
28893
29009
  const fastPersona = activePersonas(launch).find((persona) => persona.toolNameHttp === name);
28894
29010
  const fastTool = NON_PERSONA_MCP_TOOLS.find((tool) => tool.toolNameHttp === name);
28895
29011
  if (!(fastPersona ? fastAllowsTool(scope, launch, {
@@ -28974,12 +29090,13 @@ async function handleToolsCall(body, scope, launch, audience = "shared", session
28974
29090
  release();
28975
29091
  }
28976
29092
  }
28977
- if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m") && name === "oracle") {
28978
- const isCheapOracle = launch.profileId === "cheap" || launch.profileId === "cheap1m";
28979
- const oracleModel = isCheapOracle ? CHEAP_PROFILE_ORACLE_MODEL : "claude-opus-5";
29093
+ if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m" || launch.profileId === "cheapest") && name === "oracle") {
29094
+ const isCheapestOracle = launch.profileId === "cheapest";
29095
+ const isCheapOracle = launch.profileId === "cheap" || launch.profileId === "cheap1m" || isCheapestOracle;
29096
+ const oracleModel = isCheapestOracle ? CHEAPEST_PROFILE_ORACLE_MODEL : isCheapOracle ? CHEAP_PROFILE_ORACLE_MODEL : "claude-opus-5";
28980
29097
  const oracleEndpoint = isCheapOracle ? "/v1/responses" : "/v1/messages";
28981
- const oracleEffort = isCheapOracle ? CHEAP_PROFILE_ORACLE_EFFORT : "high";
28982
- if (scope !== "all" && scope !== "peers" || !launch.allowedGroups?.has("peers") || !launch.allowedPersonas?.has("oracle") || !(isCheapOracle ? cheapOracleModel() : fastOracleModel())) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
29098
+ const oracleEffort = isCheapestOracle ? CHEAPEST_PROFILE_ORACLE_EFFORT : isCheapOracle ? CHEAP_PROFILE_ORACLE_EFFORT : "high";
29099
+ if (scope !== "all" && scope !== "peers" || !launch.allowedGroups?.has("peers") || !launch.allowedPersonas?.has("oracle") || !(isCheapestOracle ? cheapestOracleModel() : isCheapOracle ? cheapOracleModel() : fastOracleModel())) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
28983
29100
  const query = typeof args.query === "string" ? args.query.trim() : "";
28984
29101
  const context = typeof args.context === "string" ? args.context.trim() : "";
28985
29102
  if (!query || !context) return rpcError(body.id, RPC_INVALID_PARAMS, "tools/call: oracle requires non-empty arguments.query and arguments.context");
@@ -28993,7 +29110,7 @@ async function handleToolsCall(body, scope, launch, audience = "shared", session
28993
29110
  model: oracleModel,
28994
29111
  endpoint: oracleEndpoint,
28995
29112
  description: "Fast/cheap-profile Oracle",
28996
- baseInstructions: isCheapOracle ? "You are Oracle, an expert architectural and technical consultant running on Grok 4.6. You have no tools or repository access. Answer from the supplied context and state assumptions explicitly, noting which facts would change the recommendation. Never claim to execute, verify, approve, merge, or authorize an action." : "You are Oracle, an expert architectural and technical consultant running on Opus 5. You have no tools or repository access. Answer from the supplied context and state assumptions explicitly, noting which facts would change the recommendation. Never claim to execute, verify, approve, merge, or authorize an action.",
29113
+ baseInstructions: isCheapestOracle ? "You are Oracle, an expert architectural and technical consultant running on GPT-5.6 Sol. You have no tools or repository access. Answer from the supplied context and state assumptions explicitly, noting which facts would change the recommendation. Never claim to execute, verify, approve, merge, or authorize an action." : isCheapOracle ? "You are Oracle, an expert architectural and technical consultant running on Grok 4.6. You have no tools or repository access. Answer from the supplied context and state assumptions explicitly, noting which facts would change the recommendation. Never claim to execute, verify, approve, merge, or authorize an action." : "You are Oracle, an expert architectural and technical consultant running on Opus 5. You have no tools or repository access. Answer from the supplied context and state assumptions explicitly, noting which facts would change the recommendation. Never claim to execute, verify, approve, merge, or authorize an action.",
28997
29114
  agentPrompt: "",
28998
29115
  writeCapable: false,
28999
29116
  requiresHttp: true,
@@ -29046,7 +29163,7 @@ async function handleToolsCall(body, scope, launch, audience = "shared", session
29046
29163
  release();
29047
29164
  }
29048
29165
  }
29049
- if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m") && PERSONAS_READ.some((p) => p.toolNameHttp === name)) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
29166
+ if ((launch.profileId === "fast" || launch.profileId === "cheap" || launch.profileId === "cheap1m" || launch.profileId === "cheapest") && PERSONAS_READ.some((p) => p.toolNameHttp === name)) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
29050
29167
  const persona = activePersonas(launch).find((p) => p.toolNameHttp === name);
29051
29168
  const nonPersonaTool = persona ? void 0 : NON_PERSONA_MCP_TOOLS.find((t) => t.toolNameHttp === name);
29052
29169
  if (!persona && !nonPersonaTool) return rpcError(body.id, RPC_METHOD_NOT_FOUND, `tools/call: unknown tool "${name}"`);
@@ -30092,6 +30209,25 @@ const ADVISOR_FAST_PROFILE_MODEL = FAST_PROFILE_ADVISOR_MODEL;
30092
30209
  function fastProfileAdvisorAvailable() {
30093
30210
  return fastEndpointForCatalogId(ADVISOR_FAST_PROFILE_MODEL, state.models?.data) === "responses";
30094
30211
  }
30212
+ /** The Advisor model for an authenticated cheapest primary lead:
30213
+ * `gemini-3.8-flash` at high effort over its Chat endpoint, transcript
30214
+ * capped at `CHEAPEST_PROFILE_ADVISOR_CONTEXT_TOKENS` (200K). */
30215
+ const ADVISOR_CHEAPEST_PROFILE_MODEL = CHEAPEST_PROFILE_ADVISOR_MODEL;
30216
+ /** True only when the live Gemini entry satisfies the fixed cheapest
30217
+ * transport (Chat Completions). */
30218
+ function cheapestProfileAdvisorAvailable() {
30219
+ return fastEndpointForCatalogId(ADVISOR_CHEAPEST_PROFILE_MODEL, state.models?.data) === "chat";
30220
+ }
30221
+ /** Pick the cheapest Advisor model. Throws when the catalog gate fails so
30222
+ * the launch prerequisite surface (not a silent downgrade) owns the error. */
30223
+ function resolveCheapestAdvisorModel() {
30224
+ if (!cheapestProfileAdvisorAvailable()) throw new Error(`cheapest Advisor invariant failed: ${ADVISOR_CHEAPEST_PROFILE_MODEL} must advertise the Chat Completions endpoint`);
30225
+ return {
30226
+ model: ADVISOR_CHEAPEST_PROFILE_MODEL,
30227
+ escalated: false,
30228
+ fastProfile: true
30229
+ };
30230
+ }
30095
30231
  /** Output cap for the Anthropic-branch advisor call when the catalog carries no
30096
30232
  * limits for the resolved model. The value the branch used unconditionally
30097
30233
  * before it became reachable, kept so a catalog-less path is no worse off. */
@@ -33025,7 +33161,9 @@ function advisorTool(getMessages) {
33025
33161
  stream: false,
33026
33162
  reasoning: { effort: WORKER_ADVISOR_EFFORT }
33027
33163
  }, { workload: "reusable-prefix" });
33028
- const text = extractResponsesText(await createResponses(payload, void 0, signal, true));
33164
+ const response = await createResponses(payload, void 0, signal, true);
33165
+ extractAndRecordAic(resolvedModel, response);
33166
+ const text = extractResponsesText(response);
33029
33167
  if (!text) throw new Error("advisor returned empty output");
33030
33168
  return textResult(text);
33031
33169
  } finally {
@@ -36141,11 +36279,12 @@ function buildPeerAwarenessSnippet(opts) {
36141
36279
  `\`mcp__${searchKey}__code\` provides semantic-first code search and \`mcp__${searchKey}__web\` provides citable web sources. Advisor is transcript-aware, primary-lead-only, and unavailable to native subagents and browse workers; it can detect framing drift but is not independent verification.${browserClause}${workerClause}${decideClause}${fleetClause}${agentsClause}${artifactClause}`
36142
36280
  ].join("\n");
36143
36281
  }
36144
- if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m") {
36282
+ if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest") {
36145
36283
  const isCheap = opts.profile === "cheap" || opts.profile === "cheap1m";
36146
- const profileLabel = isCheap ? "cheap" : "fast";
36147
- const oracleDescriptor = isCheap ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
36148
- const astraDescriptor = isCheap ? "200K/medium" : "200K/high";
36284
+ const isCheapest = opts.profile === "cheapest";
36285
+ const profileLabel = isCheapest ? "cheapest" : isCheap ? "cheap" : "fast";
36286
+ const oracleDescriptor = isCheapest ? "GPT-5.6 Sol (200K/high)" : isCheap ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
36287
+ const astraDescriptor = isCheap && !isCheapest ? "200K/medium" : "200K/high";
36149
36288
  const fastPeersKey = key("peers");
36150
36289
  const fastSearchKey = key("search");
36151
36290
  const fastBrowserKey = key("browser");
@@ -36156,7 +36295,7 @@ function buildPeerAwarenessSnippet(opts) {
36156
36295
  return [
36157
36296
  "## Peer review and advisor",
36158
36297
  "",
36159
- `This is the ${profileLabel} launch profile. Follow an evidence-first escalation ladder: settle factual claims directly through code, tests, and builds. Advisor is an optional, non-binding, lead-only transcript-aware sounding board for trajectory guidance, framing checks, or conflicting signals (direction, not dictation), not routine progress, waiting, verification, or completion. \`mcp__${fastPeersKey}__oracle\` is ${oracleDescriptor}, an expert consultant available to the lead and \`Plan\`, preferred over advisor for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs evaluated in a self-contained brief; \`reviewer\` and other subagents cannot call Oracle.${opts.astraAvailable && opts.profile !== "cheap" ? ` \`mcp__${fastPeersKey}__astra\` is GPT-6 Astra (${astraDescriptor}), an expensive terminal escalation consultant available to the lead only for hardest dead ends.` : ""}`,
36298
+ `This is the ${profileLabel} launch profile. Follow an evidence-first escalation ladder: settle factual claims directly through code, tests, and builds. Advisor is an optional, non-binding, lead-only transcript-aware sounding board for trajectory guidance, framing checks, or conflicting signals (direction, not dictation), not routine progress, waiting, verification, or completion. \`mcp__${fastPeersKey}__oracle\` is ${oracleDescriptor}, an expert consultant available to the lead and \`Plan\`, preferred over advisor for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs evaluated in a self-contained brief; \`reviewer\` and other subagents cannot call Oracle.${opts.astraAvailable && (opts.profile === "fast" || opts.profile === "cheap1m") ? ` \`mcp__${fastPeersKey}__astra\` is GPT-6 Astra (${astraDescriptor}), an expensive terminal escalation consultant available to the lead only for hardest dead ends.` : ""}`,
36160
36299
  "",
36161
36300
  `\`mcp__${fastSearchKey}__code\` is semantic-first code search and \`mcp__${fastSearchKey}__web\` surfaces citable sources. Native Task roster: \`Explore\` (mandatory cheap broad discovery, launch in parallel; lead/\`Plan\` delegate rather than self-sweep), \`Plan\` (sequencing, interfaces, migration risk, acceptance criteria in plan mode), \`general-purpose\` (mixed execution), \`implementer\` (bounded coding in a fresh context to preserve lead context), and \`reviewer\` (repo-aware verification after non-trivial changes and always after \`implementer\`). In plan mode, delegate planning to \`Plan\` and do not edit files. Verify claims with concrete repository evidence and tests before declaring done.${browserClause}${workerBrowseClause}${artifactClause}`,
36162
36301
  "Native delegation is ACL-scoped: the lead may invoke all five; `Plan` may invoke `Explore` and `reviewer`; `implementer` and `general-purpose` may invoke `reviewer`; `Explore`, `reviewer`, and `worker-browse` cannot invoke native subagents."
@@ -36221,14 +36360,15 @@ function buildPeerAwarenessSummary(opts) {
36221
36360
  "Max native roster: `Explore` for broad discovery; `Plan` for interfaces, sequencing, risks, and acceptance criteria; `general-purpose` for bounded mixed execution; `implementer` for settled coding changes; `reviewer` for repository-aware verification and reproduction; `brainstorm` for materially different open approaches; and `peer-review-coordinator` for several distinct fresh-context review lenses. Configured models are deliberate role defaults.",
36222
36361
  "Native roles can inspect the repository within their listed tools. Fresh-context peers see only the artifact and constraints supplied to them. Advisor is transcript-aware, optional, non-binding, and primary-lead-only; it can identify framing drift but is not independent verification or an approval gate. Detailed routing lives in each role or tool description, and the full gated capability inventory lives in CLAUDE.md."
36223
36362
  ].join("\n");
36224
- if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m") {
36363
+ if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest") {
36225
36364
  const isCheap = opts.profile === "cheap" || opts.profile === "cheap1m";
36226
- const profileLabel = isCheap ? "Cheap" : "Fast";
36227
- const oracleDescriptor = isCheap ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
36228
- const astraDescriptor = isCheap ? "200K/medium" : "200K/high";
36365
+ const isCheapest = opts.profile === "cheapest";
36366
+ const profileLabel = isCheapest ? "Cheapest" : isCheap ? "Cheap" : "Fast";
36367
+ const oracleDescriptor = isCheapest ? "GPT-5.6 Sol (200K/high)" : isCheap ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
36368
+ const astraDescriptor = isCheap && !isCheapest ? "200K/medium" : "200K/high";
36229
36369
  const browserClause = opts.browserToolsAvailable ?? opts.browseAvailable ? ` \`mcp__${key("browser")}__*\` provides the opt-in browser.` : "";
36230
36370
  const workerBrowseClause = opts.browseAvailable ? ` \`worker-browse\` runs delegated browsing tasks through \`mcp__${key("workers")}__browse\`.` : "";
36231
- const astraClause = opts.astraAvailable && opts.profile !== "cheap" ? ` \`mcp__${key("peers")}__astra\` is GPT-6 Astra (${astraDescriptor}), lead-only escalation for hardest dead ends.` : "";
36371
+ const astraClause = opts.astraAvailable && (opts.profile === "fast" || opts.profile === "cheap1m") ? ` \`mcp__${key("peers")}__astra\` is GPT-6 Astra (${astraDescriptor}), lead-only escalation for hardest dead ends.` : "";
36232
36372
  return [
36233
36373
  "## Injected capabilities (summary)",
36234
36374
  "",
@@ -37619,6 +37759,6 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
37619
37759
  return [...new Set(names)];
37620
37760
  }
37621
37761
  //#endregion
37622
- export { UNKNOWN_EFFORT_ANCHOR as $, colbertDegradedWarning as $t, TOOLBELT_TOOLS$1 as A, CHEAP_PROFILE_MODELS as An, scribeModel as At, resolveAdvisorEffort as B, registerLaunch as Bt, runWorkerAgent as C, upstreamMaxConnections as Cn, generalPurposeFastModel as Ct, toolbeltEnabled as D, withOneMSuffix as Dn, reviewerFastModel as Dt, buildToolbeltAwareness as E, oneMContextDisabled as En, resolveGeminiReviewModel as Et, ADVISOR_TOOL_INSTRUCTIONS as F, withInstallLock as Fn, createMessages as Ft, repairRejectedThinkingHistory as G, createResponses as Gt, formatThinkingRepairDecline as H, assembleResponsesPayload as Ht, FAST_ADVISOR_TOOL_INSTRUCTIONS as I, getTextTokenCount as It, isControllerClosedError as J, readResponseBodyCapped as Jt, buildAnthropicErrorEvent as K, createChatCompletions as Kt, buildAdvisorStream as L, getTokenCount as Lt, satisfiesMinVersion as M, CHEAP_PROFILE_NATIVE_EFFORTS as Mn, workerToolsEnabled as Mt, searchWeb as N, CHEAP_PROFILE_NATIVE_MODELS as Nn, shimDefaultsToXhigh as Nt, toolbeltSkipSet as O, withOneMSuffixForLead as On, reviewerModel as Ot, ADVISOR_INTERNAL_TOOL_NAME as P, CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS as Pn, countTokens as Pt, EFFORT_ORDER as Q, hasSupportedBrowserInstalled as Qt, injectAdvisorTool as R, getTokenizerFromModel as Rt, resolveWorkerRunOpts as S, upstreamAllowH2 as Sn, geminiAvailable as St, availableToolCommands as T, catalogAdvertises1M as Tn, nativeSubagentModel as Tt, rememberThinkingHistoryRepair as U, warnOnTokenPriceDrift as Ut, resolveAdvisorModel as V, unregisterLaunch as Vt, repairKnownThinkingHistory as W, resolveMcpToolTimeoutMs as Wt, readIteratorWithTimeout as X, normalizeOpenAIUsage as Xt, logStreamError as Y, parseJsonOrDiagnose as Yt, relayAnthropicStream as Z, provisionBrowserAssets as Zt, REVIEW_DEFAULT_MODEL as _, UPSTREAM_INACTIVITY_TIMEOUT_MS as _n, fastOracleModel as _t, buildAgentPrompt as a, CONDENSED_OPERATING_SEQUENCE as an, artifactToolsEnabled as at, resolveDefaultModel as b, pickClaudeDefault as bn, fastScoutModel as bt, enumerateInjectedMcpToolNames as c, collapsePathKeys as cn, browserCompoundToolsEnabled as ct, BROWSE_DEFAULT_MODEL as d, BUDGET_SMALL_FAST_SLUG as dn, cheapOracleModel as dt, provisionAndIndexColbert as en, bucketEffort as et, DEFAULT_MODEL_CHAIN as f, DEFAULT_CLAUDE_MODEL_FALLBACKS as fn, cheapReviewerModel as ft, PLAN_DEFAULT_MODEL as g, UPSTREAM_FETCH_TIMEOUT_MS as gn, fastImplementerModel as gt, IMPLEMENT_DEFAULT_MODEL as h, DEFAULT_PORT as hn, fastGeneralPurposeModel as ht, assertMcpToolSurfaceConsistent as i, provisionTreeSitterAssets as in, agentToolsEnabled as it, assetFor as j, CHEAP_PROFILE_NATIVE_AGENT_NAMES as jn, standInToolEnabled as jt, vscodeRipgrepPath as k, CHEAP_PROFILE_ADVISOR_CLIENT_MODEL as kn, scoutModel as kt, maxPersonasFor as l, toolbeltPathOverride as ln, browserToolsEnabled as lt, EXPLORE_DEFAULT_THINKING as m, DEFAULT_CODEX_MODEL_FALLBACKS as mn, fastAstraModel as mt, MCP_GROUPS as n, extractZipMember as nn, handleMcpDelete as nt, buildPeerAwarenessSnippet as o, DEFINITION_OF_GREATNESS as on, brainstormModel as ot, EXPLORE_DEFAULT_MODEL as p, DEFAULT_CODEX_MODEL as pn, fastAdvisorModel as pt, buildOpenAIErrorEvent as q, MAX_RESPONSE_BODY_BYTES as qt, agentNamesForToolAllowlist as r, warmTreeSitterPool as rn, handleMcpPost as rt, buildPeerAwarenessSummary as s, shouldUseInsecureTls as sn, browseAgentEnabled as st, GROUP_META as t, extractTarGzMember as tn, clampEffort as tt, personasFor as u, BUDGET_SMALL_FAST_CATALOG_ID as un, cheapAdvisorModel as ut, TEST_DEFAULT_MODEL as v, generateRandomPort as vn, fastPlanModel as vt, buildEnv as w, classifyMessagesRoute as wn, implementerFastModel as wt, resolveModeDefaults as x, resolveLeadSlugArg as xn, fleetToolsEnabled as xt, appendPlanReminder as y, isBudgetClaudeLead as yn, fastReviewerModel as yt, isAdvisorRequested as z, findLaunchBySecret as zt };
37762
+ export { EFFORT_ORDER as $, parseJsonOrDiagnose as $t, TOOLBELT_TOOLS$1 as A, oneMContextDisabled as An, resolveGeminiReviewModel as At, resolveAdvisorEffort as B, CHEAP_PROFILE_MODELS as Bn, getTextTokenCount as Bt, runWorkerAgent as C, isBudgetClaudeLead as Cn, fastReviewerModel as Ct, toolbeltEnabled as D, upstreamMaxConnections as Dn, generalPurposeFastModel as Dt, buildToolbeltAwareness as E, upstreamAllowH2 as En, geminiAvailable as Et, ADVISOR_TOOL_INSTRUCTIONS as F, CHEAPEST_PROFILE_NATIVE_AGENT_NAMES as Fn, standInToolEnabled as Ft, repairKnownThinkingHistory as G, withInstallLock as Gn, unregisterLaunch as Gt, resolveCheapestAdvisorModel as H, CHEAP_PROFILE_NATIVE_EFFORTS as Hn, getTokenizerFromModel as Ht, FAST_ADVISOR_TOOL_INSTRUCTIONS as I, CHEAPEST_PROFILE_NATIVE_EFFORTS as In, workerToolsEnabled as It, buildOpenAIErrorEvent as J, resolveMcpToolTimeoutMs as Jt, repairRejectedThinkingHistory as K, assembleResponsesPayload as Kt, buildAdvisorStream as L, CHEAPEST_PROFILE_NATIVE_MODELS as Ln, shimDefaultsToXhigh as Lt, satisfiesMinVersion as M, withOneMSuffixForLead as Mn, reviewerModel as Mt, searchWeb as N, CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL as Nn, scoutModel as Nt, toolbeltSkipSet as O, classifyMessagesRoute as On, implementerFastModel as Ot, ADVISOR_INTERNAL_TOOL_NAME as P, CHEAPEST_PROFILE_MODELS as Pn, scribeModel as Pt, relayAnthropicStream as Q, readResponseBodyCapped as Qt, injectAdvisorTool as R, CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS as Rn, countTokens as Rt, resolveWorkerRunOpts as S, generateRandomPort as Sn, fastPlanModel as St, availableToolCommands as T, resolveLeadSlugArg as Tn, fleetToolsEnabled as Tt, formatThinkingRepairDecline as U, CHEAP_PROFILE_NATIVE_MODELS as Un, findLaunchBySecret as Ut, resolveAdvisorModel as V, CHEAP_PROFILE_NATIVE_AGENT_NAMES as Vn, getTokenCount as Vt, rememberThinkingHistoryRepair as W, CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS as Wn, registerLaunch as Wt, logStreamError as X, createChatCompletions as Xt, isControllerClosedError as Y, createResponses as Yt, readIteratorWithTimeout as Z, MAX_RESPONSE_BODY_BYTES as Zt, REVIEW_DEFAULT_MODEL as _, DEFAULT_CODEX_MODEL as _n, fastAdvisorModel as _t, buildAgentPrompt as a, extractTarGzMember as an, agentToolsEnabled as at, resolveDefaultModel as b, UPSTREAM_FETCH_TIMEOUT_MS as bn, fastImplementerModel as bt, enumerateInjectedMcpToolNames as c, provisionTreeSitterAssets as cn, browseAgentEnabled as ct, BROWSE_DEFAULT_MODEL as d, shouldUseInsecureTls as dn, cheapAdvisorModel as dt, normalizeOpenAIUsage as en, UNKNOWN_EFFORT_ANCHOR as et, DEFAULT_MODEL_CHAIN as f, collapsePathKeys as fn, cheapOracleModel as ft, PLAN_DEFAULT_MODEL as g, DEFAULT_CLAUDE_MODEL_FALLBACKS as gn, cheapestReviewerModel as gt, IMPLEMENT_DEFAULT_MODEL as h, BUDGET_SMALL_FAST_SLUG as hn, cheapestOracleModel as ht, assertMcpToolSurfaceConsistent as i, provisionAndIndexColbert as in, handleMcpPost as it, assetFor as j, withOneMSuffix as jn, reviewerFastModel as jt, vscodeRipgrepPath as k, catalogAdvertises1M as kn, nativeSubagentModel as kt, maxPersonasFor as l, CONDENSED_OPERATING_SEQUENCE as ln, browserCompoundToolsEnabled as lt, EXPLORE_DEFAULT_THINKING as m, BUDGET_SMALL_FAST_CATALOG_ID as mn, cheapestAdvisorModel as mt, MCP_GROUPS as n, hasSupportedBrowserInstalled as nn, clampEffort as nt, buildPeerAwarenessSnippet as o, extractZipMember as on, artifactToolsEnabled as ot, EXPLORE_DEFAULT_MODEL as p, toolbeltPathOverride as pn, cheapReviewerModel as pt, buildAnthropicErrorEvent as q, warnOnTokenPriceDrift as qt, agentNamesForToolAllowlist as r, colbertDegradedWarning as rn, handleMcpDelete as rt, buildPeerAwarenessSummary as s, warmTreeSitterPool as sn, brainstormModel as st, GROUP_META as t, provisionBrowserAssets as tn, bucketEffort as tt, personasFor as u, DEFINITION_OF_GREATNESS as un, browserToolsEnabled as ut, TEST_DEFAULT_MODEL as v, DEFAULT_CODEX_MODEL_FALLBACKS as vn, fastAstraModel as vt, buildEnv as w, pickClaudeDefault as wn, fastScoutModel as wt, resolveModeDefaults as x, UPSTREAM_INACTIVITY_TIMEOUT_MS as xn, fastOracleModel as xt, appendPlanReminder as y, DEFAULT_PORT as yn, fastGeneralPurposeModel as yt, isAdvisorRequested as z, CHEAP_PROFILE_ADVISOR_CLIENT_MODEL as zn, createMessages as zt };
37623
37763
 
37624
- //# sourceMappingURL=peer-mcp-personas-CYWJSxPK.js.map
37764
+ //# sourceMappingURL=peer-mcp-personas-CRMVuMVF.js.map