betahi-copilot-bridge 0.20.13 → 0.20.14

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">copilot-bridge</h1>
2
2
 
3
3
  <p align="center">
4
- <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.13" alt="npm version"></a>
4
+ <a href="https://www.npmjs.com/package/betahi-copilot-bridge"><img src="https://img.shields.io/npm/v/betahi-copilot-bridge.svg?v=0.20.14" alt="npm version"></a>
5
5
  <a href="https://github.com/betahi/copilot-bridge/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/betahi-copilot-bridge.svg" alt="license"></a>
6
6
  </p>
7
7
 
package/dist/main.js CHANGED
@@ -823,17 +823,11 @@ const MODEL_CAPABILITIES = [
823
823
  },
824
824
  ...[{
825
825
  id: "claude-opus-4.7",
826
- supported: [
827
- "low",
828
- "medium",
829
- "high",
830
- "xhigh",
831
- "max"
826
+ aliases: [
827
+ "claude-opus-4.7-1m",
828
+ "claude-opus-4.7-[1m]",
829
+ "claude-opus-4.7-1m-internal"
832
830
  ],
833
- defaultEffort: "medium"
834
- }, {
835
- id: "claude-opus-4.7-1m-internal",
836
- aliases: ["claude-opus-4.7-1m"],
837
831
  supported: [
838
832
  "low",
839
833
  "medium",
@@ -854,19 +848,7 @@ const MODEL_CAPABILITIES = [
854
848
  })),
855
849
  {
856
850
  id: "claude-opus-4.6",
857
- fallback: "chat-completions",
858
- reasoning: {
859
- supported: [
860
- "low",
861
- "medium",
862
- "high",
863
- "max"
864
- ],
865
- default: "medium"
866
- }
867
- },
868
- {
869
- id: "claude-opus-4.6-1m",
851
+ aliases: ["claude-opus-4.6-1m", "claude-opus-4.6-[1m]"],
870
852
  fallback: "chat-completions",
871
853
  reasoning: {
872
854
  supported: [
@@ -1725,10 +1707,16 @@ embeddingRoutes.post("/", async (c) => {
1725
1707
  //#region src/lib/models-resolver.ts
1726
1708
  const normalizeModelId = (modelId) => modelId.trim().toLowerCase().replaceAll(/[\s._-]+/g, "");
1727
1709
  const mapClaudeOneMillionModelId = (modelId) => {
1728
- if (modelId === "claude-opus-4.7-1m") return "claude-opus-4.7-1m-internal";
1710
+ if (modelId === "claude-opus-4.6-1m") return "claude-opus-4.6";
1711
+ if (modelId === "claude-opus-4.7-1m") return "claude-opus-4.7";
1712
+ if (modelId === "claude-opus-4.7-1m-internal") return "claude-opus-4.7";
1729
1713
  if (modelId === "claude-opus-4.8-1m") return "claude-opus-4.8";
1730
1714
  return modelId;
1731
1715
  };
1716
+ const isClaudeOneMillionAlias = (modelId) => {
1717
+ const id = modelId.trim().toLowerCase();
1718
+ return /^claude-opus-4[.-][678](?:-\d{8})?-?\[1m\]$/.test(id) || /^claude-opus-4[.-][678]-1m(?:-internal)?(?:-\d{8})?$/.test(id);
1719
+ };
1732
1720
  const stripSnapshotSuffix = (modelId) => {
1733
1721
  const id = modelId.trim().toLowerCase().replace(/-\[1m\]$/, "-1m").replace(/\[1m\]$/, "-1m");
1734
1722
  const mappedId = mapClaudeOneMillionModelId(id);
@@ -1789,7 +1777,10 @@ const getBestPrefixMatches = (models, aliasCandidates) => {
1789
1777
  };
1790
1778
  const resolveModel = (requestedModelId, models = runtimeState.models?.data) => {
1791
1779
  if (!models || models.length === 0) return;
1792
- const exactMatch = models.find((model) => model.id === requestedModelId);
1780
+ const requestedExactMatch = models.find((model) => model.id === requestedModelId);
1781
+ if (requestedExactMatch && !isClaudeOneMillionAlias(requestedModelId)) return requestedExactMatch;
1782
+ const canonicalModelId = stripSnapshotSuffix(requestedModelId);
1783
+ const exactMatch = models.find((model) => model.id === canonicalModelId);
1793
1784
  if (exactMatch) return exactMatch;
1794
1785
  const aliasCandidates = getAliasCandidates(requestedModelId);
1795
1786
  const normalizedAliases = new Set(aliasCandidates.map((candidate) => normalizeModelId(candidate)));
@@ -4168,7 +4159,7 @@ const startServer = (config) => serve({
4168
4159
 
4169
4160
  //#endregion
4170
4161
  //#region src/start.ts
4171
- const getPublicModelId = (id) => id === "claude-opus-4.7-1m-internal" ? "claude-opus-4.7-1m" : id;
4162
+ const getPublicModelId = (id) => id;
4172
4163
  const unique = (ids) => [...new Set(ids)];
4173
4164
  const AUTO_MODEL_PRIORITY = [
4174
4165
  "gpt-5.3-codex",