@jeffreycao/copilot-api 1.10.13 → 1.10.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/dist/main.js CHANGED
@@ -43,7 +43,7 @@ const { auth } = await import("./auth-pzJhbgbH.js");
43
43
  const { checkUsage } = await import("./check-usage-Cz41OYeD.js");
44
44
  const { debug } = await import("./debug-Cc-hdADF.js");
45
45
  const { mcp } = await import("./mcp-DZgcvqQY.js");
46
- const { start } = await import("./start-BFEMlh3z.js");
46
+ const { start } = await import("./start-DpP5nm-1.js");
47
47
  await runMain(defineCommand({
48
48
  meta: {
49
49
  name: "copilot-api",
@@ -2767,6 +2767,7 @@ const translateResponsesResultToAnthropic = (response, options) => {
2767
2767
  };
2768
2768
  const mapOutputToAnthropicContent = (output, options) => {
2769
2769
  const contentBlocks = [];
2770
+ if (!output) output = [];
2770
2771
  for (const item of output) switch (item.type) {
2771
2772
  case "reasoning": {
2772
2773
  const thinkingText = extractReasoningText(item);
@@ -2910,7 +2911,7 @@ const fallbackContentBlocks = (outputText) => {
2910
2911
  const mapResponsesStopReason = (response, options) => {
2911
2912
  const { status, incomplete_details: incompleteDetails } = response;
2912
2913
  if (status === "completed") {
2913
- if (response.output.length === 0) return options?.hasToolCall ? "tool_use" : "end_turn";
2914
+ if (!response.output || response.output.length === 0) return options?.hasToolCall ? "tool_use" : "end_turn";
2914
2915
  if (response.output.some((item) => item.type === "function_call" || item.type === "tool_search_call")) return "tool_use";
2915
2916
  return "end_turn";
2916
2917
  }
@@ -5199,4 +5200,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
5199
5200
  //#endregion
5200
5201
  export { server };
5201
5202
 
5202
- //# sourceMappingURL=server-CPTxEK7c.js.map
5203
+ //# sourceMappingURL=server-yJcTwrWm.js.map