github-router 0.3.322 → 0.3.323

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 (104) hide show
  1. package/dist/{aic-ledger-BW3zMiCx.js → aic-ledger-DRU89gJg.js} +2 -2
  2. package/dist/{aic-ledger-BW3zMiCx.js.map → aic-ledger-DRU89gJg.js.map} +1 -1
  3. package/dist/{attribution-settings-z-U2L7ab.js → attribution-settings-CX-kIrT8.js} +292 -101
  4. package/dist/attribution-settings-CX-kIrT8.js.map +1 -0
  5. package/dist/{auth-Iun7ftd8.js → auth-DSLN1arH.js} +3 -3
  6. package/dist/{auth-Iun7ftd8.js.map → auth-DSLN1arH.js.map} +1 -1
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/{check-usage-1c-0z3iy.js → check-usage-B_12ALvf.js} +4 -4
  9. package/dist/{check-usage-1c-0z3iy.js.map → check-usage-B_12ALvf.js.map} +1 -1
  10. package/dist/{claude-DtWf7DEw.js → claude-Cq1xGzbI.js} +61 -49
  11. package/dist/claude-Cq1xGzbI.js.map +1 -0
  12. package/dist/{codex-CDtFT-Qp.js → codex-INt1hc_5.js} +5 -5
  13. package/dist/{codex-CDtFT-Qp.js.map → codex-INt1hc_5.js.map} +1 -1
  14. package/dist/{copilot-discount-I6BrT7QE.js → copilot-discount-D8t7Q3Tp.js} +2 -2
  15. package/dist/{copilot-discount-I6BrT7QE.js.map → copilot-discount-D8t7Q3Tp.js.map} +1 -1
  16. package/dist/{debug-CDyXUPcC.js → debug-D8iD6G4O.js} +2 -2
  17. package/dist/{debug-CDyXUPcC.js.map → debug-D8iD6G4O.js.map} +1 -1
  18. package/dist/engine-4uuaURb0.js +2 -0
  19. package/dist/{fast-profile-contract-_DhIWank.js → fast-profile-contract-DmsyQQrw.js} +6 -11
  20. package/dist/fast-profile-contract-DmsyQQrw.js.map +1 -0
  21. package/dist/{gate-discovery-j_hQ1IPc.js → gate-discovery-Z0QyjqM7.js} +5 -5
  22. package/dist/{gate-discovery-j_hQ1IPc.js.map → gate-discovery-Z0QyjqM7.js.map} +1 -1
  23. package/dist/{get-copilot-usage-BWCAzmSc.js → get-copilot-usage-Bs-FEPMf.js} +2 -2
  24. package/dist/{get-copilot-usage-BWCAzmSc.js.map → get-copilot-usage-Bs-FEPMf.js.map} +1 -1
  25. package/dist/hooks.mjs +6 -12
  26. package/dist/hooks.sha256 +1 -1
  27. package/dist/{internal-aic-status-CKXxxb30.js → internal-aic-status-BaUKlisM.js} +3 -3
  28. package/dist/{internal-aic-status-CKXxxb30.js.map → internal-aic-status-BaUKlisM.js.map} +1 -1
  29. package/dist/{internal-artifact-open-CA1trJ15.js → internal-artifact-open-U-Ht7R-O.js} +2 -2
  30. package/dist/{internal-artifact-open-CA1trJ15.js.map → internal-artifact-open-U-Ht7R-O.js.map} +1 -1
  31. package/dist/{internal-fast-dispatch-guard-CZ4BZuAG.js → internal-fast-dispatch-guard-Dnjoj0pV.js} +4 -5
  32. package/dist/internal-fast-dispatch-guard-Dnjoj0pV.js.map +1 -0
  33. package/dist/{internal-fast-dispatch-guard-D5kozMpo.js → internal-fast-dispatch-guard-uztSu0c8.js} +1 -1
  34. package/dist/{internal-first-mate-guard-B_or0eN3.js → internal-first-mate-guard-Dvd1vZ4l.js} +1 -1
  35. package/dist/{internal-first-mate-guard-CiFH6X1H.js → internal-first-mate-guard-mvfZal_M.js} +3 -3
  36. package/dist/{internal-first-mate-guard-CiFH6X1H.js.map → internal-first-mate-guard-mvfZal_M.js.map} +1 -1
  37. package/dist/{internal-max-dispatch-guard-BGOHRYRt.js → internal-max-dispatch-guard-CxG_c3cc.js} +1 -1
  38. package/dist/{internal-max-dispatch-guard-CnBZxo5l.js → internal-max-dispatch-guard-Sp_rCYk_.js} +2 -2
  39. package/dist/{internal-max-dispatch-guard-CnBZxo5l.js.map → internal-max-dispatch-guard-Sp_rCYk_.js.map} +1 -1
  40. package/dist/{internal-plan-review-C73snnD8.js → internal-plan-review-Co01iHOW.js} +3 -3
  41. package/dist/{internal-plan-review-C73snnD8.js.map → internal-plan-review-Co01iHOW.js.map} +1 -1
  42. package/dist/{internal-prompt-submit-dov4UvBo.js → internal-prompt-submit-dflz0bqH.js} +4 -4
  43. package/dist/{internal-prompt-submit-dov4UvBo.js.map → internal-prompt-submit-dflz0bqH.js.map} +1 -1
  44. package/dist/{internal-session-bind-C3hrb9rP.js → internal-session-bind-BVQy7Vd4.js} +2 -2
  45. package/dist/{internal-session-bind-C3hrb9rP.js.map → internal-session-bind-BVQy7Vd4.js.map} +1 -1
  46. package/dist/{internal-stop-hook-BGTPRCtO.js → internal-stop-hook-DihBVzn2.js} +5 -5
  47. package/dist/{internal-stop-hook-BGTPRCtO.js.map → internal-stop-hook-DihBVzn2.js.map} +1 -1
  48. package/dist/{internal-stop-review-MBVYtrYS.js → internal-stop-review-CrnG4IJo.js} +2 -2
  49. package/dist/{internal-stop-review-MBVYtrYS.js.map → internal-stop-review-CrnG4IJo.js.map} +1 -1
  50. package/dist/{internal-worker-guard-dxGawAY3.js → internal-worker-guard-BSoS4wzV.js} +2 -2
  51. package/dist/{internal-worker-guard-dxGawAY3.js.map → internal-worker-guard-BSoS4wzV.js.map} +1 -1
  52. package/dist/{internal-workspace-header-_aEXOz5q.js → internal-workspace-header-booLOzwD.js} +2 -2
  53. package/dist/{internal-workspace-header-_aEXOz5q.js.map → internal-workspace-header-booLOzwD.js.map} +1 -1
  54. package/dist/{lifecycle-CJB2BwSJ.js → lifecycle-BYPEqFdV.js} +2 -2
  55. package/dist/{lifecycle-CJB2BwSJ.js.map → lifecycle-BYPEqFdV.js.map} +1 -1
  56. package/dist/{lifecycle-_BE0SnNs.js → lifecycle-C1LDvDD6.js} +2 -2
  57. package/dist/{lifecycle-_BE0SnNs.js.map → lifecycle-C1LDvDD6.js.map} +1 -1
  58. package/dist/lifecycle-Cz99P30h.js +2 -0
  59. package/dist/lifecycle-DqTFEJpS.js +2 -0
  60. package/dist/main.js +20 -20
  61. package/dist/{mcp-workspace-header-mXRLE8kg.js → mcp-workspace-header-BIW0SRgs.js} +2 -2
  62. package/dist/{mcp-workspace-header-mXRLE8kg.js.map → mcp-workspace-header-BIW0SRgs.js.map} +1 -1
  63. package/dist/{models-CSFIVxAH.js → models-B9tdaM6B.js} +3 -3
  64. package/dist/{models-CSFIVxAH.js.map → models-B9tdaM6B.js.map} +1 -1
  65. package/dist/{orchestration-B8kypXcZ.js → orchestration-DvsdorFq.js} +2 -2
  66. package/dist/{orchestration-B8kypXcZ.js.map → orchestration-DvsdorFq.js.map} +1 -1
  67. package/dist/{paths-CHBAj_t9.js → paths-BnZwolac.js} +4 -4
  68. package/dist/{paths-CHBAj_t9.js.map → paths-BnZwolac.js.map} +1 -1
  69. package/dist/paths-BzM6uxmd.js +2 -0
  70. package/dist/{peer-mcp-personas-Gb0LfII0.js → peer-mcp-personas-DcAErb_d.js} +201 -66
  71. package/dist/peer-mcp-personas-DcAErb_d.js.map +1 -0
  72. package/dist/{plan-review-hook-BMmw7wxR.js → plan-review-hook-BlsGnG02.js} +3 -3
  73. package/dist/{plan-review-hook-BMmw7wxR.js.map → plan-review-hook-BlsGnG02.js.map} +1 -1
  74. package/dist/{prompt-submit-hook-CGgT5m4Q.js → prompt-submit-hook-BJFLzCaT.js} +3 -3
  75. package/dist/{prompt-submit-hook-CGgT5m4Q.js.map → prompt-submit-hook-BJFLzCaT.js.map} +1 -1
  76. package/dist/{provision-DagZEkdZ.js → provision-B-a5KUCL.js} +4 -4
  77. package/dist/{provision-DagZEkdZ.js.map → provision-B-a5KUCL.js.map} +1 -1
  78. package/dist/{self-invocation-DahN1gw9.js → self-invocation-opSXHEs0.js} +2 -2
  79. package/dist/{self-invocation-DahN1gw9.js.map → self-invocation-opSXHEs0.js.map} +1 -1
  80. package/dist/{serve-DOMsmIk-.js → serve-TiUhvpVp.js} +12 -12
  81. package/dist/{serve-DOMsmIk-.js.map → serve-TiUhvpVp.js.map} +1 -1
  82. package/dist/{server-setup-DQVRJluz.js → server-setup-CgbHmupe.js} +186 -49
  83. package/dist/server-setup-CgbHmupe.js.map +1 -0
  84. package/dist/{start-CqSFR_s8.js → start-DNzOFabp.js} +3 -3
  85. package/dist/{start-CqSFR_s8.js.map → start-DNzOFabp.js.map} +1 -1
  86. package/dist/{stop-gate-hook-D7N759TG.js → stop-gate-hook-DvNM8zFf.js} +3 -3
  87. package/dist/{stop-gate-hook-D7N759TG.js.map → stop-gate-hook-DvNM8zFf.js.map} +1 -1
  88. package/dist/{stop-gate-policy-C0gt04R0.js → stop-gate-policy-C5pXbY59.js} +2 -2
  89. package/dist/{stop-gate-policy-C0gt04R0.js.map → stop-gate-policy-C5pXbY59.js.map} +1 -1
  90. package/dist/{token-86uk6y4P.js → token-Css-ARGL.js} +2 -2
  91. package/dist/{token-86uk6y4P.js.map → token-Css-ARGL.js.map} +1 -1
  92. package/dist/{worker-dispatch-B-OA7tvU.js → worker-dispatch-DwS99DXz.js} +2 -2
  93. package/dist/{worker-dispatch-B-OA7tvU.js.map → worker-dispatch-DwS99DXz.js.map} +1 -1
  94. package/package.json +1 -1
  95. package/dist/attribution-settings-z-U2L7ab.js.map +0 -1
  96. package/dist/claude-DtWf7DEw.js.map +0 -1
  97. package/dist/engine-DA5laGIh.js +0 -2
  98. package/dist/fast-profile-contract-_DhIWank.js.map +0 -1
  99. package/dist/internal-fast-dispatch-guard-CZ4BZuAG.js.map +0 -1
  100. package/dist/lifecycle-D0KsoSqz.js +0 -2
  101. package/dist/lifecycle-DimEguJO.js +0 -2
  102. package/dist/paths-eHoOwFzZ.js +0 -2
  103. package/dist/peer-mcp-personas-Gb0LfII0.js.map +0 -1
  104. package/dist/server-setup-DQVRJluz.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { $ as EFFORT_ORDER, $t as parseJsonOrDiagnose, An as oneMContextDisabled, B as resolveAdvisorEffort, Bn as CHEAP_PROFILE_MODELS, Bt as getTextTokenCount, Cn as isBudgetClaudeLead, D as toolbeltEnabled, Dn as upstreamMaxConnections, En as upstreamAllowH2, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, G as repairKnownThinkingHistory, Gn as withInstallLock, H as resolveCheapestAdvisorModel, Ht as getTokenizerFromModel, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as buildOpenAIErrorEvent, Jt as resolveMcpToolTimeoutMs, K as repairRejectedThinkingHistory, Kt as assembleResponsesPayload, L as buildAdvisorStream, Lt as shimDefaultsToXhigh, Mn as withOneMSuffixForLead, N as searchWeb, Nn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, On as classifyMessagesRoute, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAPEST_PROFILE_MODELS, Q as relayAnthropicStream, Qt as readResponseBodyCapped, R as injectAdvisorTool, Rn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Rt as countTokens, Sn as generateRandomPort, U as formatThinkingRepairDecline, Ut as findLaunchBySecret, V as resolveAdvisorModel, Vn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Vt as getTokenCount, W as rememberThinkingHistoryRepair, Wn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, X as logStreamError, Xt as createChatCompletions, Y as isControllerClosedError, Yt as createResponses, Z as readIteratorWithTimeout, Zt as MAX_RESPONSE_BODY_BYTES, at as agentToolsEnabled, bn as UPSTREAM_FETCH_TIMEOUT_MS, cn as provisionTreeSitterAssets, en as normalizeOpenAIUsage, et as UNKNOWN_EFFORT_ANCHOR, hn as BUDGET_SMALL_FAST_SLUG, i as assertMcpToolSurfaceConsistent, it as handleMcpPost, jn as withOneMSuffix, kn as catalogAdvertises1M, nt as clampEffort, pn as toolbeltPathOverride, q as buildAnthropicErrorEvent, qt as warnOnTokenPriceDrift, rt as handleMcpDelete, tt as bucketEffort, xn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as isAdvisorRequested, zn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, zt as createMessages } from "./peer-mcp-personas-Gb0LfII0.js";
