sliccy 6.242.0 → 6.243.0

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 (291) hide show
  1. package/dist/node-server/_shared/tray-sync-protocol.d.ts +9 -0
  2. package/dist/node-server/_shared/tray-sync-protocol.d.ts.map +1 -1
  3. package/dist/node-server/_shared/tray-sync-protocol.js.map +1 -1
  4. package/dist/ui/.vite/manifest.json +421 -392
  5. package/dist/ui/assets/account-store-BUXWCO9c.js +2 -0
  6. package/dist/ui/assets/account-store-BwbUEHb5.js +1 -0
  7. package/dist/ui/assets/adobe-B1NvyhgA.js +2 -0
  8. package/dist/ui/assets/adobe-Cj-kss61.js +1 -0
  9. package/dist/ui/assets/{agent-panels-DZgCn_Eh.js → agent-panels-hMZHYKB4.js} +1 -1
  10. package/dist/ui/assets/{agent-tools-WbCq5rUh.js → agent-tools-DOAwvp2r.js} +1 -1
  11. package/dist/ui/assets/{almost-bash-shell-headless-9Czv5t8a.js → almost-bash-shell-headless-CAZee0uN.js} +16 -16
  12. package/dist/ui/assets/anthropic-messages-B2uIMNYL.js +19 -0
  13. package/dist/ui/assets/anthropic-messages-C787NPvk.js +18 -0
  14. package/dist/ui/assets/{apply-layout-DF4jjEp1.js → apply-layout-Pq0XxQj9.js} +1 -1
  15. package/dist/ui/assets/{approver-agent-CivzfuZ7.js → approver-agent-B9MJsDkQ.js} +1 -1
  16. package/dist/ui/assets/{azure-openai-3Gr9AGS9.js → azure-openai-BHir9Y8r.js} +1 -1
  17. package/dist/ui/assets/azure-openai-config--zABV6W_.js +1 -0
  18. package/dist/ui/assets/azure-openai-config-CvD1Dsr0.js +1 -0
  19. package/dist/ui/assets/azure-openai-responses-DcjVJRMr.js +1 -0
  20. package/dist/ui/assets/azure-openai-responses-Zz2PEXb6.js +1 -0
  21. package/dist/ui/assets/{azure-openai-DF83DQdU.js → azure-openai-yVG_O_XO.js} +1 -1
  22. package/dist/ui/assets/{bedrock-camp-DLQhETva.js → bedrock-camp-CLQpuikj.js} +1 -1
  23. package/dist/ui/assets/{bedrock-camp-BYH3KVc9.js → bedrock-camp-Sm0RNsDN.js} +1 -1
  24. package/dist/ui/assets/{browser-BhTdBqdp.js → browser-Chc3wUwj.js} +35 -30
  25. package/dist/ui/assets/{browser-CGX7MbCQ.js → browser-L7W6uZ79.js} +1 -1
  26. package/dist/ui/assets/{cdp-BMRNgxhA.js → cdp-DOkrWHSv.js} +1 -1
  27. package/dist/ui/assets/{cerebras-dDv6G5NB.js → cerebras-BsMLiSLC.js} +1 -1
  28. package/dist/ui/assets/{cerebras-BLbXU4bU.js → cerebras-Dr97p_v3.js} +1 -1
  29. package/dist/ui/assets/classifier-shared-BJysQIY7.js +1 -0
  30. package/dist/ui/assets/classifier-shared-DgL5N50m.js +1 -0
  31. package/dist/ui/assets/cloudflare-workers-ai-system-one-3WA5LP90.js +1 -0
  32. package/dist/ui/assets/cloudflare-workers-ai-system-one-BQQga1NM.js +1 -0
  33. package/dist/ui/assets/{codemode-tool-FcP24sWd.js → codemode-tool-BFVivVHy.js} +1 -1
  34. package/dist/ui/assets/compat-0YnuwvMn.js +2 -0
  35. package/dist/ui/assets/compat-Ba4wPWa_.js +1 -0
  36. package/dist/ui/assets/{composer-speech-BkKa1N94.js → composer-speech-qaRqAyXj.js} +1 -1
  37. package/dist/ui/assets/{connect-surface-Bm6PRdh4.js → connect-surface-DIi81fIW.js} +1 -1
  38. package/dist/ui/assets/{connection-manager-D0LxHiWb.js → connection-manager-BDqqVban.js} +1 -1
  39. package/dist/ui/assets/{context-compaction-BCsq-2e6.js → context-compaction-Dee1PlIX.js} +1 -1
  40. package/dist/ui/assets/core-C--iyWKC.js +1 -0
  41. package/dist/ui/assets/core-DzRw0pz2.js +27 -0
  42. package/dist/ui/assets/{cost-command-QgykPPks.js → cost-command-VPxRuwNr.js} +1 -1
  43. package/dist/ui/assets/{descriptor-CuhPBdq8.js → descriptor-1ECGTjSt.js} +1 -1
  44. package/dist/ui/assets/{descriptor-CKLcFFX3.js → descriptor-xRf4P0gd.js} +1 -1
  45. package/dist/ui/assets/diagnostics-B-5VkVir.js +1 -0
  46. package/dist/ui/assets/{directed-approval-BXnjNc8s.js → directed-approval-m8VBcGoU.js} +1 -1
  47. package/dist/ui/assets/dist-DRjYxtT0.js +9 -0
  48. package/dist/ui/assets/dist-Ue_WrVH6.js +4 -0
  49. package/dist/ui/assets/{emscripten-vfs-hook-DjpWiWGw.js → emscripten-vfs-hook-DS6HyOQN.js} +1 -1
  50. package/dist/ui/assets/env-api-keys-BMbk-OAv.js +1 -0
  51. package/dist/ui/assets/env-api-keys-DkgZK-ct.js +1 -0
  52. package/dist/ui/assets/error-BTdmRKoB.js +1 -0
  53. package/dist/ui/assets/{frozen-archive-writer-CxARY_u0.js → frozen-archive-writer-BXYZXVMO.js} +1 -1
  54. package/dist/ui/assets/{frozen-archive-writer-BmnL05hC.js → frozen-archive-writer-B_3LDxDv.js} +1 -1
  55. package/dist/ui/assets/{frozen-session-delete-CMYnzw-I.js → frozen-session-delete-S6fe3MHM.js} +1 -1
  56. package/dist/ui/assets/{frozen-session-identity-BvbW8Joj.js → frozen-session-identity-BzZR-tcg.js} +1 -1
  57. package/dist/ui/assets/{frozen-session-identity-Be3WxQiL.js → frozen-session-identity-Cm2y7ECd.js} +1 -1
  58. package/dist/ui/assets/{gelatiere-unit-xNfF_7ob.js → gelatiere-unit-CbpoXshu.js} +1 -1
  59. package/dist/ui/assets/github-copilot-Bpxt8DcY.js +2 -0
  60. package/dist/ui/assets/{github-copilot-DWvHSe9j.js → github-copilot-CIJWouor.js} +1 -1
  61. package/dist/ui/assets/{github-DNdt8ojA.js → github-u46P7a92.js} +1 -1
  62. package/dist/ui/assets/{github-CeB2d2Q-.js → github-z8d7X5by.js} +1 -1
  63. package/dist/ui/assets/google-generative-ai-C1S3RP6G.js +1 -0
  64. package/dist/ui/assets/{google-generative-ai-CHKS5an4.js → google-generative-ai-D_dvyaRG.js} +1 -1
  65. package/dist/ui/assets/{google-shared-Q-3oSdLJ.js → google-shared-CjU_LieG.js} +1 -1
  66. package/dist/ui/assets/{google-shared-C6X3xab7.js → google-shared-DWTs99zb.js} +1 -1
  67. package/dist/ui/assets/{google-vertex-DBm4s85u.js → google-vertex-Ckh_e-Px.js} +1 -1
  68. package/dist/ui/assets/google-vertex-DmOYmn7m.js +1 -0
  69. package/dist/ui/assets/{guest-tool-gate-83ZVVYjM.js → guest-tool-gate-D5-Z-l4h.js} +1 -1
  70. package/dist/ui/assets/{hear-D9quYsjw.js → hear-CexFR0lD.js} +1 -1
  71. package/dist/ui/assets/{host-command-CvUauhDf.js → host-command-B9z8gGwK.js} +1 -1
  72. package/dist/ui/assets/{idle-compaction-DGln8tkz.js → idle-compaction-WANlPP4R.js} +1 -1
  73. package/dist/ui/assets/{interrupted-work-recovery-CWSaMQsO.js → interrupted-work-recovery-Bc8UHznp.js} +1 -1
  74. package/dist/ui/assets/{js-realm-worker-DDuU-XgK.js → js-realm-worker-DOBX_BWP.js} +2 -2
  75. package/dist/ui/assets/{jsh-executor-DOnIPgNs.js → jsh-executor-OyG5H3M0.js} +2 -2
  76. package/dist/ui/assets/kernel-worker-Co5O2WRg.js +1262 -0
  77. package/dist/ui/assets/{key-B2Bki3fU.js → key-CMmCg0hr.js} +1 -1
  78. package/dist/ui/assets/{legacy-api-aliases--xyLjPgC.js → legacy-api-aliases-C3_OAyZB.js} +1 -1
  79. package/dist/ui/assets/{legacy-api-aliases-BjgG1CsY.js → legacy-api-aliases-D-3Ssy_B.js} +1 -1
  80. package/dist/ui/assets/{libesm-CTQYxJIv.js → libesm-CSMdpGMF.js} +4 -4
  81. package/dist/ui/assets/{lick-ws-bridge-BGMhFgVP.js → lick-ws-bridge-B4nMBMxl.js} +1 -1
  82. package/dist/ui/assets/{lick-ws-bridge-C-Y8nKtx.js → lick-ws-bridge-CZbIps3D.js} +1 -1
  83. package/dist/ui/assets/{live-session-curation-DClAHiV3.js → live-session-curation-BF1WGcAY.js} +1 -1
  84. package/dist/ui/assets/{live-session-curation-Cm7e6ohY.js → live-session-curation-CygXbAY3.js} +1 -1
  85. package/dist/ui/assets/{live-session-snapshot-a18bKxI5.js → live-session-snapshot-CWtnoNYy.js} +1 -1
  86. package/dist/ui/assets/{local-llm-CyPxIK9W.js → local-llm-B4KZH4Xt.js} +1 -1
  87. package/dist/ui/assets/{local-llm-BsgdFg8Z.js → local-llm-D0l_JQnX.js} +1 -1
  88. package/dist/ui/assets/{main-cherry-C_30DmYa.js → main-cherry-C9W_D65Z.js} +1 -1
  89. package/dist/ui/assets/main-rwkIawzW.js +22 -0
  90. package/dist/ui/assets/{mcp-command-ChutbHAT.js → mcp-command-Ce7aNwu8.js} +11 -11
  91. package/dist/ui/assets/{memory-curation-seam-C5ZMA6ti.js → memory-curation-seam-Dm3c2GeP.js} +1 -1
  92. package/dist/ui/assets/{memory-health-Bc0NK5hs.js → memory-health-Dfnf_Tuq.js} +1 -1
  93. package/dist/ui/assets/{memory-write-execute-DH0aqBWk.js → memory-write-execute-pZFV468-.js} +1 -1
  94. package/dist/ui/assets/{merge-folded-cost-into-frozen-DIOtNg18.js → merge-folded-cost-into-frozen-DTl_zOBf.js} +1 -1
  95. package/dist/ui/assets/{mistral-conversations-oqRyTLwY.js → mistral-conversations-BvlrZkA-.js} +3 -3
  96. package/dist/ui/assets/{mistral-conversations-SlnX__FI.js → mistral-conversations-gYKoKyXX.js} +4 -4
  97. package/dist/ui/assets/models-D9KYIFyv.js +8 -0
  98. package/dist/ui/assets/models-DMUS_WIm.js +8 -0
  99. package/dist/ui/assets/new-session-DEO7gD2x.js +2 -0
  100. package/dist/ui/assets/{node.browser-DfltYbWr.js → node.browser-C8yuEzbc.js} +1 -1
  101. package/dist/ui/assets/node.browser-GIQn8hjM.js +1 -0
  102. package/dist/ui/assets/node.browser-HQ5SKBOf.js +1 -0
  103. package/dist/ui/assets/{node.browser-DFNMSkXf.js → node.browser-PnMdIUDP.js} +1 -1
  104. package/dist/ui/assets/oauth-bootstrap-ZC5NQ4lP.js +2 -0
  105. package/dist/ui/assets/{onboarding-orchestrator-usjOiqL0.js → onboarding-orchestrator-DK8WHqbf.js} +1 -1
  106. package/dist/ui/assets/{openai-codex-CQ3zgei0.js → openai-codex-D8hNye9V.js} +1 -1
  107. package/dist/ui/assets/{openai-codex-responses-BFVkRFGY.js → openai-codex-responses-DL3QfjAj.js} +2 -2
  108. package/dist/ui/assets/{openai-codex-responses-N8ybD_eh.js → openai-codex-responses-D_RW7WEX.js} +2 -2
  109. package/dist/ui/assets/{openai-codex-w6oO3AnS.js → openai-codex-x6y1P4FE.js} +1 -1
  110. package/dist/ui/assets/openai-completions-B8gZJNrA.js +5 -0
  111. package/dist/ui/assets/openai-completions-Eh0-DkGU.js +5 -0
  112. package/dist/ui/assets/openai-decisions-DZc3eKSh.js +2 -0
  113. package/dist/ui/assets/openai-decisions-umTQkmTO.js +2 -0
  114. package/dist/ui/assets/openai-responses-C7rBSmmd.js +1 -0
  115. package/dist/ui/assets/openai-responses-ChllZFHw.js +1 -0
  116. package/dist/ui/assets/{openai-responses-shared-CbNa5Pf-.js → openai-responses-shared-BkcHIDFS.js} +2 -2
  117. package/dist/ui/assets/{openai-responses-shared-yguGWfYx.js → openai-responses-shared-BvBjbnyp.js} +2 -2
  118. package/dist/ui/assets/{openrouter-BEKlOYFb.js → openrouter-B2CBG3R_.js} +1 -1
  119. package/dist/ui/assets/{openrouter-lsfNukd5.js → openrouter-BUd9j3yx.js} +1 -1
  120. package/dist/ui/assets/{openrouter-free-DwguItbS.js → openrouter-free-CPJCCuxG.js} +1 -1
  121. package/dist/ui/assets/{openrouter-free-mNgVVlhf.js → openrouter-free-DMf-9uyL.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-5IQSzB1f.js → openrouter-oauth-BPULLBJW.js} +1 -1
  127. package/dist/ui/assets/{openrouter-oauth-BRdBbrLx.js → openrouter-oauth-Cr_iFRGQ.js} +1 -1
  128. package/dist/ui/assets/openrouter.models-BSx3ITDA.js +1 -0
  129. package/dist/ui/assets/openrouter.models-C88RzzVZ.js +1 -0
  130. package/dist/ui/assets/panel-rpc-handlers-Cx2DCZvj.js +2 -0
  131. package/dist/ui/assets/{panelize-shell-Cjf6GQSz.js → panelize-shell-BszF1QxA.js} +1 -1
  132. package/dist/ui/assets/pi-edit-execution-BuYIhqkU.js +12 -0
  133. package/dist/ui/assets/{pi-messages-BMxZw_ob.js → pi-messages-CiydoVXP.js} +1 -1
  134. package/dist/ui/assets/{pi-messages-F6N-eNkX.js → pi-messages-DElkezfJ.js} +1 -1
  135. package/dist/ui/assets/pi-transcript-context-CE8ItnBz.js +1 -0
  136. package/dist/ui/assets/{pi-transcript-context-miZCMig3.js → pi-transcript-context-DZyPy5yf.js} +1 -1
  137. package/dist/ui/assets/{provider-IGig8YLE.js → provider-DtMdxE0s.js} +1 -1
  138. package/dist/ui/assets/{provider-DUDuxXak.js → provider-XOGGlnmA.js} +1 -1
  139. package/dist/ui/assets/{provider-retry-CSlu6hjs.js → provider-retry-RVfYd5Vz.js} +1 -1
  140. package/dist/ui/assets/{provider-settings-DphpnNLH.js → provider-settings-DQAajlVX.js} +1 -1
  141. package/dist/ui/assets/provider-store-access-BUiCzkDB.js +1 -0
  142. package/dist/ui/assets/provider-store-access-Dum4LRDl.js +1 -0
  143. package/dist/ui/assets/{providers-C0ZOpyUo.js → providers-D0vvekBQ.js} +1 -1
  144. package/dist/ui/assets/providers-s1F7GmE9.js +2 -0
  145. package/dist/ui/assets/{quick-llm-D5BvwAIg.js → quick-llm-j6dAyTk3.js} +1 -1
  146. package/dist/ui/assets/{realm-inprocess-B6cokKhd.js → realm-inprocess-CLnOkvVF.js} +2 -2
  147. package/dist/ui/assets/{realm-unhandled-rejections-Be7LHx6d.js → realm-unhandled-rejections-DLfoHmia.js} +1 -1
  148. package/dist/ui/assets/{realm-unhandled-rejections-C5YXTNtv.js → realm-unhandled-rejections-Pyc_Yywn.js} +1 -1
  149. package/dist/ui/assets/record-Ban9cWMI.js +1 -0
  150. package/dist/ui/assets/record-DtD74Jn0.js +1 -0
  151. package/dist/ui/assets/{recovery-screen-e0y59jaB.js → recovery-screen-BUmrgmsy.js} +1 -1
  152. package/dist/ui/assets/{remote-terminal-view-DY5NhlfN.js → remote-terminal-view-C-Hj8oAA.js} +3 -3
  153. package/dist/ui/assets/renamed-providers-BUZBzl5L.js +1 -0
  154. package/dist/ui/assets/renamed-providers-DDe6My59.js +1 -0
  155. package/dist/ui/assets/{restore-DDyFEUyi.js → restore-l8tgPxKq.js} +1 -1
  156. package/dist/ui/assets/{run-1aVr5LLS.js → run-BT657BwR.js} +2 -2
  157. package/dist/ui/assets/{run-CwX8trIr.js → run-Bj8m57a_.js} +2 -2
  158. package/dist/ui/assets/{run-CZtMT0UW.js → run-D7FxVJc4.js} +1 -1
  159. package/dist/ui/assets/{run-CVAZx0m2.js → run-DCE15NzA.js} +1 -1
  160. package/dist/ui/assets/{run-CRTEPV5c.js → run-DaNuW9og.js} +1 -1
  161. package/dist/ui/assets/{run-DnxVNWPE.js → run-DcyrwtHx.js} +1 -1
  162. package/dist/ui/assets/{run-BJGzDxyk.js → run-xC8FUB2Z.js} +2 -2
  163. package/dist/ui/assets/{serve-command-BkAERAvQ.js → serve-command-B21r3jG_.js} +2 -2
  164. package/dist/ui/assets/{serve-runtime-CSyDtgVs.js → serve-runtime-BbcsYX3I.js} +1 -1
  165. package/dist/ui/assets/{session-command-memory-BOhKw7oW.js → session-command-memory-l9ApFSFO.js} +2 -2
  166. package/dist/ui/assets/{session-jsonl-CVJ9R5Rq.js → session-jsonl-BYCO0I9a.js} +1 -1
  167. package/dist/ui/assets/{session-jsonl-CEqurmTu.js → session-jsonl-CSOU88vz.js} +1 -1
  168. package/dist/ui/assets/{session-search-index-XOtFaFT2.js → session-search-index-3mybEW_M.js} +1 -1
  169. package/dist/ui/assets/{setup-feature-flags-remote-B-VirOkj.js → setup-feature-flags-remote-CLSmsGdK.js} +1 -1
  170. package/dist/ui/assets/setup-model-catalog-BOpU3mm5.js +1 -0
  171. package/dist/ui/assets/{silent-renew-backoff-CminHszT.js → silent-renew-backoff-C0Cks-_q.js} +1 -1
  172. package/dist/ui/assets/slicc-version-UL1MqRLq.js +1 -0
  173. package/dist/ui/assets/{soundscape-CKh7yLzm.js → soundscape-SNL86WsS.js} +1 -1
  174. package/dist/ui/assets/{speak-CgQxHra5.js → speak-CxZBHdSG.js} +1 -1
  175. package/dist/ui/assets/{sprinkle-manager-D1lNcJD2.js → sprinkle-manager-DmTv72o3.js} +1 -1
  176. package/dist/ui/assets/{sprinkle-renderer-C1AKQbf2.js → sprinkle-renderer-C088Z2du.js} +1 -1
  177. package/dist/ui/assets/{ssh-CVu8tZ_S.js → ssh-Bqz2CHhO.js} +1 -1
  178. package/dist/ui/assets/{sudo-8CgZUyow.js → sudo-CgGH1nWr.js} +1 -1
  179. package/dist/ui/assets/{supervisor-RB5hROJ0.js → supervisor-Clc6jzo1.js} +1 -1
  180. package/dist/ui/assets/{sync-dialog-mOaP3WSo.js → sync-dialog-Bi9sGuoT.js} +1 -1
  181. package/dist/ui/assets/system-one-shared-D_uXoohg.js +1 -0
  182. package/dist/ui/assets/system-one-shared-Do49zet2.js +1 -0
  183. package/dist/ui/assets/transform-messages-DF4OdhKs.js +1 -0
  184. package/dist/ui/assets/transform-messages-DuvHh3qm.js +1 -0
  185. package/dist/ui/assets/{transformers-env-BPNoQ4X7.js → transformers-env-CN_VjXi2.js} +1 -1
  186. package/dist/ui/assets/{tray-leader-CjMPhQNY.js → tray-leader-Cv5k1C5q.js} +1 -1
  187. package/dist/ui/assets/{tray-leave-runtime-OnRBQWsq.js → tray-leave-runtime-DNmvjMzs.js} +1 -1
  188. package/dist/ui/assets/{tray-sidecar-t4dm1U_C.js → tray-sidecar-Ceta0R1c.js} +1 -1
  189. package/dist/ui/assets/{turn-journal-CVQtwHPx.js → turn-journal-BJ3lAG7q.js} +1 -1
  190. package/dist/ui/assets/typesafe-system-one-B1zebM2I.js +1 -0
  191. package/dist/ui/assets/typesafe-system-one-B3Qz9-cZ.js +1 -0
  192. package/dist/ui/assets/{upgrade-detection-CvWsoSfP.js → upgrade-detection-CQrDUmjN.js} +1 -1
  193. package/dist/ui/assets/{voice-reply-LyPY66-z.js → voice-reply-COflgUcS.js} +1 -1
  194. package/dist/ui/assets/wc-attach-CdnSkLjJ.js +13 -0
  195. package/dist/ui/assets/{wc-browser-k_U7kFtS.js → wc-browser-aoHYpHLG.js} +1 -1
  196. package/dist/ui/assets/{wc-computers-BKXABDjS.js → wc-computers-B5vnJoiB.js} +1 -1
  197. package/dist/ui/assets/{wc-detached-DJFxz5jb.js → wc-detached-C6-SQG2h.js} +1 -1
  198. package/dist/ui/assets/wc-extension-BgJvQcjo.js +2 -0
  199. package/dist/ui/assets/wc-follower-CEckNoTF.js +17 -0
  200. package/dist/ui/assets/{wc-follower-oauth-BiHrXTeh.js → wc-follower-oauth-DFirJqdu.js} +1 -1
  201. package/dist/ui/assets/{wc-gelatiere-ChtRPt5b.js → wc-gelatiere-B22UQpCW.js} +1 -1
  202. package/dist/ui/assets/wc-live-B88AgkoT.js +248 -0
  203. package/dist/ui/assets/wc-nav-ByiM69qS.js +2 -0
  204. package/dist/ui/assets/{wc-onboarding-BbBqVLNY.js → wc-onboarding-BP6ckmvh.js} +2 -2
  205. package/dist/ui/assets/{wc-permissions-DadG0Lur.js → wc-permissions-CzJm8Vy5.js} +2 -2
  206. package/dist/ui/assets/wc-placeholder-CScMfgTw.js +4 -0
  207. package/dist/ui/assets/{wc-secret-request-B18qHj4I.js → wc-secret-request-CLvYlRbO.js} +1 -1
  208. package/dist/ui/assets/{wc-settings-DzPcEdim.js → wc-settings-Cnn5g7GW.js} +3 -3
  209. package/dist/ui/assets/{wc-shell-BeGVTjhP.js → wc-shell-DQ63Uu06.js} +4 -4
  210. package/dist/ui/assets/{wc-shortcut-config-QgREiwAI.js → wc-shortcut-config-DDSaSoFX.js} +1 -1
  211. package/dist/ui/assets/wc-sprinkles-DVDFpasV.js +2 -0
  212. package/dist/ui/assets/wc-transcript-export-tZ99xlcb.js +2 -0
  213. package/dist/ui/assets/wc-tray-wFWMCf2U.js +5 -0
  214. package/dist/ui/assets/{wc-unit-context-CZro7UrY.js → wc-unit-context-D5liISq3.js} +1 -1
  215. package/dist/ui/assets/welcome-detection-DOSSqBIu.js +1 -0
  216. package/dist/ui/assets/whisper-session-DjRUnpJX.js +2 -0
  217. package/dist/ui/assets/xai-grok-Cf4LDhyH.js +1 -0
  218. package/dist/ui/assets/xai-grok-DNP_69yB.js +1 -0
  219. package/dist/ui/index.html +12 -11
  220. package/dist/ui/packages/webapp/index.html +12 -11
  221. package/package.json +1 -1
  222. package/dist/ui/assets/account-store-CDJ2a01U.js +0 -1
  223. package/dist/ui/assets/account-store-DmRIEeKD.js +0 -2
  224. package/dist/ui/assets/adobe-C6KwRVMm.js +0 -2
  225. package/dist/ui/assets/adobe-QGrvyCz5.js +0 -1
  226. package/dist/ui/assets/anthropic-messages-COqhstcs.js +0 -40
  227. package/dist/ui/assets/anthropic-messages-CjSN1VV8.js +0 -41
  228. package/dist/ui/assets/azure-openai-responses-BG1E_58j.js +0 -1
  229. package/dist/ui/assets/azure-openai-responses-DT2eVjgI.js +0 -1
  230. package/dist/ui/assets/build-Dnkjpm_v.js +0 -3
  231. package/dist/ui/assets/cloudflare-workers-ai-system-one-CfgjeR2q.js +0 -1
  232. package/dist/ui/assets/cloudflare-workers-ai-system-one-DBa2hfSp.js +0 -1
  233. package/dist/ui/assets/compat-BAGLwgqY.js +0 -2
  234. package/dist/ui/assets/compat-nGhSz-U1.js +0 -1
  235. package/dist/ui/assets/context-CrZ58_Xy.js +0 -1
  236. package/dist/ui/assets/core-BFRZk2b-.js +0 -62
  237. package/dist/ui/assets/core-EGZ5TU35.js +0 -36
  238. package/dist/ui/assets/diagnostics-Cag7MsZI.js +0 -1
  239. package/dist/ui/assets/dist-Cu98pw2t.js +0 -9
  240. package/dist/ui/assets/dist-xQGtC96q.js +0 -4
  241. package/dist/ui/assets/edit-dC5128uh.js +0 -16
  242. package/dist/ui/assets/env-api-keys-BXRkymgV.js +0 -1
  243. package/dist/ui/assets/env-api-keys-CPPAm2nU.js +0 -1
  244. package/dist/ui/assets/error-CJ3RHG07.js +0 -1
  245. package/dist/ui/assets/github-copilot-DIBlC63Z.js +0 -2
  246. package/dist/ui/assets/google-generative-ai-BiB1UYSx.js +0 -1
  247. package/dist/ui/assets/google-vertex-B2qHfYD5.js +0 -1
  248. package/dist/ui/assets/kernel-worker-Yrt1LuLv.js +0 -1260
  249. package/dist/ui/assets/libesm-BypnjKEL.js +0 -13
  250. package/dist/ui/assets/main-bbC4wIXo.js +0 -22
  251. package/dist/ui/assets/models-CET5SEuw.js +0 -8
  252. package/dist/ui/assets/models-Xc0Gclrk.js +0 -8
  253. package/dist/ui/assets/new-session-CQJNUpUX.js +0 -2
  254. package/dist/ui/assets/node.browser-3Nibdso-.js +0 -1
  255. package/dist/ui/assets/node.browser-DFtqp6Hr.js +0 -1
  256. package/dist/ui/assets/oauth-bootstrap-CkaHhcfV.js +0 -2
  257. package/dist/ui/assets/openai-completions-Dx5kqcwu.js +0 -5
  258. package/dist/ui/assets/openai-completions-nAjVDcoU.js +0 -5
  259. package/dist/ui/assets/openai-responses-BzrpHAlB.js +0 -1
  260. package/dist/ui/assets/openai-responses-CnpU2GL3.js +0 -1
  261. package/dist/ui/assets/openrouter.models-BWF0jSAQ.js +0 -1
  262. package/dist/ui/assets/openrouter.models-DHpsqCCC.js +0 -1
  263. package/dist/ui/assets/panel-rpc-handlers-Q7Onn8CV.js +0 -2
  264. package/dist/ui/assets/pi-edit-execution-CqQRMS94.js +0 -2
  265. package/dist/ui/assets/pi-transcript-context-4pjVPiVC.js +0 -1
  266. package/dist/ui/assets/provider-store-access-DaIGmNhr.js +0 -1
  267. package/dist/ui/assets/provider-store-access-DvRuksc2.js +0 -1
  268. package/dist/ui/assets/providers-CA0WVcn4.js +0 -2
  269. package/dist/ui/assets/record-CBv8rWFt.js +0 -1
  270. package/dist/ui/assets/record-COQlaFL1.js +0 -1
  271. package/dist/ui/assets/setup-model-catalog-CB1b-8rG.js +0 -1
  272. package/dist/ui/assets/slicc-version-Ddt_Udk9.js +0 -1
  273. package/dist/ui/assets/system-one-shared-B0og9uUi.js +0 -1
  274. package/dist/ui/assets/system-one-shared-iVEDyuts.js +0 -1
  275. package/dist/ui/assets/transform-messages-BeurHGV0.js +0 -1
  276. package/dist/ui/assets/transform-messages-k2mfzJwY.js +0 -1
  277. package/dist/ui/assets/typesafe-system-one-D_iVKLH6.js +0 -1
  278. package/dist/ui/assets/typesafe-system-one-Ds8-mdzH.js +0 -1
  279. package/dist/ui/assets/wc-attach-DxjWEg8W.js +0 -13
  280. package/dist/ui/assets/wc-extension-CCj12o2_.js +0 -2
  281. package/dist/ui/assets/wc-follower-yHGrKVtf.js +0 -17
  282. package/dist/ui/assets/wc-live-D8Nh84rj.js +0 -248
  283. package/dist/ui/assets/wc-nav-CkRCT8hx.js +0 -2
  284. package/dist/ui/assets/wc-placeholder-CvIvwf-6.js +0 -4
  285. package/dist/ui/assets/wc-sprinkles-B6D8C3QF.js +0 -2
  286. package/dist/ui/assets/wc-transcript-export-DVQxHFUf.js +0 -2
  287. package/dist/ui/assets/wc-tray-gC6RCtTD.js +0 -5
  288. package/dist/ui/assets/welcome-detection-D6QVWgHU.js +0 -1
  289. package/dist/ui/assets/whisper-session-BGOkv9WY.js +0 -2
  290. package/dist/ui/assets/xai-grok-CWY2weXy.js +0 -1
  291. package/dist/ui/assets/xai-grok-xRvTAXQ3.js +0 -1
