@dianshuv/copilot-api 0.7.4 → 0.7.6

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 (2) hide show
  1. package/dist/main.mjs +7 -5
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -1213,7 +1213,7 @@ const patchClaude = defineCommand({
1213
1213
 
1214
1214
  //#endregion
1215
1215
  //#region package.json
1216
- var version = "0.7.4";
1216
+ var version = "0.7.6";
1217
1217
 
1218
1218
  //#endregion
1219
1219
  //#region src/lib/adaptive-rate-limiter.ts
@@ -7135,6 +7135,8 @@ function translateModelName(model) {
7135
7135
  }
7136
7136
  if (/^claude-sonnet-4-5-\d+$/.test(model)) return "claude-sonnet-4.5";
7137
7137
  if (/^claude-sonnet-4-\d+$/.test(model)) return "claude-sonnet-4";
7138
+ if (model === "claude-opus-4-7-1m") return "claude-opus-4.7-1m-internal";
7139
+ if (/^claude-opus-4-7$/.test(model)) return "claude-opus-4.7";
7138
7140
  if (model === "claude-opus-4-6-1m") return "claude-opus-4.6-1m";
7139
7141
  if (/^claude-opus-4-6$/.test(model)) return "claude-opus-4.6";
7140
7142
  if (/^claude-opus-4-5-\d+$/.test(model)) return "claude-opus-4.5";
@@ -7495,12 +7497,12 @@ function translateChunkToAnthropicEvents(chunk, state, toolNameMapping) {
7495
7497
  }
7496
7498
  return events;
7497
7499
  }
7498
- function translateErrorToAnthropicErrorEvent() {
7500
+ function translateErrorToAnthropicErrorEvent(error) {
7499
7501
  return {
7500
7502
  type: "error",
7501
7503
  error: {
7502
7504
  type: "api_error",
7503
- message: "An unexpected error occurred during streaming."
7505
+ message: error ? formatError(error) : "An unexpected error occurred during streaming."
7504
7506
  }
7505
7507
  };
7506
7508
  }
@@ -7665,7 +7667,7 @@ async function handleDirectAnthropicStreamingResponse(opts) {
7665
7667
  error
7666
7668
  });
7667
7669
  failTracking(ctx.trackingId, error);
7668
- const errorEvent = translateErrorToAnthropicErrorEvent();
7670
+ const errorEvent = translateErrorToAnthropicErrorEvent(error);
7669
7671
  await stream.writeSSE({
7670
7672
  event: errorEvent.type,
7671
7673
  data: JSON.stringify(errorEvent)
@@ -7851,7 +7853,7 @@ async function handleStreamingResponse(opts) {
7851
7853
  error
7852
7854
  });
7853
7855
  failTracking(ctx.trackingId, error);
7854
- const errorEvent = translateErrorToAnthropicErrorEvent();
7856
+ const errorEvent = translateErrorToAnthropicErrorEvent(error);
7855
7857
  await stream.writeSSE({
7856
7858
  event: errorEvent.type,
7857
7859
  data: JSON.stringify(errorEvent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dianshuv/copilot-api",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Turn GitHub Copilot into OpenAI/Anthropic API compatible server. Usable with Claude Code!",
5
5
  "author": "dianshuv",
6
6
  "type": "module",