ghc-proxy 0.5.3 → 0.5.4

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.mjs CHANGED
@@ -6466,7 +6466,7 @@ const checkUsage = defineCommand({
6466
6466
 
6467
6467
  //#endregion
6468
6468
  //#region src/lib/version.ts
6469
- const VERSION = "0.5.3";
6469
+ const VERSION = "0.5.4";
6470
6470
 
6471
6471
  //#endregion
6472
6472
  //#region src/debug.ts
@@ -50797,12 +50797,32 @@ function filterThinkingBlocksForNativeMessages(anthropicPayload) {
50797
50797
  function sanitizeOutputConfig(payload, model) {
50798
50798
  if (payload.output_config && !modelSupportsOutputConfig(model)) delete payload.output_config;
50799
50799
  }
50800
+ function normalizeCacheControlBlock(obj) {
50801
+ if (obj.cache_control && typeof obj.cache_control === "object") obj.cache_control = { type: obj.cache_control.type };
50802
+ }
50803
+ /**
50804
+ * Normalize `cache_control` to strip extra fields (e.g. `scope`) that
50805
+ * the upstream Copilot API does not yet accept.
50806
+ *
50807
+ * Temporary workaround — when Copilot supports `scope`, this filter
50808
+ * should be removed. The smoke-cache-control script tests whether the
50809
+ * upstream accepts `scope`.
50810
+ */
50811
+ function sanitizeCacheControl(payload) {
50812
+ if (Array.isArray(payload.system)) for (const block of payload.system) normalizeCacheControlBlock(block);
50813
+ for (const message of payload.messages) {
50814
+ normalizeCacheControlBlock(message);
50815
+ if (Array.isArray(message.content)) for (const block of message.content) normalizeCacheControlBlock(block);
50816
+ }
50817
+ if (payload.tools) for (const tool of payload.tools) normalizeCacheControlBlock(tool);
50818
+ }
50800
50819
  const nativeMessagesEntry = {
50801
50820
  name: "native-messages",
50802
50821
  canHandle: (model) => modelSupportsEndpoint(model, MESSAGES_ENDPOINT),
50803
50822
  async execute(ctx) {
50804
50823
  filterThinkingBlocksForNativeMessages(ctx.anthropicPayload);
50805
50824
  sanitizeOutputConfig(ctx.anthropicPayload, ctx.selectedModel);
50825
+ sanitizeCacheControl(ctx.anthropicPayload);
50806
50826
  return {
50807
50827
  result: await runStrategy(createNativeMessagesStrategy(ctx.copilotClient, ctx.anthropicPayload, ctx.anthropicBetaHeader, {
50808
50828
  signal: ctx.upstreamSignal.signal,