@jeffreycao/copilot-api 1.4.8 → 1.4.9

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
@@ -23,7 +23,7 @@ if (typeof args["enterprise-url"] === "string") process.env.COPILOT_API_ENTERPRI
23
23
  const { auth } = await import("./auth-BiqPNtnS.js");
24
24
  const { checkUsage } = await import("./check-usage-BTyIura_.js");
25
25
  const { debug } = await import("./debug-Dx1S6uWG.js");
26
- const { start } = await import("./start-CkxSn0VD.js");
26
+ const { start } = await import("./start-D05mLWIf.js");
27
27
  const main = defineCommand({
28
28
  meta: {
29
29
  name: "copilot-api",
@@ -2329,6 +2329,7 @@ const handleWithResponsesApi = async (c, anthropicPayload, options) => {
2329
2329
  };
2330
2330
  const handleWithMessagesApi = async (c, anthropicPayload, options) => {
2331
2331
  const { anthropicBetaHeader, subagentMarker, selectedModel, requestId, sessionId, isCompact } = options;
2332
+ stripCacheControl(anthropicPayload);
2332
2333
  for (const msg of anthropicPayload.messages) if (msg.role === "assistant" && Array.isArray(msg.content)) msg.content = msg.content.filter((block) => {
2333
2334
  if (block.type !== "thinking") return true;
2334
2335
  return block.thinking && block.thinking !== "Thinking..." && block.signature && !block.signature.includes("@");
@@ -2428,6 +2429,16 @@ const mergeToolResult = (toolResults, textBlocks) => {
2428
2429
  const lastIndex = toolResults.length - 1;
2429
2430
  return toolResults.map((tr, i) => i === lastIndex ? mergeContentWithTexts(tr, textBlocks) : tr);
2430
2431
  };
2432
+ const stripCacheControl = (payload) => {
2433
+ if (Array.isArray(payload.system)) for (const block of payload.system) {
2434
+ const b = block;
2435
+ const cc = b.cache_control;
2436
+ if (cc && typeof cc === "object") {
2437
+ const { scope,...rest } = cc;
2438
+ b.cache_control = rest;
2439
+ }
2440
+ }
2441
+ };
2431
2442
 
2432
2443
  //#endregion
2433
2444
  //#region src/routes/messages/route.ts
@@ -2894,4 +2905,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
2894
2905
 
2895
2906
  //#endregion
2896
2907
  export { server };
2897
- //# sourceMappingURL=server-DQ3RajId.js.map
2908
+ //# sourceMappingURL=server-B1qZTR00.js.map