@dianshuv/copilot-api 0.7.3 → 0.7.5

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 -7
  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.3";
1216
+ var version = "0.7.5";
1217
1217
 
1218
1218
  //#endregion
1219
1219
  //#region src/lib/adaptive-rate-limiter.ts
@@ -7495,12 +7495,12 @@ function translateChunkToAnthropicEvents(chunk, state, toolNameMapping) {
7495
7495
  }
7496
7496
  return events;
7497
7497
  }
7498
- function translateErrorToAnthropicErrorEvent() {
7498
+ function translateErrorToAnthropicErrorEvent(error) {
7499
7499
  return {
7500
7500
  type: "error",
7501
7501
  error: {
7502
7502
  type: "api_error",
7503
- message: "An unexpected error occurred during streaming."
7503
+ message: error ? formatError(error) : "An unexpected error occurred during streaming."
7504
7504
  }
7505
7505
  };
7506
7506
  }
@@ -7657,7 +7657,7 @@ async function handleDirectAnthropicStreamingResponse(opts) {
7657
7657
  toolCount: anthropicPayload.tools?.length ?? 0
7658
7658
  });
7659
7659
  } catch (error) {
7660
- consola.error("Direct Anthropic stream error:", formatError(error), error);
7660
+ consola.error("Direct Anthropic stream error:", formatError(error));
7661
7661
  recordStreamError({
7662
7662
  acc,
7663
7663
  fallbackModel: anthropicPayload.model,
@@ -7665,7 +7665,7 @@ async function handleDirectAnthropicStreamingResponse(opts) {
7665
7665
  error
7666
7666
  });
7667
7667
  failTracking(ctx.trackingId, error);
7668
- const errorEvent = translateErrorToAnthropicErrorEvent();
7668
+ const errorEvent = translateErrorToAnthropicErrorEvent(error);
7669
7669
  await stream.writeSSE({
7670
7670
  event: errorEvent.type,
7671
7671
  data: JSON.stringify(errorEvent)
@@ -7843,7 +7843,7 @@ async function handleStreamingResponse(opts) {
7843
7843
  toolCount: anthropicPayload.tools?.length ?? 0
7844
7844
  });
7845
7845
  } catch (error) {
7846
- consola.error("Stream error:", formatError(error), error);
7846
+ consola.error("Stream error:", formatError(error));
7847
7847
  recordStreamError({
7848
7848
  acc,
7849
7849
  fallbackModel: anthropicPayload.model,
@@ -7851,7 +7851,7 @@ async function handleStreamingResponse(opts) {
7851
7851
  error
7852
7852
  });
7853
7853
  failTracking(ctx.trackingId, error);
7854
- const errorEvent = translateErrorToAnthropicErrorEvent();
7854
+ const errorEvent = translateErrorToAnthropicErrorEvent(error);
7855
7855
  await stream.writeSSE({
7856
7856
  event: errorEvent.type,
7857
7857
  data: JSON.stringify(errorEvent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dianshuv/copilot-api",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Turn GitHub Copilot into OpenAI/Anthropic API compatible server. Usable with Claude Code!",
5
5
  "author": "dianshuv",
6
6
  "type": "module",