github-router 0.3.306 → 0.3.308
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/{attribution-settings-C5ScaOmz.js → attribution-settings-C_ZLSCQ4.js} +60 -61
- package/dist/attribution-settings-C_ZLSCQ4.js.map +1 -0
- package/dist/{auth-D9kUMR37.js → auth-O_UG1ABO.js} +3 -3
- package/dist/{auth-D9kUMR37.js.map → auth-O_UG1ABO.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-C7MfBexN.js → check-usage-dicJOWML.js} +4 -4
- package/dist/{check-usage-C7MfBexN.js.map → check-usage-dicJOWML.js.map} +1 -1
- package/dist/{claude-CsGXL12X.js → claude-CyiXTFxe.js} +33 -30
- package/dist/claude-CyiXTFxe.js.map +1 -0
- package/dist/{codex-DpwyLLTp.js → codex-BV4Tvt0q.js} +5 -5
- package/dist/{codex-DpwyLLTp.js.map → codex-BV4Tvt0q.js.map} +1 -1
- package/dist/{debug-CDu4RIgW.js → debug-2PgImRnr.js} +2 -2
- package/dist/{debug-CDu4RIgW.js.map → debug-2PgImRnr.js.map} +1 -1
- package/dist/engine-Cv4SNuzn.js +2 -0
- package/dist/{fast-profile-contract-OuZQaGif.js → fast-profile-contract-BWCJy6iL.js} +6 -4
- package/dist/fast-profile-contract-BWCJy6iL.js.map +1 -0
- package/dist/{gate-discovery-BVLZH7-6.js → gate-discovery-CLV0ft3G.js} +5 -5
- package/dist/{gate-discovery-BVLZH7-6.js.map → gate-discovery-CLV0ft3G.js.map} +1 -1
- package/dist/{get-copilot-usage-CNMvWsMD.js → get-copilot-usage-Cjy8TiFf.js} +2 -2
- package/dist/{get-copilot-usage-CNMvWsMD.js.map → get-copilot-usage-Cjy8TiFf.js.map} +1 -1
- package/dist/hooks.mjs +28 -12
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-artifact-open-wYwuChib.js → internal-artifact-open-CxeIfsW_.js} +2 -2
- package/dist/{internal-artifact-open-wYwuChib.js.map → internal-artifact-open-CxeIfsW_.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-CXs4ympz.js → internal-fast-dispatch-guard-CrsZI0pO.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-u3vxgazZ.js → internal-fast-dispatch-guard-kzSKB0yV.js} +3 -3
- package/dist/{internal-fast-dispatch-guard-u3vxgazZ.js.map → internal-fast-dispatch-guard-kzSKB0yV.js.map} +1 -1
- package/dist/{internal-first-mate-guard-C8GG8i5H.js → internal-first-mate-guard-BuweUgjb.js} +3 -3
- package/dist/{internal-first-mate-guard-C8GG8i5H.js.map → internal-first-mate-guard-BuweUgjb.js.map} +1 -1
- package/dist/{internal-first-mate-guard-BGaGGIBS.js → internal-first-mate-guard-Nf1H0mCK.js} +1 -1
- package/dist/{internal-max-dispatch-guard-B-n687ho.js → internal-max-dispatch-guard-DF-f8VwE.js} +1 -1
- package/dist/{internal-max-dispatch-guard-Cw_9Qx-9.js → internal-max-dispatch-guard-lS4usOV5.js} +12 -5
- package/dist/internal-max-dispatch-guard-lS4usOV5.js.map +1 -0
- package/dist/{internal-plan-review-DCbxSIUR.js → internal-plan-review-DLduDz41.js} +3 -3
- package/dist/{internal-plan-review-DCbxSIUR.js.map → internal-plan-review-DLduDz41.js.map} +1 -1
- package/dist/{internal-prompt-submit-DIn8b_Zt.js → internal-prompt-submit-DG94f8E-.js} +4 -4
- package/dist/{internal-prompt-submit-DIn8b_Zt.js.map → internal-prompt-submit-DG94f8E-.js.map} +1 -1
- package/dist/{internal-session-bind-DXosxciQ.js → internal-session-bind-D6Hpl-84.js} +2 -2
- package/dist/{internal-session-bind-DXosxciQ.js.map → internal-session-bind-D6Hpl-84.js.map} +1 -1
- package/dist/{internal-stop-hook-C2lMgQuU.js → internal-stop-hook-B8Z1k6xC.js} +5 -5
- package/dist/{internal-stop-hook-C2lMgQuU.js.map → internal-stop-hook-B8Z1k6xC.js.map} +1 -1
- package/dist/{internal-stop-review-CnYqJTiC.js → internal-stop-review-DlKzZgFm.js} +2 -2
- package/dist/{internal-stop-review-CnYqJTiC.js.map → internal-stop-review-DlKzZgFm.js.map} +1 -1
- package/dist/{internal-worker-guard-DdwLtAMn.js → internal-worker-guard-D7sfByyo.js} +2 -2
- package/dist/{internal-worker-guard-DdwLtAMn.js.map → internal-worker-guard-D7sfByyo.js.map} +1 -1
- package/dist/{internal-workspace-header-B4qymRDb.js → internal-workspace-header-CU5OjLCB.js} +2 -2
- package/dist/{internal-workspace-header-B4qymRDb.js.map → internal-workspace-header-CU5OjLCB.js.map} +1 -1
- package/dist/lifecycle-B0USSJvd.js +2 -0
- package/dist/{lifecycle-DOvQozrm.js → lifecycle-BCnarXJV.js} +2 -2
- package/dist/{lifecycle-DOvQozrm.js.map → lifecycle-BCnarXJV.js.map} +1 -1
- package/dist/lifecycle-CQFjaQc0.js +2 -0
- package/dist/{lifecycle-CSHU91pP.js → lifecycle-CtRA3Y7p.js} +2 -2
- package/dist/{lifecycle-CSHU91pP.js.map → lifecycle-CtRA3Y7p.js.map} +1 -1
- package/dist/main.js +19 -19
- package/dist/max-profile-contract-v2Q6eN5w.js +355 -0
- package/dist/max-profile-contract-v2Q6eN5w.js.map +1 -0
- package/dist/{mcp-workspace-header-Cv4QWFVV.js → mcp-workspace-header-B60WSR1Y.js} +2 -2
- package/dist/{mcp-workspace-header-Cv4QWFVV.js.map → mcp-workspace-header-B60WSR1Y.js.map} +1 -1
- package/dist/{models-BDhlItXr.js → models-COuMOfM6.js} +3 -3
- package/dist/{models-BDhlItXr.js.map → models-COuMOfM6.js.map} +1 -1
- package/dist/{orchestration-C2Q_Qynl.js → orchestration-DjLA-lxB.js} +2 -2
- package/dist/{orchestration-C2Q_Qynl.js.map → orchestration-DjLA-lxB.js.map} +1 -1
- package/dist/{paths-D6SI5bmY.js → paths-De1Qh9Q9.js} +4 -4
- package/dist/{paths-D6SI5bmY.js.map → paths-De1Qh9Q9.js.map} +1 -1
- package/dist/paths-DyX6SEnd.js +2 -0
- package/dist/{peer-mcp-personas-DXOdPbev.js → peer-mcp-personas-DAd076hn.js} +112 -352
- package/dist/peer-mcp-personas-DAd076hn.js.map +1 -0
- package/dist/{plan-review-hook-CnRRttwl.js → plan-review-hook-vL6BYmA8.js} +3 -3
- package/dist/{plan-review-hook-CnRRttwl.js.map → plan-review-hook-vL6BYmA8.js.map} +1 -1
- package/dist/{prompt-submit-hook-G84QAm_F.js → prompt-submit-hook-DfqufWC1.js} +3 -3
- package/dist/{prompt-submit-hook-G84QAm_F.js.map → prompt-submit-hook-DfqufWC1.js.map} +1 -1
- package/dist/{provision-CfB_DkuL.js → provision-Xcr-fJii.js} +4 -4
- package/dist/{provision-CfB_DkuL.js.map → provision-Xcr-fJii.js.map} +1 -1
- package/dist/{self-invocation-Da5gSWen.js → self-invocation-B84JCHps.js} +2 -2
- package/dist/{self-invocation-Da5gSWen.js.map → self-invocation-B84JCHps.js.map} +1 -1
- package/dist/{serve-Bfw7xEkR.js → serve-8tqMuzVi.js} +12 -12
- package/dist/{serve-Bfw7xEkR.js.map → serve-8tqMuzVi.js.map} +1 -1
- package/dist/{server-setup-Cbuq2-Bi.js → server-setup-C7jSESEI.js} +301 -11
- package/dist/server-setup-C7jSESEI.js.map +1 -0
- package/dist/{start-CLSlFGUF.js → start-CaTinp_s.js} +3 -3
- package/dist/{start-CLSlFGUF.js.map → start-CaTinp_s.js.map} +1 -1
- package/dist/{stop-gate-hook-rjDyq1lk.js → stop-gate-hook-BEU8qQrC.js} +3 -3
- package/dist/{stop-gate-hook-rjDyq1lk.js.map → stop-gate-hook-BEU8qQrC.js.map} +1 -1
- package/dist/{stop-gate-policy-m3dvbV10.js → stop-gate-policy-qzqXfRxE.js} +2 -2
- package/dist/{stop-gate-policy-m3dvbV10.js.map → stop-gate-policy-qzqXfRxE.js.map} +1 -1
- package/dist/{token-DnTZlcc6.js → token-CCg-Ov5q.js} +2 -2
- package/dist/{token-DnTZlcc6.js.map → token-CCg-Ov5q.js.map} +1 -1
- package/dist/{worker-dispatch-CQ2y0aBP.js → worker-dispatch-CH-NN5FW.js} +2 -2
- package/dist/{worker-dispatch-CQ2y0aBP.js.map → worker-dispatch-CH-NN5FW.js.map} +1 -1
- package/package.json +1 -1
- package/dist/attribution-settings-C5ScaOmz.js.map +0 -1
- package/dist/claude-CsGXL12X.js.map +0 -1
- package/dist/engine-j34DK_PM.js +0 -2
- package/dist/fast-profile-contract-OuZQaGif.js.map +0 -1
- package/dist/internal-max-dispatch-guard-Cw_9Qx-9.js.map +0 -1
- package/dist/lifecycle-B4DDf-Me.js +0 -2
- package/dist/lifecycle-D0BpTV9A.js +0 -2
- package/dist/max-profile-contract-CiD5wyET.js +0 -276
- package/dist/max-profile-contract-CiD5wyET.js.map +0 -1
- package/dist/paths-Bmj5b7PS.js +0 -2
- package/dist/peer-mcp-personas-DXOdPbev.js.map +0 -1
- package/dist/server-setup-Cbuq2-Bi.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as UNKNOWN_EFFORT_ANCHOR,
|
|
1
|
+
import { $ as UNKNOWN_EFFORT_ANCHOR, At as countTokens, B as resolveAdvisorEffort, Bt as resolveMcpToolTimeoutMs, Cn as withOneMSuffix, D as toolbeltEnabled, F as ADVISOR_TOOL_INSTRUCTIONS, Ft as findLaunchBySecret, G as repairRejectedThinkingHistory, Gt as parseJsonOrDiagnose, H as formatThinkingRepairDecline, Ht as createChatCompletions, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as isControllerClosedError, K as buildAnthropicErrorEvent, Kt as normalizeOpenAIUsage, L as buildAdvisorStream, Mt as getTextTokenCount, N as searchWeb, Nt as getTokenCount, P as ADVISOR_INTERNAL_TOOL_NAME, Pt as getTokenizerFromModel, Q as EFFORT_ORDER, R as injectAdvisorTool, Rt as assembleResponsesPayload, Sn as oneMContextDisabled, Tn as withInstallLock, U as rememberThinkingHistoryRepair, Ut as MAX_RESPONSE_BODY_BYTES, V as resolveAdvisorModel, Vt as createResponses, W as repairKnownThinkingHistory, Wt as readResponseBodyCapped, X as readIteratorWithTimeout, Y as logStreamError, Z as relayAnthropicStream, an as toolbeltPathOverride, bn as classifyMessagesRoute, en as provisionTreeSitterAssets, et as bucketEffort, fn as UPSTREAM_FETCH_TIMEOUT_MS, hn as isBudgetClaudeLead, i as assertMcpToolSurfaceConsistent, it as agentToolsEnabled, jt as createMessages, kt as shimDefaultsToXhigh, mn as generateRandomPort, nt as handleMcpDelete, pn as UPSTREAM_INACTIVITY_TIMEOUT_MS, q as buildOpenAIErrorEvent, rt as handleMcpPost, sn as BUDGET_SMALL_FAST_SLUG, tt as clampEffort, vn as upstreamAllowH2, wn as withOneMSuffixForLead, xn as catalogAdvertises1M, yn as upstreamMaxConnections, z as isAdvisorRequested, zt as warnOnTokenPriceDrift } from "./peer-mcp-personas-DAd076hn.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-De1Qh9Q9.js";
|
|
4
4
|
import { t as state } from "./state-B8adscCv.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-CCg-Ov5q.js";
|
|
6
|
+
import { t as getCopilotUsage } from "./get-copilot-usage-Cjy8TiFf.js";
|
|
7
7
|
import { a as resolveExecutable, n as killManagedTree, o as runCommandCapture, r as parseBoolEnv, s as runCommandVoid } from "./exec-y8C_MU8A.js";
|
|
8
|
-
import { r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-
|
|
9
|
-
import { d as maxAdvisorPinIsValid, i as MAX_PROFILE_MODELS,
|
|
8
|
+
import { a as FAST_PROFILE_MODELS, o as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-BWCJy6iL.js";
|
|
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-v2Q6eN5w.js";
|
|
10
10
|
import consola from "consola";
|
|
11
11
|
import fs, { existsSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
@@ -355,6 +355,295 @@ async function runSelfUpdate(opts) {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
//#endregion
|
|
358
|
+
//#region src/lib/launch-profile.ts
|
|
359
|
+
const STANDARD_PROFILE = Object.freeze({
|
|
360
|
+
id: "standard",
|
|
361
|
+
hasCoordinator: true
|
|
362
|
+
});
|
|
363
|
+
/**
|
|
364
|
+
* The `-m fast` roster: exactly five native agents (`Explore`, `Plan`,
|
|
365
|
+
* `general-purpose`, `implementer`, `reviewer`), the fast-only `oracle` peer
|
|
366
|
+
* tool, no coordinator, and `peers`/`search` plus optional browser and
|
|
367
|
+
* browse-only worker groups. Core workers, `orchestrate`, `decide`, `fleet`,
|
|
368
|
+
* and `first-mate` remain hard denies even when their standard gates pass.
|
|
369
|
+
*/
|
|
370
|
+
const FAST_PROFILE = Object.freeze({
|
|
371
|
+
id: "fast",
|
|
372
|
+
nativeRoster: new Set(FAST_PROFILE_NATIVE_AGENT_NAMES),
|
|
373
|
+
personaAllowlist: /* @__PURE__ */ new Set(["oracle"]),
|
|
374
|
+
allowedGroups: /* @__PURE__ */ new Set([
|
|
375
|
+
"peers",
|
|
376
|
+
"search",
|
|
377
|
+
"workers",
|
|
378
|
+
"browser"
|
|
379
|
+
]),
|
|
380
|
+
hasCoordinator: false
|
|
381
|
+
});
|
|
382
|
+
/**
|
|
383
|
+
* The `-m max` profile: Sol/Luna-led, browse-only workers, and explicit
|
|
384
|
+
* cross-lab peer names. The descriptor is a hard projection for bound launch
|
|
385
|
+
* requests; unbound/BYO traffic remains standard because it has no registry
|
|
386
|
+
* entry carrying this allow-list.
|
|
387
|
+
*/
|
|
388
|
+
const MAX_PROFILE = Object.freeze({
|
|
389
|
+
id: "max",
|
|
390
|
+
nativeRoster: new Set(MAX_PROFILE_NATIVE_AGENT_NAMES),
|
|
391
|
+
personaAllowlist: /* @__PURE__ */ new Set([
|
|
392
|
+
"sol_critic",
|
|
393
|
+
"codex_reviewer",
|
|
394
|
+
"sonnet_reviewer",
|
|
395
|
+
"opus_critic",
|
|
396
|
+
"gemini_critic",
|
|
397
|
+
"gemini_reviewer",
|
|
398
|
+
"grok_critic",
|
|
399
|
+
"grok_reviewer"
|
|
400
|
+
]),
|
|
401
|
+
allowedGroups: /* @__PURE__ */ new Set([
|
|
402
|
+
"peers",
|
|
403
|
+
"search",
|
|
404
|
+
"workers",
|
|
405
|
+
"browser",
|
|
406
|
+
"decide",
|
|
407
|
+
"fleet",
|
|
408
|
+
"first-mate"
|
|
409
|
+
]),
|
|
410
|
+
hasCoordinator: true
|
|
411
|
+
});
|
|
412
|
+
function profileDescriptor(id) {
|
|
413
|
+
if (id === "fast") return FAST_PROFILE;
|
|
414
|
+
if (id === "max") return MAX_PROFILE;
|
|
415
|
+
return STANDARD_PROFILE;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Resolve the parsed `-m` argument to a launch profile.
|
|
419
|
+
*
|
|
420
|
+
* Deliberately keyed on the RAW alias string (trimmed, case-insensitive
|
|
421
|
+
* `"fast"`), never on a resolved model id: `resolveLeadSlugArg` maps `fast`
|
|
422
|
+
* to `FAST_LEAD_MODEL` (`./port`) before this is of any use to a caller who
|
|
423
|
+
* only has the resolved id, so callers that already resolved the lead must
|
|
424
|
+
* pass the ORIGINAL `-m` value here, not the resolved one. This is what
|
|
425
|
+
* keeps `-m gpt-5.6-luna` (a direct pin of the same underlying model) a
|
|
426
|
+
* standard-surface launch — only the literal alias narrows the surface.
|
|
427
|
+
*/
|
|
428
|
+
function resolveLaunchProfile(modelArg) {
|
|
429
|
+
const arg = modelArg?.trim().toLowerCase();
|
|
430
|
+
if (arg === "fast") return "fast";
|
|
431
|
+
if (arg === "max") return "max";
|
|
432
|
+
return "standard";
|
|
433
|
+
}
|
|
434
|
+
function validateMaxProfileLaunch(catalog) {
|
|
435
|
+
return validateMaxProfilePrerequisites(catalog);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Router-owned alias id for the fast profile's Sonnet-tier row
|
|
439
|
+
* (`ANTHROPIC_DEFAULT_SONNET_MODEL`). Never sent upstream — canonicalized to
|
|
440
|
+
* `LUNA_REAL_MODEL_ID` by `canonicalizeAliasModel` before the request
|
|
441
|
+
* reaches Copilot.
|
|
442
|
+
*/
|
|
443
|
+
const LUNA_DRIVER_ALIAS_ID = "gh-router-luna-driver-max";
|
|
444
|
+
/** Fast Explore alias preserves its high-effort provenance until the
|
|
445
|
+
* authenticated request boundary. Bare Luna remains the max-effort lead and
|
|
446
|
+
* `general-purpose` model. */
|
|
447
|
+
const LUNA_SCOUT_ALIAS_ID = "gh-router-luna-scout-high";
|
|
448
|
+
/** Retired Fast aliases remain recognizable only so old running clients fail
|
|
449
|
+
* with an explicit stale-alias error instead of silently changing semantics. */
|
|
450
|
+
const LUNA_IMPLEMENTER_ALIAS_ID = "gh-router-luna-implementer-max";
|
|
451
|
+
const FAST_CRITIC_ALIAS_ID = "gh-router-fast-critic-medium";
|
|
452
|
+
const LUNA_SONNET_ALIAS_ID = "gh-router-luna-sonnet-xhigh";
|
|
453
|
+
/**
|
|
454
|
+
* Router-owned alias id for the fast profile's Haiku-tier row
|
|
455
|
+
* (`ANTHROPIC_DEFAULT_HAIKU_MODEL` / `ANTHROPIC_SMALL_FAST_MODEL`).
|
|
456
|
+
*/
|
|
457
|
+
const LUNA_HAIKU_ALIAS_ID = "gh-router-luna-haiku-high";
|
|
458
|
+
/** Max-profile aliases are intentionally separate from the fast aliases. They
|
|
459
|
+
* preserve the fixed max role effort until the authenticated max request
|
|
460
|
+
* boundary and are never valid on standard or fast launches. */
|
|
461
|
+
const MAX_LUNA_HIGH_ALIAS_ID = "gh-router-max-luna-high";
|
|
462
|
+
const MAX_LUNA_MAX_ALIAS_ID = "gh-router-max-luna-max";
|
|
463
|
+
/** The real Copilot catalog id every Luna alias (including the driver
|
|
464
|
+
* itself) canonicalizes to. */
|
|
465
|
+
const LUNA_REAL_MODEL_ID = FAST_PROFILE_MODELS.luna;
|
|
466
|
+
const MAX_ALIAS_IDS = /* @__PURE__ */ new Set([MAX_LUNA_HIGH_ALIAS_ID, MAX_LUNA_MAX_ALIAS_ID]);
|
|
467
|
+
function isMaxModelAlias(id) {
|
|
468
|
+
return MAX_ALIAS_IDS.has(stripTrailingOneMSuffix(id).base);
|
|
469
|
+
}
|
|
470
|
+
function maxAliasEffort(id) {
|
|
471
|
+
const base = stripTrailingOneMSuffix(id).base;
|
|
472
|
+
if (base === "gh-router-max-luna-high") return "high";
|
|
473
|
+
if (base === "gh-router-max-luna-max") return "max";
|
|
474
|
+
}
|
|
475
|
+
function maxAliasModel(id) {
|
|
476
|
+
return isMaxModelAlias(id) ? LUNA_REAL_MODEL_ID : void 0;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* The full alias table, keyed by `aliasId`. A simpler model-id-only table is
|
|
480
|
+
* rejected by design: the driver, the Sonnet tier, and the Haiku tier all
|
|
481
|
+
* resolve to the SAME Luna catalog id, while the fast critic alias resolves
|
|
482
|
+
* to Gemini. After early canonicalization a table keyed on the real id could
|
|
483
|
+
* no longer tell which absent-effort default applies. Alias provenance is the
|
|
484
|
+
* minimum discriminator that survives from tier selection through to request
|
|
485
|
+
* preprocessing, which is why canonicalization must happen LAST (in the
|
|
486
|
+
* `/v1/messages` identity preflight), after the effort default has already
|
|
487
|
+
* been read off the alias.
|
|
488
|
+
*/
|
|
489
|
+
const RETIRED_FAST_ALIAS_IDS = /* @__PURE__ */ new Set([LUNA_IMPLEMENTER_ALIAS_ID, FAST_CRITIC_ALIAS_ID]);
|
|
490
|
+
const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
|
|
491
|
+
[LUNA_DRIVER_ALIAS_ID, {
|
|
492
|
+
aliasId: LUNA_DRIVER_ALIAS_ID,
|
|
493
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
494
|
+
absentEffortDefault: "max"
|
|
495
|
+
}],
|
|
496
|
+
[MAX_LUNA_HIGH_ALIAS_ID, {
|
|
497
|
+
aliasId: MAX_LUNA_HIGH_ALIAS_ID,
|
|
498
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
499
|
+
absentEffortDefault: "high"
|
|
500
|
+
}],
|
|
501
|
+
[MAX_LUNA_MAX_ALIAS_ID, {
|
|
502
|
+
aliasId: MAX_LUNA_MAX_ALIAS_ID,
|
|
503
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
504
|
+
absentEffortDefault: "max"
|
|
505
|
+
}],
|
|
506
|
+
[LUNA_SCOUT_ALIAS_ID, {
|
|
507
|
+
aliasId: LUNA_SCOUT_ALIAS_ID,
|
|
508
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
509
|
+
absentEffortDefault: "high"
|
|
510
|
+
}],
|
|
511
|
+
[LUNA_SONNET_ALIAS_ID, {
|
|
512
|
+
aliasId: LUNA_SONNET_ALIAS_ID,
|
|
513
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
514
|
+
absentEffortDefault: "xhigh"
|
|
515
|
+
}],
|
|
516
|
+
[LUNA_HAIKU_ALIAS_ID, {
|
|
517
|
+
aliasId: LUNA_HAIKU_ALIAS_ID,
|
|
518
|
+
realModel: LUNA_REAL_MODEL_ID,
|
|
519
|
+
absentEffortDefault: "high"
|
|
520
|
+
}]
|
|
521
|
+
]);
|
|
522
|
+
/**
|
|
523
|
+
* Look up the alias descriptor for a wire-facing model id (with or without
|
|
524
|
+
* a trailing `[1m]` bracket — the bracket is stripped before the table
|
|
525
|
+
* lookup and is orthogonal to alias identity). Returns undefined for any
|
|
526
|
+
* id that isn't one of the registered aliases (including bare `claude-*`
|
|
527
|
+
* ids and every other real Copilot catalog id).
|
|
528
|
+
*/
|
|
529
|
+
function resolveModelAlias(id) {
|
|
530
|
+
const { base } = stripTrailingOneMSuffix(id);
|
|
531
|
+
return MODEL_ALIAS_TABLE.get(base);
|
|
532
|
+
}
|
|
533
|
+
function isRetiredFastModelAlias(id) {
|
|
534
|
+
return RETIRED_FAST_ALIAS_IDS.has(stripTrailingOneMSuffix(id).base);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Strip alias provenance and return the real catalog id to send upstream.
|
|
538
|
+
* Idempotent passthrough for any id that isn't a registered alias (a bare
|
|
539
|
+
* `claude-*` slug, an already-real Copilot id, or anything else) — this is
|
|
540
|
+
* safe to call unconditionally on every `body.model` at the outbound
|
|
541
|
+
* boundary. Preserves a trailing `[1m]` bracket: canonicalization only
|
|
542
|
+
* erases ALIAS identity, not the 1M-context accounting decoration.
|
|
543
|
+
*/
|
|
544
|
+
function canonicalizeAliasModel(id) {
|
|
545
|
+
const { base, hadSuffix } = stripTrailingOneMSuffix(id);
|
|
546
|
+
const alias = MODEL_ALIAS_TABLE.get(base);
|
|
547
|
+
if (!alias) return normalizeTrailingOneMSuffix(id);
|
|
548
|
+
return hadSuffix ? `${alias.realModel}[1m]` : alias.realModel;
|
|
549
|
+
}
|
|
550
|
+
const FAST_REQUIRED_CONTEXT_TOKENS = 1e6;
|
|
551
|
+
function findModel(catalog, id) {
|
|
552
|
+
return catalog?.data?.find((m) => m.id === id);
|
|
553
|
+
}
|
|
554
|
+
function hasToolCalls(model) {
|
|
555
|
+
return model?.capabilities?.supports?.tool_calls === true;
|
|
556
|
+
}
|
|
557
|
+
function hasContextAtLeast(model, tokens) {
|
|
558
|
+
return (model?.capabilities?.limits?.max_context_window_tokens ?? 0) >= tokens;
|
|
559
|
+
}
|
|
560
|
+
function supportsEffort(model, effort) {
|
|
561
|
+
const list = model?.capabilities?.supports?.reasoning_effort;
|
|
562
|
+
return Array.isArray(list) && list.includes(effort);
|
|
563
|
+
}
|
|
564
|
+
function supportsEndpoint(model, endpoint) {
|
|
565
|
+
return model !== void 0 && fastEndpointForModel(model) === endpoint;
|
|
566
|
+
}
|
|
567
|
+
function hasUsablePromptMetadata(model) {
|
|
568
|
+
const prompt = model?.capabilities?.limits?.max_prompt_tokens;
|
|
569
|
+
return typeof prompt === "number" && Number.isFinite(prompt) && prompt > 0;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Validate the live Copilot catalog carries every model the fast profile's
|
|
573
|
+
* EXACT roster depends on, with the specific capabilities each assignment
|
|
574
|
+
* needs. These are capability-availability PREREQUISITES for constructing
|
|
575
|
+
* the roster — not an allowlist of models the user may select later in the
|
|
576
|
+
* session — so a partial catalog fails the whole `-m fast` launch rather
|
|
577
|
+
* than silently substituting or dropping an agent.
|
|
578
|
+
*
|
|
579
|
+
* Checks, per the fast-launch-profile design:
|
|
580
|
+
* - Luna lead/Explore/general-purpose: tool calls, >=1M, high+max, Responses.
|
|
581
|
+
* - Sol Plan: tool calls, >=1M, high, Responses.
|
|
582
|
+
* - Grok reviewer: tool calls, medium, Responses, usable prompt metadata.
|
|
583
|
+
* - Gemini implementer/Advisor: tool calls, >=1M, high, chat-completions.
|
|
584
|
+
* - Opus Oracle: exact Opus 5, >=1M, adaptive/high, Messages, prompt metadata.
|
|
585
|
+
*
|
|
586
|
+
* Pure over the passed-in catalog snapshot so it's unit-testable without
|
|
587
|
+
* `state` — callers pass `state.models` at call time.
|
|
588
|
+
*/
|
|
589
|
+
function validateFastProfilePrerequisites(catalog) {
|
|
590
|
+
const missing = [];
|
|
591
|
+
const luna = findModel(catalog, LUNA_REAL_MODEL_ID);
|
|
592
|
+
if (!luna) missing.push(`${LUNA_REAL_MODEL_ID}: absent from the live catalog`);
|
|
593
|
+
else {
|
|
594
|
+
if (!hasToolCalls(luna)) missing.push(`${LUNA_REAL_MODEL_ID}: does not advertise tool_calls`);
|
|
595
|
+
if (!hasContextAtLeast(luna, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${LUNA_REAL_MODEL_ID}: advertised context window is below 1M`);
|
|
596
|
+
if (!supportsEffort(luna, "high") || !supportsEffort(luna, "max")) missing.push(`${LUNA_REAL_MODEL_ID}: does not advertise both "high" and "max" reasoning effort`);
|
|
597
|
+
if (!supportsEndpoint(luna, "responses")) missing.push(`${LUNA_REAL_MODEL_ID}: does not advertise a supported Responses endpoint`);
|
|
598
|
+
}
|
|
599
|
+
const sol = findModel(catalog, FAST_PROFILE_MODELS.plan);
|
|
600
|
+
if (!sol) missing.push(`${FAST_PROFILE_MODELS.plan}: absent from the live catalog`);
|
|
601
|
+
else {
|
|
602
|
+
if (!hasToolCalls(sol)) missing.push(`${FAST_PROFILE_MODELS.plan}: does not advertise tool_calls`);
|
|
603
|
+
if (!hasContextAtLeast(sol, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.plan}: advertised context window is below 1M`);
|
|
604
|
+
if (!supportsEffort(sol, "high")) missing.push(`${FAST_PROFILE_MODELS.plan}: does not advertise a "high" reasoning effort`);
|
|
605
|
+
if (!supportsEndpoint(sol, "responses")) missing.push(`${FAST_PROFILE_MODELS.plan}: does not advertise a supported Responses endpoint`);
|
|
606
|
+
}
|
|
607
|
+
const sonnet = findModel(catalog, FAST_PROFILE_MODELS.reviewer);
|
|
608
|
+
if (!sonnet) missing.push(`${FAST_PROFILE_MODELS.reviewer}: absent from the live catalog`);
|
|
609
|
+
else {
|
|
610
|
+
if (!hasToolCalls(sonnet)) missing.push(`${FAST_PROFILE_MODELS.reviewer}: does not advertise tool_calls`);
|
|
611
|
+
if (!hasContextAtLeast(sonnet, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.reviewer}: advertised context window is below 1M`);
|
|
612
|
+
if (!supportsEffort(sonnet, "xhigh")) missing.push(`${FAST_PROFILE_MODELS.reviewer}: does not advertise an "xhigh" reasoning effort`);
|
|
613
|
+
if (sonnet.capabilities?.supports?.adaptive_thinking !== true) missing.push(`${FAST_PROFILE_MODELS.reviewer}: does not advertise adaptive_thinking`);
|
|
614
|
+
if (!hasUsablePromptMetadata(sonnet)) missing.push(`${FAST_PROFILE_MODELS.reviewer}: no usable max_prompt_tokens metadata`);
|
|
615
|
+
if (!supportsEndpoint(sonnet, "messages")) missing.push(`${FAST_PROFILE_MODELS.reviewer}: does not advertise a supported Messages endpoint`);
|
|
616
|
+
}
|
|
617
|
+
const gemini = findModel(catalog, FAST_PROFILE_MODELS.implementer);
|
|
618
|
+
if (!gemini) missing.push(`${FAST_PROFILE_MODELS.implementer}: absent from the live catalog`);
|
|
619
|
+
else {
|
|
620
|
+
if (!hasToolCalls(gemini)) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise tool_calls`);
|
|
621
|
+
if (!hasContextAtLeast(gemini, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.implementer}: advertised context window is below 1M`);
|
|
622
|
+
if (!supportsEffort(gemini, "high")) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise a "high" reasoning effort`);
|
|
623
|
+
if (!supportsEndpoint(gemini, "chat")) missing.push(`${FAST_PROFILE_MODELS.implementer}: does not advertise a supported chat-completions endpoint`);
|
|
624
|
+
}
|
|
625
|
+
const opus = findModel(catalog, FAST_PROFILE_MODELS.oracle);
|
|
626
|
+
if (!opus) missing.push(`${FAST_PROFILE_MODELS.oracle}: absent from the live catalog`);
|
|
627
|
+
else {
|
|
628
|
+
if (!hasContextAtLeast(opus, FAST_REQUIRED_CONTEXT_TOKENS)) missing.push(`${FAST_PROFILE_MODELS.oracle}: advertised context window is below 1M`);
|
|
629
|
+
if (!supportsEffort(opus, "high")) missing.push(`${FAST_PROFILE_MODELS.oracle}: does not advertise a "high" reasoning effort`);
|
|
630
|
+
if (opus.capabilities?.supports?.adaptive_thinking !== true) missing.push(`${FAST_PROFILE_MODELS.oracle}: does not advertise adaptive_thinking`);
|
|
631
|
+
if (!hasUsablePromptMetadata(opus)) missing.push(`${FAST_PROFILE_MODELS.oracle}: no usable max_prompt_tokens metadata`);
|
|
632
|
+
if (!supportsEndpoint(opus, "messages")) missing.push(`${FAST_PROFILE_MODELS.oracle}: does not advertise a supported Messages endpoint`);
|
|
633
|
+
}
|
|
634
|
+
return {
|
|
635
|
+
ok: missing.length === 0,
|
|
636
|
+
missing
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Format `validateFastProfilePrerequisites`'s failure list into the launch
|
|
641
|
+
* error message: every missing/invalid model, plus the rollback command.
|
|
642
|
+
*/
|
|
643
|
+
function formatFastPrerequisiteFailure(missing) {
|
|
644
|
+
return "github-router claude -m fast 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 fast profile's exact roster. Run plain `github-router claude` instead.";
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
358
647
|
//#region src/lib/file-log-reporter.ts
|
|
359
648
|
const MAX_LOG_BYTES = 1048576;
|
|
360
649
|
const DEDUP_MAX = 1e3;
|
|
@@ -1649,7 +1938,7 @@ function collectToolFieldKeys(body) {
|
|
|
1649
1938
|
//#endregion
|
|
1650
1939
|
//#region package.json
|
|
1651
1940
|
var name = "github-router";
|
|
1652
|
-
var version = "0.3.
|
|
1941
|
+
var version = "0.3.308";
|
|
1653
1942
|
//#endregion
|
|
1654
1943
|
//#region src/lib/approval.ts
|
|
1655
1944
|
const awaitApproval = async () => {
|
|
@@ -4574,14 +4863,14 @@ function preprocessMaxRequest(rawBody, launch, subagentRequest = false) {
|
|
|
4574
4863
|
modified: true
|
|
4575
4864
|
};
|
|
4576
4865
|
}
|
|
4577
|
-
const allowedSubagentModel = subagentRequest && (base === "grok-4.6" || base === "gpt-5.6-luna");
|
|
4866
|
+
const allowedSubagentModel = subagentRequest && (base === "grok-4.6" || base === "gpt-5.6-luna" || base === "claude-sonnet-5");
|
|
4578
4867
|
if (!allowedModel(base) && !allowedSubagentModel) return {
|
|
4579
4868
|
body: rawBody,
|
|
4580
4869
|
originalModel,
|
|
4581
4870
|
modified: false,
|
|
4582
4871
|
rejectedModel: originalModel
|
|
4583
4872
|
};
|
|
4584
|
-
const effort = allowedSubagentModel ? base === "gpt-5.6-luna" ? "max" : "high" : MAX_MODEL_EFFORTS[base];
|
|
4873
|
+
const effort = allowedSubagentModel ? base === "claude-sonnet-5" ? "xhigh" : base === "gpt-5.6-luna" ? "max" : "high" : MAX_MODEL_EFFORTS[base];
|
|
4585
4874
|
if (!effort) return {
|
|
4586
4875
|
body: rawBody,
|
|
4587
4876
|
originalModel,
|
|
@@ -4649,6 +4938,7 @@ function preprocessFastRequest(rawBody, launch, subagentRequest = false) {
|
|
|
4649
4938
|
else if (bare === "gpt-5.6-sol") effort = "high";
|
|
4650
4939
|
else if (bare === "grok-4.6") effort = "medium";
|
|
4651
4940
|
else if (bare === "gemini-3.8-flash") effort = "high";
|
|
4941
|
+
else if (bare === "claude-sonnet-5") effort = "xhigh";
|
|
4652
4942
|
else if (bare === "claude-opus-5") effort = "high";
|
|
4653
4943
|
if (!effort && !alias) return {
|
|
4654
4944
|
body: rawBody,
|
|
@@ -6887,6 +7177,6 @@ function getCodexEnvVars(serverUrl) {
|
|
|
6887
7177
|
return vars;
|
|
6888
7178
|
}
|
|
6889
7179
|
//#endregion
|
|
6890
|
-
export { sharedServerArgs as a, stopKeepAwake as c, enableFileLogging as d,
|
|
7180
|
+
export { validateMaxProfileLaunch as _, sharedServerArgs as a, updateClaude as b, stopKeepAwake as c, enableFileLogging as d, LUNA_SCOUT_ALIAS_ID as f, validateFastProfilePrerequisites as g, resolveLaunchProfile as h, setupAndServe as i, injectModelPickerSettingsFile as l, profileDescriptor as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, formatFastPrerequisiteFailure as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, runSelfUpdate as v, checkClaudeVersion as y };
|
|
6891
7181
|
|
|
6892
|
-
//# sourceMappingURL=server-setup-
|
|
7182
|
+
//# sourceMappingURL=server-setup-C7jSESEI.js.map
|