1
+ import { $ as EFFORT_ORDER, $n as withInstallLock, $t as MAX_RESPONSE_BODY_BYTES, An as upstreamMaxConnections, B as resolveAdvisorEffort, Bn as BALANCED_PROFILE_SUBAGENT_CONTEXT_TOKENS, Bt as countTokens, Cn as UPSTREAM_FETCH_TIMEOUT_MS, D as toolbeltEnabled, En as isBudgetClaudeLead, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as withOneMSuffixForLead, G as repairKnownThinkingHistory, Gt as findLaunchBySecret, H as resolveCheapestAdvisorModel, Hn as CHEAPEST_PROFILE_MODELS, Ht as getTextTokenCount, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, In as BALANCED_PROFILE_MODELS, J as buildOpenAIErrorEvent, Jn as CHEAP_PROFILE_MODELS, Jt as assembleResponsesPayload, K as repairRejectedThinkingHistory, Kn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, L as buildAdvisorStream, Ln as BALANCED_PROFILE_NATIVE_AGENT_NAMES, Mn as catalogAdvertises1M, N as searchWeb, Nn as oneMContextDisabled, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as withOneMSuffix, Q as relayAnthropicStream, Qn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, Qt as createChatCompletions, R as injectAdvisorTool, Tn as generateRandomPort, U as formatThinkingRepairDecline, Un as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Ut as getTokenCount, V as resolveAdvisorModel, Vn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, Vt as createMessages, W as rememberThinkingHistoryRepair, Wt as getTokenizerFromModel, X as logStreamError, Xt as resolveMcpToolTimeoutMs, Y as isControllerClosedError, Yn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Yt as warnOnTokenPriceDrift, Z as readIteratorWithTimeout, Zt as createResponses, at as agentToolsEnabled, dn as provisionTreeSitterAssets, en as readResponseBodyCapped, et as UNKNOWN_EFFORT_ANCHOR, gn as toolbeltPathOverride, i as assertMcpToolSurfaceConsistent, it as handleMcpPost, jn as classifyMessagesRoute, kn as upstreamAllowH2, nn as normalizeOpenAIUsage, nt as clampEffort, q as buildAnthropicErrorEvent, qn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, rt as handleMcpDelete, tn as parseJsonOrDiagnose, tt as bucketEffort, vn as BUDGET_SMALL_FAST_SLUG, wn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as isAdvisorRequested, zt as shimDefaultsToXhigh } from "./peer-mcp-personas-DcAErb_d.js";
2
2
  import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
