github-router 0.3.295 → 0.3.302
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-pkIop1NU.js → attribution-settings-B1xutIts.js} +153 -16
- package/dist/attribution-settings-B1xutIts.js.map +1 -0
- package/dist/{auth-CluG5e-l.js → auth-CpjOjoUG.js} +4 -3
- package/dist/{auth-CluG5e-l.js.map → auth-CpjOjoUG.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-iOzfnKJe.js → check-usage-BsN3S4Fu.js} +4 -4
- package/dist/{check-usage-iOzfnKJe.js.map → check-usage-BsN3S4Fu.js.map} +1 -1
- package/dist/{claude-DNmxk-Rm.js → claude-uRuzEH0W.js} +216 -112
- package/dist/claude-uRuzEH0W.js.map +1 -0
- package/dist/{codex-Dl4gpHn-.js → codex-D5ag-liR.js} +6 -5
- package/dist/{codex-Dl4gpHn-.js.map → codex-D5ag-liR.js.map} +1 -1
- package/dist/{debug-DsEwleGg.js → debug-BXRPyeqO.js} +2 -2
- package/dist/{debug-DsEwleGg.js.map → debug-BXRPyeqO.js.map} +1 -1
- package/dist/engine-2uMJ4Isk.js +2 -0
- package/dist/fast-profile-contract-K3P58nj3.js +57 -0
- package/dist/fast-profile-contract-K3P58nj3.js.map +1 -0
- package/dist/{gate-discovery-WcduofL4.js → gate-discovery-BTRVyKWu.js} +5 -5
- package/dist/{gate-discovery-WcduofL4.js.map → gate-discovery-BTRVyKWu.js.map} +1 -1
- package/dist/{get-copilot-usage-B7Z4XVWj.js → get-copilot-usage-ByjQqhdi.js} +3 -2
- package/dist/{get-copilot-usage-B7Z4XVWj.js.map → get-copilot-usage-ByjQqhdi.js.map} +1 -1
- package/dist/hooks.mjs +351 -21
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-artifact-open-D6tKMg8v.js → internal-artifact-open-DRSxShAW.js} +2 -2
- package/dist/{internal-artifact-open-D6tKMg8v.js.map → internal-artifact-open-DRSxShAW.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-CPlCrTlU.js → internal-fast-dispatch-guard-CYOWbxjX.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-Xyu17k9X.js → internal-fast-dispatch-guard-D2HcfXZv.js} +22 -18
- package/dist/internal-fast-dispatch-guard-D2HcfXZv.js.map +1 -0
- package/dist/{internal-first-mate-guard-C9BV7J4U.js → internal-first-mate-guard-Bcb5JwiO.js} +3 -3
- package/dist/{internal-first-mate-guard-C9BV7J4U.js.map → internal-first-mate-guard-Bcb5JwiO.js.map} +1 -1
- package/dist/{internal-first-mate-guard-WJApyc8j.js → internal-first-mate-guard-Brh_uois.js} +1 -1
- package/dist/internal-max-dispatch-guard-Bcjavapx.js +2 -0
- package/dist/internal-max-dispatch-guard-BjSVXMvC.js +198 -0
- package/dist/internal-max-dispatch-guard-BjSVXMvC.js.map +1 -0
- package/dist/{internal-plan-review-t3PuNfuL.js → internal-plan-review-DVY-iV2x.js} +3 -3
- package/dist/{internal-plan-review-t3PuNfuL.js.map → internal-plan-review-DVY-iV2x.js.map} +1 -1
- package/dist/{internal-prompt-submit-C3KovHQG.js → internal-prompt-submit-BTqRn4FW.js} +4 -4
- package/dist/{internal-prompt-submit-C3KovHQG.js.map → internal-prompt-submit-BTqRn4FW.js.map} +1 -1
- package/dist/{internal-session-bind-d2uoja8I.js → internal-session-bind-YfH656lt.js} +2 -2
- package/dist/{internal-session-bind-d2uoja8I.js.map → internal-session-bind-YfH656lt.js.map} +1 -1
- package/dist/{internal-stop-hook-DJFtGCsE.js → internal-stop-hook-BZg__ab6.js} +5 -5
- package/dist/{internal-stop-hook-DJFtGCsE.js.map → internal-stop-hook-BZg__ab6.js.map} +1 -1
- package/dist/{internal-stop-review-YtDUGXpX.js → internal-stop-review-B8MmEyQ1.js} +2 -2
- package/dist/{internal-stop-review-YtDUGXpX.js.map → internal-stop-review-B8MmEyQ1.js.map} +1 -1
- package/dist/{internal-worker-guard-CdkeS9PN.js → internal-worker-guard-Dr6W83TC.js} +2 -2
- package/dist/{internal-worker-guard-CdkeS9PN.js.map → internal-worker-guard-Dr6W83TC.js.map} +1 -1
- package/dist/{internal-workspace-header-tuBXJV22.js → internal-workspace-header-Cep0WSIb.js} +2 -2
- package/dist/{internal-workspace-header-tuBXJV22.js.map → internal-workspace-header-Cep0WSIb.js.map} +1 -1
- package/dist/lifecycle-4TZrJuAa.js +2 -0
- package/dist/{lifecycle-CM9eTzvk.js → lifecycle-CmPJ6e_6.js} +2 -2
- package/dist/{lifecycle-CM9eTzvk.js.map → lifecycle-CmPJ6e_6.js.map} +1 -1
- package/dist/{lifecycle-Bg6doY3-.js → lifecycle-DgsJ_8Am.js} +2 -2
- package/dist/{lifecycle-Bg6doY3-.js.map → lifecycle-DgsJ_8Am.js.map} +1 -1
- package/dist/lifecycle-O91Vzzb-.js +2 -0
- package/dist/main.js +19 -18
- package/dist/main.js.map +1 -1
- package/dist/max-profile-contract-BTXowh6k.js +264 -0
- package/dist/max-profile-contract-BTXowh6k.js.map +1 -0
- package/dist/{mcp-workspace-header-dERl2YTT.js → mcp-workspace-header-NzFD0Wgd.js} +2 -2
- package/dist/{mcp-workspace-header-dERl2YTT.js.map → mcp-workspace-header-NzFD0Wgd.js.map} +1 -1
- package/dist/{models-DZ4hYsR7.js → models-1KwEUgzd.js} +3 -3
- package/dist/{models-DZ4hYsR7.js.map → models-1KwEUgzd.js.map} +1 -1
- package/dist/{orchestration-BiGCEwbH.js → orchestration-CYyp9w-t.js} +2 -2
- package/dist/{orchestration-BiGCEwbH.js.map → orchestration-CYyp9w-t.js.map} +1 -1
- package/dist/paths-DDAiPVto.js +2 -0
- package/dist/{paths-Ci485qSJ.js → paths-IcZW8gZx.js} +4 -4
- package/dist/{paths-Ci485qSJ.js.map → paths-IcZW8gZx.js.map} +1 -1
- package/dist/{peer-mcp-personas-BwNtC8jt.js → peer-mcp-personas-DwEiYeJS.js} +498 -260
- package/dist/peer-mcp-personas-DwEiYeJS.js.map +1 -0
- package/dist/{plan-review-hook-DuW0pSoM.js → plan-review-hook-szSNt6uU.js} +3 -3
- package/dist/{plan-review-hook-DuW0pSoM.js.map → plan-review-hook-szSNt6uU.js.map} +1 -1
- package/dist/{prompt-submit-hook-IMl7ssfr.js → prompt-submit-hook-ZUxo_jEl.js} +3 -3
- package/dist/{prompt-submit-hook-IMl7ssfr.js.map → prompt-submit-hook-ZUxo_jEl.js.map} +1 -1
- package/dist/{provision-DeNqzvSM.js → provision-BLT1pCFy.js} +4 -4
- package/dist/{provision-DeNqzvSM.js.map → provision-BLT1pCFy.js.map} +1 -1
- package/dist/{self-invocation-DAB_od0C.js → self-invocation-BJWbA8ka.js} +2 -2
- package/dist/{self-invocation-DAB_od0C.js.map → self-invocation-BJWbA8ka.js.map} +1 -1
- package/dist/{serve-BS5EmCpM.js → serve-wEZoOijw.js} +13 -12
- package/dist/{serve-BS5EmCpM.js.map → serve-wEZoOijw.js.map} +1 -1
- package/dist/{server-setup-DsGJnJ_O.js → server-setup-Zn5wkosb.js} +268 -41
- package/dist/server-setup-Zn5wkosb.js.map +1 -0
- package/dist/{start-vJdt2MiM.js → start-DSqU8d8h.js} +3 -3
- package/dist/{start-vJdt2MiM.js.map → start-DSqU8d8h.js.map} +1 -1
- package/dist/state-B8adscCv.js +51 -0
- package/dist/state-B8adscCv.js.map +1 -0
- package/dist/{stop-gate-hook-DQnh_KfI.js → stop-gate-hook-CJOk28zd.js} +3 -3
- package/dist/{stop-gate-hook-DQnh_KfI.js.map → stop-gate-hook-CJOk28zd.js.map} +1 -1
- package/dist/{stop-gate-policy-DMr3KVmw.js → stop-gate-policy-zhzRIj6G.js} +2 -2
- package/dist/{stop-gate-policy-DMr3KVmw.js.map → stop-gate-policy-zhzRIj6G.js.map} +1 -1
- package/dist/{token-BtJhjXXu.js → token-CbuFyx-B.js} +4 -50
- package/dist/token-CbuFyx-B.js.map +1 -0
- package/dist/{worker-dispatch-BEHkTbnH.js → worker-dispatch-DgP5yT26.js} +2 -2
- package/dist/{worker-dispatch-BEHkTbnH.js.map → worker-dispatch-DgP5yT26.js.map} +1 -1
- package/package.json +1 -1
- package/dist/attribution-settings-pkIop1NU.js.map +0 -1
- package/dist/claude-DNmxk-Rm.js.map +0 -1
- package/dist/engine-XnluJUs6.js +0 -2
- package/dist/internal-fast-dispatch-guard-Xyu17k9X.js.map +0 -1
- package/dist/lifecycle-CGLt1cJQ.js +0 -2
- package/dist/lifecycle-DoUwpVDB.js +0 -2
- package/dist/paths-GD7bgGGy.js +0 -2
- package/dist/peer-mcp-personas-BwNtC8jt.js.map +0 -1
- package/dist/server-setup-DsGJnJ_O.js.map +0 -1
- package/dist/token-BtJhjXXu.js.map +0 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as UNKNOWN_EFFORT_ANCHOR, $t as countTokens, An as BUDGET_SMALL_FAST_SLUG, B as resolveAdvisorEffort, Bt as MAX_LUNA_HIGH_ALIAS_ID, Cn as provisionTreeSitterAssets, D as toolbeltEnabled, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as UPSTREAM_FETCH_TIMEOUT_MS, Ft as LUNA_HAIKU_ALIAS_ID, G as repairRejectedThinkingHistory, Gn as oneMContextDisabled, Gt as maxAliasEffort, H as formatThinkingRepairDecline, Hn as upstreamMaxConnections, Ht as canonicalizeAliasModel, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, In as UPSTREAM_INACTIVITY_TIMEOUT_MS, J as isControllerClosedError, Jn as withInstallLock, K as buildAnthropicErrorEvent, Kn as withOneMSuffix, Kt as maxAliasModel, L as buildAdvisorStream, Ln as generateRandomPort, Lt as LUNA_REAL_MODEL_ID, N as searchWeb, On as toolbeltPathOverride, P as ADVISOR_INTERNAL_TOOL_NAME, Pt as LUNA_DRIVER_ALIAS_ID, Q as EFFORT_ORDER, Qt as shimDefaultsToXhigh, R as injectAdvisorTool, Rn as isBudgetClaudeLead, U as rememberThinkingHistoryRepair, Un as classifyMessagesRoute, V as resolveAdvisorModel, Vn as upstreamAllowH2, Vt as MAX_LUNA_MAX_ALIAS_ID, W as repairKnownThinkingHistory, Wn as catalogAdvertises1M, Wt as isMaxModelAlias, X as readIteratorWithTimeout, Y as logStreamError, Yt as resolveModelAlias, Z as relayAnthropicStream, cn as warnOnTokenPriceDrift, dn as createChatCompletions, en as createMessages, et as bucketEffort, fn as MAX_RESPONSE_BODY_BYTES, hn as normalizeOpenAIUsage, i as assertMcpToolSurfaceConsistent, in as findLaunchBySecret, ln as resolveMcpToolTimeoutMs, lt as agentToolsEnabled, mn as parseJsonOrDiagnose, nn as getTokenCount, nt as handleMcpDelete, pn as readResponseBodyCapped, q as buildOpenAIErrorEvent, qn as withOneMSuffixForLead, rn as getTokenizerFromModel, rt as handleMcpPost, sn as assembleResponsesPayload, tn as getTextTokenCount, tt as clampEffort, un as createResponses, z as isAdvisorRequested, zt as LUNA_SONNET_ALIAS_ID } from "./peer-mcp-personas-DwEiYeJS.js";
|
|
2
2
|
import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
|
|
3
|
-
import { i as ensurePaths, t as PATHS } from "./paths-
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
3
|
+
import { i as ensurePaths, t as PATHS } from "./paths-IcZW8gZx.js";
|
|
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-CbuFyx-B.js";
|
|
6
|
+
import { t as getCopilotUsage } from "./get-copilot-usage-ByjQqhdi.js";
|
|
6
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-K3P58nj3.js";
|
|
9
|
+
import { b as stripTrailingOneMSuffix, d as maxAdvisorPinIsValid, i as MAX_PROFILE_MODELS, l as maxAdvisorEffortForModel, m as maxOpusModel, n as MAX_PROFILE_ALLOWED_LEAD_MODEL_IDS, t as MAX_PROFILE_ADVISOR_INSTRUCTIONS, u as maxAdvisorModelFromPin } from "./max-profile-contract-BTXowh6k.js";
|
|
7
10
|
import consola from "consola";
|
|
8
11
|
import * as fs$2 from "node:fs";
|
|
9
12
|
import fs, { existsSync } from "node:fs";
|
|
@@ -1089,7 +1092,7 @@ const CLIENT_OUTPUT_RESERVE_TOKENS = 2e4;
|
|
|
1089
1092
|
/**
|
|
1090
1093
|
* The client's additional flat reserve between the output-reduced window and
|
|
1091
1094
|
* its reactive compaction threshold. Read from the installed Claude Code
|
|
1092
|
-
* 2.1.
|
|
1095
|
+
* 2.1.251 bundle: `E9(e,t)` computes `r = e - 13000` and returns it when no
|
|
1093
1096
|
* percentage override is set, where `e` is already
|
|
1094
1097
|
* `window - min(maxOutput, 20_000)`.
|
|
1095
1098
|
*/
|
|
@@ -1098,7 +1101,9 @@ const CLIENT_THRESHOLD_RESERVE_TOKENS = 13e3;
|
|
|
1098
1101
|
* Bounds the `CLAUDE_CODE_AUTO_COMPACT_WINDOW` env path applies to whatever it
|
|
1099
1102
|
* parses: `IWe = 1e5` floor, `ZRt = 1e6` cap. A value below the floor is
|
|
1100
1103
|
* silently RAISED to it, so deriving something smaller would be a lie; a value
|
|
1101
|
-
* above the cap is clamped.
|
|
1104
|
+
* above the cap is clamped. In the 2.1.251 bundle, `ike = 1e5` and
|
|
1105
|
+
* `JNe = 1e6` are passed to the shared env parser and the result is floored
|
|
1106
|
+
* again with `Math.max(ike, ...)` before use.
|
|
1102
1107
|
*/
|
|
1103
1108
|
const ENV_WINDOW_MIN_TOKENS = 1e5;
|
|
1104
1109
|
const ENV_WINDOW_MAX_TOKENS = 1e6;
|
|
@@ -1497,7 +1502,7 @@ function collectToolFieldKeys(body) {
|
|
|
1497
1502
|
//#endregion
|
|
1498
1503
|
//#region package.json
|
|
1499
1504
|
var name = "github-router";
|
|
1500
|
-
var version = "0.3.
|
|
1505
|
+
var version = "0.3.302";
|
|
1501
1506
|
//#endregion
|
|
1502
1507
|
//#region src/lib/approval.ts
|
|
1503
1508
|
const awaitApproval = async () => {
|
|
@@ -4359,13 +4364,103 @@ function identityPreflightErrorResponse(c, reason, path = "/v1/messages") {
|
|
|
4359
4364
|
}, 403);
|
|
4360
4365
|
}
|
|
4361
4366
|
//#endregion
|
|
4367
|
+
//#region src/lib/max-request-preprocess.ts
|
|
4368
|
+
function maxRequestError(result) {
|
|
4369
|
+
if (result.rejectedAlias) return `Router-owned model alias ${JSON.stringify(result.rejectedAlias)} is valid only for an authenticated -m max launch.`;
|
|
4370
|
+
if (result.rejectedModel) return `Model ${JSON.stringify(result.rejectedModel)} is outside the fixed -m max model set (Sol, Luna, Gemini 3.7 Flash, or Opus 5).`;
|
|
4371
|
+
}
|
|
4372
|
+
const MAX_MODEL_EFFORTS = Object.freeze({
|
|
4373
|
+
"gpt-5.6-sol": "high",
|
|
4374
|
+
"gpt-5.6-luna": "high",
|
|
4375
|
+
"gemini-3.7-flash": "high",
|
|
4376
|
+
"claude-opus-5": "high"
|
|
4377
|
+
});
|
|
4378
|
+
function allowedModel(base) {
|
|
4379
|
+
return MAX_PROFILE_ALLOWED_LEAD_MODEL_IDS.includes(base);
|
|
4380
|
+
}
|
|
4381
|
+
function setEffort(body, effort) {
|
|
4382
|
+
const outputConfig = body.output_config && typeof body.output_config === "object" ? body.output_config : {};
|
|
4383
|
+
if (outputConfig.effort === void 0) body.output_config = {
|
|
4384
|
+
...outputConfig,
|
|
4385
|
+
effort
|
|
4386
|
+
};
|
|
4387
|
+
}
|
|
4388
|
+
/**
|
|
4389
|
+
* Apply the bound max profile's lead-model projection. Max is intentionally
|
|
4390
|
+
* separate from the fast preprocessor: fast aliases and fixed fast role rules
|
|
4391
|
+
* must not become active for max, while arbitrary old/unknown model selections
|
|
4392
|
+
* must fail closed rather than silently escape the max surface.
|
|
4393
|
+
*/
|
|
4394
|
+
function preprocessMaxRequest(rawBody, launch, subagentRequest = false) {
|
|
4395
|
+
let parsed;
|
|
4396
|
+
try {
|
|
4397
|
+
parsed = JSON.parse(rawBody);
|
|
4398
|
+
} catch {
|
|
4399
|
+
return {
|
|
4400
|
+
body: rawBody,
|
|
4401
|
+
modified: false
|
|
4402
|
+
};
|
|
4403
|
+
}
|
|
4404
|
+
const originalModel = typeof parsed.model === "string" ? parsed.model : void 0;
|
|
4405
|
+
if (!originalModel) return {
|
|
4406
|
+
body: rawBody,
|
|
4407
|
+
modified: false
|
|
4408
|
+
};
|
|
4409
|
+
if (launch?.profileId !== "max") return {
|
|
4410
|
+
body: rawBody,
|
|
4411
|
+
originalModel,
|
|
4412
|
+
modified: false
|
|
4413
|
+
};
|
|
4414
|
+
const { base, hadSuffix } = stripTrailingOneMSuffix(originalModel);
|
|
4415
|
+
const aliasEffort = maxAliasEffort(originalModel);
|
|
4416
|
+
const canonical = maxAliasModel(originalModel);
|
|
4417
|
+
if (canonical) {
|
|
4418
|
+
const effort = aliasEffort ?? "high";
|
|
4419
|
+
parsed.model = hadSuffix ? `${canonical}[1m]` : canonical;
|
|
4420
|
+
setEffort(parsed, effort);
|
|
4421
|
+
if (parsed.thinking && typeof parsed.thinking === "object") {
|
|
4422
|
+
if (parsed.thinking.type === "enabled") parsed.thinking = { type: "adaptive" };
|
|
4423
|
+
}
|
|
4424
|
+
return {
|
|
4425
|
+
body: JSON.stringify(parsed),
|
|
4426
|
+
originalModel,
|
|
4427
|
+
modified: true
|
|
4428
|
+
};
|
|
4429
|
+
}
|
|
4430
|
+
const allowedSubagentModel = subagentRequest && base === "grok-4.6";
|
|
4431
|
+
if (!allowedModel(base) && !allowedSubagentModel) return {
|
|
4432
|
+
body: rawBody,
|
|
4433
|
+
originalModel,
|
|
4434
|
+
modified: false,
|
|
4435
|
+
rejectedModel: originalModel
|
|
4436
|
+
};
|
|
4437
|
+
const effort = allowedSubagentModel ? "medium" : MAX_MODEL_EFFORTS[base];
|
|
4438
|
+
if (!effort) return {
|
|
4439
|
+
body: rawBody,
|
|
4440
|
+
originalModel,
|
|
4441
|
+
modified: false,
|
|
4442
|
+
rejectedModel: originalModel
|
|
4443
|
+
};
|
|
4444
|
+
setEffort(parsed, effort);
|
|
4445
|
+
if (parsed.thinking && typeof parsed.thinking === "object") {
|
|
4446
|
+
if (parsed.thinking.type === "enabled") parsed.thinking = { type: "adaptive" };
|
|
4447
|
+
}
|
|
4448
|
+
return {
|
|
4449
|
+
body: JSON.stringify(parsed),
|
|
4450
|
+
originalModel,
|
|
4451
|
+
modified: true
|
|
4452
|
+
};
|
|
4453
|
+
}
|
|
4454
|
+
Object.freeze([MAX_LUNA_HIGH_ALIAS_ID, MAX_LUNA_MAX_ALIAS_ID]);
|
|
4455
|
+
//#endregion
|
|
4362
4456
|
//#region src/lib/fast-request-preprocess.ts
|
|
4363
4457
|
/**
|
|
4364
4458
|
* Apply authenticated fast-profile model and effort policy before ordinary model
|
|
4365
4459
|
* resolution. Synthetic aliases are refused outside an authenticated fast
|
|
4366
4460
|
* launch, so raw/BYO traffic cannot opt itself into private profile semantics.
|
|
4367
4461
|
*/
|
|
4368
|
-
function preprocessFastRequest(rawBody, launch) {
|
|
4462
|
+
function preprocessFastRequest(rawBody, launch, subagentRequest = false) {
|
|
4463
|
+
if (launch?.profileId === "max") return preprocessMaxRequest(rawBody, launch, subagentRequest);
|
|
4369
4464
|
let parsed;
|
|
4370
4465
|
try {
|
|
4371
4466
|
parsed = JSON.parse(rawBody);
|
|
@@ -4381,7 +4476,7 @@ function preprocessFastRequest(rawBody, launch) {
|
|
|
4381
4476
|
modified: false
|
|
4382
4477
|
};
|
|
4383
4478
|
const alias = resolveModelAlias(originalModel);
|
|
4384
|
-
if (alias && launch?.profileId !== "fast") return {
|
|
4479
|
+
if (alias && (launch?.profileId !== "fast" || isMaxModelAlias(originalModel))) return {
|
|
4385
4480
|
body: rawBody,
|
|
4386
4481
|
originalModel,
|
|
4387
4482
|
modified: false,
|
|
@@ -4700,6 +4795,32 @@ function stripWebSearchTool(body) {
|
|
|
4700
4795
|
* in probes `shim_advisor_degrade_gpt55` and
|
|
4701
4796
|
* `shim_advisor_degrade_gemini35flash`.
|
|
4702
4797
|
*/
|
|
4798
|
+
function hasNonEmptyTools(rawBody) {
|
|
4799
|
+
let body;
|
|
4800
|
+
try {
|
|
4801
|
+
body = JSON.parse(rawBody);
|
|
4802
|
+
} catch {
|
|
4803
|
+
return false;
|
|
4804
|
+
}
|
|
4805
|
+
return Array.isArray(body.tools) && body.tools.length > 0;
|
|
4806
|
+
}
|
|
4807
|
+
function fastAdvisorMetadataMismatch(rawBody) {
|
|
4808
|
+
let body;
|
|
4809
|
+
try {
|
|
4810
|
+
body = JSON.parse(rawBody);
|
|
4811
|
+
} catch {
|
|
4812
|
+
return;
|
|
4813
|
+
}
|
|
4814
|
+
if (!Array.isArray(body.tools) || body.tools.length === 0) return void 0;
|
|
4815
|
+
for (const tool of body.tools) {
|
|
4816
|
+
if (!tool || typeof tool !== "object") continue;
|
|
4817
|
+
const type = tool.type;
|
|
4818
|
+
if (typeof type !== "string" || !type.startsWith("advisor_")) continue;
|
|
4819
|
+
const model = tool.model;
|
|
4820
|
+
if (typeof model !== "string") return "the native Advisor tool omitted its fixed model";
|
|
4821
|
+
if (stripTrailingOneMSuffix(model).base !== FAST_PROFILE_ADVISOR_MODEL) return `the native Advisor tool requested ${JSON.stringify(model)} instead of ${JSON.stringify(FAST_PROFILE_ADVISOR_MODEL)}`;
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4703
4824
|
function stripAdvisorTool(rawBody) {
|
|
4704
4825
|
let body;
|
|
4705
4826
|
try {
|
|
@@ -4833,12 +4954,57 @@ async function handleCompletion(c) {
|
|
|
4833
4954
|
const incomingBeta = c.req.header("anthropic-beta");
|
|
4834
4955
|
const advisorRequested = isAdvisorRequested(incomingBeta);
|
|
4835
4956
|
const fastProfileRequest = identity.launch?.profileId === "fast";
|
|
4836
|
-
const
|
|
4957
|
+
const maxProfileRequest = identity.launch?.profileId === "max";
|
|
4958
|
+
const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
|
|
4959
|
+
const fastSubagentRequest = fastProfileRequest && subagentRequest;
|
|
4960
|
+
const maxSubagentRequest = maxProfileRequest && subagentRequest;
|
|
4837
4961
|
const fastLeadAdvisor = fastProfileRequest && !fastSubagentRequest;
|
|
4838
|
-
const
|
|
4839
|
-
const
|
|
4962
|
+
const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
|
|
4963
|
+
const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest;
|
|
4964
|
+
const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
4965
|
+
const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
4966
|
+
const advisorBehaviorEnabled = fastLeadAdvisor ? fastAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
|
|
4967
|
+
let fastAdvisorChoice;
|
|
4968
|
+
let maxAdvisorChoice;
|
|
4969
|
+
if (maxAdvisorEnabled) {
|
|
4970
|
+
const requestedAdvisor = process.env.GH_ROUTER_ADVISOR_MODEL;
|
|
4971
|
+
if (!maxAdvisorPinIsValid(requestedAdvisor)) return c.json({
|
|
4972
|
+
type: "error",
|
|
4973
|
+
error: {
|
|
4974
|
+
type: "invalid_request_error",
|
|
4975
|
+
message: `Invalid GH_ROUTER_ADVISOR_MODEL ${JSON.stringify(requestedAdvisor)} for max profile; must be gpt-5.6-sol or claude-opus-5.`
|
|
4976
|
+
}
|
|
4977
|
+
}, 400, { "x-should-retry": "false" });
|
|
4978
|
+
const model = maxAdvisorModelFromPin(requestedAdvisor, maxOpusModel());
|
|
4979
|
+
maxAdvisorChoice = {
|
|
4980
|
+
model,
|
|
4981
|
+
effort: maxAdvisorEffortForModel(model)
|
|
4982
|
+
};
|
|
4983
|
+
}
|
|
4984
|
+
if (fastAdvisorEnabled) {
|
|
4985
|
+
const mismatch = fastAdvisorMetadataMismatch(rawBody);
|
|
4986
|
+
if (mismatch) return c.json({
|
|
4987
|
+
type: "error",
|
|
4988
|
+
error: {
|
|
4989
|
+
type: "invalid_request_error",
|
|
4990
|
+
message: `Fast Advisor model mismatch: ${mismatch}. Run \`/advisor ${FAST_PROFILE_ADVISOR_MODEL}[1m]\` to restore the fixed fast profile, or relaunch with \`github-router claude -m fast\`.`
|
|
4991
|
+
}
|
|
4992
|
+
}, 400, { "x-should-retry": "false" });
|
|
4993
|
+
try {
|
|
4994
|
+
fastAdvisorChoice = resolveAdvisorModel(void 0, true);
|
|
4995
|
+
} catch (error) {
|
|
4996
|
+
return c.json({
|
|
4997
|
+
type: "error",
|
|
4998
|
+
error: {
|
|
4999
|
+
type: "api_error",
|
|
5000
|
+
message: error instanceof Error ? error.message : String(error)
|
|
5001
|
+
}
|
|
5002
|
+
}, 503);
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
|
|
4840
5006
|
if (fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
4841
|
-
const message = fastPreprocess.rejectedAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.rejectedAlias)} is valid only for an authenticated -m fast launch.` : `Model ${JSON.stringify(fastPreprocess.rejectedModel)} is outside the fixed -m fast model set.`;
|
|
5007
|
+
const message = identity.launch?.profileId === "max" ? maxRequestError(fastPreprocess) ?? "Invalid max request" : fastPreprocess.rejectedAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.rejectedAlias)} is valid only for an authenticated -m fast launch.` : `Model ${JSON.stringify(fastPreprocess.rejectedModel)} is outside the fixed -m fast model set.`;
|
|
4842
5008
|
return c.json({
|
|
4843
5009
|
type: "error",
|
|
4844
5010
|
error: {
|
|
@@ -4849,7 +5015,7 @@ async function handleCompletion(c) {
|
|
|
4849
5015
|
}
|
|
4850
5016
|
let finalBody = await processWebSearch(fastPreprocess.body);
|
|
4851
5017
|
finalBody = sanitizeAnthropicBody(finalBody);
|
|
4852
|
-
if (fastSubagentRequest) finalBody = stripAdvisorTool(finalBody);
|
|
5018
|
+
if (fastSubagentRequest || maxSubagentRequest) finalBody = stripAdvisorTool(finalBody);
|
|
4853
5019
|
const loopGuard = guardAnthropicBody(finalBody);
|
|
4854
5020
|
if (loopGuard.action === "abort") return c.json({
|
|
4855
5021
|
type: "error",
|
|
@@ -4859,8 +5025,8 @@ async function handleCompletion(c) {
|
|
|
4859
5025
|
}
|
|
4860
5026
|
}, 400, { "x-should-retry": "false" });
|
|
4861
5027
|
if (loopGuard.body !== void 0) finalBody = loopGuard.body;
|
|
4862
|
-
if (
|
|
4863
|
-
finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : void 0);
|
|
5028
|
+
if (advisorBehaviorEnabled) {
|
|
5029
|
+
finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
|
|
4864
5030
|
consola.info("ADVISOR enabled for this request — injecting __anthropic_advisor tool; will translate tool_use → server_tool_use{advisor} on the SSE stream");
|
|
4865
5031
|
}
|
|
4866
5032
|
if (finalBody.includes("\"mcp_servers\"")) try {
|
|
@@ -4884,16 +5050,16 @@ async function handleCompletion(c) {
|
|
|
4884
5050
|
parsedBase = JSON.parse(promptWindowBody);
|
|
4885
5051
|
} catch {}
|
|
4886
5052
|
const wantsStream = parsedBase?.stream === true;
|
|
4887
|
-
if (
|
|
5053
|
+
if ((fastAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
|
|
4888
5054
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
4889
5055
|
const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
|
|
4890
|
-
const
|
|
5056
|
+
const translatedAdvisorAborter = new AbortController();
|
|
4891
5057
|
const firstResponse = await streamParsedRequestViaShim(parsedInitial, endpoint, {
|
|
4892
5058
|
modelId,
|
|
4893
5059
|
model: selectedModel,
|
|
4894
5060
|
routePath: c.req.path,
|
|
4895
|
-
onCancel: () =>
|
|
4896
|
-
},
|
|
5061
|
+
onCancel: () => translatedAdvisorAborter.abort()
|
|
5062
|
+
}, translatedAdvisorAborter.signal);
|
|
4897
5063
|
logRequest({
|
|
4898
5064
|
method: "POST",
|
|
4899
5065
|
path: c.req.path,
|
|
@@ -4902,7 +5068,17 @@ async function handleCompletion(c) {
|
|
|
4902
5068
|
status: 200,
|
|
4903
5069
|
streaming: true
|
|
4904
5070
|
}, selectedModel, startTime);
|
|
4905
|
-
const advisorChoice =
|
|
5071
|
+
const advisorChoice = maxAdvisorEnabled ? {
|
|
5072
|
+
model: maxAdvisorChoice.model,
|
|
5073
|
+
effort: maxAdvisorChoice.effort,
|
|
5074
|
+
escalated: false,
|
|
5075
|
+
fastProfile: false
|
|
5076
|
+
} : {
|
|
5077
|
+
model: fastAdvisorChoice.model,
|
|
5078
|
+
effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
5079
|
+
escalated: fastAdvisorChoice.escalated,
|
|
5080
|
+
fastProfile: true
|
|
5081
|
+
};
|
|
4906
5082
|
return new Response(buildAdvisorStream({
|
|
4907
5083
|
firstResponse,
|
|
4908
5084
|
initialConversation,
|
|
@@ -4910,9 +5086,10 @@ async function handleCompletion(c) {
|
|
|
4910
5086
|
requestHeaders: {},
|
|
4911
5087
|
advisorModel: advisorChoice.model,
|
|
4912
5088
|
advisorEscalated: advisorChoice.escalated,
|
|
4913
|
-
advisorFastProfile:
|
|
4914
|
-
|
|
4915
|
-
|
|
5089
|
+
advisorFastProfile: advisorChoice.fastProfile,
|
|
5090
|
+
advisorMaxProfile: maxAdvisorEnabled,
|
|
5091
|
+
advisorEffort: advisorChoice.effort,
|
|
5092
|
+
externalAborter: translatedAdvisorAborter,
|
|
4916
5093
|
continueTurn: makeShimContinueTurn(endpoint, {
|
|
4917
5094
|
modelId,
|
|
4918
5095
|
model: selectedModel
|
|
@@ -4928,7 +5105,7 @@ async function handleCompletion(c) {
|
|
|
4928
5105
|
});
|
|
4929
5106
|
}
|
|
4930
5107
|
const shimBody = stripAdvisorTool(promptWindowBody);
|
|
4931
|
-
if (
|
|
5108
|
+
if (advisorBehaviorEnabled) consola.info("ADVISOR requested with a non-Claude model — stripping the injected __anthropic_advisor tool and proceeding without advisor (Claude-only feature; gracefully degraded).");
|
|
4932
5109
|
const shimOpts = {
|
|
4933
5110
|
rawBody: shimBody,
|
|
4934
5111
|
modelId,
|
|
@@ -4940,7 +5117,7 @@ async function handleCompletion(c) {
|
|
|
4940
5117
|
}
|
|
4941
5118
|
if (modelId) logEndpointMismatch(modelId, "/v1/messages");
|
|
4942
5119
|
const effectiveBetas = applyDefaultBetas(betaHeaders, resolvedModel ?? originalModel);
|
|
4943
|
-
const advisorAborter =
|
|
5120
|
+
const advisorAborter = advisorBehaviorEnabled ? new AbortController() : void 0;
|
|
4944
5121
|
const requestHeaders = {
|
|
4945
5122
|
...selectedModel?.requestHeaders,
|
|
4946
5123
|
...effectiveBetas
|
|
@@ -5014,13 +5191,18 @@ async function handleCompletion(c) {
|
|
|
5014
5191
|
if (requestId) streamHeaders["x-request-id"] = requestId;
|
|
5015
5192
|
const reqId = response.headers.get("request-id");
|
|
5016
5193
|
if (reqId) streamHeaders["request-id"] = reqId;
|
|
5017
|
-
if (
|
|
5194
|
+
if (advisorBehaviorEnabled && response.body) {
|
|
5018
5195
|
let parsedBase = {};
|
|
5019
5196
|
try {
|
|
5020
5197
|
parsedBase = JSON.parse(nativeBody);
|
|
5021
5198
|
} catch {}
|
|
5022
5199
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
5023
|
-
const advisorChoice =
|
|
5200
|
+
const advisorChoice = fastAdvisorChoice ?? (maxAdvisorChoice ? {
|
|
5201
|
+
model: maxAdvisorChoice.model,
|
|
5202
|
+
effort: maxAdvisorChoice.effort,
|
|
5203
|
+
escalated: false,
|
|
5204
|
+
fastProfile: false
|
|
5205
|
+
} : resolveAdvisorModel(originalModel, false));
|
|
5024
5206
|
return new Response(buildAdvisorStream({
|
|
5025
5207
|
firstResponse: response,
|
|
5026
5208
|
initialConversation,
|
|
@@ -5029,7 +5211,8 @@ async function handleCompletion(c) {
|
|
|
5029
5211
|
advisorModel: advisorChoice.model,
|
|
5030
5212
|
advisorEscalated: advisorChoice.escalated,
|
|
5031
5213
|
advisorFastProfile: fastLeadAdvisor,
|
|
5032
|
-
|
|
5214
|
+
advisorMaxProfile: maxAdvisorEnabled,
|
|
5215
|
+
advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor),
|
|
5033
5216
|
externalAborter: advisorAborter
|
|
5034
5217
|
}), {
|
|
5035
5218
|
status: response.status,
|
|
@@ -5365,9 +5548,11 @@ async function handleCountTokens(c) {
|
|
|
5365
5548
|
const startTime = Date.now();
|
|
5366
5549
|
const identity = runMessagesIdentityPreflight(c);
|
|
5367
5550
|
if (!identity.ok) return identityPreflightErrorResponse(c, identity.reason, c.req.path);
|
|
5368
|
-
const
|
|
5551
|
+
const rawBody = await c.req.text();
|
|
5552
|
+
const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
|
|
5553
|
+
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
|
|
5369
5554
|
if (fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
5370
|
-
const message = fastPreprocess.rejectedAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.rejectedAlias)} is valid only for an authenticated -m fast launch.` : `Model ${JSON.stringify(fastPreprocess.rejectedModel)} is outside the fixed -m fast model set.`;
|
|
5555
|
+
const message = identity.launch?.profileId === "max" ? maxRequestError(fastPreprocess) ?? "Invalid max request" : fastPreprocess.rejectedAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.rejectedAlias)} is valid only for an authenticated -m fast launch.` : `Model ${JSON.stringify(fastPreprocess.rejectedModel)} is outside the fixed -m fast model set.`;
|
|
5371
5556
|
return c.json({
|
|
5372
5557
|
type: "error",
|
|
5373
5558
|
error: {
|
|
@@ -6425,6 +6610,30 @@ function nativeSelectableModelsInCatalog() {
|
|
|
6425
6610
|
display_name: m.displayName
|
|
6426
6611
|
}));
|
|
6427
6612
|
}
|
|
6613
|
+
const MAX_NATIVE_MODELS = [
|
|
6614
|
+
{
|
|
6615
|
+
id: MAX_PROFILE_MODELS.sol,
|
|
6616
|
+
displayName: "GPT-5.6 Sol"
|
|
6617
|
+
},
|
|
6618
|
+
{
|
|
6619
|
+
id: MAX_PROFILE_MODELS.luna,
|
|
6620
|
+
displayName: "GPT-5.6 Luna"
|
|
6621
|
+
},
|
|
6622
|
+
{
|
|
6623
|
+
id: MAX_PROFILE_MODELS.gemini,
|
|
6624
|
+
displayName: "Gemini 3.7 Flash"
|
|
6625
|
+
},
|
|
6626
|
+
{
|
|
6627
|
+
id: MAX_PROFILE_MODELS.opus,
|
|
6628
|
+
displayName: "Claude Opus 5"
|
|
6629
|
+
}
|
|
6630
|
+
];
|
|
6631
|
+
function maxSelectableModelsInCatalog() {
|
|
6632
|
+
return MAX_NATIVE_MODELS.filter((model) => state.models?.data.some((entry) => entry.id === model.id)).map((model) => ({
|
|
6633
|
+
id: withOneMSuffix(model.id),
|
|
6634
|
+
display_name: model.displayName
|
|
6635
|
+
}));
|
|
6636
|
+
}
|
|
6428
6637
|
/**
|
|
6429
6638
|
* Pre-seed Claude Code's gateway-model discovery cache so the non-Claude
|
|
6430
6639
|
* models appear as selectable picker rows WITHOUT the network fetch.
|
|
@@ -6552,7 +6761,10 @@ function clearGatewayModelCache(configDir = PATHS.CLAUDE_CONFIG_DIR) {
|
|
|
6552
6761
|
*/
|
|
6553
6762
|
function oneMSuffixForAlias(aliasId) {
|
|
6554
6763
|
if (oneMContextDisabled()) return aliasId;
|
|
6555
|
-
return catalogAdvertises1M(
|
|
6764
|
+
return catalogAdvertises1M(LUNA_REAL_MODEL_ID) ? `${aliasId}[1m]` : aliasId;
|
|
6765
|
+
}
|
|
6766
|
+
function oneMSuffixForMaxModel(id) {
|
|
6767
|
+
return withOneMSuffix(id);
|
|
6556
6768
|
}
|
|
6557
6769
|
function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
6558
6770
|
const vars = {
|
|
@@ -6567,8 +6779,9 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6567
6779
|
if (process.env.MCP_TIMEOUT === void 0) vars.MCP_TIMEOUT = mcpToolTimeoutMs;
|
|
6568
6780
|
if (process.env.MCP_TOOL_TIMEOUT === void 0) vars.MCP_TOOL_TIMEOUT = mcpToolTimeoutMs;
|
|
6569
6781
|
const isFastProfile = launchProfileId === "fast";
|
|
6570
|
-
const
|
|
6571
|
-
|
|
6782
|
+
const isMaxProfile = launchProfileId === "max";
|
|
6783
|
+
const smallFastModel = isMaxProfile ? MAX_LUNA_HIGH_ALIAS_ID : isFastProfile ? LUNA_HAIKU_ALIAS_ID : isBudgetClaudeLead(model) && (state.models?.data?.some((m) => m.id === "claude-haiku-4.5") ?? false) ? BUDGET_SMALL_FAST_SLUG : "claude-sonnet-5";
|
|
6784
|
+
if (process.env.ANTHROPIC_SMALL_FAST_MODEL === void 0) vars.ANTHROPIC_SMALL_FAST_MODEL = isFastProfile || isMaxProfile ? oneMSuffixForAlias(smallFastModel) : smallFastModel;
|
|
6572
6785
|
const seedTierRow = (modelKey, nameKey, bareSlug) => {
|
|
6573
6786
|
if (process.env[modelKey] !== void 0) return;
|
|
6574
6787
|
vars[modelKey] = withOneMSuffixForLead(bareSlug);
|
|
@@ -6579,7 +6792,20 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6579
6792
|
vars[modelKey] = oneMSuffixForAlias(aliasId);
|
|
6580
6793
|
if (process.env[nameKey] === void 0) vars[nameKey] = displayName;
|
|
6581
6794
|
};
|
|
6582
|
-
if (
|
|
6795
|
+
if (isMaxProfile) {
|
|
6796
|
+
const seedMaxRow = (modelKey, nameKey, id) => {
|
|
6797
|
+
if (process.env[modelKey] !== void 0) return;
|
|
6798
|
+
vars[modelKey] = oneMSuffixForMaxModel(id);
|
|
6799
|
+
if (process.env[nameKey] === void 0) vars[nameKey] = id;
|
|
6800
|
+
};
|
|
6801
|
+
seedMaxRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", MAX_PROFILE_MODELS.luna);
|
|
6802
|
+
seedMaxRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", MAX_PROFILE_MODELS.luna);
|
|
6803
|
+
if (maxOpusModel()) seedMaxRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", MAX_PROFILE_MODELS.opus);
|
|
6804
|
+
if (process.env.ANTHROPIC_CUSTOM_MODEL_OPTION === void 0) {
|
|
6805
|
+
vars.ANTHROPIC_CUSTOM_MODEL_OPTION = oneMSuffixForMaxModel(MAX_PROFILE_MODELS.sol);
|
|
6806
|
+
if (process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME === void 0) vars.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME = "GPT-5.6 Sol";
|
|
6807
|
+
}
|
|
6808
|
+
} else if (isFastProfile) {
|
|
6583
6809
|
seedFastAliasTierRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", LUNA_SONNET_ALIAS_ID, "GPT-5.6 Luna (xhigh)");
|
|
6584
6810
|
seedFastAliasTierRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", LUNA_HAIKU_ALIAS_ID, "GPT-5.6 Luna (high)");
|
|
6585
6811
|
const fastAliasCapabilities = "effort,xhigh_effort,max_effort,thinking,adaptive_thinking,interleaved_thinking";
|
|
@@ -6594,7 +6820,7 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6594
6820
|
seedTierRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", "claude-sonnet-5");
|
|
6595
6821
|
seedTierRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", smallFastModel);
|
|
6596
6822
|
}
|
|
6597
|
-
seedTierRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", "claude-opus-5");
|
|
6823
|
+
if (!isMaxProfile) seedTierRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", "claude-opus-5");
|
|
6598
6824
|
if (process.env.CLAUDE_CODE_PLAN_V2_AGENT_COUNT === void 0) vars.CLAUDE_CODE_PLAN_V2_AGENT_COUNT = "7";
|
|
6599
6825
|
for (const key of [
|
|
6600
6826
|
"CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL",
|
|
@@ -6603,11 +6829,11 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6603
6829
|
"CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING",
|
|
6604
6830
|
"CLAUDE_CODE_ENABLE_TASKS"
|
|
6605
6831
|
]) if (process.env[key] === void 0) vars[key] = "1";
|
|
6606
|
-
const nativeModels = nativeSelectableModelsInCatalog();
|
|
6832
|
+
const nativeModels = isMaxProfile ? maxSelectableModelsInCatalog() : nativeSelectableModelsInCatalog();
|
|
6607
6833
|
if (nativeModels.length > 0) {
|
|
6608
6834
|
if (seedGatewayModelCache(serverUrl, nativeModels) && process.env.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY === void 0 && vars.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY === void 0) vars.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY = "1";
|
|
6609
6835
|
} else clearGatewayModelCache();
|
|
6610
|
-
applyAutoCompactWindow(vars);
|
|
6836
|
+
applyAutoCompactWindow(vars, launchProfileId);
|
|
6611
6837
|
if (toolbeltEnabled()) Object.assign(vars, toolbeltPathOverride(process.env, PATHS.TOOLBELT_BIN_DIR));
|
|
6612
6838
|
return vars;
|
|
6613
6839
|
}
|
|
@@ -6652,7 +6878,7 @@ function catalogEntryForSeededModel(value) {
|
|
|
6652
6878
|
*
|
|
6653
6879
|
* Presence-guarded on the parent env, symmetric with every other guard here.
|
|
6654
6880
|
*/
|
|
6655
|
-
function applyAutoCompactWindow(vars) {
|
|
6881
|
+
function applyAutoCompactWindow(vars, launchProfileId) {
|
|
6656
6882
|
if (process.env.CLAUDE_CODE_AUTO_COMPACT_WINDOW !== void 0) return;
|
|
6657
6883
|
let tightestWindow;
|
|
6658
6884
|
const consider = (value) => {
|
|
@@ -6662,7 +6888,8 @@ function applyAutoCompactWindow(vars) {
|
|
|
6662
6888
|
if (candidateWindow !== void 0 && (tightestWindow === void 0 || candidateWindow < tightestWindow)) tightestWindow = candidateWindow;
|
|
6663
6889
|
};
|
|
6664
6890
|
for (const key of LEAD_CAPABLE_MODEL_ENV_KEYS) consider(vars[key] ?? process.env[key]);
|
|
6665
|
-
|
|
6891
|
+
const gatewayModels = launchProfileId === "max" ? maxSelectableModelsInCatalog() : nativeSelectableModelsInCatalog();
|
|
6892
|
+
for (const model of gatewayModels) consider(model.id);
|
|
6666
6893
|
if (tightestWindow === void 0) return;
|
|
6667
6894
|
vars.CLAUDE_CODE_AUTO_COMPACT_WINDOW = String(tightestWindow);
|
|
6668
6895
|
}
|
|
@@ -6690,4 +6917,4 @@ function getCodexEnvVars(serverUrl) {
|
|
|
6690
6917
|
//#endregion
|
|
6691
6918
|
export { sharedServerArgs as a, stopKeepAwake as c, runSelfUpdate as d, checkClaudeVersion as f, setupAndServe as i, listModelsForEndpoint as l, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, updateClaude as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, enableFileLogging as u };
|
|
6692
6919
|
|
|
6693
|
-
//# sourceMappingURL=server-setup-
|
|
6920
|
+
//# sourceMappingURL=server-setup-Zn5wkosb.js.map
|