github-router 0.3.321 → 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.
- package/dist/{aic-ledger-BrDqsuge.js → aic-ledger-DRU89gJg.js} +20 -3
- package/dist/aic-ledger-DRU89gJg.js.map +1 -0
- package/dist/{attribution-settings-DHWo0lyG.js → attribution-settings-CX-kIrT8.js} +292 -101
- package/dist/attribution-settings-CX-kIrT8.js.map +1 -0
- package/dist/{auth-Iun7ftd8.js → auth-DSLN1arH.js} +3 -3
- package/dist/{auth-Iun7ftd8.js.map → auth-DSLN1arH.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-1c-0z3iy.js → check-usage-B_12ALvf.js} +4 -4
- package/dist/{check-usage-1c-0z3iy.js.map → check-usage-B_12ALvf.js.map} +1 -1
- package/dist/{claude-uAFPKvuS.js → claude-Cq1xGzbI.js} +61 -49
- package/dist/claude-Cq1xGzbI.js.map +1 -0
- package/dist/{codex-CVHdye0h.js → codex-INt1hc_5.js} +5 -5
- package/dist/{codex-CVHdye0h.js.map → codex-INt1hc_5.js.map} +1 -1
- package/dist/{copilot-discount-BnJkEojk.js → copilot-discount-D8t7Q3Tp.js} +2 -2
- package/dist/{copilot-discount-BnJkEojk.js.map → copilot-discount-D8t7Q3Tp.js.map} +1 -1
- package/dist/{debug-CDyXUPcC.js → debug-D8iD6G4O.js} +2 -2
- package/dist/{debug-CDyXUPcC.js.map → debug-D8iD6G4O.js.map} +1 -1
- package/dist/engine-4uuaURb0.js +2 -0
- package/dist/{fast-profile-contract-_DhIWank.js → fast-profile-contract-DmsyQQrw.js} +6 -11
- package/dist/fast-profile-contract-DmsyQQrw.js.map +1 -0
- package/dist/{gate-discovery-DUBuxiLb.js → gate-discovery-Z0QyjqM7.js} +5 -5
- package/dist/{gate-discovery-DUBuxiLb.js.map → gate-discovery-Z0QyjqM7.js.map} +1 -1
- package/dist/{get-copilot-usage-BWCAzmSc.js → get-copilot-usage-Bs-FEPMf.js} +2 -2
- package/dist/{get-copilot-usage-BWCAzmSc.js.map → get-copilot-usage-Bs-FEPMf.js.map} +1 -1
- package/dist/hooks.mjs +6 -12
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-aic-status-Dc2JQDsX.js → internal-aic-status-BaUKlisM.js} +3 -3
- package/dist/{internal-aic-status-Dc2JQDsX.js.map → internal-aic-status-BaUKlisM.js.map} +1 -1
- package/dist/{internal-artifact-open-CA1trJ15.js → internal-artifact-open-U-Ht7R-O.js} +2 -2
- package/dist/{internal-artifact-open-CA1trJ15.js.map → internal-artifact-open-U-Ht7R-O.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-CZ4BZuAG.js → internal-fast-dispatch-guard-Dnjoj0pV.js} +4 -5
- package/dist/internal-fast-dispatch-guard-Dnjoj0pV.js.map +1 -0
- package/dist/{internal-fast-dispatch-guard-D5kozMpo.js → internal-fast-dispatch-guard-uztSu0c8.js} +1 -1
- package/dist/{internal-first-mate-guard-B_or0eN3.js → internal-first-mate-guard-Dvd1vZ4l.js} +1 -1
- package/dist/{internal-first-mate-guard-CiFH6X1H.js → internal-first-mate-guard-mvfZal_M.js} +3 -3
- package/dist/{internal-first-mate-guard-CiFH6X1H.js.map → internal-first-mate-guard-mvfZal_M.js.map} +1 -1
- package/dist/{internal-max-dispatch-guard-BGOHRYRt.js → internal-max-dispatch-guard-CxG_c3cc.js} +1 -1
- package/dist/{internal-max-dispatch-guard-CnBZxo5l.js → internal-max-dispatch-guard-Sp_rCYk_.js} +2 -2
- package/dist/{internal-max-dispatch-guard-CnBZxo5l.js.map → internal-max-dispatch-guard-Sp_rCYk_.js.map} +1 -1
- package/dist/{internal-plan-review-C73snnD8.js → internal-plan-review-Co01iHOW.js} +3 -3
- package/dist/{internal-plan-review-C73snnD8.js.map → internal-plan-review-Co01iHOW.js.map} +1 -1
- package/dist/{internal-prompt-submit-dov4UvBo.js → internal-prompt-submit-dflz0bqH.js} +4 -4
- package/dist/{internal-prompt-submit-dov4UvBo.js.map → internal-prompt-submit-dflz0bqH.js.map} +1 -1
- package/dist/{internal-session-bind-C3hrb9rP.js → internal-session-bind-BVQy7Vd4.js} +2 -2
- package/dist/{internal-session-bind-C3hrb9rP.js.map → internal-session-bind-BVQy7Vd4.js.map} +1 -1
- package/dist/{internal-stop-hook-DCjYE2x0.js → internal-stop-hook-DihBVzn2.js} +5 -5
- package/dist/{internal-stop-hook-DCjYE2x0.js.map → internal-stop-hook-DihBVzn2.js.map} +1 -1
- package/dist/{internal-stop-review-MBVYtrYS.js → internal-stop-review-CrnG4IJo.js} +2 -2
- package/dist/{internal-stop-review-MBVYtrYS.js.map → internal-stop-review-CrnG4IJo.js.map} +1 -1
- package/dist/{internal-worker-guard-dxGawAY3.js → internal-worker-guard-BSoS4wzV.js} +2 -2
- package/dist/{internal-worker-guard-dxGawAY3.js.map → internal-worker-guard-BSoS4wzV.js.map} +1 -1
- package/dist/{internal-workspace-header-_aEXOz5q.js → internal-workspace-header-booLOzwD.js} +2 -2
- package/dist/{internal-workspace-header-_aEXOz5q.js.map → internal-workspace-header-booLOzwD.js.map} +1 -1
- package/dist/{lifecycle-CJB2BwSJ.js → lifecycle-BYPEqFdV.js} +2 -2
- package/dist/{lifecycle-CJB2BwSJ.js.map → lifecycle-BYPEqFdV.js.map} +1 -1
- package/dist/{lifecycle-_BE0SnNs.js → lifecycle-C1LDvDD6.js} +2 -2
- package/dist/{lifecycle-_BE0SnNs.js.map → lifecycle-C1LDvDD6.js.map} +1 -1
- package/dist/lifecycle-Cz99P30h.js +2 -0
- package/dist/lifecycle-DqTFEJpS.js +2 -0
- package/dist/main.js +20 -20
- package/dist/{mcp-workspace-header-mXRLE8kg.js → mcp-workspace-header-BIW0SRgs.js} +2 -2
- package/dist/{mcp-workspace-header-mXRLE8kg.js.map → mcp-workspace-header-BIW0SRgs.js.map} +1 -1
- package/dist/{models-CSFIVxAH.js → models-B9tdaM6B.js} +3 -3
- package/dist/{models-CSFIVxAH.js.map → models-B9tdaM6B.js.map} +1 -1
- package/dist/{orchestration-B8kypXcZ.js → orchestration-DvsdorFq.js} +2 -2
- package/dist/{orchestration-B8kypXcZ.js.map → orchestration-DvsdorFq.js.map} +1 -1
- package/dist/{paths-CHBAj_t9.js → paths-BnZwolac.js} +4 -4
- package/dist/{paths-CHBAj_t9.js.map → paths-BnZwolac.js.map} +1 -1
- package/dist/paths-BzM6uxmd.js +2 -0
- package/dist/{peer-mcp-personas-BerVEkZ9.js → peer-mcp-personas-DcAErb_d.js} +209 -71
- package/dist/peer-mcp-personas-DcAErb_d.js.map +1 -0
- package/dist/{plan-review-hook-BMmw7wxR.js → plan-review-hook-BlsGnG02.js} +3 -3
- package/dist/{plan-review-hook-BMmw7wxR.js.map → plan-review-hook-BlsGnG02.js.map} +1 -1
- package/dist/{prompt-submit-hook-CGgT5m4Q.js → prompt-submit-hook-BJFLzCaT.js} +3 -3
- package/dist/{prompt-submit-hook-CGgT5m4Q.js.map → prompt-submit-hook-BJFLzCaT.js.map} +1 -1
- package/dist/{provision-o4bXbsvB.js → provision-B-a5KUCL.js} +4 -4
- package/dist/{provision-o4bXbsvB.js.map → provision-B-a5KUCL.js.map} +1 -1
- package/dist/{self-invocation-DahN1gw9.js → self-invocation-opSXHEs0.js} +2 -2
- package/dist/{self-invocation-DahN1gw9.js.map → self-invocation-opSXHEs0.js.map} +1 -1
- package/dist/{serve-DSL2Fcnc.js → serve-TiUhvpVp.js} +12 -12
- package/dist/{serve-DSL2Fcnc.js.map → serve-TiUhvpVp.js.map} +1 -1
- package/dist/{server-setup-CXXKmPIE.js → server-setup-CgbHmupe.js} +205 -57
- package/dist/server-setup-CgbHmupe.js.map +1 -0
- package/dist/{start-Cl_1UMg_.js → start-DNzOFabp.js} +3 -3
- package/dist/{start-Cl_1UMg_.js.map → start-DNzOFabp.js.map} +1 -1
- package/dist/{stop-gate-hook-D7N759TG.js → stop-gate-hook-DvNM8zFf.js} +3 -3
- package/dist/{stop-gate-hook-D7N759TG.js.map → stop-gate-hook-DvNM8zFf.js.map} +1 -1
- package/dist/{stop-gate-policy-C0gt04R0.js → stop-gate-policy-C5pXbY59.js} +2 -2
- package/dist/{stop-gate-policy-C0gt04R0.js.map → stop-gate-policy-C5pXbY59.js.map} +1 -1
- package/dist/{token-86uk6y4P.js → token-Css-ARGL.js} +2 -2
- package/dist/{token-86uk6y4P.js.map → token-Css-ARGL.js.map} +1 -1
- package/dist/{worker-dispatch-B-OA7tvU.js → worker-dispatch-DwS99DXz.js} +2 -2
- package/dist/{worker-dispatch-B-OA7tvU.js.map → worker-dispatch-DwS99DXz.js.map} +1 -1
- package/package.json +1 -1
- package/dist/aic-ledger-BrDqsuge.js.map +0 -1
- package/dist/attribution-settings-DHWo0lyG.js.map +0 -1
- package/dist/claude-uAFPKvuS.js.map +0 -1
- package/dist/engine-57iIqICe.js +0 -2
- package/dist/fast-profile-contract-_DhIWank.js.map +0 -1
- package/dist/internal-fast-dispatch-guard-CZ4BZuAG.js.map +0 -1
- package/dist/lifecycle-D0KsoSqz.js +0 -2
- package/dist/lifecycle-DimEguJO.js +0 -2
- package/dist/paths-eHoOwFzZ.js +0 -2
- package/dist/peer-mcp-personas-BerVEkZ9.js.map +0 -1
- package/dist/server-setup-CXXKmPIE.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { $ as EFFORT_ORDER, $t as
|
|
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-
|
|
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-
|
|
6
|
-
import { t as getCopilotUsage } from "./get-copilot-usage-
|
|
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-
|
|
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
|
|
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
|
|
366
|
-
* `
|
|
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["
|
|
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
|
|
633
|
-
absentEffortDefault: "
|
|
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["
|
|
653
|
-
absentEffortDefault: "
|
|
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
|
|
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
|
|
776
|
+
* - Luna Explore: tool calls, >=1M, high+max, Responses.
|
|
725
777
|
* - Sol Plan: tool calls, >=1M, high, Responses.
|
|
726
|
-
* -
|
|
727
|
-
* - Gemini
|
|
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.
|
|
762
|
-
if (!gemini) missing.push(`${FAST_PROFILE_MODELS.
|
|
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.
|
|
765
|
-
if (!hasContextAtLeast(gemini, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.
|
|
766
|
-
if (!supportsEffort(gemini, "high")) missing.push(`${FAST_PROFILE_MODELS.
|
|
767
|
-
if (!supportsEndpoint(gemini, "chat")) missing.push(`${FAST_PROFILE_MODELS.
|
|
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
|
|
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.
|
|
2426
|
+
var version = "0.3.323";
|
|
2295
2427
|
//#endregion
|
|
2296
2428
|
//#region src/lib/approval.ts
|
|
2297
2429
|
const awaitApproval = async () => {
|
|
@@ -3656,7 +3788,7 @@ function makeContentBlockStop(index) {
|
|
|
3656
3788
|
index
|
|
3657
3789
|
};
|
|
3658
3790
|
}
|
|
3659
|
-
function makeMessageDelta(stopReason, stopSequence, usage) {
|
|
3791
|
+
function makeMessageDelta(stopReason, stopSequence, usage, copilotUsage) {
|
|
3660
3792
|
return {
|
|
3661
3793
|
type: "message_delta",
|
|
3662
3794
|
delta: {
|
|
@@ -3668,7 +3800,8 @@ function makeMessageDelta(stopReason, stopSequence, usage) {
|
|
|
3668
3800
|
output_tokens: usage.output_tokens ?? 0,
|
|
3669
3801
|
cache_read_input_tokens: usage.cache_read_input_tokens ?? 0,
|
|
3670
3802
|
cache_creation_input_tokens: usage.cache_creation_input_tokens ?? 0
|
|
3671
|
-
}
|
|
3803
|
+
},
|
|
3804
|
+
...copilotUsage ? { copilot_usage: copilotUsage } : {}
|
|
3672
3805
|
};
|
|
3673
3806
|
}
|
|
3674
3807
|
function makeMessageStop() {
|
|
@@ -4623,6 +4756,7 @@ async function* synthAnthropicFromChat(upstream, opts) {
|
|
|
4623
4756
|
let usageCacheRead = 0;
|
|
4624
4757
|
let usageCacheWrite = 0;
|
|
4625
4758
|
let aicRecorded = false;
|
|
4759
|
+
let aicCopilotUsageWire;
|
|
4626
4760
|
let finishReason = null;
|
|
4627
4761
|
let sawDone = false;
|
|
4628
4762
|
yield makeMessageStart(messageId, opts.modelId);
|
|
@@ -4640,7 +4774,12 @@ async function* synthAnthropicFromChat(upstream, opts) {
|
|
|
4640
4774
|
continue;
|
|
4641
4775
|
}
|
|
4642
4776
|
if (!aicRecorded) {
|
|
4643
|
-
|
|
4777
|
+
const pricedUsage = extractCopilotUsage(chunk.copilot_usage);
|
|
4778
|
+
if (pricedUsage && pricedUsage.totalNanoAiu > 0) {
|
|
4779
|
+
recordAic(opts.modelId, pricedUsage);
|
|
4780
|
+
aicRecorded = true;
|
|
4781
|
+
aicCopilotUsageWire = copilotUsageToWire(pricedUsage);
|
|
4782
|
+
}
|
|
4644
4783
|
}
|
|
4645
4784
|
if (chunk.usage) {
|
|
4646
4785
|
usageIn = Math.max(usageIn, chunk.usage.prompt_tokens ?? 0);
|
|
@@ -4726,7 +4865,7 @@ async function* synthAnthropicFromChat(upstream, opts) {
|
|
|
4726
4865
|
output_tokens: usage.output,
|
|
4727
4866
|
cache_read_input_tokens: usage.cacheRead,
|
|
4728
4867
|
cache_creation_input_tokens: usage.cacheWrite
|
|
4729
|
-
});
|
|
4868
|
+
}, aicCopilotUsageWire);
|
|
4730
4869
|
yield makeMessageStop();
|
|
4731
4870
|
}
|
|
4732
4871
|
//#endregion
|
|
@@ -4882,7 +5021,7 @@ async function* synthAnthropicFromResponses(upstream, opts) {
|
|
|
4882
5021
|
let sawTool = false;
|
|
4883
5022
|
let hitMaxTokens = false;
|
|
4884
5023
|
let sawTerminal = false;
|
|
4885
|
-
let
|
|
5024
|
+
let aicCopilotUsageWire = void 0;
|
|
4886
5025
|
const closeCurrent = () => {
|
|
4887
5026
|
if (!current) return;
|
|
4888
5027
|
q.push(makeContentBlockStop(current.index));
|
|
@@ -5052,8 +5191,12 @@ async function* synthAnthropicFromResponses(upstream, opts) {
|
|
|
5052
5191
|
case "response.completed":
|
|
5053
5192
|
case "response.incomplete": {
|
|
5054
5193
|
sawTerminal = true;
|
|
5055
|
-
if (
|
|
5056
|
-
|
|
5194
|
+
if (aicCopilotUsageWire === void 0) {
|
|
5195
|
+
const usage = extractCopilotUsage(ev.copilot_usage);
|
|
5196
|
+
if (usage && usage.totalNanoAiu > 0) {
|
|
5197
|
+
recordAic(opts.modelId, usage);
|
|
5198
|
+
aicCopilotUsageWire = copilotUsageToWire(usage);
|
|
5199
|
+
}
|
|
5057
5200
|
}
|
|
5058
5201
|
const u = ev.response?.usage;
|
|
5059
5202
|
if (u) {
|
|
@@ -5087,7 +5230,7 @@ async function* synthAnthropicFromResponses(upstream, opts) {
|
|
|
5087
5230
|
output_tokens: usage.output,
|
|
5088
5231
|
cache_read_input_tokens: usage.cacheRead,
|
|
5089
5232
|
cache_creation_input_tokens: usage.cacheWrite
|
|
5090
|
-
}));
|
|
5233
|
+
}, aicCopilotUsageWire));
|
|
5091
5234
|
q.push(makeMessageStop());
|
|
5092
5235
|
for (const e of q) yield e;
|
|
5093
5236
|
q.length = 0;
|
|
@@ -5432,7 +5575,7 @@ function preprocessMaxRequest(rawBody, launch, subagentRequest = false) {
|
|
|
5432
5575
|
Object.freeze([MAX_LUNA_HIGH_ALIAS_ID, MAX_LUNA_MAX_ALIAS_ID]);
|
|
5433
5576
|
//#endregion
|
|
5434
5577
|
//#region src/lib/fast-request-preprocess.ts
|
|
5435
|
-
const cheapFamily = (profileId) => profileId === "cheap" || profileId === "cheap1m" || profileId === "cheapest";
|
|
5578
|
+
const cheapFamily = (profileId) => profileId === "cheap" || profileId === "cheap1m" || profileId === "cheapest" || profileId === "balanced";
|
|
5436
5579
|
const pinnedProfile = (profileId) => profileId === "fast" || cheapFamily(profileId);
|
|
5437
5580
|
/**
|
|
5438
5581
|
* Profiles whose every selectable `/model` row must stay at Claude Code's
|
|
@@ -5440,24 +5583,25 @@ const pinnedProfile = (profileId) => profileId === "fast" || cheapFamily(profile
|
|
|
5440
5583
|
* `fast` keeps 1M on lead and subagents by design; `cheap1m` keeps 1M on
|
|
5441
5584
|
* the lead only (its subagents are bare-by-construction).
|
|
5442
5585
|
*/
|
|
5443
|
-
const bareEnforcedProfile = (profileId) => profileId === "cheap" || profileId === "cheapest";
|
|
5586
|
+
const bareEnforcedProfile = (profileId) => profileId === "cheap" || profileId === "cheapest" || profileId === "balanced";
|
|
5444
5587
|
function explicitEffortOf(value) {
|
|
5445
5588
|
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
5446
5589
|
}
|
|
5447
5590
|
/**
|
|
5448
|
-
* Apply authenticated fast/cheap-profile model and effort policy before
|
|
5591
|
+
* Apply authenticated fast/cheap/balanced-profile model and effort policy before
|
|
5449
5592
|
* ordinary model resolution. Synthetic aliases are refused outside an
|
|
5450
5593
|
* authenticated pinned launch, so raw/BYO traffic cannot opt itself into
|
|
5451
|
-
* private profile semantics. The cheap family (including cheapest
|
|
5452
|
-
* fast's effort mapping (same model-to-effort rows, just
|
|
5453
|
-
* 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.
|
|
5454
5597
|
* Note the reviewer differs: fast reviews on Sonnet 5/xhigh while cheap
|
|
5455
|
-
* reviews on Luna/max
|
|
5456
|
-
* here, so each profile's reviewer resolves to
|
|
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.
|
|
5457
5601
|
*
|
|
5458
|
-
* Pinned-profile isolation (fast/cheap/cheap1m/cheapest): only
|
|
5602
|
+
* Pinned-profile isolation (fast/cheap/cheap1m/cheapest/balanced): only
|
|
5459
5603
|
* router-provided models are accepted (anything else is `rejectedModel`).
|
|
5460
|
-
* Context: cheap/cheapest traffic is stripped to the bare 200K id;
|
|
5604
|
+
* Context: cheap/cheapest/balanced traffic is stripped to the bare 200K id;
|
|
5461
5605
|
* cheap1m subagent traffic is stripped while its lead keeps 1M; fast
|
|
5462
5606
|
* keeps 1M on both. Effort: picker changes apply to the lead session
|
|
5463
5607
|
* only — lead requests keep an explicit `output_config.effort` when
|
|
@@ -5994,21 +6138,25 @@ async function handleCompletion(c) {
|
|
|
5994
6138
|
const maxProfileRequest = identity.launch?.profileId === "max";
|
|
5995
6139
|
const cheapProfileRequest = identity.launch?.profileId === "cheap" || identity.launch?.profileId === "cheap1m";
|
|
5996
6140
|
const cheapestProfileRequest = identity.launch?.profileId === "cheapest";
|
|
6141
|
+
const balancedProfileRequest = identity.launch?.profileId === "balanced";
|
|
5997
6142
|
const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
|
|
5998
6143
|
const fastSubagentRequest = fastProfileRequest && subagentRequest;
|
|
5999
6144
|
const maxSubagentRequest = maxProfileRequest && subagentRequest;
|
|
6000
6145
|
const cheapSubagentRequest = cheapProfileRequest && subagentRequest;
|
|
6001
6146
|
const cheapestSubagentRequest = cheapestProfileRequest && subagentRequest;
|
|
6147
|
+
const balancedSubagentRequest = balancedProfileRequest && subagentRequest;
|
|
6002
6148
|
const fastLeadAdvisor = fastProfileRequest && !fastSubagentRequest;
|
|
6003
6149
|
const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
|
|
6004
6150
|
const cheapLeadAdvisor = cheapProfileRequest && !cheapSubagentRequest;
|
|
6005
6151
|
const cheapestLeadAdvisor = cheapestProfileRequest && !cheapestSubagentRequest;
|
|
6006
|
-
const
|
|
6152
|
+
const balancedLeadAdvisor = balancedProfileRequest && !balancedSubagentRequest;
|
|
6153
|
+
const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && !cheapestSubagentRequest && !balancedSubagentRequest;
|
|
6007
6154
|
const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6008
6155
|
const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6009
6156
|
const cheapAdvisorEnabled = cheapLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6010
6157
|
const cheapestAdvisorEnabled = cheapestLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6011
|
-
const
|
|
6158
|
+
const balancedAdvisorEnabled = balancedLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6159
|
+
const advisorBehaviorEnabled = fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : balancedLeadAdvisor ? balancedAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
|
|
6012
6160
|
let fastAdvisorChoice;
|
|
6013
6161
|
let maxAdvisorChoice;
|
|
6014
6162
|
if (maxAdvisorEnabled) {
|
|
@@ -6047,9 +6195,9 @@ async function handleCompletion(c) {
|
|
|
6047
6195
|
}, 503);
|
|
6048
6196
|
}
|
|
6049
6197
|
}
|
|
6050
|
-
if (cheapAdvisorEnabled) {
|
|
6198
|
+
if (cheapAdvisorEnabled || balancedAdvisorEnabled) {
|
|
6051
6199
|
const mismatch = fastAdvisorMetadataMismatch(rawBody);
|
|
6052
|
-
const relaunchProfile = identity.launch?.profileId === "cheap1m" ? "cheap1m" : "cheap";
|
|
6200
|
+
const relaunchProfile = identity.launch?.profileId === "cheap1m" ? "cheap1m" : identity.launch?.profileId === "balanced" ? "balanced" : "cheap";
|
|
6053
6201
|
if (mismatch) return c.json({
|
|
6054
6202
|
type: "error",
|
|
6055
6203
|
error: {
|
|
@@ -6140,7 +6288,7 @@ async function handleCompletion(c) {
|
|
|
6140
6288
|
parsedBase = JSON.parse(promptWindowBody);
|
|
6141
6289
|
} catch {}
|
|
6142
6290
|
const wantsStream = parsedBase?.stream === true;
|
|
6143
|
-
if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
|
|
6291
|
+
if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
|
|
6144
6292
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
6145
6293
|
const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
|
|
6146
6294
|
const translatedAdvisorAborter = new AbortController();
|
|
@@ -6163,7 +6311,7 @@ async function handleCompletion(c) {
|
|
|
6163
6311
|
effort: maxAdvisorChoice.effort,
|
|
6164
6312
|
escalated: false,
|
|
6165
6313
|
fastProfile: false
|
|
6166
|
-
} : cheapAdvisorEnabled || cheapestAdvisorEnabled ? {
|
|
6314
|
+
} : cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled ? {
|
|
6167
6315
|
model: fastAdvisorChoice.model,
|
|
6168
6316
|
effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
6169
6317
|
escalated: fastAdvisorChoice.escalated,
|
|
@@ -6183,7 +6331,7 @@ async function handleCompletion(c) {
|
|
|
6183
6331
|
advisorEscalated: advisorChoice.escalated,
|
|
6184
6332
|
advisorFastProfile: advisorChoice.fastProfile,
|
|
6185
6333
|
advisorMaxProfile: maxAdvisorEnabled,
|
|
6186
|
-
advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled,
|
|
6334
|
+
advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled || balancedAdvisorEnabled,
|
|
6187
6335
|
advisorEffort: advisorChoice.effort,
|
|
6188
6336
|
externalAborter: translatedAdvisorAborter,
|
|
6189
6337
|
continueTurn: makeShimContinueTurn(endpoint, {
|
|
@@ -6306,10 +6454,10 @@ async function handleCompletion(c) {
|
|
|
6306
6454
|
requestHeaders,
|
|
6307
6455
|
advisorModel: advisorChoice.model,
|
|
6308
6456
|
advisorEscalated: advisorChoice.escalated,
|
|
6309
|
-
advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor,
|
|
6457
|
+
advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor || balancedLeadAdvisor,
|
|
6310
6458
|
advisorMaxProfile: maxAdvisorEnabled,
|
|
6311
|
-
advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor,
|
|
6312
|
-
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),
|
|
6313
6461
|
externalAborter: advisorAborter
|
|
6314
6462
|
}), {
|
|
6315
6463
|
status: response.status,
|
|
@@ -7899,6 +8047,6 @@ function getCodexEnvVars(serverUrl) {
|
|
|
7899
8047
|
return vars;
|
|
7900
8048
|
}
|
|
7901
8049
|
//#endregion
|
|
7902
|
-
export {
|
|
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 };
|
|
7903
8051
|
|
|
7904
|
-
//# sourceMappingURL=server-setup-
|
|
8052
|
+
//# sourceMappingURL=server-setup-CgbHmupe.js.map
|