github-router 0.3.367 → 0.3.369
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/ado-tools-C0sY_rX1.js +1 -0
- package/dist/{attribution-settings-wVzQvIdL.js → attribution-settings-zoBxw08y.js} +223 -191
- package/dist/attribution-settings-zoBxw08y.js.map +1 -0
- package/dist/{balanced-profile-contract-DtnTIBjL.js → balanced-profile-contract-Dm_usmw7.js} +7 -1
- package/dist/{balanced-profile-contract-DtnTIBjL.js.map → balanced-profile-contract-Dm_usmw7.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-B3pIageM.js → claude-BbIfnWbm.js} +15 -13
- package/dist/claude-BbIfnWbm.js.map +1 -0
- package/dist/{claude-md-injection-BV4tPUWo.js → claude-md-injection-BtBG1RBZ.js} +36 -11
- package/dist/claude-md-injection-BtBG1RBZ.js.map +1 -0
- package/dist/{codex-B_AMB6JM.js → codex-CZVlP2tB.js} +5 -5
- package/dist/{codex-B_AMB6JM.js.map → codex-CZVlP2tB.js.map} +1 -1
- package/dist/engine-DeIo-VIR.js +1 -0
- package/dist/{gate-discovery-CXE-7VcM.js → gate-discovery-BYyYeUnn.js} +2 -2
- package/dist/{gate-discovery-CXE-7VcM.js.map → gate-discovery-BYyYeUnn.js.map} +1 -1
- package/dist/hooks.mjs +72 -10
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-fast-dispatch-guard-DP25L_Bx.js → internal-fast-dispatch-guard-De_DJOyZ.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-DbrgO9Ab.js → internal-fast-dispatch-guard-_n-A8hgo.js} +2 -2
- package/dist/{internal-fast-dispatch-guard-DbrgO9Ab.js.map → internal-fast-dispatch-guard-_n-A8hgo.js.map} +1 -1
- package/dist/{internal-prompt-submit-DPUBQZtG.js → internal-prompt-submit-B-kKTl-8.js} +2 -2
- package/dist/{internal-prompt-submit-BaccW_CC.js → internal-prompt-submit-bi7F7pKk.js} +2 -2
- package/dist/{internal-prompt-submit-BaccW_CC.js.map → internal-prompt-submit-bi7F7pKk.js.map} +1 -1
- package/dist/{internal-rebrief-NjSlx5QY.js → internal-rebrief-B6ZJS6Mp.js} +3 -3
- package/dist/{internal-rebrief-NjSlx5QY.js.map → internal-rebrief-B6ZJS6Mp.js.map} +1 -1
- package/dist/{internal-stop-hook-B2TTl6Zp.js → internal-stop-hook-BbyobGUU.js} +2 -2
- package/dist/{internal-stop-hook-B2TTl6Zp.js.map → internal-stop-hook-BbyobGUU.js.map} +1 -1
- package/dist/main.js +9 -9
- package/dist/{peer-mcp-personas-BOgR46nM.js → peer-mcp-personas-DNtWI2C1.js} +721 -330
- package/dist/peer-mcp-personas-DNtWI2C1.js.map +1 -0
- package/dist/{pi-DcWp83mx.js → pi-Bc-MVgAo.js} +31 -12
- package/dist/{pi-DcWp83mx.js.map → pi-Bc-MVgAo.js.map} +1 -1
- package/dist/{provision-DkWR9B6I.js → provision-DUWdcY_a.js} +2 -2
- package/dist/{provision-DkWR9B6I.js.map → provision-DUWdcY_a.js.map} +1 -1
- package/dist/{serve-BGwEVDdc.js → serve-CmWOTR7m.js} +7 -7
- package/dist/{serve-BGwEVDdc.js.map → serve-CmWOTR7m.js.map} +1 -1
- package/dist/{server-setup-DVPL9iph.js → server-setup-CIzmDJzT.js} +55 -121
- package/dist/server-setup-CIzmDJzT.js.map +1 -0
- package/dist/{start-BUWx3nSr.js → start-rlpaeAtx.js} +3 -3
- package/dist/{start-BUWx3nSr.js.map → start-rlpaeAtx.js.map} +1 -1
- package/dist/state-CiwCLVDZ.js.map +1 -1
- package/dist/{static-context-pack-ChHuxBpk.js → static-context-pack-DvwLWlbe.js} +153 -17
- package/dist/static-context-pack-DvwLWlbe.js.map +1 -0
- package/package.json +1 -1
- package/dist/ado-tools-rysFZDws.js +0 -1
- package/dist/attribution-settings-wVzQvIdL.js.map +0 -1
- package/dist/claude-B3pIageM.js.map +0 -1
- package/dist/claude-md-injection-BV4tPUWo.js.map +0 -1
- package/dist/engine-D3oNrF6Z.js +0 -1
- package/dist/peer-mcp-personas-BOgR46nM.js.map +0 -1
- package/dist/server-setup-DVPL9iph.js.map +0 -1
- package/dist/static-context-pack-ChHuxBpk.js.map +0 -1
|
@@ -7,9 +7,9 @@ import { r as fetchWithTransientRetry } from "./upstream-retry-i1k1Xai2.js";
|
|
|
7
7
|
import { t as getCopilotUsage } from "./get-copilot-usage-BbGmK03C.js";
|
|
8
8
|
import { a as parseBoolEnv, c as runCommandCapture, i as killManagedTree, s as resolveExecutable, u as runCommandVoid } from "./exec-Bf8g_bIR.js";
|
|
9
9
|
import { c as FAST_PROFILE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-JOnZBgFB.js";
|
|
10
|
-
import { $ as
|
|
11
|
-
import {
|
|
12
|
-
import { i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, r as BALANCED_PROFILE_MODELS } from "./balanced-profile-contract-
|
|
10
|
+
import { $ as buildAnthropicErrorEvent, $n as catalogAdvertises1M, $t as shimDefaultsToXhigh, B as FAST_ADVISOR_TOOL_INSTRUCTIONS, Cn as effectiveLocalProfile, D as toolbeltEnabled, Dn as normalizeCloudAgentEnvironment, F as ADVISOR_TOOL_INSTRUCTIONS, G as isAdvisorRequested, Gn as UPSTREAM_INACTIVITY_TIMEOUT_MS, H as LOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, I as CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS, J as resolveCuratedAdvisorModel, K as resolveAdvisorEffort, Kn as generateRandomPort, L as CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, Ln as toolbeltPathOverride, N as searchWeb, On as normalizeKustoClusterUri, P as ADVISOR_INTERNAL_TOOL_NAME, Q as repairRejectedThinkingHistory, Qn as classifyMessagesRoute, R as CHEAPLOCAL_ADVISOR_TOOL_INSTRUCTIONS, Sn as assertCopilotModelAllowed, U as buildAdvisorStream, V as LOCAL_ADVISOR_TOOL_INSTRUCTIONS, W as injectAdvisorTool, Wn as UPSTREAM_FETCH_TIMEOUT_MS, X as rememberThinkingHistoryRepair, Xn as upstreamAllowH2, Y as formatThinkingRepairDecline, Z as repairKnownThinkingHistory, Zn as upstreamMaxConnections, _n as createResponses, an as localSessionId, ar as CHEAP_PROFILE_NATIVE_AGENT_NAMES, at as EFFORT_ORDER, bn as readResponseBodyCapped, cn as LAUNCH_BOUND_TOKEN_PREFIX, cr as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, ct as clampEffort, en as getTextTokenCount, er as oneMContextDisabled, et as buildOpenAIErrorEvent, fn as rememberLaunchSessionId, gn as resolveMcpToolTimeoutMs, gt as normalizeAdoToolsets, hn as warnOnTokenPriceDrift, ht as ADO_DEFAULT_TOOLSETS, i as assertMcpToolSurfaceConsistent, in as localBaseUrl, ir as CHEAP_PROFILE_MODELS, it as relayAnthropicStream, ln as findLaunchBySecret, lt as handleMcpDelete, mn as assembleResponsesPayload, mt as provisionAdoTools, nn as getTokenizerFromModel, nr as withOneMSuffixForLead, nt as logStreamError, on as countTokens, ot as UNKNOWN_EFFORT_ANCHOR, q as resolveAdvisorModel, qn as isBudgetClaudeLead, rr as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, rt as readIteratorWithTimeout, sn as createMessages, st as bucketEffort, tn as getTokenCount, tr as withOneMSuffix, tt as isControllerClosedError, ut as handleMcpPost, vn as createChatCompletions, vt as agentToolsEnabled, wn as normalizeOpenAIUsage, xn as parseJsonOrDiagnose, yn as MAX_RESPONSE_BODY_BYTES, z as CHEAPLOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, zn as BUDGET_SMALL_FAST_SLUG } from "./peer-mcp-personas-DNtWI2C1.js";
|
|
11
|
+
import { D as LOCAL_PROFILE_TIER_MODELS, F as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, P as CHEAPEST_PROFILE_MODELS, S as localContractFor, _ as isCheapestFamily, b as isPinnedLaunchProfile, f as balancedContractFor, g as isBalancedFamily, h as displayModelName, k as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, p as cheapestContractFor, x as local2AdvisorContract, y as isLocalFamily } from "./static-context-pack-DvwLWlbe.js";
|
|
12
|
+
import { i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, r as BALANCED_PROFILE_MODELS } from "./balanced-profile-contract-Dm_usmw7.js";
|
|
13
13
|
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-Cx5_Z1Y7.js";
|
|
14
14
|
import { f as getAzureRepoFromGit } from "./bluebird-client-C29-JOkG.js";
|
|
15
15
|
import { a as extractAndRecordPricedAic, g as nanoAiuToCredits, h as formatAic, i as extractAndRecordAic, l as recordAic, m as extractCopilotUsage, p as copilotUsageToWire, u as recordZeroCostRequest } from "./aic-ledger-_mvGW2Ev.js";
|
|
@@ -515,6 +515,30 @@ const CHEAPEST2_PROFILE = Object.freeze({
|
|
|
515
515
|
]),
|
|
516
516
|
hasCoordinator: false
|
|
517
517
|
});
|
|
518
|
+
/**
|
|
519
|
+
* The `-m cheaplocal` roster: `cheapest` exactly, with its Advisor and Oracle
|
|
520
|
+
* served by the local Anthropic-Messages endpoint rather than Copilot.
|
|
521
|
+
*
|
|
522
|
+
* The surface is inherited from the family contract and the group set is the
|
|
523
|
+
* cheapest one unchanged: the lead and natives are still Copilot calls, and the
|
|
524
|
+
* `workers` group works as it does on `cheapest` (subject to the profile's
|
|
525
|
+
* Copilot family ceiling, enforced at egress).
|
|
526
|
+
*/
|
|
527
|
+
const CHEAPLOCAL_PROFILE = Object.freeze({
|
|
528
|
+
id: "cheaplocal",
|
|
529
|
+
nativeRoster: new Set(cheapestContractFor("cheaplocal").nativeAgentNames),
|
|
530
|
+
personaAllowlist: /* @__PURE__ */ new Set(["oracle"]),
|
|
531
|
+
allowedGroups: /* @__PURE__ */ new Set([
|
|
532
|
+
"peers",
|
|
533
|
+
"search",
|
|
534
|
+
"workers",
|
|
535
|
+
"browser",
|
|
536
|
+
"ado",
|
|
537
|
+
"kusto",
|
|
538
|
+
"cloudagent"
|
|
539
|
+
]),
|
|
540
|
+
hasCoordinator: false
|
|
541
|
+
});
|
|
518
542
|
/** The `-m balanced2` roster: `balanced` with the Sol lead/reviewer at
|
|
519
543
|
* `gpt-6.1-sol` and the Oracle at `grok-4.7`. Roster unchanged. */
|
|
520
544
|
const BALANCED2_PROFILE = Object.freeze({
|
|
@@ -625,6 +649,7 @@ function profileDescriptor(id) {
|
|
|
625
649
|
if (id === "cheap") return CHEAP_PROFILE;
|
|
626
650
|
if (id === "cheapest") return CHEAPEST_PROFILE;
|
|
627
651
|
if (id === "cheapest2") return CHEAPEST2_PROFILE;
|
|
652
|
+
if (id === "cheaplocal") return CHEAPLOCAL_PROFILE;
|
|
628
653
|
if (id === "balanced") return BALANCED_PROFILE;
|
|
629
654
|
if (id === "balanced2") return BALANCED2_PROFILE;
|
|
630
655
|
if (id === "local") return LOCAL_PROFILE;
|
|
@@ -650,6 +675,7 @@ function resolveLaunchProfile(modelArg) {
|
|
|
650
675
|
if (arg === "cheap") return "cheap";
|
|
651
676
|
if (arg === "cheapest") return "cheapest";
|
|
652
677
|
if (arg === "cheapest2") return "cheapest2";
|
|
678
|
+
if (arg === "cheaplocal") return "cheaplocal";
|
|
653
679
|
if (arg === "balanced") return "balanced";
|
|
654
680
|
if (arg === "balanced2") return "balanced2";
|
|
655
681
|
if (arg === "local") return "local";
|
|
@@ -1180,7 +1206,7 @@ function validateCheapestProfilePrerequisites(catalog, opts = {}, profileId = "c
|
|
|
1180
1206
|
if (!supportsEffort(luna, "high") || !supportsEffort(luna, "max") || !supportsEffort(luna, "xhigh")) missing.push(`${contract.models.lead}: does not advertise "high", "max", and "xhigh" reasoning effort`);
|
|
1181
1207
|
if (!supportsEndpoint(luna, "responses")) missing.push(`${contract.models.lead}: does not advertise a supported Responses endpoint`);
|
|
1182
1208
|
}
|
|
1183
|
-
if (peers) {
|
|
1209
|
+
if (peers && contract.consultTransport !== "local") {
|
|
1184
1210
|
const oracle = findModel(catalog, contract.oracleModel);
|
|
1185
1211
|
if (!oracle) missing.push(`${contract.oracleModel}: absent from the live catalog`);
|
|
1186
1212
|
else {
|
|
@@ -1189,6 +1215,8 @@ function validateCheapestProfilePrerequisites(catalog, opts = {}, profileId = "c
|
|
|
1189
1215
|
if (!supportsEndpoint(oracle, "responses")) missing.push(`${contract.oracleModel}: does not advertise a supported Responses endpoint`);
|
|
1190
1216
|
if (!hasUsablePromptMetadata(oracle)) missing.push(`${contract.oracleModel}: no usable max_prompt_tokens metadata (Oracle brief)`);
|
|
1191
1217
|
}
|
|
1218
|
+
}
|
|
1219
|
+
if (peers) {
|
|
1192
1220
|
const reviewer = findModel(catalog, contract.models.reviewer);
|
|
1193
1221
|
if (!reviewer) missing.push(`${contract.models.reviewer}: absent from the live catalog`);
|
|
1194
1222
|
else {
|
|
@@ -3510,7 +3538,7 @@ function collectToolFieldKeys(body) {
|
|
|
3510
3538
|
//#endregion
|
|
3511
3539
|
//#region package.json
|
|
3512
3540
|
var name = "github-router";
|
|
3513
|
-
var version = "0.3.
|
|
3541
|
+
var version = "0.3.369";
|
|
3514
3542
|
//#endregion
|
|
3515
3543
|
//#region src/lib/approval.ts
|
|
3516
3544
|
const awaitApproval = async () => {
|
|
@@ -6812,114 +6840,6 @@ function preprocessFastRequest(rawBody, launch, subagentRequest = false) {
|
|
|
6812
6840
|
modified: true
|
|
6813
6841
|
};
|
|
6814
6842
|
}
|
|
6815
|
-
const LOCAL_DEFAULT_BASE_URL = `https://localhost:11111/v1`;
|
|
6816
|
-
let cliOverride;
|
|
6817
|
-
let warnedInert = false;
|
|
6818
|
-
function trimTrailingSlashes(value) {
|
|
6819
|
-
return value.replace(/\/+$/, "");
|
|
6820
|
-
}
|
|
6821
|
-
/**
|
|
6822
|
-
* Validate an absolute http(s) base URL and normalize it to the form the
|
|
6823
|
-
* egress concatenates (`<base>/messages`). A bare origin gains the documented
|
|
6824
|
-
* `/v1` prefix so `--localurl http://localhost:11111` and
|
|
6825
|
-
* `--localurl http://localhost:11111/v1` mean the same thing.
|
|
6826
|
-
*/
|
|
6827
|
-
function normalizeBaseUrl(raw, source) {
|
|
6828
|
-
const trimmed = raw.trim();
|
|
6829
|
-
if (trimmed.length === 0) throw new Error(`${source} must not be empty`);
|
|
6830
|
-
let parsed;
|
|
6831
|
-
try {
|
|
6832
|
-
parsed = new URL(trimmed);
|
|
6833
|
-
} catch {
|
|
6834
|
-
throw new Error(`${source} must be an absolute http(s) URL (got "${trimmed}")`);
|
|
6835
|
-
}
|
|
6836
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error(`${source} must be an http(s) URL (got "${parsed.protocol}")`);
|
|
6837
|
-
if (parsed.search.length > 0 || parsed.hash.length > 0) throw new Error(`${source} must not carry a query or fragment (got "${trimmed}")`);
|
|
6838
|
-
if (parsed.pathname === "/" || parsed.pathname === "") parsed.pathname = "/v1";
|
|
6839
|
-
return trimTrailingSlashes(parsed.toString());
|
|
6840
|
-
}
|
|
6841
|
-
function parseLocalPort(raw, source) {
|
|
6842
|
-
const trimmed = raw.trim();
|
|
6843
|
-
if (!/^\d+$/.test(trimmed)) throw new Error(`${source} must be an integer port (got "${trimmed}")`);
|
|
6844
|
-
const port = Number(trimmed);
|
|
6845
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(`${source} must be between 1 and 65535 (got "${trimmed}")`);
|
|
6846
|
-
return port;
|
|
6847
|
-
}
|
|
6848
|
-
function withPort(baseUrl, port) {
|
|
6849
|
-
const parsed = new URL(baseUrl);
|
|
6850
|
-
parsed.port = String(port);
|
|
6851
|
-
return trimTrailingSlashes(parsed.toString());
|
|
6852
|
-
}
|
|
6853
|
-
/**
|
|
6854
|
-
* Resolve the local upstream base URL.
|
|
6855
|
-
*
|
|
6856
|
-
* Precedence, highest first:
|
|
6857
|
-
* 1. `--localurl` (full base URL)
|
|
6858
|
-
* 2. `--localport` (port of the base URL resolved below)
|
|
6859
|
-
* 3. `GH_ROUTER_LOCAL_BASE_URL`
|
|
6860
|
-
* 4. `GH_ROUTER_LOCAL_PORT`
|
|
6861
|
-
* 5. `https://localhost:11111/v1`
|
|
6862
|
-
*
|
|
6863
|
-
* The default scheme is `https` because that is the only endpoint measured.
|
|
6864
|
-
* A plain-HTTP server needs an explicit `--localurl http://...`; inferring the
|
|
6865
|
-
* scheme from the port number would be exactly the guess this profile refuses
|
|
6866
|
-
* to make.
|
|
6867
|
-
*/
|
|
6868
|
-
function localBaseUrl(env = process.env) {
|
|
6869
|
-
if (cliOverride?.baseUrl !== void 0) return cliOverride.baseUrl;
|
|
6870
|
-
const envBaseRaw = (env.GH_ROUTER_LOCAL_BASE_URL ?? "").trim();
|
|
6871
|
-
const base = envBaseRaw.length > 0 ? normalizeBaseUrl(envBaseRaw, "GH_ROUTER_LOCAL_BASE_URL") : LOCAL_DEFAULT_BASE_URL;
|
|
6872
|
-
if (cliOverride?.port !== void 0) return withPort(base, cliOverride.port);
|
|
6873
|
-
const envPortRaw = (env.GH_ROUTER_LOCAL_PORT ?? "").trim();
|
|
6874
|
-
if (envPortRaw.length > 0) return withPort(base, parseLocalPort(envPortRaw, "GH_ROUTER_LOCAL_PORT"));
|
|
6875
|
-
return base;
|
|
6876
|
-
}
|
|
6877
|
-
/**
|
|
6878
|
-
* Apply the CLI-level endpoint override. Called once per launch, before
|
|
6879
|
-
* `setupAndServe` starts accepting requests. Passing an empty object clears
|
|
6880
|
-
* any previous override.
|
|
6881
|
-
*
|
|
6882
|
-
* Deliberately does NOT write `process.env`: the child environment is
|
|
6883
|
-
* filtered and rebuilt, so a module-level value is the only surface that
|
|
6884
|
-
* cannot be reinterpreted by something else downstream.
|
|
6885
|
-
*/
|
|
6886
|
-
function configureLocalEgress(override) {
|
|
6887
|
-
const baseProvided = override.baseUrl !== void 0;
|
|
6888
|
-
const portProvided = override.port !== void 0;
|
|
6889
|
-
if (!baseProvided && !portProvided) {
|
|
6890
|
-
cliOverride = void 0;
|
|
6891
|
-
warnedInert = false;
|
|
6892
|
-
return;
|
|
6893
|
-
}
|
|
6894
|
-
if (baseProvided && portProvided) throw new Error("--localurl and --localport cannot be combined; pass one endpoint spelling");
|
|
6895
|
-
if (override.profileId !== void 0 && !isLocalFamily(override.profileId)) {
|
|
6896
|
-
if (!warnedInert) {
|
|
6897
|
-
warnedInert = true;
|
|
6898
|
-
consola.warn(`--localurl/--localport only apply to the local launch profiles (profile: ${override.profileId}); ignoring`);
|
|
6899
|
-
}
|
|
6900
|
-
cliOverride = void 0;
|
|
6901
|
-
return;
|
|
6902
|
-
}
|
|
6903
|
-
if (override.baseUrl !== void 0) {
|
|
6904
|
-
cliOverride = { baseUrl: normalizeBaseUrl(override.baseUrl, "--localurl") };
|
|
6905
|
-
return;
|
|
6906
|
-
}
|
|
6907
|
-
cliOverride = { port: parseLocalPort(String(override.port), "--localport") };
|
|
6908
|
-
}
|
|
6909
|
-
/**
|
|
6910
|
-
* The session id sent upstream on the local path.
|
|
6911
|
-
*
|
|
6912
|
-
* `x-claude-code-session-id` is what the local server requires (a request
|
|
6913
|
-
* without it is a 400). It must stay stable per conversation, so the client's
|
|
6914
|
-
* own value always wins and the process-level id is only a fallback for a
|
|
6915
|
-
* caller that sent none. Never synthesize a fresh value per request: the
|
|
6916
|
-
* header exists for prompt-cache routing, and a random value defeats it.
|
|
6917
|
-
*/
|
|
6918
|
-
function localSessionId(c) {
|
|
6919
|
-
const incoming = c.req.header("x-claude-code-session-id")?.trim();
|
|
6920
|
-
if (incoming !== void 0 && incoming.length > 0) return incoming;
|
|
6921
|
-
return state.sessionId;
|
|
6922
|
-
}
|
|
6923
6843
|
//#endregion
|
|
6924
6844
|
//#region src/lib/prompt-window-salvage.ts
|
|
6925
6845
|
/**
|
|
@@ -7337,6 +7257,7 @@ async function handleCompletion(c) {
|
|
|
7337
7257
|
const startTime = Date.now();
|
|
7338
7258
|
const identity = runMessagesIdentityPreflight(c);
|
|
7339
7259
|
if (!identity.ok) return identityPreflightErrorResponse(c, identity.reason);
|
|
7260
|
+
rememberLaunchSessionId(identity.launch, c.req.header("x-claude-code-session-id"));
|
|
7340
7261
|
await checkRateLimit(state);
|
|
7341
7262
|
const rawBody = await c.req.text();
|
|
7342
7263
|
recordBodySize(rawBody.length);
|
|
@@ -7422,6 +7343,8 @@ async function handleCompletion(c) {
|
|
|
7422
7343
|
const curatedAdvisorContract = localAdvisorRequest ? local2AdvisorContract() : cheapestProfileRequest ? cheapestContractFor(identity.launch?.profileId) : void 0;
|
|
7423
7344
|
const curatedAdvisorModel = curatedAdvisorContract?.advisorModel;
|
|
7424
7345
|
const curatedAdvisorClientModel = curatedAdvisorContract?.advisorClientModel;
|
|
7346
|
+
const curatedLocalConsult = curatedAdvisorContract?.consultTransport === "local";
|
|
7347
|
+
const curatedAdvisorLocalEffort = curatedLocalConsult ? curatedAdvisorContract?.advisorEffort : void 0;
|
|
7425
7348
|
const subagentAgentId = (c.req.header("x-claude-code-agent-id") ?? "").trim();
|
|
7426
7349
|
const subagentRequest = subagentAgentId.length > 0;
|
|
7427
7350
|
const fastSubagentRequest = fastProfileRequest && subagentRequest;
|
|
@@ -7507,8 +7430,8 @@ async function handleCompletion(c) {
|
|
|
7507
7430
|
if (curatedAdvisorEnabled) {
|
|
7508
7431
|
const mismatch = cheapestAdvisorMetadataMismatch(rawBody, curatedAdvisorClientModel ?? CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL);
|
|
7509
7432
|
if (mismatch) {
|
|
7510
|
-
const curatedLabel = localAdvisorRequest ? "Local Advisor" : "Cheapest Advisor";
|
|
7511
|
-
const curatedAlias = localAdvisorRequest ? "local2" : "cheapest";
|
|
7433
|
+
const curatedLabel = localAdvisorRequest ? "Local Advisor" : curatedLocalConsult ? "Cheap local Advisor" : "Cheapest Advisor";
|
|
7434
|
+
const curatedAlias = localAdvisorRequest ? "local2" : curatedLocalConsult ? "cheaplocal" : "cheapest";
|
|
7512
7435
|
return c.json({
|
|
7513
7436
|
type: "error",
|
|
7514
7437
|
error: {
|
|
@@ -7518,7 +7441,7 @@ async function handleCompletion(c) {
|
|
|
7518
7441
|
}, 400);
|
|
7519
7442
|
}
|
|
7520
7443
|
try {
|
|
7521
|
-
fastAdvisorChoice =
|
|
7444
|
+
fastAdvisorChoice = resolveCuratedAdvisorModel(curatedAdvisorModel, curatedAdvisorContract?.consultTransport ?? "copilot");
|
|
7522
7445
|
} catch (error) {
|
|
7523
7446
|
return c.json({
|
|
7524
7447
|
type: "error",
|
|
@@ -7530,7 +7453,7 @@ async function handleCompletion(c) {
|
|
|
7530
7453
|
}
|
|
7531
7454
|
}
|
|
7532
7455
|
if (curatedReviewerEnabled && !fastAdvisorChoice) try {
|
|
7533
|
-
fastAdvisorChoice =
|
|
7456
|
+
fastAdvisorChoice = resolveCuratedAdvisorModel(curatedAdvisorModel, curatedAdvisorContract?.consultTransport ?? "copilot");
|
|
7534
7457
|
} catch (error) {
|
|
7535
7458
|
return c.json({
|
|
7536
7459
|
type: "error",
|
|
@@ -7569,6 +7492,9 @@ async function handleCompletion(c) {
|
|
|
7569
7492
|
const curatedAdvisorInstructions = localAdvisorRequest ? {
|
|
7570
7493
|
lead: LOCAL_ADVISOR_TOOL_INSTRUCTIONS,
|
|
7571
7494
|
reviewer: LOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS
|
|
7495
|
+
} : curatedLocalConsult ? {
|
|
7496
|
+
lead: CHEAPLOCAL_ADVISOR_TOOL_INSTRUCTIONS,
|
|
7497
|
+
reviewer: CHEAPLOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS
|
|
7572
7498
|
} : {
|
|
7573
7499
|
lead: CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS,
|
|
7574
7500
|
reviewer: CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS
|
|
@@ -7622,7 +7548,7 @@ async function handleCompletion(c) {
|
|
|
7622
7548
|
fastProfile: false
|
|
7623
7549
|
} : cheapAdvisorEnabled || curatedAdvisorEnabled || curatedReviewerEnabled ? {
|
|
7624
7550
|
model: fastAdvisorChoice.model,
|
|
7625
|
-
effort: resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
7551
|
+
effort: curatedAdvisorLocalEffort ?? resolveAdvisorEffort(rawBody, fastAdvisorChoice.model, true),
|
|
7626
7552
|
escalated: fastAdvisorChoice.escalated,
|
|
7627
7553
|
fastProfile: true
|
|
7628
7554
|
} : {
|
|
@@ -7644,6 +7570,10 @@ async function handleCompletion(c) {
|
|
|
7644
7570
|
advisorCheapestProfile: curatedAdvisorEnabled || curatedReviewerEnabled,
|
|
7645
7571
|
advisorReviewerProfile: curatedReviewerEnabled,
|
|
7646
7572
|
advisorLocalProfile: localAdvisorRequest,
|
|
7573
|
+
advisorLocalEgress: curatedLocalConsult ? {
|
|
7574
|
+
baseUrl: localBaseUrl(),
|
|
7575
|
+
sessionId: localSessionId(c, identity.launch?.sessionId)
|
|
7576
|
+
} : void 0,
|
|
7647
7577
|
advisorMaxTurns: curatedReviewerEnabled ? 5 : void 0,
|
|
7648
7578
|
advisorEffort: advisorChoice.effort,
|
|
7649
7579
|
externalAborter: translatedAdvisorAborter,
|
|
@@ -7781,8 +7711,12 @@ async function handleCompletion(c) {
|
|
|
7781
7711
|
baseUrl: localBaseUrl(),
|
|
7782
7712
|
sessionId: localSessionId(c)
|
|
7783
7713
|
} : void 0,
|
|
7714
|
+
advisorLocalEgress: curatedLocalConsult ? {
|
|
7715
|
+
baseUrl: localBaseUrl(),
|
|
7716
|
+
sessionId: localSessionId(c, identity.launch?.sessionId)
|
|
7717
|
+
} : void 0,
|
|
7784
7718
|
advisorMaxTurns: curatedReviewerEnabled ? 5 : void 0,
|
|
7785
|
-
advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || curatedLeadAdvisor),
|
|
7719
|
+
advisorEffort: maxAdvisorChoice ? maxAdvisorChoice.effort : curatedAdvisorLocalEffort ?? resolveAdvisorEffort(rawBody, advisorChoice.model, fastLeadAdvisor || cheapLeadAdvisor || curatedLeadAdvisor),
|
|
7786
7720
|
externalAborter: advisorAborter
|
|
7787
7721
|
}), {
|
|
7788
7722
|
status: response.status,
|
|
@@ -9601,6 +9535,6 @@ function getPiLaunchEnvVars(mirrorDir) {
|
|
|
9601
9535
|
return vars;
|
|
9602
9536
|
}
|
|
9603
9537
|
//#endregion
|
|
9604
|
-
export {
|
|
9538
|
+
export { updateClaude as $, CHEAP_EXPLORE_ALIAS_ID as A, formatFastPrerequisiteFailure as B, BALANCED_EXPLORE_ALIAS_ID as C, CHEAPEST_EXPLORE_ALIAS_ID as D, BROWSE_LOW_ALIAS_ID as E, MAX_BROWSE_LOW_ALIAS_ID as F, validateCheap1mProfilePrerequisites as G, profileDescriptor as H, formatBalancedPrerequisiteFailure as I, validateFastProfilePrerequisites as J, validateCheapProfilePrerequisites as K, formatCheap1mPrerequisiteFailure as L, CHEAP_PLAN_ALIAS_ID as M, CHEAP_REVIEWER_ALIAS_ID as N, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as O, LUNA_SCOUT_ALIAS_ID as P, checkClaudeVersion as Q, formatCheapPrerequisiteFailure as R, enableFileLogging as S, BALANCED_REVIEWER_ALIAS_ID as T, resolveLaunchProfile as U, formatLocalPrerequisiteFailure as V, validateBalancedProfilePrerequisites as W, validateMaxProfileLaunch as X, validateLocalProfilePrerequisites as Y, runSelfUpdate as Z, sweepStalePiAgentMirrors as _, setupAndServe as a, injectModelPickerSettingsFile as b, PI_MIN_VERSION as c, meetsPiMinVersion as d, refreshPiInBackground as f, removeOwnPiAgentMirror as g, ensurePiAgentMirror as h, parseSharedArgs as i, CHEAP_GENERAL_PURPOSE_ALIAS_ID as j, CHEAPEST_REVIEWER_ALIAS_ID as k, ensurePiInstalled as l, updatePi as m, getCodexEnvVars as n, sharedServerArgs as o, resolvePiRegistry as p, validateCheapestProfilePrerequisites as q, getPiLaunchEnvVars as r, LAUNCH_SECRET_HEADER as s, getClaudeCodeEnvVars as t, getInstalledPiVersion as u, startKeepAwake as v, BALANCED_GENERAL_PURPOSE_ALIAS_ID as w, listModelsForEndpoint as x, stopKeepAwake as y, formatCheapestPrerequisiteFailure as z };
|
|
9605
9539
|
|
|
9606
|
-
//# sourceMappingURL=server-setup-
|
|
9540
|
+
//# sourceMappingURL=server-setup-CIzmDJzT.js.map
|