{"version":3,"file":"github-copilot-headers-CZo2QHrt.mjs","names":[],"sources":["../node_modules/.pnpm/@earendil-works+pi-ai@0.84.1_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.js"],"sourcesContent":["// Copilot expects X-Initiator to indicate whether the request is user-initiated\n// or agent-initiated (e.g. follow-up after assistant/tool messages).\nexport function inferCopilotInitiator(messages) {\n    const last = messages[messages.length - 1];\n    return last && last.role !== \"user\" ? \"agent\" : \"user\";\n}\n// Copilot requires Copilot-Vision-Request header when sending images\nexport function hasCopilotVisionInput(messages) {\n    return messages.some((msg) => {\n        if (msg.role === \"user\" && Array.isArray(msg.content)) {\n            return msg.content.some((c) => c.type === \"image\");\n        }\n        if (msg.role === \"toolResult\" && Array.isArray(msg.content)) {\n            return msg.content.some((c) => c.type === \"image\");\n        }\n        return false;\n    });\n}\nexport function buildCopilotDynamicHeaders(params) {\n    const headers = {\n        \"X-Initiator\": inferCopilotInitiator(params.messages),\n        \"Openai-Intent\": \"conversation-edits\",\n    };\n    if (params.hasImages) {\n        headers[\"Copilot-Vision-Request\"] = \"true\";\n    }\n    return headers;\n}\n//# sourceMappingURL=github-copilot-headers.js.map"],"x_google_ignoreList":[0],"mappings":";;AAEA,SAAgB,sBAAsB,UAAU;CAC5C,MAAM,OAAO,SAAS,SAAS,SAAS;CACxC,OAAO,QAAQ,KAAK,SAAS,SAAS,UAAU;AACpD;AAEA,SAAgB,sBAAsB,UAAU;CAC5C,OAAO,SAAS,MAAM,QAAQ;EAC1B,IAAI,IAAI,SAAS,UAAU,MAAM,QAAQ,IAAI,OAAO,GAChD,OAAO,IAAI,QAAQ,MAAM,MAAM,EAAE,SAAS,OAAO;EAErD,IAAI,IAAI,SAAS,gBAAgB,MAAM,QAAQ,IAAI,OAAO,GACtD,OAAO,IAAI,QAAQ,MAAM,MAAM,EAAE,SAAS,OAAO;EAErD,OAAO;CACX,CAAC;AACL;AACA,SAAgB,2BAA2B,QAAQ;CAC/C,MAAM,UAAU;EACZ,eAAe,sBAAsB,OAAO,QAAQ;EACpD,iBAAiB;CACrB;CACA,IAAI,OAAO,WACP,QAAQ,4BAA4B;CAExC,OAAO;AACX"}