sliccy 6.241.2 → 6.242.1

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 (298) hide show
  1. package/dist/ui/.vite/manifest.json +435 -406
  2. package/dist/ui/assets/account-store-C7cmsYvk.js +2 -0
  3. package/dist/ui/assets/account-store-LMcdoHV5.js +1 -0
  4. package/dist/ui/assets/adobe-CsN2HePU.js +1 -0
  5. package/dist/ui/assets/adobe-DvupBVBe.js +2 -0
  6. package/dist/ui/assets/{agent-panels-BPTNztEF.js → agent-panels-nqX59rBC.js} +1 -1
  7. package/dist/ui/assets/{agent-tools-WbCq5rUh.js → agent-tools-DOAwvp2r.js} +1 -1
  8. package/dist/ui/assets/{almost-bash-shell-headless-BhATwxlI.js → almost-bash-shell-headless-D4axvqF7.js} +16 -16
  9. package/dist/ui/assets/anthropic-messages-B2uIMNYL.js +19 -0
  10. package/dist/ui/assets/anthropic-messages-C787NPvk.js +18 -0
  11. package/dist/ui/assets/{apply-layout-do6BKGG_.js → apply-layout-BLMLhkIq.js} +1 -1
  12. package/dist/ui/assets/{approver-agent-CivzfuZ7.js → approver-agent-B9MJsDkQ.js} +1 -1
  13. package/dist/ui/assets/{azure-openai-Crma6jg9.js → azure-openai-CJ435PeY.js} +1 -1
  14. package/dist/ui/assets/{azure-openai-DbyCJhyF.js → azure-openai-DzHm6zoK.js} +1 -1
  15. package/dist/ui/assets/azure-openai-config--zABV6W_.js +1 -0
  16. package/dist/ui/assets/azure-openai-config-CvD1Dsr0.js +1 -0
  17. package/dist/ui/assets/azure-openai-responses-DcjVJRMr.js +1 -0
  18. package/dist/ui/assets/azure-openai-responses-Zz2PEXb6.js +1 -0
  19. package/dist/ui/assets/bedrock-camp-CLQpuikj.js +1 -0
  20. package/dist/ui/assets/bedrock-camp-Sm0RNsDN.js +1 -0
  21. package/dist/ui/assets/bedrock-camp-extra-models-BVTKXD9j.js +1 -0
  22. package/dist/ui/assets/bedrock-camp-extra-models-Df3uDddz.js +1 -0
  23. package/dist/ui/assets/{browser-BhTdBqdp.js → browser-Chc3wUwj.js} +35 -30
  24. package/dist/ui/assets/{browser-CGX7MbCQ.js → browser-L7W6uZ79.js} +1 -1
  25. package/dist/ui/assets/{cdp-Chj4rX9S.js → cdp-DAKkYx5Q.js} +1 -1
  26. package/dist/ui/assets/{cerebras-CMjh5Atq.js → cerebras-B6RM4KMv.js} +1 -1
  27. package/dist/ui/assets/{cerebras-D3JMO0_v.js → cerebras-D8aIpgqL.js} +1 -1
  28. package/dist/ui/assets/classifier-shared-BJysQIY7.js +1 -0
  29. package/dist/ui/assets/classifier-shared-DgL5N50m.js +1 -0
  30. package/dist/ui/assets/claude-model-version-3MWQoaco.js +1 -0
  31. package/dist/ui/assets/{claude-model-version-ceOteQ2f.js → claude-model-version-BlyDyuTC.js} +1 -1
  32. package/dist/ui/assets/cloudflare-workers-ai-system-one-3WA5LP90.js +1 -0
  33. package/dist/ui/assets/cloudflare-workers-ai-system-one-BQQga1NM.js +1 -0
  34. package/dist/ui/assets/{codemode-tool-FcP24sWd.js → codemode-tool-BFVivVHy.js} +1 -1
  35. package/dist/ui/assets/compat-0YnuwvMn.js +2 -0
  36. package/dist/ui/assets/compat-Ba4wPWa_.js +1 -0
  37. package/dist/ui/assets/{composer-speech-B4dRABTT.js → composer-speech-tCXeaBeW.js} +1 -1
  38. package/dist/ui/assets/{connect-surface-DE7YTMvl.js → connect-surface-BNPAOM6T.js} +1 -1
  39. package/dist/ui/assets/{connection-manager-D0LxHiWb.js → connection-manager-BDqqVban.js} +1 -1
  40. package/dist/ui/assets/{context-compaction-BCsq-2e6.js → context-compaction-Dee1PlIX.js} +1 -1
  41. package/dist/ui/assets/core-C--iyWKC.js +1 -0
  42. package/dist/ui/assets/core-DzRw0pz2.js +27 -0
  43. package/dist/ui/assets/{cost-command-TMcbUPyN.js → cost-command-VPxRuwNr.js} +1 -1
  44. package/dist/ui/assets/{descriptor-CuhPBdq8.js → descriptor-1ECGTjSt.js} +1 -1
  45. package/dist/ui/assets/{descriptor-CKLcFFX3.js → descriptor-xRf4P0gd.js} +1 -1
  46. package/dist/ui/assets/diagnostics-B-5VkVir.js +1 -0
  47. package/dist/ui/assets/{directed-approval-Bh7n7n1J.js → directed-approval-C-H1pezV.js} +1 -1
  48. package/dist/ui/assets/dist-DRjYxtT0.js +9 -0
  49. package/dist/ui/assets/dist-Ue_WrVH6.js +4 -0
  50. package/dist/ui/assets/{emscripten-vfs-hook-C48AABzj.js → emscripten-vfs-hook-C_sPQF1q.js} +1 -1
  51. package/dist/ui/assets/env-api-keys-BMbk-OAv.js +1 -0
  52. package/dist/ui/assets/env-api-keys-DkgZK-ct.js +1 -0
  53. package/dist/ui/assets/error-BTdmRKoB.js +1 -0
  54. package/dist/ui/assets/{frozen-archive-writer-WvWeevzo.js → frozen-archive-writer-B9jFFV1G.js} +1 -1
  55. package/dist/ui/assets/{frozen-archive-writer-Dp5Kp2AM.js → frozen-archive-writer-C-H_SeAN.js} +1 -1
  56. package/dist/ui/assets/{frozen-session-delete-Bd5sAXCT.js → frozen-session-delete-TEdGsWWq.js} +1 -1
  57. package/dist/ui/assets/{frozen-session-identity-DtVvVfo-.js → frozen-session-identity-98l4HHOx.js} +1 -1
  58. package/dist/ui/assets/{frozen-session-identity-DBNKX1Kt.js → frozen-session-identity-BuympVx1.js} +1 -1
  59. package/dist/ui/assets/{gelatiere-unit-CRAdgKi2.js → gelatiere-unit-POxyevbg.js} +1 -1
  60. package/dist/ui/assets/{github-Ce6zEmb7.js → github-DLccWQy2.js} +1 -1
  61. package/dist/ui/assets/{github-Cki_0Nyx.js → github-DbPIkVg9.js} +1 -1
  62. package/dist/ui/assets/github-copilot-BWirQvll.js +2 -0
  63. package/dist/ui/assets/{github-copilot-DnxO45YA.js → github-copilot-CCxXuXGc.js} +1 -1
  64. package/dist/ui/assets/google-generative-ai-C1S3RP6G.js +1 -0
  65. package/dist/ui/assets/{google-generative-ai-CHKS5an4.js → google-generative-ai-D_dvyaRG.js} +1 -1
  66. package/dist/ui/assets/{google-shared-Q-3oSdLJ.js → google-shared-CjU_LieG.js} +1 -1
  67. package/dist/ui/assets/{google-shared-C6X3xab7.js → google-shared-DWTs99zb.js} +1 -1
  68. package/dist/ui/assets/{google-vertex-DBm4s85u.js → google-vertex-Ckh_e-Px.js} +1 -1
  69. package/dist/ui/assets/google-vertex-DmOYmn7m.js +1 -0
  70. package/dist/ui/assets/{guest-tool-gate-83ZVVYjM.js → guest-tool-gate-D5-Z-l4h.js} +1 -1
  71. package/dist/ui/assets/{hear-DrMASLik.js → hear-D0GDb5OM.js} +1 -1
  72. package/dist/ui/assets/{host-command-CvUauhDf.js → host-command-B9z8gGwK.js} +1 -1
  73. package/dist/ui/assets/{idle-compaction-DGln8tkz.js → idle-compaction-WANlPP4R.js} +1 -1
  74. package/dist/ui/assets/{interrupted-work-recovery-CWSaMQsO.js → interrupted-work-recovery-Bc8UHznp.js} +1 -1
  75. package/dist/ui/assets/{js-realm-worker-BImPsiO1.js → js-realm-worker-B5EaNFPR.js} +2 -2
  76. package/dist/ui/assets/{jsh-executor-DeyquLjX.js → jsh-executor-Cvtifnzy.js} +2 -2
  77. package/dist/ui/assets/kernel-worker-BnKZsD8D.js +1262 -0
  78. package/dist/ui/assets/{key-B2Bki3fU.js → key-CMmCg0hr.js} +1 -1
  79. package/dist/ui/assets/{legacy-api-aliases--xyLjPgC.js → legacy-api-aliases-C3_OAyZB.js} +1 -1
  80. package/dist/ui/assets/{legacy-api-aliases-BjgG1CsY.js → legacy-api-aliases-D-3Ssy_B.js} +1 -1
  81. package/dist/ui/assets/{libesm-CTQYxJIv.js → libesm-CSMdpGMF.js} +4 -4
  82. package/dist/ui/assets/{lick-ws-bridge-yY6biRYG.js → lick-ws-bridge-9wS4yJ0w.js} +1 -1
  83. package/dist/ui/assets/{lick-ws-bridge-Dz2GMrQF.js → lick-ws-bridge-jZ4K-oo9.js} +1 -1
  84. package/dist/ui/assets/{live-session-curation-P07mPEUJ.js → live-session-curation-DmFglcFD.js} +1 -1
  85. package/dist/ui/assets/{live-session-curation-DNRKwuqG.js → live-session-curation-yQ-Vm41y.js} +1 -1
  86. package/dist/ui/assets/{live-session-snapshot-BIzlbYCZ.js → live-session-snapshot-DGG3f5uE.js} +1 -1
  87. package/dist/ui/assets/{local-llm-DCFLzc5h.js → local-llm-CCShpj71.js} +1 -1
  88. package/dist/ui/assets/{local-llm-CmCBqZZ-.js → local-llm-FAQb55rp.js} +1 -1
  89. package/dist/ui/assets/main-DMcZBsBh.js +22 -0
  90. package/dist/ui/assets/{main-cherry-BDVwWFQN.js → main-cherry-DpTyQuBL.js} +1 -1
  91. package/dist/ui/assets/{mcp-command-C1alEKaT.js → mcp-command-DH5p3gPZ.js} +11 -11
  92. package/dist/ui/assets/{memory-curation-seam-BY8tSgeq.js → memory-curation-seam-FFS-yP-L.js} +1 -1
  93. package/dist/ui/assets/{memory-health-CU02gRyR.js → memory-health-A-AOIR0m.js} +1 -1
  94. package/dist/ui/assets/{memory-write-execute-CVgMXvW1.js → memory-write-execute-CBK1MREm.js} +1 -1
  95. package/dist/ui/assets/{merge-folded-cost-into-frozen-hx2AKJws.js → merge-folded-cost-into-frozen-j807FRp1.js} +1 -1
  96. package/dist/ui/assets/{mistral-conversations-oqRyTLwY.js → mistral-conversations-BvlrZkA-.js} +3 -3
  97. package/dist/ui/assets/{mistral-conversations-SlnX__FI.js → mistral-conversations-gYKoKyXX.js} +4 -4
  98. package/dist/ui/assets/models-D9KYIFyv.js +8 -0
  99. package/dist/ui/assets/models-DMUS_WIm.js +8 -0
  100. package/dist/ui/assets/new-session-BAU8qoRg.js +2 -0
  101. package/dist/ui/assets/{node.browser-DfltYbWr.js → node.browser-C8yuEzbc.js} +1 -1
  102. package/dist/ui/assets/node.browser-GIQn8hjM.js +1 -0
  103. package/dist/ui/assets/node.browser-HQ5SKBOf.js +1 -0
  104. package/dist/ui/assets/{node.browser-DFNMSkXf.js → node.browser-PnMdIUDP.js} +1 -1
  105. package/dist/ui/assets/oauth-bootstrap-DQTz034Z.js +2 -0
  106. package/dist/ui/assets/{onboarding-orchestrator-CSc2ijQX.js → onboarding-orchestrator-BApWfGDZ.js} +1 -1
  107. package/dist/ui/assets/{openai-codex-Blubslp_.js → openai-codex-Dz9Hz7cm.js} +1 -1
  108. package/dist/ui/assets/{openai-codex-Cxuu2ttC.js → openai-codex-ZrvYHVwu.js} +1 -1
  109. package/dist/ui/assets/{openai-codex-responses-BFVkRFGY.js → openai-codex-responses-DL3QfjAj.js} +2 -2
  110. package/dist/ui/assets/{openai-codex-responses-N8ybD_eh.js → openai-codex-responses-D_RW7WEX.js} +2 -2
  111. package/dist/ui/assets/openai-completions-B8gZJNrA.js +5 -0
  112. package/dist/ui/assets/openai-completions-Eh0-DkGU.js +5 -0
  113. package/dist/ui/assets/openai-decisions-DZc3eKSh.js +2 -0
  114. package/dist/ui/assets/openai-decisions-umTQkmTO.js +2 -0
  115. package/dist/ui/assets/openai-responses-C7rBSmmd.js +1 -0
  116. package/dist/ui/assets/openai-responses-ChllZFHw.js +1 -0
  117. package/dist/ui/assets/{openai-responses-shared-CbNa5Pf-.js → openai-responses-shared-BkcHIDFS.js} +2 -2
  118. package/dist/ui/assets/{openai-responses-shared-yguGWfYx.js → openai-responses-shared-BvBjbnyp.js} +2 -2
  119. package/dist/ui/assets/{openrouter-BO37g5kD.js → openrouter-BUQDu47M.js} +1 -1
  120. package/dist/ui/assets/{openrouter-free-Nwvsh4Wu.js → openrouter-free-C49a6JRY.js} +1 -1
  121. package/dist/ui/assets/{openrouter-free-DMHXMOwF.js → openrouter-free-D1RSYnrS.js} +1 -1
  122. package/dist/ui/assets/{openrouter-images-DInxQ8hj.js → openrouter-images-BLhPKhhs.js} +1 -1
  123. package/dist/ui/assets/{openrouter-images-B2LpvEOZ.js → openrouter-images-BxgQP1ZC.js} +1 -1
  124. package/dist/ui/assets/{openrouter-models-DawLtPaY.js → openrouter-models-BmhhmiWg.js} +1 -1
  125. package/dist/ui/assets/{openrouter-models-RwlwKz0P.js → openrouter-models-W7XmIrEt.js} +1 -1
  126. package/dist/ui/assets/{openrouter-oauth-B7dwn7-K.js → openrouter-oauth-ByrbaA4D.js} +1 -1
  127. package/dist/ui/assets/{openrouter-oauth-CBN-q3uQ.js → openrouter-oauth-D8IvxZ7K.js} +1 -1
  128. package/dist/ui/assets/{openrouter-DfDarzCs.js → openrouter-xeZ1sMms.js} +1 -1
  129. package/dist/ui/assets/openrouter.models-BSx3ITDA.js +1 -0
  130. package/dist/ui/assets/openrouter.models-C88RzzVZ.js +1 -0
  131. package/dist/ui/assets/panel-rpc-handlers-CAHaGcUL.js +2 -0
  132. package/dist/ui/assets/{panelize-shell-7Y7g8j87.js → panelize-shell-9zV9Orft.js} +1 -1
  133. package/dist/ui/assets/pi-edit-execution-DKUTmAry.js +12 -0
  134. package/dist/ui/assets/{pi-messages-BMxZw_ob.js → pi-messages-CiydoVXP.js} +1 -1
  135. package/dist/ui/assets/{pi-messages-F6N-eNkX.js → pi-messages-DElkezfJ.js} +1 -1
  136. package/dist/ui/assets/pi-transcript-context-CE8ItnBz.js +1 -0
  137. package/dist/ui/assets/{pi-transcript-context-miZCMig3.js → pi-transcript-context-DZyPy5yf.js} +1 -1
  138. package/dist/ui/assets/{provider-DQruadfh.js → provider-D-ykGwqg.js} +1 -1
  139. package/dist/ui/assets/{provider-C6ydoCMq.js → provider-bqWyptLT.js} +1 -1
  140. package/dist/ui/assets/{provider-retry-CSlu6hjs.js → provider-retry-RVfYd5Vz.js} +1 -1
  141. package/dist/ui/assets/{provider-settings-B3qqcxSD.js → provider-settings-DB_WwQDb.js} +1 -1
  142. package/dist/ui/assets/provider-store-access-C_IUeBVd.js +1 -0
  143. package/dist/ui/assets/provider-store-access-CytEP8xG.js +1 -0
  144. package/dist/ui/assets/providers-C4C51wfX.js +2 -0
  145. package/dist/ui/assets/{providers-B9czndZN.js → providers-qejBSaH2.js} +1 -1
  146. package/dist/ui/assets/{quick-llm-BPycuWR-.js → quick-llm-Bg8bsYeX.js} +1 -1
  147. package/dist/ui/assets/{realm-inprocess-DWdzUOQ_.js → realm-inprocess-DIFlE2ih.js} +2 -2
  148. package/dist/ui/assets/{realm-unhandled-rejections-Bl_ZXwoN.js → realm-unhandled-rejections-DuDX1XsO.js} +1 -1
  149. package/dist/ui/assets/{realm-unhandled-rejections-C53qKLqK.js → realm-unhandled-rejections-cnpITgwQ.js} +1 -1
  150. package/dist/ui/assets/record-Ban9cWMI.js +1 -0
  151. package/dist/ui/assets/record-DtD74Jn0.js +1 -0
  152. package/dist/ui/assets/{recovery-screen-Cazf2xIP.js → recovery-screen-CmpvrsH2.js} +1 -1
  153. package/dist/ui/assets/{remote-terminal-view-Bi6kHDPF.js → remote-terminal-view-mG1cslxd.js} +3 -3
  154. package/dist/ui/assets/renamed-providers-BUZBzl5L.js +1 -0
  155. package/dist/ui/assets/renamed-providers-DDe6My59.js +1 -0
  156. package/dist/ui/assets/{restore-44hNH7jV.js → restore-C13TcO9D.js} +1 -1
  157. package/dist/ui/assets/{run-CRTEPV5c.js → run-DaNuW9og.js} +1 -1
  158. package/dist/ui/assets/{run-DnxVNWPE.js → run-DcyrwtHx.js} +1 -1
  159. package/dist/ui/assets/{run-4_xJysDp.js → run-DfX5ruur.js} +2 -2
  160. package/dist/ui/assets/{run-C4ksmo-v.js → run-G6dw8QHv.js} +1 -1
  161. package/dist/ui/assets/{run-BA6c0GPu.js → run-LbXVMEE2.js} +2 -2
  162. package/dist/ui/assets/{run-eMa-imbo.js → run-dvwY_0Mg.js} +1 -1
  163. package/dist/ui/assets/{run-BJGzDxyk.js → run-xC8FUB2Z.js} +2 -2
  164. package/dist/ui/assets/{serve-command-CL7ZUUME.js → serve-command-CHfAIOHY.js} +2 -2
  165. package/dist/ui/assets/{serve-runtime-FnrqSQ9N.js → serve-runtime-D4K9eaOV.js} +1 -1
  166. package/dist/ui/assets/{session-command-memory-U9MPhSTK.js → session-command-memory-D1nqCEjG.js} +2 -2
  167. package/dist/ui/assets/{session-jsonl-Dex98vVP.js → session-jsonl-Dw6-vKR4.js} +1 -1
  168. package/dist/ui/assets/{session-jsonl-B6PTjNY7.js → session-jsonl-FXRetOAW.js} +1 -1
  169. package/dist/ui/assets/{session-search-index-D4Hgp55S.js → session-search-index-sViZcrH8.js} +1 -1
  170. package/dist/ui/assets/{setup-feature-flags-remote-DOYQs_ab.js → setup-feature-flags-remote-C2rFofJk.js} +1 -1
  171. package/dist/ui/assets/setup-model-catalog-CoX5PPIu.js +1 -0
  172. package/dist/ui/assets/{silent-renew-backoff-BMu6yC44.js → silent-renew-backoff-DjqNK0gl.js} +1 -1
  173. package/dist/ui/assets/slicc-version-BYcI5lyB.js +1 -0
  174. package/dist/ui/assets/{soundscape-BhzoNmry.js → soundscape-ZCwJCejO.js} +1 -1
  175. package/dist/ui/assets/{speak-DTAAyjvt.js → speak-C4XDVFOd.js} +1 -1
  176. package/dist/ui/assets/{sprinkle-manager-Cvz_wvjt.js → sprinkle-manager-DCp9ktyI.js} +1 -1
  177. package/dist/ui/assets/{sprinkle-renderer-Bf2N_Op8.js → sprinkle-renderer-DUdlmZzY.js} +1 -1
  178. package/dist/ui/assets/{ssh-CVu8tZ_S.js → ssh-Bqz2CHhO.js} +1 -1
  179. package/dist/ui/assets/{sudo-psOqIGnL.js → sudo-7dQUlj9u.js} +1 -1
  180. package/dist/ui/assets/{supervisor-Ms2TJ94r.js → supervisor-Cm4Br5Bp.js} +1 -1
  181. package/dist/ui/assets/{sync-dialog-DHBHhHXb.js → sync-dialog-C7UzXurv.js} +1 -1
  182. package/dist/ui/assets/system-one-shared-D_uXoohg.js +1 -0
  183. package/dist/ui/assets/system-one-shared-Do49zet2.js +1 -0
  184. package/dist/ui/assets/{temperature-support-0nztUM0u.js → temperature-support-9MoXJgur.js} +1 -1
  185. package/dist/ui/assets/{temperature-support-DhoZT6gU.js → temperature-support-DhJ_0y8D.js} +1 -1
  186. package/dist/ui/assets/transform-messages-DF4OdhKs.js +1 -0
  187. package/dist/ui/assets/transform-messages-DuvHh3qm.js +1 -0
  188. package/dist/ui/assets/{transformers-env-N_IINZ2N.js → transformers-env-eK1GAmlY.js} +1 -1
  189. package/dist/ui/assets/{tray-leader-U7aWeTYx.js → tray-leader-ByxTjm7v.js} +1 -1
  190. package/dist/ui/assets/{tray-leave-runtime-D8WKpUof.js → tray-leave-runtime-CGfgD_l_.js} +1 -1
  191. package/dist/ui/assets/{tray-sidecar-DaYo1_7T.js → tray-sidecar-C2mWKDLO.js} +1 -1
  192. package/dist/ui/assets/{turn-journal-CVQtwHPx.js → turn-journal-BJ3lAG7q.js} +1 -1
  193. package/dist/ui/assets/typesafe-system-one-B1zebM2I.js +1 -0
  194. package/dist/ui/assets/typesafe-system-one-B3Qz9-cZ.js +1 -0
  195. package/dist/ui/assets/{upgrade-detection-CnW9IWmw.js → upgrade-detection-mxvsQ7d1.js} +1 -1
  196. package/dist/ui/assets/{voice-reply-D70F9Jig.js → voice-reply-CNqXcytR.js} +1 -1
  197. package/dist/ui/assets/wc-attach-CTH3djxT.js +13 -0
  198. package/dist/ui/assets/{wc-browser-BbP-L6hO.js → wc-browser-DxwwYgO4.js} +1 -1
  199. package/dist/ui/assets/{wc-computers-DkSSp9VX.js → wc-computers-D9JoAyGk.js} +1 -1
  200. package/dist/ui/assets/{wc-detached--2VtFBm4.js → wc-detached-DFBPDSb7.js} +1 -1
  201. package/dist/ui/assets/wc-extension-o3opm5o5.js +2 -0
  202. package/dist/ui/assets/wc-follower-B6owaMW7.js +17 -0
  203. package/dist/ui/assets/{wc-follower-oauth-jPrcuiBT.js → wc-follower-oauth-iPAb4lP-.js} +1 -1
  204. package/dist/ui/assets/{wc-gelatiere-CH09qCLS.js → wc-gelatiere-CXXvIq8m.js} +1 -1
  205. package/dist/ui/assets/wc-live-yMGE6i1e.js +248 -0
  206. package/dist/ui/assets/wc-nav-CoUdFOJj.js +2 -0
  207. package/dist/ui/assets/{wc-onboarding-DfnMJHdB.js → wc-onboarding-BgzGE8gS.js} +2 -2
  208. package/dist/ui/assets/{wc-permissions-rM3M_LQl.js → wc-permissions-CyQgHfKN.js} +2 -2
  209. package/dist/ui/assets/wc-placeholder-Bc6dyn-A.js +4 -0
  210. package/dist/ui/assets/{wc-secret-request-CNE59PrN.js → wc-secret-request-CZ0k7hXL.js} +1 -1
  211. package/dist/ui/assets/{wc-settings-CO0WKQ0U.js → wc-settings-D6dRO6tZ.js} +3 -3
  212. package/dist/ui/assets/{wc-shell-ChGRHIpW.js → wc-shell-CCmBaVQE.js} +4 -4
  213. package/dist/ui/assets/{wc-shortcut-config-ClUA-2rq.js → wc-shortcut-config-DAYOOx8x.js} +1 -1
  214. package/dist/ui/assets/wc-sprinkles-BIMkIdn_.js +2 -0
  215. package/dist/ui/assets/wc-transcript-export-BF9PGt-B.js +2 -0
  216. package/dist/ui/assets/{wc-tray-BMj5XxoM.js → wc-tray-BSwujbla.js} +4 -4
  217. package/dist/ui/assets/{wc-unit-context-CZro7UrY.js → wc-unit-context-D5liISq3.js} +1 -1
  218. package/dist/ui/assets/welcome-detection-D3bHDmja.js +1 -0
  219. package/dist/ui/assets/whisper-session-Cvvuie0p.js +2 -0
  220. package/dist/ui/assets/xai-grok-BAa-CqFq.js +1 -0
  221. package/dist/ui/assets/xai-grok-WwMxwnuu.js +1 -0
  222. package/dist/ui/index.html +14 -13
  223. package/dist/ui/packages/webapp/index.html +14 -13
  224. package/package.json +1 -1
  225. package/dist/ui/assets/account-store-BxNOy49N.js +0 -1
  226. package/dist/ui/assets/account-store-DZiXvdji.js +0 -2
  227. package/dist/ui/assets/adobe-CwvNDAl7.js +0 -1
  228. package/dist/ui/assets/adobe-DMuNVyzl.js +0 -2
  229. package/dist/ui/assets/anthropic-messages-COqhstcs.js +0 -40
  230. package/dist/ui/assets/anthropic-messages-CjSN1VV8.js +0 -41
  231. package/dist/ui/assets/azure-openai-responses-BG1E_58j.js +0 -1
  232. package/dist/ui/assets/azure-openai-responses-DT2eVjgI.js +0 -1
  233. package/dist/ui/assets/bedrock-camp-CBP41h6t.js +0 -1
  234. package/dist/ui/assets/bedrock-camp-CWYBPsp_.js +0 -1
  235. package/dist/ui/assets/bedrock-camp-extra-models-BYrxX19D.js +0 -1
  236. package/dist/ui/assets/bedrock-camp-extra-models-DIuCBjcJ.js +0 -1
  237. package/dist/ui/assets/build-Dnkjpm_v.js +0 -3
  238. package/dist/ui/assets/claude-model-version-DZmbk9E2.js +0 -1
  239. package/dist/ui/assets/cloudflare-workers-ai-system-one-CfgjeR2q.js +0 -1
  240. package/dist/ui/assets/cloudflare-workers-ai-system-one-DBa2hfSp.js +0 -1
  241. package/dist/ui/assets/compat-BAGLwgqY.js +0 -2
  242. package/dist/ui/assets/compat-nGhSz-U1.js +0 -1
  243. package/dist/ui/assets/context-CrZ58_Xy.js +0 -1
  244. package/dist/ui/assets/core-BFRZk2b-.js +0 -62
  245. package/dist/ui/assets/core-EGZ5TU35.js +0 -36
  246. package/dist/ui/assets/diagnostics-Cag7MsZI.js +0 -1
  247. package/dist/ui/assets/dist-Cu98pw2t.js +0 -9
  248. package/dist/ui/assets/dist-xQGtC96q.js +0 -4
  249. package/dist/ui/assets/edit-dC5128uh.js +0 -16
  250. package/dist/ui/assets/env-api-keys-BXRkymgV.js +0 -1
  251. package/dist/ui/assets/env-api-keys-CPPAm2nU.js +0 -1
  252. package/dist/ui/assets/error-CJ3RHG07.js +0 -1
  253. package/dist/ui/assets/github-copilot-BFAy1omp.js +0 -2
  254. package/dist/ui/assets/google-generative-ai-BiB1UYSx.js +0 -1
  255. package/dist/ui/assets/google-vertex-B2qHfYD5.js +0 -1
  256. package/dist/ui/assets/kernel-worker-DIOokGRo.js +0 -1260
  257. package/dist/ui/assets/libesm-BypnjKEL.js +0 -13
  258. package/dist/ui/assets/main-CfN2cUqZ.js +0 -22
  259. package/dist/ui/assets/models-CET5SEuw.js +0 -8
  260. package/dist/ui/assets/models-Xc0Gclrk.js +0 -8
  261. package/dist/ui/assets/new-session-DCVkAjxC.js +0 -2
  262. package/dist/ui/assets/node.browser-3Nibdso-.js +0 -1
  263. package/dist/ui/assets/node.browser-DFtqp6Hr.js +0 -1
  264. package/dist/ui/assets/oauth-bootstrap-BXF8NQag.js +0 -2
  265. package/dist/ui/assets/openai-completions-Dx5kqcwu.js +0 -5
  266. package/dist/ui/assets/openai-completions-nAjVDcoU.js +0 -5
  267. package/dist/ui/assets/openai-responses-BzrpHAlB.js +0 -1
  268. package/dist/ui/assets/openai-responses-CnpU2GL3.js +0 -1
  269. package/dist/ui/assets/openrouter.models-BWF0jSAQ.js +0 -1
  270. package/dist/ui/assets/openrouter.models-DHpsqCCC.js +0 -1
  271. package/dist/ui/assets/panel-rpc-handlers-DFPKlmOB.js +0 -2
  272. package/dist/ui/assets/pi-edit-execution-C6VSS68P.js +0 -2
  273. package/dist/ui/assets/pi-transcript-context-4pjVPiVC.js +0 -1
  274. package/dist/ui/assets/provider-store-access-8Kjohitf.js +0 -1
  275. package/dist/ui/assets/provider-store-access-B-CkHLl5.js +0 -1
  276. package/dist/ui/assets/providers-BlihNA7u.js +0 -2
  277. package/dist/ui/assets/record-CBv8rWFt.js +0 -1
  278. package/dist/ui/assets/record-COQlaFL1.js +0 -1
  279. package/dist/ui/assets/setup-model-catalog-BJ6Hqkh-.js +0 -1
  280. package/dist/ui/assets/slicc-version-tZkTwmfz.js +0 -1
  281. package/dist/ui/assets/system-one-shared-B0og9uUi.js +0 -1
  282. package/dist/ui/assets/system-one-shared-iVEDyuts.js +0 -1
  283. package/dist/ui/assets/transform-messages-BeurHGV0.js +0 -1
  284. package/dist/ui/assets/transform-messages-k2mfzJwY.js +0 -1
  285. package/dist/ui/assets/typesafe-system-one-D_iVKLH6.js +0 -1
  286. package/dist/ui/assets/typesafe-system-one-Ds8-mdzH.js +0 -1
  287. package/dist/ui/assets/wc-attach-i7R9wRQy.js +0 -13
  288. package/dist/ui/assets/wc-extension-C9gpI6oX.js +0 -2
  289. package/dist/ui/assets/wc-follower-CQSWKN20.js +0 -17
  290. package/dist/ui/assets/wc-live-BFgffnb7.js +0 -248
  291. package/dist/ui/assets/wc-nav-ljnm58LU.js +0 -2
  292. package/dist/ui/assets/wc-placeholder-BodLGoP_.js +0 -4
  293. package/dist/ui/assets/wc-sprinkles-RpKjg3A5.js +0 -2
  294. package/dist/ui/assets/wc-transcript-export-CstNRG9n.js +0 -2
  295. package/dist/ui/assets/welcome-detection-o5jTF0Xc.js +0 -1
  296. package/dist/ui/assets/whisper-session-BoS3c9u2.js +0 -2
  297. package/dist/ui/assets/xai-grok-DB7G774g.js +0 -1
  298. package/dist/ui/assets/xai-grok-tiXY9TSK.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/clipboard-eqmn97SP.js","assets/rolldown-runtime-Dd_uD5pT.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./diagnostics-B-5VkVir.js";import{t}from"./preload-helper-Czpn1I53.js";import{a as n}from"./compat-0YnuwvMn.js";import{a as r,c as i,i as a,r as o,s,t as c}from"./legacy-api-aliases-D-3Ssy_B.js";import{a as l,i as u}from"./core-DzRw0pz2.js";import{G as d,u as ee}from"./account-store-C7cmsYvk.js";import"./main-DMcZBsBh.js";var te=`https://api.github.com/copilot_internal/user`,f=8e3;function p(e){if(!e||typeof e!=`object`)return null;let t=e.quota_snapshots?.premium_interactions;return!t||t.unlimited||typeof t.percent_remaining!=`number`?null:{percent:Math.max(0,100-t.percent_remaining),status:t.percent_remaining<=0&&t.overage_permitted!==!0?`rate-limited`:`ok`,window:`monthly`,resetsAt:e.quota_reset_date_utc}}async function m(e,t,n={}){let r=typeof AbortController==`function`?new AbortController:null,i=r?setTimeout(()=>r.abort(),n.timeoutMs??f):null;try{let i=await t(te,{headers:{...n.headers,Authorization:`Bearer ${e}`},...r?{signal:r.signal}:{}});if(i.status===404||i.status===501)return null;if(!i.ok)throw Error(`GitHub Copilot /copilot_internal/user returned ${i.status}`);return p(await i.json())}finally{i&&clearTimeout(i)}}var h=`github-copilot`,g=atob(`SXYxLmI1MDdhMDhjODdlY2ZlOTg=`),_=`https://github.com/login/device/code`,v=`https://github.com/login/oauth/access_token`,y=`https://api.github.com/copilot_internal/v2/token`,b={Accept:`application/json`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`},x={Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},S=`https://github.com/login/device/success*`;function C(){return ee().find(e=>e.providerId===h)}async function w(){let e=await fetch(_,{method:`POST`,headers:x,body:new URLSearchParams({client_id:g,scope:`read:user`})});if(!e.ok)throw Error(`GitHub device-code request failed: ${e.status} ${e.statusText} — ${await e.text().catch(()=>``)}`);let t=await e.json();if(typeof t.device_code!=`string`||typeof t.user_code!=`string`||typeof t.verification_uri!=`string`||typeof t.expires_in!=`number`||typeof t.interval!=`number`)throw Error(`GitHub device-code response had an unexpected shape`);return t}async function T(e,t){let n=Date.now()+e.expires_in*1e3,r=Math.max(1e3,Math.floor(e.interval*1e3)),i=1.2;for(;Date.now()<n;){if(t.aborted)throw Error(`Copilot login cancelled`);await E(Math.ceil(r*i),t);let n=await fetch(v,{method:`POST`,headers:x,body:new URLSearchParams({client_id:g,device_code:e.device_code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`})});if(!n.ok)throw Error(`GitHub token poll failed: ${n.status} ${n.statusText} — ${await n.text().catch(()=>``)}`);let a=await n.json();if(typeof a.access_token==`string`&&a.access_token.length>0)return a.access_token;if(a.error!==`authorization_pending`){if(a.error===`slow_down`){r=typeof a.interval==`number`?a.interval*1e3:r+5e3,i=1.4;continue}if(a.error){let e=a.error_description?`: ${a.error_description}`:``;throw Error(`Device flow failed (${a.error})${e}`)}}}throw Error(`Copilot device flow timed out (device code expired)`)}function E(e,t){return new Promise((n,r)=>{if(t.aborted){r(Error(`Copilot login cancelled`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Copilot login cancelled`))},{once:!0})})}function ne(e){let t=e.match(/proxy-ep=([^;]+)/);return t?`https://${t[1].replace(/^proxy\./,`api.`)}`:null}async function D(e){let t=await fetch(y,{headers:{...b,Authorization:`Bearer ${e}`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Copilot token exchange failed: ${t.status} ${t.statusText} — ${e.slice(0,300)}`)}let n=await t.json();if(typeof n.token!=`string`||typeof n.expires_at!=`number`)throw Error(`Copilot token exchange returned an unexpected payload`);if(n.chat_enabled===!1)throw Error(`GitHub Copilot Chat is disabled for this account (no chat features granted)`);return{copilotToken:n.token,expiresAtMs:n.expires_at*1e3-3e5,apiBaseUrl:ne(n.token)??`https://api.individual.githubcopilot.com`,githubAccessToken:e}}var O=`github-copilot.models.v1`;function k(e){let t=e.supported_endpoints??[],n=(e.vendor??``).toLowerCase(),r=e.id;return n===`anthropic`&&t.includes(`/v1/messages`)?`anthropic-messages`:n===`openai`&&(/^gpt-5/i.test(r)||/codex/i.test(r)||/^o\d/i.test(r))?`openai-responses`:`openai-completions`}function A(e){if(!e||typeof e!=`object`)return[];let t=e.data;if(!Array.isArray(t))return[];let n=[];for(let e of t)e.capabilities?.type&&e.capabilities.type!==`chat`||e.model_picker_enabled!==!1&&e.id&&n.push({id:e.id,name:e.name??e.id,vendor:e.vendor??``,api:k(e),contextWindow:e.capabilities?.limits?.max_context_window_tokens??e.capabilities?.limits?.max_prompt_tokens??128e3,maxTokens:e.capabilities?.limits?.max_output_tokens??8192,supportsTools:e.capabilities?.supports?.tool_calls===!0,supportsStreaming:e.capabilities?.supports?.streaming!==!1,supportsVision:e.capabilities?.supports?.vision===!0,supportsReasoning:e.capabilities?.supports?.adaptive_thinking===!0||Array.isArray(e.capabilities?.supports?.reasoning_effort),policyState:e.policy?.state??`enabled`});return n}async function j(e){let t=await fetch(`${e.apiBaseUrl}/models`,{headers:{...b,Authorization:`Bearer ${e.copilotToken}`,Accept:`application/json`}});if(!t.ok)throw Error(`Copilot /models returned ${t.status} ${t.statusText}`);return A(await t.json())}function M(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(O);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function N(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(O,JSON.stringify(e))}catch{}}function P(e){return M().find(t=>t.id===e)??null}async function F(e){let t;try{t=await j(e)}catch(e){console.warn(`[github-copilot] Catalog refresh failed; keeping previous cache.`,e instanceof Error?e.message:String(e));return}N(t),await Promise.all(t.filter(e=>e.policyState===`disabled`).map(async t=>{let n=`${e.apiBaseUrl}/models/${encodeURIComponent(t.id)}/policy`;try{let r=await fetch(n,{method:`POST`,headers:{...b,"Content-Type":`application/json`,Authorization:`Bearer ${e.copilotToken}`,"openai-intent":`chat-policy`,"x-interaction-type":`chat-policy`},body:JSON.stringify({state:`enabled`})});r.ok?t.policyState=`enabled`:r.status!==404&&r.status!==400&&console.warn(`[github-copilot] enable policy for ${t.id} returned ${r.status} ${r.statusText}`)}catch(e){console.warn(`[github-copilot] enable policy for ${t.id} failed:`,e instanceof Error?e.message:String(e))}})),N(t)}async function I(e,t){await d({providerId:h,accessToken:e.copilotToken,refreshToken:e.githubAccessToken,tokenExpiresAt:e.expiresAtMs,baseUrl:e.apiBaseUrl,userName:t})}async function L(){let e=C();if(!e?.accessToken||!e.refreshToken)throw Error(`Not logged in to GitHub Copilot — click "Login" in the provider settings`);let t=e.tokenExpiresAt??0;if(Date.now()<t-6e4)return e.accessToken;let n=await D(e.refreshToken);return await I(n,e.userName),n.copilotToken}var R=[`mini`,`nano`,`flash`,`haiku`,`lite`,`embedding`];function z(e){let t=[e.id,e.name??``].flatMap(e=>{let t=e.toLowerCase();return[t,t.replace(/[\s_.:]+/g,`-`)]});return!R.some(e=>t.some(t=>t.includes(e)))}function B(){if(!C()?.accessToken)return[];let e=M();if(e.length>0)return e.filter(e=>!e.policyState.startsWith(`unavailable:`)).filter(e=>z(e)).map(e=>({id:e.id,name:e.name,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.supportsReasoning,input:e.supportsVision?[`text`,`image`]:[`text`]}));let t;try{t=l(`github-copilot`)}catch{return[]}return t.filter(e=>z({id:e.id,name:e.name})).map(e=>({id:e.id,name:e.name??e.id,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.reasoning,input:e.input}))}function V(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:e.api,provider:h,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var H={"User-Agent":`GitHubCopilotChat/0.35.0`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`};function U(e){let t=C(),n=t?.baseUrl??`https://api.individual.githubcopilot.com`,r=P(e);if(r)return{api:r.api,baseUrl:n,headers:{...H}};try{let n=u(`github-copilot`,e);return{api:n.api,baseUrl:t?.baseUrl??n.baseUrl,headers:{...n.headers??{},...H}}}catch{return null}}function W(e,t){let n=M(),r=n.findIndex(t=>t.id===e);r<0||(n[r]={...n[r],policyState:`unavailable:${t}`},N(n))}function G(e,t){return`GitHub Copilot rejected "${e}" with model_not_supported. This usually means the model isn't included in your Copilot plan (Opus and other premium models require Copilot Pro / Pro+ / Business / Enterprise). Try Claude Sonnet 4.6 or another model that appears in the picker after a fresh login. Original error: ${t}`}function K(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`error`)return null;if(t.error&&typeof t.error==`object`){let e=t.error.errorMessage;if(typeof e==`string`)return e}return typeof t.errorMessage==`string`?t.errorMessage:null}function q(e,t){return e===`anthropic-messages`?t?r:c:e===`openai-responses`?t?i:a:t?s:o}function J(e,t,n){let r=K(n);if(r&&/model_not_supported/i.test(r)){W(t.id,`model_not_supported`);let n=G(t.id,r);return console.error(`[github-copilot] Plan-gated model rejection:`,n),e.push(V(t,Error(n))),e.end(),!0}return e.push(n),!1}function Y(e,t,n){let r=n instanceof Error?n.message:String(n),i=n;/model_not_supported/i.test(r)&&(W(t.id,`model_not_supported`),i=Error(G(t.id,r))),console.error(`[github-copilot] Stream error:`,i instanceof Error?i.message:String(i)),e.push(V(t,i)),e.end()}async function X(e,t,n,r,i){try{let a=await L(),o=U(t.id);if(!o)throw Error(`GitHub Copilot does not recognize "${t.id}" — open the picker (the model list refreshes on login) and pick a current model.`);let s={...t,api:o.api,baseUrl:o.baseUrl,headers:o.headers,provider:`github-copilot`},c={...r,apiKey:a},l=q(o.api,i)(s,n,c);for await(let n of l)if(J(e,t,n))return;e.end()}catch(n){Y(e,t,n)}}function Z(t){return(n,r,i={})=>{let a=e();return X(a,n,r,i,t),a}}var Q=Z(!1),$=Z(!0),re=({userCode:e,verificationUrl:n})=>typeof document>`u`?(console.info(`[github-copilot] Device verification code: ${e} — open ${n} in a browser to authorize.`),Promise.resolve(`continue`)):new Promise(n=>{let r=document.createElement(`div`);r.setAttribute(`data-slicc-overlay`,`github-copilot-device`),r.style.cssText=[`position:fixed`,`top:24px`,`right:24px`,`z-index:2147483647`,`background:#0d1117`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:10px`,`padding:16px 18px`,`box-shadow:0 8px 32px rgba(0,0,0,0.45)`,`font:13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,`min-width:260px`,`max-width:340px`].join(`;`);let i=document.createElement(`div`);i.textContent=`GitHub Copilot — verification code`,i.style.cssText=`font-weight:600;margin-bottom:8px;color:#7ee787`;let a=document.createElement(`div`);a.textContent=e,a.style.cssText=[`font:600 22px ui-monospace, SFMono-Regular, Menlo, monospace`,`letter-spacing:2px`,`background:#161b22`,`border:1px solid #30363d`,`border-radius:6px`,`padding:10px 12px`,`text-align:center`,`margin-bottom:10px`,`user-select:all`,`cursor:text`].join(`;`);let o=document.createElement(`div`);o.style.cssText=`color:#8b949e;font-size:12px;line-height:1.5`,o.textContent=`Copy the code, then click Continue to open the GitHub authorization page in a new tab.`;let s=document.createElement(`div`);s.style.cssText=`display:flex;gap:8px;margin-top:12px;justify-content:flex-end`;let c=document.createElement(`button`);c.type=`button`,c.textContent=`Cancel`,c.style.cssText=[`background:transparent`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let l=document.createElement(`button`);l.type=`button`,l.textContent=`Copy & Continue`,l.style.cssText=[`background:#238636`,`color:#fff`,`border:0`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let u=()=>{try{r.remove()}catch{}};c.addEventListener(`click`,()=>{u(),n(`cancel`)}),l.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:n}=await t(async()=>{let{copyTextToClipboard:e}=await import(`./clipboard-eqmn97SP.js`).then(e=>e.t);return{copyTextToClipboard:e}},__vite__mapDeps([0,1]));await n(e)}catch{}u(),n(`continue`)})()}),s.appendChild(c),s.appendChild(l),r.appendChild(i),r.appendChild(a),r.appendChild(o),r.appendChild(s),document.body.appendChild(r)});async function ie(){let e=C();return e?.refreshToken?m(e.refreshToken,fetch,{headers:b}):null}var ae={id:h,name:`GitHub Copilot`,description:`Use your GitHub Copilot subscription to access Claude, GPT-5, Codex, Gemini, and Grok models. Sign in with the GitHub device-code flow.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`claude-sonnet-4.6`,oauthTokenDomains:[`*.githubcopilot.com`,`api.individual.githubcopilot.com`,`api.business.githubcopilot.com`,`api.enterprise.githubcopilot.com`],getModelIds:B,getBudgetUsage:ie,onOAuthLoginIntercepted:async(e,t,n)=>{let r=await w(),i=new URL(r.verification_uri);if(i.searchParams.set(`user_code`,r.user_code),await(n?.presentDeviceCode??re)({userCode:r.user_code,verificationUrl:i.toString(),expiresInSeconds:r.expires_in})===`cancel`)throw Error(`GitHub Copilot login cancelled`);let a=new AbortController,o=e({authorizeUrl:i.toString(),redirectUriPattern:S,onCapture:`close`,timeoutMs:r.expires_in*1e3}).catch(e=>(console.warn(`[github-copilot] Launcher failed:`,e instanceof Error?e.message:String(e)),null)),s;try{s=await T(r,a.signal)}catch(e){throw a.abort(),await o,e}await o;let c=await D(s),l;try{let e=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${s}`,Accept:`application/json`}});if(e.ok){let t=await e.json();l=t.name||t.login}}catch{}await I(c,l),await F(c),t()},onOAuthLogout:async()=>{await d({providerId:h,accessToken:``})},onSilentRenew:async()=>{let e=C();if(!e?.refreshToken)return null;try{let t=await D(e.refreshToken);return await I(t,e.userName),await F(t),t.copilotToken}catch(e){return console.warn(`[github-copilot] Silent renew failed:`,e instanceof Error?e.message:String(e)),null}}};function oe(){n({api:`github-copilot-anthropic`,stream:Q,streamSimple:$}),n({api:`github-copilot-openai`,stream:Q,streamSimple:$})}export{ae as config,z as isCopilotConeCompatible,oe as register};
