github-router 0.3.257 → 0.3.261

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.
Files changed (79) hide show
  1. package/dist/{attribution-settings-Bf_bD4RA.js → attribution-settings-Bl0HHJQF.js} +9 -9
  2. package/dist/attribution-settings-Bl0HHJQF.js.map +1 -0
  3. package/dist/{auth-CP4q2CjO.js → auth-I8k2OOvA.js} +3 -3
  4. package/dist/{auth-CP4q2CjO.js.map → auth-I8k2OOvA.js.map} +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/{check-usage-6PB5IUFb.js → check-usage-SOn7-cWc.js} +4 -4
  7. package/dist/{check-usage-6PB5IUFb.js.map → check-usage-SOn7-cWc.js.map} +1 -1
  8. package/dist/{claude-DAG4HtaH.js → claude-CEaI47j7.js} +17 -14
  9. package/dist/claude-CEaI47j7.js.map +1 -0
  10. package/dist/{codex-DKyJuUiO.js → codex-C6Eyz3EV.js} +9 -6
  11. package/dist/codex-C6Eyz3EV.js.map +1 -0
  12. package/dist/{debug-CjmE9sgG.js → debug-vshv4nIv.js} +2 -2
  13. package/dist/{debug-CjmE9sgG.js.map → debug-vshv4nIv.js.map} +1 -1
  14. package/dist/engine-B4Ohhv5i.js +2 -0
  15. package/dist/{file-log-reporter-IFQcL5IK.js → file-log-reporter-vI8qCFNM.js} +2 -2
  16. package/dist/{file-log-reporter-IFQcL5IK.js.map → file-log-reporter-vI8qCFNM.js.map} +1 -1
  17. package/dist/{gate-discovery-B86ByhEG.js → gate-discovery-BnPhH_AC.js} +5 -5
  18. package/dist/{gate-discovery-B86ByhEG.js.map → gate-discovery-BnPhH_AC.js.map} +1 -1
  19. package/dist/{get-copilot-usage-DD1N0Xlh.js → get-copilot-usage-CYpAsYrM.js} +2 -2
  20. package/dist/{get-copilot-usage-DD1N0Xlh.js.map → get-copilot-usage-CYpAsYrM.js.map} +1 -1
  21. package/dist/{internal-artifact-open-D2cQ2QCw.js → internal-artifact-open-CZGO831M.js} +2 -2
  22. package/dist/{internal-artifact-open-D2cQ2QCw.js.map → internal-artifact-open-CZGO831M.js.map} +1 -1
  23. package/dist/{internal-plan-review-ipnT3bhj.js → internal-plan-review-6gkcOAjT.js} +3 -3
  24. package/dist/{internal-plan-review-ipnT3bhj.js.map → internal-plan-review-6gkcOAjT.js.map} +1 -1
  25. package/dist/{internal-prompt-submit-DOj75_hh.js → internal-prompt-submit-CSJR24-y.js} +4 -4
  26. package/dist/{internal-prompt-submit-DOj75_hh.js.map → internal-prompt-submit-CSJR24-y.js.map} +1 -1
  27. package/dist/{internal-session-bind-DwK2iGW0.js → internal-session-bind-DtSBTkQe.js} +2 -2
  28. package/dist/{internal-session-bind-DwK2iGW0.js.map → internal-session-bind-DtSBTkQe.js.map} +1 -1
  29. package/dist/{internal-stop-hook-B8huizZ1.js → internal-stop-hook-CiflCJO-.js} +5 -5
  30. package/dist/{internal-stop-hook-B8huizZ1.js.map → internal-stop-hook-CiflCJO-.js.map} +1 -1
  31. package/dist/{internal-stop-review-AUcFssrW.js → internal-stop-review-_1Mqz7eT.js} +2 -2
  32. package/dist/{internal-stop-review-AUcFssrW.js.map → internal-stop-review-_1Mqz7eT.js.map} +1 -1
  33. package/dist/{lifecycle-Byw5s1G8.js → lifecycle-Bd1Fyf4B.js} +100 -3
  34. package/dist/lifecycle-Bd1Fyf4B.js.map +1 -0
  35. package/dist/lifecycle-CRTWEbiP.js +2 -0
  36. package/dist/lifecycle-DUPXAOQS.js +2 -0
  37. package/dist/{lifecycle-DD88ka3f.js → lifecycle-DjC9tC1A.js} +2 -2
  38. package/dist/{lifecycle-DD88ka3f.js.map → lifecycle-DjC9tC1A.js.map} +1 -1
  39. package/dist/main.js +14 -14
  40. package/dist/{models-B6UnGyRo.js → models-uQgsKNNC.js} +3 -3
  41. package/dist/{models-B6UnGyRo.js.map → models-uQgsKNNC.js.map} +1 -1
  42. package/dist/{orchestration-hRU4TdWr.js → orchestration-BiZviyam.js} +2 -2
  43. package/dist/{orchestration-hRU4TdWr.js.map → orchestration-BiZviyam.js.map} +1 -1
  44. package/dist/{paths-C1cLZ7Ga.js → paths-BXrbboAS.js} +3 -3
  45. package/dist/{paths-C1cLZ7Ga.js.map → paths-BXrbboAS.js.map} +1 -1
  46. package/dist/paths-Dz1WyRJG.js +2 -0
  47. package/dist/{peer-mcp-personas-ByulAXNm.js → peer-mcp-personas-V4AXhm9B.js} +414 -59
  48. package/dist/peer-mcp-personas-V4AXhm9B.js.map +1 -0
  49. package/dist/{plan-review-hook-C8x0uKPf.js → plan-review-hook-Bo4y1r3j.js} +2 -2
  50. package/dist/{plan-review-hook-C8x0uKPf.js.map → plan-review-hook-Bo4y1r3j.js.map} +1 -1
  51. package/dist/{prompt-submit-hook-BrkkLAAB.js → prompt-submit-hook-BFRFLSk5.js} +2 -2
  52. package/dist/{prompt-submit-hook-BrkkLAAB.js.map → prompt-submit-hook-BFRFLSk5.js.map} +1 -1
  53. package/dist/{provision-BztATDo4.js → provision-BLwsOFCI.js} +4 -4
  54. package/dist/{provision-BztATDo4.js.map → provision-BLwsOFCI.js.map} +1 -1
  55. package/dist/{serve-CkBOQXvt.js → serve-De-kqWXM.js} +10 -10
  56. package/dist/{serve-CkBOQXvt.js.map → serve-De-kqWXM.js.map} +1 -1
  57. package/dist/{server-setup-CA0ZT-nq.js → server-setup-BeeT8m-w.js} +99 -13
  58. package/dist/server-setup-BeeT8m-w.js.map +1 -0
  59. package/dist/{start-DGiyI4Pm.js → start-DEC0M8UH.js} +8 -5
  60. package/dist/start-DEC0M8UH.js.map +1 -0
  61. package/dist/{stop-gate-hook-DQc2KV7B.js → stop-gate-hook-DoYD9Wt8.js} +2 -2
  62. package/dist/{stop-gate-hook-DQc2KV7B.js.map → stop-gate-hook-DoYD9Wt8.js.map} +1 -1
  63. package/dist/{stop-gate-policy-CHwWbuF_.js → stop-gate-policy-CoMKWSsS.js} +2 -2
  64. package/dist/{stop-gate-policy-CHwWbuF_.js.map → stop-gate-policy-CoMKWSsS.js.map} +1 -1
  65. package/dist/{token-R2ocFC3M.js → token-DWknHe9M.js} +23 -2
  66. package/dist/token-DWknHe9M.js.map +1 -0
  67. package/package.json +1 -1
  68. package/dist/attribution-settings-Bf_bD4RA.js.map +0 -1
  69. package/dist/claude-DAG4HtaH.js.map +0 -1
  70. package/dist/codex-DKyJuUiO.js.map +0 -1
  71. package/dist/engine-BpTP4Mex.js +0 -2
  72. package/dist/lifecycle-Byw5s1G8.js.map +0 -1
  73. package/dist/lifecycle-D80CaWie.js +0 -2
  74. package/dist/lifecycle-DzqCqDlM.js +0 -2
  75. package/dist/paths-CwKwc2pi.js +0 -2
  76. package/dist/peer-mcp-personas-ByulAXNm.js.map +0 -1
  77. package/dist/server-setup-CA0ZT-nq.js.map +0 -1
  78. package/dist/start-DGiyI4Pm.js.map +0 -1
  79. package/dist/token-R2ocFC3M.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { A as searchWeb, B as readIteratorWithTimeout, Et as toolbeltPathOverride, F as isAdvisorRequested, Ft as withInstallLock, H as handleMcpDelete, I as buildAnthropicErrorEvent, 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-ByulAXNm.js";
1
+ import { A as searchWeb, B as readIteratorWithTimeout, Dt as toolbeltPathOverride, F as isAdvisorRequested, H as handleMcpDelete, I as buildAnthropicErrorEvent, It as withOneMSuffix, L as buildOpenAIErrorEvent, Lt as withInstallLock, M as ADVISOR_TOOL_INSTRUCTIONS, Mt as UPSTREAM_FETCH_TIMEOUT_MS, N as buildAdvisorStream, Nt as UPSTREAM_INACTIVITY_TIMEOUT_MS, P as injectAdvisorTool, Pt as generateRandomPort, 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, 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-V4AXhm9B.js";
2
2
  import { t as getPackageVersion } from "./version-_Q1WpsQp.js";
3
- import { i as ensurePaths, t as PATHS } from "./paths-C1cLZ7Ga.js";
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";
5
- import { t as getCopilotUsage } from "./get-copilot-usage-DD1N0Xlh.js";
3
+ import { i as ensurePaths, t as PATHS } from "./paths-BXrbboAS.js";
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-DWknHe9M.js";
5
+ import { t as getCopilotUsage } from "./get-copilot-usage-CYpAsYrM.js";
6
6
  import { a as resolveExecutable, n as killManagedTree, o as runCommandCapture, r as parseBoolEnv, s as runCommandVoid } from "./exec-DTO2oin0.js";
7
7
  import consola from "consola";
8
8
  import * as fs$2 from "node:fs";
@@ -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.257";
885
+ var version = "0.3.261";
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 : "xhigh", supported);
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, so context accounting for a selected row uses Claude Code's
4561
- * default window (safe under-accounting: it compacts earlier than the real
4562
- * 1M/400k window, never overflows). See `seedGatewayModelCache`.
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-CA0ZT-nq.js.map
4862
+ //# sourceMappingURL=server-setup-BeeT8m-w.js.map