github-router 0.3.347 → 0.3.349
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{aic-statusline-settings-YoDG20pq.js → aic-statusline-settings-DCFywz3N.js} +2 -2
- package/dist/aic-statusline-settings-DCFywz3N.js.map +1 -0
- package/dist/{attribution-settings-50S3mk4N.js → attribution-settings-BgYkynRc.js} +30 -18
- package/dist/attribution-settings-BgYkynRc.js.map +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-D0rojAcX.js → claude-Chtd07VA.js} +32 -16
- package/dist/claude-Chtd07VA.js.map +1 -0
- package/dist/{codex-kcdKpoOe.js → codex-DayPQ8t5.js} +4 -4
- package/dist/{codex-kcdKpoOe.js.map → codex-DayPQ8t5.js.map} +1 -1
- package/dist/engine-T81FYVwK.js +2 -0
- package/dist/{gate-discovery-CzZ5Oc3H.js → gate-discovery-CBOPoK9-.js} +4 -4
- package/dist/{gate-discovery-CzZ5Oc3H.js.map → gate-discovery-CBOPoK9-.js.map} +1 -1
- package/dist/hooks.mjs +684 -14
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-aic-status-CCvU7zhC.js → internal-aic-status-lM0YNDaH.js} +52 -11
- package/dist/internal-aic-status-lM0YNDaH.js.map +1 -0
- package/dist/{internal-artifact-open-lta2UPnE.js → internal-artifact-open-CXJbMXpq.js} +2 -2
- package/dist/{internal-artifact-open-lta2UPnE.js.map → internal-artifact-open-CXJbMXpq.js.map} +1 -1
- package/dist/{internal-plan-review-B4f0dpss.js → internal-plan-review-F-WbltsT.js} +3 -3
- package/dist/{internal-plan-review-B4f0dpss.js.map → internal-plan-review-F-WbltsT.js.map} +1 -1
- package/dist/internal-prompt-submit-DRCJ5kWC.js +559 -0
- package/dist/internal-prompt-submit-DRCJ5kWC.js.map +1 -0
- package/dist/{internal-session-bind-IpZ5hJzR.js → internal-session-bind-LrYEo-kg.js} +2 -2
- package/dist/{internal-session-bind-IpZ5hJzR.js.map → internal-session-bind-LrYEo-kg.js.map} +1 -1
- package/dist/{internal-stop-hook-BdVV3NyD.js → internal-stop-hook-CIe2kVss.js} +5 -5
- package/dist/{internal-stop-hook-BdVV3NyD.js.map → internal-stop-hook-CIe2kVss.js.map} +1 -1
- package/dist/{internal-stop-review-C7bOxX1q.js → internal-stop-review-nL003JIj.js} +2 -2
- package/dist/{internal-stop-review-C7bOxX1q.js.map → internal-stop-review-nL003JIj.js.map} +1 -1
- package/dist/main.js +12 -12
- package/dist/{orchestration-Ccmfslh4.js → orchestration-DjuJRhXn.js} +2 -2
- package/dist/{orchestration-Ccmfslh4.js.map → orchestration-DjuJRhXn.js.map} +1 -1
- package/dist/{peer-mcp-personas-DlmmbpD6.js → peer-mcp-personas-agpBeTgS.js} +258 -52
- package/dist/peer-mcp-personas-agpBeTgS.js.map +1 -0
- package/dist/{pi-07uTIAcP.js → pi-BLDBFXg3.js} +5 -5
- package/dist/{pi-07uTIAcP.js.map → pi-BLDBFXg3.js.map} +1 -1
- package/dist/{plan-review-hook-BTvxvCCo.js → plan-review-hook-DMqPHBBN.js} +2 -2
- package/dist/{plan-review-hook-BTvxvCCo.js.map → plan-review-hook-DMqPHBBN.js.map} +1 -1
- package/dist/prompt-submit-hook-CBGlhEpU.js +411 -0
- package/dist/prompt-submit-hook-CBGlhEpU.js.map +1 -0
- package/dist/{provision-D_rmmqTq.js → provision-BKdrO1Sv.js} +2 -2
- package/dist/{provision-D_rmmqTq.js.map → provision-BKdrO1Sv.js.map} +1 -1
- package/dist/{serve-DbrYa6zo.js → serve-p_58sDJK.js} +8 -8
- package/dist/{serve-DbrYa6zo.js.map → serve-p_58sDJK.js.map} +1 -1
- package/dist/{server-setup-CKhj8I0W.js → server-setup-PAHohZ-u.js} +86 -33
- package/dist/server-setup-PAHohZ-u.js.map +1 -0
- package/dist/{start-BXVrchgI.js → start-CTHcqkQL.js} +3 -3
- package/dist/{start-BXVrchgI.js.map → start-CTHcqkQL.js.map} +1 -1
- package/dist/{stop-gate-hook-DZVfKoSh.js → stop-gate-hook-DRcYQAtf.js} +2 -2
- package/dist/{stop-gate-hook-DZVfKoSh.js.map → stop-gate-hook-DRcYQAtf.js.map} +1 -1
- package/dist/{stop-gate-policy-Gd_cNT9-.js → stop-gate-policy-CbLklfV2.js} +21 -2
- package/dist/{stop-gate-policy-Gd_cNT9-.js.map → stop-gate-policy-CbLklfV2.js.map} +1 -1
- package/package.json +1 -1
- package/dist/aic-statusline-settings-YoDG20pq.js.map +0 -1
- package/dist/attribution-settings-50S3mk4N.js.map +0 -1
- package/dist/claude-D0rojAcX.js.map +0 -1
- package/dist/engine-BWxxbsSu.js +0 -2
- package/dist/internal-aic-status-CCvU7zhC.js.map +0 -1
- package/dist/internal-prompt-submit-DGxv_Vgl.js +0 -127
- package/dist/internal-prompt-submit-DGxv_Vgl.js.map +0 -1
- package/dist/peer-mcp-personas-DlmmbpD6.js.map +0 -1
- package/dist/prompt-submit-hook-BeLUDy_m.js +0 -173
- package/dist/prompt-submit-hook-BeLUDy_m.js.map +0 -1
- package/dist/server-setup-CKhj8I0W.js.map +0 -1
|
@@ -7,7 +7,7 @@ import { r as fetchWithTransientRetry } from "./upstream-retry-i1k1Xai2.js";
|
|
|
7
7
|
import { t as getCopilotUsage } from "./get-copilot-usage-C_6ast5h.js";
|
|
8
8
|
import { c as runCommandVoid, i as parseBoolEnv, o as resolveExecutable, r as killManagedTree, s as runCommandCapture } from "./exec-MCU1H-KZ.js";
|
|
9
9
|
import { _ as FAST_PROFILE_MODELS, f as FAST_PROFILE_ADVISOR_MODEL, i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, l as BALANCED_PROFILE_SUBAGENT_CONTEXT_TOKENS, n as BALANCED_PROFILE_LEAD_EFFORT, r as BALANCED_PROFILE_MODELS, v as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./balanced-profile-contract-XiIj4O1U.js";
|
|
10
|
-
import { $ as
|
|
10
|
+
import { $ as readIteratorWithTimeout, $t as createChatCompletions, An as oneMContextDisabled, B as injectAdvisorTool, Bt as shimDefaultsToXhigh, Cn as isBudgetClaudeLead, D as toolbeltEnabled, Dn as upstreamMaxConnections, En as upstreamAllowH2, F as ADVISOR_TOOL_INSTRUCTIONS, G as formatThinkingRepairDecline, Gn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Gt as getTokenizerFromModel, H as resolveAdvisorEffort, Hn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Ht as createMessages, I as CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS, In as CHEAPEST_PROFILE_MODELS, J as repairRejectedThinkingHistory, Jn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, K as rememberThinkingHistoryRepair, Kt as findLaunchBySecret, L as CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, Ln as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Mn as withOneMSuffixForLead, N as searchWeb, Nn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, On as classifyMessagesRoute, P as ADVISOR_INTERNAL_TOOL_NAME, Q as logStreamError, Qt as createResponses, R as FAST_ADVISOR_TOOL_INSTRUCTIONS, Sn as generateRandomPort, U as resolveAdvisorModel, Un as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, Ut as getTextTokenCount, V as isAdvisorRequested, Vt as countTokens, W as resolveCheapestAdvisorModel, Wn as CHEAP_PROFILE_MODELS, Wt as getTokenCount, X as buildOpenAIErrorEvent, Xt as warnOnTokenPriceDrift, Y as buildAnthropicErrorEvent, Yt as assembleResponsesPayload, Z as isControllerClosedError, Zt as resolveMcpToolTimeoutMs, at as handleMcpDelete, bn as UPSTREAM_FETCH_TIMEOUT_MS, en as MAX_RESPONSE_BODY_BYTES, et as relayAnthropicStream, hn as BUDGET_SMALL_FAST_SLUG, i as assertMcpToolSurfaceConsistent, it as clampEffort, jn as withOneMSuffix, kn as catalogAdvertises1M, nn as parseJsonOrDiagnose, nt as UNKNOWN_EFFORT_ANCHOR, ot as handleMcpPost, pn as toolbeltPathOverride, q as repairKnownThinkingHistory, rn as normalizeOpenAIUsage, rt as bucketEffort, st as agentToolsEnabled, tn as readResponseBodyCapped, tt as EFFORT_ORDER, xn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as buildAdvisorStream } from "./peer-mcp-personas-agpBeTgS.js";
|
|
11
11
|
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--dAYkEG1.js";
|
|
12
12
|
import { a as extractAndRecordPricedAic, f as copilotUsageToWire, h as nanoAiuToCredits, i as extractAndRecordAic, l as recordAic, m as formatAic, p as extractCopilotUsage } from "./aic-ledger-D4oMcg7c.js";
|
|
13
13
|
import consola from "consola";
|
|
@@ -576,7 +576,7 @@ const CHEAP_REVIEWER_ALIAS_ID = "gh-router-cheap-reviewer-max";
|
|
|
576
576
|
const CHEAPEST_EXPLORE_ALIAS_ID = "gh-router-cheapest-explore-high";
|
|
577
577
|
const CHEAPEST_GENERAL_PURPOSE_ALIAS_ID = "gh-router-cheapest-general-purpose-xhigh";
|
|
578
578
|
const CHEAPEST_IMPLEMENTER_ALIAS_ID = "gh-router-cheapest-implementer-max";
|
|
579
|
-
const CHEAPEST_REVIEWER_ALIAS_ID = "gh-router-cheapest-reviewer-
|
|
579
|
+
const CHEAPEST_REVIEWER_ALIAS_ID = "gh-router-cheapest-reviewer-max";
|
|
580
580
|
/**
|
|
581
581
|
* Balanced-profile subagent aliases (`-m balanced`). Same non-catalog
|
|
582
582
|
* mechanism as the cheap aliases above, with the balanced roster's own
|
|
@@ -663,7 +663,8 @@ const RETIRED_FAST_ALIAS_IDS = /* @__PURE__ */ new Set([
|
|
|
663
663
|
LUNA_IMPLEMENTER_ALIAS_ID,
|
|
664
664
|
FAST_CRITIC_ALIAS_ID,
|
|
665
665
|
"gh-router-balanced-general-purpose-high",
|
|
666
|
-
"gh-router-balanced-reviewer-max"
|
|
666
|
+
"gh-router-balanced-reviewer-max",
|
|
667
|
+
"gh-router-cheapest-reviewer-high"
|
|
667
668
|
]);
|
|
668
669
|
const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
|
|
669
670
|
[LUNA_DRIVER_ALIAS_ID, {
|
|
@@ -744,7 +745,7 @@ const MODEL_ALIAS_TABLE = /* @__PURE__ */ new Map([
|
|
|
744
745
|
[CHEAPEST_REVIEWER_ALIAS_ID, {
|
|
745
746
|
aliasId: CHEAPEST_REVIEWER_ALIAS_ID,
|
|
746
747
|
realModel: CHEAPEST_PROFILE_MODELS.reviewer,
|
|
747
|
-
absentEffortDefault: "
|
|
748
|
+
absentEffortDefault: "max"
|
|
748
749
|
}],
|
|
749
750
|
[BALANCED_EXPLORE_ALIAS_ID, {
|
|
750
751
|
aliasId: BALANCED_EXPLORE_ALIAS_ID,
|
|
@@ -1023,10 +1024,10 @@ function formatCheapPrerequisiteFailure(missing) {
|
|
|
1023
1024
|
const CHEAPEST_SUBAGENT_MIN_CONTEXT_TOKENS = CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS;
|
|
1024
1025
|
/**
|
|
1025
1026
|
* Validate the live Copilot catalog for `-m cheapest`: Luna lead at the 200K
|
|
1026
|
-
* default window, Luna Explore/GP roles, a
|
|
1027
|
-
* Oracle, and a Sol/medium Advisor — all at the
|
|
1028
|
-
* their fixed efforts and supported endpoints. There is no
|
|
1029
|
-
* lead plans directly.
|
|
1027
|
+
* default window, Luna Explore/GP roles, a Luna/max reviewer (protege of the
|
|
1028
|
+
* Sol Advisor), a Sol/high Oracle, and a Sol/medium Advisor — all at the
|
|
1029
|
+
* 200K default with their fixed efforts and supported endpoints. There is no
|
|
1030
|
+
* `Plan` role: the lead plans directly.
|
|
1030
1031
|
*
|
|
1031
1032
|
* `opts.peers === false` (the Pi `--no-peers` path) validates the LEAD only:
|
|
1032
1033
|
* no peer or native-role model is used in that launch, so requiring them
|
|
@@ -1508,17 +1509,26 @@ const CHEAP_PICKER_MODELS = Object.freeze([
|
|
|
1508
1509
|
neverOneM: true
|
|
1509
1510
|
}
|
|
1510
1511
|
]);
|
|
1511
|
-
const CHEAPEST_PICKER_MODELS = Object.freeze([
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1512
|
+
const CHEAPEST_PICKER_MODELS = Object.freeze([
|
|
1513
|
+
{
|
|
1514
|
+
id: "gpt-5.6-sol",
|
|
1515
|
+
label: "GPT-5.6 Sol",
|
|
1516
|
+
behavesAs: "claude-opus-5.5",
|
|
1517
|
+
neverOneM: true
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
id: "gpt-6-luna",
|
|
1521
|
+
label: "GPT-6 Luna",
|
|
1522
|
+
behavesAs: "claude-opus-5.5",
|
|
1523
|
+
neverOneM: true
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
id: "gpt-6-luna",
|
|
1527
|
+
label: "GPT-6 Luna (1M)",
|
|
1528
|
+
behavesAs: "claude-opus-5.5",
|
|
1529
|
+
neverOneM: false
|
|
1530
|
+
}
|
|
1531
|
+
]);
|
|
1522
1532
|
const BALANCED_PICKER_MODELS = Object.freeze([
|
|
1523
1533
|
{
|
|
1524
1534
|
id: "gpt-5.6-sol",
|
|
@@ -2514,7 +2524,7 @@ function collectToolFieldKeys(body) {
|
|
|
2514
2524
|
//#endregion
|
|
2515
2525
|
//#region package.json
|
|
2516
2526
|
var name = "github-router";
|
|
2517
|
-
var version = "0.3.
|
|
2527
|
+
var version = "0.3.349";
|
|
2518
2528
|
//#endregion
|
|
2519
2529
|
//#region src/lib/approval.ts
|
|
2520
2530
|
const awaitApproval = async () => {
|
|
@@ -5690,7 +5700,7 @@ function explicitEffortOf(value) {
|
|
|
5690
5700
|
* balanced) shares fast's effort mapping (same model-to-effort rows, just
|
|
5691
5701
|
* bare subagent slugs at the wiring layer), so this preprocess is shared.
|
|
5692
5702
|
* Note the reviewer differs: fast reviews on Sonnet 5/xhigh while cheap
|
|
5693
|
-
* reviews on Luna/max, cheapest reviews on
|
|
5703
|
+
* reviews on Luna/max, cheapest reviews on Luna/max, and balanced reviews
|
|
5694
5704
|
* on Sol/high — all rows exist here, so each profile's reviewer resolves to
|
|
5695
5705
|
* its fixed effort. The balanced LEAD is the other exception: bare Sol leads
|
|
5696
5706
|
* at medium (`BALANCED_PROFILE_LEAD_EFFORT`), not the shared high.
|
|
@@ -6098,6 +6108,28 @@ function cheapestAdvisorMetadataMismatch(rawBody) {
|
|
|
6098
6108
|
if (stripTrailingOneMSuffix(model).base !== CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL) return `the native Advisor tool requested ${JSON.stringify(model)} instead of ${JSON.stringify(CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL)}`;
|
|
6099
6109
|
}
|
|
6100
6110
|
}
|
|
6111
|
+
/**
|
|
6112
|
+
* True when the request's `model` is the cheapest reviewer's pinned alias
|
|
6113
|
+
* (bare or `[1m]`-decorated — `resolveModelAlias` strips the bracket).
|
|
6114
|
+
*
|
|
6115
|
+
* Role detection by MODEL rather than by `x-claude-code-agent-id`: classic
|
|
6116
|
+
* Task spawns send the bare role name ("reviewer"), but Agent-team teammates
|
|
6117
|
+
* send stable name-based ids ("reviewer-advisor-only[@team]"), so an
|
|
6118
|
+
* agent-id exact-match misses every teammate spawn. The frontmatter pins the
|
|
6119
|
+
* reviewer to its alias, invocation-level overrides are stripped by the
|
|
6120
|
+
* dispatch ACL, and `/model` switches affect only the lead — so the alias is
|
|
6121
|
+
* the robust discriminator across spawn styles. Fail-closed: unparseable
|
|
6122
|
+
* bodies and non-alias ids (bare Luna = lead, Explore/GP carry their own
|
|
6123
|
+
* aliases) return false.
|
|
6124
|
+
*/
|
|
6125
|
+
function isCheapestReviewerModel(rawBody) {
|
|
6126
|
+
try {
|
|
6127
|
+
const body = JSON.parse(rawBody);
|
|
6128
|
+
return typeof body.model === "string" && resolveModelAlias(body.model)?.aliasId === "gh-router-cheapest-reviewer-max";
|
|
6129
|
+
} catch {
|
|
6130
|
+
return false;
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6101
6133
|
function stripAdvisorTool(rawBody) {
|
|
6102
6134
|
let body;
|
|
6103
6135
|
try {
|
|
@@ -6235,7 +6267,8 @@ async function handleCompletion(c) {
|
|
|
6235
6267
|
const cheapProfileRequest = identity.launch?.profileId === "cheap" || identity.launch?.profileId === "cheap1m";
|
|
6236
6268
|
const cheapestProfileRequest = identity.launch?.profileId === "cheapest";
|
|
6237
6269
|
const balancedProfileRequest = identity.launch?.profileId === "balanced";
|
|
6238
|
-
const
|
|
6270
|
+
const subagentAgentId = (c.req.header("x-claude-code-agent-id") ?? "").trim();
|
|
6271
|
+
const subagentRequest = subagentAgentId.length > 0;
|
|
6239
6272
|
const fastSubagentRequest = fastProfileRequest && subagentRequest;
|
|
6240
6273
|
const maxSubagentRequest = maxProfileRequest && subagentRequest;
|
|
6241
6274
|
const cheapSubagentRequest = cheapProfileRequest && subagentRequest;
|
|
@@ -6245,12 +6278,15 @@ async function handleCompletion(c) {
|
|
|
6245
6278
|
const maxLeadAdvisor = maxProfileRequest && !maxSubagentRequest;
|
|
6246
6279
|
const cheapLeadAdvisor = cheapProfileRequest && !cheapSubagentRequest;
|
|
6247
6280
|
const cheapestLeadAdvisor = cheapestProfileRequest && !cheapestSubagentRequest;
|
|
6248
|
-
const
|
|
6281
|
+
const cheapestReviewerAdvisor = cheapestProfileRequest && (subagentAgentId === "reviewer" || isCheapestReviewerModel(rawBody));
|
|
6282
|
+
if (cheapestProfileRequest && subagentRequest) consola.debug(`cheapest subagent advisor gate: agentId=${JSON.stringify(subagentAgentId)} reviewerModel=${isCheapestReviewerModel(rawBody)} granted=${cheapestReviewerAdvisor && advisorRequested}`);
|
|
6283
|
+
const advisorEnabled = advisorRequested && !fastSubagentRequest && !maxSubagentRequest && !cheapSubagentRequest && (!cheapestSubagentRequest || cheapestReviewerAdvisor) && !balancedSubagentRequest;
|
|
6249
6284
|
const fastAdvisorEnabled = fastLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6250
6285
|
const maxAdvisorEnabled = maxLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6251
6286
|
const cheapAdvisorEnabled = cheapLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6252
6287
|
const cheapestAdvisorEnabled = cheapestLeadAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6253
|
-
const
|
|
6288
|
+
const cheapestReviewerEnabled = cheapestReviewerAdvisor && advisorRequested && hasNonEmptyTools(rawBody);
|
|
6289
|
+
const advisorBehaviorEnabled = balancedProfileRequest ? false : fastLeadAdvisor ? fastAdvisorEnabled : cheapLeadAdvisor ? cheapAdvisorEnabled : cheapestLeadAdvisor ? cheapestAdvisorEnabled : maxLeadAdvisor ? maxAdvisorEnabled : cheapestReviewerAdvisor ? cheapestReviewerEnabled : advisorEnabled;
|
|
6254
6290
|
let fastAdvisorChoice;
|
|
6255
6291
|
let maxAdvisorChoice;
|
|
6256
6292
|
if (maxAdvisorEnabled) {
|
|
@@ -6332,6 +6368,17 @@ async function handleCompletion(c) {
|
|
|
6332
6368
|
}, 503);
|
|
6333
6369
|
}
|
|
6334
6370
|
}
|
|
6371
|
+
if (cheapestReviewerEnabled && !fastAdvisorChoice) try {
|
|
6372
|
+
fastAdvisorChoice = resolveCheapestAdvisorModel();
|
|
6373
|
+
} catch (error) {
|
|
6374
|
+
return c.json({
|
|
6375
|
+
type: "error",
|
|
6376
|
+
error: {
|
|
6377
|
+
type: "api_error",
|
|
6378
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6379
|
+
}
|
|
6380
|
+
}, 503);
|
|
6381
|
+
}
|
|
6335
6382
|
const fastPreprocess = preprocessFastRequest(rawBody, identity.launch, subagentRequest);
|
|
6336
6383
|
if (fastPreprocess.retiredAlias || fastPreprocess.rejectedAlias || fastPreprocess.rejectedModel) {
|
|
6337
6384
|
const profileId = identity.launch?.profileId;
|
|
@@ -6347,7 +6394,7 @@ async function handleCompletion(c) {
|
|
|
6347
6394
|
}
|
|
6348
6395
|
let finalBody = await processWebSearch(fastPreprocess.body);
|
|
6349
6396
|
finalBody = sanitizeAnthropicBody(finalBody);
|
|
6350
|
-
if (fastSubagentRequest || maxSubagentRequest) finalBody = stripAdvisorTool(finalBody);
|
|
6397
|
+
if (fastSubagentRequest || maxSubagentRequest || cheapestSubagentRequest && !cheapestReviewerAdvisor) finalBody = stripAdvisorTool(finalBody);
|
|
6351
6398
|
const loopGuard = guardAnthropicBody(finalBody);
|
|
6352
6399
|
if (loopGuard.action === "abort") return c.json({
|
|
6353
6400
|
type: "error",
|
|
@@ -6358,7 +6405,7 @@ async function handleCompletion(c) {
|
|
|
6358
6405
|
}, 400, { "x-should-retry": "false" });
|
|
6359
6406
|
if (loopGuard.body !== void 0) finalBody = loopGuard.body;
|
|
6360
6407
|
if (advisorBehaviorEnabled) {
|
|
6361
|
-
finalBody = injectAdvisorTool(finalBody, fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
|
|
6408
|
+
finalBody = injectAdvisorTool(finalBody, cheapestReviewerAdvisor ? CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS : cheapestLeadAdvisor ? CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS : fastLeadAdvisor ? FAST_ADVISOR_TOOL_INSTRUCTIONS : maxLeadAdvisor ? MAX_PROFILE_ADVISOR_INSTRUCTIONS : void 0);
|
|
6362
6409
|
consola.info("ADVISOR enabled for this request — injecting __anthropic_advisor tool; will translate tool_use → server_tool_use{advisor} on the SSE stream");
|
|
6363
6410
|
}
|
|
6364
6411
|
if (finalBody.includes("\"mcp_servers\"")) try {
|
|
@@ -6382,7 +6429,7 @@ async function handleCompletion(c) {
|
|
|
6382
6429
|
parsedBase = JSON.parse(promptWindowBody);
|
|
6383
6430
|
} catch {}
|
|
6384
6431
|
const wantsStream = parsedBase?.stream === true;
|
|
6385
|
-
if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled) && wantsStream) {
|
|
6432
|
+
if ((fastAdvisorEnabled || cheapAdvisorEnabled || cheapestAdvisorEnabled || maxAdvisorEnabled || cheapestReviewerEnabled) && wantsStream) {
|
|
6386
6433
|
const initialConversation = Array.isArray(parsedBase.messages) ? parsedBase.messages : [];
|
|
6387
6434
|
const parsedInitial = parseAnthropicRequest(parsedBase, modelId, selectedModel);
|
|
6388
6435
|
const translatedAdvisorAborter = new AbortController();
|
|
@@ -6405,7 +6452,7 @@ async function handleCompletion(c) {
|
|
|
6405
6452
|
effort: maxAdvisorChoice.effort,
|
|
6406
6453
|
escalated: false,
|
|
6407
6454
|
fastProfile: false
|
|
6408
|
-
} : cheapAdvisorEnabled || cheapestAdvisorEnabled ? {
|
|
6455
|
+
} : cheapAdvisorEnabled || cheapestAdvisorEnabled || cheapestReviewerEnabled ? {
|
|
6409
6456
|
model: fastAdvisorChoice.model,
|
|
6410
6457
|
effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
6411
6458
|
escalated: fastAdvisorChoice.escalated,
|
|
@@ -6423,9 +6470,12 @@ async function handleCompletion(c) {
|
|
|
6423
6470
|
requestHeaders: {},
|
|
6424
6471
|
advisorModel: advisorChoice.model,
|
|
6425
6472
|
advisorEscalated: advisorChoice.escalated,
|
|
6426
|
-
advisorFastProfile: advisorChoice.fastProfile,
|
|
6473
|
+
advisorFastProfile: advisorChoice.fastProfile && !cheapestReviewerEnabled,
|
|
6427
6474
|
advisorMaxProfile: maxAdvisorEnabled,
|
|
6428
|
-
advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled,
|
|
6475
|
+
advisorCheapProfile: cheapAdvisorEnabled || cheapestAdvisorEnabled || cheapestReviewerEnabled,
|
|
6476
|
+
advisorCheapestProfile: cheapestAdvisorEnabled || cheapestReviewerEnabled,
|
|
6477
|
+
advisorReviewerProfile: cheapestReviewerEnabled,
|
|
6478
|
+
advisorMaxTurns: cheapestReviewerEnabled ? 5 : void 0,
|
|
6429
6479
|
advisorEffort: advisorChoice.effort,
|
|
6430
6480
|
externalAborter: translatedAdvisorAborter,
|
|
6431
6481
|
continueTurn: makeShimContinueTurn(endpoint, {
|
|
@@ -6548,9 +6598,12 @@ async function handleCompletion(c) {
|
|
|
6548
6598
|
requestHeaders,
|
|
6549
6599
|
advisorModel: advisorChoice.model,
|
|
6550
6600
|
advisorEscalated: advisorChoice.escalated,
|
|
6551
|
-
advisorFastProfile: fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor,
|
|
6601
|
+
advisorFastProfile: (fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor) && !cheapestReviewerEnabled,
|
|
6552
6602
|
advisorMaxProfile: maxAdvisorEnabled,
|
|
6553
|
-
advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor,
|
|
6603
|
+
advisorCheapProfile: cheapLeadAdvisor || cheapestLeadAdvisor || cheapestReviewerEnabled,
|
|
6604
|
+
advisorCheapestProfile: cheapestAdvisorEnabled || cheapestReviewerEnabled,
|
|
6605
|
+
advisorReviewerProfile: cheapestReviewerEnabled,
|
|
6606
|
+
advisorMaxTurns: cheapestReviewerEnabled ? 5 : void 0,
|
|
6554
6607
|
advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || cheapestLeadAdvisor),
|
|
6555
6608
|
externalAborter: advisorAborter
|
|
6556
6609
|
}), {
|
|
@@ -8190,4 +8243,4 @@ function getPiLaunchEnvVars(mirrorDir) {
|
|
|
8190
8243
|
//#endregion
|
|
8191
8244
|
export { formatFastPrerequisiteFailure as A, runSelfUpdate as B, CHEAP_REVIEWER_ALIAS_ID as C, formatCheap1mPrerequisiteFailure as D, formatBalancedPrerequisiteFailure as E, validateCheapProfilePrerequisites as F, updateClaude as H, validateCheapestProfilePrerequisites as I, validateFastProfilePrerequisites as L, resolveLaunchProfile as M, validateBalancedProfilePrerequisites as N, formatCheapPrerequisiteFailure as O, validateCheap1mProfilePrerequisites as P, validateMaxProfileLaunch as R, CHEAP_PLAN_ALIAS_ID as S, MAX_BROWSE_LOW_ALIAS_ID as T, checkClaudeVersion as V, CHEAPEST_EXPLORE_ALIAS_ID as _, setupAndServe as a, CHEAP_EXPLORE_ALIAS_ID as b, startKeepAwake as c, listModelsForEndpoint as d, enableFileLogging as f, BROWSE_LOW_ALIAS_ID as g, BALANCED_REVIEWER_ALIAS_ID as h, parseSharedArgs as i, profileDescriptor as j, formatCheapestPrerequisiteFailure as k, stopKeepAwake as l, BALANCED_GENERAL_PURPOSE_ALIAS_ID as m, getCodexEnvVars as n, sharedServerArgs as o, BALANCED_EXPLORE_ALIAS_ID as p, getPiLaunchEnvVars as r, LAUNCH_SECRET_HEADER as s, getClaudeCodeEnvVars as t, injectModelPickerSettingsFile as u, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as v, LUNA_SCOUT_ALIAS_ID as w, CHEAP_GENERAL_PURPOSE_ALIAS_ID as x, CHEAPEST_REVIEWER_ALIAS_ID as y, queueDetachedGlobalInstall as z };
|
|
8192
8245
|
|
|
8193
|
-
//# sourceMappingURL=server-setup-
|
|
8246
|
+
//# sourceMappingURL=server-setup-PAHohZ-u.js.map
|