@@ -1 +1 @@
1
- import{_ as e,r as t}from"./account-store-BxNOy49N.js";import{a as n}from"./diagnostics-Cag7MsZI.js";import{a as r}from"./compat-nGhSz-U1.js";import{a as i,i as a}from"./core-EGZ5TU35.js";import{a as o,c as s,i as c,r as l,s as u,t as d}from"./legacy-api-aliases--xyLjPgC.js";import"./provider-settings-B3qqcxSD.js";function f(e){if(!e||typeof e!=`object`)return null;let t=e.quota_snapshots?.premium_interactions;return!t||t.unlimited||typeof t.percent_remaining!=`number`?null:{percent:Math.max(0,100-t.percent_remaining),status:t.percent_remaining<=0&&t.overage_permitted!==!0?`rate-limited`:`ok`,window:`monthly`,resetsAt:e.quota_reset_date_utc}}async function p(e,t,n={}){let r=typeof AbortController==`function`?new AbortController:null,i=r?setTimeout(()=>r.abort(),n.timeoutMs??8e3):null;try{let i=await t(`https://api.github.com/copilot_internal/user`,{headers:{...n.headers,Authorization:`Bearer ${e}`},...r?{signal:r.signal}:{}});if(i.status===404||i.status===501)return null;if(!i.ok)throw Error(`GitHub Copilot /copilot_internal/user returned ${i.status}`);return f(await i.json())}finally{i&&clearTimeout(i)}}const m=`github-copilot`,h=atob(`SXYxLmI1MDdhMDhjODdlY2ZlOTg=`),g={Accept:`application/json`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`},_={Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`};function v(){return t().find(e=>e.providerId===m)}async function y(){let e=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:_,body:new URLSearchParams({client_id:h,scope:`read:user`})});if(!e.ok)throw Error(`GitHub device-code request failed: ${e.status} ${e.statusText} — ${await e.text().catch(()=>``)}`);let t=await e.json();if(typeof t.device_code!=`string`||typeof t.user_code!=`string`||typeof t.verification_uri!=`string`||typeof t.expires_in!=`number`||typeof t.interval!=`number`)throw Error(`GitHub device-code response had an unexpected shape`);return t}async function b(e,t){let n=Date.now()+e.expires_in*1e3,r=Math.max(1e3,Math.floor(e.interval*1e3)),i=1.2;for(;Date.now()<n;){if(t.aborted)throw Error(`Copilot login cancelled`);await x(Math.ceil(r*i),t);let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:_,body:new URLSearchParams({client_id:h,device_code:e.device_code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`})});if(!n.ok)throw Error(`GitHub token poll failed: ${n.status} ${n.statusText} — ${await n.text().catch(()=>``)}`);let a=await n.json();if(typeof a.access_token==`string`&&a.access_token.length>0)return a.access_token;if(a.error!==`authorization_pending`){if(a.error===`slow_down`){r=typeof a.interval==`number`?a.interval*1e3:r+5e3,i=1.4;continue}if(a.error){let e=a.error_description?`: ${a.error_description}`:``;throw Error(`Device flow failed (${a.error})${e}`)}}}throw Error(`Copilot device flow timed out (device code expired)`)}function x(e,t){return new Promise((n,r)=>{if(t.aborted){r(Error(`Copilot login cancelled`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Copilot login cancelled`))},{once:!0})})}function S(e){let t=e.match(/proxy-ep=([^;]+)/);return t?`https://${t[1].replace(/^proxy\./,`api.`)}`:null}async function C(e){let t=await fetch(`https://api.github.com/copilot_internal/v2/token`,{headers:{...g,Authorization:`Bearer ${e}`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Copilot token exchange failed: ${t.status} ${t.statusText} — ${e.slice(0,300)}`)}let n=await t.json();if(typeof n.token!=`string`||typeof n.expires_at!=`number`)throw Error(`Copilot token exchange returned an unexpected payload`);if(n.chat_enabled===!1)throw Error(`GitHub Copilot Chat is disabled for this account (no chat features granted)`);return{copilotToken:n.token,expiresAtMs:n.expires_at*1e3-3e5,apiBaseUrl:S(n.token)??`https://api.individual.githubcopilot.com`,githubAccessToken:e}}const w=`github-copilot.models.v1`;function T(e){let t=e.supported_endpoints??[],n=(e.vendor??``).toLowerCase(),r=e.id;return n===`anthropic`&&t.includes(`/v1/messages`)?`anthropic-messages`:n===`openai`&&(/^gpt-5/i.test(r)||/codex/i.test(r)||/^o\d/i.test(r))?`openai-responses`:`openai-completions`}function E(e){if(!e||typeof e!=`object`)return[];let t=e.data;if(!Array.isArray(t))return[];let n=[];for(let e of t)e.capabilities?.type&&e.capabilities.type!==`chat`||e.model_picker_enabled!==!1&&e.id&&n.push({id:e.id,name:e.name??e.id,vendor:e.vendor??``,api:T(e),contextWindow:e.capabilities?.limits?.max_context_window_tokens??e.capabilities?.limits?.max_prompt_tokens??128e3,maxTokens:e.capabilities?.limits?.max_output_tokens??8192,supportsTools:e.capabilities?.supports?.tool_calls===!0,supportsStreaming:e.capabilities?.supports?.streaming!==!1,supportsVision:e.capabilities?.supports?.vision===!0,supportsReasoning:e.capabilities?.supports?.adaptive_thinking===!0||Array.isArray(e.capabilities?.supports?.reasoning_effort),policyState:e.policy?.state??`enabled`});return n}async function D(e){let t=await fetch(`${e.apiBaseUrl}/models`,{headers:{...g,Authorization:`Bearer ${e.copilotToken}`,Accept:`application/json`}});if(!t.ok)throw Error(`Copilot /models returned ${t.status} ${t.statusText}`);return E(await t.json())}function O(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(w);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function k(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(w,JSON.stringify(e))}catch{}}function A(e){return O().find(t=>t.id===e)??null}async function j(e){let t;try{t=await D(e)}catch(e){console.warn(`[github-copilot] Catalog refresh failed; keeping previous cache.`,e instanceof Error?e.message:String(e));return}k(t),await Promise.all(t.filter(e=>e.policyState===`disabled`).map(async t=>{let n=`${e.apiBaseUrl}/models/${encodeURIComponent(t.id)}/policy`;try{let r=await fetch(n,{method:`POST`,headers:{...g,"Content-Type":`application/json`,Authorization:`Bearer ${e.copilotToken}`,"openai-intent":`chat-policy`,"x-interaction-type":`chat-policy`},body:JSON.stringify({state:`enabled`})});r.ok?t.policyState=`enabled`:r.status!==404&&r.status!==400&&console.warn(`[github-copilot] enable policy for ${t.id} returned ${r.status} ${r.statusText}`)}catch(e){console.warn(`[github-copilot] enable policy for ${t.id} failed:`,e instanceof Error?e.message:String(e))}})),k(t)}async function M(t,n){await e({providerId:m,accessToken:t.copilotToken,refreshToken:t.githubAccessToken,tokenExpiresAt:t.expiresAtMs,baseUrl:t.apiBaseUrl,userName:n})}async function N(){let e=v();if(!e?.accessToken||!e.refreshToken)throw Error(`Not logged in to GitHub Copilot — click "Login" in the provider settings`);let t=e.tokenExpiresAt??0;if(Date.now()<t-6e4)return e.accessToken;let n=await C(e.refreshToken);return await M(n,e.userName),n.copilotToken}const P=[`mini`,`nano`,`flash`,`haiku`,`lite`,`embedding`];function F(e){let t=[e.id,e.name??``].flatMap(e=>{let t=e.toLowerCase();return[t,t.replace(/[\s_.:]+/g,`-`)]});return!P.some(e=>t.some(t=>t.includes(e)))}function I(){if(!v()?.accessToken)return[];let e=O();if(e.length>0)return e.filter(e=>!e.policyState.startsWith(`unavailable:`)).filter(e=>F(e)).map(e=>({id:e.id,name:e.name,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.supportsReasoning,input:e.supportsVision?[`text`,`image`]:[`text`]}));let t;try{t=i(`github-copilot`)}catch{return[]}return t.filter(e=>F({id:e.id,name:e.name})).map(e=>({id:e.id,name:e.name??e.id,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.reasoning,input:e.input}))}function L(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:e.api,provider:m,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const R={"User-Agent":`GitHubCopilotChat/0.35.0`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`};function z(e){let t=v(),n=t?.baseUrl??`https://api.individual.githubcopilot.com`,r=A(e);if(r)return{api:r.api,baseUrl:n,headers:{...R}};try{let n=a(`github-copilot`,e);return{api:n.api,baseUrl:t?.baseUrl??n.baseUrl,headers:{...n.headers??{},...R}}}catch{return null}}function B(e,t){let n=O(),r=n.findIndex(t=>t.id===e);r<0||(n[r]={...n[r],policyState:`unavailable:${t}`},k(n))}function V(e,t){return`GitHub Copilot rejected "${e}" with model_not_supported. This usually means the model isn't included in your Copilot plan (Opus and other premium models require Copilot Pro / Pro+ / Business / Enterprise). Try Claude Sonnet 4.6 or another model that appears in the picker after a fresh login. Original error: ${t}`}function H(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`error`)return null;if(t.error&&typeof t.error==`object`){let e=t.error.errorMessage;if(typeof e==`string`)return e}return typeof t.errorMessage==`string`?t.errorMessage:null}function U(e,t){return e===`anthropic-messages`?t?o:d:e===`openai-responses`?t?s:c:t?u:l}function W(e,t,n){let r=H(n);if(r&&/model_not_supported/i.test(r)){B(t.id,`model_not_supported`);let n=V(t.id,r);return console.error(`[github-copilot] Plan-gated model rejection:`,n),e.push(L(t,Error(n))),e.end(),!0}return e.push(n),!1}function G(e,t,n){let r=n instanceof Error?n.message:String(n),i=n;/model_not_supported/i.test(r)&&(B(t.id,`model_not_supported`),i=Error(V(t.id,r))),console.error(`[github-copilot] Stream error:`,i instanceof Error?i.message:String(i)),e.push(L(t,i)),e.end()}async function K(e,t,n,r,i){try{let a=await N(),o=z(t.id);if(!o)throw Error(`GitHub Copilot does not recognize "${t.id}" — open the picker (the model list refreshes on login) and pick a current model.`);let s={...t,api:o.api,baseUrl:o.baseUrl,headers:o.headers,provider:`github-copilot`},c={...r,apiKey:a},l=U(o.api,i)(s,n,c);for await(let n of l)if(W(e,t,n))return;e.end()}catch(n){G(e,t,n)}}function q(e){return(t,r,i={})=>{let a=n();return K(a,t,r,i,e),a}}const J=q(!1),Y=q(!0),X=({userCode:e,verificationUrl:t})=>typeof document>`u`?(console.info(`[github-copilot] Device verification code: ${e} — open ${t} in a browser to authorize.`),Promise.resolve(`continue`)):new Promise(t=>{let n=document.createElement(`div`);n.setAttribute(`data-slicc-overlay`,`github-copilot-device`),n.style.cssText=[`position:fixed`,`top:24px`,`right:24px`,`z-index:2147483647`,`background:#0d1117`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:10px`,`padding:16px 18px`,`box-shadow:0 8px 32px rgba(0,0,0,0.45)`,`font:13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,`min-width:260px`,`max-width:340px`].join(`;`);let r=document.createElement(`div`);r.textContent=`GitHub Copilot — verification code`,r.style.cssText=`font-weight:600;margin-bottom:8px;color:#7ee787`;let i=document.createElement(`div`);i.textContent=e,i.style.cssText=[`font:600 22px ui-monospace, SFMono-Regular, Menlo, monospace`,`letter-spacing:2px`,`background:#161b22`,`border:1px solid #30363d`,`border-radius:6px`,`padding:10px 12px`,`text-align:center`,`margin-bottom:10px`,`user-select:all`,`cursor:text`].join(`;`);let a=document.createElement(`div`);a.style.cssText=`color:#8b949e;font-size:12px;line-height:1.5`,a.textContent=`Copy the code, then click Continue to open the GitHub authorization page in a new tab.`;let o=document.createElement(`div`);o.style.cssText=`display:flex;gap:8px;margin-top:12px;justify-content:flex-end`;let s=document.createElement(`button`);s.type=`button`,s.textContent=`Cancel`,s.style.cssText=[`background:transparent`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let c=document.createElement(`button`);c.type=`button`,c.textContent=`Copy & Continue`,c.style.cssText=[`background:#238636`,`color:#fff`,`border:0`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let l=()=>{try{n.remove()}catch{}};s.addEventListener(`click`,()=>{l(),t(`cancel`)}),c.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:t}=await import(`./provider-settings-B3qqcxSD.js`).then(e=>e.t);await t(e)}catch{}l(),t(`continue`)})()}),o.appendChild(s),o.appendChild(c),n.appendChild(r),n.appendChild(i),n.appendChild(a),n.appendChild(o),document.body.appendChild(n)});async function Z(){let e=v();return e?.refreshToken?p(e.refreshToken,fetch,{headers:g}):null}const Q={id:m,name:`GitHub Copilot`,description:`Use your GitHub Copilot subscription to access Claude, GPT-5, Codex, Gemini, and Grok models. Sign in with the GitHub device-code flow.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`claude-sonnet-4.6`,oauthTokenDomains:[`*.githubcopilot.com`,`api.individual.githubcopilot.com`,`api.business.githubcopilot.com`,`api.enterprise.githubcopilot.com`],getModelIds:I,getBudgetUsage:Z,onOAuthLoginIntercepted:async(e,t,n)=>{let r=await y(),i=new URL(r.verification_uri);if(i.searchParams.set(`user_code`,r.user_code),await(n?.presentDeviceCode??X)({userCode:r.user_code,verificationUrl:i.toString(),expiresInSeconds:r.expires_in})===`cancel`)throw Error(`GitHub Copilot login cancelled`);let a=new AbortController,o=e({authorizeUrl:i.toString(),redirectUriPattern:`https://github.com/login/device/success*`,onCapture:`close`,timeoutMs:r.expires_in*1e3}).catch(e=>(console.warn(`[github-copilot] Launcher failed:`,e instanceof Error?e.message:String(e)),null)),s;try{s=await b(r,a.signal)}catch(e){throw a.abort(),await o,e}await o;let c=await C(s),l;try{let e=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${s}`,Accept:`application/json`}});if(e.ok){let t=await e.json();l=t.name||t.login}}catch{}await M(c,l),await j(c),t()},onOAuthLogout:async()=>{await e({providerId:m,accessToken:``})},onSilentRenew:async()=>{let e=v();if(!e?.refreshToken)return null;try{let t=await C(e.refreshToken);return await M(t,e.userName),await j(t),t.copilotToken}catch(e){return console.warn(`[github-copilot] Silent renew failed:`,e instanceof Error?e.message:String(e)),null}}};function $(){r({api:`github-copilot-anthropic`,stream:J,streamSimple:Y}),r({api:`github-copilot-openai`,stream:J,streamSimple:Y})}export{Q as config,F as isCopilotConeCompatible,$ as register};
1
+ import{_ as e,r as t}from"./account-store-LMcdoHV5.js";import{a as n}from"./diagnostics-B-5VkVir.js";import{a as r}from"./compat-Ba4wPWa_.js";import{a as i,c as a,i as o,r as s,s as c,t as l}from"./legacy-api-aliases-C3_OAyZB.js";import{a as u,i as d}from"./core-C--iyWKC.js";import"./provider-settings-DB_WwQDb.js";function f(e){if(!e||typeof e!=`object`)return null;let t=e.quota_snapshots?.premium_interactions;return!t||t.unlimited||typeof t.percent_remaining!=`number`?null:{percent:Math.max(0,100-t.percent_remaining),status:t.percent_remaining<=0&&t.overage_permitted!==!0?`rate-limited`:`ok`,window:`monthly`,resetsAt:e.quota_reset_date_utc}}async function p(e,t,n={}){let r=typeof AbortController==`function`?new AbortController:null,i=r?setTimeout(()=>r.abort(),n.timeoutMs??8e3):null;try{let i=await t(`https://api.github.com/copilot_internal/user`,{headers:{...n.headers,Authorization:`Bearer ${e}`},...r?{signal:r.signal}:{}});if(i.status===404||i.status===501)return null;if(!i.ok)throw Error(`GitHub Copilot /copilot_internal/user returned ${i.status}`);return f(await i.json())}finally{i&&clearTimeout(i)}}const m=`github-copilot`,h=atob(`SXYxLmI1MDdhMDhjODdlY2ZlOTg=`),g={Accept:`application/json`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`},_={Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`};function v(){return t().find(e=>e.providerId===m)}async function y(){let e=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:_,body:new URLSearchParams({client_id:h,scope:`read:user`})});if(!e.ok)throw Error(`GitHub device-code request failed: ${e.status} ${e.statusText} — ${await e.text().catch(()=>``)}`);let t=await e.json();if(typeof t.device_code!=`string`||typeof t.user_code!=`string`||typeof t.verification_uri!=`string`||typeof t.expires_in!=`number`||typeof t.interval!=`number`)throw Error(`GitHub device-code response had an unexpected shape`);return t}async function b(e,t){let n=Date.now()+e.expires_in*1e3,r=Math.max(1e3,Math.floor(e.interval*1e3)),i=1.2;for(;Date.now()<n;){if(t.aborted)throw Error(`Copilot login cancelled`);await x(Math.ceil(r*i),t);let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:_,body:new URLSearchParams({client_id:h,device_code:e.device_code,grant_type:`urn:ietf:params:oauth:grant-type:device_code`})});if(!n.ok)throw Error(`GitHub token poll failed: ${n.status} ${n.statusText} — ${await n.text().catch(()=>``)}`);let a=await n.json();if(typeof a.access_token==`string`&&a.access_token.length>0)return a.access_token;if(a.error!==`authorization_pending`){if(a.error===`slow_down`){r=typeof a.interval==`number`?a.interval*1e3:r+5e3,i=1.4;continue}if(a.error){let e=a.error_description?`: ${a.error_description}`:``;throw Error(`Device flow failed (${a.error})${e}`)}}}throw Error(`Copilot device flow timed out (device code expired)`)}function x(e,t){return new Promise((n,r)=>{if(t.aborted){r(Error(`Copilot login cancelled`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Copilot login cancelled`))},{once:!0})})}function S(e){let t=e.match(/proxy-ep=([^;]+)/);return t?`https://${t[1].replace(/^proxy\./,`api.`)}`:null}async function C(e){let t=await fetch(`https://api.github.com/copilot_internal/v2/token`,{headers:{...g,Authorization:`Bearer ${e}`}});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`Copilot token exchange failed: ${t.status} ${t.statusText} — ${e.slice(0,300)}`)}let n=await t.json();if(typeof n.token!=`string`||typeof n.expires_at!=`number`)throw Error(`Copilot token exchange returned an unexpected payload`);if(n.chat_enabled===!1)throw Error(`GitHub Copilot Chat is disabled for this account (no chat features granted)`);return{copilotToken:n.token,expiresAtMs:n.expires_at*1e3-3e5,apiBaseUrl:S(n.token)??`https://api.individual.githubcopilot.com`,githubAccessToken:e}}const w=`github-copilot.models.v1`;function T(e){let t=e.supported_endpoints??[],n=(e.vendor??``).toLowerCase(),r=e.id;return n===`anthropic`&&t.includes(`/v1/messages`)?`anthropic-messages`:n===`openai`&&(/^gpt-5/i.test(r)||/codex/i.test(r)||/^o\d/i.test(r))?`openai-responses`:`openai-completions`}function E(e){if(!e||typeof e!=`object`)return[];let t=e.data;if(!Array.isArray(t))return[];let n=[];for(let e of t)e.capabilities?.type&&e.capabilities.type!==`chat`||e.model_picker_enabled!==!1&&e.id&&n.push({id:e.id,name:e.name??e.id,vendor:e.vendor??``,api:T(e),contextWindow:e.capabilities?.limits?.max_context_window_tokens??e.capabilities?.limits?.max_prompt_tokens??128e3,maxTokens:e.capabilities?.limits?.max_output_tokens??8192,supportsTools:e.capabilities?.supports?.tool_calls===!0,supportsStreaming:e.capabilities?.supports?.streaming!==!1,supportsVision:e.capabilities?.supports?.vision===!0,supportsReasoning:e.capabilities?.supports?.adaptive_thinking===!0||Array.isArray(e.capabilities?.supports?.reasoning_effort),policyState:e.policy?.state??`enabled`});return n}async function D(e){let t=await fetch(`${e.apiBaseUrl}/models`,{headers:{...g,Authorization:`Bearer ${e.copilotToken}`,Accept:`application/json`}});if(!t.ok)throw Error(`Copilot /models returned ${t.status} ${t.statusText}`);return E(await t.json())}function O(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(w);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function k(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(w,JSON.stringify(e))}catch{}}function A(e){return O().find(t=>t.id===e)??null}async function j(e){let t;try{t=await D(e)}catch(e){console.warn(`[github-copilot] Catalog refresh failed; keeping previous cache.`,e instanceof Error?e.message:String(e));return}k(t),await Promise.all(t.filter(e=>e.policyState===`disabled`).map(async t=>{let n=`${e.apiBaseUrl}/models/${encodeURIComponent(t.id)}/policy`;try{let r=await fetch(n,{method:`POST`,headers:{...g,"Content-Type":`application/json`,Authorization:`Bearer ${e.copilotToken}`,"openai-intent":`chat-policy`,"x-interaction-type":`chat-policy`},body:JSON.stringify({state:`enabled`})});r.ok?t.policyState=`enabled`:r.status!==404&&r.status!==400&&console.warn(`[github-copilot] enable policy for ${t.id} returned ${r.status} ${r.statusText}`)}catch(e){console.warn(`[github-copilot] enable policy for ${t.id} failed:`,e instanceof Error?e.message:String(e))}})),k(t)}async function M(t,n){await e({providerId:m,accessToken:t.copilotToken,refreshToken:t.githubAccessToken,tokenExpiresAt:t.expiresAtMs,baseUrl:t.apiBaseUrl,userName:n})}async function N(){let e=v();if(!e?.accessToken||!e.refreshToken)throw Error(`Not logged in to GitHub Copilot — click "Login" in the provider settings`);let t=e.tokenExpiresAt??0;if(Date.now()<t-6e4)return e.accessToken;let n=await C(e.refreshToken);return await M(n,e.userName),n.copilotToken}const P=[`mini`,`nano`,`flash`,`haiku`,`lite`,`embedding`];function F(e){let t=[e.id,e.name??``].flatMap(e=>{let t=e.toLowerCase();return[t,t.replace(/[\s_.:]+/g,`-`)]});return!P.some(e=>t.some(t=>t.includes(e)))}function I(){if(!v()?.accessToken)return[];let e=O();if(e.length>0)return e.filter(e=>!e.policyState.startsWith(`unavailable:`)).filter(e=>F(e)).map(e=>({id:e.id,name:e.name,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.supportsReasoning,input:e.supportsVision?[`text`,`image`]:[`text`]}));let t;try{t=u(`github-copilot`)}catch{return[]}return t.filter(e=>F({id:e.id,name:e.name})).map(e=>({id:e.id,name:e.name??e.id,api:e.api===`anthropic-messages`?`anthropic`:`openai`,context_window:e.contextWindow,max_tokens:e.maxTokens,reasoning:e.reasoning,input:e.input}))}function L(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:e.api,provider:m,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const R={"User-Agent":`GitHubCopilotChat/0.35.0`,"Editor-Version":`vscode/1.107.0`,"Editor-Plugin-Version":`copilot-chat/0.35.0`,"Copilot-Integration-Id":`vscode-chat`};function z(e){let t=v(),n=t?.baseUrl??`https://api.individual.githubcopilot.com`,r=A(e);if(r)return{api:r.api,baseUrl:n,headers:{...R}};try{let n=d(`github-copilot`,e);return{api:n.api,baseUrl:t?.baseUrl??n.baseUrl,headers:{...n.headers??{},...R}}}catch{return null}}function B(e,t){let n=O(),r=n.findIndex(t=>t.id===e);r<0||(n[r]={...n[r],policyState:`unavailable:${t}`},k(n))}function V(e,t){return`GitHub Copilot rejected "${e}" with model_not_supported. This usually means the model isn't included in your Copilot plan (Opus and other premium models require Copilot Pro / Pro+ / Business / Enterprise). Try Claude Sonnet 4.6 or another model that appears in the picker after a fresh login. Original error: ${t}`}function H(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`error`)return null;if(t.error&&typeof t.error==`object`){let e=t.error.errorMessage;if(typeof e==`string`)return e}return typeof t.errorMessage==`string`?t.errorMessage:null}function U(e,t){return e===`anthropic-messages`?t?i:l:e===`openai-responses`?t?a:o:t?c:s}function W(e,t,n){let r=H(n);if(r&&/model_not_supported/i.test(r)){B(t.id,`model_not_supported`);let n=V(t.id,r);return console.error(`[github-copilot] Plan-gated model rejection:`,n),e.push(L(t,Error(n))),e.end(),!0}return e.push(n),!1}function G(e,t,n){let r=n instanceof Error?n.message:String(n),i=n;/model_not_supported/i.test(r)&&(B(t.id,`model_not_supported`),i=Error(V(t.id,r))),console.error(`[github-copilot] Stream error:`,i instanceof Error?i.message:String(i)),e.push(L(t,i)),e.end()}async function K(e,t,n,r,i){try{let a=await N(),o=z(t.id);if(!o)throw Error(`GitHub Copilot does not recognize "${t.id}" — open the picker (the model list refreshes on login) and pick a current model.`);let s={...t,api:o.api,baseUrl:o.baseUrl,headers:o.headers,provider:`github-copilot`},c={...r,apiKey:a},l=U(o.api,i)(s,n,c);for await(let n of l)if(W(e,t,n))return;e.end()}catch(n){G(e,t,n)}}function q(e){return(t,r,i={})=>{let a=n();return K(a,t,r,i,e),a}}const J=q(!1),Y=q(!0),X=({userCode:e,verificationUrl:t})=>typeof document>`u`?(console.info(`[github-copilot] Device verification code: ${e} — open ${t} in a browser to authorize.`),Promise.resolve(`continue`)):new Promise(t=>{let n=document.createElement(`div`);n.setAttribute(`data-slicc-overlay`,`github-copilot-device`),n.style.cssText=[`position:fixed`,`top:24px`,`right:24px`,`z-index:2147483647`,`background:#0d1117`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:10px`,`padding:16px 18px`,`box-shadow:0 8px 32px rgba(0,0,0,0.45)`,`font:13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,`min-width:260px`,`max-width:340px`].join(`;`);let r=document.createElement(`div`);r.textContent=`GitHub Copilot — verification code`,r.style.cssText=`font-weight:600;margin-bottom:8px;color:#7ee787`;let i=document.createElement(`div`);i.textContent=e,i.style.cssText=[`font:600 22px ui-monospace, SFMono-Regular, Menlo, monospace`,`letter-spacing:2px`,`background:#161b22`,`border:1px solid #30363d`,`border-radius:6px`,`padding:10px 12px`,`text-align:center`,`margin-bottom:10px`,`user-select:all`,`cursor:text`].join(`;`);let a=document.createElement(`div`);a.style.cssText=`color:#8b949e;font-size:12px;line-height:1.5`,a.textContent=`Copy the code, then click Continue to open the GitHub authorization page in a new tab.`;let o=document.createElement(`div`);o.style.cssText=`display:flex;gap:8px;margin-top:12px;justify-content:flex-end`;let s=document.createElement(`button`);s.type=`button`,s.textContent=`Cancel`,s.style.cssText=[`background:transparent`,`color:#e6edf3`,`border:1px solid #30363d`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let c=document.createElement(`button`);c.type=`button`,c.textContent=`Copy & Continue`,c.style.cssText=[`background:#238636`,`color:#fff`,`border:0`,`border-radius:6px`,`padding:6px 12px`,`font:600 12px inherit`,`cursor:pointer`].join(`;`);let l=()=>{try{n.remove()}catch{}};s.addEventListener(`click`,()=>{l(),t(`cancel`)}),c.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:t}=await import(`./provider-settings-DB_WwQDb.js`).then(e=>e.t);await t(e)}catch{}l(),t(`continue`)})()}),o.appendChild(s),o.appendChild(c),n.appendChild(r),n.appendChild(i),n.appendChild(a),n.appendChild(o),document.body.appendChild(n)});async function Z(){let e=v();return e?.refreshToken?p(e.refreshToken,fetch,{headers:g}):null}const Q={id:m,name:`GitHub Copilot`,description:`Use your GitHub Copilot subscription to access Claude, GPT-5, Codex, Gemini, and Grok models. Sign in with the GitHub device-code flow.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:`claude-sonnet-4.6`,oauthTokenDomains:[`*.githubcopilot.com`,`api.individual.githubcopilot.com`,`api.business.githubcopilot.com`,`api.enterprise.githubcopilot.com`],getModelIds:I,getBudgetUsage:Z,onOAuthLoginIntercepted:async(e,t,n)=>{let r=await y(),i=new URL(r.verification_uri);if(i.searchParams.set(`user_code`,r.user_code),await(n?.presentDeviceCode??X)({userCode:r.user_code,verificationUrl:i.toString(),expiresInSeconds:r.expires_in})===`cancel`)throw Error(`GitHub Copilot login cancelled`);let a=new AbortController,o=e({authorizeUrl:i.toString(),redirectUriPattern:`https://github.com/login/device/success*`,onCapture:`close`,timeoutMs:r.expires_in*1e3}).catch(e=>(console.warn(`[github-copilot] Launcher failed:`,e instanceof Error?e.message:String(e)),null)),s;try{s=await b(r,a.signal)}catch(e){throw a.abort(),await o,e}await o;let c=await C(s),l;try{let e=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${s}`,Accept:`application/json`}});if(e.ok){let t=await e.json();l=t.name||t.login}}catch{}await M(c,l),await j(c),t()},onOAuthLogout:async()=>{await e({providerId:m,accessToken:``})},onSilentRenew:async()=>{let e=v();if(!e?.refreshToken)return null;try{let t=await C(e.refreshToken);return await M(t,e.userName),await j(t),t.copilotToken}catch(e){return console.warn(`[github-copilot] Silent renew failed:`,e instanceof Error?e.message:String(e)),null}}};function $(){r({api:`github-copilot-anthropic`,stream:J,streamSimple:Y}),r({api:`github-copilot-openai`,stream:J,streamSimple:Y})}export{Q as config,F as isCopilotConeCompatible,$ as register};
@@ -0,0 +1 @@
1
+ import{i as e}from"./diagnostics-B-5VkVir.js";import{f as t,n,o as r,t as i,u as a,y as o}from"./models-DMUS_WIm.js";import{n as s}from"./headers-FK4rgixo.js";import{s as c}from"./constrained-sampling-auYJ_zjz.js";import{t as l}from"./sanitize-unicode-DmIE6hZJ.js";import{r as u}from"./transform-messages-DuvHh3qm.js";import{n as d,t as f}from"./error-body-pkrba6pf.js";import{a as p,c as m,d as h,f as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./google-shared-DWTs99zb.js";let D=0;const O=(t,n,a)=>{let o=new e,s=r(n);return(async()=>{let e={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{if(a?.fetch&&a.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Generative AI adapter`);let n=a?.apiKey;if(!n)throw Error(`No API key for provider: ${t.provider}`);let r=A(t,n,a?.headers),c=j(t,s,a),l=await a?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await v(()=>r.models.generateContentStream(c),a);o.push({type:`start`,partial:e});let d=null,f=e.content,h=()=>f.length-1;for await(let n of u){await a?.onProviderStreamEvent?.(n,t),e.responseId||=n.responseId;let r=n.candidates?.[0];if(r?.content?.parts)for(let t of r.content.parts){if(t.text!==void 0){let n=_(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:f.length-1,content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),o.push({type:`thinking_start`,contentIndex:h(),partial:e})):(d={type:`text`,text:``},e.content.push(d),o.push({type:`text_start`,contentIndex:h(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=m(d.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:h(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=m(d.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:h(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++D}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:h(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:h(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:h(),toolCall:r,partial:e})}}r?.finishReason&&(e.rawStopReason=r.finishReason,e.stopReason=p(r.finishReason),e.content.some(e=>e.type===`toolCall`)&&e.stopReason===`stop`&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:n.usageMetadata.thoughtsTokenCount||0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},i(t,e.usage))}if(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),a?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=a?.signal?.aborted?`aborted`:`error`,e.errorMessage=f(d(t)),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},k=(e,t,r)=>{let i=r?.apiKey;if(!i)throw Error(`No API key for provider: ${e.provider}`);let a={...u(e,t,r,i),toolChoice:r?.toolChoice};if(!r?.reasoning)return O(e,t,{...a,thinking:{enabled:!1}});let o=n(e,r.reasoning);if(o===`off`)return O(e,t,{...a,thinking:{enabled:!1}});let s=w(e,o);return S(e)?O(e,t,{...a,thinking:{enabled:!0,level:g(s)}}):O(e,t,{...a,thinking:{enabled:!0,budgetTokens:M(e,s,r.thinkingBudgets)}})};function A(e,t,n){let r={};e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``);let i=s({"User-Agent":c(),...e.headers,...n});return i&&(r.headers=i),new y({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function j(e,n,r={}){let i=T(e,n),s=t(n.messages),c=a(n.messages),u={};r.temperature!==void 0&&(u.temperature=r.temperature),r.maxTokens!==void 0&&(u.maxOutputTokens=r.maxTokens);let d=E(e.id),f=c.length>0?x(c,r.toolChoice,d):void 0,p=s?o(s):``,m={...Object.keys(u).length>0&&u,...p&&{systemInstruction:l(p)},...c.length>0&&{tools:b(c,!1,d)},...f!==void 0&&{toolConfig:{functionCallingConfig:{mode:f}}}};if(r.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};r.thinking.level===void 0?r.thinking.budgetTokens!==void 0&&(e.thinkingBudget=r.thinking.budgetTokens):e.thinkingLevel=h(r.thinking.level),m.thinkingConfig=e}else e.reasoning&&r.thinking&&!r.thinking.enabled&&(m.thinkingConfig=C(e));if(r.signal){if(r.signal.aborted)throw Error(`Request aborted`);m.abortSignal=r.signal}return{model:e.id,contents:i,config:m}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{O as stream,k as streamSimple};
@@ -1 +1 @@
1
- import{i as e}from"./diagnostics-Cag7MsZI.js";import{c as t,g as n,n as r,o as i,t as a,u as o}from"./models-Xc0Gclrk.js";import{n as s}from"./headers-FK4rgixo.js";import{s as c}from"./constrained-sampling-DOxF6Eck.js";import{t as l}from"./sanitize-unicode-DmIE6hZJ.js";import{r as u}from"./transform-messages-k2mfzJwY.js";import{n as d,t as f}from"./error-body-pkrba6pf.js";import{a as p,c as m,d as h,f as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./google-shared-Q-3oSdLJ.js";var D=0,O=(t,n,r)=>{let o=new e,s=i(n);return(async()=>{let e={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{if(r?.fetch&&r.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Generative AI adapter`);let n=r?.apiKey;if(!n)throw Error(`No API key for provider: ${t.provider}`);let i=A(t,n,r?.headers),c=j(t,s,r),l=await r?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await v(()=>i.models.generateContentStream(c),r);o.push({type:`start`,partial:e});let d=null,f=e.content,h=()=>f.length-1;for await(let n of u){await r?.onProviderStreamEvent?.(n,t),e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=_(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:f.length-1,content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),o.push({type:`thinking_start`,contentIndex:h(),partial:e})):(d={type:`text`,text:``},e.content.push(d),o.push({type:`text_start`,contentIndex:h(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=m(d.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:h(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=m(d.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:h(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++D}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:h(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:h(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:h(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=p(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&e.stopReason===`stop`&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:n.usageMetadata.thoughtsTokenCount||0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},a(t,e.usage))}if(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),r?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=r?.signal?.aborted?`aborted`:`error`,e.errorMessage=f(d(t)),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},k=(e,t,n)=>{let i=n?.apiKey;if(!i)throw Error(`No API key for provider: ${e.provider}`);let a={...u(e,t,n,i),toolChoice:n?.toolChoice};if(!n?.reasoning)return O(e,t,{...a,thinking:{enabled:!1}});let o=r(e,n.reasoning);if(o===`off`)return O(e,t,{...a,thinking:{enabled:!1}});let s=w(e,o);return S(e)?O(e,t,{...a,thinking:{enabled:!0,level:g(s)}}):O(e,t,{...a,thinking:{enabled:!0,budgetTokens:M(e,s,n.thinkingBudgets)}})};function A(e,t,n){let r={};e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``);let i=s({"User-Agent":c(),...e.headers,...n});return i&&(r.headers=i),new y({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function j(e,r,i={}){let a=T(e,r),s=o(r.messages),c=t(r.messages),u={};i.temperature!==void 0&&(u.temperature=i.temperature),i.maxTokens!==void 0&&(u.maxOutputTokens=i.maxTokens);let d=E(e.id),f=c.length>0?x(c,i.toolChoice,d):void 0,p=s?n(s):``,m={...Object.keys(u).length>0&&u,...p&&{systemInstruction:l(p)},...c.length>0&&{tools:b(c,!1,d)},...f!==void 0&&{toolConfig:{functionCallingConfig:{mode:f}}}};if(i.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};i.thinking.level===void 0?i.thinking.budgetTokens!==void 0&&(e.thinkingBudget=i.thinking.budgetTokens):e.thinkingLevel=h(i.thinking.level),m.thinkingConfig=e}else e.reasoning&&i.thinking&&!i.thinking.enabled&&(m.thinkingConfig=C(e));if(i.signal){if(i.signal.aborted)throw Error(`Request aborted`);m.abortSignal=i.signal}return{model:e.id,contents:a,config:m}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{O as stream,k as streamSimple};
1
+ import{i as e}from"./diagnostics-B-5VkVir.js";import{c as t,h as n,n as r,o as i,t as a,u as o}from"./models-D9KYIFyv.js";import{n as s}from"./headers-FK4rgixo.js";import{s as c}from"./constrained-sampling-DOxF6Eck.js";import{t as l}from"./sanitize-unicode-DmIE6hZJ.js";import{r as u}from"./transform-messages-DF4OdhKs.js";import{n as d,t as f}from"./error-body-pkrba6pf.js";import{a as p,c as m,d as h,f as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./google-shared-CjU_LieG.js";var D=0,O=(t,n,r)=>{let o=new e,s=i(n);return(async()=>{let e={role:`assistant`,content:[],api:`google-generative-ai`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{if(r?.fetch&&r.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Generative AI adapter`);let n=r?.apiKey;if(!n)throw Error(`No API key for provider: ${t.provider}`);let i=A(t,n,r?.headers),c=j(t,s,r),l=await r?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await v(()=>i.models.generateContentStream(c),r);o.push({type:`start`,partial:e});let d=null,f=e.content,h=()=>f.length-1;for await(let n of u){await r?.onProviderStreamEvent?.(n,t),e.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=_(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:f.length-1,content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),o.push({type:`thinking_start`,contentIndex:h(),partial:e})):(d={type:`text`,text:``},e.content.push(d),o.push({type:`text_start`,contentIndex:h(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=m(d.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:h(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=m(d.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:h(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++D}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:h(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:h(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:h(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=p(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&e.stopReason===`stop`&&(e.stopReason=`toolUse`)),n.usageMetadata&&(e.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:n.usageMetadata.thoughtsTokenCount||0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},a(t,e.usage))}if(d&&(d.type===`text`?o.push({type:`text_end`,contentIndex:h(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:e})),r?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=r?.signal?.aborted?`aborted`:`error`,e.errorMessage=f(d(t)),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},k=(e,t,n)=>{let i=n?.apiKey;if(!i)throw Error(`No API key for provider: ${e.provider}`);let a={...u(e,t,n,i),toolChoice:n?.toolChoice};if(!n?.reasoning)return O(e,t,{...a,thinking:{enabled:!1}});let o=r(e,n.reasoning);if(o===`off`)return O(e,t,{...a,thinking:{enabled:!1}});let s=w(e,o);return S(e)?O(e,t,{...a,thinking:{enabled:!0,level:g(s)}}):O(e,t,{...a,thinking:{enabled:!0,budgetTokens:M(e,s,n.thinkingBudgets)}})};function A(e,t,n){let r={};e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``);let i=s({"User-Agent":c(),...e.headers,...n});return i&&(r.headers=i),new y({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function j(e,r,i={}){let a=T(e,r),s=o(r.messages),c=t(r.messages),u={};i.temperature!==void 0&&(u.temperature=i.temperature),i.maxTokens!==void 0&&(u.maxOutputTokens=i.maxTokens);let d=E(e.id),f=c.length>0?x(c,i.toolChoice,d):void 0,p=s?n(s):``,m={...Object.keys(u).length>0&&u,...p&&{systemInstruction:l(p)},...c.length>0&&{tools:b(c,!1,d)},...f!==void 0&&{toolConfig:{functionCallingConfig:{mode:f}}}};if(i.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};i.thinking.level===void 0?i.thinking.budgetTokens!==void 0&&(e.thinkingBudget=i.thinking.budgetTokens):e.thinkingLevel=h(i.thinking.level),m.thinkingConfig=e}else e.reasoning&&i.thinking&&!i.thinking.enabled&&(m.thinkingConfig=C(e));if(i.signal){if(i.signal.aborted)throw Error(`Request aborted`);m.abortSignal=i.signal}return{model:e.id,contents:a,config:m}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{O as stream,k as streamSimple};