3
- import { i as ensurePaths, t as PATHS } from "./paths-CHBAj_t9.js";
3
+ import { i as ensurePaths, t as PATHS } from "./paths-BnZwolac.js";
4
4
  import { t as state } from "./state-BlMpEFAt.js";
5
- import { T as copilotHeaders, _ as forwardError, a as cacheCopilotVersion, c as filterBetaHeader, d as resolveModel, f as sleep, g as HTTPError, i as tryRefreshAndRetry, l as isNullish, n as setupGitHubAgentToken, o as cacheModels, r as setupGitHubToken, s as cacheVSCodeVersion, t as setupCopilotToken, w as copilotBaseUrl, y as fetchWithTransientRetry } from "./token-86uk6y4P.js";
6
- import { t as getCopilotUsage } from "./get-copilot-usage-BWCAzmSc.js";
5
+ import { T as copilotHeaders, _ as forwardError, a as cacheCopilotVersion, c as filterBetaHeader, d as resolveModel, f as sleep, g as HTTPError, i as tryRefreshAndRetry, l as isNullish, n as setupGitHubAgentToken, o as cacheModels, r as setupGitHubToken, s as cacheVSCodeVersion, t as setupCopilotToken, w as copilotBaseUrl, y as fetchWithTransientRetry } from "./token-Css-ARGL.js";
6
+ import { t as getCopilotUsage } from "./get-copilot-usage-Bs-FEPMf.js";
7
7
  import { c as runCommandVoid, i as parseBoolEnv, o as resolveExecutable, r as killManagedTree, s as runCommandCapture } from "./exec-COUT4QsS.js";
