github-router 0.3.346 → 0.3.348

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 (72) hide show
  1. package/README.md +6 -6
  2. package/dist/{attribution-settings-DyzvcqWL.js → attribution-settings-P_vba-ri.js} +28 -18
  3. package/dist/attribution-settings-P_vba-ri.js.map +1 -0
  4. package/dist/{balanced-profile-contract-C6AgFJNp.js → balanced-profile-contract-XiIj4O1U.js} +7 -7
  5. package/dist/balanced-profile-contract-XiIj4O1U.js.map +1 -0
  6. package/dist/browser-ext/manifest.json +1 -1
  7. package/dist/{claude-Bc-4s27I.js → claude-D26fp1ih.js} +21 -20
  8. package/dist/claude-D26fp1ih.js.map +1 -0
  9. package/dist/{codex-D6ZfS7hJ.js → codex-DM97sCtu.js} +5 -5
  10. package/dist/{codex-D6ZfS7hJ.js.map → codex-DM97sCtu.js.map} +1 -1
  11. package/dist/copilot-discount-CilBhKQW.js.map +1 -1
  12. package/dist/engine-VTQo0qUy.js +2 -0
  13. package/dist/{gate-discovery-TC3k4dr1.js → gate-discovery-V-mslLHt.js} +4 -4
  14. package/dist/{gate-discovery-TC3k4dr1.js.map → gate-discovery-V-mslLHt.js.map} +1 -1
  15. package/dist/hooks.mjs +258 -10
  16. package/dist/hooks.sha256 +1 -1
  17. package/dist/{internal-artifact-open-lta2UPnE.js → internal-artifact-open-CXJbMXpq.js} +2 -2
  18. package/dist/{internal-artifact-open-lta2UPnE.js.map → internal-artifact-open-CXJbMXpq.js.map} +1 -1
  19. package/dist/{internal-fast-dispatch-guard-7UiD_vM5.js → internal-fast-dispatch-guard-DRsZJ-Rg.js} +2 -2
  20. package/dist/{internal-fast-dispatch-guard-7UiD_vM5.js.map → internal-fast-dispatch-guard-DRsZJ-Rg.js.map} +1 -1
  21. package/dist/{internal-fast-dispatch-guard-ByXUE5oO.js → internal-fast-dispatch-guard-DeZ6KilC.js} +1 -1
  22. package/dist/{internal-max-dispatch-guard-CioyE9wn.js → internal-max-dispatch-guard-DSjJwVH2.js} +3 -3
  23. package/dist/internal-max-dispatch-guard-DSjJwVH2.js.map +1 -0
  24. package/dist/{internal-max-dispatch-guard-BSRTtOit.js → internal-max-dispatch-guard-KmbYwh7h.js} +1 -1
  25. package/dist/{internal-plan-review-B4f0dpss.js → internal-plan-review-F-WbltsT.js} +3 -3
  26. package/dist/{internal-plan-review-B4f0dpss.js.map → internal-plan-review-F-WbltsT.js.map} +1 -1
  27. package/dist/{internal-prompt-submit-BMJ0A7vR.js → internal-prompt-submit-B1nd4y4V.js} +92 -6
  28. package/dist/internal-prompt-submit-B1nd4y4V.js.map +1 -0
  29. package/dist/{internal-session-bind-IpZ5hJzR.js → internal-session-bind-LrYEo-kg.js} +2 -2
  30. package/dist/{internal-session-bind-IpZ5hJzR.js.map → internal-session-bind-LrYEo-kg.js.map} +1 -1
  31. package/dist/{internal-stop-hook-BjdKy6On.js → internal-stop-hook-v5WF6Kc2.js} +5 -5
  32. package/dist/{internal-stop-hook-BjdKy6On.js.map → internal-stop-hook-v5WF6Kc2.js.map} +1 -1
  33. package/dist/{internal-stop-review-C7bOxX1q.js → internal-stop-review-nL003JIj.js} +2 -2
  34. package/dist/{internal-stop-review-C7bOxX1q.js.map → internal-stop-review-nL003JIj.js.map} +1 -1
  35. package/dist/main.js +13 -13
  36. package/dist/{max-profile-contract-LTJstj1e.js → max-profile-contract--dAYkEG1.js} +5 -4
  37. package/dist/max-profile-contract--dAYkEG1.js.map +1 -0
  38. package/dist/{orchestration-BMISq91N.js → orchestration-DjuJRhXn.js} +2 -2
  39. package/dist/{orchestration-BMISq91N.js.map → orchestration-DjuJRhXn.js.map} +1 -1
  40. package/dist/{peer-mcp-personas-CIV3aDP6.js → peer-mcp-personas-C200IycG.js} +107 -71
  41. package/dist/peer-mcp-personas-C200IycG.js.map +1 -0
  42. package/dist/{pi-CugyWYp7.js → pi-BWGfNpi7.js} +8 -5
  43. package/dist/pi-BWGfNpi7.js.map +1 -0
  44. package/dist/{plan-review-hook-BTvxvCCo.js → plan-review-hook-DMqPHBBN.js} +2 -2
  45. package/dist/{plan-review-hook-BTvxvCCo.js.map → plan-review-hook-DMqPHBBN.js.map} +1 -1
  46. package/dist/prompt-submit-hook-wjuHUrpS.js +352 -0
  47. package/dist/prompt-submit-hook-wjuHUrpS.js.map +1 -0
  48. package/dist/{provision-J68elA3c.js → provision-BFTONLfA.js} +3 -3
  49. package/dist/{provision-J68elA3c.js.map → provision-BFTONLfA.js.map} +1 -1
  50. package/dist/{serve-BEY7EjEv.js → serve-D9xQeGqi.js} +8 -8
  51. package/dist/{serve-BEY7EjEv.js.map → serve-D9xQeGqi.js.map} +1 -1
  52. package/dist/{server-setup-tNMUzFgE.js → server-setup-R1HQtpR9.js} +77 -35
  53. package/dist/server-setup-R1HQtpR9.js.map +1 -0
  54. package/dist/{start-BDxUhfDG.js → start-vg2n8UjI.js} +4 -4
  55. package/dist/{start-BDxUhfDG.js.map → start-vg2n8UjI.js.map} +1 -1
  56. package/dist/{stop-gate-hook-DBcxPgkF.js → stop-gate-hook-DRcYQAtf.js} +3 -3
  57. package/dist/{stop-gate-hook-DBcxPgkF.js.map → stop-gate-hook-DRcYQAtf.js.map} +1 -1
  58. package/dist/{stop-gate-policy-Gd_cNT9-.js → stop-gate-policy-CbLklfV2.js} +21 -2
  59. package/dist/{stop-gate-policy-Gd_cNT9-.js.map → stop-gate-policy-CbLklfV2.js.map} +1 -1
  60. package/package.json +1 -1
  61. package/dist/attribution-settings-DyzvcqWL.js.map +0 -1
  62. package/dist/balanced-profile-contract-C6AgFJNp.js.map +0 -1
  63. package/dist/claude-Bc-4s27I.js.map +0 -1
  64. package/dist/engine-PexAztE4.js +0 -2
  65. package/dist/internal-max-dispatch-guard-CioyE9wn.js.map +0 -1
  66. package/dist/internal-prompt-submit-BMJ0A7vR.js.map +0 -1
  67. package/dist/max-profile-contract-LTJstj1e.js.map +0 -1
  68. package/dist/peer-mcp-personas-CIV3aDP6.js.map +0 -1
  69. package/dist/pi-CugyWYp7.js.map +0 -1
  70. package/dist/prompt-submit-hook-BeLUDy_m.js +0 -173
  71. package/dist/prompt-submit-hook-BeLUDy_m.js.map +0 -1
  72. package/dist/server-setup-tNMUzFgE.js.map +0 -1
