github-router 0.3.257 → 0.3.258
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-Bf_bD4RA.js → attribution-settings-CYBfjHzd.js} +8 -8
- package/dist/attribution-settings-CYBfjHzd.js.map +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-DAG4HtaH.js → claude-DZ1VmE7I.js} +6 -6
- package/dist/{claude-DAG4HtaH.js.map → claude-DZ1VmE7I.js.map} +1 -1
- package/dist/{codex-DKyJuUiO.js → codex-DwabDTOC.js} +4 -4
- package/dist/{codex-DKyJuUiO.js.map → codex-DwabDTOC.js.map} +1 -1
- package/dist/engine-Cpu-wQ6p.js +2 -0
- package/dist/{gate-discovery-B86ByhEG.js → gate-discovery-BpHK5pIq.js} +2 -2
- package/dist/{gate-discovery-B86ByhEG.js.map → gate-discovery-BpHK5pIq.js.map} +1 -1
- package/dist/{internal-stop-hook-B8huizZ1.js → internal-stop-hook-DiqatTCG.js} +2 -2
- package/dist/{internal-stop-hook-B8huizZ1.js.map → internal-stop-hook-DiqatTCG.js.map} +1 -1
- package/dist/main.js +5 -5
- package/dist/{peer-mcp-personas-ByulAXNm.js → peer-mcp-personas-DYT9RZBk.js} +70 -3
- package/dist/peer-mcp-personas-DYT9RZBk.js.map +1 -0
- package/dist/{provision-BztATDo4.js → provision-C2wCxRK_.js} +2 -2
- package/dist/{provision-BztATDo4.js.map → provision-C2wCxRK_.js.map} +1 -1
- package/dist/{serve-CkBOQXvt.js → serve-DHTgMHKU.js} +5 -5
- package/dist/{serve-CkBOQXvt.js.map → serve-DHTgMHKU.js.map} +1 -1
- package/dist/{server-setup-CA0ZT-nq.js → server-setup-CJzxzYks.js} +96 -10
- package/dist/server-setup-CJzxzYks.js.map +1 -0
- package/dist/{start-DGiyI4Pm.js → start-DePkmXJt.js} +3 -3
- package/dist/{start-DGiyI4Pm.js.map → start-DePkmXJt.js.map} +1 -1
- package/package.json +1 -1
- package/dist/attribution-settings-Bf_bD4RA.js.map +0 -1
- package/dist/engine-BpTP4Mex.js +0 -2
- package/dist/peer-mcp-personas-ByulAXNm.js.map +0 -1
- package/dist/server-setup-CA0ZT-nq.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as searchWeb, B as readIteratorWithTimeout, Et as toolbeltPathOverride, F as isAdvisorRequested, Ft as
|
|
1
|
+
import { A as searchWeb, B as readIteratorWithTimeout, Et as toolbeltPathOverride, F as isAdvisorRequested, Ft as withOneMSuffix, H as handleMcpDelete, I as buildAnthropicErrorEvent, It as withInstallLock, L as buildOpenAIErrorEvent, M as ADVISOR_TOOL_INSTRUCTIONS, Mt as UPSTREAM_INACTIVITY_TIMEOUT_MS, N as buildAdvisorStream, Nt as generateRandomPort, P as injectAdvisorTool, R as isControllerClosedError, U as handleMcpPost, V as relayAnthropicStream, W as agentToolsEnabled, at as countTokens, ct as assembleResponsesPayload, dt as createResponses, ft as createChatCompletions, ht as parseJsonOrDiagnose, it as shimDefaultsToXhigh, j as ADVISOR_INTERNAL_TOOL_NAME, jt as UPSTREAM_FETCH_TIMEOUT_MS, lt as resolveMcpToolTimeoutMs, mt as readResponseBodyCapped, ot as createMessages, pt as MAX_RESPONSE_BODY_BYTES, r as assertMcpToolSurfaceConsistent, st as getTokenCount, ut as pickEndpoint, w as toolbeltEnabled, z as logStreamError } from "./peer-mcp-personas-DYT9RZBk.js";
|
|
2
2
|
import { t as getPackageVersion } from "./version-_Q1WpsQp.js";
|
|
3
3
|
import { i as ensurePaths, t as PATHS } from "./paths-C1cLZ7Ga.js";
|
|
4
4
|
import { C as copilotHeaders, O as state, S as copilotBaseUrl, a as cacheCopilotVersion, c as filterBetaHeader, d as resolveModel, f as sleep, g as fetchWithTransientRetry, i as tryRefreshAndRetry, l as isNullish, n as setupGitHubAgentToken, o as cacheModels, r as setupGitHubToken, s as cacheVSCodeVersion, t as setupCopilotToken, v as HTTPError, y as forwardError } from "./token-R2ocFC3M.js";
|
|
@@ -882,7 +882,7 @@ function initProxyFromEnv() {
|
|
|
882
882
|
//#endregion
|
|
883
883
|
//#region package.json
|
|
884
884
|
var name = "github-router";
|
|
885
|
-
var version = "0.3.
|
|
885
|
+
var version = "0.3.258";
|
|
886
886
|
//#endregion
|
|
887
887
|
//#region src/lib/approval.ts
|
|
888
888
|
const awaitApproval = async () => {
|
|
@@ -1706,16 +1706,54 @@ function anthropicSseStreamFromEvents(events, opts) {
|
|
|
1706
1706
|
* handler → shim → handler import cycle). `handler.ts` re-exports these for
|
|
1707
1707
|
* backward compatibility with existing imports/tests.
|
|
1708
1708
|
*/
|
|
1709
|
+
/**
|
|
1710
|
+
* Copilot's reasoning-effort tiers, lowest to highest.
|
|
1711
|
+
*
|
|
1712
|
+
* Both ends were added after the fact and both are load-bearing:
|
|
1713
|
+
*
|
|
1714
|
+
* `none` is advertised by every gpt-5.x entry in the live catalog. While it was
|
|
1715
|
+
* missing here it was treated as an UNRECOGNIZED value, so a client asking for
|
|
1716
|
+
* the MINIMUM on a model that does not offer it (gemini advertises only
|
|
1717
|
+
* low/medium/high) was anchored at the unknown-value tier and clamped to
|
|
1718
|
+
* `high` — the maximum. Listing it makes the clamp resolve to `low` instead,
|
|
1719
|
+
* which is what "nearest supported tier" should always have meant.
|
|
1720
|
+
*
|
|
1721
|
+
* `max` is advertised by `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`,
|
|
1722
|
+
* `claude-opus-5` and the 4.7/4.8 Opus lines, and Claude Code's effort picker
|
|
1723
|
+
* offers it for any model whose entry allows it. Listing it lets an explicit
|
|
1724
|
+
* selection pass through, and lets `clampEffort` land on it for a model that
|
|
1725
|
+
* advertises nothing lower.
|
|
1726
|
+
*
|
|
1727
|
+
* `bucketEffort` deliberately reaches neither end — see below.
|
|
1728
|
+
*/
|
|
1709
1729
|
const EFFORT_ORDER = [
|
|
1730
|
+
"none",
|
|
1710
1731
|
"low",
|
|
1711
1732
|
"medium",
|
|
1712
1733
|
"high",
|
|
1713
|
-
"xhigh"
|
|
1734
|
+
"xhigh",
|
|
1735
|
+
"max"
|
|
1714
1736
|
];
|
|
1737
|
+
/** Anchor for an effort value that is not a recognized tier at all.
|
|
1738
|
+
*
|
|
1739
|
+
* Deliberately NOT the top of `EFFORT_ORDER`. Callers reach this only when the
|
|
1740
|
+
* incoming value is unrecognized, which is a guess — and resolving a guess to
|
|
1741
|
+
* the most expensive tier a model advertises would silently spend more than the
|
|
1742
|
+
* caller could have meant. Anchoring here and clamping DOWN keeps the behavior
|
|
1743
|
+
* identical to before `max` joined the ladder, while `max` stays reachable by
|
|
1744
|
+
* explicit, valid selection. */
|
|
1745
|
+
const UNKNOWN_EFFORT_ANCHOR = "xhigh";
|
|
1715
1746
|
/**
|
|
1716
1747
|
* Bucket a thinking budget into a Copilot reasoning-effort string.
|
|
1717
1748
|
* `<2000`→low, `<8000`→medium, `<24000`→high, else→xhigh.
|
|
1718
1749
|
* Defaults missing/non-numeric budgets to 8000 ("high").
|
|
1750
|
+
*
|
|
1751
|
+
* The ceiling stays at `xhigh` even though `max` exists: Anthropic's
|
|
1752
|
+
* `budget_tokens` is unbounded above, so any threshold chosen for a `max`
|
|
1753
|
+
* bucket would silently re-tier existing callers whose budgets already map to
|
|
1754
|
+
* `xhigh`. `max` is reachable only by explicit selection
|
|
1755
|
+
* (`output_config.effort`), which is an unambiguous request rather than an
|
|
1756
|
+
* inference from a token count.
|
|
1719
1757
|
*/
|
|
1720
1758
|
function bucketEffort(budget) {
|
|
1721
1759
|
const n = typeof budget === "number" && Number.isFinite(budget) ? budget : 8e3;
|
|
@@ -2049,6 +2087,45 @@ function parseReasoningEffort(thinking, model) {
|
|
|
2049
2087
|
return Array.isArray(supported) && supported.length > 0 ? clampEffort(bucketed, supported) : bucketed;
|
|
2050
2088
|
}
|
|
2051
2089
|
/**
|
|
2090
|
+
* Client-selected reasoning effort in Copilot shape (`output_config.effort`) —
|
|
2091
|
+
* what Claude Code's effort picker puts on the wire.
|
|
2092
|
+
*
|
|
2093
|
+
* This is the highest-precedence signal, matching the rule the passthrough path
|
|
2094
|
+
* already documents ("client-supplied `output_config.effort` always wins",
|
|
2095
|
+
* `routes/messages/handler.ts`). Before it was read here the field survived
|
|
2096
|
+
* every preprocessing step and was then simply dropped by the shim, which made
|
|
2097
|
+
* the picker a no-op on non-Claude models in three distinct ways: alone it fell
|
|
2098
|
+
* through to the `high` default, alongside a `thinking` budget it lost to the
|
|
2099
|
+
* bucketed budget, and alongside `thinking:{type:"adaptive"}` it produced NO
|
|
2100
|
+
* reasoning field at all (the adaptive shape is neither `undefined` nor
|
|
2101
|
+
* `enabled`, so both of the other branches decline it).
|
|
2102
|
+
*
|
|
2103
|
+
* `clampOutputConfigEffortInPlace` has normally already clamped this against the
|
|
2104
|
+
* model's allowlist upstream, but the clamp is repeated here so the shim is
|
|
2105
|
+
* correct when called directly, and so an unrecognized level (a future Copilot
|
|
2106
|
+
* tier) resolves the same way it does on the passthrough path: anchored at
|
|
2107
|
+
* `UNKNOWN_EFFORT_ANCHOR` and clamped DOWN to the highest the model actually
|
|
2108
|
+
* advertises, never up.
|
|
2109
|
+
*
|
|
2110
|
+
* When the model advertises NO allowlist there is nothing to validate against,
|
|
2111
|
+
* so only a recognized tier is honored and anything else declines to the
|
|
2112
|
+
* `thinking`/default chain. Passing an arbitrary string through would let a
|
|
2113
|
+
* typo become a synthesized `reasoning.effort` on a payload we build, which is
|
|
2114
|
+
* the 400 that `defaultReasoningEffort` already refuses to risk by returning
|
|
2115
|
+
* undefined in exactly this case.
|
|
2116
|
+
*/
|
|
2117
|
+
function parseOutputConfigEffort(body, model) {
|
|
2118
|
+
const oc = body.output_config;
|
|
2119
|
+
if (!oc || typeof oc !== "object") return void 0;
|
|
2120
|
+
const effort = oc.effort;
|
|
2121
|
+
if (typeof effort !== "string" || effort === "") return void 0;
|
|
2122
|
+
const known = EFFORT_ORDER.includes(effort);
|
|
2123
|
+
const supported = model?.capabilities?.supports?.reasoning_effort;
|
|
2124
|
+
if (!(Array.isArray(supported) && supported.length > 0)) return known ? effort : void 0;
|
|
2125
|
+
if (supported.includes(effort)) return effort;
|
|
2126
|
+
return clampEffort(known ? effort : UNKNOWN_EFFORT_ANCHOR, supported);
|
|
2127
|
+
}
|
|
2128
|
+
/**
|
|
2052
2129
|
* Parse an already-JSON-parsed Anthropic Messages body into the neutral shape.
|
|
2053
2130
|
* `resolvedModel` is the catalog id the request will run on; `model` its
|
|
2054
2131
|
* catalog entry (for the reasoning-effort allowlist).
|
|
@@ -2068,7 +2145,7 @@ function parseAnthropicRequest(body, resolvedModel, model) {
|
|
|
2068
2145
|
tools,
|
|
2069
2146
|
toolChoice: parseToolChoice(body.tool_choice),
|
|
2070
2147
|
parallelToolCalls: parseDisableParallelToolUse(body.tool_choice),
|
|
2071
|
-
reasoningEffort: body.thinking === void 0 ? defaultReasoningEffort(model) : parseReasoningEffort(body.thinking, model),
|
|
2148
|
+
reasoningEffort: parseOutputConfigEffort(body, model) ?? (body.thinking === void 0 ? defaultReasoningEffort(model) : parseReasoningEffort(body.thinking, model)),
|
|
2072
2149
|
maxOutputTokens: maxTokens,
|
|
2073
2150
|
stopSequences: stopSequences && stopSequences.length > 0 ? stopSequences : void 0,
|
|
2074
2151
|
stream: body.stream === true
|
|
@@ -3405,7 +3482,7 @@ function clampOutputConfigEffortInPlace(body, model) {
|
|
|
3405
3482
|
const current = oc.effort;
|
|
3406
3483
|
if (typeof current !== "string") return false;
|
|
3407
3484
|
if (supported.includes(current)) return false;
|
|
3408
|
-
const clamped = clampEffort(EFFORT_ORDER.includes(current) ? current :
|
|
3485
|
+
const clamped = clampEffort(EFFORT_ORDER.includes(current) ? current : UNKNOWN_EFFORT_ANCHOR, supported);
|
|
3409
3486
|
if (clamped === current) return false;
|
|
3410
3487
|
oc.effort = clamped;
|
|
3411
3488
|
return true;
|
|
@@ -4557,9 +4634,9 @@ function parseSharedArgs(args) {
|
|
|
4557
4634
|
*
|
|
4558
4635
|
* Display labels only: the gateway-model cache schema Claude Code reads is
|
|
4559
4636
|
* `{id, display_name?}` per model — there is NO per-model context-window
|
|
4560
|
-
* field
|
|
4561
|
-
*
|
|
4562
|
-
*
|
|
4637
|
+
* field. Context accounting is instead driven off the id itself, via the
|
|
4638
|
+
* `[1m]` literal-bracket suffix `nativeSelectableModelsInCatalog` attaches to
|
|
4639
|
+
* every row the catalog says serves >=1M. See `withOneMSuffix`.
|
|
4563
4640
|
*/
|
|
4564
4641
|
const NATIVE_NON_CLAUDE_MODELS = [
|
|
4565
4642
|
{
|
|
@@ -4591,13 +4668,22 @@ const NATIVE_NON_CLAUDE_MODELS = [
|
|
|
4591
4668
|
* dropped — the caller then neither enables discovery nor writes a cache
|
|
4592
4669
|
* for it, and lesser tiers see the unchanged picker. Pure (reads
|
|
4593
4670
|
* `state.models`), so it is unit-testable without side effects.
|
|
4671
|
+
*
|
|
4672
|
+
* The projected id carries a `[1m]` suffix when the catalog advertises a
|
|
4673
|
+
* >=1M window for it, because Claude Code budgets a gateway-discovered row
|
|
4674
|
+
* at its 200K default otherwise — `gpt-5.6-sol` (1,050,000) would compact at
|
|
4675
|
+
* roughly a fifth of its real window. `withOneMSuffix` is catalog-gated, so
|
|
4676
|
+
* `gpt-5.3-codex` (400K) stays bare and keeps the conservative accounting;
|
|
4677
|
+
* over-budgeting it would trade premature compaction for a hard overflow.
|
|
4678
|
+
* The lookup below still keys off the BARE id — the decoration is applied
|
|
4679
|
+
* only to the value handed to Claude Code.
|
|
4594
4680
|
*/
|
|
4595
4681
|
function nativeSelectableModelsInCatalog() {
|
|
4596
4682
|
const catalog = state.models?.data;
|
|
4597
4683
|
if (!catalog || catalog.length === 0) return [];
|
|
4598
4684
|
const present = new Set(catalog.map((m) => m.id));
|
|
4599
4685
|
return NATIVE_NON_CLAUDE_MODELS.filter((m) => present.has(m.id)).map((m) => ({
|
|
4600
|
-
id: m.id,
|
|
4686
|
+
id: withOneMSuffix(m.id),
|
|
4601
4687
|
display_name: m.displayName
|
|
4602
4688
|
}));
|
|
4603
4689
|
}
|
|
@@ -4773,4 +4859,4 @@ function getCodexEnvVars(serverUrl) {
|
|
|
4773
4859
|
//#endregion
|
|
4774
4860
|
export { sharedServerArgs as a, listModelsForEndpoint as c, updateClaude as d, setupAndServe as i, runSelfUpdate as l, getCodexEnvVars as n, startKeepAwake as o, parseSharedArgs as r, stopKeepAwake as s, getClaudeCodeEnvVars as t, checkClaudeVersion as u };
|
|
4775
4861
|
|
|
4776
|
-
//# sourceMappingURL=server-setup-
|
|
4862
|
+
//# sourceMappingURL=server-setup-CJzxzYks.js.map
|