github-router 0.3.34 → 0.3.35
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/main.js +24 -30
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -929,31 +929,15 @@ async function autoUpdateClaude(latestVersion) {
|
|
|
929
929
|
//#endregion
|
|
930
930
|
//#region src/lib/port.ts
|
|
931
931
|
const DEFAULT_PORT = 8787;
|
|
932
|
-
/**
|
|
933
|
-
* Default model for `github-router claude`. The Anthropic-published dashed
|
|
934
|
-
* slug (`claude-opus-4-7`) — NOT the Copilot-internal slug
|
|
935
|
-
* (`claude-opus-4.7-1m-internal`) — because Claude Code 2.1.126's `/model`
|
|
936
|
-
* UI is backed by a hardcoded registry of Anthropic slugs, and an
|
|
937
|
-
* unrecognized slug causes the menu to highlight "Opus 4" with a
|
|
938
|
-
* "Newer version available" hint instead of "Opus 4.7 (1M context)".
|
|
939
|
-
*
|
|
940
|
-
* The proxy's `resolveModel` (`src/lib/utils.ts`) translates this to
|
|
941
|
-
* Copilot's `claude-opus-4.7-1m-internal` (enterprise) or
|
|
942
|
-
* `claude-opus-4.7` (Pro+/Business/Max) at request time via the
|
|
943
|
-
* family-preference + version-match branch — round-trip covered by
|
|
944
|
-
* `tests/lib-utils.test.ts:154`.
|
|
945
|
-
*
|
|
946
|
-
* `DEFAULT_CLAUDE_MODEL_FALLBACKS` covers major.minor regressions only;
|
|
947
|
-
* 1M↔200K downgrade is handled inside the resolver, so we don't need
|
|
948
|
-
* separate `-1m` entries here.
|
|
949
|
-
*/
|
|
950
|
-
const DEFAULT_CLAUDE_MODEL = "claude-opus-4-7";
|
|
951
932
|
const DEFAULT_CLAUDE_MODEL_FALLBACKS = ["claude-opus-4-6", "claude-opus-4-5"];
|
|
952
933
|
/**
|
|
953
934
|
* Cap-aware default picker for `ANTHROPIC_MODEL` on the implicit-default
|
|
954
|
-
* path. Returns `claude-opus
|
|
955
|
-
* contains
|
|
956
|
-
* `
|
|
935
|
+
* path. Returns `claude-opus-${family}[1m]` when the live Copilot catalog
|
|
936
|
+
* contains an `opus-${family}-1m*` variant (enterprise tier), else the
|
|
937
|
+
* bare `claude-opus-${family}` slug. `family` defaults to `"4.7"` so the
|
|
938
|
+
* no-arg call preserves the original behavior; explicit values like
|
|
939
|
+
* `"4.6"` or `"4.8"` are used to honor the `github-router claude
|
|
940
|
+
* -m <version>` family shorthand.
|
|
957
941
|
*
|
|
958
942
|
* The `[1m]` literal-bracket suffix is Claude Code's local 1M-context
|
|
959
943
|
* unlock — cc-backup `src/utils/context.ts:35-40` matches `/\[1m\]/i`
|
|
@@ -980,12 +964,21 @@ const DEFAULT_CLAUDE_MODEL_FALLBACKS = ["claude-opus-4-6", "claude-opus-4-5"];
|
|
|
980
964
|
* can't tell the difference between "no catalog yet" and "no 1M
|
|
981
965
|
* variant" — defaulting safe-side preserves the pre-change behavior).
|
|
982
966
|
*/
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
967
|
+
const DEFAULT_OPUS_FAMILY = "4.7";
|
|
968
|
+
function pickClaudeDefault(opusFamily = DEFAULT_OPUS_FAMILY) {
|
|
969
|
+
const dotted = opusFamily.replace(/-/g, ".");
|
|
970
|
+
const bareSlug = `claude-opus-${dotted.replace(/\./g, "-")}`;
|
|
971
|
+
const versionPattern = dotted.replace(/\./g, "[.-]");
|
|
972
|
+
const oneMRegex = new RegExp(`opus-${versionPattern}-1m(?:$|-)`, "i");
|
|
973
|
+
const familyRegex = new RegExp(`opus-${versionPattern}(?:$|[-.])`, "i");
|
|
974
|
+
const models = state.models?.data ?? [];
|
|
975
|
+
const has1m = models.some((m) => oneMRegex.test(m.id));
|
|
976
|
+
if (opusFamily !== DEFAULT_OPUS_FAMILY && state.models && models.length > 0 && !models.some((m) => familyRegex.test(m.id))) consola.warn(`Requested Opus family "${dotted}" not found in Copilot catalog; using "${bareSlug}" anyway (resolveModel may not find a backend for it).`);
|
|
977
|
+
if (has1m) {
|
|
978
|
+
consola.info(`Catalog contains opus-${dotted}-1m variant; defaulting ANTHROPIC_MODEL to "${bareSlug}[1m]" so Claude Code accounts for 1M context locally. Set CLAUDE_CODE_DISABLE_1M_CONTEXT=1 to opt out (HIPAA), or pass --model ${bareSlug} to pin 200K.`);
|
|
979
|
+
return `${bareSlug}[1m]`;
|
|
987
980
|
}
|
|
988
|
-
return
|
|
981
|
+
return bareSlug;
|
|
989
982
|
}
|
|
990
983
|
/**
|
|
991
984
|
* Default model for `github-router codex`. `gpt-5.5` is the new flagship
|
|
@@ -10902,7 +10895,7 @@ function initProxyFromEnv() {
|
|
|
10902
10895
|
//#endregion
|
|
10903
10896
|
//#region package.json
|
|
10904
10897
|
var name = "github-router";
|
|
10905
|
-
var version = "0.3.
|
|
10898
|
+
var version = "0.3.35";
|
|
10906
10899
|
|
|
10907
10900
|
//#endregion
|
|
10908
10901
|
//#region src/lib/approval.ts
|
|
@@ -13023,7 +13016,7 @@ const claude = defineCommand({
|
|
|
13023
13016
|
model: {
|
|
13024
13017
|
alias: "m",
|
|
13025
13018
|
type: "string",
|
|
13026
|
-
description: "Override the default model for Claude Code"
|
|
13019
|
+
description: "Override the default model for Claude Code. Accepts a full slug (e.g. claude-opus-4-7) or an Opus family shorthand (e.g. 4.7, 4.8, 4.6) which expands to the best variant for that family — adding the [1m] suffix when a 1M-context backend is in the catalog."
|
|
13027
13020
|
},
|
|
13028
13021
|
"codex-mcp": {
|
|
13029
13022
|
type: "boolean",
|
|
@@ -13102,7 +13095,8 @@ const claude = defineCommand({
|
|
|
13102
13095
|
}
|
|
13103
13096
|
enableFileLogging();
|
|
13104
13097
|
const usingDefault = !args.model;
|
|
13105
|
-
|
|
13098
|
+
const opusFamilyShorthand = args.model?.match(/^(\d+\.\d+)$/)?.[1];
|
|
13099
|
+
let chosenSlug = opusFamilyShorthand ? pickClaudeDefault(opusFamilyShorthand) : args.model ?? pickClaudeDefault();
|
|
13106
13100
|
let resolvedSlug = resolveModel(chosenSlug);
|
|
13107
13101
|
if (usingDefault && state.models) {
|
|
13108
13102
|
const inCache = (slug) => state.models?.data.some((m) => m.id === resolveModel(slug)) ?? false;
|