@@ -1 +0,0 @@
1
- function e(e,n){try{return Promise.resolve(n(t))}catch(e){return Promise.reject(e)}}const t={startSpan:e,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(t);const n=Object.freeze({token:Symbol(`chord.abortSignal`)});var r=class{get abortSignal(){return this.value(n)}},i=class extends r{#e;constructor(e){super(),this.#e=e}value(e){}toString(){return this.#e}},a=class extends r{#e;#t;#n;constructor(e,t,n){super(),this.#e=e,this.#t=t,this.#n=n}value(e){return e.token===this.#t.token?this.#n:this.#e.value(e)}toString(){return`${this.#e}.WithValue(${this.#t.token.description??`anonymous`})`}};new i(`[Context BACKGROUND_CONTEXT]`);const o=new i(`[Context TODO_CONTEXT]`);function s(e){return Object.freeze({token:Symbol(e)})}function c(e,t,n){return new a(n,e,t)}function l(e,t){let r=t.abortSignal,i=r===void 0?e:AbortSignal.any([r,e]);return c(n,i,t)}s(`pi.telemetryContext`);export{l as n,o as t};
@@ -1,62 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t,n,r,t as i}from"./compat-BAGLwgqY.js";import"./libesm-BypnjKEL.js";import{t as a}from"./logger-DDBAeTLF.js";import{n as o}from"./utf16-clip-CGL7omVm.js";import{a as s}from"./feature-flags-DvsApnS-.js";import"./proxied-fetch-4VBgrEIu.js";import"./secret-topology-hMRoGGjt.js";import"./secrets-bridge-client-D734Xx8G.js";import"./image-markers-q8JQTtid.js";import"./tool-ui-eSQ1g2I1.js";var c={assign:0,create:0,clone:0,discard:0,update:0};function l(e){return Array.isArray(e)}function u(e){return f(e,null)}function d(e){return f(typeof e,`object`)&&!u(e)}function f(e,t){return e===t}function p(e){if(!d(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!u(t)&&f(typeof t.constructor,`function`)&&!(f(t.constructor,globalThis.Object)||f(t.constructor.name,`Object`))}function m(e){return f(e,`__proto__`)||f(e,`constructor`)||f(e,`prototype`)}function h(e,t){return m(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function g(e){return Object.getOwnPropertyNames(e)}function _(e){return Object.getOwnPropertySymbols(e)}function v(e){return globalThis.ArrayBuffer.isView(e)}function y(e){return e instanceof globalThis.RegExp}function b(e){return e instanceof globalThis.Set}function x(e){return e instanceof globalThis.Map}var S={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ee(){return S}function te(e){return ee().immutableTypes?Object.freeze(e):e}function ne(e){return e}function re(e){return h(e,`~kind`)||h(e,`~unsafe`)}function ie(e){let t={};for(let n of g(e)){if(m(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=C(r.value),f(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function ae(e){let t={};for(let n of g(e))m(n)||(t[n]=C(e[n]));for(let n of _(e))t[n]=C(e[n]);return t}function oe(e){return p(e)?ne(e):re(e)?ie(e):ae(e)}function se(e){return e.map(e=>C(e))}function ce(e){return e.slice()}function le(e){return new RegExp(e.source,e.flags)}function ue(e){return new Map(C([...e.entries()]))}function de(e){return new Set(C([...e.values()]))}function C(e){return v(e)?ce(e):y(e)?le(e):x(e)?ue(e):b(e)?de(e):l(e)?se(e):d(e)?oe(e):e}function fe(e){return c.clone+=1,C(e)}function pe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function me(e,t){return{...e,...t}}function w(e,t,n={}){c.create+=1;let r=me(t,n);return te(ee().enumerableKind?me(r,e):pe(r,e))}function he(e,t,n){c.update+=1;let r=ee(),i=fe(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return te(i)}function ge(e){return d(e)}function _e(e){return he(e,{"~optional":!0},{})}function ve(e,t){return he(_e(e),{},t)}function ye(e,t){return w({"~kind":`Array`},{type:`array`,items:e},t)}function be(e,t={}){return ve(e,t)}function T(e){return be(e)}function xe(e){return ge(e)&&h(e,`~optional`)}function Se(e){return g(e).filter(t=>!xe(e[t]))}function E(e,t={}){let n=Se(e);return w({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Ce;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Ce||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var we=new Float64Array(1);new DataView(we.buffer),new Uint8Array(we.buffer),new TextEncoder;var Te=`-?(?:0|[1-9][0-9]*)`,Ee=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function De(e){return w({"~kind":`Number`},{type:`number`},e)}function D(e){return w({"~kind":`String`},{type:`string`},e)}var Oe=`^${Te}$`;`${Ee}`;function ke(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ae=[...ke(97,122),...ke(65,90)],je=[`0`,...ke(49,57)];[...je],[...Ae,...je],[...je],new RegExp(Oe);function Me(e,t){try{return Promise.resolve(t(Ne))}catch(e){return Promise.reject(e)}}var Ne={startSpan:Me,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Ne);var Pe=Object.freeze({token:Symbol(`chord.abortSignal`)}),Fe=class{get abortSignal(){return this.value(Pe)}},Ie=class extends Fe{#e;constructor(e){super(),this.#e=e}value(e){}toString(){return this.#e}};new Ie(`[Context BACKGROUND_CONTEXT]`),new Ie(`[Context TODO_CONTEXT]`);function Le(e){return Object.freeze({token:Symbol(e)})}Le(`pi.telemetryContext`);var Re={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},ze={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...Re}),{...ze},{...Re},{...ze},{...Re},{...ze};function Be(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function Ve(e,t=``){return Be(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}Ve(`pi.session.name`);var He=Symbol.for(`yaml.alias`),Ue=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),We=Symbol.for(`yaml.pair`),Ge=Symbol.for(`yaml.scalar`),k=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),j=e=>!!e&&typeof e==`object`&&e[A]===He,Ke=e=>!!e&&typeof e==`object`&&e[A]===Ue,qe=e=>!!e&&typeof e==`object`&&e[A]===O,M=e=>!!e&&typeof e==`object`&&e[A]===We,N=e=>!!e&&typeof e==`object`&&e[A]===Ge,Je=e=>!!e&&typeof e==`object`&&e[A]===k;function P(e){if(e&&typeof e==`object`)switch(e[A]){case O:case k:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[A]){case He:case O:case Ge:case k:return!0}return!1}var Ye=e=>(N(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),Xe=Symbol(`skip children`),L=Symbol(`remove node`);function Ze(e,t){let n=Qe(t);Ke(e)?R(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):R(null,e,n,Object.freeze([]))}Ze.BREAK=I,Ze.SKIP=Xe,Ze.REMOVE=L;function R(e,t,n,r){let i=$e(e,t,n,r);if(F(i)||M(i))return et(e,r,i),R(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=R(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=R(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=R(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function Qe(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function $e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(qe(t))return n.Map?.(e,t,r);if(Je(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(j(t))return n.Alias?.(e,t,r)}function et(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(Ke(r))r.contents=n;else{let e=j(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function tt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function z(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=z(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=z(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=z(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=z(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ye(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var nt=class{constructor(e){Object.defineProperty(this,A,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ke(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?z(i,{"":o},``,o):o}},rt=class extends nt{constructor(e){super(He),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Ze(e,{Node:(e,t)=>{(j(t)||Ye(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(B(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=it(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(tt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function it(e,t,n){if(j(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=it(e,i,n);t>r&&(r=t)}return r}if(M(t)){let r=it(e,t.key,n),i=it(e,t.value,n);return Math.max(r,i)}return 1}var at=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends nt{constructor(e){super(Ge),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var ot=`tag:yaml.org,2002:`;function st(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ct(e,t,n){if(Ke(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[O].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new rt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ot+t.slice(2));let l=st(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[k]:o[O]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function lt(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ct(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var ut=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,dt=class extends nt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||M(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ut(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},ft=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function H(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var U=(e,t,n)=>e.endsWith(`
2
- `)?H(n,t):n.includes(`
3
- `)?`
4
- `+H(n,t):(e.endsWith(` `)?``:` `)+n,pt=`flow`,mt=`block`,ht=`quoted`;function gt(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=_t(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
5
- `)n===`block`&&(h=_t(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
6
- `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
7
- `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function _t(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
8
- `);r=t,i=t+1,a=e[i]}return r}var vt=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),yt=e=>/^(%|---|\.\.\.)/m.test(e);function bt(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
9
- `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function W(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(yt(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
10
-
11
- `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
12
- `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:gt(o,a,ht,vt(t,!1))}function xt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
13
- `)||/[ \t]\n|\n[ \t]/.test(e))return W(e,t);let n=t.indent||(yt(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:gt(r,n,pt,vt(t,!1))}function G(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=W;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?xt:i&&!t?W:n?xt:W}return r(e,t)}var St;try{St=RegExp(`(^|(?<!
14
- ))
15
- +(?!
16
- |$)`,`g`)}catch{St=/\n+(?!\n|$)/g}function Ct({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return G(n,r);let l=r.indent||(r.forceBlockIndent||yt(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===V.BLOCK_FOLDED?!1:t===V.BLOCK_LITERAL||!bt(n,c,l.length);if(!n)return u?`|
17
- `:`>
18
- `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
19
- `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
20
- `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
21
- `&&(p=p.slice(0,-1)),p.replace(St,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
22
- `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
23
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=vt(r,!0);o!==`folded`&&t!==V.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=gt(`${v}${e}${p}`,l,mt,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function wt(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
24
- `)||u&&/[[\]{},]/.test(a))return G(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
25
- `)?G(a,t):Ct(e,t,n,r);if(!s&&!u&&i!==V.PLAIN&&a.includes(`
26
- `))return Ct(e,t,n,r);if(yt(a)){if(c===``)return t.forceBlockIndent=!0,Ct(e,t,n,r);if(s&&c===l)return G(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return G(a,t)}return s?d:gt(d,c,pt,vt(t,!1))}function Tt(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?G(o.value,t):Ct(o,t,n,r);case V.QUOTE_DOUBLE:return W(o.value,t);case V.QUOTE_SINGLE:return xt(o.value,t);case V.PLAIN:return wt(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Et(e,t){let n=Object.assign({blockQuote:!0,commentString:ft,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Dt(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(N(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ot(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(N(e)||P(e))&&e.anchor;a&&tt(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function kt(e,t,n,r){if(M(e))return e.toString(t,n,r);if(j(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=F(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Dt(t.doc.schema.tags,a);let o=Ot(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):N(a)?Tt(a,t,n,r):a.toString(t,n,r);return o?N(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function At({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=F(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(P(e)||!F(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||P(e)||(N(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=kt(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=U(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=U(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=U(g,n.indent,l(f))));let _,v,y;F(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&N(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Je(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=kt(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
27
- `:``,v){let e=l(v);S+=`\n${H(e,n.indent)}`}x===``&&!n.inFlow?S===`
28
- `&&y&&(S=`
29
-
30
- `):S+=`\n${n.indent}`}else if(!p&&P(t)){let e=x[0],r=x.indexOf(`
31
- `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
32
- `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=U(g,n.indent,l(y)):h&&i&&i(),g}function jt(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Mt=`<<`,Nt={identify:e=>e===Mt||typeof e==`symbol`&&e.description===Mt,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(Mt)),{addToJSMap:Ft}),stringify:()=>Mt},Pt=(e,t)=>(Nt.identify(t)||N(t)&&(!t.type||t.type===V.PLAIN)&&Nt.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Nt.tag&&e.default);function Ft(e,t,n){let r=Lt(e,n);if(Je(r))for(let n of r.items)It(e,t,n);else if(Array.isArray(r))for(let n of r)It(e,t,n);else It(e,t,r)}function It(e,t,n){let r=Lt(e,n);if(!qe(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Lt(e,t){return e&&j(t)?t.resolve(e.doc,e):t}function Rt(e,t,{key:n,value:r}){if(F(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Pt(e,n))Ft(e,t,r);else{let i=B(n,``,e);if(t instanceof Map)t.set(i,B(r,i,e));else if(t instanceof Set)t.add(i);else{let a=zt(n,i,e),o=B(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function zt(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(F(e)&&n?.doc){let t=Et(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),jt(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Bt(e,t,n){return new K(ct(e,void 0,n),ct(t,void 0,n))}var K=class e{constructor(e,t=null){Object.defineProperty(this,A,{value:We}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return F(n)&&(n=n.clone(t)),F(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Rt(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?At(this,e,t,n):JSON.stringify(this)}};function Vt(e,t,n){return(t.inFlow??e.flow?Ut:Ht)(e,t,n)}function Ht({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(F(i))!d&&i.spaceBefore&&f.push(``),Wt(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Wt(n,f,e.commentBefore,d))}d=!1;let s=kt(i,u,()=>o=null,()=>d=!0);o&&(s+=U(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
33
- `}}return e?(p+=`
34
- `+H(l(e),c),s&&s()):d&&o&&o(),p}function Ut({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(F(i))i.spaceBefore&&d.push(``),Wt(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Wt(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=F(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=kt(i,c,()=>a=null);l||=d.length>u||o.includes(`
35
- `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=U(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
36
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Wt({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=H(t(r),e);n.push(i.trimStart())}}function q(e,t){let n=N(t)?t.value:t;for(let r of e)if(M(r)&&(r.key===t||r.key===n||N(r.key)&&r.key.value===n))return r}var J=class extends dt{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(O,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Bt(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=M(e)?e:!e||typeof e!=`object`||!(`key`in e)?new K(e,e?.value):new K(e.key,e.value);let r=q(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);N(r.value)&&at(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=q(this.items,e)?.value;return(!t&&N(n)?n.value:n)??void 0}has(e){return!!q(this.items,e)}set(e,t){this.add(new K(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Rt(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!M(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Vt(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Gt={collection:`map`,default:!0,nodeClass:J,tag:`tag:yaml.org,2002:map`,resolve(e,t){return qe(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>J.from(e,t,n)},Kt=class extends dt{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(k,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=qt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=qt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&N(r)?r.value:r}has(e){let t=qt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=qt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];N(r)&&at(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(B(e,String(r++),t));return n}toString(e,t,n){return e?Vt(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ct(a,void 0,n))}}return i}};function qt(e){let t=N(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Jt={collection:`seq`,default:!0,nodeClass:Kt,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Je(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Kt.from(e,t,n)};function Yt(e){return typeof e==`bigint`||Number.isInteger(e)}var Xt=({value:e})=>JSON.stringify(e),Zt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Xt},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Xt},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Xt},{identify:Yt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Xt}];[Gt,Jt].concat(Zt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Qt(e,t,n){let{replacer:r}=n,i=new Kt(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Bt(o,s,n))}return i}var $t=class e extends Kt{constructor(){super(),this.add=J.prototype.add.bind(this),this.delete=J.prototype.delete.bind(this),this.get=J.prototype.get.bind(this),this.has=J.prototype.has.bind(this),this.set=J.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(M(e)?(r=B(e.key,``,t),i=B(e.value,r,t)):r=B(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Qt(e,t,n),i=new this;return i.items=r.items,i}};$t.tag=`tag:yaml.org,2002:omap`;var en=class e extends J{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=M(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new K(e.key,null):new K(e,null),q(this.items,t.key)||this.items.push(t)}get(e,t){let n=q(this.items,e);return!t&&M(n)?N(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=q(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new K(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Bt(e,null,n));return i}};en.tag=`tag:yaml.org,2002:set`;var tn=Symbol(`break visit`),nn=Symbol(`skip children`),rn=Symbol(`remove item`);function Y(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),an(Object.freeze([]),e,t)}Y.BREAK=tn,Y.SKIP=nn,Y.REMOVE=rn,Y.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Y.parentCollection=(e,t)=>{let n=Y.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function an(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=an(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===tn)return tn;else r===rn&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}e(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=/[.*+?()[\]{}^$|\\/]/,i=/^ +$/,a=/(?:[^\\]|^)\\$/,o=/^\\!/,s=/^\\#/,c=/\r?\n/g,l=`/`,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));var d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=()=>!1,m=e=>{let{length:t}=e;return e.slice(0,t-t%2)},h={alnum:`0-9A-Za-z`,alpha:`A-Za-z`,blank:` \\t`,cntrl:`\\x00-\\x1f\\x7f`,digit:`0-9`,graph:`!-.0-~`,lower:`a-z`,print:` -.0-~`,punct:"!-.:-@\\[-`{-~",space:` \\t\\n\\r`,upper:`A-Z`,xdigit:`0-9A-Fa-f`},g=`\\]^-[`,_=e=>g.indexOf(e)<0?e:`\\`+e,v=`(?!\\/)`,y=(e,t)=>{if(e)return`[^\\/${t}]`;let n=`[${t}]`;return new RegExp(n).test(`/`)?v+n:n},b=(e,t)=>{let{length:n}=e,r=t+1,i=``,a=e[r];(a===`!`||a===`^`)&&(i=`^`,r++);let o=``,s=``;for(;;){let t=e[r];if(t===void 0)return null;if(t===`\\`){let t=e[r+1];if(t===void 0)return null;o+=_(t),s=t,r++}else if(t===`-`&&s&&r+1<n&&e[r+1]!==`]`){r++;let t=e[r];t===`\\`&&(t=e[r+=1]),s<=t&&(o+=`-${_(t)}`),s=``}else if(t===`[`&&e[r+1]===`:`){let t=r+2,i=t;for(;i<n&&e[i]!==`]`;)i++;if(i===n)return null;if(i>t&&e[i-1]===`:`){let n=h[e.slice(t,i-1)];if(n===void 0)return null;o+=n,s=``,r=i}else o+=_(`[`),s=`[`,r=t-2}else o+=_(t),s=t;if(r++,e[r]===`]`)return{end:r,source:y(i,o)}}},x=`[]`,S=`\0`,ee=RegExp(`${S}(\\d+)${S}`,`g`),te=``,ne=e=>{let t=[],n=e=>`${S}${t.push(e)-1}${S}`,{length:i}=e,a=``,o=0;for(;o<i;){let t=e[o];if(t===`\\`){let t=e[o+1];a+=t===`*`||t===`[`||t===` `||t===`\\`?e.slice(o,o+2):n(r.test(t)?`\\`+t:t),o+=2}else if(t===S)a+=n(`[${S}]`),o++;else if(t===`[`){let t=b(e,o);t===null?(a+=n(x),o=i):(a+=n(t.source),o=t.end+1)}else a+=t,o++}return{source:a,sources:t}},re=null,ie=/\/(?!$)/,ae=[[/^\uFEFF/,()=>``,``],[/[\r\n]+$/,()=>``],[/((?:\\\\)*?)(\\? +)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?) /g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`,`?`],[/^\//,()=>`^`,l],[/\//g,()=>`\\/`,l],[/^\^*(?:\\\*\\\*\\\/)+/,()=>`^(?:.*\\/)?`,`*`],[re,(e,t)=>!e||e[0]===`^`?e:(ie.test(t)?`^`:`(?:^|\\/)`)+e],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?n.slice(t+6)===`\\/`?`(?:\\/[^\\/]+)+`:`(?:\\/[^\\/]+)*`:`\\/.+`,`*`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`),`*`],[/(^|[^\\])((?:\\\\)*)\\\*$/,(e,t,n)=>n.length/2%2==0?t+n+te:e,`*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`,`\\\\`],[/\\\\/g,()=>`\\`,`\\\\`],[/\\\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r)=>`\\[${t}${m(n)}${r}`,`[`],[re,e=>{let t=e[e.length-1];return!t||t===te?e:t===l?`${e}$`:`${e}(?=$|\\/$)`}]],oe=/(^|\\\/)?\uE000$/,se=`regex`,ce=`checkRegex`,le={[se](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[ce](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},ue=`[^\\/]*`,de=e=>{if(e.indexOf(ue)<0)return e;let t=[],{length:n}=e,r=0;for(;r<n;){let i=e[r];if(e.startsWith(ue,r))t.push({wildcard:!0}),r+=6;else if(i===`[`){let i=r+1;for(e[i]===`^`&&i++,e[i]===`]`&&i++;i<n&&e[i]!==`]`;)i+=e[i]===`\\`?2:1;i++,t.push({single:e.slice(r,i)}),r=i}else if(i===`\\`)t.push({single:e.slice(r,r+2)}),r+=2;else if(i===`(`){let i=0,a=r;do e[a]===`\\`?a++:e[a]===`(`?i++:e[a]===`)`&&i--,a++;while(a<n&&i>0);`*+?`.indexOf(e[a])>=0&&a++,t.push({boundary:e.slice(r,a)}),r=a}else i===`^`||i===`$`?(t.push({boundary:i}),r++):(t.push({single:i}),r++)}let i=``,a=[],o=()=>{let e;a.forEach((t,n)=>{t.wildcard&&(e=n)}),a.forEach((t,n)=>{if(!t.wildcard){i+=t.single;return}i+=n===e?ue:`(?:(?!${a[n+1].single})[^\\/])*`}),a=[]};return t.forEach(e=>{if(e.boundary===void 0){a.push(e);return}o(),i+=e.boundary}),o(),i},C=e=>{let{source:t,sources:n}=ne(e),r=ae.reduce((t,[n,r,i])=>n===re?r(t,e):i!==void 0&&t.indexOf(i)<0?t:n.test(t)?t.replace(n,r.bind(e)):t,t);return n.length?r.replace(ee,(e,t)=>n[t]):r},fe=e=>{let t=e.indexOf(l);return t<0||t===e.length-1},pe=e=>{let t=e.length-1,n=e.lastIndexOf(l,e[t]===l?t-1:t);return n<0?e:e.slice(n+1)},me=e=>{if(e.charCodeAt(0)===47||e.indexOf(`//`)>=0){let t=e.split(l).filter(Boolean);return t.pop(),t.length?t.join(l)+l:``}let t=e.length-1,n=e.lastIndexOf(l,e.charCodeAt(t)===47?t-1:t);return n<0?``:e.slice(0,n+1)},w=e=>typeof e==`string`,he=e=>e&&w(e)&&!i.test(e)&&!a.test(e)&&e.indexOf(`#`)!==0,ge=e=>e.split(c).filter(Boolean),_e=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get _basenameOnly(){return f(this,`_basenameOnly`,fe(this.body))}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(se,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(ce,e)}_make(e,t){let n=de(this.regexPrefix.replace(oe,le[e])),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}},ve=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(o,`!`).replace(s,`#`);let a=C(i);return new _e(e,t,i,n,r,a)},ye=class{constructor(e){this._ignoreCase=e,this._rules=[],this._basenameCount=0}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._basenameCount+=e._rules._basenameCount,this._added=!0;return}if(w(e)&&(e={pattern:e}),he(e.pattern)){let t=ve(e,this._ignoreCase);this._added=!0,this._rules.push(t),fe(t.body)&&this._basenameCount++}}add(e){return this._added=!1,n(w(e)?ge(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a,o=this._rules,{length:s}=o,c=this._basenameCount*2>=s,l=c?pe(e):e;for(let u=0;u<s;u++){let s=o[u],{negative:d}=s;!(i===d&&r!==i||d&&!r&&!i&&!t)&&s[n].test(c&&s._basenameOnly?l:e)&&(r=!d,i=d,a=d?void 0:s)}let u={ignored:r,unignored:i};return a&&(u.rule=a),u}},be=(e,t)=>{throw new t(e)},T=(e,t,n)=>w(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),xe=e=>{let t=e.charCodeAt(0);if(t===47)return!0;if(t!==46)return!1;if(e.length===1)return!0;let n=e.charCodeAt(1);return n===47?!0:n===46?e.length===2||e.charCodeAt(2)===47:!1};T.isNotRelative=xe,T.convert=e=>e;var Se=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new ye(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n){let r=e&&T.convert(e);return T(r,e,this._strictPathCheck?be:p),this._t(r,t,n)}checkIgnore(e){if(e.charCodeAt(e.length-1)!==47)return this.test(e);let t=me(e);if(t){let e=this._t(t,this._testCache,!0);if(e.ignored)return e}return this._rules.test(e,!1,ce)}_t(e,t,n){if(e in t)return t[e];let r=me(e),i=r?this._t(r,t,n):void 0;return t[e]=i&&i.ignored?i:this._rules.test(e,n,se)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},E=e=>new Se(e),Ce=e=>T(e&&T.convert(e),e,p),we=()=>{T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||xe(t)};typeof process<`u`&&process.platform===`win32`&&we(),t.exports=E,E.default=E,t.exports.isPathValid=Ce,f(t.exports,Symbol.for(`setupWindows`),we)}))(),globalThis.Buffer,new TextEncoder,new TextDecoder,E({command:D({description:`Bash command to execute`}),timeout:T(De({description:`Timeout in seconds (optional, no default timeout)`}))});var on=E({oldText:D({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:D({description:`Replacement text for this targeted edit.`})},{});E({path:D({description:`Path to the file to edit (relative or absolute)`}),edits:ye(on,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),E({path:D({description:`Path to the file to read (relative or absolute)`}),offset:T(De({description:`Line number to start reading from (1-indexed)`})),limit:T(De({description:`Maximum number of lines to read`}))}),E({path:D({description:`Path to the file to write (relative or absolute)`}),content:D({description:`Content to write to the file`})}),a(`context-compaction`);function sn(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${ln(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${ln(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${ln(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${ln(e.content)}\n</${e.role}>`)}}return t.join(`
37
-
38
- `)}var cn=/\n*The full transcript of the conversation before this compaction is saved at \S+ — read it when the summary is not enough\.?/g;function ln(e){if(typeof e==`string`)return e.replace(cn,``);if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text.replace(cn,``)):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
39
- `)}var un=`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
40
-
41
- Focus on:
42
- - User preferences, working style, opinions stated explicitly.
43
- - Stable project facts (architecture decisions, conventions, constraints).
44
- - Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
45
- - External resources/links the user named.
46
-
47
- DO NOT include:
48
- - Ephemeral state (current task, in-progress work).
49
- - Information already obvious from the codebase (file paths, function names, framework conventions).
50
- - Generic restatements of what the conversation was about.
51
-
52
- If nothing in the conversation is worth persisting, return exactly the single line:
53
- NONE
54
-
55
- Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`;function dn(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
56
-
57
- Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
58
-
59
- <conversation>
60
- ${e}
61
- </conversation>`}var X=class extends Error{failure;constructor(e,t){super(t),this.failure=e,this.name=`CompactionCallError`}};function fn(e){if(e instanceof X)return e.failure;let t=typeof e==`object`&&e?e:void 0,n=t?.status??t?.statusCode??t?.code,r=typeof t?.message==`string`?t.message.toLowerCase():String(e).toLowerCase();return n===429||n===`429`||/rate[ -]?limit|too many requests|throttl/.test(r)?`rate-limit`:/quota|credit|budget|billing|allowance|resource exhausted/.test(r)?`quota-exhausted`:n===401||n===`401`||/unauthori[sz]ed|authentication|invalid api.?key|invalid x-api-key|session expired/.test(r)?`authentication`:typeof n==`number`&&n>=500||typeof n==`string`&&/^5\d\d$/.test(n)||/service unavailable|provider unavailable|overloaded|outage|timed? out|timeout|network|fetch failed|connection/.test(r)?`provider-unavailable`:`unknown`}async function pn(e,t,n,r,a,s,c){let l={role:`user`,content:[{type:`text`,text:o(r)}],timestamp:Date.now()},u=await i(e,{systemPrompt:o(n),messages:[l]},{maxTokens:a,apiKey:t,headers:s,signal:c});if(typeof u!=`object`||!u)throw new X(`invalid-response`,`Compaction call returned no response`);let d=u;if(typeof d.stopReason!=`string`||!Array.isArray(d.content))throw new X(`invalid-response`,`Compaction call returned an invalid response envelope`);if(d.stopReason===`error`){let e=typeof d.errorMessage==`string`?d.errorMessage:`Unknown provider error`;throw new X(fn(Error(e)),`Compaction call failed: ${e}`)}let f=d.content.filter(e=>typeof e==`object`&&!!e&&e.type===`text`);if(f.some(e=>typeof e.text!=`string`))throw new X(`invalid-response`,`Compaction call returned an invalid text block`);let p=f.map(e=>e.text).join(`
62
- `).trim();if(!p)throw new X(`empty-response`,`Compaction call returned no summary text`);return p}async function mn(e){let t=dn(sn(e.messages));return pn(e.model,e.apiKey,t,e.instruction,e.maxTokens,e.headers,e.signal)}var hn=un,gn=`Generate a short title (3 to 6 words) summarizing what this conversation was about. Output ONLY the title text — no quotes, no punctuation other than what belongs in the title, no preamble.`,_n=`slicc_model_catalog`;function vn(){try{return globalThis.localStorage??null}catch{return null}}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e,t){return Reflect.get(e,t)}function yn(e){let t=null;try{t=e?.getItem(`slicc_model_catalog`)??null}catch{return{raw:null,store:{}}}if(!t)return{raw:t,store:{}};try{let e=JSON.parse(t);return{raw:t,store:Z(e)?e:{}}}catch{return{raw:t,store:{}}}}function $(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function bn(e){if(!Z(e))return null;let t=Q(e,`input`),n=Q(e,`output`),r=Q(e,`cacheRead`),i=Q(e,`cacheWrite`);return!$(t)||!$(n)||!$(r)||!$(i)?null:{input:t,output:n,cacheRead:r,cacheWrite:i}}function xn(e){return!Array.isArray(e)||e.length===0||!e.every(e=>e===`text`||e===`image`)?null:[...e]}function Sn(e){if(e===void 0)return;if(!Z(e))return null;let t=Object.entries(e);return t.every(([,e])=>e===null||typeof e==`string`)?Object.fromEntries(t):null}function Cn(e){return{apis:new Set(e.map(e=>e.api)),baseUrls:new Set(e.map(e=>e.baseUrl))}}function wn(e,t,n){if(!Z(t))return null;let r=Q(t,`id`),i=Q(t,`name`),a=Q(t,`api`),o=Q(t,`baseUrl`),s=Q(t,`reasoning`),c=Q(t,`contextWindow`),l=Q(t,`maxTokens`);if(typeof r!=`string`||r.length===0||r.length>200||typeof i!=`string`||i.length===0||typeof a!=`string`||!n.apis.has(a)||typeof o!=`string`||!n.baseUrls.has(o)||typeof s!=`boolean`||!$(c)||c===0||!$(l)||l===0)return null;let u=bn(Q(t,`cost`)),d=xn(Q(t,`input`)),f=Sn(Q(t,`thinkingLevelMap`));if(!u||!d||f===null)return null;let p=Q(t,`compat`),m={id:r,name:i,api:a,provider:e,baseUrl:o,reasoning:s,input:d,cost:u,contextWindow:c,maxTokens:l};return f&&(m.thinkingLevelMap=f),Z(p)&&(m.compat={...p}),m}function Tn(){return 1790795820024}var En,Dn=new Map;function On(e){try{return r(e)}catch{return[]}}function kn(e){if(!e||!Array.isArray(e.models)||e.models.length===0)return!1;let t=Tn();return t===null||typeof e.lastModified==`number`&&e.lastModified>t}var An=new Set([`id`,`name`,`api`,`provider`,`baseUrl`,`reasoning`,`input`,`cost`,`contextWindow`,`maxTokens`,`thinkingLevelMap`,`compat`]);function jn(e,t,n){if(t)return{...Object.fromEntries(Object.entries(t).filter(([e])=>!An.has(e))),...e};let r=n.find(t=>t.headers&&t.api===e.api&&t.baseUrl===e.baseUrl);return r?.headers?{...e,headers:{...r.headers}}:e}function Mn(e,t){let n=On(e);if(n.length===0)return n;let r=Cn(n),i=[...n],a=new Map(i.map((e,t)=>[e.id,t])),o=new Map(n.map(e=>[e.id,e]));for(let s of t.models){let t=wn(e,s,r);if(!t)continue;let c=a.get(t.id),l=jn(t,o.get(t.id),n);c===void 0?(a.set(l.id,i.length),i.push(l)):i[c]=l}return i}function Nn(e,t){if(!s(`live-model-catalog`))return On(e);let{raw:n,store:r}=yn(t),i=r[e];if(!kn(i))return On(e);n!==En&&(En=n,Dn=new Map);let a=Dn.get(e);return a||(a=Mn(e,i),Dn.set(e,a)),a}function Pn(e){return[...Nn(e,vn())]}function Fn(e,t){return Nn(e,vn()).find(e=>e.id===t)||n(e,t)}var In=t;a(`secret-scrub`),a(`image-processor`),a(`tool-adapter`);export{Pn as a,yn as c,mn as d,Fn as i,hn as l,vn as n,In as o,Q as r,Z as s,_n as t,gn as u};
@@ -1,36 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import"./proxied-fetch-F-dCBEfh.js";import{i as n}from"./feature-flags-QlgHaQc1.js";import{s as r,t as i}from"./api-endpoint-D8lUKmPu.js";import{$ as a,G as o,S as s,U as c,y as l}from"./build-Dnkjpm_v.js";import{i as u,n as d,r as f}from"./compat-nGhSz-U1.js";import"./context-CrZ58_Xy.js";import"./libesm-CTQYxJIv.js";import"./context-compaction-BCsq-2e6.js";import{n as p}from"./float-topology-COIC4j_U.js";import{t as m}from"./secrets-bridge-client-GOCzDscb.js";import{t as h}from"./image-markers-CwM1dvoI.js";import{o as g,s as _}from"./tool-ui-DRnUkp2g.js";import{n as v}from"./image-processor-BlI3KRoz.js";const y={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},b={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...y}),{...b},{...y},{...b},{...y},{...b};function x(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function S(e,t=``){return x(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}S(`pi.session.name`);const C=Symbol.for(`yaml.alias`),ee=Symbol.for(`yaml.document`),w=Symbol.for(`yaml.map`),T=Symbol.for(`yaml.pair`),te=Symbol.for(`yaml.scalar`),E=Symbol.for(`yaml.seq`),D=Symbol.for(`yaml.node.type`),O=e=>!!e&&typeof e==`object`&&e[D]===C,k=e=>!!e&&typeof e==`object`&&e[D]===ee,A=e=>!!e&&typeof e==`object`&&e[D]===w,j=e=>!!e&&typeof e==`object`&&e[D]===T,M=e=>!!e&&typeof e==`object`&&e[D]===te,N=e=>!!e&&typeof e==`object`&&e[D]===E;function P(e){if(e&&typeof e==`object`)switch(e[D]){case w:case E:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[D]){case C:case w:case te:case E:return!0}return!1}const ne=e=>(M(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),re=Symbol(`skip children`),L=Symbol(`remove node`);function R(e,t){let n=ie(t);k(e)?z(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):z(null,e,n,Object.freeze([]))}R.BREAK=I,R.SKIP=re,R.REMOVE=L;function z(e,t,n,r){let i=ae(e,t,n,r);if(F(i)||j(i))return oe(e,r,i),z(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=z(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=z(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=z(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(N(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(O(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(k(r))r.contents=n;else{let e=O(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function se(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function B(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=B(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=B(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=B(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=B(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function V(e,t,n){if(Array.isArray(e))return e.map((e,t)=>V(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ne(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ce=class{constructor(e){Object.defineProperty(this,D,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!k(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=V(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?B(i,{"":o},``,o):o}},le=class extends ce{constructor(e){super(C),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],R(e,{Node:(e,t)=>{(O(t)||ne(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(V(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ue(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(se(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ue(e,t,n){if(O(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=ue(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ue(e,t.key,n),i=ue(e,t.value,n);return Math.max(r,i)}return 1}const de=e=>!e||typeof e!=`function`&&typeof e!=`object`;var H=class extends ce{constructor(e){super(te),this.value=e}toJSON(e,t){return t?.keep?this.value:V(this.value,e,t)}toString(){return String(this.value)}};H.BLOCK_FOLDED=`BLOCK_FOLDED`,H.BLOCK_LITERAL=`BLOCK_LITERAL`,H.PLAIN=`PLAIN`,H.QUOTE_DOUBLE=`QUOTE_DOUBLE`,H.QUOTE_SINGLE=`QUOTE_SINGLE`;function fe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function pe(e,t,n){if(k(e)&&(e=e.contents),F(e))return e;if(j(e)){let t=n.schema[w].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new le(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=fe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new H(e);return c&&(c.node=t),t}l=e instanceof Map?o[w]:Symbol.iterator in Object(e)?o[E]:o[w]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new H(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function me(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return pe(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const he=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var ge=class extends ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(he(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const _e=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ve(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const U=(e,t,n)=>e.endsWith(`
2
- `)?ve(n,t):n.includes(`
3
- `)?`
4
- `+ve(n,t):(e.endsWith(` `)?``:` `)+n,ye=`flow`;function be(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=xe(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
5
- `)n===`block`&&(h=xe(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
6
- `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
7
- `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function xe(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
8
- `);r=t,i=t+1,a=e[i]}return r}const Se=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ce=e=>/^(%|---|\.\.\.)/m.test(e);function we(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
9
- `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function W(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ce(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
10
-
11
- `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
12
- `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:be(o,a,`quoted`,Se(t,!1))}function Te(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
13
- `)||/[ \t]\n|\n[ \t]/.test(e))return W(e,t);let n=t.indent||(Ce(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:be(r,n,ye,Se(t,!1))}function G(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=W;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Te:i&&!t?W:n?Te:W}return r(e,t)}let Ee;try{Ee=RegExp(`(^|(?<!
14
- ))
15
- +(?!
16
- |$)`,`g`)}catch{Ee=/\n+(?!\n|$)/g}function De({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return G(n,r);let l=r.indent||(r.forceBlockIndent||Ce(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===H.BLOCK_FOLDED?!1:t===H.BLOCK_LITERAL||!we(n,c,l.length);if(!n)return u?`|
17
- `:`>
18
- `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
19
- `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
20
- `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
21
- `&&(p=p.slice(0,-1)),p.replace(Ee,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
22
- `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
23
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Se(r,!0);o!==`folded`&&t!==H.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=be(`${v}${e}${p}`,l,`block`,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Oe(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
24
- `)||u&&/[[\]{},]/.test(a))return G(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
25
- `)?G(a,t):De(e,t,n,r);if(!s&&!u&&i!==H.PLAIN&&a.includes(`
26
- `))return De(e,t,n,r);if(Ce(a)){if(c===``)return t.forceBlockIndent=!0,De(e,t,n,r);if(s&&c===l)return G(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return G(a,t)}return s?d:be(d,c,ye,Se(t,!1))}function ke(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==H.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=H.QUOTE_DOUBLE);let c=e=>{switch(e){case H.BLOCK_FOLDED:case H.BLOCK_LITERAL:return i||a?G(o.value,t):De(o,t,n,r);case H.QUOTE_DOUBLE:return W(o.value,t);case H.QUOTE_SINGLE:return Te(o.value,t);case H.PLAIN:return Oe(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Ae(e,t){let n=Object.assign({blockQuote:!0,commentString:_e,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function je(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(M(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Me(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(M(e)||P(e))&&e.anchor;a&&se(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ne(e,t,n,r){if(j(e))return e.toString(t,n,r);if(O(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=F(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=je(t.doc.schema.tags,a);let o=Me(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):M(a)?ke(a,t,n,r):a.toString(t,n,r);return o?M(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Pe({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=F(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(P(e)||!F(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||P(e)||(M(e)?e.type===H.BLOCK_FOLDED||e.type===H.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ne(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=U(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=U(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=U(g,n.indent,l(f))));let _,v,y;F(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&M(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&N(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ne(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
27
- `:``,v){let e=l(v);S+=`\n${ve(e,n.indent)}`}x===``&&!n.inFlow?S===`
28
- `&&y&&(S=`
29
-
30
- `):S+=`\n${n.indent}`}else if(!p&&P(t)){let e=x[0],r=x.indexOf(`
31
- `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
32
- `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=U(g,n.indent,l(y)):h&&i&&i(),g}function Fe(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const Ie={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new H(Symbol(`<<`)),{addToJSMap:Re}),stringify:()=>`<<`},Le=(e,t)=>(Ie.identify(t)||M(t)&&(!t.type||t.type===H.PLAIN)&&Ie.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Ie.tag&&e.default);function Re(e,t,n){let r=Be(e,n);if(N(r))for(let n of r.items)ze(e,t,n);else if(Array.isArray(r))for(let n of r)ze(e,t,n);else ze(e,t,r)}function ze(e,t,n){let r=Be(e,n);if(!A(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Be(e,t){return e&&O(t)?t.resolve(e.doc,e):t}function Ve(e,t,{key:n,value:r}){if(F(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Le(e,n))Re(e,t,r);else{let i=V(n,``,e);if(t instanceof Map)t.set(i,V(r,i,e));else if(t instanceof Set)t.add(i);else{let a=He(n,i,e),o=V(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function He(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(F(e)&&n?.doc){let t=Ae(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Fe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Ue(e,t,n){return new K(pe(e,void 0,n),pe(t,void 0,n))}var K=class e{constructor(e,t=null){Object.defineProperty(this,D,{value:T}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return F(n)&&(n=n.clone(t)),F(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Ve(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Pe(this,e,t,n):JSON.stringify(this)}};function We(e,t,n){return(t.inFlow??e.flow?Ke:Ge)(e,t,n)}function Ge({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(F(i))!d&&i.spaceBefore&&f.push(``),qe(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(j(i)){let e=F(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),qe(n,f,e.commentBefore,d))}d=!1;let s=Ne(i,u,()=>o=null,()=>d=!0);o&&(s+=U(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
33
- `}}return e?(p+=`
34
- `+ve(l(e),c),s&&s()):d&&o&&o(),p}function Ke({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(F(i))i.spaceBefore&&d.push(``),qe(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(j(i)){let e=F(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),qe(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=F(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ne(i,c,()=>a=null);l||=d.length>u||o.includes(`
35
- `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=U(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
36
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function qe({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=ve(t(r),e);n.push(i.trimStart())}}function q(e,t){let n=M(t)?t.value:t;for(let r of e)if(j(r)&&(r.key===t||r.key===n||M(r.key)&&r.key.value===n))return r}var J=class extends ge{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(w,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Ue(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=j(e)?e:!e||typeof e!=`object`||!(`key`in e)?new K(e,e?.value):new K(e.key,e.value);let r=q(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);M(r.value)&&de(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=q(this.items,e)?.value;return(!t&&M(n)?n.value:n)??void 0}has(e){return!!q(this.items,e)}set(e,t){this.add(new K(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Ve(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!j(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),We(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Je={collection:`map`,default:!0,nodeClass:J,tag:`tag:yaml.org,2002:map`,resolve(e,t){return A(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>J.from(e,t,n)};var Ye=class extends ge{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(E,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Xe(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Xe(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&M(r)?r.value:r}has(e){let t=Xe(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Xe(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];M(r)&&de(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(V(e,String(r++),t));return n}toString(e,t,n){return e?We(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(pe(a,void 0,n))}}return i}};function Xe(e){let t=M(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const Ze={collection:`seq`,default:!0,nodeClass:Ye,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return N(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Ye.from(e,t,n)};function Qe(e){return typeof e==`bigint`||Number.isInteger(e)}const $e=({value:e})=>JSON.stringify(e),et=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:$e},{identify:e=>e==null,createNode:()=>new H(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:$e},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:$e},{identify:Qe,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Qe(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:$e}];[Je,Ze].concat(et,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function tt(e,t,n){let{replacer:r}=n,i=new Ye(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Ue(o,s,n))}return i}var nt=class e extends Ye{constructor(){super(),this.add=J.prototype.add.bind(this),this.delete=J.prototype.delete.bind(this),this.get=J.prototype.get.bind(this),this.has=J.prototype.has.bind(this),this.set=J.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(j(e)?(r=V(e.key,``,t),i=V(e.value,r,t)):r=V(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=tt(e,t,n),i=new this;return i.items=r.items,i}};nt.tag=`tag:yaml.org,2002:omap`;var rt=class e extends J{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=j(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new K(e.key,null):new K(e,null),q(this.items,t.key)||this.items.push(t)}get(e,t){let n=q(this.items,e);return!t&&j(n)?M(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=q(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new K(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Ue(e,null,n));return i}};rt.tag=`tag:yaml.org,2002:set`;const it=Symbol(`break visit`),at=Symbol(`skip children`),ot=Symbol(`remove item`);function Y(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),st(Object.freeze([]),e,t)}Y.BREAK=it,Y.SKIP=at,Y.REMOVE=ot,Y.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Y.parentCollection=(e,t)=>{let n=Y.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function st(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=st(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===it)return it;else r===ot&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}e(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/[.*+?()[\]{}^$|\\/]/,i=/^ +$/,a=/(?:[^\\]|^)\\$/,o=/^\\!/,s=/^\\#/,c=/\r?\n/g,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),f=()=>!1,p=e=>{let{length:t}=e;return e.slice(0,t-t%2)},m={alnum:`0-9A-Za-z`,alpha:`A-Za-z`,blank:` \\t`,cntrl:`\\x00-\\x1f\\x7f`,digit:`0-9`,graph:`!-.0-~`,lower:`a-z`,print:` -.0-~`,punct:"!-.:-@\\[-`{-~",space:` \\t\\n\\r`,upper:`A-Z`,xdigit:`0-9A-Fa-f`},h=e=>`\\]^-[`.indexOf(e)<0?e:`\\`+e,g=(e,t)=>{if(e)return`[^\\/${t}]`;let n=`[${t}]`;return new RegExp(n).test(`/`)?`(?!\\/)`+n:n},_=(e,t)=>{let{length:n}=e,r=t+1,i=``,a=e[r];(a===`!`||a===`^`)&&(i=`^`,r++);let o=``,s=``;for(;;){let t=e[r];if(t===void 0)return null;if(t===`\\`){let t=e[r+1];if(t===void 0)return null;o+=h(t),s=t,r++}else if(t===`-`&&s&&r+1<n&&e[r+1]!==`]`){r++;let t=e[r];t===`\\`&&(t=e[r+=1]),s<=t&&(o+=`-${h(t)}`),s=``}else if(t===`[`&&e[r+1]===`:`){let t=r+2,i=t;for(;i<n&&e[i]!==`]`;)i++;if(i===n)return null;if(i>t&&e[i-1]===`:`){let n=m[e.slice(t,i-1)];if(n===void 0)return null;o+=n,s=``,r=i}else o+=h(`[`),s=`[`,r=t-2}else o+=h(t),s=t;if(r++,e[r]===`]`)return{end:r,source:g(i,o)}}},v=RegExp(`\0(\\d+)\0`,`g`),y=e=>{let t=[],n=e=>`${t.push(e)-1}`,{length:i}=e,a=``,o=0;for(;o<i;){let t=e[o];if(t===`\\`){let t=e[o+1];a+=t===`*`||t===`[`||t===` `||t===`\\`?e.slice(o,o+2):n(r.test(t)?`\\`+t:t),o+=2}else if(t===`\0`)a+=n(`[\0]`),o++;else if(t===`[`){let t=_(e,o);t===null?(a+=n(`[]`),o=i):(a+=n(t.source),o=t.end+1)}else a+=t,o++}return{source:a,sources:t}},b=/\/(?!$)/,x=[[/^\uFEFF/,()=>``,``],[/[\r\n]+$/,()=>``],[/((?:\\\\)*?)(\\? +)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?) /g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`,`?`],[/^\//,()=>`^`,`/`],[/\//g,()=>`\\/`,`/`],[/^\^*(?:\\\*\\\*\\\/)+/,()=>`^(?:.*\\/)?`,`*`],[null,(e,t)=>!e||e[0]===`^`?e:(b.test(t)?`^`:`(?:^|\\/)`)+e],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?n.slice(t+6)===`\\/`?`(?:\\/[^\\/]+)+`:`(?:\\/[^\\/]+)*`:`\\/.+`,`*`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`),`*`],[/(^|[^\\])((?:\\\\)*)\\\*$/,(e,t,n)=>n.length/2%2==0?t+n+``:e,`*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`,`\\\\`],[/\\\\/g,()=>`\\`,`\\\\`],[/\\\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r)=>`\\[${t}${p(n)}${r}`,`[`],[null,e=>{let t=e[e.length-1];return!t||t===``?e:t===`/`?`${e}$`:`${e}(?=$|\\/$)`}]],S=/(^|\\\/)?\uE000$/,C=`regex`,ee=`checkRegex`,w={[C](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[ee](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},T=`[^\\/]*`,te=e=>{if(e.indexOf(T)<0)return e;let t=[],{length:n}=e,r=0;for(;r<n;){let i=e[r];if(e.startsWith(T,r))t.push({wildcard:!0}),r+=6;else if(i===`[`){let i=r+1;for(e[i]===`^`&&i++,e[i]===`]`&&i++;i<n&&e[i]!==`]`;)i+=e[i]===`\\`?2:1;i++,t.push({single:e.slice(r,i)}),r=i}else if(i===`\\`)t.push({single:e.slice(r,r+2)}),r+=2;else if(i===`(`){let i=0,a=r;do e[a]===`\\`?a++:e[a]===`(`?i++:e[a]===`)`&&i--,a++;while(a<n&&i>0);`*+?`.indexOf(e[a])>=0&&a++,t.push({boundary:e.slice(r,a)}),r=a}else i===`^`||i===`$`?(t.push({boundary:i}),r++):(t.push({single:i}),r++)}let i=``,a=[],o=()=>{let e;a.forEach((t,n)=>{t.wildcard&&(e=n)}),a.forEach((t,n)=>{if(!t.wildcard){i+=t.single;return}i+=n===e?T:`(?:(?!${a[n+1].single})[^\\/])*`}),a=[]};return t.forEach(e=>{if(e.boundary===void 0){a.push(e);return}o(),i+=e.boundary}),o(),i},E=e=>{let{source:t,sources:n}=y(e),r=x.reduce((t,[n,r,i])=>n===null?r(t,e):i!==void 0&&t.indexOf(i)<0?t:n.test(t)?t.replace(n,r.bind(e)):t,t);return n.length?r.replace(v,(e,t)=>n[t]):r},D=e=>{let t=e.indexOf(`/`);return t<0||t===e.length-1},O=e=>{let t=e.length-1,n=e.lastIndexOf(`/`,e[t]===`/`?t-1:t);return n<0?e:e.slice(n+1)},k=e=>{if(e.charCodeAt(0)===47||e.indexOf(`//`)>=0){let t=e.split(`/`).filter(Boolean);return t.pop(),t.length?t.join(`/`)+`/`:``}let t=e.length-1,n=e.lastIndexOf(`/`,e.charCodeAt(t)===47?t-1:t);return n<0?``:e.slice(0,n+1)},A=e=>typeof e==`string`,j=e=>e&&A(e)&&!i.test(e)&&!a.test(e)&&e.indexOf(`#`)!==0,M=e=>e.split(c).filter(Boolean);var N=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,d(this,`body`,n),d(this,`ignoreCase`,r),d(this,`regexPrefix`,a)}get _basenameOnly(){return d(this,`_basenameOnly`,D(this.body))}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(C,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(ee,e)}_make(e,t){let n=te(this.regexPrefix.replace(S,w[e])),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return d(this,t,r)}};let P=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(o,`!`).replace(s,`#`);let a=E(i);return new N(e,t,i,n,r,a)};var F=class{constructor(e){this._ignoreCase=e,this._rules=[],this._basenameCount=0}_add(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules._rules),this._basenameCount+=e._rules._basenameCount,this._added=!0;return}if(A(e)&&(e={pattern:e}),j(e.pattern)){let t=P(e,this._ignoreCase);this._added=!0,this._rules.push(t),D(t.body)&&this._basenameCount++}}add(e){return this._added=!1,n(A(e)?M(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a,o=this._rules,{length:s}=o,c=this._basenameCount*2>=s,l=c?O(e):e;for(let u=0;u<s;u++){let s=o[u],{negative:d}=s;!(i===d&&r!==i||d&&!r&&!i&&!t)&&s[n].test(c&&s._basenameOnly?l:e)&&(r=!d,i=d,a=d?void 0:s)}let u={ignored:r,unignored:i};return a&&(u.rule=a),u}};let ne=(e,t)=>{throw new t(e)},I=(e,t,n)=>A(e)?e?!I.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),re=e=>{let t=e.charCodeAt(0);if(t===47)return!0;if(t!==46)return!1;if(e.length===1)return!0;let n=e.charCodeAt(1);return n===47?!0:n===46?e.length===2||e.charCodeAt(2)===47:!1};I.isNotRelative=re,I.convert=e=>e;var L=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=new F(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n){let r=e&&I.convert(e);return I(r,e,this._strictPathCheck?ne:f),this._t(r,t,n)}checkIgnore(e){if(e.charCodeAt(e.length-1)!==47)return this.test(e);let t=k(e);if(t){let e=this._t(t,this._testCache,!0);if(e.ignored)return e}return this._rules.test(e,!1,ee)}_t(e,t,n){if(e in t)return t[e];let r=k(e),i=r?this._t(r,t,n):void 0;return t[e]=i&&i.ignored?i:this._rules.test(e,n,C)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let R=e=>new L(e),z=e=>I(e&&I.convert(e),e,f),ie=()=>{I.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;I.isNotRelative=t=>e.test(t)||re(t)};typeof process<`u`&&process.platform===`win32`&&ie(),t.exports=R,R.default=R,t.exports.isPathValid=z,d(t.exports,Symbol.for(`setupWindows`),ie)}))(),globalThis.Buffer,new TextEncoder,new TextDecoder,c({command:l({description:`Bash command to execute`}),timeout:o(s({description:`Timeout in seconds (optional, no default timeout)`}))});const ct=c({oldText:l({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:l({description:`Replacement text for this targeted edit.`})},{});c({path:l({description:`Path to the file to edit (relative or absolute)`}),edits:a(ct,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),c({path:l({description:`Path to the file to read (relative or absolute)`}),offset:o(s({description:`Line number to start reading from (1-indexed)`})),limit:o(s({description:`Maximum number of lines to read`}))}),c({path:l({description:`Path to the file to write (relative or absolute)`}),content:l({description:`Content to write to the file`})});function lt(){try{return globalThis.localStorage??null}catch{return null}}function ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e,t){return Reflect.get(e,t)}function dt(e){let t=null;try{t=e?.getItem(`slicc_model_catalog`)??null}catch{return{raw:null,store:{}}}if(!t)return{raw:t,store:{}};try{let e=JSON.parse(t);return{raw:t,store:ut(e)?e:{}}}catch{return{raw:t,store:{}}}}function Z(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function ft(e){if(!ut(e))return null;let t=X(e,`input`),n=X(e,`output`),r=X(e,`cacheRead`),i=X(e,`cacheWrite`);return!Z(t)||!Z(n)||!Z(r)||!Z(i)?null:{input:t,output:n,cacheRead:r,cacheWrite:i}}function pt(e){return!Array.isArray(e)||e.length===0||!e.every(e=>e===`text`||e===`image`)?null:[...e]}function mt(e){if(e===void 0)return;if(!ut(e))return null;let t=Object.entries(e);return t.every(([,e])=>e===null||typeof e==`string`)?Object.fromEntries(t):null}function ht(e){return{apis:new Set(e.map(e=>e.api)),baseUrls:new Set(e.map(e=>e.baseUrl))}}function gt(e,t,n){if(!ut(t))return null;let r=X(t,`id`),i=X(t,`name`),a=X(t,`api`),o=X(t,`baseUrl`),s=X(t,`reasoning`),c=X(t,`contextWindow`),l=X(t,`maxTokens`);if(typeof r!=`string`||r.length===0||r.length>200||typeof i!=`string`||i.length===0||typeof a!=`string`||!n.apis.has(a)||typeof o!=`string`||!n.baseUrls.has(o)||typeof s!=`boolean`||!Z(c)||c===0||!Z(l)||l===0)return null;let u=ft(X(t,`cost`)),d=pt(X(t,`input`)),f=mt(X(t,`thinkingLevelMap`));if(!u||!d||f===null)return null;let p=X(t,`compat`),m={id:r,name:i,api:a,provider:e,baseUrl:o,reasoning:s,input:d,cost:u,contextWindow:c,maxTokens:l};return f&&(m.thinkingLevelMap=f),ut(p)&&(m.compat={...p}),m}function _t(){return 1790795820024}let vt,yt=new Map;function bt(e){try{return f(e)}catch{return[]}}function xt(e){if(!e||!Array.isArray(e.models)||e.models.length===0)return!1;let t=_t();return t===null||typeof e.lastModified==`number`&&e.lastModified>t}const St=new Set([`id`,`name`,`api`,`provider`,`baseUrl`,`reasoning`,`input`,`cost`,`contextWindow`,`maxTokens`,`thinkingLevelMap`,`compat`]);function Ct(e,t,n){if(t)return{...Object.fromEntries(Object.entries(t).filter(([e])=>!St.has(e))),...e};let r=n.find(t=>t.headers&&t.api===e.api&&t.baseUrl===e.baseUrl);return r?.headers?{...e,headers:{...r.headers}}:e}function wt(e,t){let n=bt(e);if(n.length===0)return n;let r=ht(n),i=[...n],a=new Map(i.map((e,t)=>[e.id,t])),o=new Map(n.map(e=>[e.id,e]));for(let s of t.models){let t=gt(e,s,r);if(!t)continue;let c=a.get(t.id),l=Ct(t,o.get(t.id),n);c===void 0?(a.set(l.id,i.length),i.push(l)):i[c]=l}return i}function Tt(e,t){if(!n(`live-model-catalog`))return bt(e);let{raw:r,store:i}=dt(t),a=i[e];if(!xt(a))return bt(e);r!==vt&&(vt=r,yt=new Map);let o=yt.get(e);return o||(o=wt(e,a),yt.set(e,o)),o}function Et(e){return[...Tt(e,lt())]}function Dt(e,t){return Tt(e,lt()).find(e=>e.id===t)||d(e,t)}const Ot=u,Q=t(`secret-scrub`),$=`[tool output withheld: secret scrub unavailable]`,kt=async e=>e;function At(){let e=p();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(Q.debug(`SW scrub-tool-result returned error`),$):typeof t.text==`string`?t.text:$}catch{return Q.debug(`SW scrub-tool-result failed`),$}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await m(`secrets.scrub-tool-result`,{text:e});return t?.error?(Q.debug(`Bridge scrub-tool-result returned error`),$):typeof t?.text==`string`?t.text:$}catch{return Q.debug(`Bridge scrub-tool-result failed`),$}}:e===`connect`?kt:async e=>{if(!e)return e;try{let t=await fetch(r(`/api/secrets/scrub`),{method:`POST`,headers:i({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return Q.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return Q.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const jt=t(`tool-adapter`);function Mt(e){let t=[],n=0;for(let r of h(e)){if(r.kind===`inert`||!r.parsed)continue;let i=e.slice(n,r.index);i.trim()&&t.push({type:`text`,text:i.trimEnd()}),t.push({type:`image`,mimeType:r.parsed.mimeType,data:r.parsed.data}),n=r.index+r.marker.length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function Nt(e){let t=Mt(e),n=[];for(let e of t)e.type===`image`?n.push(await v(e)):n.push(e);return n}function Pt(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...Vt(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid===i.pid&&t===`SIGKILL`&&r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function Ft(e,t){e&&e.manager.exit(e.record.pid,t)}async function It(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return jt.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function Lt(e,t){try{return await Nt(e)}catch(n){return jt.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),Mt(e)}}async function Rt(e,t,n,r){let i=n?.currentGate();if(!i)return!0;if(r?.aborted)return!1;try{return await i.approve(e.name,t)&&r?.aborted!==!0}catch(t){return jt.warn(`Tool-call gate threw — refusing the call`,{tool:e.name,error:t instanceof Error?t.message:String(t)}),!1}}function zt(e,t,n,r){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,prepareArguments:e.prepareArguments,async execute(i,a,o,s){let c;if(s&&(c=_({onUpdate:s,toolName:e.name,toolCallId:i})),!await Rt(e,a,r,o))return c&&g(c),{content:[{type:`text`,text:`${e.name}: not approved (guest-caused turn).`}],details:{isError:!0}};let l=Pt(e,a,o,t);try{let t=await e.execute(a??{},l.effectiveSignal),r=await Lt(await It(t.content,e.name,n),e.name);return Ft(l.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw Ft(l.tracked,l.tracked?.record.abort.signal.aborted?null:1),e}finally{c&&g(c),l.tracked?.unsubscribeKill()}}}}function Bt(e,t,n,r){return e.map(e=>zt(e,t,n,r))}function Vt(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}export{Et as a,Dt as i,Vt as n,Ot as o,At as r,Bt as t};
@@ -1 +0,0 @@
1
- var e=class{incoming=[];outgoing=[];get length(){return this.incoming.length+this.outgoing.length}enqueue(e){this.incoming.push(e)}dequeue(){if(this.outgoing.length===0)for(;this.incoming.length>0;)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}},t=class{queue=new e;waiting=new e;done=!1;finalResultPromise;resolveFinalResult;isComplete;extractResult;constructor(e,t){this.isComplete=e,this.extractResult=t,this.finalResultPromise=new Promise(e=>{this.resolveFinalResult=e})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let t=this.waiting.dequeue();t?t({value:e,done:!1}):this.queue.enqueue(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.dequeue()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.dequeue();else if(this.done)return;else{let e=await new Promise(e=>this.waiting.enqueue(e));if(e.done)return;yield e.value}}result(){return this.finalResultPromise}},n=class extends t{constructor(){super(e=>e.type===`done`||e.type===`error`,e=>{if(e.type===`done`)return e.message;if(e.type===`error`)return e.error;throw Error(`Unexpected event type for final result`)})}};function r(){return new n}function i(e){return e instanceof Error?e.message||e.name:typeof e==`string`?e:String(e)}function a(e){if(!(e instanceof Error))return{name:`ThrownValue`,message:i(e)};let t=e.code;return{name:e.name||void 0,message:e.message||e.name,stack:e.stack,code:typeof t==`string`||typeof t==`number`?t:void 0}}function o(e,t,n){return{type:e,timestamp:Date.now(),error:a(t),details:n}}function s(e,t){e.diagnostics=[...e.diagnostics??[],t]}export{r as a,n as i,o as n,i as r,s as t};
@@ -1,9 +0,0 @@
1
- function e(e){let t=``;for(let n of e){let e=t===``?/^[A-Za-z_$]$/.test(n):/^[A-Za-z0-9_$]$/.test(n);t+=e?n:`_`}return t===``?`_`:t}var t=class{worker;listeners=new Map;exited=!1;constructor(e,t){this.worker=new globalThis.Worker(e,{type:`module`}),this.worker.onmessage=e=>{this.emit(`message`,e.data)},this.worker.onerror=e=>{let t=Error(e.message??`Worker error`);this.emit(`error`,t)},t?.workerData!==void 0&&this.worker.postMessage(t.workerData)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),this}postMessage(e){this.worker.postMessage(e)}async terminate(){return this.exited||(this.exited=!0,this.worker.terminate(),this.emit(`exit`,0)),0}emit(e,...t){let n=this.listeners.get(e);if(n)for(let e of n)try{e(...t)}catch{}}};let n;function r(){return n||(n=WebAssembly.compileStreaming(fetch(`https://cdn.jsdelivr.net/npm/quickjs-wasi@3.6.2/quickjs.wasm`)).catch(e=>{throw n=void 0,e}),n)}function i(e){if(typeof e!=`object`||!e)return!1;let t=e.type;return t===`call`||t===`output`||t===`done`||t===`crash`}const a=/^[A-Za-z_$][A-Za-z0-9_$]*$/,o=new Set([`tools`,`ALL_TOOLS`,`console`,`text`,`image`,`exit`,`globalThis`,`store`,`load`]);function s(e){return e instanceof Error?e.message:String(e)}function c(e){let t={};for(let[n,r]of Object.entries(e??{})){let e=JSON.stringify(r);e!==void 0&&(t[n]=e)}return t}function l(e){let t={set:{},delete:[]};for(let[n,r]of JSON.parse(e))r===void 0?t.delete.push(n):t.set[n]=JSON.parse(r);return t}function u(){return new URL(import.meta.url.endsWith(`.ts`)?`./worker.ts`:`./worker.js`,import.meta.url)}var d=class{promise;resolveResult;worker;interrupt=new SharedArrayBuffer(4);tools;globals;signal;timer;output=[];calls=[];pending=new Map;finished=!1;constructor(e){this.promise=new Promise(e=>{this.resolveResult=e}),this.tools=e.tools,this.globals=e.globals,this.signal=e.signal,Number.isFinite(e.timeoutMs)&&(this.timer=setTimeout(()=>{this.finish({kind:`timeout`,message:`Execution timed out after ${e.timeoutMs} ms`})},e.timeoutMs)),e.signal&&(e.signal.aborted?this.onAbort():e.signal.addEventListener(`abort`,this.onAbort,{once:!0})),e.wasm.then(t=>this.start(e,t),e=>{this.finish({kind:`sandbox`,message:`Failed to load QuickJS: ${s(e)}`})})}abort(e){return this.finish({kind:`aborted`,message:e}),this.promise}start(n,r){if(this.finished)return;let i={code:n.code,tools:[...n.tools.values()].map(t=>({name:t.name,jsName:e(t.name),description:t.description??``})),globals:[...n.globals.values()].map(e=>({name:e.name,spread:e.spread===!0})),wasm:r,memoryLimitBytes:n.memoryLimitBytes,store:n.store,interrupt:this.interrupt},a;try{a=new t(n.workerUrl,{workerData:i})}catch(e){this.finish({kind:`sandbox`,message:`Failed to start worker: ${s(e)}`});return}this.worker=a,a.on(`message`,e=>this.handleMessage(e)),a.on(`error`,e=>{this.finish({kind:`sandbox`,name:e instanceof Error?e.name:void 0,message:s(e)})}),a.on(`exit`,e=>{this.finish({kind:`sandbox`,message:`Worker exited with code ${e} before the script settled`})})}onAbort=()=>{let e=this.signal?.reason;this.finish({kind:`aborted`,message:e instanceof Error?e.message:`Execution aborted`})};post(e){this.worker?.postMessage(e)}handleMessage(e){if(!(this.finished||!i(e)))switch(e.type){case`output`:this.output.push(e.item);break;case`call`:this.handleCall(e);break;case`done`:this.handleDone(e);break;case`crash`:this.finish({kind:`sandbox`,message:e.message})}}handleDone(e){if(!e.ok){let t=JSON.parse(e.error);this.finish({kind:`script`,...t});return}this.finish(void 0,e.value===void 0?void 0:JSON.parse(e.value),e.writes)}async handleCall(e){let{id:t,name:n}=e,r=e.target===`tool`,i=r?{name:n,status:`cancelled`,durationMs:0}:void 0;i&&this.calls.push(i);let a={record:i,startedAt:performance.now(),controller:new AbortController};this.pending.set(t,a);let o,c;try{let i=(r?this.tools:this.globals).get(n);if(!i)throw Error(`Unknown ${r?`tool`:`global`} "${n}"`);let s=e.args===void 0?void 0:JSON.parse(e.args),l=await i.execute(s,{signal:a.controller.signal});c={type:`result`,id:t,ok:!0,payload:l===void 0?void 0:JSON.stringify(l)},o=`ok`}catch(e){c={type:`result`,id:t,ok:!1,payload:s(e)},o=`error`}this.pending.delete(t)&&(i&&(i.status=o,i.durationMs=performance.now()-a.startedAt),this.post(c))}finish(e,t,n){if(this.finished)return;this.finished=!0,clearTimeout(this.timer),this.signal?.removeEventListener(`abort`,this.onAbort);let r=performance.now();for(let e of this.pending.values())e.record&&(e.record.durationMs=r-e.startedAt),e.controller.abort();this.pending.clear();let i=e?{ok:!1,error:e,output:this.output,calls:this.calls}:{ok:!0,value:t,output:this.output,calls:this.calls,storeWrites:n===void 0?{set:{},delete:[]}:l(n)};if(!this.worker){this.resolveResult(i);return}Atomics.store(new Int32Array(this.interrupt),0,1),this.worker.terminate().catch(()=>void 0).then(()=>this.resolveResult(i))}},f=class{toolsByName=new Map;globalsByName=new Map;timeoutMs;memoryLimitBytes;wasm;workerUrl;running=new Set;closed=!1;constructor(e={}){this.timeoutMs=e.timeoutMs??3e5,this.memoryLimitBytes=e.memoryLimitBytes,this.wasm=e.wasm,this.workerUrl=e.workerUrl??u();for(let t of e.tools??[])this.registerTool(t);let t=new Set;for(let n of e.globals??[]){let e=n.name.split(`.`);if(e.length>2||!e.every(e=>a.test(e))||o.has(e[0]))throw Error(`Invalid global name "${n.name}"`);if(this.globalsByName.has(n.name))throw Error(`Global "${n.name}" is already registered`);e.length===2&&t.add(e[0]),this.globalsByName.set(n.name,n)}for(let e of t)if(this.globalsByName.has(e))throw Error(`Global "${e}" conflicts with the namespace "${e}"`)}registerTool(e){if(this.toolsByName.has(e.name))throw Error(`Tool "${e.name}" is already registered`);this.toolsByName.set(e.name,e)}unregisterTool(e){return this.toolsByName.delete(e)}get tools(){return[...this.toolsByName.values()]}get globals(){return[...this.globalsByName.values()]}execute(e,t={}){if(this.closed)return Promise.reject(Error(`Sandbox is closed`));let n=new d({code:e,tools:new Map(this.toolsByName),globals:this.globalsByName,timeoutMs:t.timeoutMs??this.timeoutMs,signal:t.signal,memoryLimitBytes:this.memoryLimitBytes,store:c(t.store),wasm:this.wasm===void 0?r():Promise.resolve(this.wasm),workerUrl:this.workerUrl});return this.running.add(n),n.promise.finally(()=>this.running.delete(n))}async close(){this.closed=!0,await Promise.all([...this.running].map(e=>e.abort(`Sandbox closed`)))}};const p=`image expects a non-empty image URL string, an object with image_url, or a raw MCP image block`;`${JSON.stringify(p)}${JSON.stringify(p)}${JSON.stringify(p)}${JSON.stringify(p)}`,String.raw`
2
- start: options_source | plain_source
3
- options_source: OPTIONS_LINE NEWLINE SOURCE
4
- plain_source: SOURCE
5
-
6
- OPTIONS_LINE: /[ \t]*\/\/ @options:[^\r\n]*/
7
- NEWLINE: /\r?\n/
8
- SOURCE: /[\s\S]+/
9
- `;export{f as CodemodeSandbox,r as loadQuickJSWasm};
@@ -1,4 +0,0 @@
1
- const e={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603};var t=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`McpError`,this.code=e,this.data=n}},n=class extends Error{constructor(e=`MCP connection closed`){super(e),this.name=`McpConnectionClosedError`}},r=class extends Error{timeoutMs;constructor(e){super(`MCP request timed out after ${e}ms`),this.name=`McpTimeoutError`,this.timeoutMs=e}},i=class extends Error{constructor(e=`MCP request aborted`){super(e),this.name=`AbortError`}};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o(e){return e instanceof Error?e:Error(String(e))}function s(e){return typeof e==`string`||typeof e==`number`&&Number.isFinite(e)}function c(e){return a(e)&&e.jsonrpc===`2.0`&&s(e.id)&&typeof e.method==`string`}function l(e){return a(e)&&e.jsonrpc===`2.0`&&!(`id`in e)&&typeof e.method==`string`}function u(e){return!a(e)||e.jsonrpc!==`2.0`||!s(e.id)?!1:`result`in e?!(`error`in e):!(`error`in e)||!a(e.error)?!1:typeof e.error.code==`number`&&typeof e.error.message==`string`}function d(n){if(c(n)||l(n)||u(n))return n;throw new t(e.invalidRequest,`Invalid JSON-RPC message`)}const f=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`],p=1e3;function m(n){if(!a(n)||typeof n.protocolVersion!=`string`||!a(n.capabilities)||!a(n.serverInfo)||typeof n.serverInfo.name!=`string`||typeof n.serverInfo.version!=`string`||n.instructions!==void 0&&typeof n.instructions!=`string`)throw new t(e.invalidRequest,`Invalid MCP initialize result`);return n}function h(n){return new t(e.invalidRequest,n)}function g(e,t,n,r){let i=a(n)?n[t]:void 0;if(!a(n)||!Array.isArray(i))throw h(`Invalid MCP ${e} result`);for(let t of i)if(!a(t)||!r(t))throw h(`Invalid entry in MCP ${e} result`);if(n.nextCursor!==void 0&&typeof n.nextCursor!=`string`)throw h(`Invalid MCP ${e} cursor`);return{items:i,...n.nextCursor===void 0?{}:{nextCursor:n.nextCursor}}}const _=e=>typeof e.name==`string`&&a(e.inputSchema),v=e=>typeof e.uri==`string`&&(e.name===void 0||typeof e.name==`string`),y=e=>typeof e.uriTemplate==`string`&&(e.name===void 0||typeof e.name==`string`);function b(e){return{...e,name:e.name??e.uri}}function x(e){return{...e,name:e.name??e.uriTemplate}}function S(e){return e.nextCursor===void 0?{}:{nextCursor:e.nextCursor}}function C(e){if(!a(e)||!Array.isArray(e.contents))throw h(`Invalid MCP resources/read result`);for(let t of e.contents)if(!a(t)||typeof t.uri!=`string`||typeof t.text!=`string`&&typeof t.blob!=`string`)throw h(`Invalid contents in MCP resources/read result`);return e}function w(n){if(!a(n)||n.content!==void 0&&!Array.isArray(n.content))throw new t(e.invalidRequest,`Invalid MCP tools/call result`);if(n.structuredContent!==void 0&&!a(n.structuredContent))throw new t(e.invalidRequest,`Invalid MCP tools/call structured content`);return n.content===void 0?{...n,content:[]}:n}var T=class{options;state=`idle`;transport;nextRequestId=1;serverInfoValue;serverCapabilitiesValue;instructionsValue;protocolVersionValue;pending=new Map;progressRequests=new Map;incoming=new Map;requestHandlers=new Map;notificationListeners=new Map;errorListeners=new Set;closeListeners=new Set;disposers=[];constructor(e){this.options=Object.freeze({...e}),this.requestHandlers.set(`ping`,()=>({}));let t=e.roots;t&&this.requestHandlers.set(`roots/list`,async()=>({roots:[...typeof t==`function`?await t():t]}))}get connectionState(){return this.state}get serverInfo(){return this.serverInfoValue}get serverCapabilities(){return this.serverCapabilitiesValue}get instructions(){return this.instructionsValue}get protocolVersion(){return this.protocolVersionValue}async connect(e){if(this.state!==`idle`)throw Error(`Cannot connect MCP client in ${this.state} state`);this.state=`connecting`,this.transport=e,this.disposers=[e.onMessage(e=>this.handleMessage(e)),e.onError(e=>this.emitError(e)),e.onClose(()=>this.handleTransportClose())];try{await e.start();let t={...this.options.capabilities};this.options.roots&&t.roots===void 0&&(t.roots={});let n=m(await this.requestInternal(`initialize`,{protocolVersion:this.options.protocolVersion??`2025-11-25`,capabilities:t,clientInfo:{name:this.options.name,version:this.options.version,...this.options.title===void 0?{}:{title:this.options.title}}},{},!0));if(!f.includes(n.protocolVersion))throw Error(`MCP server selected unsupported protocol version ${n.protocolVersion}`);return this.protocolVersionValue=n.protocolVersion,this.serverInfoValue=n.serverInfo,this.serverCapabilitiesValue=n.capabilities,this.instructionsValue=n.instructions,e.setProtocolVersion?.(n.protocolVersion),await this.notifyInternal(`notifications/initialized`,void 0,!0),this.state=`connected`,n}catch(e){throw await this.close().catch(()=>{}),e}}request(e,t,n={}){return this.requestInternal(e,t,n,!1)}notify(e,t){return this.notifyInternal(e,t,!1)}setRequestHandler(e,t){return this.requestHandlers.set(e,t),()=>{this.requestHandlers.get(e)===t&&this.requestHandlers.delete(e)}}onNotification(e,t){let n=this.notificationListeners.get(e)??new Set;return this.notificationListeners.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&this.notificationListeners.delete(e)}}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}async ping(e={}){await this.request(`ping`,void 0,e)}async listTools(e={}){return await this.listAll(`tools/list`,`tools`,_,e)}async listResources(e={}){return(await this.listAll(`resources/list`,`resources`,v,e)).map(b)}async listResourcesPage(e,t={}){let n=await this.listPage(`resources/list`,`resources`,v,e,t);return{resources:n.items.map(b),...S(n)}}async listResourceTemplates(e={}){return(await this.listAll(`resources/templates/list`,`resourceTemplates`,y,e)).map(x)}async listResourceTemplatesPage(e,t={}){let n=await this.listPage(`resources/templates/list`,`resourceTemplates`,y,e,t);return{resourceTemplates:n.items.map(x),...S(n)}}async readResource(e,t={}){return C(await this.request(`resources/read`,{uri:e},t))}async listPage(e,t,n,r,i){return g(e,t,await this.request(e,r===void 0?void 0:{cursor:r},i),n)}async listAll(e,t,n,r){let i=[],a=new Set,o;for(let s=0;s<p;s++){let s=await this.listPage(e,t,n,o,r);if(i.push(...s.items),s.nextCursor===void 0)return i;if(a.has(s.nextCursor))throw Error(`MCP ${e} returned duplicate cursor: ${s.nextCursor}`);a.add(s.nextCursor),o=s.nextCursor}throw Error(`MCP ${e} exceeded ${p} pages`)}async callTool(e,t,n={}){return w(await this.request(`tools/call`,{name:e,...t===void 0?{}:{arguments:t}},n))}async close(){let e=this.transport;this.transport=void 0,this.disposeTransportListeners(),this.markClosed(new n),await e?.close()}async requestInternal(e,t,n,r){let o=this.requireTransport(r);if(n.signal?.aborted)throw new i;let s=this.nextRequestId++,c=n.onProgress?s:void 0,l=c===void 0?t:{...t,_meta:{...a(t?._meta)?t._meta:{},progressToken:c}},u={jsonrpc:`2.0`,id:s,method:e,...l===void 0?{}:{params:l}};return new Promise((t,r)=>{let a={resolve:t,reject:r,timeoutMs:n.timeoutMs??this.options.requestTimeoutMs??3e4,timer:void 0,signal:n.signal,onAbort:()=>this.cancelPending(s,new i,e!==`initialize`,String(n.signal?.reason??`Aborted`)),cancellable:e!==`initialize`,onProgress:n.onProgress,progressToken:c};this.pending.set(s,a),c!==void 0&&this.progressRequests.set(c,s),n.signal?.addEventListener(`abort`,a.onAbort,{once:!0}),this.armTimeout(s,a),o.send(u).catch(e=>this.cancelPending(s,e,!1))})}async notifyInternal(e,t,n){await this.requireTransport(n).send({jsonrpc:`2.0`,method:e,...t===void 0?{}:{params:t}})}requireTransport(e){if(this.transport&&(this.state===`connected`||e&&this.state===`connecting`))return this.transport;throw new n(`MCP client is ${this.state}`)}handleMessage(n){if(u(n)){this.handleResponse(n);return}if(c(n)){this.handleRequest(n);return}if(l(n)){this.handleNotification(n.method,n.params);return}this.emitError(new t(e.invalidRequest,`Received invalid JSON-RPC message`))}handleResponse(e){let n=this.pending.get(e.id);if(!n){this.emitError(Error(`Received response for unknown MCP request ${String(e.id)}`));return}this.removePending(e.id,n),`error`in e?n.reject(new t(e.error.code,e.error.message,e.error.data)):n.resolve(e.result)}async handleRequest(n){let r=this.transport;if(!r)return;let i=this.requestHandlers.get(n.method);if(!i){await r.send({jsonrpc:`2.0`,id:n.id,error:{code:e.methodNotFound,message:`Method not found: ${n.method}`}}).catch(e=>this.emitError(e));return}let a=new AbortController;this.incoming.set(n.id,a);try{let e=await i(n.params,{signal:a.signal});await r.send({jsonrpc:`2.0`,id:n.id,result:e??{}})}catch(i){let a=i instanceof t?{code:i.code,message:i.message,data:i.data}:{code:e.internalError,message:o(i).message};await r.send({jsonrpc:`2.0`,id:n.id,error:a}).catch(e=>this.emitError(e))}finally{this.incoming.delete(n.id)}}handleNotification(e,t){e===`notifications/progress`?this.handleProgress(t):e===`notifications/cancelled`&&this.handleCancelled(t);for(let n of this.notificationListeners.get(e)??[])try{n(t)}catch(e){this.emitError(e)}}handleProgress(e){if(!a(e)||!s(e.progressToken)||typeof e.progress!=`number`)return;let t=this.progressRequests.get(e.progressToken),n=t===void 0?void 0:this.pending.get(t);if(!(t===void 0||!n)){this.armTimeout(t,n);try{n.onProgress?.(e)}catch(e){this.emitError(e)}}}handleCancelled(e){a(e)&&s(e.requestId)&&this.incoming.get(e.requestId)?.abort(e.reason)}armTimeout(e,t){t.timer&&clearTimeout(t.timer),!(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)&&(t.timer=setTimeout(()=>{this.cancelPending(e,new r(t.timeoutMs),t.cancellable,`Request timed out`)},t.timeoutMs))}cancelPending(e,t,n,r){let i=this.pending.get(e);i&&(this.removePending(e,i),i.reject(t),n&&this.transport&&this.transport.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:e,...r?{reason:r}:{}}}).catch(e=>this.emitError(e)))}removePending(e,t){this.pending.delete(e),t.timer&&clearTimeout(t.timer),t.progressToken!==void 0&&this.progressRequests.delete(t.progressToken),t.signal?.removeEventListener(`abort`,t.onAbort)}rejectPending(e){for(let[t,n]of this.pending)this.removePending(t,n),n.reject(e)}handleTransportClose(){this.markClosed(new n)}markClosed(e){let t=this.state===`closed`;this.state=`closed`,this.rejectPending(e);for(let t of this.incoming.values())t.abort(e);if(this.incoming.clear(),!t)for(let e of[...this.closeListeners])try{e()}catch(e){this.emitError(e)}}emitError(e){let t=o(e);for(let e of this.errorListeners)e(t)}disposeTransportListeners(){for(let e of this.disposers.splice(0))e()}},E=class{messageListeners=new Set;errorListeners=new Set;closeListeners=new Set;closeEmitted=!1;onMessage(e){return this.messageListeners.add(e),()=>this.messageListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}emitMessage(e){for(let t of this.messageListeners)t(e)}emitError(e){let t=o(e);for(let e of this.errorListeners)e(t)}emitClose(){if(!this.closeEmitted){this.closeEmitted=!0;for(let e of this.closeListeners)e()}}};async function D(e,t){let n=e.getReader(),r=new TextDecoder,i=``,a,o,s=[],c=0,l=t.maxEventBytes??16777216,u=()=>{if(s.length===0){a=void 0,o=void 0;return}let e=s.join(`
2
- `);t.onEvent({...a?{event:a}:{},data:e,...o?{id:o}:{}}),a=void 0,o=void 0,s=[],c=0},d=e=>{let n=e.endsWith(`\r`)?e.slice(0,-1):e;if(n===``){u();return}if(n.startsWith(`:`))return;let r=n.indexOf(`:`),i=r<0?n:n.slice(0,r),d=r<0?``:n.slice(r+1);if(d.startsWith(` `)&&(d=d.slice(1)),i===`data`){if(c+=Buffer.byteLength(d)+ +(s.length>0),c>l)throw Error(`MCP SSE event exceeds ${l} bytes`);s.push(d)}else i===`event`?a=d:i===`id`&&!d.includes(`\0`)?(o=d,t.onId?.(d)):i===`retry`&&/^\d+$/.test(d)&&t.onRetry?.(Number(d))};try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,{stream:!0});let a=i.indexOf(`
3
- `);for(;a>=0;)d(i.slice(0,a)),i=i.slice(a+1),a=i.indexOf(`
4
- `);if(Buffer.byteLength(i)>l)throw Error(`MCP SSE event exceeds ${l} bytes`)}i+=r.decode(),i&&d(i),u()}finally{n.releaseLock()}}var O=class extends Error{status;body;constructor(e,t,n=``){super(t),this.name=`McpHttpError`,this.status=e,this.body=n}},k=class extends O{wwwAuthenticate;constructor(e,t=``){super(401,`MCP server requires authentication`,t),this.name=`McpAuthRequiredError`,this.wwwAuthenticate=e.headers.get(`www-authenticate`)}},A=class extends O{constructor(e=``){super(404,`MCP session expired`,e),this.name=`McpSessionExpiredError`}};function j(e){return e.headers.get(`content-type`)?.split(`;`,1)[0]?.trim().toLowerCase()}function M(e){return e.status===401||e.status===403&&/(?:^|[\s,])error="?insufficient_scope"?/i.test(e.headers.get(`www-authenticate`)??``)}function N(e){return e===408||e===429||e>=500}function P(e){return e.body?.cancel().catch(()=>{})??Promise.resolve()}function F(e,t){let n=t.trim(),r=n.length>500?`${n.slice(0,497)}...`:n;return`MCP HTTP request failed with status ${e}${r?`: ${r}`:``}`}var I=class extends E{url;options;fetch;controller=new AbortController;started=!1;closed=!1;sessionIdValue;protocolVersion;getStreamStarted=!1;constructor(e){super(),this.options=Object.freeze({...e,headers:e.headers?{...e.headers}:void 0}),this.url=new URL(e.url);let t=e.fetch??globalThis.fetch;this.fetch=(e,n)=>t(e,n)}get sessionId(){return this.sessionIdValue}async start(){if(this.started)throw Error(`MCP Streamable HTTP transport already started`);if(this.closed)throw new n;this.started=!0}setProtocolVersion(e){this.protocolVersion=e}async send(e){if(!this.started||this.closed)throw new n;let t=await this.authorizedFetch(`POST`,{headers:{accept:`application/json, text/event-stream`,"content-type":`application/json`},body:JSON.stringify(e)});if(await this.checkResponse(t),this.captureSession(t),!c(e)){await P(t),`method`in e&&e.method===`notifications/initialized`&&this.startGetStream();return}if(t.status===202||t.status===204)throw new O(t.status,`MCP server accepted request ${e.method} without a response`);let r=j(t);if(r===`application/json`){let e=await t.json();for(let t of Array.isArray(e)?e:[e])this.emitMessage(d(t));return}if(r===`text/event-stream`&&t.body){this.consumeResponseStream(t.body,e.id);return}throw await P(t),new O(t.status,`Unsupported MCP response content type: ${r??`missing`}`)}async close(){if(!this.closed){if(this.closed=!0,this.controller.abort(),this.started&&this.sessionIdValue){let e=new AbortController,t=setTimeout(()=>e.abort(),1e3);try{let{headers:t}=await this.headers();await this.fetch(this.url,{method:`DELETE`,headers:t,signal:e.signal}).then(P).catch(()=>void 0)}catch{}finally{clearTimeout(t)}}this.emitClose()}}async authorizedFetch(e,t){let n=this.options.authProvider?.onUnauthorized?.bind(this.options.authProvider);for(let r=0;;r++){let{headers:i,token:a}=await this.headers(t.headers),o=await this.fetch(this.url,{method:e,headers:i,body:t.body,signal:this.controller.signal});if(r>0||!n||!M(o))return o;try{await n({response:o,serverUrl:this.url,fetch:this.fetch,token:a})}finally{await P(o)}}}async headers(e={}){let t=new Headers(this.options.headers);for(let[n,r]of Object.entries(e))t.set(n,r);this.sessionIdValue&&t.set(`Mcp-Session-Id`,this.sessionIdValue),this.protocolVersion&&t.set(`MCP-Protocol-Version`,this.protocolVersion);let n=await this.options.authProvider?.token();return n&&t.set(`Authorization`,`Bearer ${n}`),{headers:t,...n?{token:n}:{}}}captureSession(e){let t=e.headers.get(`mcp-session-id`);t&&(this.sessionIdValue=t)}async checkResponse(e){if(e.ok)return;let t=(await e.text().catch(()=>``)).slice(0,8192);throw e.status===401?new k(e,t):e.status===404&&this.sessionIdValue?new A(t):new O(e.status,F(e.status,t),t)}async consumeSse(e,t,n){await D(e,{maxEventBytes:this.options.maxMessageBytes??16777216,onId:e=>{t.lastEventId=e},onRetry:e=>{t.retryMs=e},onEvent:e=>{if(t.received=!0,!e.data.trim()||e.event!==void 0&&e.event!==`message`)return;let r;try{r=d(JSON.parse(e.data))}catch(e){this.emitError(e);return}n?.(r),this.emitMessage(r)}})}async consumeResponseStream(t,n){let r={lastEventId:void 0,retryMs:void 0,received:!1},i=!1,a=e=>{u(e)&&e.id===n&&(i=!0)},s=t,c;for(let e=0;;){if(s)try{await this.consumeSse(s,r,a),c=void 0}catch(e){c=e}if(i||this.closed)return;if(c!==void 0&&!this.isRetryable(c)||r.lastEventId===void 0||e>=this.maxRetries())break;if(r.received&&(e=0),r.received=!1,!await this.sleep(this.reconnectDelay(e++,r.retryMs)))return;try{s=await this.openSseStream(r.lastEventId)}catch(e){if(c=e,!this.isRetryable(e))break;s=void 0}}if(this.closed)return;let l=c===void 0?`stream ended without a response`:o(c).message;this.emitMessage({jsonrpc:`2.0`,id:n,error:{code:e.internalError,message:`MCP response stream failed: ${l}`}})}startGetStream(){this.options.openGetStream===!1||this.getStreamStarted||this.closed||(this.getStreamStarted=!0,this.runGetStream())}async runGetStream(){let e={lastEventId:void 0,retryMs:void 0,received:!1};for(let t=0;!this.closed;){try{let n=await this.openSseStream(e.lastEventId);if(!n)return;let r=Date.now();await this.consumeSse(n,e),(e.received||Date.now()-r>this.maxDelay())&&(t=0)}catch(e){if(this.closed)return;if(!this.isRetryable(e)){this.emitError(e);return}}if(e.received=!1,t>=this.maxRetries()){this.emitError(Error(`MCP server-to-client stream dropped and could not be reopened`));return}if(!await this.sleep(this.reconnectDelay(t++,e.retryMs)))return}}async openSseStream(e){let t=await this.authorizedFetch(`GET`,{headers:{accept:`text/event-stream`,...e===void 0?{}:{"last-event-id":e}}});if(t.status===405){await P(t);return}await this.checkResponse(t),this.captureSession(t);let n=j(t);if(n!==`text/event-stream`||!t.body)throw await P(t),new O(t.status,`Unsupported MCP GET response content type: ${n??`missing`}`);return t.body}isRetryable(e){if(e instanceof O)return N(e.status);if(e instanceof TypeError)return!0;let t=e?.code;return typeof t==`string`&&(t.startsWith(`E`)||t.startsWith(`UND_ERR`))}reconnectDelay(e,t){if(t!==void 0)return t;let n=this.options.reconnect?.initialDelayMs??1e3;return Math.min(n*2**e,this.maxDelay())}maxDelay(){return this.options.reconnect?.maxDelayMs??3e4}maxRetries(){return this.options.reconnect?.maxRetries??5}sleep(e){let t=this.controller.signal;return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=()=>{clearTimeout(i),n(!1)},i=setTimeout(()=>{t.removeEventListener(`abort`,r),n(!0)},e);i.unref?.(),t.addEventListener(`abort`,r,{once:!0})})}};export{T as McpClient,I as StreamableHttpTransport};
@@ -1,16 +0,0 @@
1
- import{$ as e,U as t,y as n}from"./build-Dnkjpm_v.js";import{n as r,r as i,t as a}from"./libesm-CTQYxJIv.js";function o(e){let t=e.indexOf(`\r
2
- `),n=e.indexOf(`
3
- `);return n===-1||t===-1?`
4
- `:t<n?`\r
5
- `:`
6
- `}function s(e){return e.replace(/\r\n/g,`
7
- `).replace(/\r/g,`
8
- `)}function c(e,t){return t===`\r
9
- `?e.replace(/\n/g,`\r
10
- `):e}function l(e){return e.normalize(`NFKC`).split(`
11
- `).map(e=>e.trimEnd()).join(`
12
- `).replace(/[\u2018\u2019\u201A\u201B]/g,`'`).replace(/[\u201C\u201D\u201E\u201F]/g,`"`).replace(/[\u2010\u2011\u2012\u2013\u2014\u2015\u2212]/g,`-`).replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g,` `)}function u(e){return e.match(/[^\n]*\n|[^\n]+/g)??[]}function d(e){let t=0;return u(e).map(e=>{let n={start:t,end:t+e.length};return t=n.end,n})}function f(e,t){let n=t.matchIndex,r=t.matchIndex+t.matchLength,i=-1;for(let t=0;t<e.length;t++){let r=e[t];if(n>=r.start&&n<r.end){i=t;break}}if(i===-1)throw Error(`Replacement range is outside the base content.`);let a=i;for(;a<e.length&&e[a].end<r;)a++;if(a>=e.length)throw Error(`Replacement range is outside the base content.`);return{startLine:i,endLine:a+1}}function p(e,t,n=0){let r=e;for(let e=t.length-1;e>=0;e--){let i=t[e],a=i.matchIndex-n;r=r.substring(0,a)+i.newText+r.substring(a+i.matchLength)}return r}function m(e,t,n){let r=u(e),i=d(t);if(r.length!==i.length)throw Error(`Cannot preserve unchanged lines because the base content has a different line count.`);let a=[],o=[...n].sort((e,t)=>e.matchIndex-t.matchIndex);for(let e of o){let t=f(i,e),n=a[a.length-1];if(n&&t.startLine<n.endLine){n.endLine=Math.max(n.endLine,t.endLine),n.replacements.push(e);continue}a.push({...t,replacements:[e]})}let s=0,c=``;for(let e of a){c+=r.slice(s,e.startLine).join(``);let n=i[e.startLine].start,a=i[e.endLine-1].end;c+=p(t.slice(n,a),e.replacements,n),s=e.endLine}return c+=r.slice(s).join(``),c}function h(e,t){let n=e.indexOf(t);if(n!==-1)return{found:!0,index:n,matchLength:t.length,usedFuzzyMatch:!1,contentForReplacement:e};let r=l(e),i=l(t),a=r.indexOf(i);return a===-1?{found:!1,index:-1,matchLength:0,usedFuzzyMatch:!1,contentForReplacement:e}:{found:!0,index:a,matchLength:i.length,usedFuzzyMatch:!0,contentForReplacement:r}}function g(e){return e.startsWith(``)?{bom:``,text:e.slice(1)}:{bom:``,text:e}}function _(e,t){let n=l(e),r=l(t);return n.split(r).length-1}function v(e,t,n){return Error(n===1?`Could not find the exact text in ${e}. The old text must match exactly including all whitespace and newlines.`:`Could not find edits[${t}] in ${e}. The oldText must match exactly including all whitespace and newlines.`)}function y(e,t,n,r){return Error(n===1?`Found ${r} occurrences of the text in ${e}. The text must be unique. Please provide more context to make it unique.`:`Found ${r} occurrences of edits[${t}] in ${e}. Each oldText must be unique. Please provide more context to make it unique.`)}function b(e,t,n){return Error(n===1?`oldText must not be empty in ${e}.`:`edits[${t}].oldText must not be empty in ${e}.`)}function x(e,t){return Error(t===1?`No changes made to ${e}. The replacement produced identical content. This might indicate an issue with special characters or the text not existing as expected.`:`No changes made to ${e}. The replacements produced identical content.`)}function S(e,t,n){let r=t.map(e=>({oldText:s(e.oldText),newText:s(e.newText)}));for(let e=0;e<r.length;e++)if(r[e].oldText.length===0)throw b(n,e,r.length);let i=r.map(t=>h(e,t.oldText)).some(e=>e.usedFuzzyMatch),a=i?l(e):e,o=[];for(let e=0;e<r.length;e++){let t=r[e],i=h(a,t.oldText);if(!i.found)throw v(n,e,r.length);let s=_(a,t.oldText);if(s>1)throw y(n,e,r.length,s);o.push({editIndex:e,matchIndex:i.index,matchLength:i.matchLength,newText:t.newText})}o.sort((e,t)=>e.matchIndex-t.matchIndex);for(let e=1;e<o.length;e++){let t=o[e-1],r=o[e];if(t.matchIndex+t.matchLength>r.matchIndex)throw Error(`edits[${t.editIndex}] and edits[${r.editIndex}] overlap in ${n}. Merge them into one edit or target disjoint regions.`)}let c=e,u=i?m(e,a,o):p(a,o);if(c===u)throw x(n,r.length);return{baseContent:c,newContent:u}}function C(e,t,n,i=4){return r(e,e,t,n,void 0,void 0,{context:i,headerOptions:a})}function w(e,t,n=4){let r=i(e,t),a=[],o=e.split(`
13
- `),s=t.split(`
14
- `),c=Math.max(o.length,s.length),l=String(c).length,u=1,d=1,f=!1,p;for(let e=0;e<r.length;e++){let t=r[e],i=t.value.split(`
15
- `);if(i[i.length-1]===``&&i.pop(),t.added||t.removed){p===void 0&&(p=d);for(let e of i)if(t.added){let t=String(d).padStart(l,` `);a.push(`+${t} ${e}`),d++}else{let t=String(u).padStart(l,` `);a.push(`-${t} ${e}`),u++}f=!0}else{let t=e<r.length-1&&(r[e+1].added||r[e+1].removed),o=f,s=t;if(o&&s){if(i.length<=n*2)for(let e of i){let t=String(u).padStart(l,` `);a.push(` ${t} ${e}`),u++,d++}else{let e=i.slice(0,n),t=i.slice(i.length-n),r=i.length-e.length-t.length;for(let t of e){let e=String(u).padStart(l,` `);a.push(` ${e} ${t}`),u++,d++}a.push(` ${``.padStart(l,` `)} ...`),u+=r,d+=r;for(let e of t){let t=String(u).padStart(l,` `);a.push(` ${t} ${e}`),u++,d++}}}else if(o){let e=i.slice(0,n),t=i.length-e.length;for(let t of e){let e=String(u).padStart(l,` `);a.push(` ${e} ${t}`),u++,d++}t>0&&(a.push(` ${``.padStart(l,` `)} ...`),u+=t,d+=t)}else if(s){let e=Math.max(0,i.length-n);e>0&&(a.push(` ${``.padStart(l,` `)} ...`),u+=e,d+=e);for(let t of i.slice(e)){let e=String(u).padStart(l,` `);a.push(` ${e} ${t}`),u++,d++}}else u+=i.length,d+=i.length;f=!1}}return{diff:a.join(`
16
- `),firstChangedLine:p}}function T(e){if(!e.ok)throw e.error;return e.value}const E=new WeakMap;function D(e){let t=E.get(e);return t||(t={queues:new Map,registration:Promise.resolve()},E.set(e,t)),t}async function O(e,t,n){let r=T(await e.absolutePath(t,n)),i=await e.canonicalPath(r,n);if(i.ok)return i.value;if(i.error.code===`not_found`||i.error.code===`not_supported`)return r;throw i.error}async function k(e,t,n,r){let i=D(e),a=i.registration.then(async()=>{let n=await O(e,t,r),a=i.queues.get(n)??Promise.resolve(),o=()=>{},s=new Promise(e=>{o=e}),c=a.then(()=>s);return i.queues.set(n,c),{key:n,currentQueue:a,chainedQueue:c,releaseNext:o}});i.registration=a.then(()=>void 0,()=>void 0);let{key:o,currentQueue:s,chainedQueue:c,releaseNext:l}=await a;await s;try{return await n()}finally{l(),i.queues.get(o)===c&&i.queues.delete(o)}}const A=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;function j(e){let t=e.replace(A,` `);return t.startsWith(`@`)?t.slice(1):t}async function M(e,t,n){return T(await e.absolutePath(j(t),n))}const N=t({oldText:n({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:n({description:`Replacement text for this targeted edit.`})},{}),P=t({path:n({description:`Path to the file to edit (relative or absolute)`}),edits:e(N,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{});function F(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.oldText==`string`&&typeof t.newText==`string`}function I(e){if(!e||typeof e!=`object`)return e;let t=e;if(typeof t.edits==`string`)try{let e=JSON.parse(t.edits);Array.isArray(e)?t.edits=e:F(e)&&(t.edits=[e])}catch{}else F(t.edits)&&(t.edits=[t.edits]);let n=t;if(typeof n.oldText!=`string`||typeof n.newText!=`string`)return t;let r=Array.isArray(n.edits)?[...n.edits]:[];r.push({oldText:n.oldText,newText:n.newText});let{oldText:i,newText:a,...o}=n;return{...o,edits:r}}function L(e){if(!Array.isArray(e.edits)||e.edits.length===0)throw Error(`Edit tool input is invalid. edits must contain at least one replacement.`);return{path:e.path,edits:e.edits}}function R(e,t){return Error(`Could not edit file: ${e}. Error code: ${t.code}.`,{cause:t})}function z(){return{name:`edit`,label:`edit`,description:`Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.`,parameters:P,prepareArguments:I,async execute(e,t,n,{env:r},i,a){let{path:l,edits:u}=L(t),d=await M(r,l,a);return k(r,d,async()=>{if(a.abortSignal?.aborted)throw Error(`Operation aborted`);let e=await r.fileInfo(d,a);if(!e.ok)throw R(l,e.error);if(e.value.kind!==`file`&&e.value.kind!==`symlink`)throw Error(`Could not edit file: ${l}. Path is not a file.`);let t=await r.readTextFile(d,a);if(!t.ok)throw R(l,t.error);if(a.abortSignal?.aborted)throw Error(`Operation aborted`);let{bom:n,text:i}=g(t.value),f=o(i),{baseContent:p,newContent:m}=S(s(i),u,l);if(a.abortSignal?.aborted)throw Error(`Operation aborted`);let h=n+c(m,f),_=await r.writeFile(d,h,a);if(!_.ok)throw R(l,_.error);if(a.abortSignal?.aborted)throw Error(`Operation aborted`);let v=w(p,m);return{content:[{type:`text`,text:`Successfully replaced ${u.length} block(s) in ${l}.`}],details:{diff:v.diff,patch:C(l,p,m),firstChangedLine:v.firstChangedLine}}},a)}}}export{z as createEditTool};
@@ -1 +0,0 @@
1
- import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./provider-env-CTOcDKrQ.js";var n=function(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e},r=null,i=null,a=null,o=t=>e(()=>import(n(t)),[]);typeof process<`u`&&(process.versions?.node||process.versions?.bun)&&(o(`node:fs`).then(e=>{r=e.existsSync}),o(`node:os`).then(e=>{i=e.homedir}),o(`node:path`).then(e=>{a=e.join}));var s=`ANTHROPIC_AUTH_TOKEN`,c=`ANTHROPIC_OAUTH_TOKEN`,l=`ANTHROPIC_API_KEY`,u=`ANTHROPIC_FEDERATION_RULE_ID`,d=`ANTHROPIC_ORGANIZATION_ID`,f=`ANTHROPIC_SERVICE_ACCOUNT_ID`,p=`ANTHROPIC_IDENTITY_TOKEN_FILE`,m=`ANTHROPIC_WORKSPACE_ID`,h=null;function g(e){let n=e?.GOOGLE_APPLICATION_CREDENTIALS;if(n)return r?r(n):!1;if(h===null){if(!r||!i||!a)return typeof process<`u`&&(process.versions?.node||process.versions?.bun)||(h=!1),!1;let n=t(`GOOGLE_APPLICATION_CREDENTIALS`,e);h=r(n||a(i(),`.config`,`gcloud`,`application_default_credentials.json`))}return h}function _(e){if(e===`github-copilot`)return[`COPILOT_GITHUB_TOKEN`];if(e===`anthropic`)return[s,c,l];let t={"ant-ling":`ANT_LING_API_KEY`,"qwen-token-plan":`QWEN_TOKEN_PLAN_API_KEY`,"qwen-token-plan-cn":`QWEN_TOKEN_PLAN_CN_API_KEY`,"qwen-token-plan-individual":`QWEN_TOKEN_PLAN_API_KEY`,openai:`OPENAI_API_KEY`,"azure-openai-responses":`AZURE_OPENAI_API_KEY`,nvidia:`NVIDIA_API_KEY`,deepseek:`DEEPSEEK_API_KEY`,google:`GEMINI_API_KEY`,"google-vertex":`GOOGLE_CLOUD_API_KEY`,groq:`GROQ_API_KEY`,cerebras:`CEREBRAS_API_KEY`,xai:`XAI_API_KEY`,typesafe:`TYPESAFE_API_KEY`,radius:`RADIUS_API_KEY`,openrouter:`OPENROUTER_API_KEY`,"vercel-ai-gateway":`AI_GATEWAY_API_KEY`,zai:`ZAI_API_KEY`,"zai-coding-cn":`ZAI_CODING_CN_API_KEY`,mistral:`MISTRAL_API_KEY`,minimax:`MINIMAX_API_KEY`,"minimax-cn":`MINIMAX_CN_API_KEY`,moonshotai:`MOONSHOT_API_KEY`,"moonshotai-cn":`MOONSHOT_API_KEY`,huggingface:`HF_TOKEN`,fireworks:`FIREWORKS_API_KEY`,together:`TOGETHER_API_KEY`,baseten:`BASETEN_API_KEY`,opencode:`OPENCODE_API_KEY`,"opencode-go":`OPENCODE_API_KEY`,"kimi-coding":`KIMI_API_KEY`,meta:`META_API_KEY`,"cloudflare-workers-ai":`CLOUDFLARE_API_KEY`,"cloudflare-ai-gateway":`CLOUDFLARE_API_KEY`,xiaomi:`XIAOMI_API_KEY`,"xiaomi-token-plan-cn":`XIAOMI_TOKEN_PLAN_CN_API_KEY`,"xiaomi-token-plan-ams":`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,"xiaomi-token-plan-sgp":`XIAOMI_TOKEN_PLAN_SGP_API_KEY`}[e];return t?[t]:void 0}function v(e,n){let r=_(e);if(!r)return;let i=r.filter(e=>!!t(e,n));return i.length>0?i:void 0}function y(e,n){let r=v(e,n);if(r?.[0]){let i=e===`anthropic`?r.find(e=>e!==s):r[0];if(i)return t(i,n)}if(e===`google-vertex`){let e=g(n),r=!!(t(`GOOGLE_CLOUD_PROJECT`,n)||t(`GCLOUD_PROJECT`,n)),i=!!t(`GOOGLE_CLOUD_LOCATION`,n);if(e&&r&&i)return`<authenticated>`}if(e===`amazon-bedrock`&&(t(`AWS_PROFILE`,n)||t(`AWS_ACCESS_KEY_ID`,n)&&t(`AWS_SECRET_ACCESS_KEY`,n)||t(`AWS_BEARER_TOKEN_BEDROCK`,n)||t(`AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`,n)||t(`AWS_CONTAINER_CREDENTIALS_FULL_URI`,n)||t(`AWS_WEB_IDENTITY_TOKEN_FILE`,n)))return`<authenticated>`}export{c as a,m as c,p as i,y as l,s as n,d as o,u as r,f as s,l as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./provider-env-CILujRmO.js";var t=function(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e};let n=null,r=null,i=null;const a=e=>import(t(e));typeof process<`u`&&(process.versions?.node||process.versions?.bun)&&(a(`node:fs`).then(e=>{n=e.existsSync}),a(`node:os`).then(e=>{r=e.homedir}),a(`node:path`).then(e=>{i=e.join}));const o=`ANTHROPIC_AUTH_TOKEN`,s=`ANTHROPIC_OAUTH_TOKEN`,c=`ANTHROPIC_API_KEY`,l=`ANTHROPIC_FEDERATION_RULE_ID`,u=`ANTHROPIC_ORGANIZATION_ID`,d=`ANTHROPIC_SERVICE_ACCOUNT_ID`,f=`ANTHROPIC_IDENTITY_TOKEN_FILE`,p=`ANTHROPIC_WORKSPACE_ID`;let m=null;function h(t){let a=t?.GOOGLE_APPLICATION_CREDENTIALS;if(a)return n?n(a):!1;if(m===null){if(!n||!r||!i)return typeof process<`u`&&(process.versions?.node||process.versions?.bun)||(m=!1),!1;let a=e(`GOOGLE_APPLICATION_CREDENTIALS`,t);m=n(a||i(r(),`.config`,`gcloud`,`application_default_credentials.json`))}return m}function g(e){if(e===`github-copilot`)return[`COPILOT_GITHUB_TOKEN`];if(e===`anthropic`)return[o,s,c];let t={"ant-ling":`ANT_LING_API_KEY`,"qwen-token-plan":`QWEN_TOKEN_PLAN_API_KEY`,"qwen-token-plan-cn":`QWEN_TOKEN_PLAN_CN_API_KEY`,"qwen-token-plan-individual":`QWEN_TOKEN_PLAN_API_KEY`,openai:`OPENAI_API_KEY`,"azure-openai-responses":`AZURE_OPENAI_API_KEY`,nvidia:`NVIDIA_API_KEY`,deepseek:`DEEPSEEK_API_KEY`,google:`GEMINI_API_KEY`,"google-vertex":`GOOGLE_CLOUD_API_KEY`,groq:`GROQ_API_KEY`,cerebras:`CEREBRAS_API_KEY`,xai:`XAI_API_KEY`,typesafe:`TYPESAFE_API_KEY`,radius:`RADIUS_API_KEY`,openrouter:`OPENROUTER_API_KEY`,"vercel-ai-gateway":`AI_GATEWAY_API_KEY`,zai:`ZAI_API_KEY`,"zai-coding-cn":`ZAI_CODING_CN_API_KEY`,mistral:`MISTRAL_API_KEY`,minimax:`MINIMAX_API_KEY`,"minimax-cn":`MINIMAX_CN_API_KEY`,moonshotai:`MOONSHOT_API_KEY`,"moonshotai-cn":`MOONSHOT_API_KEY`,huggingface:`HF_TOKEN`,fireworks:`FIREWORKS_API_KEY`,together:`TOGETHER_API_KEY`,baseten:`BASETEN_API_KEY`,opencode:`OPENCODE_API_KEY`,"opencode-go":`OPENCODE_API_KEY`,"kimi-coding":`KIMI_API_KEY`,meta:`META_API_KEY`,"cloudflare-workers-ai":`CLOUDFLARE_API_KEY`,"cloudflare-ai-gateway":`CLOUDFLARE_API_KEY`,xiaomi:`XIAOMI_API_KEY`,"xiaomi-token-plan-cn":`XIAOMI_TOKEN_PLAN_CN_API_KEY`,"xiaomi-token-plan-ams":`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,"xiaomi-token-plan-sgp":`XIAOMI_TOKEN_PLAN_SGP_API_KEY`}[e];return t?[t]:void 0}function _(t,n){let r=g(t);if(!r)return;let i=r.filter(t=>!!e(t,n));return i.length>0?i:void 0}function v(t,n){let r=_(t,n);if(r?.[0]){let i=t===`anthropic`?r.find(e=>e!==o):r[0];if(i)return e(i,n)}if(t===`google-vertex`){let t=h(n),r=!!(e(`GOOGLE_CLOUD_PROJECT`,n)||e(`GCLOUD_PROJECT`,n)),i=!!e(`GOOGLE_CLOUD_LOCATION`,n);if(t&&r&&i)return`<authenticated>`}if(t===`amazon-bedrock`&&(e(`AWS_PROFILE`,n)||e(`AWS_ACCESS_KEY_ID`,n)&&e(`AWS_SECRET_ACCESS_KEY`,n)||e(`AWS_BEARER_TOKEN_BEDROCK`,n)||e(`AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`,n)||e(`AWS_CONTAINER_CREDENTIALS_FULL_URI`,n)||e(`AWS_WEB_IDENTITY_TOKEN_FILE`,n)))return`<authenticated>`}export{s as a,p as c,f as i,v as l,o as n,u as o,l as r,d as s,c as t};
@@ -1 +0,0 @@
1
- function e(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var t=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{let t=Object.prototype.toString.call(e);if(t===`[object Error]`||t===`[object DOMException]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},n=class extends Error{},r=class e extends n{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.workspaceID=i?.get(`anthropic-workspace-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(n,r,i,o){if(!n||!o)return new a({message:i,cause:t(r)});let s=r,g=s?.error?.type;return n===400?new c(n,s,i,o,g):n===401?new l(n,s,i,o,g):n===403?new u(n,s,i,o,g):n===404?new d(n,s,i,o,g):n===409?new f(n,s,i,o,g):n===422?new p(n,s,i,o,g):n===429?new m(n,s,i,o,g):n>=500?new h(n,s,i,o,g):new e(n,s,i,o,g)}},i=class extends r{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},a=class extends r{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},o=class extends a{constructor({message:e}={}){super({message:e??`Request timed out.`})}},s=class extends n{constructor(e,{cause:t}={}){super(e??`Retryable error.`),t!==void 0&&(this.cause=t)}},c=class extends r{},l=class extends r{},u=class extends r{},d=class extends r{},f=class extends r{},p=class extends r{},m=class extends r{},h=class extends r{};export{n as a,f as c,u as d,m as f,e as g,t as h,i,h as l,p as m,o as n,l as o,s as p,r,c as s,a as t,d as u};
@@ -1,2 +0,0 @@
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,i as t}from"./core-BFRZk2b-.js";import{a as n}from"./diagnostics-Cag7MsZI.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{a as i}from"./compat-BAGLwgqY.js";import{a,c as o,i as s,r as c,s as l,t as u}from"./legacy-api-aliases-BjgG1CsY.js";import{W as d,u as ee}from"./account-store-DmRIEeKD.js";import"./main-bbC4wIXo.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 t=M();if(t.length>0)return t.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 n;try{n=e(`github-copilot`)}catch{return[]}return n.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 n=C(),r=n?.baseUrl??`https://api.individual.githubcopilot.com`,i=P(e);if(i)return{api:i.api,baseUrl:r,headers:{...H}};try{let r=t(`github-copilot`,e);return{api:r.api,baseUrl:n?.baseUrl??r.baseUrl,headers:{...r.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?a:u:e===`openai-responses`?t?o:s:t?l:c}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(e){return(t,r,i={})=>{let a=n();return X(a,t,r,i,e),a}}var Q=Z(!1),$=Z(!0),re=({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 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{n.remove()}catch{}};c.addEventListener(`click`,()=>{u(),t(`cancel`)}),l.addEventListener(`click`,()=>{(async()=>{try{let{copyTextToClipboard:t}=await r(async()=>{let{copyTextToClipboard:e}=await import(`./clipboard-eqmn97SP.js`).then(e=>e.t);return{copyTextToClipboard:e}},__vite__mapDeps([0,1]));await t(e)}catch{}u(),t(`continue`)})()}),s.appendChild(c),s.appendChild(l),n.appendChild(i),n.appendChild(a),n.appendChild(o),n.appendChild(s),document.body.appendChild(n)});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(){i({api:`github-copilot-anthropic`,stream:Q,streamSimple:$}),i({api:`github-copilot-openai`,stream:Q,streamSimple:$})}export{ae as config,z as isCopilotConeCompatible,oe as register};
@@ -1 +0,0 @@
1
- import{i as e}from"./diagnostics-Cag7MsZI.js";import{b as t,f as n,n as r,o as i,t as a,u as o}from"./models-CET5SEuw.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-BeurHGV0.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-C6X3xab7.js";let D=0;const 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=n(r.messages),c=o(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?t(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 +0,0 @@
1
- import{i as e}from"./diagnostics-Cag7MsZI.js";import{b as t,f as n,n as r,o as i,t as a,u as o}from"./models-CET5SEuw.js";import{t as s}from"./provider-env-CILujRmO.js";import{n as c}from"./headers-FK4rgixo.js";import{s as l}from"./constrained-sampling-auYJ_zjz.js";import{t as u}from"./sanitize-unicode-DmIE6hZJ.js";import{r as d}from"./transform-messages-BeurHGV0.js";import{n as f,t as p}from"./error-body-pkrba6pf.js";import{a as m,c as h,d as g,f as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O}from"./google-shared-C6X3xab7.js";let k=0;const A=(t,n,r)=>{let o=new e,s=i(n);return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,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 Vertex adapter`);let n=R(r),i=n?N(t,n,r?.headers):M(t,B(r),V(r),r?.headers,r?.env),c=H(t,s,r),l=await r?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await b(()=>i.models.generateContentStream(c),r);o.push({type:`start`,partial:e});let d=null,f=e.content,p=()=>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=y(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:p(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),o.push({type:`thinking_start`,contentIndex:p(),partial:e})):(d={type:`text`,text:``},e.content.push(d),o.push({type:`text_start`,contentIndex:p(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=h(d.thinkingSignature,t.thoughtSignature),o.push({type:`thinking_delta`,contentIndex:p(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=h(d.textSignature,t.thoughtSignature),o.push({type:`text_delta`,contentIndex:p(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?o.push({type:`text_end`,contentIndex:p(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:p(),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()}_${++k}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),o.push({type:`toolcall_start`,contentIndex:p(),partial:e}),o.push({type:`toolcall_delta`,contentIndex:p(),delta:JSON.stringify(r.arguments),partial:e}),o.push({type:`toolcall_end`,contentIndex:p(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=m(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:p(),content:d.text,partial:e}):o.push({type:`thinking_end`,contentIndex:p(),content:d.thinking,partial:e})),r?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google Vertex 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=p(f(t)),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},j=(e,t,n)=>{let i={...d(e,t,n,void 0),toolChoice:n?.toolChoice};if(!n?.reasoning)return A(e,t,{...i,thinking:{enabled:!1}});let a=r(e,n.reasoning);if(a===`off`)return A(e,t,{...i,thinking:{enabled:!1}});let o=E(e,a);return w(e)?A(e,t,{...i,thinking:{enabled:!0,level:_(o)}}):A(e,t,{...i,thinking:{enabled:!0,budgetTokens:U(e,o,n.thinkingBudgets)}})};function M(e,t,n,r,i){let a=L(i);return new x({vertexai:!0,project:t,location:n,apiVersion:`v1`,...a?{googleAuthOptions:a}:{},httpOptions:P(e,r)})}function N(e,t,n){return new x({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:P(e,n)})}function P(e,t){let n={},r=F(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=v.COLLECTION,I(r)&&(n.apiVersion=``));let i=c({"User-Agent":l(),...e.headers,...t});return i&&(n.headers=i),Object.keys(n).length>0?n:void 0}function F(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function I(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function L(e){let t=s(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function R(e){let t=e?.apiKey?.trim();if(!(!t||t===`gcp-vertex-credentials`||z(t)))return t}function z(e){return/^<[^>]+>$/.test(e)}function B(e){let t=e?.project||s(`GOOGLE_CLOUD_PROJECT`,e?.env)||s(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function V(e){let t=e?.location||s(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function H(e,r,i={}){let a=D(e,r),s=n(r.messages),c=o(r.messages),l={};i.temperature!==void 0&&(l.temperature=i.temperature),i.maxTokens!==void 0&&(l.maxOutputTokens=i.maxTokens);let d=O(e.id),f=c.length>0?C(c,i.toolChoice,d):void 0,p=s?t(s):``,m={...Object.keys(l).length>0&&l,...p&&{systemInstruction:u(p)},...c.length>0&&{tools:S(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=g(i.thinking.level),m.thinkingConfig=e}else e.reasoning&&i.thinking&&!i.thinking.enabled&&(m.thinkingConfig=T(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 U(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`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{A as stream,j as streamSimple};