8
- import { c as FAST_PROFILE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-_DhIWank.js";
8
+ import { c as FAST_PROFILE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-DmsyQQrw.js";
9
9
  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-Bl7I_EOC.js";
10
- 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-BW3zMiCx.js";
10
+ 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-DRU89gJg.js";
11
11
  import consola from "consola";
12
12
  import fs, { existsSync } from "node:fs";
13
13
  import path from "node:path";
@@ -362,8 +362,8 @@ const STANDARD_PROFILE = Object.freeze({
362
362
  hasCoordinator: true
363
363
  });
364
364
  /**
365
- * The `-m fast` roster: exactly five native agents (`Explore`, `Plan`,
366
- * `general-purpose`, `implementer`, `reviewer`), the fast-only `oracle` peer
365
+ * The `-m fast` roster: exactly four native agents (`Explore`, `Plan`,
366
+ * `General-Purpose`, `Reviewer`), the fast-only `oracle` peer
367
367
  * tool, no coordinator, and `peers`/`search` plus optional browser and
368
368
  * browse-only worker groups. Core workers, `orchestrate`, `decide`, `fleet`,
369
369
  * and `first-mate` remain hard denies even when their standard gates pass.
@@ -440,6 +440,25 @@ const CHEAPEST_PROFILE = Object.freeze({
440
440
  hasCoordinator: false
441
441
  });
442
442
  /**
443
+ * The `-m balanced` roster: the most-complex-tasks tier. A Sol/high lead at
444
+ * the 200K default window, the same four-agent surface as cheap
445
+ * (`Explore`/`Plan`/`General-Purpose`/`Reviewer`, every role at 200K), and
446
+ * the Grok-4.6/medium Oracle-only peer set. Hard-denies match fast's: core
447
+ * workers, `orchestrate`, `decide`, `fleet`, and `first-mate`.
448
+ */
449
+ const BALANCED_PROFILE = Object.freeze({
450
+ id: "balanced",
451
+ nativeRoster: new Set(BALANCED_PROFILE_NATIVE_AGENT_NAMES),
452
+ personaAllowlist: /* @__PURE__ */ new Set(["oracle"]),
453
+ allowedGroups: /* @__PURE__ */ new Set([
454
+ "peers",
455
+ "search",
456
+ "workers",
457
+ "browser"
458
+ ]),
459
+ hasCoordinator: false
460
+ });
461
+ /**
443
462
  * The `-m max` profile: Sol/Luna-led, browse-only workers, and explicit
444
463
  * cross-lab peer names. The descriptor is a hard projection for bound launch
445
464
  * requests; unbound/BYO traffic remains standard because it has no registry
@@ -475,6 +494,7 @@ function profileDescriptor(id) {
475
494
  if (id === "cheap1m") return CHEAP1M_PROFILE;
476
495
  if (id === "cheap") return CHEAP_PROFILE;
477
496
  if (id === "cheapest") return CHEAPEST_PROFILE;
497
+ if (id === "balanced") return BALANCED_PROFILE;
478
498
  return STANDARD_PROFILE;
479
499
  }
480
500
  /**
@@ -495,6 +515,7 @@ function resolveLaunchProfile(modelArg) {
495
515
  if (arg === "cheap1m") return "cheap1m";
496
516
  if (arg === "cheap") return "cheap";
497
517
  if (arg === "cheapest") return "cheapest";
518
+ if (arg === "balanced") return "balanced";
498
519
  return "standard";
499
520
  }
500
521
  function validateMaxProfileLaunch(catalog) {
@@ -543,6 +564,17 @@ const CHEAPEST_PLAN_ALIAS_ID = "gh-router-cheapest-plan-high";
543
564
  const CHEAPEST_GENERAL_PURPOSE_ALIAS_ID = "gh-router-cheapest-general-purpose-xhigh";
544
565
  const CHEAPEST_IMPLEMENTER_ALIAS_ID = "gh-router-cheapest-implementer-max";
545
566
  const CHEAPEST_REVIEWER_ALIAS_ID = "gh-router-cheapest-reviewer-high";
567
+ /**
568
+ * Balanced-profile subagent aliases (`-m balanced`). Same non-catalog
569
+ * mechanism as the cheap aliases above, with the balanced roster's own
570
+ * identities and efforts (`BALANCED_PROFILE_NATIVE_MODELS` /
571
+ * `BALANCED_PROFILE_NATIVE_EFFORTS`, pinned by a drift test). Emitted BARE by
572
+ * `buildBalancedProfileAgentDefinitions`.
573
+ */
574
+ const BALANCED_EXPLORE_ALIAS_ID = "gh-router-balanced-explore-high";
575
+ const BALANCED_PLAN_ALIAS_ID = "gh-router-balanced-plan-high";
576
+ const BALANCED_GENERAL_PURPOSE_ALIAS_ID = "gh-router-balanced-general-purpose-high";
577
+ const BALANCED_REVIEWER_ALIAS_ID = "gh-router-balanced-reviewer-max";
546
578
  const LUNA_SONNET_ALIAS_ID = "gh-router-luna-sonnet-xhigh";
547
579
  /**
548
580
  * Router-owned alias id for the fast profile's Haiku-tier row
@@ -624,13 +656,13 @@ const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
624
656
  }],
625
657
  [CHEAP_GENERAL_PURPOSE_ALIAS_ID, {
626
658
  aliasId: CHEAP_GENERAL_PURPOSE_ALIAS_ID,
627
- realModel: CHEAP_PROFILE_MODELS["general-purpose"],
659
+ realModel: CHEAP_PROFILE_MODELS["General-Purpose"],
628
660
  absentEffortDefault: "max"
629
661
  }],
630
662
  [CHEAP_IMPLEMENTER_ALIAS_ID, {
631
663
  aliasId: CHEAP_IMPLEMENTER_ALIAS_ID,
632
- realModel: CHEAP_PROFILE_MODELS.implementer,
633
- absentEffortDefault: "high"
664
+ realModel: CHEAP_PROFILE_MODELS["General-Purpose"],
665
+ absentEffortDefault: "max"
634
666
  }],
635
667
  [CHEAP_REVIEWER_ALIAS_ID, {
636
668
  aliasId: CHEAP_REVIEWER_ALIAS_ID,
@@ -649,18 +681,38 @@ const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
649
681
  }],
650
682
  [CHEAPEST_GENERAL_PURPOSE_ALIAS_ID, {
651
683
  aliasId: CHEAPEST_GENERAL_PURPOSE_ALIAS_ID,
652
- realModel: CHEAPEST_PROFILE_MODELS["general-purpose"],
653
- absentEffortDefault: "xhigh"
684
+ realModel: CHEAPEST_PROFILE_MODELS["General-Purpose"],
685
+ absentEffortDefault: "max"
654
686
  }],
655
687
  [CHEAPEST_IMPLEMENTER_ALIAS_ID, {
656
688
  aliasId: CHEAPEST_IMPLEMENTER_ALIAS_ID,
657
- realModel: CHEAPEST_PROFILE_MODELS.implementer,
689
+ realModel: CHEAPEST_PROFILE_MODELS["General-Purpose"],
658
690
  absentEffortDefault: "max"
659
691
  }],
660
692
  [CHEAPEST_REVIEWER_ALIAS_ID, {
661
693
  aliasId: CHEAPEST_REVIEWER_ALIAS_ID,
662
694
  realModel: CHEAPEST_PROFILE_MODELS.reviewer,
663
695
  absentEffortDefault: "high"
696
+ }],
697
+ [BALANCED_EXPLORE_ALIAS_ID, {
698
+ aliasId: BALANCED_EXPLORE_ALIAS_ID,
699
+ realModel: BALANCED_PROFILE_MODELS.explore,
700
+ absentEffortDefault: "high"
701
+ }],
702
+ [BALANCED_PLAN_ALIAS_ID, {
703
+ aliasId: BALANCED_PLAN_ALIAS_ID,
704
+ realModel: BALANCED_PROFILE_MODELS.plan,
705
+ absentEffortDefault: "high"
706
+ }],
707
+ [BALANCED_GENERAL_PURPOSE_ALIAS_ID, {
708
+ aliasId: BALANCED_GENERAL_PURPOSE_ALIAS_ID,
709
+ realModel: BALANCED_PROFILE_MODELS["General-Purpose"],
710
+ absentEffortDefault: "high"
711
+ }],
712
+ [BALANCED_REVIEWER_ALIAS_ID, {
713
+ aliasId: BALANCED_REVIEWER_ALIAS_ID,
714
+ realModel: BALANCED_PROFILE_MODELS.reviewer,
715
+ absentEffortDefault: "max"
664
716
  }]
665
717
  ]);
666
718
  /**
@@ -721,10 +773,10 @@ function hasUsablePromptMetadata(model) {
721
773
  * than silently substituting or dropping an agent.
722
774
  *
723
775
  * Checks, per the fast-launch-profile design:
724
- * - Luna lead/Explore/general-purpose: tool calls, >=1M, high+max, Responses.
776
+ * - Luna Explore: tool calls, >=1M, high+max, Responses.
725
777
  * - Sol Plan: tool calls, >=1M, high, Responses.
726
- * - Grok reviewer: tool calls, medium, Responses, usable prompt metadata.
727
- * - Gemini implementer/Advisor: tool calls, >=1M, high, chat-completions.
778
+ * - Sonnet reviewer: tool calls, >=1M, xhigh, Messages, prompt metadata.
779
+ * - Gemini lead/General-Purpose: tool calls, >=1M, high, chat-completions.
728
780
  * - Opus Oracle: exact Opus 5, >=1M, adaptive/high, Messages, prompt metadata.
729
781
  *
730
782
  * Pure over the passed-in catalog snapshot so it's unit-testable without
@@ -758,13 +810,13 @@ function validateFastProfilePrerequisites(catalog) {
758
810
  if (!hasUsablePromptMetadata(sonnet)) missing.push(`${FAST_PROFILE_MODELS.reviewer}: no usable max_prompt_tokens metadata`);
759
811
  if (!supportsEndpoint(sonnet, "messages")) missing.push(`${FAST_PROFILE_MODELS.reviewer}: does not advertise a supported Messages endpoint`);
760
812
  }
761
- const gemini = findModel(catalog, FAST_PROFILE_MODELS.implementer);
762
- if (!gemini) missing.push(`${FAST_PROFILE_MODELS.implementer}: absent from the live catalog`);
813
+ const gemini = findModel(catalog, FAST_PROFILE_MODELS.gemini);
814
+ if (!gemini) missing.push(`${FAST_PROFILE_MODELS.gemini}: absent from the live catalog`);
763
815
  else {
764
- if (!hasToolCalls(gemini)) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise tool_calls`);
765
- if (!hasContextAtLeast(gemini, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.implementer}: advertised context window is below 1M`);
766
- if (!supportsEffort(gemini, "high")) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise a "high" reasoning effort`);
767
- if (!supportsEndpoint(gemini, "chat")) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise a supported chat-completions endpoint`);
816
+ if (!hasToolCalls(gemini)) missing.push(`${FAST_PROFILE_MODELS.gemini}: does not advertise tool_calls`);
817
+ if (!hasContextAtLeast(gemini, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.gemini}: advertised context window is below 1M`);
818
+ if (!supportsEffort(gemini, "high")) missing.push(`${FAST_PROFILE_MODELS.gemini}: does not advertise a "high" reasoning effort`);
819
+ if (!supportsEndpoint(gemini, "chat")) missing.push(`${FAST_PROFILE_MODELS.gemini}: does not advertise a supported chat-completions endpoint`);
768
820
  }
769
821
  const opus = findModel(catalog, FAST_PROFILE_MODELS.oracle);
770
822
  if (!opus) missing.push(`${FAST_PROFILE_MODELS.oracle}: absent from the live catalog`);
@@ -795,7 +847,7 @@ const CHEAP_SUBAGENT_MIN_CONTEXT_TOKENS = CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS;
795
847
  /**
796
848
  * Shared cheap-family roster prerequisite check, parameterized only by the
797
849
  * LEAD's context gate. Both `-m cheap` (200K lead floor) and `-m cheap1m`
798
- * (1M lead window) validate the EXACT same five-agent roster: the lead gate
850
+ * (1M lead window) validate the EXACT same four-agent roster: the lead gate
799
851
  * is the only requirement that differs between the two cheap siblings, and
800
852
  * every subagent runs at the 200K default window either way. A non-1M
801
853
  * luna/sol/sonnet/grok is acceptable as long as the roster models advertise
@@ -932,6 +984,60 @@ function validateCheapestProfilePrerequisites(catalog) {
932
984
  function formatCheapestPrerequisiteFailure(missing) {
933
985
  return "github-router claude -m cheapest requires the following live-catalog capabilities, which this account's catalog does not fully provide:\n" + missing.map((m) => ` - ${m}`).join("\n") + "\n\nFalling back or silently dropping an agent is not supported for the cheapest profile's exact roster. Run plain `github-router claude` instead.";
934
986
  }
987
+ /** The subagent window floor: every balanced role runs at the 200K default. */
988
+ const BALANCED_SUBAGENT_MIN_CONTEXT_TOKENS = BALANCED_PROFILE_SUBAGENT_CONTEXT_TOKENS;
989
+ /**
990
+ * Validate the live Copilot catalog for `-m balanced`: Sol lead at the 200K
991
+ * default window, Luna Explore/Reviewer roles, Sol Plan, Gemini
992
+ * General-Purpose, and a Grok Oracle — all at the 200K default with their
993
+ * fixed efforts and supported endpoints.
994
+ */
995
+ function validateBalancedProfilePrerequisites(catalog) {
996
+ const missing = [];
997
+ const sol = findModel(catalog, BALANCED_PROFILE_MODELS.lead);
998
+ if (!sol) missing.push(`${BALANCED_PROFILE_MODELS.lead}: absent from the live catalog`);
999
+ else {
1000
+ if (!hasToolCalls(sol)) missing.push(`${BALANCED_PROFILE_MODELS.lead}: does not advertise tool_calls`);
1001
+ if (!hasContextAtLeast(sol, BALANCED_SUBAGENT_MIN_CONTEXT_TOKENS)) missing.push(`${BALANCED_PROFILE_MODELS.lead}: advertised context window is below the 200K subagent floor`);
1002
+ if (!supportsEffort(sol, "high")) missing.push(`${BALANCED_PROFILE_MODELS.lead}: does not advertise a "high" reasoning effort`);
1003
+ if (!supportsEndpoint(sol, "responses")) missing.push(`${BALANCED_PROFILE_MODELS.lead}: does not advertise a supported Responses endpoint`);
1004
+ }
1005
+ const luna = findModel(catalog, BALANCED_PROFILE_MODELS.explore);
1006
+ if (!luna) missing.push(`${BALANCED_PROFILE_MODELS.explore}: absent from the live catalog`);
1007
+ else {
1008
+ if (!hasToolCalls(luna)) missing.push(`${BALANCED_PROFILE_MODELS.explore}: does not advertise tool_calls`);
1009
+ if (!hasContextAtLeast(luna, BALANCED_SUBAGENT_MIN_CONTEXT_TOKENS)) missing.push(`${BALANCED_PROFILE_MODELS.explore}: advertised context window is below the 200K subagent floor`);
1010
+ if (!supportsEffort(luna, "high") || !supportsEffort(luna, "max")) missing.push(`${BALANCED_PROFILE_MODELS.explore}: does not advertise both "high" and "max" reasoning effort`);
1011
+ if (!supportsEndpoint(luna, "responses")) missing.push(`${BALANCED_PROFILE_MODELS.explore}: does not advertise a supported Responses endpoint`);
1012
+ }
1013
+ const gemini = findModel(catalog, BALANCED_PROFILE_MODELS["General-Purpose"]);
1014
+ if (!gemini) missing.push(`${BALANCED_PROFILE_MODELS["General-Purpose"]}: absent from the live catalog`);
1015
+ else {
1016
+ if (!hasToolCalls(gemini)) missing.push(`${BALANCED_PROFILE_MODELS["General-Purpose"]}: does not advertise tool_calls`);
1017
+ if (!hasContextAtLeast(gemini, BALANCED_SUBAGENT_MIN_CONTEXT_TOKENS)) missing.push(`${BALANCED_PROFILE_MODELS["General-Purpose"]}: advertised context window is below the 200K subagent floor`);
1018
+ if (!supportsEffort(gemini, "high")) missing.push(`${BALANCED_PROFILE_MODELS["General-Purpose"]}: does not advertise a "high" reasoning effort`);
1019
+ if (!supportsEndpoint(gemini, "chat")) missing.push(`${BALANCED_PROFILE_MODELS["General-Purpose"]}: does not advertise a supported chat-completions endpoint`);
1020
+ }
1021
+ const grok = findModel(catalog, BALANCED_PROFILE_MODELS.oracle);
1022
+ if (!grok) missing.push(`${BALANCED_PROFILE_MODELS.oracle}: absent from the live catalog`);
1023
+ else {
1024
+ if (!hasContextAtLeast(grok, BALANCED_SUBAGENT_MIN_CONTEXT_TOKENS)) missing.push(`${BALANCED_PROFILE_MODELS.oracle}: advertised context window is below the 200K subagent floor`);
1025
+ if (!supportsEffort(grok, "medium")) missing.push(`${BALANCED_PROFILE_MODELS.oracle}: does not advertise a "medium" reasoning effort`);
1026
+ if (!hasUsablePromptMetadata(grok)) missing.push(`${BALANCED_PROFILE_MODELS.oracle}: no usable max_prompt_tokens metadata`);
1027
+ if (!supportsEndpoint(grok, "responses")) missing.push(`${BALANCED_PROFILE_MODELS.oracle}: does not advertise a supported Responses endpoint`);
1028
+ }
1029
+ return {
1030
+ ok: missing.length === 0,
1031
+ missing
1032
+ };
1033
+ }
1034
+ /**
1035
+ * Format `validateBalancedProfilePrerequisites`'s failure list into the
1036
+ * launch error message.
1037
+ */
1038
+ function formatBalancedPrerequisiteFailure(missing) {
1039
+ return "github-router claude -m balanced requires the following live-catalog capabilities, which this account's catalog does not fully provide:\n" + missing.map((m) => ` - ${m}`).join("\n") + "\n\nFalling back or silently dropping an agent is not supported for the balanced profile's exact roster. Run plain `github-router claude` instead.";
1040
+ }
935
1041
  //#endregion
936
1042
  //#region src/lib/file-log-reporter.ts
937
1043
  const MAX_LOG_BYTES = 1048576;
@@ -1316,6 +1422,32 @@ const CHEAPEST_PICKER_MODELS = Object.freeze([
1316
1422
  neverOneM: true
1317
1423
  }
1318
1424
  ]);
1425
+ const BALANCED_PICKER_MODELS = Object.freeze([
1426
+ {
1427
+ id: "gpt-5.6-sol",
1428
+ label: "GPT-5.6 Sol",
1429
+ behavesAs: "claude-opus-5",
1430
+ neverOneM: true
1431
+ },
1432
+ {
1433
+ id: "gpt-5.6-luna",
1434
+ label: "GPT-5.6 Luna",
1435
+ behavesAs: "claude-opus-5",
1436
+ neverOneM: true
1437
+ },
1438
+ {
1439
+ id: "gemini-3.8-flash",
1440
+ label: "Gemini 3.8 Flash",
1441
+ behavesAs: "claude-sonnet-5",
1442
+ neverOneM: true
1443
+ },
1444
+ {
1445
+ id: "grok-4.6",
1446
+ label: "Grok 4.6",
1447
+ behavesAs: "claude-sonnet-5",
1448
+ neverOneM: true
1449
+ }
1450
+ ]);
1319
1451
  /**
1320
1452
  * Return the ordered, profile-specific `/model` rows supported by the live
1321
1453
  * Copilot catalog. Fast intentionally shares Standard's four-row inventory;
@@ -1333,7 +1465,7 @@ function selectableModelsInCatalog(profile) {
1333
1465
  const catalog = state.models?.data;
1334
1466
  if (!catalog || catalog.length === 0) return [];
1335
1467
  const present = new Set(catalog.map((entry) => entry.id));
1336
- return (profile === "max" ? MAX_PICKER_MODELS : profile === "cheap" || profile === "cheap1m" ? CHEAP_PICKER_MODELS : profile === "cheapest" ? CHEAPEST_PICKER_MODELS : STANDARD_PICKER_MODELS).filter((entry) => present.has(entry.id)).map((entry) => ({
1468
+ return (profile === "max" ? MAX_PICKER_MODELS : profile === "cheap" || profile === "cheap1m" ? CHEAP_PICKER_MODELS : profile === "cheapest" ? CHEAPEST_PICKER_MODELS : profile === "balanced" ? BALANCED_PICKER_MODELS : STANDARD_PICKER_MODELS).filter((entry) => present.has(entry.id)).map((entry) => ({
1337
1469
  model: entry.neverOneM ? entry.id : withOneMSuffix(entry.id),
1338
1470
  label: entry.label,
1339
1471
  behavesAs: entry.behavesAs
@@ -1371,7 +1503,7 @@ async function renameSettingsWithRetry(temp, target) {
1371
1503
  * 200K session's `/model` UI.
1372
1504
  */
1373
1505
  function routerWinsPicker(profile) {
1374
- return profile === "fast" || profile === "cheap" || profile === "cheap1m" || profile === "cheapest";
1506
+ return profile === "fast" || profile === "cheap" || profile === "cheap1m" || profile === "cheapest" || profile === "balanced";
1375
1507
  }
1376
1508
  function modelIdsFromExistingPicker(value) {
1377
1509
  if (!value || typeof value !== "object" || Array.isArray(value)) return [];
@@ -2291,7 +2423,7 @@ function collectToolFieldKeys(body) {
2291
2423
  //#endregion
2292
2424
  //#region package.json
2293
2425
  var name = "github-router";
2294
- var version = "0.3.322";
2426
+ var version = "0.3.323";
2295
2427
  //#endregion
2296
2428
  //#region src/lib/approval.ts
2297
2429
  const awaitApproval = async () => {
@@ -5443,7 +5575,7 @@ function preprocessMaxRequest(rawBody, launch, subagentRequest = false) {
5443
5575
  Object.freeze([MAX_LUNA_HIGH_ALIAS_ID, MAX_LUNA_MAX_ALIAS_ID]);
5444
5576
  //#endregion
5445
5577
  //#region src/lib/fast-request-preprocess.ts
5446
- const cheapFamily = (profileId) => profileId === "cheap" || profileId === "cheap1m" || profileId === "cheapest";
5578
+ const cheapFamily = (profileId) => profileId === "cheap" || profileId === "cheap1m" || profileId === "cheapest" || profileId === "balanced";
5447
5579
  const pinnedProfile = (profileId) => profileId === "fast" || cheapFamily(profileId);
5448
5580
  /**
5449
5581
  * Profiles whose every selectable `/model` row must stay at Claude Code's
@@ -5451,24 +5583,25 @@ const pinnedProfile = (profileId) => profileId === "fast" || cheapFamily(profile
5451
5583
  * `fast` keeps 1M on lead and subagents by design; `cheap1m` keeps 1M on
5452
5584
  * the lead only (its subagents are bare-by-construction).
5453
5585
  */
5454
- const bareEnforcedProfile = (profileId) => profileId === "cheap" || profileId === "cheapest";
5586
+ const bareEnforcedProfile = (profileId) => profileId === "cheap" || profileId === "cheapest" || profileId === "balanced";
5455
5587
  function explicitEffortOf(value) {
5456
5588
  return typeof value === "string" && value.trim() !== "" ? value : void 0;
5457
5589
  }
5458
5590
  /**
5459
- * Apply authenticated fast/cheap-profile model and effort policy before
5591
+ * Apply authenticated fast/cheap/balanced-profile model and effort policy before
5460
5592
  * ordinary model resolution. Synthetic aliases are refused outside an
5461
5593
  * authenticated pinned launch, so raw/BYO traffic cannot opt itself into
5462
- * private profile semantics. The cheap family (including cheapest) shares
5463
- * fast's effort mapping (same model-to-effort rows, just bare subagent
5464
- * slugs at the wiring layer), so this preprocess is shared.
5594
+ * private profile semantics. The cheap family (including cheapest and
5595
+ * balanced) shares fast's effort mapping (same model-to-effort rows, just
5596
+ * bare subagent slugs at the wiring layer), so this preprocess is shared.
5465
5597
  * Note the reviewer differs: fast reviews on Sonnet 5/xhigh while cheap
5466
- * reviews on Luna/max and cheapest reviews on Gemini/high all rows exist
5467
- * here, so each profile's reviewer resolves to its fixed effort.
5598
+ * reviews on Luna/max, cheapest reviews on Gemini/high, and balanced reviews
5599
+ * on Luna/max — all rows exist here, so each profile's reviewer resolves to
5600
+ * its fixed effort.
5468
5601
  *
5469
- * Pinned-profile isolation (fast/cheap/cheap1m/cheapest): only
5602
+ * Pinned-profile isolation (fast/cheap/cheap1m/cheapest/balanced): only
5470
5603
  * router-provided models are accepted (anything else is `rejectedModel`).
5471
- * Context: cheap/cheapest traffic is stripped to the bare 200K id;
5604
+ * Context: cheap/cheapest/balanced traffic is stripped to the bare 200K id;
5472
5605
  * cheap1m subagent traffic is stripped while its lead keeps 1M; fast
5473
5606
  * keeps 1M on both. Effort: picker changes apply to the lead session
5474
5607
  * only — lead requests keep an explicit `output_config.effort` when
@@ -6005,21 +6138,25 @@ async function handleCompletion(c) {
6005
6138
  const maxProfileRequest = identity.launch?.profileId === "max";
6006
6139
  const cheapProfileRequest = identity.launch?.profileId === "cheap" || identity.launch?.profileId === "cheap1m";
6007
6140
  const cheapestProfileRequest = identity.launch?.profileId === "cheapest";
6141
+ const balancedProfileRequest = identity.launch?.profileId === "balanced";
6008
6142
  const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
6009
6143
  const fastSubagentRequest = fastProfileRequest && subagentRequest;
6010
6144
  const maxSubagentRequest = maxProfileRequest && subagentRequest;
6011
6145
  const cheapSubagentRequest = cheapProfileRequest && subagentRequest;
6012
6146
  const cheapestSubagentRequest = cheapestProfileRequest && subagentRequest;
6147
+ const balancedSubagentRequest = balancedProfileRequest && subagentRequest;
6013
6148
  const fastLeadAdvisor = fastProfileRequest && !fastSubagentRequest;
6014
6149
  const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
6015
6150
  const cheapLeadAdvisor = cheapProfileRequest && !cheapSubagentRequest;
6016
6151
  const cheapestLeadAdvisor = cheapestProfileRequest && !cheapestSubagentRequest;
6017
- const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && !cheapestSubagentRequest;
6152
+ const balancedLeadAdvisor = balancedProfileRequest && !balancedSubagentRequest;
6153
+ const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && !cheapestSubagentRequest && !balancedSubagentRequest;
6018
6154
  const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6019
6155
  const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6020
6156
  const cheapAdvisorEnabled = cheapLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6021
6157
  const cheapestAdvisorEnabled = cheapestLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6022
- const advisorBehaviorEnabled = fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
6158
+ const balancedAdvisorEnabled = balancedLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
6159
+ const advisorBehaviorEnabled = fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : balancedLeadAdvisor ? balancedAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
6023
6160
  let fastAdvisorChoice;
6024
6161
  let maxAdvisorChoice;
6025
6162
  if (maxAdvisorEnabled) {
@@ -6058,9 +6195,9 @@ async function handleCompletion(c) {
6058
6195
  }, 503);
6059
6196
  }
6060
6197
  }
6061
- if (cheapAdvisorEnabled) {
6198
+ if (cheapAdvisorEnabled || balancedAdvisorEnabled) {
6062
6199
  const mismatch = fastAdvisorMetadataMismatch(rawBody);
6063
- const relaunchProfile = identity.launch?.profileId === "cheap1m" ? "cheap1m" : "cheap";
6200
+ const relaunchProfile = identity.launch?.profileId === "cheap1m" ? "cheap1m" : identity.launch?.profileId === "balanced" ? "balanced" : "cheap";
6064
6201
  if (mismatch) return c.json({
6065
6202
  type: "error",
6066
6203
  error: {
@@ -6151,7 +6288,7 @@ async function handleCompletion(c) {
6151
6288
  parsedBase = JSON.parse(promptWindowBody);
6152
6289
  } catch {}
6153
6290
  const wantsStream = parsedBase?.stream === true;
6154
- if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
6291
+ if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
6155
6292
  const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
6156
6293
  const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
6157
6294
  const translatedAdvisorAborter = new AbortController();
@@ -6174,7 +6311,7 @@ async function handleCompletion(c) {
6174
6311
  effort: maxAdvisorChoice.effort,
6175
6312
  escalated: false,
6176
6313
  fastProfile: false
6177
- } : cheapAdvisorEnabled || cheapestAdvisorEnabled ? {
6314
+ } : cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled ? {
6178
6315
  model: fastAdvisorChoice.model,
6179
6316
  effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
6180
6317
  escalated: fastAdvisorChoice.escalated,
@@ -6194,7 +6331,7 @@ async function handleCompletion(c) {
6194
6331
  advisorEscalated: advisorChoice.escalated,
6195
6332
  advisorFastProfile: advisorChoice.fastProfile,
6196
6333
  advisorMaxProfile: maxAdvisorEnabled,
6197
- advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled,
6334
+ advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled,
6198
6335
  advisorEffort: advisorChoice.effort,
6199
6336
  externalAborter: translatedAdvisorAborter,
6200
6337
  continueTurn: makeShimContinueTurn(endpoint, {
@@ -6317,10 +6454,10 @@ async function handleCompletion(c) {
6317
6454
  requestHeaders,
6318
6455
  advisorModel: advisorChoice.model,
6319
6456
  advisorEscalated: advisorChoice.escalated,
6320
- advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor,
6457
+ advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor || balancedLeadAdvisor,
6321
6458
  advisorMaxProfile: maxAdvisorEnabled,
6322
- advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor,
6323
- advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor),
6459
+ advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor || balancedLeadAdvisor,
6460
+ advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor || balancedLeadAdvisor),
6324
6461
  externalAborter: advisorAborter
6325
6462
  }), {
6326
6463
  status: response.status,
@@ -7910,6 +8047,6 @@ function getCodexEnvVars(serverUrl) {
7910
8047
  return vars;
7911
8048
  }
7912
8049
  //#endregion
7913
- export { validateCheapProfilePrerequisites as A, formatCheap1mPrerequisiteFailure as C, profileDescriptor as D, formatFastPrerequisiteFailure as E, checkClaudeVersion as F, updateClaude as I, validateFastProfilePrerequisites as M, validateMaxProfileLaunch as N, resolveLaunchProfile as O, runSelfUpdate as P, LUNA_SCOUT_ALIAS_ID as S, formatCheapestPrerequisiteFailure as T, CHEAP_EXPLORE_ALIAS_ID as _, sharedServerArgs as a, CHEAP_PLAN_ALIAS_ID as b, stopKeepAwake as c, enableFileLogging as d, CHEAPEST_EXPLORE_ALIAS_ID as f, CHEAPEST_REVIEWER_ALIAS_ID as g, CHEAPEST_PLAN_ALIAS_ID as h, setupAndServe as i, validateCheapestProfilePrerequisites as j, validateCheap1mProfilePrerequisites as k, injectModelPickerSettingsFile as l, CHEAPEST_IMPLEMENTER_ALIAS_ID as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, CHEAP_GENERAL_PURPOSE_ALIAS_ID as v, formatCheapPrerequisiteFailure as w, CHEAP_REVIEWER_ALIAS_ID as x, CHEAP_IMPLEMENTER_ALIAS_ID as y };
8050
+ export { profileDescriptor as A, updateClaude as B, CHEAP_REVIEWER_ALIAS_ID as C, formatCheapPrerequisiteFailure as D, formatCheap1mPrerequisiteFailure as E, validateCheapestProfilePrerequisites as F, validateFastProfilePrerequisites as I, validateMaxProfileLaunch as L, validateBalancedProfilePrerequisites as M, validateCheap1mProfilePrerequisites as N, formatCheapestPrerequisiteFailure as O, validateCheapProfilePrerequisites as P, runSelfUpdate as R, CHEAP_PLAN_ALIAS_ID as S, formatBalancedPrerequisiteFailure as T, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as _, sharedServerArgs as a, CHEAP_EXPLORE_ALIAS_ID as b, stopKeepAwake as c, enableFileLogging as d, BALANCED_EXPLORE_ALIAS_ID as f, CHEAPEST_EXPLORE_ALIAS_ID as g, BALANCED_REVIEWER_ALIAS_ID as h, setupAndServe as i, resolveLaunchProfile as j, formatFastPrerequisiteFailure as k, injectModelPickerSettingsFile as l, BALANCED_PLAN_ALIAS_ID as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, BALANCED_GENERAL_PURPOSE_ALIAS_ID as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, CHEAPEST_PLAN_ALIAS_ID as v, LUNA_SCOUT_ALIAS_ID as w, CHEAP_GENERAL_PURPOSE_ALIAS_ID as x, CHEAPEST_REVIEWER_ALIAS_ID as y, checkClaudeVersion as z };
7914
8051
 
7915
- //# sourceMappingURL=server-setup-DQVRJluz.js.map
8052
+ //# sourceMappingURL=server-setup-CgbHmupe.js.map