@@ -6,9 +6,9 @@ import { _ as forwardError, a as cacheCopilotVersion, b as copilotBaseUrl, c as
6
6
  import { r as fetchWithTransientRetry } from "./upstream-retry-i1k1Xai2.js";
7
7
  import { t as getCopilotUsage } from "./get-copilot-usage-C_6ast5h.js";
8
8
  import { c as runCommandVoid, i as parseBoolEnv, o as resolveExecutable, r as killManagedTree, s as runCommandCapture } from "./exec-MCU1H-KZ.js";
9
- import { _ as FAST_PROFILE_MODELS, f as FAST_PROFILE_ADVISOR_MODEL, i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, l as BALANCED_PROFILE_SUBAGENT_CONTEXT_TOKENS, n as BALANCED_PROFILE_LEAD_EFFORT, r as BALANCED_PROFILE_MODELS, v as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./balanced-profile-contract-C6AgFJNp.js";
10
- import { $ as EFFORT_ORDER, $t as readResponseBodyCapped, An as withOneMSuffixForLead, B as resolveAdvisorEffort, Bn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Bt as createMessages, D as toolbeltEnabled, Dn as catalogAdvertises1M, En as classifyMessagesRoute, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, G as repairKnownThinkingHistory, H as resolveCheapestAdvisorModel, Hn as CHEAP_PROFILE_MODELS, Ht as getTokenCount, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as buildOpenAIErrorEvent, Jt as warnOnTokenPriceDrift, K as repairRejectedThinkingHistory, Kn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, L as buildAdvisorStream, N as searchWeb, On as oneMContextDisabled, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAPEST_PROFILE_MODELS, Q as relayAnthropicStream, Qt as MAX_RESPONSE_BODY_BYTES, R as injectAdvisorTool, Rt as shimDefaultsToXhigh, Tn as upstreamMaxConnections, U as formatThinkingRepairDecline, Un as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Ut as getTokenizerFromModel, V as resolveAdvisorModel, Vn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, Vt as getTextTokenCount, W as rememberThinkingHistoryRepair, Wt as findLaunchBySecret, X as logStreamError, Xt as createResponses, Y as isControllerClosedError, Yt as resolveMcpToolTimeoutMs, Z as readIteratorWithTimeout, Zt as createChatCompletions, at as agentToolsEnabled, bn as generateRandomPort, dn as toolbeltPathOverride, en as parseJsonOrDiagnose, et as UNKNOWN_EFFORT_ANCHOR, i as assertMcpToolSurfaceConsistent, it as handleMcpPost, jn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, kn as withOneMSuffix, nt as clampEffort, pn as BUDGET_SMALL_FAST_SLUG, q as buildAnthropicErrorEvent, qt as assembleResponsesPayload, rt as handleMcpDelete, tn as normalizeOpenAIUsage, tt as bucketEffort, vn as UPSTREAM_FETCH_TIMEOUT_MS, wn as upstreamAllowH2, xn as isBudgetClaudeLead, yn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as isAdvisorRequested, zt as countTokens } from "./peer-mcp-personas-CIV3aDP6.js";
11
- import { A as normalizeTrailingOneMSuffix, a as MAX_PROFILE_NATIVE_AGENT_NAMES, d as maxAdvisorPinIsValid, h as maxOpusModel, i as MAX_PROFILE_MODELS, j as stripTrailingOneMSuffix, k as fastEndpointForModel, l as maxAdvisorEffortForModel, n as MAX_PROFILE_ALLOWED_LEAD_MODEL_IDS, t as MAX_PROFILE_ADVISOR_INSTRUCTIONS, u as maxAdvisorModelFromPin, y as validateMaxProfilePrerequisites } from "./max-profile-contract-LTJstj1e.js";
9
+ import { _ as FAST_PROFILE_MODELS, f as FAST_PROFILE_ADVISOR_MODEL, i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, l as BALANCED_PROFILE_SUBAGENT_CONTEXT_TOKENS, n as BALANCED_PROFILE_LEAD_EFFORT, r as BALANCED_PROFILE_MODELS, v as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./balanced-profile-contract-XiIj4O1U.js";
10
+ import { $ as readIteratorWithTimeout, $t as createChatCompletions, An as oneMContextDisabled, B as injectAdvisorTool, Bt as shimDefaultsToXhigh, Cn as isBudgetClaudeLead, D as toolbeltEnabled, Dn as upstreamMaxConnections, En as upstreamAllowH2, F as ADVISOR_TOOL_INSTRUCTIONS, G as formatThinkingRepairDecline, Gn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Gt as getTokenizerFromModel, H as resolveAdvisorEffort, Hn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Ht as createMessages, I as CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS, In as CHEAPEST_PROFILE_MODELS, J as repairRejectedThinkingHistory, Jn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, K as rememberThinkingHistoryRepair, Kt as findLaunchBySecret, L as CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, Ln as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Mn as withOneMSuffixForLead, N as searchWeb, Nn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, On as classifyMessagesRoute, P as ADVISOR_INTERNAL_TOOL_NAME, Q as logStreamError, Qt as createResponses, R as FAST_ADVISOR_TOOL_INSTRUCTIONS, Sn as generateRandomPort, U as resolveAdvisorModel, Un as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, Ut as getTextTokenCount, V as isAdvisorRequested, Vt as countTokens, W as resolveCheapestAdvisorModel, Wn as CHEAP_PROFILE_MODELS, Wt as getTokenCount, X as buildOpenAIErrorEvent, Xt as warnOnTokenPriceDrift, Y as buildAnthropicErrorEvent, Yt as assembleResponsesPayload, Z as isControllerClosedError, Zt as resolveMcpToolTimeoutMs, at as handleMcpDelete, bn as UPSTREAM_FETCH_TIMEOUT_MS, en as MAX_RESPONSE_BODY_BYTES, et as relayAnthropicStream, hn as BUDGET_SMALL_FAST_SLUG, i as assertMcpToolSurfaceConsistent, it as clampEffort, jn as withOneMSuffix, kn as catalogAdvertises1M, nn as parseJsonOrDiagnose, nt as UNKNOWN_EFFORT_ANCHOR, ot as handleMcpPost, pn as toolbeltPathOverride, q as repairKnownThinkingHistory, rn as normalizeOpenAIUsage, rt as bucketEffort, st as agentToolsEnabled, tn as readResponseBodyCapped, tt as EFFORT_ORDER, xn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as buildAdvisorStream } from "./peer-mcp-personas-C200IycG.js";
11
+ import { A as normalizeTrailingOneMSuffix, a as MAX_PROFILE_NATIVE_AGENT_NAMES, d as maxAdvisorPinIsValid, h as maxOpusModel, i as MAX_PROFILE_MODELS, j as stripTrailingOneMSuffix, k as fastEndpointForModel, l as maxAdvisorEffortForModel, n as MAX_PROFILE_ALLOWED_LEAD_MODEL_IDS, t as MAX_PROFILE_ADVISOR_INSTRUCTIONS, u as maxAdvisorModelFromPin, y as validateMaxProfilePrerequisites } from "./max-profile-contract--dAYkEG1.js";
12
12
  import { a as extractAndRecordPricedAic, f as copilotUsageToWire, h as nanoAiuToCredits, i as extractAndRecordAic, l as recordAic, m as formatAic, p as extractCopilotUsage } from "./aic-ledger-D4oMcg7c.js";
13
13
  import consola from "consola";
14
14
  import fs, { existsSync } from "node:fs";
@@ -576,7 +576,7 @@ const CHEAP_REVIEWER_ALIAS_ID = "gh-router-cheap-reviewer-max";
576
576
  const CHEAPEST_EXPLORE_ALIAS_ID = "gh-router-cheapest-explore-high";
577
577
  const CHEAPEST_GENERAL_PURPOSE_ALIAS_ID = "gh-router-cheapest-general-purpose-xhigh";
578
578
  const CHEAPEST_IMPLEMENTER_ALIAS_ID = "gh-router-cheapest-implementer-max";
579
- const CHEAPEST_REVIEWER_ALIAS_ID = "gh-router-cheapest-reviewer-high";
579
+ const CHEAPEST_REVIEWER_ALIAS_ID = "gh-router-cheapest-reviewer-max";
580
580
  /**
581
581
  * Balanced-profile subagent aliases (`-m balanced`). Same non-catalog
582
582
  * mechanism as the cheap aliases above, with the balanced roster's own
@@ -663,7 +663,8 @@ const RETIRED_FAST_ALIAS_IDS = /* @__PURE__ */ new Set([
663
663
  LUNA_IMPLEMENTER_ALIAS_ID,
664
664
  FAST_CRITIC_ALIAS_ID,
665
665
  "gh-router-balanced-general-purpose-high",
666
- "gh-router-balanced-reviewer-max"
666
+ "gh-router-balanced-reviewer-max",
667
+ "gh-router-cheapest-reviewer-high"
667
668
  ]);
668
669
  const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
669
670
  [LUNA_DRIVER_ALIAS_ID, {
@@ -744,7 +745,7 @@ const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
744
745
  [CHEAPEST_REVIEWER_ALIAS_ID, {
745
746
  aliasId: CHEAPEST_REVIEWER_ALIAS_ID,
746
747
  realModel: CHEAPEST_PROFILE_MODELS.reviewer,
747
- absentEffortDefault: "high"
748
+ absentEffortDefault: "max"
748
749
  }],
749
750
  [BALANCED_EXPLORE_ALIAS_ID, {
750
751
  aliasId: BALANCED_EXPLORE_ALIAS_ID,
@@ -1023,10 +1024,10 @@ function formatCheapPrerequisiteFailure(missing) {
1023
1024
  const CHEAPEST_SUBAGENT_MIN_CONTEXT_TOKENS = CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS;
1024
1025
  /**
1025
1026
  * Validate the live Copilot catalog for `-m cheapest`: Luna lead at the 200K
1026
- * default window, Luna Explore/GP roles, a Sol/high reviewer, a Sol/high
1027
- * Oracle, and a Sol/medium Advisor — all at the 200K default with
1028
- * their fixed efforts and supported endpoints. There is no `Plan` role: the
1029
- * lead plans directly.
1027
+ * default window, Luna Explore/GP roles, a Luna/max reviewer (protege of the
1028
+ * Sol Advisor), a Sol/high Oracle, and a Sol/medium Advisor — all at the
1029
+ * 200K default with their fixed efforts and supported endpoints. There is no
1030
+ * `Plan` role: the lead plans directly.
1030
1031
  *
1031
1032
  * `opts.peers === false` (the Pi `--no-peers` path) validates the LEAD only:
1032
1033
  * no peer or native-role model is used in that launch, so requiring them
@@ -1439,8 +1440,8 @@ function listModelsForEndpoint(path) {
1439
1440
  //#region src/lib/model-picker-settings.ts
1440
1441
  const STANDARD_PICKER_MODELS = Object.freeze([
1441
1442
  {
1442
- id: "gpt-6-sol",
1443
- label: "GPT-6 Sol",
1443
+ id: "gpt-5.6-sol",
1444
+ label: "GPT-5.6 Sol",
1444
1445
  behavesAs: "claude-opus-5.5"
1445
1446
  },
1446
1447
  {
@@ -1463,7 +1464,7 @@ const STANDARD_PICKER_MODELS = Object.freeze([
1463
1464
  const MAX_PICKER_MODELS = Object.freeze([
1464
1465
  {
1465
1466
  id: MAX_PROFILE_MODELS.sol,
1466
- label: "GPT-6 Sol",
1467
+ label: "GPT-5.6 Sol",
1467
1468
  behavesAs: "claude-opus-5.5"
1468
1469
  },
1469
1470
  {
@@ -1484,8 +1485,8 @@ const MAX_PICKER_MODELS = Object.freeze([
1484
1485
  ]);
1485
1486
  const CHEAP_PICKER_MODELS = Object.freeze([
1486
1487
  {
1487
- id: "gpt-6-sol",
1488
- label: "GPT-6 Sol",
1488
+ id: "gpt-5.6-sol",
1489
+ label: "GPT-5.6 Sol",
1489
1490
  behavesAs: "claude-opus-5.5",
1490
1491
  neverOneM: true
1491
1492
  },
@@ -1509,8 +1510,8 @@ const CHEAP_PICKER_MODELS = Object.freeze([
1509
1510
  }
1510
1511
  ]);
1511
1512
  const CHEAPEST_PICKER_MODELS = Object.freeze([{
1512
- id: "gpt-6-sol",
1513
- label: "GPT-6 Sol",
1513
+ id: "gpt-5.6-sol",
1514
+ label: "GPT-5.6 Sol",
1514
1515
  behavesAs: "claude-opus-5.5",
1515
1516
  neverOneM: true
1516
1517
  }, {
@@ -1521,8 +1522,8 @@ const CHEAPEST_PICKER_MODELS = Object.freeze([{
1521
1522
  }]);
1522
1523
  const BALANCED_PICKER_MODELS = Object.freeze([
1523
1524
  {
1524
- id: "gpt-6-sol",
1525
- label: "GPT-6 Sol",
1525
+ id: "gpt-5.6-sol",
1526
+ label: "GPT-5.6 Sol",
1526
1527
  behavesAs: "claude-opus-5.5",
1527
1528
  neverOneM: true
1528
1529
  },
@@ -2514,7 +2515,7 @@ function collectToolFieldKeys(body) {
2514
2515
  //#endregion
2515
2516
  //#region package.json
2516
2517
  var name = "github-router";
2517
- var version = "0.3.346";
2518
+ var version = "0.3.348";
2518
2519
  //#endregion
2519
2520
  //#region src/lib/approval.ts
2520
2521
  const awaitApproval = async () => {
@@ -5690,7 +5691,7 @@ function explicitEffortOf(value) {
5690
5691
  * balanced) shares fast's effort mapping (same model-to-effort rows, just
5691
5692
  * bare subagent slugs at the wiring layer), so this preprocess is shared.
5692
5693
  * Note the reviewer differs: fast reviews on Sonnet 5/xhigh while cheap
5693
- * reviews on Luna/max, cheapest reviews on Sol/high, and balanced reviews
5694
+ * reviews on Luna/max, cheapest reviews on Luna/max, and balanced reviews
5694
5695
  * on Sol/high — all rows exist here, so each profile's reviewer resolves to
5695
5696
  * its fixed effort. The balanced LEAD is the other exception: bare Sol leads
5696
5697
  * at medium (`BALANCED_PROFILE_LEAD_EFFORT`), not the shared high.
@@ -5748,7 +5749,7 @@ function preprocessFastRequest(rawBody, launch, subagentRequest = false) {
5748
5749
  fixedEffort = alias.absentEffortDefault;
5749
5750
  parsed.model = canonicalizeAliasModel(originalModel);
5750
5751
  } else if (bare === "gpt-6-luna" || bare === "gpt-6-luna") fixedEffort = "max";
5751
- else if (bare === "gpt-6-sol" || bare === "gpt-6-sol") fixedEffort = profileId === "balanced" && !subagentRequest ? BALANCED_PROFILE_LEAD_EFFORT : "high";
5752
+ else if (bare === "gpt-5.6-sol" || bare === "gpt-6-sol") fixedEffort = profileId === "balanced" && !subagentRequest ? BALANCED_PROFILE_LEAD_EFFORT : "high";
5752
5753
  else if (bare === "grok-4.6") fixedEffort = "medium";
5753
5754
  else if (bare === "gemini-3.8-flash") fixedEffort = "high";
5754
5755
  else if (bare === "claude-sonnet-5") fixedEffort = "xhigh";
@@ -6098,6 +6099,28 @@ function cheapestAdvisorMetadataMismatch(rawBody) {
6098
6099
  if (stripTrailingOneMSuffix(model).base !== CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL) return `the native Advisor tool requested ${JSON.stringify(model)} instead of ${JSON.stringify(CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL)}`;
6099
6100
  }
6100
6101
  }
6102
+ /**
6103
+ * True when the request's `model` is the cheapest reviewer's pinned alias
6104
+ * (bare or `[1m]`-decorated — `resolveModelAlias` strips the bracket).
6105
+ *
6106
+ * Role detection by MODEL rather than by `x-claude-code-agent-id`: classic
6107
+ * Task spawns send the bare role name ("reviewer"), but Agent-team teammates
6108
+ * send stable name-based ids ("reviewer-advisor-only[@team]"), so an
6109
+ * agent-id exact-match misses every teammate spawn. The frontmatter pins the
6110
+ * reviewer to its alias, invocation-level overrides are stripped by the
6111
+ * dispatch ACL, and `/model` switches affect only the lead — so the alias is
6112
+ * the robust discriminator across spawn styles. Fail-closed: unparseable
6113
+ * bodies and non-alias ids (bare Luna = lead, Explore/GP carry their own
6114
+ * aliases) return false.
6115
+ */
6116
+ function isCheapestReviewerModel(rawBody) {
6117
+ try {
6118
+ const body = JSON.parse(rawBody);
6119
+ return typeof body.model === "string" && resolveModelAlias(body.model)?.aliasId === "gh-router-cheapest-reviewer-max";
6120
+ } catch {
6121
+ return false;
6122
+ }
6123
+ }
6101
6124
  function stripAdvisorTool(rawBody) {
6102
6125
  let body;
6103
6126
  try {
@@ -6235,7 +6258,8 @@ async function handleCompletion(c) {
6235
6258
  const cheapProfileRequest = identity.launch?.profileId === "cheap" || identity.launch?.profileId === "cheap1m";
6236
6259
  const cheapestProfileRequest = identity.launch?.profileId === "cheapest";
6237
6260
  const balancedProfileRequest = identity.launch?.profileId === "balanced";
6238
- const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
6261
+ const subagentAgentId = (c.req.header("x-claude-code-agent-id") ?? "").trim();
6262
+ const subagentRequest = subagentAgentId.length > 0;
6239
6263
  const fastSubagentRequest = fastProfileRequest && subagentRequest;
6240
6264
  const maxSubagentRequest = maxProfileRequest && subagentRequest;
6241
6265
  const cheapSubagentRequest = cheapProfileRequest && subagentRequest;
@@ -6245,12 +6269,15 @@ async function handleCompletion(c) {
6245
6269
  const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
6246
6270
  const cheapLeadAdvisor = cheapProfileRequest && !cheapSubagentRequest;
6247
6271
  const cheapestLeadAdvisor = cheapestProfileRequest && !cheapestSubagentRequest;
6248
- const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && !cheapestSubagentRequest && !balancedSubagentRequest;
6272
+ const cheapestReviewerAdvisor = cheapestProfileRequest && (subagentAgentId === "reviewer" || isCheapestReviewerModel(rawBody));
6273
+ if (cheapestProfileRequest && subagentRequest) consola.debug(`cheapest subagent advisor gate: agentId=${JSON.stringify(subagentAgentId)} reviewerModel=${isCheapestReviewerModel(rawBody)} granted=${cheapestReviewerAdvisor && advisorRequested}`);
6274
+ const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && (!cheapestSubagentRequest || cheapestReviewerAdvisor) && !balancedSubagentRequest;
6249
6275
  const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6250
6276
  const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6251
6277
  const cheapAdvisorEnabled = cheapLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6252
6278
  const cheapestAdvisorEnabled = cheapestLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6253
- const advisorBehaviorEnabled = balancedProfileRequest ? false : fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
6279
+ const cheapestReviewerEnabled = cheapestReviewerAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6280
+ const advisorBehaviorEnabled = balancedProfileRequest ? false : fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : cheapestReviewerAdvisor ? cheapestReviewerEnabled : advisorEnabled;
6254
6281
  let fastAdvisorChoice;
6255
6282
  let maxAdvisorChoice;
6256
6283
  if (maxAdvisorEnabled) {
@@ -6259,7 +6286,7 @@ async function handleCompletion(c) {
6259
6286
  type: "error",
6260
6287
  error: {
6261
6288
  type: "invalid_request_error",
6262
- message: `Invalid GH_ROUTER_ADVISOR_MODEL ${JSON.stringify(requestedAdvisor)} for max profile; must be gpt-6-sol or claude-opus-5.5.`
6289
+ message: `Invalid GH_ROUTER_ADVISOR_MODEL ${JSON.stringify(requestedAdvisor)} for max profile; must be gpt-5.6-sol, gpt-6-sol, or claude-opus-5.5.`
6263
6290
  }
6264
6291
  }, 400, { "x-should-retry": "false" });
6265
6292
  const model = maxAdvisorModelFromPin(requestedAdvisor, maxOpusModel());
@@ -6332,6 +6359,17 @@ async function handleCompletion(c) {
6332
6359
  }, 503);
6333
6360
  }
6334
6361
  }
6362
+ if (cheapestReviewerEnabled && !fastAdvisorChoice) try {
6363
+ fastAdvisorChoice = resolveCheapestAdvisorModel();
6364
+ } catch (error) {
6365
+ return c.json({
6366
+ type: "error",
6367
+ error: {
6368
+ type: "api_error",
6369
+ message: error instanceof Error ? error.message : String(error)
6370
+ }
6371
+ }, 503);
6372
+ }
6335
6373
  const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
6336
6374
  if (fastPreprocess.retiredAlias || fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
6337
6375
  const profileId = identity.launch?.profileId;
@@ -6347,7 +6385,7 @@ async function handleCompletion(c) {
6347
6385
  }
6348
6386
  let finalBody = await processWebSearch(fastPreprocess.body);
6349
6387
  finalBody = sanitizeAnthropicBody(finalBody);
6350
- if (fastSubagentRequest || maxSubagentRequest) finalBody = stripAdvisorTool(finalBody);
6388
+ if (fastSubagentRequest || maxSubagentRequest || cheapestSubagentRequest && !cheapestReviewerAdvisor) finalBody = stripAdvisorTool(finalBody);
6351
6389
  const loopGuard = guardAnthropicBody(finalBody);
6352
6390
  if (loopGuard.action === "abort") return c.json({
6353
6391
  type: "error",
@@ -6358,7 +6396,7 @@ async function handleCompletion(c) {
6358
6396
  }, 400, { "x-should-retry": "false" });
6359
6397
  if (loopGuard.body !== void 0) finalBody = loopGuard.body;
6360
6398
  if (advisorBehaviorEnabled) {
6361
- finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
6399
+ finalBody = injectAdvisorTool(finalBody, cheapestReviewerAdvisor ? CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS : cheapestLeadAdvisor ? CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS : fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
6362
6400
  consola.info("ADVISOR enabled for this request — injecting __anthropic_advisor tool; will translate tool_use → server_tool_use{advisor} on the SSE stream");
6363
6401
  }
6364
6402
  if (finalBody.includes("\"mcp_servers\"")) try {
@@ -6382,7 +6420,7 @@ async function handleCompletion(c) {
6382
6420
  parsedBase = JSON.parse(promptWindowBody);
6383
6421
  } catch {}
6384
6422
  const wantsStream = parsedBase?.stream === true;
6385
- if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
6423
+ if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled || cheapestReviewerEnabled) && wantsStream) {
6386
6424
  const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
6387
6425
  const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
6388
6426
  const translatedAdvisorAborter = new AbortController();
@@ -6405,7 +6443,7 @@ async function handleCompletion(c) {
6405
6443
  effort: maxAdvisorChoice.effort,
6406
6444
  escalated: false,
6407
6445
  fastProfile: false
6408
- } : cheapAdvisorEnabled || cheapestAdvisorEnabled ? {
6446
+ } : cheapAdvisorEnabled || cheapestAdvisorEnabled || cheapestReviewerEnabled ? {
6409
6447
  model: fastAdvisorChoice.model,
6410
6448
  effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
6411
6449
  escalated: fastAdvisorChoice.escalated,
@@ -6423,9 +6461,11 @@ async function handleCompletion(c) {
6423
6461
  requestHeaders: {},
6424
6462
  advisorModel: advisorChoice.model,
6425
6463
  advisorEscalated: advisorChoice.escalated,
6426
- advisorFastProfile: advisorChoice.fastProfile,
6464
+ advisorFastProfile: advisorChoice.fastProfile && !cheapestReviewerEnabled,
6427
6465
  advisorMaxProfile: maxAdvisorEnabled,
6428
- advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled,
6466
+ advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled || cheapestReviewerEnabled,
6467
+ advisorReviewerProfile: cheapestReviewerEnabled,
6468
+ advisorMaxTurns: cheapestReviewerEnabled ? 5 : void 0,
6429
6469
  advisorEffort: advisorChoice.effort,
6430
6470
  externalAborter: translatedAdvisorAborter,
6431
6471
  continueTurn: makeShimContinueTurn(endpoint, {
@@ -6548,9 +6588,11 @@ async function handleCompletion(c) {
6548
6588
  requestHeaders,
6549
6589
  advisorModel: advisorChoice.model,
6550
6590
  advisorEscalated: advisorChoice.escalated,
6551
- advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor,
6591
+ advisorFastProfile: (fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor) && !cheapestReviewerEnabled,
6552
6592
  advisorMaxProfile: maxAdvisorEnabled,
6553
- advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor,
6593
+ advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor || cheapestReviewerEnabled,
6594
+ advisorReviewerProfile: cheapestReviewerEnabled,
6595
+ advisorMaxTurns: cheapestReviewerEnabled ? 5 : void 0,
6554
6596
  advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor),
6555
6597
  externalAborter: advisorAborter
6556
6598
  }), {
@@ -8190,4 +8232,4 @@ function getPiLaunchEnvVars(mirrorDir) {
8190
8232
  //#endregion
8191
8233
  export { formatFastPrerequisiteFailure as A, runSelfUpdate as B, CHEAP_REVIEWER_ALIAS_ID as C, formatCheap1mPrerequisiteFailure as D, formatBalancedPrerequisiteFailure as E, validateCheapProfilePrerequisites as F, updateClaude as H, validateCheapestProfilePrerequisites as I, validateFastProfilePrerequisites as L, resolveLaunchProfile as M, validateBalancedProfilePrerequisites as N, formatCheapPrerequisiteFailure as O, validateCheap1mProfilePrerequisites as P, validateMaxProfileLaunch as R, CHEAP_PLAN_ALIAS_ID as S, MAX_BROWSE_LOW_ALIAS_ID as T, checkClaudeVersion as V, CHEAPEST_EXPLORE_ALIAS_ID as _, setupAndServe as a, CHEAP_EXPLORE_ALIAS_ID as b, startKeepAwake as c, listModelsForEndpoint as d, enableFileLogging as f, BROWSE_LOW_ALIAS_ID as g, BALANCED_REVIEWER_ALIAS_ID as h, parseSharedArgs as i, profileDescriptor as j, formatCheapestPrerequisiteFailure as k, stopKeepAwake as l, BALANCED_GENERAL_PURPOSE_ALIAS_ID as m, getCodexEnvVars as n, sharedServerArgs as o, BALANCED_EXPLORE_ALIAS_ID as p, getPiLaunchEnvVars as r, LAUNCH_SECRET_HEADER as s, getClaudeCodeEnvVars as t, injectModelPickerSettingsFile as u, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as v, LUNA_SCOUT_ALIAS_ID as w, CHEAP_GENERAL_PURPOSE_ALIAS_ID as x, CHEAPEST_REVIEWER_ALIAS_ID as y, queueDetachedGlobalInstall as z };
8192
8234
 
8193
- //# sourceMappingURL=server-setup-tNMUzFgE.js.map
8235
+ //# sourceMappingURL=server-setup-R1HQtpR9.js.map