github-router 0.3.297 → 0.3.303
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-B70GmZ68.js → attribution-settings-dta8MTnd.js} +322 -95
- package/dist/attribution-settings-dta8MTnd.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-DMMfvfns.js → claude-kr-Augld.js} +169 -170
- package/dist/claude-kr-Augld.js.map +1 -0
- package/dist/{codex-DVOyVv2B.js → codex-B1qnVlzG.js} +6 -5
- package/dist/{codex-DVOyVv2B.js.map → codex-B1qnVlzG.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-B3w1TDgR.js +2 -0
- package/dist/{fast-profile-contract-K3P58nj3.js → fast-profile-contract-B6xn-Rzo.js} +26 -23
- package/dist/fast-profile-contract-B6xn-Rzo.js.map +1 -0
- package/dist/{gate-discovery-G6PAG61j.js → gate-discovery-DOIm3XHF.js} +5 -5
- package/dist/{gate-discovery-G6PAG61j.js.map → gate-discovery-DOIm3XHF.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 +393 -40
- 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-Bkr_iGOu.js → internal-fast-dispatch-guard-BhpZ6LvO.js} +72 -16
- package/dist/internal-fast-dispatch-guard-BhpZ6LvO.js.map +1 -0
- package/dist/{internal-fast-dispatch-guard-N-RaLrOn.js → internal-fast-dispatch-guard-C6BNoOnn.js} +1 -1
- 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-DhAr8N_o.js +215 -0
- package/dist/internal-max-dispatch-guard-DhAr8N_o.js.map +1 -0
- package/dist/internal-max-dispatch-guard-k52H-PdC.js +2 -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-BjzrF1zd.js → internal-stop-hook-CWffknT2.js} +5 -5
- package/dist/{internal-stop-hook-BjzrF1zd.js.map → internal-stop-hook-CWffknT2.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-Ct62mtAR.js +276 -0
- package/dist/max-profile-contract-Ct62mtAR.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-ce6_YMnX.js → peer-mcp-personas-BU5dNLxQ.js} +737 -459
- package/dist/peer-mcp-personas-BU5dNLxQ.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-BhCtm3md.js → provision-qNJgF5XD.js} +4 -4
- package/dist/{provision-BhCtm3md.js.map → provision-qNJgF5XD.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-Blj_dRSr.js → serve-T64kVeQN.js} +13 -12
- package/dist/{serve-Blj_dRSr.js.map → serve-T64kVeQN.js.map} +1 -1
- package/dist/{server-setup-DhG3YZPj.js → server-setup-C_LAE8NI.js} +222 -40
- package/dist/server-setup-C_LAE8NI.js.map +1 -0
- package/dist/{start-8QaqICtd.js → start-DHRToEyb.js} +3 -3
- package/dist/{start-8QaqICtd.js.map → start-DHRToEyb.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-B70GmZ68.js.map +0 -1
- package/dist/claude-DMMfvfns.js.map +0 -1
- package/dist/engine-BkGRuUNs.js +0 -2
- package/dist/fast-profile-contract-K3P58nj3.js.map +0 -1
- package/dist/internal-fast-dispatch-guard-Bkr_iGOu.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-ce6_YMnX.js.map +0 -1
- package/dist/server-setup-DhG3YZPj.js.map +0 -1
- package/dist/token-BtJhjXXu.js.map +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as UNKNOWN_EFFORT_ANCHOR, An as MAX_LUNA_HIGH_ALIAS_ID, At as countTokens, B as resolveAdvisorEffort, Bn as resolveModelAlias, Bt as resolveMcpToolTimeoutMs, Cn as withOneMSuffix, D as toolbeltEnabled, Dn as LUNA_REAL_MODEL_ID, En as LUNA_HAIKU_ALIAS_ID, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as isRetiredFastModelAlias, Ft as findLaunchBySecret, G as repairRejectedThinkingHistory, Gt as parseJsonOrDiagnose, H as formatThinkingRepairDecline, Ht as createChatCompletions, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, In as maxAliasEffort, J as isControllerClosedError, K as buildAnthropicErrorEvent, Kt as normalizeOpenAIUsage, L as buildAdvisorStream, Ln as maxAliasModel, Mn as canonicalizeAliasModel, Mt as getTextTokenCount, N as searchWeb, Nt as getTokenCount, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as isMaxModelAlias, Pt as getTokenizerFromModel, Q as EFFORT_ORDER, R as injectAdvisorTool, Rt as assembleResponsesPayload, Sn as oneMContextDisabled, Tn as LUNA_DRIVER_ALIAS_ID, U as rememberThinkingHistoryRepair, Un as withInstallLock, 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, jn as MAX_LUNA_MAX_ALIAS_ID, jt as createMessages, kn as LUNA_SONNET_ALIAS_ID, 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-BU5dNLxQ.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";
|
|
7
|
-
import { r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-
|
|
8
|
+
import { r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-B6xn-Rzo.js";
|
|
9
|
+
import { 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, x as stripTrailingOneMSuffix } from "./max-profile-contract-Ct62mtAR.js";
|
|
8
10
|
import consola from "consola";
|
|
9
11
|
import * as fs$2 from "node:fs";
|
|
10
12
|
import fs, { existsSync } from "node:fs";
|
|
@@ -1090,7 +1092,7 @@ const CLIENT_OUTPUT_RESERVE_TOKENS = 2e4;
|
|
|
1090
1092
|
/**
|
|
1091
1093
|
* The client's additional flat reserve between the output-reduced window and
|
|
1092
1094
|
* its reactive compaction threshold. Read from the installed Claude Code
|
|
1093
|
-
* 2.1.
|
|
1095
|
+
* 2.1.251 bundle: `E9(e,t)` computes `r = e - 13000` and returns it when no
|
|
1094
1096
|
* percentage override is set, where `e` is already
|
|
1095
1097
|
* `window - min(maxOutput, 20_000)`.
|
|
1096
1098
|
*/
|
|
@@ -1099,7 +1101,9 @@ const CLIENT_THRESHOLD_RESERVE_TOKENS = 13e3;
|
|
|
1099
1101
|
* Bounds the `CLAUDE_CODE_AUTO_COMPACT_WINDOW` env path applies to whatever it
|
|
1100
1102
|
* parses: `IWe = 1e5` floor, `ZRt = 1e6` cap. A value below the floor is
|
|
1101
1103
|
* silently RAISED to it, so deriving something smaller would be a lie; a value
|
|
1102
|
-
* 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.
|
|
1103
1107
|
*/
|
|
1104
1108
|
const ENV_WINDOW_MIN_TOKENS = 1e5;
|
|
1105
1109
|
const ENV_WINDOW_MAX_TOKENS = 1e6;
|
|
@@ -1498,7 +1502,7 @@ function collectToolFieldKeys(body) {
|
|
|
1498
1502
|
//#endregion
|
|
1499
1503
|
//#region package.json
|
|
1500
1504
|
var name = "github-router";
|
|
1501
|
-
var version = "0.3.
|
|
1505
|
+
var version = "0.3.303";
|
|
1502
1506
|
//#endregion
|
|
1503
1507
|
//#region src/lib/approval.ts
|
|
1504
1508
|
const awaitApproval = async () => {
|
|
@@ -4360,13 +4364,103 @@ function identityPreflightErrorResponse(c, reason, path = "/v1/messages") {
|
|
|
4360
4364
|
}, 403);
|
|
4361
4365
|
}
|
|
4362
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" || base === "gpt-5.6-luna");
|
|
4431
|
+
if (!allowedModel(base) && !allowedSubagentModel) return {
|
|
4432
|
+
body: rawBody,
|
|
4433
|
+
originalModel,
|
|
4434
|
+
modified: false,
|
|
4435
|
+
rejectedModel: originalModel
|
|
4436
|
+
};
|
|
4437
|
+
const effort = allowedSubagentModel ? base === "gpt-5.6-luna" ? "max" : "high" : 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
|
|
4363
4456
|
//#region src/lib/fast-request-preprocess.ts
|
|
4364
4457
|
/**
|
|
4365
4458
|
* Apply authenticated fast-profile model and effort policy before ordinary model
|
|
4366
4459
|
* resolution. Synthetic aliases are refused outside an authenticated fast
|
|
4367
4460
|
* launch, so raw/BYO traffic cannot opt itself into private profile semantics.
|
|
4368
4461
|
*/
|
|
4369
|
-
function preprocessFastRequest(rawBody, launch) {
|
|
4462
|
+
function preprocessFastRequest(rawBody, launch, subagentRequest = false) {
|
|
4463
|
+
if (launch?.profileId === "max") return preprocessMaxRequest(rawBody, launch, subagentRequest);
|
|
4370
4464
|
let parsed;
|
|
4371
4465
|
try {
|
|
4372
4466
|
parsed = JSON.parse(rawBody);
|
|
@@ -4381,8 +4475,14 @@ function preprocessFastRequest(rawBody, launch) {
|
|
|
4381
4475
|
body: rawBody,
|
|
4382
4476
|
modified: false
|
|
4383
4477
|
};
|
|
4478
|
+
if (isRetiredFastModelAlias(originalModel)) return {
|
|
4479
|
+
body: rawBody,
|
|
4480
|
+
originalModel,
|
|
4481
|
+
modified: false,
|
|
4482
|
+
retiredAlias: originalModel
|
|
4483
|
+
};
|
|
4384
4484
|
const alias = resolveModelAlias(originalModel);
|
|
4385
|
-
if (alias && launch?.profileId !== "fast") return {
|
|
4485
|
+
if (alias && (launch?.profileId !== "fast" || isMaxModelAlias(originalModel))) return {
|
|
4386
4486
|
body: rawBody,
|
|
4387
4487
|
originalModel,
|
|
4388
4488
|
modified: false,
|
|
@@ -4860,12 +4960,33 @@ async function handleCompletion(c) {
|
|
|
4860
4960
|
const incomingBeta = c.req.header("anthropic-beta");
|
|
4861
4961
|
const advisorRequested = isAdvisorRequested(incomingBeta);
|
|
4862
4962
|
const fastProfileRequest = identity.launch?.profileId === "fast";
|
|
4863
|
-
const
|
|
4963
|
+
const maxProfileRequest = identity.launch?.profileId === "max";
|
|
4964
|
+
const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
|
|
4965
|
+
const fastSubagentRequest = fastProfileRequest && subagentRequest;
|
|
4966
|
+
const maxSubagentRequest = maxProfileRequest && subagentRequest;
|
|
4864
4967
|
const fastLeadAdvisor = fastProfileRequest && !fastSubagentRequest;
|
|
4865
|
-
const
|
|
4968
|
+
const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
|
|
4969
|
+
const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest;
|
|
4866
4970
|
const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
4867
|
-
const
|
|
4971
|
+
const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
4972
|
+
const advisorBehaviorEnabled = fastLeadAdvisor ? fastAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : advisorEnabled;
|
|
4868
4973
|
let fastAdvisorChoice;
|
|
4974
|
+
let maxAdvisorChoice;
|
|
4975
|
+
if (maxAdvisorEnabled) {
|
|
4976
|
+
const requestedAdvisor = process.env.GH_ROUTER_ADVISOR_MODEL;
|
|
4977
|
+
if (!maxAdvisorPinIsValid(requestedAdvisor)) return c.json({
|
|
4978
|
+
type: "error",
|
|
4979
|
+
error: {
|
|
4980
|
+
type: "invalid_request_error",
|
|
4981
|
+
message: `Invalid GH_ROUTER_ADVISOR_MODEL ${JSON.stringify(requestedAdvisor)} for max profile; must be gpt-5.6-sol or claude-opus-5.`
|
|
4982
|
+
}
|
|
4983
|
+
}, 400, { "x-should-retry": "false" });
|
|
4984
|
+
const model = maxAdvisorModelFromPin(requestedAdvisor, maxOpusModel());
|
|
4985
|
+
maxAdvisorChoice = {
|
|
4986
|
+
model,
|
|
4987
|
+
effort: maxAdvisorEffortForModel(model)
|
|
4988
|
+
};
|
|
4989
|
+
}
|
|
4869
4990
|
if (fastAdvisorEnabled) {
|
|
4870
4991
|
const mismatch = fastAdvisorMetadataMismatch(rawBody);
|
|
4871
4992
|
if (mismatch) return c.json({
|
|
@@ -4887,9 +5008,9 @@ async function handleCompletion(c) {
|
|
|
4887
5008
|
}, 503);
|
|
4888
5009
|
}
|
|
4889
5010
|
}
|
|
4890
|
-
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch);
|
|
4891
|
-
if (fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
4892
|
-
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.`;
|
|
5011
|
+
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
|
|
5012
|
+
if (fastPreprocess.retiredAlias || fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
5013
|
+
const message = fastPreprocess.retiredAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.retiredAlias)} belongs to a retired Fast role and is no longer valid. Relaunch or select a current Fast role.` : 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.`;
|
|
4893
5014
|
return c.json({
|
|
4894
5015
|
type: "error",
|
|
4895
5016
|
error: {
|
|
@@ -4900,7 +5021,7 @@ async function handleCompletion(c) {
|
|
|
4900
5021
|
}
|
|
4901
5022
|
let finalBody = await processWebSearch(fastPreprocess.body);
|
|
4902
5023
|
finalBody = sanitizeAnthropicBody(finalBody);
|
|
4903
|
-
if (fastSubagentRequest) finalBody = stripAdvisorTool(finalBody);
|
|
5024
|
+
if (fastSubagentRequest || maxSubagentRequest) finalBody = stripAdvisorTool(finalBody);
|
|
4904
5025
|
const loopGuard = guardAnthropicBody(finalBody);
|
|
4905
5026
|
if (loopGuard.action === "abort") return c.json({
|
|
4906
5027
|
type: "error",
|
|
@@ -4911,7 +5032,7 @@ async function handleCompletion(c) {
|
|
|
4911
5032
|
}, 400, { "x-should-retry": "false" });
|
|
4912
5033
|
if (loopGuard.body !== void 0) finalBody = loopGuard.body;
|
|
4913
5034
|
if (advisorBehaviorEnabled) {
|
|
4914
|
-
finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : void 0);
|
|
5035
|
+
finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
|
|
4915
5036
|
consola.info("ADVISOR enabled for this request — injecting __anthropic_advisor tool; will translate tool_use → server_tool_use{advisor} on the SSE stream");
|
|
4916
5037
|
}
|
|
4917
5038
|
if (finalBody.includes("\"mcp_servers\"")) try {
|
|
@@ -4935,16 +5056,16 @@ async function handleCompletion(c) {
|
|
|
4935
5056
|
parsedBase = JSON.parse(promptWindowBody);
|
|
4936
5057
|
} catch {}
|
|
4937
5058
|
const wantsStream = parsedBase?.stream === true;
|
|
4938
|
-
if (fastAdvisorEnabled && wantsStream) {
|
|
5059
|
+
if ((fastAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
|
|
4939
5060
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
4940
5061
|
const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
|
|
4941
|
-
const
|
|
5062
|
+
const translatedAdvisorAborter = new AbortController();
|
|
4942
5063
|
const firstResponse = await streamParsedRequestViaShim(parsedInitial, endpoint, {
|
|
4943
5064
|
modelId,
|
|
4944
5065
|
model: selectedModel,
|
|
4945
5066
|
routePath: c.req.path,
|
|
4946
|
-
onCancel: () =>
|
|
4947
|
-
},
|
|
5067
|
+
onCancel: () => translatedAdvisorAborter.abort()
|
|
5068
|
+
}, translatedAdvisorAborter.signal);
|
|
4948
5069
|
logRequest({
|
|
4949
5070
|
method: "POST",
|
|
4950
5071
|
path: c.req.path,
|
|
@@ -4953,7 +5074,17 @@ async function handleCompletion(c) {
|
|
|
4953
5074
|
status: 200,
|
|
4954
5075
|
streaming: true
|
|
4955
5076
|
}, selectedModel, startTime);
|
|
4956
|
-
const advisorChoice =
|
|
5077
|
+
const advisorChoice = maxAdvisorEnabled ? {
|
|
5078
|
+
model: maxAdvisorChoice.model,
|
|
5079
|
+
effort: maxAdvisorChoice.effort,
|
|
5080
|
+
escalated: false,
|
|
5081
|
+
fastProfile: false
|
|
5082
|
+
} : {
|
|
5083
|
+
model: fastAdvisorChoice.model,
|
|
5084
|
+
effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
5085
|
+
escalated: fastAdvisorChoice.escalated,
|
|
5086
|
+
fastProfile: true
|
|
5087
|
+
};
|
|
4957
5088
|
return new Response(buildAdvisorStream({
|
|
4958
5089
|
firstResponse,
|
|
4959
5090
|
initialConversation,
|
|
@@ -4961,9 +5092,10 @@ async function handleCompletion(c) {
|
|
|
4961
5092
|
requestHeaders: {},
|
|
4962
5093
|
advisorModel: advisorChoice.model,
|
|
4963
5094
|
advisorEscalated: advisorChoice.escalated,
|
|
4964
|
-
advisorFastProfile:
|
|
4965
|
-
|
|
4966
|
-
|
|
5095
|
+
advisorFastProfile: advisorChoice.fastProfile,
|
|
5096
|
+
advisorMaxProfile: maxAdvisorEnabled,
|
|
5097
|
+
advisorEffort: advisorChoice.effort,
|
|
5098
|
+
externalAborter: translatedAdvisorAborter,
|
|
4967
5099
|
continueTurn: makeShimContinueTurn(endpoint, {
|
|
4968
5100
|
modelId,
|
|
4969
5101
|
model: selectedModel
|
|
@@ -5071,7 +5203,12 @@ async function handleCompletion(c) {
|
|
|
5071
5203
|
parsedBase = JSON.parse(nativeBody);
|
|
5072
5204
|
} catch {}
|
|
5073
5205
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
5074
|
-
const advisorChoice = fastAdvisorChoice ??
|
|
5206
|
+
const advisorChoice = fastAdvisorChoice ?? (maxAdvisorChoice ? {
|
|
5207
|
+
model: maxAdvisorChoice.model,
|
|
5208
|
+
effort: maxAdvisorChoice.effort,
|
|
5209
|
+
escalated: false,
|
|
5210
|
+
fastProfile: false
|
|
5211
|
+
} : resolveAdvisorModel(originalModel, false));
|
|
5075
5212
|
return new Response(buildAdvisorStream({
|
|
5076
5213
|
firstResponse: response,
|
|
5077
5214
|
initialConversation,
|
|
@@ -5080,7 +5217,8 @@ async function handleCompletion(c) {
|
|
|
5080
5217
|
advisorModel: advisorChoice.model,
|
|
5081
5218
|
advisorEscalated: advisorChoice.escalated,
|
|
5082
5219
|
advisorFastProfile: fastLeadAdvisor,
|
|
5083
|
-
|
|
5220
|
+
advisorMaxProfile: maxAdvisorEnabled,
|
|
5221
|
+
advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor),
|
|
5084
5222
|
externalAborter: advisorAborter
|
|
5085
5223
|
}), {
|
|
5086
5224
|
status: response.status,
|
|
@@ -5416,9 +5554,11 @@ async function handleCountTokens(c) {
|
|
|
5416
5554
|
const startTime = Date.now();
|
|
5417
5555
|
const identity = runMessagesIdentityPreflight(c);
|
|
5418
5556
|
if (!identity.ok) return identityPreflightErrorResponse(c, identity.reason, c.req.path);
|
|
5419
|
-
const
|
|
5420
|
-
|
|
5421
|
-
|
|
5557
|
+
const rawBody = await c.req.text();
|
|
5558
|
+
const subagentRequest = Boolean(c.req.header("x-claude-code-agent-id"));
|
|
5559
|
+
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
|
|
5560
|
+
if (fastPreprocess.retiredAlias || fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
5561
|
+
const message = fastPreprocess.retiredAlias ? `Router-owned model alias ${JSON.stringify(fastPreprocess.retiredAlias)} belongs to a retired Fast role and is no longer valid. Relaunch or select a current Fast role.` : 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.`;
|
|
5422
5562
|
return c.json({
|
|
5423
5563
|
type: "error",
|
|
5424
5564
|
error: {
|
|
@@ -6476,6 +6616,30 @@ function nativeSelectableModelsInCatalog() {
|
|
|
6476
6616
|
display_name: m.displayName
|
|
6477
6617
|
}));
|
|
6478
6618
|
}
|
|
6619
|
+
const MAX_NATIVE_MODELS = [
|
|
6620
|
+
{
|
|
6621
|
+
id: MAX_PROFILE_MODELS.sol,
|
|
6622
|
+
displayName: "GPT-5.6 Sol"
|
|
6623
|
+
},
|
|
6624
|
+
{
|
|
6625
|
+
id: MAX_PROFILE_MODELS.luna,
|
|
6626
|
+
displayName: "GPT-5.6 Luna"
|
|
6627
|
+
},
|
|
6628
|
+
{
|
|
6629
|
+
id: MAX_PROFILE_MODELS.gemini,
|
|
6630
|
+
displayName: "Gemini 3.7 Flash"
|
|
6631
|
+
},
|
|
6632
|
+
{
|
|
6633
|
+
id: MAX_PROFILE_MODELS.opus,
|
|
6634
|
+
displayName: "Claude Opus 5"
|
|
6635
|
+
}
|
|
6636
|
+
];
|
|
6637
|
+
function maxSelectableModelsInCatalog() {
|
|
6638
|
+
return MAX_NATIVE_MODELS.filter((model) => state.models?.data.some((entry) => entry.id === model.id)).map((model) => ({
|
|
6639
|
+
id: withOneMSuffix(model.id),
|
|
6640
|
+
display_name: model.displayName
|
|
6641
|
+
}));
|
|
6642
|
+
}
|
|
6479
6643
|
/**
|
|
6480
6644
|
* Pre-seed Claude Code's gateway-model discovery cache so the non-Claude
|
|
6481
6645
|
* models appear as selectable picker rows WITHOUT the network fetch.
|
|
@@ -6605,6 +6769,9 @@ function oneMSuffixForAlias(aliasId) {
|
|
|
6605
6769
|
if (oneMContextDisabled()) return aliasId;
|
|
6606
6770
|
return catalogAdvertises1M(LUNA_REAL_MODEL_ID) ? `${aliasId}[1m]` : aliasId;
|
|
6607
6771
|
}
|
|
6772
|
+
function oneMSuffixForMaxModel(id) {
|
|
6773
|
+
return withOneMSuffix(id);
|
|
6774
|
+
}
|
|
6608
6775
|
function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
6609
6776
|
const vars = {
|
|
6610
6777
|
ANTHROPIC_BASE_URL: serverUrl,
|
|
@@ -6618,8 +6785,9 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6618
6785
|
if (process.env.MCP_TIMEOUT === void 0) vars.MCP_TIMEOUT = mcpToolTimeoutMs;
|
|
6619
6786
|
if (process.env.MCP_TOOL_TIMEOUT === void 0) vars.MCP_TOOL_TIMEOUT = mcpToolTimeoutMs;
|
|
6620
6787
|
const isFastProfile = launchProfileId === "fast";
|
|
6621
|
-
const
|
|
6622
|
-
|
|
6788
|
+
const isMaxProfile = launchProfileId === "max";
|
|
6789
|
+
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";
|
|
6790
|
+
if (process.env.ANTHROPIC_SMALL_FAST_MODEL === void 0) vars.ANTHROPIC_SMALL_FAST_MODEL = isFastProfile || isMaxProfile ? oneMSuffixForAlias(smallFastModel) : smallFastModel;
|
|
6623
6791
|
const seedTierRow = (modelKey, nameKey, bareSlug) => {
|
|
6624
6792
|
if (process.env[modelKey] !== void 0) return;
|
|
6625
6793
|
vars[modelKey] = withOneMSuffixForLead(bareSlug);
|
|
@@ -6630,7 +6798,20 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6630
6798
|
vars[modelKey] = oneMSuffixForAlias(aliasId);
|
|
6631
6799
|
if (process.env[nameKey] === void 0) vars[nameKey] = displayName;
|
|
6632
6800
|
};
|
|
6633
|
-
if (
|
|
6801
|
+
if (isMaxProfile) {
|
|
6802
|
+
const seedMaxRow = (modelKey, nameKey, id) => {
|
|
6803
|
+
if (process.env[modelKey] !== void 0) return;
|
|
6804
|
+
vars[modelKey] = oneMSuffixForMaxModel(id);
|
|
6805
|
+
if (process.env[nameKey] === void 0) vars[nameKey] = id;
|
|
6806
|
+
};
|
|
6807
|
+
seedMaxRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", MAX_PROFILE_MODELS.luna);
|
|
6808
|
+
seedMaxRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", MAX_PROFILE_MODELS.luna);
|
|
6809
|
+
if (maxOpusModel()) seedMaxRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", MAX_PROFILE_MODELS.opus);
|
|
6810
|
+
if (process.env.ANTHROPIC_CUSTOM_MODEL_OPTION === void 0) {
|
|
6811
|
+
vars.ANTHROPIC_CUSTOM_MODEL_OPTION = oneMSuffixForMaxModel(MAX_PROFILE_MODELS.sol);
|
|
6812
|
+
if (process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME === void 0) vars.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME = "GPT-5.6 Sol";
|
|
6813
|
+
}
|
|
6814
|
+
} else if (isFastProfile) {
|
|
6634
6815
|
seedFastAliasTierRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", LUNA_SONNET_ALIAS_ID, "GPT-5.6 Luna (xhigh)");
|
|
6635
6816
|
seedFastAliasTierRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", LUNA_HAIKU_ALIAS_ID, "GPT-5.6 Luna (high)");
|
|
6636
6817
|
const fastAliasCapabilities = "effort,xhigh_effort,max_effort,thinking,adaptive_thinking,interleaved_thinking";
|
|
@@ -6645,7 +6826,7 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6645
6826
|
seedTierRow("ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", "claude-sonnet-5");
|
|
6646
6827
|
seedTierRow("ANTHROPIC_DEFAULT_HAIKU_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME", smallFastModel);
|
|
6647
6828
|
}
|
|
6648
|
-
seedTierRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", "claude-opus-5");
|
|
6829
|
+
if (!isMaxProfile) seedTierRow("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", "claude-opus-5");
|
|
6649
6830
|
if (process.env.CLAUDE_CODE_PLAN_V2_AGENT_COUNT === void 0) vars.CLAUDE_CODE_PLAN_V2_AGENT_COUNT = "7";
|
|
6650
6831
|
for (const key of [
|
|
6651
6832
|
"CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL",
|
|
@@ -6654,11 +6835,11 @@ function getClaudeCodeEnvVars(serverUrl, model, launchProfileId = "standard") {
|
|
|
6654
6835
|
"CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING",
|
|
6655
6836
|
"CLAUDE_CODE_ENABLE_TASKS"
|
|
6656
6837
|
]) if (process.env[key] === void 0) vars[key] = "1";
|
|
6657
|
-
const nativeModels = nativeSelectableModelsInCatalog();
|
|
6838
|
+
const nativeModels = isMaxProfile ? maxSelectableModelsInCatalog() : nativeSelectableModelsInCatalog();
|
|
6658
6839
|
if (nativeModels.length > 0) {
|
|
6659
6840
|
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";
|
|
6660
6841
|
} else clearGatewayModelCache();
|
|
6661
|
-
applyAutoCompactWindow(vars);
|
|
6842
|
+
applyAutoCompactWindow(vars, launchProfileId);
|
|
6662
6843
|
if (toolbeltEnabled()) Object.assign(vars, toolbeltPathOverride(process.env, PATHS.TOOLBELT_BIN_DIR));
|
|
6663
6844
|
return vars;
|
|
6664
6845
|
}
|
|
@@ -6703,7 +6884,7 @@ function catalogEntryForSeededModel(value) {
|
|
|
6703
6884
|
*
|
|
6704
6885
|
* Presence-guarded on the parent env, symmetric with every other guard here.
|
|
6705
6886
|
*/
|
|
6706
|
-
function applyAutoCompactWindow(vars) {
|
|
6887
|
+
function applyAutoCompactWindow(vars, launchProfileId) {
|
|
6707
6888
|
if (process.env.CLAUDE_CODE_AUTO_COMPACT_WINDOW !== void 0) return;
|
|
6708
6889
|
let tightestWindow;
|
|
6709
6890
|
const consider = (value) => {
|
|
@@ -6713,7 +6894,8 @@ function applyAutoCompactWindow(vars) {
|
|
|
6713
6894
|
if (candidateWindow !== void 0 && (tightestWindow === void 0 || candidateWindow < tightestWindow)) tightestWindow = candidateWindow;
|
|
6714
6895
|
};
|
|
6715
6896
|
for (const key of LEAD_CAPABLE_MODEL_ENV_KEYS) consider(vars[key] ?? process.env[key]);
|
|
6716
|
-
|
|
6897
|
+
const gatewayModels = launchProfileId === "max" ? maxSelectableModelsInCatalog() : nativeSelectableModelsInCatalog();
|
|
6898
|
+
for (const model of gatewayModels) consider(model.id);
|
|
6717
6899
|
if (tightestWindow === void 0) return;
|
|
6718
6900
|
vars.CLAUDE_CODE_AUTO_COMPACT_WINDOW = String(tightestWindow);
|
|
6719
6901
|
}
|
|
@@ -6741,4 +6923,4 @@ function getCodexEnvVars(serverUrl) {
|
|
|
6741
6923
|
//#endregion
|
|
6742
6924
|
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 };
|
|
6743
6925
|
|
|
6744
|
-
//# sourceMappingURL=server-setup-
|
|
6926
|
+
//# sourceMappingURL=server-setup-C_LAE8NI.js.map
|