sliccy 6.130.0 → 6.131.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 (329) hide show
  1. package/README.md +2 -2
  2. package/dist/node-server/_shared/agent-wire-types.d.ts +54 -0
  3. package/dist/node-server/_shared/agent-wire-types.d.ts.map +1 -1
  4. package/dist/node-server/_shared/cdp-target-info.d.ts +19 -0
  5. package/dist/node-server/_shared/cdp-target-info.d.ts.map +1 -0
  6. package/dist/node-server/_shared/cdp-target-info.js +9 -0
  7. package/dist/node-server/_shared/cdp-target-info.js.map +1 -0
  8. package/dist/node-server/_shared/discovery-link.d.ts +76 -0
  9. package/dist/node-server/_shared/discovery-link.d.ts.map +1 -0
  10. package/dist/node-server/_shared/discovery-link.js +76 -0
  11. package/dist/node-server/_shared/discovery-link.js.map +1 -0
  12. package/dist/node-server/_shared/extension-bridge-protocol.d.ts +165 -0
  13. package/dist/node-server/_shared/extension-bridge-protocol.d.ts.map +1 -0
  14. package/dist/node-server/_shared/extension-bridge-protocol.js +65 -0
  15. package/dist/node-server/_shared/extension-bridge-protocol.js.map +1 -0
  16. package/dist/node-server/_shared/handoff-link.d.ts +90 -0
  17. package/dist/node-server/_shared/handoff-link.d.ts.map +1 -0
  18. package/dist/node-server/_shared/handoff-link.js +192 -0
  19. package/dist/node-server/_shared/handoff-link.js.map +1 -0
  20. package/dist/node-server/_shared/iframe-repaint.d.ts +51 -0
  21. package/dist/node-server/_shared/iframe-repaint.d.ts.map +1 -0
  22. package/dist/node-server/_shared/iframe-repaint.js +118 -0
  23. package/dist/node-server/_shared/iframe-repaint.js.map +1 -0
  24. package/dist/node-server/_shared/index.d.ts +9 -0
  25. package/dist/node-server/_shared/index.d.ts.map +1 -1
  26. package/dist/node-server/_shared/index.js +9 -0
  27. package/dist/node-server/_shared/index.js.map +1 -1
  28. package/dist/node-server/_shared/leader-ext-id.d.ts +16 -0
  29. package/dist/node-server/_shared/leader-ext-id.d.ts.map +1 -0
  30. package/dist/node-server/_shared/leader-ext-id.js +16 -0
  31. package/dist/node-server/_shared/leader-ext-id.js.map +1 -0
  32. package/dist/node-server/_shared/link-header.d.ts +98 -0
  33. package/dist/node-server/_shared/link-header.d.ts.map +1 -0
  34. package/dist/node-server/_shared/link-header.js +441 -0
  35. package/dist/node-server/_shared/link-header.js.map +1 -0
  36. package/dist/node-server/_shared/proxy-headers.d.ts +46 -0
  37. package/dist/node-server/_shared/proxy-headers.d.ts.map +1 -0
  38. package/dist/node-server/_shared/proxy-headers.js +133 -0
  39. package/dist/node-server/_shared/proxy-headers.js.map +1 -0
  40. package/dist/node-server/_shared/well-known-probe.d.ts +63 -0
  41. package/dist/node-server/_shared/well-known-probe.d.ts.map +1 -0
  42. package/dist/node-server/_shared/well-known-probe.js +104 -0
  43. package/dist/node-server/_shared/well-known-probe.js.map +1 -0
  44. package/dist/node-server/electron-controller.d.ts +51 -0
  45. package/dist/node-server/electron-controller.js +88 -5
  46. package/dist/ui/.vite/manifest.json +414 -488
  47. package/dist/ui/assets/CLAUDE-CWMPcWVI.js +34 -0
  48. package/dist/ui/assets/{CLAUDE-BG8Wfdn_.js → CLAUDE-DM1onrcU.js} +1 -1
  49. package/dist/ui/assets/SKILL--AFE5RE3.js +1 -0
  50. package/dist/ui/assets/{SKILL-DT72j81i.js → SKILL-cpVS35My.js} +1 -1
  51. package/dist/ui/assets/__vite-browser-external-B6A3FtA_.js +1 -0
  52. package/dist/ui/assets/{account-store-EaBcIxhN.js → account-store-DsMvFZgS.js} +3 -3
  53. package/dist/ui/assets/account-store-naVgJKHe.js +1 -0
  54. package/dist/ui/assets/{adobe-B0U_BLCy.js → adobe-BhZB46bT.js} +1 -1
  55. package/dist/ui/assets/{adobe-DSoEAq_f.js → adobe-sRIQnDEl.js} +2 -2
  56. package/dist/ui/assets/{agent-bridge-sbs3wiia.js → agent-bridge-DVqU5-sn.js} +1 -1
  57. package/dist/ui/assets/{agent-message-to-chat-Cnv4uh07.js → agent-message-to-chat-Df4an5Ei.js} +1 -1
  58. package/dist/ui/assets/{agent-message-to-chat-DW2ZZk9R.js → agent-message-to-chat-xGeYopQz.js} +1 -1
  59. package/dist/ui/assets/api-endpoint-DGxXvrur.js +1 -0
  60. package/dist/ui/assets/api-endpoint-Lx_FU5cP.js +1 -0
  61. package/dist/ui/assets/{apply-layout-DvwSioYn.js → apply-layout-dNkV0TEv.js} +1 -1
  62. package/dist/ui/assets/{apps-DFIoDcds.js → apps-tzFQ7_KO.js} +1 -1
  63. package/dist/ui/assets/{auto-mount-table-CEBCZFRF.js → auto-mount-table-0jMTi9rV.js} +1 -1
  64. package/dist/ui/assets/{azure-openai-C_J_i_Uv.js → azure-openai-B9ZeZZ0T.js} +1 -1
  65. package/dist/ui/assets/{azure-openai-DUJebq5R.js → azure-openai-DsmgiFlX.js} +1 -1
  66. package/dist/ui/assets/{backend-hostfs-t651gkrP.js → backend-hostfs-BH8uwRZG.js} +1 -1
  67. package/dist/ui/assets/{backend-hostfs-BQYf7TAS.js → backend-hostfs-BxfjZHzO.js} +1 -1
  68. package/dist/ui/assets/bridge-protocol-06nbmp2X.js +1 -0
  69. package/dist/ui/assets/bridge-protocol-DdqxTTSu.js +1 -0
  70. package/dist/ui/assets/{bsh-watchdog-D97yX3sQ.js → bsh-watchdog-CxyhQHy5.js} +1 -1
  71. package/dist/ui/assets/{capability-Btlr4Wc-.js → capability-Bxl0SE1s.js} +2 -2
  72. package/dist/ui/assets/{cdp-DHIp_AO9.js → cdp-CmXwwigc.js} +1 -1
  73. package/dist/ui/assets/{cerebras-4vCJGBUt.js → cerebras-CsdnfQnc.js} +1 -1
  74. package/dist/ui/assets/{cerebras-CBjabVSb.js → cerebras-Mux-1Uqj.js} +1 -1
  75. package/dist/ui/assets/{client-CjV_9a9h.js → client-C6Cmi9c4.js} +1 -1
  76. package/dist/ui/assets/composer-speech-CElQJ4q_.js +1 -0
  77. package/dist/ui/assets/{connect-surface-DrBGja7c.js → connect-surface-DgrjdeR5.js} +1 -1
  78. package/dist/ui/assets/{context-compaction-huebTevb.js → context-compaction-DRymamfD.js} +3 -3
  79. package/dist/ui/assets/{core-CdPvxBo3.js → core-B8y1Kyh_.js} +2 -2
  80. package/dist/ui/assets/{derive-C_gfjwp6.js → derive-TWFNEJkb.js} +1 -1
  81. package/dist/ui/assets/dip-1TiuHkUR.js +233 -0
  82. package/dist/ui/assets/{directed-approval-cJrhWrrr.js → directed-approval-BDO2wdC5.js} +1 -1
  83. package/dist/ui/assets/{discovery-preference-DFkmIHQo.js → discovery-preference-B9KlkVuR.js} +1 -1
  84. package/dist/ui/assets/ensure-speech-assets-DasC7jBA.js +1 -0
  85. package/dist/ui/assets/{esbuild-wasm-CSKOA492.js → esbuild-wasm-Ew76Vf_V.js} +2 -2
  86. package/dist/ui/assets/export-provider-CqI0pk50.js +1 -0
  87. package/dist/ui/assets/export-spool-CuNzzI8a.js +1 -0
  88. package/dist/ui/assets/{extension-bridge-transport-D3PItLFo.js → extension-bridge-transport-DfRNjx8c.js} +1 -1
  89. package/dist/ui/assets/extension-media-capture-2FcAdcuB.js +1 -0
  90. package/dist/ui/assets/extension-ops-owOXVncP.js +1 -0
  91. package/dist/ui/assets/float-topology-hfgMx1Yq.js +1 -0
  92. package/dist/ui/assets/{follower-navigate-watcher-B9ZostUJ.js → follower-navigate-watcher-JQ0b_cW8.js} +1 -1
  93. package/dist/ui/assets/{fs-C9SJY4sJ.js → fs-CBaQR8Xc.js} +2 -2
  94. package/dist/ui/assets/{fs-n6R6QZv0.js → fs-CDaCMxrL.js} +1 -1
  95. package/dist/ui/assets/github-B7uOq9Q1.js +1 -0
  96. package/dist/ui/assets/{github-copilot-COZvaCzG.js → github-copilot-BeWJoZwD.js} +1 -1
  97. package/dist/ui/assets/{github-copilot-Cai-dPyZ.js → github-copilot-DwKSI23j.js} +1 -1
  98. package/dist/ui/assets/{github-install-DfhMDFC9.js → github-install-DE7dF6r8.js} +1 -1
  99. package/dist/ui/assets/{github-D-fdkiMQ.js → github-qhOhjD2Q.js} +2 -2
  100. package/dist/ui/assets/{github-zip-ZEV5pLGZ.js → github-zip-CuwUOO-U.js} +1 -1
  101. package/dist/ui/assets/{guest-tool-gate-CG9Yw8Kq.js → guest-tool-gate-BxRAm4CU.js} +1 -1
  102. package/dist/ui/assets/{hear-D7MO-jTh.js → hear-CNQSuR1y.js} +1 -1
  103. package/dist/ui/assets/{help-CQHZfeL3.js → help-D66VHlYj.js} +8 -4
  104. package/dist/ui/assets/hid-picker-sFJ8vzUj.js +1 -0
  105. package/dist/ui/assets/host-command-29ain4NA.js +1 -0
  106. package/dist/ui/assets/idle-compaction-B9i1duyd.js +1 -0
  107. package/dist/ui/assets/idle-compaction-settings-1yyApSsQ.js +1 -0
  108. package/dist/ui/assets/image-markers-BFDmhPy4.js +1 -0
  109. package/dist/ui/assets/image-markers-DuyWsic3.js +1 -0
  110. package/dist/ui/assets/{installer-7BWtTgd6.js → installer-C6TqZaGO.js} +3 -3
  111. package/dist/ui/assets/{js-realm-worker-CXI-Ngjy.js → js-realm-worker-Bsb6rmK5.js} +4 -4
  112. package/dist/ui/assets/{jsh-runtime-extensions-Bf9eAUzp.js → jsh-runtime-extensions-Dkujbplu.js} +1 -1
  113. package/dist/ui/assets/kernel-worker-CkZd8Enf.js +4991 -0
  114. package/dist/ui/assets/lick-manager-ULemXDKa.js +2 -0
  115. package/dist/ui/assets/lick-urls-BX4Jyu_T.js +1 -0
  116. package/dist/ui/assets/{lick-ws-bridge-Jk_oJNDM.js → lick-ws-bridge-Bo5sH7lf.js} +1 -1
  117. package/dist/ui/assets/{lick-ws-bridge-ct0HLNad.js → lick-ws-bridge-RFOSPq0w.js} +1 -1
  118. package/dist/ui/assets/{live-session-snapshot-DnNBHXrk.js → live-session-snapshot-BTnyrQCU.js} +1 -1
  119. package/dist/ui/assets/{loader-B90Xxi7L.js → loader-Dw-TPPKt.js} +1 -1
  120. package/dist/ui/assets/{local-llm-Dm5mp8ES.js → local-llm-B-qS5oNT.js} +1 -1
  121. package/dist/ui/assets/{local-llm-CXD-Qof4.js → local-llm-COCS88AU.js} +1 -1
  122. package/dist/ui/assets/{magick-wasm-BEYfJbAX.js → magick-wasm-C7OGcZrJ.js} +2 -2
  123. package/dist/ui/assets/main-CAXbdHY8.js +22 -0
  124. package/dist/ui/assets/main-cherry-DSNvH0CD.js +1 -0
  125. package/dist/ui/assets/{mount-DD8rKTRS.js → mount-BbUBqN71.js} +2 -2
  126. package/dist/ui/assets/{mount-bridge-client-CUPodVo6.js → mount-bridge-client-BejrWSrL.js} +1 -1
  127. package/dist/ui/assets/{mount-bridge-client-BrMqFu_x.js → mount-bridge-client-DGJyqEPG.js} +1 -1
  128. package/dist/ui/assets/{mount-picker-popup-CVvcLs1V.js → mount-picker-popup--ijSfN8u.js} +1 -1
  129. package/dist/ui/assets/{mount-recovery-D6g3iniZ.js → mount-recovery-OxgGejDC.js} +1 -1
  130. package/dist/ui/assets/{mount-C1nMn8bL.js → mount-ysOnJBjr.js} +3 -3
  131. package/dist/ui/assets/navigation-watcher-C8xRyQBd.js +1 -0
  132. package/dist/ui/assets/new-session-JIL4tJ1I.js +2 -0
  133. package/dist/ui/assets/oauth-bootstrap-DP5y5Dy8.js +2 -0
  134. package/dist/ui/assets/oauth-service-Bconf2Pz.js +1 -0
  135. package/dist/ui/assets/oauth-service-t2taQm3p.js +1 -0
  136. package/dist/ui/assets/{openai-codex-BveJezys.js → openai-codex-BZDYkVh6.js} +1 -1
  137. package/dist/ui/assets/{openai-codex-WPOtL2Mf.js → openai-codex-DlFMWNVB.js} +1 -1
  138. package/dist/ui/assets/{openrouter-98Q9mrw8.js → openrouter-BrS9XpJS.js} +1 -1
  139. package/dist/ui/assets/{openrouter-6nEYTdxI.js → openrouter-Dn_iX45f.js} +1 -1
  140. package/dist/ui/assets/{openrouter-oauth-C7w8rKLa.js → openrouter-oauth-CioQlp0x.js} +1 -1
  141. package/dist/ui/assets/{openrouter-oauth-BCNSNHpM.js → openrouter-oauth-D9gZVt7e.js} +1 -1
  142. package/dist/ui/assets/{page-approval-service-DnWfuBVQ.js → page-approval-service-IZdlRu-_.js} +1 -1
  143. package/dist/ui/assets/panel-rpc-handlers-DUN0E_f8.js +2 -0
  144. package/dist/ui/assets/{panelize-shell-C7Ptpa69.js → panelize-shell-KNX1XTnq.js} +1 -1
  145. package/dist/ui/assets/picker-popup-sQtXmfAo.js +1 -0
  146. package/dist/ui/assets/{port-bridge-client-wFmUGeZa.js → port-bridge-client-C1tBBqwu.js} +1 -1
  147. package/dist/ui/assets/{port-bridge-client-BTnhFM03.js → port-bridge-client-CN1cFP4D.js} +1 -1
  148. package/dist/ui/assets/preview-url-r19H6zH1.js +1 -0
  149. package/dist/ui/assets/{provider-1nSAXh4b.js → provider-BfGyOQHs.js} +2 -2
  150. package/dist/ui/assets/{provider-RrpO6cEr.js → provider-DnIZJQjl.js} +1 -1
  151. package/dist/ui/assets/provider-settings-C6uIHjd4.js +1 -0
  152. package/dist/ui/assets/provider-settings-DrWv51sQ.js +2 -0
  153. package/dist/ui/assets/{provider-store-access-kKnmyJjr.js → provider-store-access-BqErJhmB.js} +2 -2
  154. package/dist/ui/assets/provider-store-access-BuQzycZu.js +1 -0
  155. package/dist/ui/assets/{providers-CvD7PECK.js → providers-CF2FF0H2.js} +1 -1
  156. package/dist/ui/assets/providers-CqZKx9qW.js +2 -0
  157. package/dist/ui/assets/proxied-fetch-CiijUcSt.js +2 -0
  158. package/dist/ui/assets/proxied-fetch-DUC7X0GS.js +1 -0
  159. package/dist/ui/assets/{py-realm-worker-DGFMfg27.js → py-realm-worker-BYQkpReo.js} +2 -2
  160. package/dist/ui/assets/{pyodide-BDRAQKP6.js → pyodide-BwD0AtZB.js} +2 -2
  161. package/dist/ui/assets/{quick-llm-I3oLGgvo.js → quick-llm-B9NubAhJ.js} +1 -1
  162. package/dist/ui/assets/{recovery-screen-CBwlz3Qo.js → recovery-screen-cHPORxsj.js} +1 -1
  163. package/dist/ui/assets/{redirect-uri-DZXyVwvI.js → redirect-uri-BKkf61lT.js} +1 -1
  164. package/dist/ui/assets/{remote-terminal-view-Db-9V2n9.js → remote-terminal-view-BHs39pzZ.js} +1 -1
  165. package/dist/ui/assets/request-body-DWn6QJ_H.js +1 -0
  166. package/dist/ui/assets/rest-ops-CLpS_ilI.js +1 -0
  167. package/dist/ui/assets/rest-ops-D2ig8qfG.js +1 -0
  168. package/dist/ui/assets/{run-BBAgk3Ml.js → run-03JeZZol.js} +1 -1
  169. package/dist/ui/assets/{run-COi81T_1.js → run-B5YOTTPD.js} +1 -1
  170. package/dist/ui/assets/run-BOu4zIOZ.js +29 -0
  171. package/dist/ui/assets/{run-DZMSwK6o.js → run-CUXVFhoI.js} +1 -1
  172. package/dist/ui/assets/run-D5Va_gO8.js +81 -0
  173. package/dist/ui/assets/{run-DCeEfqcT.js → run-DZh-18uA.js} +3 -3
  174. package/dist/ui/assets/{secret-env-Cp2Eduxg.js → secret-env-CtpVPUh5.js} +1 -1
  175. package/dist/ui/assets/secret-topology-Yt0aO4Gz.js +1 -0
  176. package/dist/ui/assets/{secrets-bridge-client-CHMeCH4_.js → secrets-bridge-client-BVl0YuB2.js} +1 -1
  177. package/dist/ui/assets/{secrets-bridge-client-CNOtgwnq.js → secrets-bridge-client-C3MaYf_O.js} +1 -1
  178. package/dist/ui/assets/serial-picker-BQF_Eitc.js +1 -0
  179. package/dist/ui/assets/{session-freezer-DVh0_BPO.js → session-freezer-Bltt6zUt.js} +3 -3
  180. package/dist/ui/assets/{setup-feature-flags-remote-DBcwYFl-.js → setup-feature-flags-remote-BkP-HRZt.js} +1 -1
  181. package/dist/ui/assets/setup-standalone-prelude-C2tPUGcI.js +2 -0
  182. package/dist/ui/assets/setup-sudo-BSw__xoN.js +2 -0
  183. package/dist/ui/assets/shared-Djytys1b.js +1 -0
  184. package/dist/ui/assets/shared-Dq_aaG_m.js +4 -0
  185. package/dist/ui/assets/silent-renew-backoff-DIMz5UqB.js +1 -0
  186. package/dist/ui/assets/silent-renew-backoff-SSzHR-oP.js +1 -0
  187. package/dist/ui/assets/{skills-BEEjU5I5.js → skills-wzno5Tj5.js} +1 -1
  188. package/dist/ui/assets/slicc-app-url-B9OxaBDe.js +1 -0
  189. package/dist/ui/assets/slicc-version-HwuyIZfW.js +1 -0
  190. package/dist/ui/assets/{snapshot-CPjJBR4Z.js → snapshot-Bi6QabWh.js} +1 -1
  191. package/dist/ui/assets/{snapshot-features-BZbgnon7.js → snapshot-features-BEPdcWF6.js} +3 -3
  192. package/dist/ui/assets/{speak-Dx2FEQBZ.js → speak-BxNdNjKi.js} +1 -1
  193. package/dist/ui/assets/{sprinkle-bridge-BVfyHi8X.js → sprinkle-bridge-BNzhEsPj.js} +1 -1
  194. package/dist/ui/assets/{sprinkle-manager-Dxc8U2h1.js → sprinkle-manager-CflRWcbq.js} +1 -1
  195. package/dist/ui/assets/{sprinkle-renderer-1C1DNVyK.js → sprinkle-renderer-BnSqYzuY.js} +1 -1
  196. package/dist/ui/assets/{src-kInvzkEg.js → src-Bex_z_yH.js} +583 -148
  197. package/dist/ui/assets/state-DIwkpIaB.js +42 -0
  198. package/dist/ui/assets/{store-BHLq6CyB.js → store-CFx1fIZL.js} +1 -1
  199. package/dist/ui/assets/{store-Dd0aJqlJ.js → store-i7XHN1Er.js} +1 -1
  200. package/dist/ui/assets/{sudo-DBeYNsAF.js → sudo-r7OrTMGT.js} +1 -1
  201. package/dist/ui/assets/sync-dialog-D7Wg49Up.js +1 -0
  202. package/dist/ui/assets/tab-teleport-PAaKnGkm.js +1 -0
  203. package/dist/ui/assets/transcript-export-DP-r8eDz.js +1 -0
  204. package/dist/ui/assets/transformers-env-BmBEKck6.js +1 -0
  205. package/dist/ui/assets/{tray-leader-DTpZEm3l.js → tray-leader-DabyaEs-.js} +1 -1
  206. package/dist/ui/assets/{tray-leave-runtime-BrGJs1g5.js → tray-leave-runtime-VfTj-MHR.js} +1 -1
  207. package/dist/ui/assets/tray-runtime-config-BQL-GPqt.js +1 -0
  208. package/dist/ui/assets/tray-runtime-config-C3Ti4Pik.js +1 -0
  209. package/dist/ui/assets/tray-sidecar-Zx9F34-1.js +2 -0
  210. package/dist/ui/assets/tray-sync-protocol-jKTx-dCF.js +1 -0
  211. package/dist/ui/assets/tray-webrtc-uW6sTyIA.js +1 -0
  212. package/dist/ui/assets/{upgrade-detection-BwiYpjuO.js → upgrade-detection-Cz0eOMYf.js} +1 -1
  213. package/dist/ui/assets/usb-picker-Cbm0jfjl.js +1 -0
  214. package/dist/ui/assets/{voice-reply-BGR2cNZ_.js → voice-reply-B43Nr1Xr.js} +1 -1
  215. package/dist/ui/assets/{wc-attach-BLZapYO1.js → wc-attach-BbT2famN.js} +3 -3
  216. package/dist/ui/assets/wc-browser-Ctsf5Y23.js +1 -0
  217. package/dist/ui/assets/{wc-extension-B_OX4AT5.js → wc-extension-CJ6cvLnw.js} +2 -2
  218. package/dist/ui/assets/{wc-float-label-Ck2cAgp3.js → wc-float-label-CnFnKVLC.js} +1 -1
  219. package/dist/ui/assets/wc-follower-CkrdiOKN.js +17 -0
  220. package/dist/ui/assets/wc-follower-oauth-B6m2XpVI.js +5 -0
  221. package/dist/ui/assets/wc-live-CxoqWHpR.js +8 -0
  222. package/dist/ui/assets/wc-nav-Bnd_bEYw.js +2 -0
  223. package/dist/ui/assets/wc-onboarding-FeHr2fj5.js +2 -0
  224. package/dist/ui/assets/{wc-permissions-iZXqGvtf.js → wc-permissions-CppSymRx.js} +3 -3
  225. package/dist/ui/assets/wc-permissions-providers-BjqCnuQT.js +2 -0
  226. package/dist/ui/assets/wc-placeholder-C79lmtig.js +4 -0
  227. package/dist/ui/assets/wc-settings-DdAeaZhQ.js +59 -0
  228. package/dist/ui/assets/wc-shell-BP3biEU1.js +125 -0
  229. package/dist/ui/assets/{wc-shortcut-config--IseG9bJ.js → wc-shortcut-config-CjOJXjsp.js} +2 -2
  230. package/dist/ui/assets/wc-shortcuts-BDQiHczD.js +41 -0
  231. package/dist/ui/assets/wc-sprinkles-ChlcnDD2.js +2 -0
  232. package/dist/ui/assets/wc-transcript-export-DdEuCfi6.js +2 -0
  233. package/dist/ui/assets/wc-tray-BfoqEbBg.js +5 -0
  234. package/dist/ui/assets/whisper-session-DW7HkDu2.js +2 -0
  235. package/dist/ui/assets/{xai-grok-OLNPEXTT.js → xai-grok-3L0LL1R8.js} +1 -1
  236. package/dist/ui/assets/{xai-grok-C-iHnNxi.js → xai-grok-CKevFY8L.js} +1 -1
  237. package/dist/ui/index.html +15 -17
  238. package/dist/ui/llm-proxy-sw.js +1 -1
  239. package/dist/ui/packages/webapp/index.html +15 -17
  240. package/package.json +5 -4
  241. package/dist/ui/assets/CLAUDE-DhkULx_E.js +0 -1
  242. package/dist/ui/assets/SKILL-DJAvKejL.js +0 -1
  243. package/dist/ui/assets/__vite-browser-external-B19j3y2v.js +0 -1
  244. package/dist/ui/assets/account-store-CCqSr710.js +0 -1
  245. package/dist/ui/assets/api-endpoint-BB41u1PK.js +0 -1
  246. package/dist/ui/assets/api-endpoint-DRYP1Kfj.js +0 -1
  247. package/dist/ui/assets/composer-speech-C8OcijP-.js +0 -1
  248. package/dist/ui/assets/dip-Co-Ga2Ny.js +0 -233
  249. package/dist/ui/assets/ensure-speech-assets-Csum3_gw.js +0 -1
  250. package/dist/ui/assets/export-provider-BunpOA08.js +0 -1
  251. package/dist/ui/assets/export-spool-Bvpvkbul.js +0 -1
  252. package/dist/ui/assets/extension-media-capture-DiCJSgES.js +0 -1
  253. package/dist/ui/assets/extension-ops-CsNT8YjX.js +0 -1
  254. package/dist/ui/assets/float-topology-ey0oewfq.js +0 -1
  255. package/dist/ui/assets/github-BXAKydA_.js +0 -1
  256. package/dist/ui/assets/handoff-link-CGs8AaQW.js +0 -1
  257. package/dist/ui/assets/hid-picker-C4WMZ0dN.js +0 -1
  258. package/dist/ui/assets/host-command-PnmJLRej.js +0 -1
  259. package/dist/ui/assets/idle-compaction-CACtwRU_.js +0 -1
  260. package/dist/ui/assets/idle-compaction-settings-wK6JTbJh.js +0 -1
  261. package/dist/ui/assets/image-markers-DXh8szCT.js +0 -1
  262. package/dist/ui/assets/image-markers-Gur55AOh.js +0 -1
  263. package/dist/ui/assets/kernel-worker-Da1sBAJS.js +0 -4940
  264. package/dist/ui/assets/lick-manager-DtpJc-rA.js +0 -2
  265. package/dist/ui/assets/lick-urls-f41PW9LN.js +0 -1
  266. package/dist/ui/assets/main-BwL0siqZ.js +0 -22
  267. package/dist/ui/assets/main-cherry-D1l6FfCM.js +0 -1
  268. package/dist/ui/assets/navigation-watcher-C3S1JDXr.js +0 -1
  269. package/dist/ui/assets/new-session-DyvxhZfj.js +0 -2
  270. package/dist/ui/assets/oauth-bootstrap-KB9SK_o_.js +0 -2
  271. package/dist/ui/assets/oauth-service-CT-Lvflt.js +0 -1
  272. package/dist/ui/assets/oauth-service-nBlvta_T.js +0 -1
  273. package/dist/ui/assets/panel-rpc-handlers-BPA7Umeo.js +0 -2
  274. package/dist/ui/assets/picker-popup-BjCTzsQH.js +0 -1
  275. package/dist/ui/assets/picker-popup-CFr7T4TJ.js +0 -1
  276. package/dist/ui/assets/preview-url-BvtKejEp.js +0 -1
  277. package/dist/ui/assets/provider-settings-CHQp2onM.js +0 -1
  278. package/dist/ui/assets/provider-settings-Dp2FBrlU.js +0 -2
  279. package/dist/ui/assets/provider-store-access-8IJH8x4u.js +0 -1
  280. package/dist/ui/assets/providers-DuO7vxZy.js +0 -2
  281. package/dist/ui/assets/proxied-fetch-B0SF_J0b.js +0 -1
  282. package/dist/ui/assets/proxied-fetch-CNztWUVW.js +0 -2
  283. package/dist/ui/assets/remote-cdp-transport-BZuQZZe1.js +0 -1
  284. package/dist/ui/assets/request-body-CsruB58l.js +0 -1
  285. package/dist/ui/assets/rest-ops-31ZkM4IG.js +0 -1
  286. package/dist/ui/assets/rest-ops-D6OyHX5S.js +0 -1
  287. package/dist/ui/assets/run-b1PI_1dP.js +0 -81
  288. package/dist/ui/assets/runtime-env-BFnohVwN.js +0 -1
  289. package/dist/ui/assets/runtime-env-Dc36nUmg.js +0 -1
  290. package/dist/ui/assets/runtime-env-NCI8LQob.js +0 -1
  291. package/dist/ui/assets/runtime-env-a_l4ilH_.js +0 -1
  292. package/dist/ui/assets/secret-topology-B8MYKYm6.js +0 -1
  293. package/dist/ui/assets/serial-picker-fzg2DxKj.js +0 -1
  294. package/dist/ui/assets/setup-standalone-prelude-C2jWAIl4.js +0 -2
  295. package/dist/ui/assets/setup-sudo-BK3Rz-OI.js +0 -2
  296. package/dist/ui/assets/shared-BpOmrBY4.js +0 -1
  297. package/dist/ui/assets/shared-CTdWt5ZU.js +0 -4
  298. package/dist/ui/assets/silent-renew-backoff-B8p8Ja1t.js +0 -1
  299. package/dist/ui/assets/silent-renew-backoff-BjF-rXLR.js +0 -1
  300. package/dist/ui/assets/slicc-app-url-DnN_aesz.js +0 -1
  301. package/dist/ui/assets/slicc-version-CUqwa07v.js +0 -1
  302. package/dist/ui/assets/src-DXa5EsFV.js +0 -1
  303. package/dist/ui/assets/src-XLzS9HFL.js +0 -1
  304. package/dist/ui/assets/state-C7WiY9TK.js +0 -42
  305. package/dist/ui/assets/sync-dialog-BZ2j4xTg.js +0 -1
  306. package/dist/ui/assets/tab-teleport-D1Xeuund.js +0 -1
  307. package/dist/ui/assets/transformers-env-DnkszgHP.js +0 -1
  308. package/dist/ui/assets/tray-runtime-config-D9gR_d0I.js +0 -1
  309. package/dist/ui/assets/tray-runtime-config-DCaFjGSS.js +0 -1
  310. package/dist/ui/assets/tray-sidecar-CWqVyj-w.js +0 -2
  311. package/dist/ui/assets/tray-sync-protocol-BNw4_0UD.js +0 -1
  312. package/dist/ui/assets/tray-sync-protocol-BZ5yhJH9.js +0 -1
  313. package/dist/ui/assets/tray-webrtc-De2SkVvZ.js +0 -1
  314. package/dist/ui/assets/usb-picker-B8B4LJT7.js +0 -1
  315. package/dist/ui/assets/wc-browser-AyZY1PPl.js +0 -1
  316. package/dist/ui/assets/wc-follower-CYLEd4rs.js +0 -17
  317. package/dist/ui/assets/wc-follower-oauth-CTgC7D7W.js +0 -5
  318. package/dist/ui/assets/wc-live-s5MA_zAo.js +0 -8
  319. package/dist/ui/assets/wc-nav-DHUiLdz3.js +0 -2
  320. package/dist/ui/assets/wc-onboarding-CX3HBRTZ.js +0 -2
  321. package/dist/ui/assets/wc-permissions-providers-BzoJwkWd.js +0 -2
  322. package/dist/ui/assets/wc-placeholder-BPLzZhYP.js +0 -4
  323. package/dist/ui/assets/wc-settings-tszLzSGm.js +0 -59
  324. package/dist/ui/assets/wc-shell-BBDMmI8N.js +0 -122
  325. package/dist/ui/assets/wc-shortcuts-BWBA9QlD.js +0 -11
  326. package/dist/ui/assets/wc-sprinkles-Cx9Zvx6r.js +0 -2
  327. package/dist/ui/assets/wc-transcript-export-B6x5VMbH.js +0 -2
  328. package/dist/ui/assets/wc-tray-DEV2i60z.js +0 -5
  329. package/dist/ui/assets/whisper-session-i96-W77q.js +0 -2
@@ -0,0 +1,34 @@
1
+ var e=`# sliccy
2
+
3
+ SLICC is a browser-native runtime for coding, browsing, automation, and parallel agents.
4
+
5
+ ## Roles
6
+
7
+ Your injected role, policy, workspace and tools are authoritative; this file is not. Cone: a root work unit. Scoop: a delegated child. Root cones may coexist — never assume a singleton \`cone\`.
8
+
9
+ Sprinkles are persistent \`.shtml\` panels owned by a long-lived scoop; dips are ephemeral inline \`shtml\`; licks are events addressed to a work unit; trays are remote runtimes (\`host\` lists, \`--runtime=<id>\` targets).
10
+
11
+ ## Explore first
12
+
13
+ 100+ commands. Never say "I can't" without checking: \`commands\`, \`<cmd> --help\`, \`man <topic>\`, \`skill list\`, \`upskill search "<query>"\`, \`upskill tabs\`. Manuals and skills define syntax and capability — read them before concluding something is missing.
14
+
15
+ New capability = a skill, not a feature: \`/workspace/skills/skill-authoring/SKILL.md\`.
16
+
17
+ ## Media
18
+
19
+ \`![label](/absolute/path)\` renders inline in chat: images, video, audio; 2+ per paragraph is a gallery. Absolute paths only. Raw HTML renders too (sanitized), but a fenced html block only shows source.
20
+
21
+ ## Licks
22
+
23
+ Events arrive as \`[<Event>: <name>]\` with a JSON body. Route each to the work unit it addresses; never handle another unit's lick yourself. Discovery events are informational — you may act, you are never required to. Handoffs and other privileged actions are human-gated.
24
+
25
+ ## Operating
26
+
27
+ When something fails, preserve the evidence, read the output, and try a different path. After an ambiguous failure verify state before repeating a mutation. A policy denial surfaces as exit 1 or \`EACCES\`, not a prompt; request the least privilege that works. Verify results and artifacts before claiming completion.
28
+
29
+ Keep only durable facts in memory; prune stale entries.
30
+
31
+ ## Style
32
+
33
+ Professional tool, not a chatbot. No emoji.
34
+ `;export{e as default};
@@ -1 +1 @@
1
- var e="# CLAUDE.md\n\nThis file covers the default virtual filesystem payload in `packages/vfs-root/`.\n\n## What This Package Contains\n\n`packages/vfs-root/` is copied into the app's virtual filesystem on init/reset. It is content, not runtime code.\n\n## Directory Structure\n\n| Path | Purpose |\n| ------------------------------------- | ------------------------------------------------------------------------------------------ |\n| `packages/vfs-root/shared/` | Shared content that becomes `/shared/` in the VFS |\n| `packages/vfs-root/workspace/` | Default workspace content that becomes `/workspace/` in the VFS |\n| `packages/vfs-root/shared/CLAUDE.md` | Agent-facing runtime instructions bundled into `/shared/CLAUDE.md` |\n| `packages/vfs-root/shared/MEMORY.md` | User-editable memory curator config bundled as `/shared/MEMORY.md` |\n| `packages/vfs-root/shared/sprinkles/` | Built-in sprinkle UIs |\n| `packages/vfs-root/shared/sounds/` | Shared notification sounds |\n| `packages/vfs-root/workspace/skills/` | Default installable workspace skills |\n| `packages/vfs-root/etc/` | System config seeded into `/etc/` (`models`, `sudoers`, `APPROVALS.md`, `slicc/keys.json`) |\n\n## Adding Default Content\n\n### Memory curator\n\n- `shared/MEMORY.md` is the single source for the runner's build-time fallback and the seeded\n `/shared/MEMORY.md` file.\n- The file is seeded only when absent, so user and skill customizations survive later boots.\n- `MEMORY.md` is user-edited only; the curator intentionally cannot rewrite its own instructions.\n- Frontmatter uses a strict YAML subset: block-array items may have `#` comment tails; inline\n entries containing commas must be quoted. A bare `/` is rejected from `writablePaths`.\n- Frontmatter `allowedCommands` entries extend the curator's built-in base set; they do not\n replace or remove base commands.\n- The curator may rewrite the entire memory file, and the hard character budget\n applies to the entire file with no protected region.\n- **The curator edits a staged draft, never the live file.** `{{MEMORY_PATH}}` resolves to\n `/sessions/.curation/<archive>/draft.md`, seeded (with a `base.md` snapshot) from the live\n memory when the pass spawns; the agent bridge three-way-merges base→draft onto the live file\n on exit 0, before the success receipt (`mergeOnSuccess`). Concurrent live edits survive;\n conflicting regions resolve to the curator. A killed or failed run leaves the live memory\n untouched. The bridge also writes `/sessions/.curation/<archive>/status.json` on both exit\n paths (`outcomeReceiptPath`) — the durable ledger of which sessions completed vs failed\n curation; the index entry mirrors it as `memoryCuratedAt` / `memoryFailed`. Per-archive\n keying means parallel per-cone curators (#1666) never share staging state.\n- Every `##`/`###` memory section ends with a `YYYY-MM-DD` last-verified date, in UTC to match\n archive timestamps. Each pass re-verifies the oldest sections first; undated sections are\n maximally stale.\n- The curator's write grant is `/workspace/CLAUDE.md` alone, not `/workspace/`. It can run `upskill`\n to look up a skill for a pitfall it found, and a directory-wide grant would also let it install\n into `/workspace/skills/`. Reads still cover `/workspace/`. Single-file entries in\n `writablePaths` work because `generateScoopSudoers` emits both the bare path and the `/**` form.\n- The pass is detached, so it spawns with `notifyOnComplete`. Its closing message reaches the cone\n on the `scoop-notify` channel; that is where a skill suggestion lands. Without it the report is\n discarded and the cone never learns the pass ran.\n- Turn count is what a pass costs, because every turn re-reads the whole context as a cache read.\n Two things keep it down, and both belong to the prompt rather than the runtime: `thinkingLevel`\n (default `medium`; spawned agents otherwise resolve to `off`) so the curator plans the cut\n instead of converging by trial and error, and the archive reading recipes so it never `cat`s a\n multi-megabyte archive whose `slicc:session-data` block is a single line holding half the file.\n\n### Approver agent\n\n- `etc/APPROVALS.md` is the single source for the runner's build-time fallback and\n the seeded `/etc/APPROVALS.md`, exactly like `shared/MEMORY.md` is for the curator.\n `SudoManager.ensureDefaults()` does the seeding, when absent, on the ungated\n handle — the same place `/etc/sudoers` is seeded, and for the same reason: the\n file is self-protected, so anything else that had to create it (the `upgrade\napply` merge) would prompt the owner to approve the default already in force (#2686).\n- It lives in `/etc/` because it is POLICY, next to `sudoers` — not in `/shared/`,\n which is agent-visible content. Writes to it are self-protected in\n `base/sudoers.ts` (`isSelfProtectedWrite`) for the same reason writes to\n `/etc/sudoers` are: it decides what a GUEST may do, and a cone acting on a\n guest's message must not rewrite the rules gating that guest without the owner\n seeing a prompt.\n- Re-read on EVERY decision, not cached: an owner who tightens it after a bad\n call expects the next decision to use it. Missing or unreadable falls back to\n the bundled default rather than wedging approvals shut.\n- The optional ```yaml block tunes `timeoutSeconds` (clamped — a guest, and for\n a tool gate the cone's turn, is blocked on the decision), `model`, and\n `thinkingLevel`. Unreadable values fall back rather than becoming real.\n- The approver never reads this file itself; the runtime reads it and puts it in\n the prompt. The agent holds no write grant at all.\n\n### Skills\n\n- Add new built-in workspace skills under `packages/vfs-root/workspace/skills/<skill-name>/`.\n- Include `SKILL.md` and any companion assets or `.jsh` scripts the skill needs.\n\n### Keyboard shortcuts\n\n- `etc/slicc/keys.json` is the user's OVERRIDE file for keyboard mode, seeded on first boot by\n `ui/wc/wc-shortcut-config.ts`. It ships with `\"trigger\": \"auto\"` and `\"bindings\": {}` — the\n keymap itself is `DEFAULT_KEYMAP` in `ui/wc/wc-shortcuts.ts`, and a test asserts the file binds\n nothing. `trigger` is `auto` | `esc` | `null` (Theme settings switches it live).\n- **Never list a binding here again.** v1 wrote its whole keymap into the seed, and because the\n file is applied OVER the defaults that pinned every install to v1 forever: no later map, and no\n key for any command added since, could reach anyone who had booted once. An empty bindings object\n is what makes the shipped map — and every future change to it — inheritable.\n- The one write beyond seeding is that migration: a file still holding the v1 map exactly\n (`isUntouchedV1Document`) is replaced once. Anything else, including v1 with one line changed,\n is the user's and is left alone — an edited config must survive every later boot. Theme settings\n may also rewrite `trigger` in place.\n- The `//` comment must name every `CommandId` (a test asserts it) and carries the v1 keymap as a\n paste-back block for anyone who wants the old keys. `s` maps to `sprinkles` there, not to a\n cycle command: `p`/`s` opens the first and the step keys walk the rest.\n\n### Sprinkles\n\n- Add built-in sprinkles under `packages/vfs-root/shared/sprinkles/<name>/`.\n- Keep the main file named `<name>.shtml` to match discovery and sprinkle naming conventions.\n\n### Sounds\n\n- Add shared sounds under `packages/vfs-root/shared/sounds/`.\n- Prefer stable filenames because shell commands and docs may reference them directly.\n\n## External Handoffs\n\n- Mechanism: RFC 8288 `Link` response header carrying `https://www.sliccy.ai/rel/handoff` or `https://www.sliccy.ai/rel/upskill` on a main-frame document response → `navigate` lick → cone approval card.\n- Agent-facing flow: `packages/vfs-root/workspace/skills/handoff/SKILL.md` (bundled to `/workspace/skills/handoff/SKILL.md`) and the trigger line in `shared/CLAUDE.md` (bundled to `/shared/CLAUDE.md`).\n- Protocol reference: `docs/slicc-handoff.md`.\n- When handoff behavior changes, keep the skill, `shared/CLAUDE.md`, and `docs/slicc-handoff.md` aligned — do not duplicate their content here.\n\n## Important Distinction\n\n`packages/vfs-root/shared/CLAUDE.md` is **agent-facing runtime content** bundled into the virtual filesystem.\n\nIt is different from the developer-facing `CLAUDE.md` files in the repository. Do not merge those roles together.\n";export{e as default};
1
+ var e="# CLAUDE.md\n\nThis file covers the default virtual filesystem payload in `packages/vfs-root/`.\n\n## What This Package Contains\n\n`packages/vfs-root/` is copied into the app's virtual filesystem on init/reset. It is content, not runtime code.\n\n## Directory Structure\n\n| Path | Purpose |\n| ------------------------------------- | ------------------------------------------------------------------------------------------ |\n| `packages/vfs-root/shared/` | Shared content that becomes `/shared/` in the VFS |\n| `packages/vfs-root/workspace/` | Default workspace content that becomes `/workspace/` in the VFS |\n| `packages/vfs-root/shared/CLAUDE.md` | Agent-facing runtime instructions bundled into `/shared/CLAUDE.md` |\n| `packages/vfs-root/shared/MEMORY.md` | User-editable memory curator config bundled as `/shared/MEMORY.md` |\n| `packages/vfs-root/shared/sprinkles/` | Built-in sprinkle UIs |\n| `packages/vfs-root/shared/sounds/` | Shared notification sounds |\n| `packages/vfs-root/workspace/skills/` | Default installable workspace skills |\n| `packages/vfs-root/etc/` | System config seeded into `/etc/` (`models`, `sudoers`, `APPROVALS.md`, `slicc/keys.json`) |\n\n## Adding Default Content\n\n### Memory curator\n\n- `shared/MEMORY.md` is the single source for the runner's build-time fallback and the seeded\n `/shared/MEMORY.md` file.\n- The file is seeded only when absent, so user and skill customizations survive later boots.\n- `MEMORY.md` is user-edited only; the curator intentionally cannot rewrite its own instructions.\n- Frontmatter uses a strict YAML subset: block-array items may have `#` comment tails; inline\n entries containing commas must be quoted. A bare `/` is rejected from `writablePaths`.\n- Frontmatter `allowedCommands` entries extend the curator's built-in base set; they do not\n replace or remove base commands.\n- The curator may rewrite the entire memory file, and the hard character budget\n applies to the entire file with no protected region.\n- **The curator edits a staged draft, never the live file.** `{{MEMORY_PATH}}` resolves to\n `/sessions/.curation/<archive>/draft.md`, seeded (with a `base.md` snapshot) from the live\n memory when the pass spawns; the agent bridge three-way-merges base→draft onto the live file\n on exit 0, before the success receipt (`mergeOnSuccess`). Concurrent live edits survive;\n conflicting regions resolve to the curator. A killed or failed run leaves the live memory\n untouched. The bridge also writes `/sessions/.curation/<archive>/status.json` on both exit\n paths (`outcomeReceiptPath`) — the durable ledger of which sessions completed vs failed\n curation; the index entry mirrors it as `memoryCuratedAt` / `memoryFailed`. Per-archive\n keying means parallel per-cone curators (#1666) never share staging state.\n- Every `##`/`###` memory section ends with a `YYYY-MM-DD` last-verified date, in UTC to match\n archive timestamps. Each pass re-verifies the oldest sections first; undated sections are\n maximally stale.\n- The curator's write grant is `/workspace/CLAUDE.md` alone, not `/workspace/`. It can run `upskill`\n to look up a skill for a pitfall it found, and a directory-wide grant would also let it install\n into `/workspace/skills/`. Reads still cover `/workspace/`. Single-file entries in\n `writablePaths` work because `generateScoopSudoers` emits both the bare path and the `/**` form.\n- The pass is detached, so it spawns with `notifyOnComplete`. Its closing message reaches the cone\n on the `scoop-notify` channel; that is where a skill suggestion lands. Without it the report is\n discarded and the cone never learns the pass ran.\n- Turn count is what a pass costs, because every turn re-reads the whole context as a cache read.\n Two things keep it down, and both belong to the prompt rather than the runtime: `thinkingLevel`\n (default `medium`; spawned agents otherwise resolve to `off`) so the curator plans the cut\n instead of converging by trial and error, and the archive reading recipes so it never `cat`s a\n multi-megabyte archive whose `slicc:session-data` block is a single line holding half the file.\n\n### Approver agent\n\n- `etc/APPROVALS.md` is the single source for the runner's build-time fallback and\n the seeded `/etc/APPROVALS.md`, exactly like `shared/MEMORY.md` is for the curator.\n `SudoManager.ensureDefaults()` does the seeding, when absent, on the ungated\n handle — the same place `/etc/sudoers` is seeded, and for the same reason: the\n file is self-protected, so anything else that had to create it (the `upgrade\napply` merge) would prompt the owner to approve the default already in force (#2686).\n- It lives in `/etc/` because it is POLICY, next to `sudoers` — not in `/shared/`,\n which is agent-visible content. Writes to it are self-protected in\n `base/sudoers.ts` (`isSelfProtectedWrite`) for the same reason writes to\n `/etc/sudoers` are: it decides what a GUEST may do, and a cone acting on a\n guest's message must not rewrite the rules gating that guest without the owner\n seeing a prompt.\n- Re-read on EVERY decision, not cached: an owner who tightens it after a bad\n call expects the next decision to use it. Missing or unreadable falls back to\n the bundled default rather than wedging approvals shut.\n- The optional ```yaml block tunes `timeoutSeconds` (clamped — a guest, and for\n a tool gate the cone's turn, is blocked on the decision), `model`, and\n `thinkingLevel`. Unreadable values fall back rather than becoming real.\n- The approver never reads this file itself; the runtime reads it and puts it in\n the prompt. The agent holds no write grant at all.\n\n### Skills\n\n- Add new built-in workspace skills under `packages/vfs-root/workspace/skills/<skill-name>/`.\n- Include `SKILL.md` and any companion assets or `.jsh` scripts the skill needs.\n\n### Keyboard shortcuts\n\n- `etc/slicc/keys.json` is the user's OVERRIDE file for keyboard mode, seeded on first boot by\n `ui/wc/wc-shortcut-config.ts`. It ships with `\"trigger\": \"auto\"` and `\"bindings\": {}` — the\n keymap itself is `DEFAULT_KEYMAP` in `ui/wc/wc-shortcuts.ts`, and a test asserts the file binds\n nothing. `trigger` is `auto` | `esc` | `null` (Theme settings switches it live).\n- **Never list a binding here again.** v1 wrote its whole keymap into the seed, and because the\n file is applied OVER the defaults that pinned every install to v1 forever: no later map, and no\n key for any command added since, could reach anyone who had booted once. An empty bindings object\n is what makes the shipped map — and every future change to it — inheritable.\n- The one write beyond seeding is that migration: a file still holding the v1 map exactly\n (`isUntouchedV1Document`) is replaced once. Anything else, including v1 with one line changed,\n is the user's and is left alone — an edited config must survive every later boot. Theme settings\n may also rewrite `trigger` in place.\n- The `//` comment must name every `CommandId` (a test asserts it) and carries the v1 keymap as a\n paste-back block for anyone who wants the old keys. `s` maps to `sprinkles` there, not to a\n cycle command: `p`/`s` opens the first and the step keys walk the rest.\n\n### Sprinkles\n\n- Add built-in sprinkles under `packages/vfs-root/shared/sprinkles/<name>/`.\n- Keep the main file named `<name>.shtml` to match discovery and sprinkle naming conventions.\n\n### Sounds\n\n- Add shared sounds under `packages/vfs-root/shared/sounds/`.\n- Prefer stable filenames because shell commands and docs may reference them directly.\n\n## External Handoffs\n\n- Mechanism: RFC 8288 `Link` response header carrying `https://www.sliccy.ai/rel/handoff` or `https://www.sliccy.ai/rel/upskill` on a main-frame document response → `navigate` lick → cone approval card.\n- Agent-facing flow: `packages/vfs-root/workspace/skills/handoff/SKILL.md` (bundled to `/workspace/skills/handoff/SKILL.md`); the agent reaches it through the injected skill index, not through `shared/CLAUDE.md`, which only states that handoffs are human-gated.\n- Protocol reference: `docs/slicc-handoff.md`.\n- When handoff behavior changes, keep the skill and `docs/slicc-handoff.md` aligned — do not duplicate their content here or in `shared/CLAUDE.md`.\n\n## Important Distinction\n\n`packages/vfs-root/shared/CLAUDE.md` is **agent-facing runtime content** bundled into the virtual filesystem.\n\nIt is different from the developer-facing `CLAUDE.md` files in the repository. Do not merge those roles together.\n";export{e as default};
@@ -0,0 +1 @@
1
+ var e="---\nname: playwright-cli\ndescription: |\n Use this whenever the user asks to browse, navigate, click, fill a form,\n scrape, take a screenshot, or otherwise interact with a web page. SLICC drives\n the browser through the `playwright-cli` shell command (also aliased as\n `playwright` and `puppeteer`). Read this BEFORE running any browser\n automation: every tab-operating command requires a `--tab` target id, and\n multi-agent tab handling has rules you must follow.\nallowed-tools: bash\n---\n\n# Browser Automation via playwright-cli\n\nUse `playwright-cli` (also aliased as `playwright` and `puppeteer`) via the bash tool for all browser automation.\n\n**Every tab-operating command requires `--tab=<targetId>`.** There is no implicit \"current tab\". Always specify which tab you're operating on.\n\n`playwright-cli <command> --help` prints that command's usage and does nothing else — safe to run before any action.\n\n## Quick Start\n\n```bash\n# 1. Open a page — note the targetId in the output\nplaywright-cli open https://example.com\n# Output: Opened https://example.com in new tab [targetId: E9A3F...]\n\n# 2. Take a snapshot to see the page structure and get element refs\nplaywright-cli snapshot --tab=E9A3F\n\n# 3. Interact using refs from the snapshot (e.g. e5, e12)\nplaywright-cli click --tab=E9A3F e5\nplaywright-cli fill --tab=E9A3F e12 \"hello world\"\n\n# 4. Re-snapshot after interactions (refs change)\nplaywright-cli snapshot --tab=E9A3F\n```\n\n## Tab IDs\n\n- `tab-list` shows all tabs with their targetIds. The user's active tab is marked `(active)`.\n- `tab-new` / `open` return the new tab's targetId — capture it for subsequent commands.\n- Use `--tab=<targetId>` on ALL commands that operate on a tab.\n\n## Frame IDs\n\n- `frames --tab=<targetId>` lists frame IDs. A frame ID is not a tab target ID; never pass it to `--tab`.\n- Use `--tab=<targetId> --frame=<frameId>` with `eval`, `eval-file`, or `snapshot` to target a child frame, including cross-origin frames.\n- A frame-scoped `snapshot` prints only that frame's accessibility subtree. Its frame-prefixed refs work with `click`, `fill`, `dblclick`, `hover`, `select`, `check`, and `uncheck`; do not pass `--frame` to those commands. Other ref commands require refs from a top-level snapshot.\n\n## Common Failure Modes\n\n- `--tab <targetId> is required` — you forgot `--tab=<id>`. Run `tab-list` to get IDs.\n- `is a frame ID, not a tab target ID` — keep the owning tab's targetId in `--tab` and pass the frame ID with `--frame`.\n- `No snapshot available` — run `snapshot --tab=<id>` before using refs.\n- `unknown flag \"--x\"` / `unexpected argument \"y\"` — every subcommand rejects arguments it does not\n support, so an exit code of 0 means everything you passed was honoured. Check `<verb> --help`.\n- For free-text payloads that start with `-` (e.g. `fill`/`type`/`eval`), put `--` before the text:\n `fill --tab=<id> e1 -- --dash-looking`.\n- `is not an element ref` — a screenshot's positional is a main-frame element ref (`e5`); the output\n path is `--filename=<path>`. Frame-prefixed refs (`f1e5`) clip only with `click`-family commands.\n- Refs are tied to **one tab + one snapshot**. They do not carry across tabs, navigations, or reloads.\n\n## Element Refs\n\nSnapshots assign short ref IDs (`e1`, `e2`, ...) to interactive elements. Use these refs with `click`, `fill`, `dblclick`, `hover`, `select`, `check`, `uncheck`, `drag`, `upload`, `drop`, and `screenshot`.\n\nRefs are invalidated after any state-changing command. Always re-snapshot to get fresh refs.\n\n## Commands\n\nAll commands below that operate on a tab require `--tab=<targetId>`.\n\n### Core\n\n```bash\nplaywright-cli open [url] [--foreground] [--mobile] # Open tab (background by default), returns targetId\nplaywright-cli tab-new [url] [--foreground] [--mobile] # Same as open\nplaywright-cli tab-close --tab=<id> # Close tab (alias: close)\nplaywright-cli goto --tab=<id> <url> # Navigate tab\nplaywright-cli navigate --tab=<id> <url> # Alias for goto\nplaywright-cli snapshot --tab=<id> [--frame=<frameId>] [--no-iframes] [--filename=path] [--depth=<n>] [--boxes] # Tab tree or one frame subtree; --depth limits nesting, --boxes adds [box=x,y,w,h] rects\nplaywright-cli find --tab=<id> <text> # Search the snapshot for text (case-insensitive), returns matching lines + context\nplaywright-cli find --tab=<id> --regex=<re> # Same, with a regexp (use either text or --regex, not both)\nplaywright-cli eval --tab=<id> [--frame=<frameId>] <expression> [--filename=path|--output=path] # Evaluate JS in a tab/frame, incl. top-level await/return; use `--` before an expression that starts with `-`\nplaywright-cli eval-file --tab=<id> [--frame=<frameId>] <vfs-path> [--output=path|--filename=path] # Evaluate JS from a VFS file in a tab/frame (top-level await/return supported)\nplaywright-cli frames --tab=<id> # List frame IDs for --frame (not --tab)\nplaywright-cli resize --tab=<id> <width> <height> # Resize viewport\n```\n\n`--foreground` (or `--fg`) opens the new tab **in the foreground** — it brings the\nnew tab to the front and switches the user's visible/active tab to it, instead of\nopening in the background.\n\n**Bringing a tab to the foreground (activate / focus / raise / switch to a tab):**\n\n- **New tab** → `open <url> --foreground` (or `tab-new <url> --fg`).\n- **Existing tab** → `tab-select <index>` (1-based index from `tab-list`).\n\n`--mobile` opens the tab with generic mobile-device emulation (viewport,\ndevice pixel ratio, touch, Android Chrome UA), sticky for the tab's lifetime —\na later `resize` changes only the dimensions and keeps the mobile identity.\nMobile pages are usually lighter, which saves tokens.\n\nThese two are the ONLY ways to change which tab is in front. There is no\n`activate`, `bring-to-front`, or `focus` subcommand, and `eval`-ing\n`window.focus()` does NOT work (browsers block a page from stealing foreground).\nIf a tab didn't come to the front, re-run `tab-select` / `--foreground` — do not\nfall back to `window.focus()`.\n\n### Interaction\n\n```bash\nplaywright-cli click --tab=<id> <ref> [--modifiers=Shift,Control,Alt,Meta] # Click element\nplaywright-cli dblclick --tab=<id> <ref> [button] [--modifiers=...] # Double-click\nplaywright-cli fill --tab=<id> <ref> <text> [--submit] # Clear input + type text (--submit presses Enter); use `--` before text that starts with `-`\nplaywright-cli type --tab=<id> <text> [--submit] # Type into focused element (--submit presses Enter); use `--` before text that starts with `-`\nplaywright-cli hover --tab=<id> <ref> # Hover over element\nplaywright-cli select --tab=<id> <ref> <value> # Select dropdown value\nplaywright-cli check --tab=<id> <ref> # Check checkbox/radio\nplaywright-cli uncheck --tab=<id> <ref> # Uncheck checkbox/radio\nplaywright-cli drag --tab=<id> <startRef> <endRef> # Drag and drop\nplaywright-cli upload --tab=<id> [ref] <file> [file...] # Upload VFS files to file input as raw bytes (optional snapshot ref targets hidden inputs)\nplaywright-cli drop --tab=<id> <ref> [--path=<vfs-path>] [--data=<mime/type=value>] # Drop files/data onto element (--path drops raw bytes)\nplaywright-cli dialog-accept --tab=<id> [text] # Accept JS dialog\nplaywright-cli dialog-dismiss --tab=<id> # Dismiss JS dialog\n```\n\n### Keyboard\n\n```bash\nplaywright-cli press --tab=<id> <key> # Press key (keyDown + keyUp, e.g. Enter, Tab, Escape)\nplaywright-cli keydown --tab=<id> <key> # Hold key down (no paired keyUp)\nplaywright-cli keyup --tab=<id> <key> # Release held key (no paired keyDown)\n```\n\n### Mouse\n\n```bash\nplaywright-cli mousemove --tab=<id> <x> <y> # Move mouse to coordinates (negative coords ok, e.g. -10 20)\nplaywright-cli mousedown --tab=<id> [button] # Press mouse button (left/right/middle, default: left)\nplaywright-cli mouseup --tab=<id> [button] # Release mouse button\nplaywright-cli mousewheel --tab=<id> <dx> <dy> # Scroll mouse wheel (negative deltas ok, e.g. 0 -300)\n```\n\n### Navigation\n\n```bash\nplaywright-cli go-back --tab=<id> # history.back()\nplaywright-cli go-forward --tab=<id> # history.forward()\nplaywright-cli reload --tab=<id> # Reload page\n```\n\n### Teleport\n\n```bash\nplaywright-cli teleport --tab=<id> --start=<regex> --return=<regex> [--timeout=<s>]\nplaywright-cli teleport --list # List available follower runtimes\nplaywright-cli teleport --off --tab=<id> # Cancel a teleport on this tab\nplaywright-cli open <url> --teleport-start=<regex> --teleport-return=<regex>\nplaywright-cli goto --tab=<id> <url> --teleport-start=<regex> --teleport-return=<regex>\n```\n\nTeleport is for leader/follower tray auth handoffs. Scoped to a specific tab — only commands targeting the teleporting tab are blocked; other tabs remain operational.\n\n`--runtime` is optional: without it, teleport picks the most recently active eligible follower (preferring standalone floats). Only followers that can actually serve cookies are eligible — cherry hosts, exec-only CLI followers, and any target advertising `network: false` are excluded, so a teleport fails fast instead of \"succeeding\" with zero cookies.\n\n### Screenshots\n\n```bash\nplaywright-cli screenshot --tab=<id> # Save to $TMPDIR/screenshot-<ts>.png\nplaywright-cli screenshot --tab=<id> --filename=page.png # Save to custom path\nplaywright-cli screenshot --tab=<id> e5 # Clip to an element (positional = MAIN-FRAME ref, not a path)\nplaywright-cli screenshot --tab=<id> --fullPage # Full scrollable page (alias: --full-page)\nplaywright-cli screenshot --tab=<id> --max-width=800 # Downscale to a max width (png output only)\nplaywright-cli screenshot --tab=<id> --type=jpeg # png (default) / jpeg / webp; inferred from --filename extension\nplaywright-cli screenshot --tab=<id> --hires # Capture in device pixels (honors device pixel ratio)\n```\n\nAn element screenshot (`screenshot e5`) returns **that element's crop or fails**\n(exit 1) — typically because the snapshot went stale after a navigation or\nlayout change. Re-run `snapshot` and retry with a fresh ref; it never silently\nsubstitutes a full-viewport frame.\n\nA `resize` sticks to its tab: the viewport override is re-applied automatically\nwhenever the tab is re-attached, so another driver switching tabs cannot reset\nit.\n\nAll playwright-cli commands share one browser and run **serialized**. When\nconcurrent callers (e.g. parallel scoops) queue up, commands may emit a\n`note: browser bridge contended — ...` line on stderr with the total lock wait\nand queue depth — treat it as a signal to stagger callers or reduce fan-out\nrather than re-running commands.\n\n### Save As\n\n```bash\nplaywright-cli pdf --tab=<id> [--filename=path] # Save page as PDF (not available in extension mode)\n```\n\n### Viewing pages and screenshots yourself\n\nThe browser displays things to the human; `open --view` is what lets _you_ see them. **But viewing screenshots is a last resort for the cone — every image you load eats a large chunk of the context window** (a single 1280×800 PNG can run 1500+ tokens, full-page screenshots much more). Reach for cheaper signals first:\n\n1. **`playwright-cli snapshot --tab=<id>`** — text accessibility tree. Use this first; it answers \"what's on the page\" for almost all verification tasks at a tiny fraction of the token cost. On a big page, `find --tab=<id> <text>` greps the snapshot and returns just the matching lines with context, and `snapshot --depth=<n>` caps the tree — both much cheaper than the full tree.\n2. **`eval` against the DOM** — when you need a specific value (`document.title`, an attribute, computed style), `eval` it. Don't screenshot for facts you can extract.\n3. **Delegate visual inspection to a scoop.** If the cone genuinely needs vision (layout regression, render fidelity, \"does this look right\"), spawn a scoop to take and view the screenshot — the scoop's context absorbs the tokens, and you receive its summary back. The cone's window stays clean for orchestration.\n4. **`open --view` in the cone** — only when the cone itself must see pixels for its current decision and steps 1–3 won't do.\n\n**What you CAN see:**\n\n- `open --view <path>` — reads an image from the VFS and returns it. Works with PNG, JPEG, GIF, WebP, SVG.\n- `playwright-cli screenshot --tab=<id>` + `open --view <path>` — screenshot a tab, then view it.\n- `screencapture --view screenshot.png` — capture the user's screen via browser screen sharing.\n- `playwright-cli snapshot --tab=<id>` — accessibility tree (text). Use to verify content without vision.\n\n**What only the human sees:**\n\n- `serve <dir>` — opens an app directory in a browser tab (read-only preview).\n- `serve --ttl 30d <dir>` — uploads an immutable snapshot that works without the leader. TTL units are whole `m`, `h`, `d`, or `w`, capped at 30 days. It implies `--no-bridge`, conflicts with `--bridge`/`--max-tabs`, and is limited to 1,000 files, 25 MiB per file, and 50 MiB total. Use `serve --list` for mode/expiry and `serve --stop <token>` to revoke it early.\n- `serve --bridge <dir>` — opens a **driveable** preview whose visitors auto-connect as live synthetic-CDP targets you can navigate/click/evaluate/screenshot via playwright. **Security: opt-in only; cross-subdomain cookie risk accepted (host-only cookies isolated; `Domain=.sliccy.now` cookies readable across previews).** Flags: `--max-tabs <N>` (default 20), `--quiet` (suppress the first-visit announcement), `--no-bridge` (force read-only), `--stop <token>` (revoke + delete webhook). Use `serve --logs [<token>] [--lines <N>]` to inspect leader-memory-only connect/disconnect records without emitting a lick or waking the cone. `serve --truncate [<token>]` clears matching records **and re-arms the first-visit announcement**, so the next visit announces once. Visitor page API: `window.slicc.emit(name, detail?)` (fires webhook lick on cone), `window.slicc.on(name, cb)` (subscribes to CustomEvents you dispatch).\n- `open <path>` (no flags) — opens a file in a browser tab.\n- `imgcat <path>` — displays an image in the terminal preview.\n\n**Workflow to verify a page (when vision is actually required):**\n\n1. `serve /workspace/app` — open the app (the human sees it).\n2. `playwright-cli tab-list` — find the tab by URL, note the targetId.\n3. `playwright-cli snapshot --tab=<id>` — required before screenshot, and often answers your question on its own.\n4. `playwright-cli screenshot --tab=<id> --filename=\"$TMPDIR/shot.png\"` — consider `--max-width` to keep the file small.\n5. `open --view \"$TMPDIR/shot.png\"` — now you can see it. Strongly prefer doing this from a scoop, not the cone.\n\n**Don't:**\n\n- Default to screenshots when a snapshot would do.\n- `read_file` on a PNG or base64-encode to view images.\n- `imgcat` or `cat` on screenshots expecting to see them.\n- Open a screenshot then screenshot that tab.\n- Use `eval` to check the active tab — use `tab-list`.\n\n### Tab Management\n\n```bash\nplaywright-cli tab-list # List tabs with targetIds + (active) marker\nplaywright-cli tab-new [url] # New tab, returns targetId\nplaywright-cli tab-close --tab=<id> # Close specific tab\nplaywright-cli tab-select <index> # Select (bring to front) tab by 1-based index\n```\n\n### Cookies\n\n```bash\nplaywright-cli cookie-list --tab=<id> [--domain=<d>] [--path=<p>] # List cookies (filter by domain/path)\nplaywright-cli cookie-get --tab=<id> <name> # Get cookie\nplaywright-cli cookie-set --tab=<id> <name> <value> [--sameSite=Strict|Lax|None] [other flags] # Set cookie\nplaywright-cli cookie-delete --tab=<id> <name> [--domain= --path=] # Delete cookie\nplaywright-cli cookie-clear --tab=<id> # Clear all cookies\n```\n\n### Storage\n\n```bash\nplaywright-cli localstorage-list --tab=<id>\nplaywright-cli localstorage-get --tab=<id> <key>\nplaywright-cli localstorage-set --tab=<id> <key> <value>\nplaywright-cli localstorage-delete --tab=<id> <key>\nplaywright-cli localstorage-clear --tab=<id>\n# Same pattern for sessionstorage-*\nplaywright-cli state-save --tab=<id> [filename|--filename=path] # Save cookies + localStorage to JSON\nplaywright-cli state-load --tab=<id> <filename> # Restore from state file\n```\n\n### Network\n\n```bash\nplaywright-cli console --tab=<id> [min-level] [--clear] # List console messages (debug/log/info/warning/error)\nplaywright-cli requests --tab=<id> [--static] [--filter=<regex>] [--clear] # List network requests\nplaywright-cli request --tab=<id> <index> [--filename=path] # Full request details\nplaywright-cli request-headers --tab=<id> <index> # Request headers only\nplaywright-cli request-body --tab=<id> <index> # Request body only\nplaywright-cli response-headers --tab=<id> <index> # Response headers only\nplaywright-cli response-body --tab=<id> <index> [--filename=path] # Response body (--filename saves the exact bytes)\nplaywright-cli network-state-set --tab=<id> <online|offline> # Toggle network state\nplaywright-cli route --tab=<id> <pattern> [--status=N] [--body=text] [--content-type=type] [--header=name:value]\nplaywright-cli route-list --tab=<id> # List active routes\nplaywright-cli unroute --tab=<id> [pattern] # Remove routes (all if no pattern)\n```\n\n### DevTools\n\n```bash\nplaywright-cli generate-locator --tab=<id> <ref> # Generate Playwright locator string for element\nplaywright-cli highlight --tab=<id> <ref> [--style=<css>] # Highlight element with visual overlay\nplaywright-cli highlight --tab=<id> --hide [ref] # Remove highlight (all if no ref)\n```\n\n### HAR Recording\n\n```bash\nplaywright-cli record [url] [--filter=<js-expr>] # Open tab with network recording\nplaywright-cli stop-recording <recordingId> # Stop and save HAR\n```\n\n## Multi-Agent Tab Behavior\n\n**All agents (cone + scoops) share the same tab namespace.** There is no tab isolation.\n\n- `tab-list` shows **every** tab from every agent — yours, the cone's, other scoops'. The list can be noisy.\n- Any agent can `eval`, `snapshot`, or `close` any tab — there are no ownership checks.\n- Tab counts fluctuate as other agents open and close tabs concurrently.\n\n**Best practices for scoops:**\n\n1. **Track your own tab IDs.** When you open a tab, capture the targetId and store it. Don't rely on `tab-list` to find your tabs later — other agents' tabs will be mixed in.\n\n ```bash\n # Open and capture the ID\n playwright-cli tab-new https://example.com\n # Output: Opened https://example.com in new tab [targetId: ABC123...]\n # Use ABC123 for all subsequent commands on this tab\n ```\n\n2. **NEVER close tabs you didn't open.** Tabs you don't recognize belong to the **user** or other agents. User tabs are off-limits unless the user explicitly asks you to close them. Only close tabs whose targetId you captured from your own `tab-new` / `open` calls.\n\n3. **Handle \"tab not found\" gracefully.** Another agent might close a tab between your `tab-list` and your command. If you get `Error: No tab with id`, the tab is gone — move on.\n\n4. **Don't depend on tab count or ordering.** Other agents are opening/closing tabs concurrently. Use targetIds, not positional logic.\n\n5. **Clean up when done.** Close all tabs you opened before finishing. Include this in every scoop brief:\n _\"Close each tab with `playwright-cli tab-close --tab=<id>` when done.\"_\n\n## Tips\n\n- **Refs change after every interaction** — always re-snapshot before clicking or filling.\n- `open` and `tab-new` open tabs in the **background** by default. Capture the targetId from the output. To open in the **foreground** add `--foreground`/`--fg`; to raise an **already-open** tab use `tab-select <index>`.\n- After `click`, `fill`, `goto`, `go-back`, `go-forward`, `reload`, `select`, `check`, `uncheck`, `drag`, or `dialog-*`, take a fresh `snapshot --tab=<id>` before using refs again.\n- Unexpected JavaScript dialogs are auto-dismissed on attached pages.\n- Use `eval --tab=<id>` for DOM operations not covered by built-in commands; save results with `--filename=path`.\n- The SLICC app tab and Chrome internal UI tabs are automatically excluded from `tab-list`.\n- `fill` clears and types into regular inputs, textareas, and `contenteditable` elements. Use `--submit` to press Enter after. If the text or an `eval` expression starts with `-`, put `--` before it so it is not parsed as a flag.\n- Negative numbers for `mousewheel` / `mousemove` are positionals (no `--` needed): `mousewheel --tab=<id> 0 -300`.\n- `drop --path=<vfs-path>` injects the file as **raw bytes**; a UTF-8 text round-trip would replace every byte >= 0x80 with `EF BF BD`, so mp4/zip/jpg drops stay byte-exact.\n- Screenshots default to `$TMPDIR/screenshot-<timestamp>.png` — your own scratch directory, not the shared root. Use `--filename=path` to save elsewhere —\n `screenshot <path>` is an error, because that slot is the element ref.\n- Unsupported flags and extra positionals are rejected per subcommand, so a probe that exits 0 means\n the flag was honoured — nothing is silently dropped.\n- Use `keydown`/`keyup` for holding modifier keys (e.g. Shift+click: `keydown Shift`, `click`, `keyup Shift`).\n- Use `requests` + `response-body` to inspect XHR/fetch responses; `route` to mock or block them.\n- **Calling the app's own backend? Use `curlwright`, not `eval-file`.** It is curl's flags run by a `fetch()` inside the tab, so cookies, origin and session come along: `curlwright -s -X POST https://app.example.com/api/items -H 'X-CSRF-Token: abc' -d '{\"name\":\"x\"}' --tab=<id>`. `-o <file>` writes a **byte-exact** body, which `eval-file` cannot do at all — that is the only way to pull a binary response out of a page. Without `--tab` it uses the tab already on that origin. `curlwright --help` for the flag list.\n- `state-save` / `state-load` persist auth state (cookies + localStorage) across sessions.\n- `pdf` saves a print-layout PDF; not available in extension mode.\n- `upload` injects VFS files as **raw bytes** (a UTF-8 text round-trip would replace every byte ≥ 0x80 with `EF BF BD`). A leading `eN` / `fNeN` token is a snapshot ref, never a filename — run `snapshot` first; without a ref, focus the file input first. To upload a file named `e2`, pass `./e2` or an absolute path.\n\n## Low-level CDP escape hatch\n\nFor raw Chrome DevTools Protocol calls that `playwright-cli` doesn't wrap, send JSON-RPC directly over WebSocket with `websocat`:\n\n```bash\n# Discover the page's debug socket URL via the CDP HTTP endpoint\ncurl -s http://127.0.0.1:9222/json | jq -r '.[0].webSocketDebuggerUrl'\n\n# Send a single CDP method, receive the response, exit\necho 'Page.navigate {\"url\":\"https://example.com\"}' \\\n | websocat -1 --jsonrpc --jsonrpc-omit-jsonrpc ws://127.0.0.1:9222/devtools/page/<id>\n```\n\nRun `websocat --help` for the full flag list. Use this only when `playwright-cli` has no wrapper for the CDP method you need.\n";export{e as default};
@@ -1 +1 @@
1
- var e="---\nname: skill-authoring\ndescription: |\n Use this when the user wants to write a new skill, edit an existing one, or\n understand SLICC's skill system. Covers SKILL.md frontmatter (name,\n description, allowed-tools), how to write a description that triggers\n reliably, native `/workspace/skills/` vs compatibility `.agents/` /\n `.claude/skills/` discovery, and when to ship companion files like `.jsh`\n scripts or `.bsh` browser hooks.\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Skill authoring\n\nA skill is a folder with a `SKILL.md` (and optional companion files) that loads into the agent's system prompt when the description matches the user's intent. This skill is about authoring those folders well.\n\n## Discovery\n\nSLICC discovers five kinds of skill roots:\n\n| Root | Source | Mutability |\n| ------------------------------------------------------------ | -------------------------------------------- | ----------------------------------- |\n| `/workspace/skills/<name>/SKILL.md` | Bundled or installed via `upskill` | Install-managed; you can edit them |\n| `.agents/skills/<name>/SKILL.md` (anywhere) | Compatibility (Cursor / SuperClaude) | Read-only (discovered, not managed) |\n| `.claude/skills/<name>/SKILL.md` (anywhere) | Compatibility (Claude Code) | Read-only (discovered, not managed) |\n| `<mount>/.claude-plugin/marketplace.json` → plugin `skills/` | Claude Code marketplace (mounted repos) | Read-only (discovered, not managed) |\n| `<plugin-root>/skills/<name>/SKILL.md` | Agent Plugins installed via `plugin install` | Read-only (discovered, not managed) |\n\nSkills under `/workspace/skills/` installed with `upskill` carry a `.upskill` provenance record (source, ref, commit, file list) that `upskill update [--dry-run]` uses to refresh them. `upskill` never modifies or deletes a **dotfile** in a skill directory, so that is where a skill should keep its credentials and local state (`scripts/.config`) — everything else is replaced on update.\n\nThe marketplace root is auto-discovered: when a mounted directory contains `.claude-plugin/marketplace.json`, SLICC reads the manifest, resolves each plugin's `source` path, and discovers skills at `<plugin-source>/skills/<name>/SKILL.md`. No install step needed — mount the repo and the skills are live immediately. Agent Plugins (agent-plugins.org packages with a `plugin.json` manifest) require an explicit `plugin install <path|repo>` — `<repo>` may be a local directory or a GitHub reference (`owner/repo`, `owner/repo@branch`, or a `https://github.com/owner/repo[/tree/branch[/dir]]` URL, downloaded into `/workspace/.plugins/sources/`); their skills then surface automatically. Precedence: native > agents > claude > marketplace > plugin.\n\nWhen you create a new skill **for SLICC**, put it in `/workspace/skills/<name>/`. The `.agents/`, `.claude/`, and marketplace paths exist so SLICC can pick up skills authored for other agents without modification — don't create new skills there.\n\n## SKILL.md structure\n\n```markdown\n---\nname: <slug>\ndescription: |\n Use this when ...\n ... (1–3 sentences explaining trigger conditions, what's covered, and what's\n NOT covered if there's a sibling skill that handles related topics.)\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Title (matches `name`)\n\n... body ...\n```\n\n### Frontmatter fields\n\n- **`name`** — lowercase, kebab-case. Must match the folder name. This is what `skill list` shows.\n- **`description`** — the trigger string. The agent uses this to decide whether to load the skill. Get this right; everything else is secondary.\n- **`allowed-tools`** — comma-separated list of tools the skill needs. Without this, the agent may load the skill but find it can't execute the steps. Common values:\n - `bash` — almost every skill.\n - `read_file, write_file, edit_file` — for skills that author files (sprinkles, config edits, three-way merges).\n - Omit only for purely informational skills.\n\n### Writing a good description\n\nThe description is a trigger, not a summary. It runs through the agent at every turn — too vague and the skill loads when irrelevant; too narrow and it doesn't load when needed.\n\n**Pattern that works**: \"Use this when \\<user-facing trigger\\>. Covers \\<topics\\>. \\[For \\<adjacent topic\\> use \\<sibling skill\\>.\\]\"\n\nCompare:\n\n- ❌ `description: Licks, webhooks, cron tasks, viewing pages/images, screencapture, onboarding`\n Keyword soup. The agent has to guess what \"licks\" or \"screencapture\" mean for this user.\n- ✅ `description: Use this when setting up event-driven automation in SLICC — webhooks, cron tasks, or filesystem watchers that route events to scoops. Covers webhook, crontask, and fswatch. Read this BEFORE wiring anything that should fire on a schedule, an HTTP call, or a VFS change.`\n Names the user intent (\"setting up event-driven automation\"), names the commands the agent will reach for, and tells the agent when to load it.\n\nRules of thumb:\n\n- Lead with **\"Use this when...\"** or **\"Use this whenever...\"**.\n- Name the **user-facing trigger** (what the user said), not just the implementation.\n- If there's a closely-named sibling skill (dips vs sprinkles, mount vs other storage), say which is which inside the description so the agent doesn't load both.\n- Multi-line YAML scalars are fine for longer descriptions — use the `|` block style.\n\n## Body conventions\n\n- Lead with one sentence stating what the skill is. No preamble.\n- Use tables for option matrices (commands × flags, tradeoffs, etc.).\n- Code blocks are bash unless otherwise needed.\n- Include a \"Don't\" or \"Common errors\" section near the end if the skill is failure-prone — the agent will read it before acting.\n- If the skill is large (> ~150 lines), split a reference table or example gallery into a companion `<topic>.md` and have the SKILL.md `read_file` it on demand. The `sprinkles/` skill (style-guide.md) and `dips/` skill (patterns.md) follow this pattern.\n\n## Companion files\n\n### `.jsh` — JavaScript shell scripts\n\n`.jsh` files on the shell's `$PATH` search roots are auto-discovered as shell commands. **Full reference: `./jsh-runtime-extensions.md`.**\n\n- **Auto-discovery**: registered as callable commands by filename (without the extension), from the `$PATH` roots — `/workspace/skills`, `/workspace/.mcp/aliases`, `/workspace/bin`, `/shared/bin` by default. A skill can ship its own commands by including a `.jsh` next to `SKILL.md`. Earlier roots win basename collisions, so `/workspace/skills/` wins. For commands elsewhere, add their dir to the PATH: `echo 'export PATH=\"$PATH:/my/tools\"' >> ~/.profile`.\n- **Dual-mode**: works in both the CLI server and the Chrome extension (sandbox iframe). Don't rely on CLI-only Node modules.\n- **Top-level `await`**: scripts are wrapped in `AsyncFunction`, so `await` at the top level works. Prefer it — errors surface instead of becoming unhandled rejections. Fire-and-forget `.then()`, unawaited `main()`, and `setTimeout` also keep the realm alive: like Node, the process stays up while I/O (fs/exec/fetch) or timers are outstanding, and `process.exit()` skips the rest. A Promise with no handle (`new Promise(() => {})`) does **not** keep it alive.\n\n#### Runtime surface (use these — don't reinvent)\n\nNode-standard bare globals:\n\n| Global | Use for |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `process` | `argv`, `env`, `cwd()`, `exit(code)`, `stdout.write`, `stderr.write`; `stdin` is one-shot buffered (no streaming) — `read()`, events, or async iterator, drain once |\n| `console` | `log`/`info` → stdout, `warn`/`error` → stderr |\n| `fetch` | Standard `fetch` routed through SLICC's proxied transport (cookies + CORS handled). |\n| `require(p)` | Synchronous CJS `require`. Use `require('sliccy:<name>')` for capability bridges and `require('fs')` for the VFS bridge (see below). |\n| `__dirname` / `__filename` | CJS scope vars — the script's own directory and absolute path. |\n\nCapability bridges via `require('sliccy:<name>')` (full reference: `./jsh-runtime-extensions.md`):\n\n| `require('sliccy:<name>')` | Use for |\n| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `sliccy:exec` | Callable `exec(cmd)` + `.spawn(argv[])`. Composes with any supplemental command or `.jsh` script. |\n| `sliccy:agent` | Callable `agent(prompt, opts?)` → sub-scoop final text (parsed when `schema` set) + `.spawn(...)` → `{ finalText, exitCode, stderr }`. `opts`: `model`, `thinking`, `cwd`, `allowedCommands`, `readOnly`, `schema`. |\n| `sliccy:skill` | `dir` / `refs` / `assets` / `config()` / `token(providerId)` — script-relative paths and provider tokens. |\n| `sliccy:http` | `http.client({ baseUrl, token, headers, retry, timeoutMs })` — standard API-client builder. |\n| `sliccy:browser` | `findTab`, `ensureTab`, `eval`, `evalAsync`, `cookie`, `localStorage`, `fetch`, `websocket.on(...)`. |\n| `sliccy:usb` / `sliccy:serial` / `sliccy:hid` | `list()` / `request()` + device methods. Chromium-only. |\n| `sliccy:cli` | `die(msg, opts?)`, `out(value)`, `warn(msg, opts?)`, `help(text)`. |\n| `sliccy:color` | ANSI helpers (`green`, `red`, `bold`, `dim`, …) auto-disabled on non-TTY / `NO_COLOR`. |\n| `sliccy:time` | `parseDuration`, `ago`, `range`, `future`, `gmailDate`. |\n| `sliccy:fmt` | `trunc`, `col`, `table`, `date`. |\n| `sliccy:pool` | `pool(n, items, fn)` — bounded concurrency runner. |\n\nVFS bridge:\n\n| `require('fs')` / `require('node:fs')` | `readFile`, `writeFile`, `readFileBinary`, `writeFileBinary`, `readDir`, `exists`, `stat`, `mkdir`, `rm`, `fetchToFile` — all paths are VFS, async. There is no bare `fs` global. |\n| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n\n#### Runtime extensions (live — prefer these over hand-rolled equivalents)\n\nReach these via `require('sliccy:<name>')`. Full reference: `./jsh-runtime-extensions.md`. Use them instead of reimplementing the cross-skill patterns they replace.\n\n- **`process.argv.parseFlags()`** — returns `{ positional, flags, subcommand }`. Replaces the per-skill `--flag=val` / `--flag val` parsing loop.\n- **`require('sliccy:browser')`** — `findTab({ domain | urlMatch })`, `ensureTab(url)`, `eval(tab, fn)`, `evalAsync(tab, fn)`, `cookie(tab, name)`, `localStorage(tab, key)`. Replaces shelling out to `playwright-cli tab-list` and regex-parsing its output.\n- **`browser.fetch(tab, url, opts)`** — page-context fetch (runs inside the tab's origin, so cookies + same-origin headers are automatic). Replaces the `eval-file` temp-file + double-JSON-unwrap dance.\n- **`browser.websocket.on(tab, …).filter({…}).forward({ sink })`** — declarative WebSocket observer with a closed sink set (`webhook` / `scoop` / `vfs` / `log`). **Required** for any new WS-watch use case; do not author page-context `WebSocket.prototype` patches in skill code.\n- **`require('sliccy:http').client({ baseUrl, token, headers, retry })`** — `get`/`post`/`put`/`delete` with merged headers, lazy token resolution, and Retry-After-aware backoff for `retry.on` statuses.\n- **`require('sliccy:skill')`** — `dir` / `refs` / `assets` / `config()` / `token(providerId)`: replace the per-skill `process.argv[1]` dirname math, ad-hoc `.config` JSON readers, and bespoke `oauth-token` shell-outs.\n\nShip a `.jsh` when the skill needs deterministic, parameterizable behavior the agent shouldn't have to re-derive each time (e.g. a `slicc-handoff` helper, a custom diff formatter, a domain-specific lint).\n\n### `.bsh` — browser shell scripts\n\n`.bsh` files auto-execute when the browser navigates to a matching URL:\n\n- **Filename = hostname pattern**: `-.okta.com.bsh` matches `*.okta.com`.\n- **`// @match` directive**: restrict to specific URL patterns in the first 10 lines.\n- Same execution engine as `.jsh`.\n\nUse `.bsh` for site-specific automations — auto-fillers, lick-emitters, or page transforms that should run whenever the user lands on a particular host.\n\n## Filesystem at a glance\n\nThe VFS is stored in IndexedDB; it survives tab closes and refreshes. The `mount` shell command bridges remote storage (local folders, S3-compatible, Adobe DA) into VFS paths — see `/workspace/skills/mount/SKILL.md`.\n\nThe VFS supports symbolic links transparently:\n\n```bash\nln -s /workspace/skills /workspace/skill-link # Create symlink\nreadlink /workspace/skill-link # Read link target\nls -la /workspace/ # Shows symlinks with -> target\n```\n\n`cat`, `read_file`, `write_file` etc. follow symlinks automatically.\n\n**Mount points must be empty.** Mounting over existing files is blocked so built-in skills and scripts stay discoverable. `ln -s` mounted files into the place where you need them.\n\n## Don't\n\n- Don't ship a skill without a description that starts with \"Use this when...\" — the trigger field IS the skill from the agent's perspective.\n- Don't put `name:` in Title Case. Lowercase kebab-case. Match the folder.\n- Don't dump shell-command catalogs into a SKILL.md just because they're related — `commands` already lists them. Skills are for **patterns and policy**, not reference material.\n- Don't author skills under `.agents/skills/` or `.claude/skills/`. Those roots are for compatibility discovery from other agents.\n";export{e as default};
1
+ var e="---\nname: skill-authoring\ndescription: |\n Use this when the user wants to write a new skill, edit an existing one, or\n understand SLICC's skill system. Covers SKILL.md frontmatter (name,\n description, allowed-tools), how to write a description that triggers\n reliably, native `/workspace/skills/` vs compatibility `.agents/` /\n `.claude/skills/` discovery, and when to ship companion files like `.jsh`\n scripts or `.bsh` browser hooks.\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Skill authoring\n\nA skill is a folder with a `SKILL.md` (and optional companion files) that loads into the agent's system prompt when the description matches the user's intent. This skill is about authoring those folders well.\n\n## Discovery\n\nSLICC discovers five kinds of skill roots:\n\n| Root | Source | Mutability |\n| ------------------------------------------------------------ | -------------------------------------------- | ----------------------------------- |\n| `/workspace/skills/<name>/SKILL.md` | Bundled or installed via `upskill` | Install-managed; you can edit them |\n| `.agents/skills/<name>/SKILL.md` (anywhere) | Compatibility (Cursor / SuperClaude) | Read-only (discovered, not managed) |\n| `.claude/skills/<name>/SKILL.md` (anywhere) | Compatibility (Claude Code) | Read-only (discovered, not managed) |\n| `<mount>/.claude-plugin/marketplace.json` → plugin `skills/` | Claude Code marketplace (mounted repos) | Read-only (discovered, not managed) |\n| `<plugin-root>/skills/<name>/SKILL.md` | Agent Plugins installed via `plugin install` | Read-only (discovered, not managed) |\n\nSkills under `/workspace/skills/` installed with `upskill` carry a `.upskill` provenance record (source, ref, commit, file list) that `upskill update [--dry-run]` uses to refresh them. `upskill` never modifies or deletes a **dotfile** in a skill directory, so that is where a skill should keep its credentials and local state (`scripts/.config`) — everything else is replaced on update.\n\nThe marketplace root is auto-discovered: when a mounted directory contains `.claude-plugin/marketplace.json`, SLICC reads the manifest, resolves each plugin's `source` path, and discovers skills at `<plugin-source>/skills/<name>/SKILL.md`. No install step needed — mount the repo and the skills are live immediately. Agent Plugins (agent-plugins.org packages with a `plugin.json` manifest) require an explicit `plugin install <path|repo>` — `<repo>` may be a local directory or a GitHub reference (`owner/repo`, `owner/repo@branch`, or a `https://github.com/owner/repo[/tree/branch[/dir]]` URL, downloaded into `/workspace/.plugins/sources/`); their skills then surface automatically. Precedence: native > agents > claude > marketplace > plugin.\n\nWhen you create a new skill **for SLICC**, put it in `/workspace/skills/<name>/`. The `.agents/`, `.claude/`, and marketplace paths exist so SLICC can pick up skills authored for other agents without modification — don't create new skills there.\n\n## SKILL.md structure\n\n```markdown\n---\nname: <slug>\ndescription: |\n Use this when ...\n ... (1–3 sentences explaining trigger conditions, what's covered, and what's\n NOT covered if there's a sibling skill that handles related topics.)\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Title (matches `name`)\n\n... body ...\n```\n\n### Frontmatter fields\n\n- **`name`** — lowercase, kebab-case. Must match the folder name. This is what `skill list` shows.\n- **`description`** — the trigger string. The agent uses this to decide whether to load the skill. Get this right; everything else is secondary.\n- **`allowed-tools`** — comma-separated list of tools the skill needs. Without this, the agent may load the skill but find it can't execute the steps. Common values:\n - `bash` — almost every skill.\n - `read_file, write_file, edit_file` — for skills that author files (sprinkles, config edits, three-way merges).\n - Omit only for purely informational skills.\n\n### Writing a good description\n\nThe description is a trigger, not a summary. It runs through the agent at every turn — too vague and the skill loads when irrelevant; too narrow and it doesn't load when needed.\n\n**Pattern that works**: \"Use this when \\<user-facing trigger\\>. Covers \\<topics\\>. \\[For \\<adjacent topic\\> use \\<sibling skill\\>.\\]\"\n\nCompare:\n\n- ❌ `description: Licks, webhooks, cron tasks, viewing pages/images, screencapture, onboarding`\n Keyword soup. The agent has to guess what \"licks\" or \"screencapture\" mean for this user.\n- ✅ `description: Use this when setting up event-driven automation in SLICC — webhooks, cron tasks, or filesystem watchers that route events to scoops. Covers webhook, crontask, and fswatch. Read this BEFORE wiring anything that should fire on a schedule, an HTTP call, or a VFS change.`\n Names the user intent (\"setting up event-driven automation\"), names the commands the agent will reach for, and tells the agent when to load it.\n\nRules of thumb:\n\n- Lead with **\"Use this when...\"** or **\"Use this whenever...\"**.\n- Name the **user-facing trigger** (what the user said), not just the implementation.\n- If there's a closely-named sibling skill (dips vs sprinkles, mount vs other storage), say which is which inside the description so the agent doesn't load both.\n- Multi-line YAML scalars are fine for longer descriptions — use the `|` block style.\n\n## Body conventions\n\n- Lead with one sentence stating what the skill is. No preamble.\n- Use tables for option matrices (commands × flags, tradeoffs, etc.).\n- Code blocks are bash unless otherwise needed.\n- Include a \"Don't\" or \"Common errors\" section near the end if the skill is failure-prone — the agent will read it before acting.\n- If the skill is large (> ~150 lines), split a reference table or example gallery into a companion `<topic>.md` and have the SKILL.md `read_file` it on demand. The `sprinkles/` skill (style-guide.md) and `dips/` skill (patterns.md) follow this pattern.\n\n## Companion files\n\n### `.jsh` — JavaScript shell scripts\n\n`.jsh` files on the shell's `$PATH` search roots are auto-discovered as shell commands. **Full reference: `./jsh-runtime-extensions.md`.**\n\n- **Auto-discovery**: registered as callable commands by filename (without the extension), from the `$PATH` roots — `/workspace/skills`, `/workspace/.mcp/aliases`, `/workspace/bin`, `/shared/bin` by default. A skill can ship its own commands by including a `.jsh` next to `SKILL.md`. Earlier roots win basename collisions, so `/workspace/skills/` wins. For commands elsewhere, add their dir to the PATH: `echo 'export PATH=\"$PATH:/my/tools\"' >> ~/.profile`.\n- **Dual-mode**: works in both the CLI server and the Chrome extension (sandbox iframe). Don't rely on CLI-only Node modules.\n- **Top-level `await`**: scripts are wrapped in `AsyncFunction`, so `await` at the top level works. Prefer it — errors surface instead of becoming unhandled rejections. Fire-and-forget `.then()`, unawaited `main()`, `setTimeout`, and `await fetch(…).json()` / `.text()` also keep the realm alive: like Node, the process stays up while I/O (fs/exec/fetch, including reading the response body) or timers are outstanding, and `process.exit()` skips the rest. A Promise with no handle (`new Promise(() => {})`) does **not** keep it alive. `node --check` / `-c` syntax-checks without executing (top-level `await` and ESM `import`/`export` are valid — the same entry transpile `node file.mjs` uses). `node --input-type=module` treats `-e` / stdin / `.js` as ESM.\n\n#### Runtime surface (use these — don't reinvent)\n\nNode-standard bare globals:\n\n| Global | Use for |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `process` | `argv`, `env`, `cwd()`, `exit(code)`, `stdout.write`, `stderr.write`; `stdin` is one-shot buffered (no streaming) — `read()`, events, or async iterator, drain once |\n| `console` | `log`/`info` → stdout, `warn`/`error` → stderr |\n| `fetch` | Standard `fetch` routed through SLICC's proxied transport (cookies + CORS handled). |\n| `require(p)` | Synchronous CJS `require`. Use `require('sliccy:<name>')` for capability bridges and `require('fs')` for the VFS bridge (see below). |\n| `__dirname` / `__filename` | CJS scope vars — the script's own directory and absolute path. |\n\nCapability bridges via `require('sliccy:<name>')` (full reference: `./jsh-runtime-extensions.md`):\n\n| `require('sliccy:<name>')` | Use for |\n| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `sliccy:exec` | Callable `exec(cmd)` + `.spawn(argv[])`. Composes with any supplemental command or `.jsh` script. |\n| `sliccy:agent` | Callable `agent(prompt, opts?)` → sub-scoop final text (parsed when `schema` set) + `.spawn(...)` → `{ finalText, exitCode, stderr }`. `opts`: `model`, `thinking`, `cwd`, `allowedCommands`, `readOnly`, `schema`. |\n| `sliccy:skill` | `dir` / `root` / `refs` / `assets` / `config()` / `token(providerId)` — skill-root `references/` and `assets/`, script-dir `.config`, provider tokens. |\n| `sliccy:http` | `http.client({ baseUrl, token, headers, retry, timeoutMs })` — standard API-client builder. |\n| `sliccy:browser` | `findTab`, `ensureTab`, `eval`, `evalAsync`, `cookie`, `localStorage`, `fetch`, `websocket.on(...)`. |\n| `sliccy:usb` / `sliccy:serial` / `sliccy:hid` | `list()` / `request()` + device methods. Chromium-only. |\n| `sliccy:cli` | `die(msg, opts?)`, `out(value)`, `warn(msg, opts?)`, `help(text)`. |\n| `sliccy:color` | ANSI helpers (`green`, `red`, `bold`, `dim`, …) auto-disabled on non-TTY / `NO_COLOR`. |\n| `sliccy:time` | `parseDuration`, `ago`, `range`, `future`, `gmailDate`. |\n| `sliccy:fmt` | `trunc`, `col`, `table`, `date`. |\n| `sliccy:pool` | `pool(n, items, fn)` — bounded concurrency runner. |\n\nVFS bridge:\n\n| `require('fs')` / `require('node:fs')` | `readFile`, `writeFile`, `readFileBinary`, `writeFileBinary`, `readDir`, `exists`, `stat`, `mkdir`, `rm`, `fetchToFile` — all paths are VFS, async. There is no bare `fs` global. |\n| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n\n#### Runtime extensions (live — prefer these over hand-rolled equivalents)\n\nReach these via `require('sliccy:<name>')`. Full reference: `./jsh-runtime-extensions.md`. Use them instead of reimplementing the cross-skill patterns they replace.\n\n- **`process.argv.parseFlags()`** — returns `{ positional, flags, subcommand }`. Replaces the per-skill `--flag=val` / `--flag val` parsing loop.\n- **`require('sliccy:browser')`** — `findTab({ domain | urlMatch })`, `ensureTab(url)`, `eval(tab, fn)`, `evalAsync(tab, fn)`, `cookie(tab, name)`, `localStorage(tab, key)`. Replaces shelling out to `playwright-cli tab-list` and regex-parsing its output.\n- **`browser.fetch(tab, url, opts)`** — page-context fetch (runs inside the tab's origin, so cookies + same-origin headers are automatic). Replaces the `eval-file` temp-file + double-JSON-unwrap dance.\n- **`browser.websocket.on(tab, …).filter({…}).forward({ sink })`** — declarative WebSocket observer with a closed sink set (`webhook` / `scoop` / `vfs` / `log`). **Required** for any new WS-watch use case; do not author page-context `WebSocket.prototype` patches in skill code.\n- **`require('sliccy:http').client({ baseUrl, token, headers, retry })`** — `get`/`post`/`put`/`delete` with merged headers, lazy token resolution, and Retry-After-aware backoff for `retry.on` statuses.\n- **`require('sliccy:skill')`** — `dir` / `root` / `refs` / `assets` / `config()` / `token(providerId)`: replace the per-skill `process.argv[1]` dirname math, ad-hoc `.config` JSON readers, and bespoke `oauth-token` shell-outs. `refs`/`assets` resolve from the skill root (parent of the `scripts/` path segment, including nested helpers).\n\nShip a `.jsh` when the skill needs deterministic, parameterizable behavior the agent shouldn't have to re-derive each time (e.g. a `slicc-handoff` helper, a custom diff formatter, a domain-specific lint).\n\n### `.bsh` — browser shell scripts\n\n`.bsh` files auto-execute when the browser navigates to a matching URL:\n\n- **Filename = hostname pattern**: `-.okta.com.bsh` matches `*.okta.com`.\n- **`// @match` directive**: restrict to specific URL patterns in the first 10 lines.\n- Same execution engine as `.jsh`.\n\nUse `.bsh` for site-specific automations — auto-fillers, lick-emitters, or page transforms that should run whenever the user lands on a particular host.\n\n## Filesystem at a glance\n\nThe VFS is stored in IndexedDB; it survives tab closes and refreshes. The `mount` shell command bridges remote storage (local folders, S3-compatible, Adobe DA) into VFS paths — see `/workspace/skills/mount/SKILL.md`.\n\nThe VFS supports symbolic links transparently:\n\n```bash\nln -s /workspace/skills /workspace/skill-link # Create symlink\nreadlink /workspace/skill-link # Read link target\nls -la /workspace/ # Shows symlinks with -> target\n```\n\n`cat`, `read_file`, `write_file` etc. follow symlinks automatically.\n\n**Mount points must be empty.** Mounting over existing files is blocked so built-in skills and scripts stay discoverable. `ln -s` mounted files into the place where you need them.\n\n## Don't\n\n- Don't ship a skill without a description that starts with \"Use this when...\" — the trigger field IS the skill from the agent's perspective.\n- Don't put `name:` in Title Case. Lowercase kebab-case. Match the folder.\n- Don't dump shell-command catalogs into a SKILL.md just because they're related — `commands` already lists them. Skills are for **patterns and policy**, not reference material.\n- Don't author skills under `.agents/skills/` or `.claude/skills/`. Those roots are for compatibility discovery from other agents.\n";export{e as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./py-realm-worker-BYQkpReo.js";var t=e(((e,t)=>{t.exports={}}));export default t();
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-nBlvta_T.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-CNztWUVW.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DJRlyqZu.js","assets/src-XLzS9HFL.js","assets/fetch-body-D2PwksUW.js","assets/api-endpoint-BB41u1PK.js","assets/runtime-env-Dlaokqg1.js","assets/runtime-env-NCI8LQob.js","assets/runtime-env-a_l4ilH_.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
2
- import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{a as r,c as i,l as a,o,s}from"./claude-model-version-BJLrDjmH.js";import"./libesm-BypnjKEL.js";import{t as c}from"./logger-DDBAeTLF.js";import"./src-XLzS9HFL.js";import"./proxied-fetch-CNztWUVW.js";import{a as l,t as u}from"./api-endpoint-BB41u1PK.js";import{n as d}from"./float-topology-ey0oewfq.js";import"./secret-topology-B8MYKYm6.js";import{n as f}from"./secrets-bridge-client-CHMeCH4_.js";import"./image-markers-DXh8szCT.js";import"./tool-ui-eSQ1g2I1.js";import{n as p,o as m,t as h}from"./providers-DuO7vxZy.js";import{n as g,t as _}from"./panel-rpc-B3MSVImO.js";import{r as v,t as y}from"./bedrock-camp-compat-CgBMwna8.js";var b={assign:0,create:0,clone:0,discard:0,update:0};function x(e){return Array.isArray(e)}function S(e){return w(e,null)}function C(e){return w(typeof e,`object`)&&!S(e)}function w(e,t){return e===t}function ee(e){if(!C(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!S(t)&&w(typeof t.constructor,`function`)&&!(w(t.constructor,globalThis.Object)||w(t.constructor.name,`Object`))}function te(e){return w(e,`__proto__`)||w(e,`constructor`)||w(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function T(e){return globalThis.ArrayBuffer.isView(e)}function ae(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:E(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=E(e[n]));for(let n of ie(e))t[n]=E(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>E(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(E([...e.entries()]))}function _e(e){return new Set(E([...e.values()]))}function E(e){return T(e)?me(e):ae(e)?he(e):se(e)?ge(e):oe(e)?_e(e):x(e)?pe(e):C(e)?fe(e):e}function ve(e){return b.clone+=1,E(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(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 Se(e,t){return{...e,...t}}function Ce(e,t,n={}){b.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){b.update+=1;let r=be(),i=ve(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 i}function Te(e){return C(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(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`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function D(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);function Ue(e,t){try{return Promise.resolve(t(We))}catch(e){return Promise.reject(e)}}var We={startSpan:Ue,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(We);var Ge=Symbol.for(`yaml.alias`),Ke=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),qe=Symbol.for(`yaml.pair`),Je=Symbol.for(`yaml.scalar`),Ye=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),A=e=>!!e&&typeof e==`object`&&e[k]===Ge,Xe=e=>!!e&&typeof e==`object`&&e[k]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[k]===O,j=e=>!!e&&typeof e==`object`&&e[k]===qe,M=e=>!!e&&typeof e==`object`&&e[k]===Je,Qe=e=>!!e&&typeof e==`object`&&e[k]===Ye;function N(e){if(e&&typeof e==`object`)switch(e[k]){case O:case Ye:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case Ge:case O:case Je:case Ye:return!0}return!1}var $e=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),et=Symbol(`skip children`),tt=Symbol(`remove node`);function nt(e,t){let n=rt(t);Xe(e)?I(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):I(null,e,n,Object.freeze([]))}nt.BREAK=F,nt.SKIP=et,nt.REMOVE=tt;function I(e,t,n,r){let i=it(e,t,n,r);if(P(i)||j(i))return at(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===tt&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===F)return F;e===tt&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===F)return F;i===tt&&(t.value=null)}}return i}function rt(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 it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ze(t))return n.Map?.(e,t,r);if(Qe(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(A(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(Xe(r))r.contents=n;else{let e=A(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(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 st(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=st(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=st(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=st(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=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function L(e,t,n){if(Array.isArray(e))return e.map((e,t)=>L(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$e(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 ct=class{constructor(e){Object.defineProperty(this,k,{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(!Xe(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=L(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ge),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=[],nt(e,{Node:(e,t)=>{(A(t)||$e(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||=(L(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=ut(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(ot(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 ut(e,t,n){if(A(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(N(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,R=class extends ct{constructor(e){super(Je),this.value=e}toJSON(e,t){return t?.keep?this.value:L(this.value,e,t)}toString(){return String(this.value)}};R.BLOCK_FOLDED=`BLOCK_FOLDED`,R.BLOCK_LITERAL=`BLOCK_LITERAL`,R.PLAIN=`PLAIN`,R.QUOTE_DOUBLE=`QUOTE_DOUBLE`,R.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(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 mt(e,t,n){if(Xe(e)&&(e=e.contents),P(e))return e;if(j(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 lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new R(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[Ye]: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 R(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(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 mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{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=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(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(N(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:N(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 N(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(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var z=(e,t,n)=>e.endsWith(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-t2taQm3p.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-CiijUcSt.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DJRlyqZu.js","assets/fetch-body-D2PwksUW.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{a as r,c as i,l as a,o,s}from"./claude-model-version-BJLrDjmH.js";import"./libesm-BypnjKEL.js";import{t as c}from"./logger-DDBAeTLF.js";import"./proxied-fetch-CiijUcSt.js";import{a as l,t as u}from"./api-endpoint-DGxXvrur.js";import{n as d}from"./float-topology-hfgMx1Yq.js";import"./secret-topology-Yt0aO4Gz.js";import{n as f}from"./secrets-bridge-client-BVl0YuB2.js";import"./image-markers-BFDmhPy4.js";import"./tool-ui-eSQ1g2I1.js";import{n as p,o as m,t as h}from"./providers-CqZKx9qW.js";import{n as g,t as _}from"./panel-rpc-B3MSVImO.js";import{r as v,t as y}from"./bedrock-camp-compat-CgBMwna8.js";var b={assign:0,create:0,clone:0,discard:0,update:0};function x(e){return Array.isArray(e)}function S(e){return w(e,null)}function C(e){return w(typeof e,`object`)&&!S(e)}function w(e,t){return e===t}function ee(e){if(!C(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!S(t)&&w(typeof t.constructor,`function`)&&!(w(t.constructor,globalThis.Object)||w(t.constructor.name,`Object`))}function te(e){return w(e,`__proto__`)||w(e,`constructor`)||w(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function T(e){return globalThis.ArrayBuffer.isView(e)}function ae(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:E(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=E(e[n]));for(let n of ie(e))t[n]=E(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>E(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(E([...e.entries()]))}function _e(e){return new Set(E([...e.values()]))}function E(e){return T(e)?me(e):ae(e)?he(e):se(e)?ge(e):oe(e)?_e(e):x(e)?pe(e):C(e)?fe(e):e}function ve(e){return b.clone+=1,E(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(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 Se(e,t){return{...e,...t}}function Ce(e,t,n={}){b.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){b.update+=1;let r=be(),i=ve(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 i}function Te(e){return C(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(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`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function D(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);function Ue(e,t){try{return Promise.resolve(t(We))}catch(e){return Promise.reject(e)}}var We={startSpan:Ue,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(We);var Ge=Symbol.for(`yaml.alias`),Ke=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),qe=Symbol.for(`yaml.pair`),Je=Symbol.for(`yaml.scalar`),Ye=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),A=e=>!!e&&typeof e==`object`&&e[k]===Ge,Xe=e=>!!e&&typeof e==`object`&&e[k]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[k]===O,j=e=>!!e&&typeof e==`object`&&e[k]===qe,M=e=>!!e&&typeof e==`object`&&e[k]===Je,Qe=e=>!!e&&typeof e==`object`&&e[k]===Ye;function N(e){if(e&&typeof e==`object`)switch(e[k]){case O:case Ye:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case Ge:case O:case Je:case Ye:return!0}return!1}var $e=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),et=Symbol(`skip children`),tt=Symbol(`remove node`);function nt(e,t){let n=rt(t);Xe(e)?I(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):I(null,e,n,Object.freeze([]))}nt.BREAK=F,nt.SKIP=et,nt.REMOVE=tt;function I(e,t,n,r){let i=it(e,t,n,r);if(P(i)||j(i))return at(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===tt&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===F)return F;e===tt&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===F)return F;i===tt&&(t.value=null)}}return i}function rt(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 it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ze(t))return n.Map?.(e,t,r);if(Qe(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(A(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(Xe(r))r.contents=n;else{let e=A(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(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 st(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=st(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=st(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=st(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=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function L(e,t,n){if(Array.isArray(e))return e.map((e,t)=>L(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$e(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 ct=class{constructor(e){Object.defineProperty(this,k,{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(!Xe(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=L(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ge),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=[],nt(e,{Node:(e,t)=>{(A(t)||$e(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||=(L(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=ut(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(ot(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 ut(e,t,n){if(A(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(N(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,R=class extends ct{constructor(e){super(Je),this.value=e}toJSON(e,t){return t?.keep?this.value:L(this.value,e,t)}toString(){return String(this.value)}};R.BLOCK_FOLDED=`BLOCK_FOLDED`,R.BLOCK_LITERAL=`BLOCK_LITERAL`,R.PLAIN=`PLAIN`,R.QUOTE_DOUBLE=`QUOTE_DOUBLE`,R.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(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 mt(e,t,n){if(Xe(e)&&(e=e.contents),P(e))return e;if(j(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 lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new R(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[Ye]: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 R(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(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 mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{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=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(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(N(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:N(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 N(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(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var z=(e,t,n)=>e.endsWith(`
3
3
  `)?yt(n,t):n.includes(`
4
4
  `)?`
5
5
  `+yt(n,t):(e.endsWith(` `)?``:` `)+n,bt=`flow`,xt=`block`,St=`quoted`;function Ct(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=wt(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===`
@@ -60,4 +60,4 @@ Do NOT continue the conversation. Do NOT answer questions inside the conversatio
60
60
  <conversation>
61
61
  ${e}
62
62
  </conversation>`}async function Sn(e,t,n,r,i,a,s){let c=await o(e,{systemPrompt:n,messages:[{role:`user`,content:[{type:`text`,text:r}],timestamp:Date.now()}]},{maxTokens:i,apiKey:t,headers:a,signal:s});if(c.stopReason===`error`)throw Error(`Compaction call failed: ${c.errorMessage||`Unknown error`}`);return c.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
63
- `).trim()}async function Cn(e){let t=xn(_n(e.messages));return Sn(e.model,e.apiKey,t,e.instruction,e.maxTokens,e.headers,e.signal)}var wn=bn,Tn=`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.`,En=`slicc_oauth_extra_domains`;function Dn(e){try{let t=e.getItem(En);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function On(e,t){try{e.setItem(En,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}c(`secret-scrub`),c(`image-processor`),c(`tool-adapter`);function kn(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},i=r(e);if(!i)return n;let a;for(let e of t.values()){let t=r(e.id);!t||t.family!==i.family||(!a||t.major>a.major||t.major===a.major&&t.minor>a.minor)&&(a={major:t.major,minor:t.minor,cost:e.cost})}return a?.cost??n}c(`model-policy`);var An=`/etc/models`;function jn(){return{sections:{}}}function Mn(e,t,n){return e.providerId===t?e.modelId===`*`||e.modelId===n:!1}function Nn(e,t){return e.sections[t]??[]}function Pn(e,t,n,r){return Nn(e,t).some(e=>e.deny&&Mn(e,n,r))}function Fn(e,t,n,r){let i=Nn(e,t);return i.some(e=>e.deny&&Mn(e,n,r))?!1:n===t||i.some(e=>!e.deny&&Mn(e,n,r))}var In=jn();function Ln(){return In}function Rn(e,t,n){return`add \`${t}:${n}\` (or \`${t}:*\`) under \`[${e}]\` in ${An}`}var zn=e({ACCOUNTS_KEY:()=>G,__test__:()=>Yn,addAccount:()=>mr,applyProviderDefaults:()=>nr,clearAllSettings:()=>Rr,clearApiKey:()=>Nr,clearBaseUrl:()=>Ir,clearSelectedProvider:()=>Ar,exportProviders:()=>Lr,getAccounts:()=>X,getAllAvailableModels:()=>sr,getAllExtraOAuthDomains:()=>dr,getApiKey:()=>jr,getApiKeyForProvider:()=>wr,getApiVersionForProvider:()=>Er,getAvailableProviders:()=>Xn,getBaseUrl:()=>Pr,getBaseUrlForProvider:()=>Z,getDeploymentForProvider:()=>Tr,getExtraOAuthDomains:()=>cr,getOAuthAccountInfo:()=>er,getProviderConfig:()=>q,getProviderModels:()=>J,getRawApiKeyForProvider:()=>Cr,getSelectedModelId:()=>Q,getSelectedProvider:()=>$,isModelHiddenFromPicker:()=>ir,logoutOAuthAccount:()=>_r,maskOAuthTokenWithRetry:()=>vr,migrateLegacyAuthOnlySelection:()=>qn,modelRunsOnProvider:()=>Kr,persistOAuthMaskViaServiceWorker:()=>yr,policyVisible:()=>or,providerOffersLlmModels:()=>Zn,removeAccount:()=>gr,resolveCurrentModel:()=>qr,resolveModelById:()=>Gr,resolveModelByShorthand:()=>Jr,resolveModelIdForScoop:()=>si,resolveModelSelectionForScoop:()=>ei,saveOAuthAccount:()=>xr,setApiKey:()=>Mr,setBaseUrl:()=>Fr,setExtraOAuthDomains:()=>lr,setExtraOAuthDomainsAsync:()=>ur,setSelectedModelId:()=>Dr,setSelectedProvider:()=>kr}),Bn=s,Vn=i,G=`slicc_accounts`,K=`selected-model`,Hn=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],Un=new Set([`github`]);function Wn(e){let t;try{t=a()}catch{return!1}return t.includes(e)&&!m(e)}var Gn=!1;function Kn(){if(!Gn){Gn=!0;for(let e of Hn)try{localStorage.removeItem(e)}catch{}qn()}}function qn(){try{let e=localStorage.getItem(K);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(Un.has(n)||Wn(n))&&localStorage.removeItem(K)}}}catch{}try{let e=localStorage.getItem(G);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&Wn(e.providerId)));n.length!==t.length&&localStorage.setItem(G,JSON.stringify(n))}catch{}}function Jn(){Gn=!1}var Yn={_resetLegacyCleanup:Jn};function Xn(){let e=a().filter(m),t=p();return[...new Set([...e,...t])].filter(e=>!h(e)?.hidden)}function Zn(e){try{if(J(e).length>0)return!0}catch{}try{if(i(e).length>0)return!0}catch{}let t=h(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function Qn(e,t){try{if(J(e).some(e=>e.id===t))return!0}catch{}try{if(i(e).some(e=>e.id===t))return!0}catch{}let n=h(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function q(e){return h(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function $n(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function J(e){try{if(e===`bedrock-camp`){let e=y(Z(`bedrock-camp`));return Vn(`amazon-bedrock`).filter(t=>v(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=q(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return Y.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of a())try{for(let t of Vn(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=Br(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=kn(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&$n(s,c),$n(s,n),s})}if(t.isOAuth){let n=Vn(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&$n(i,a),i})}return Vn(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return Y.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function er(e){let t=X().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,scopes:t.scopes,expired:n}}var tr=Object.assign({})[`/packages/webapp/providers.json`]??[],Y=c(`provider-settings`);function nr(e=tr){if(e.length===0||X().length>0)return;let t=new Set(Xn());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){Y.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}mr(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(K)&&localStorage.setItem(K,`${n.providerId}:${n.model}`)}var rr=[/haiku/i];function ir(e){return rr.some(t=>t.test(e))}function ar(e){return e.filter(e=>!ir(e.id))}function or(e,t){let n=ti();if(n===null)return e;let r=Ln();return e.filter(e=>!Pn(r,n,t,e.id))}function sr(){let e=X();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=q(n.providerId);if(e.hidden||Wn(n.providerId))continue;let r=or(ar(J(n.providerId)),n.providerId);if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function X(){Kn();let e=localStorage.getItem(G);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function cr(e){return Dn(localStorage)[e]??[]}function lr(e,t){let n=Dn(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,On(localStorage,n)}async function ur(e,t){if(g()){lr(e,t);return}let n=_();if(!n)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:r}=await n.call(`oauth-extras-set`,{providerId:e,domains:t});try{On(localStorage,r)}catch(t){Y.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function dr(){return Dn(localStorage)}function fr(e){localStorage.setItem(G,JSON.stringify(e))}async function pr(e){if(g()){fr(e);return}let t=_();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let n=JSON.stringify(e),{storedJson:r}=await t.call(`save-oauth-accounts`,{accountsJson:n});try{localStorage.setItem(G,r)}catch(e){Y.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function mr(e,t,n,r,i){let a=X().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),fr(a)}async function hr(e){let t=d();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&Y.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&Y.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await f(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&Y.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(l(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:u()});!t.ok&&t.status!==404&&Y.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){Y.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function gr(e){let t=X().find(t=>t.providerId===e),n=q(e);t&&n?.isOAuth&&await _r(e),await hr(e),await pr(X().filter(t=>t.providerId!==e));let r=localStorage.getItem(K)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(K)}async function _r(e){let t=X().find(t=>t.providerId===e);if(!t)return;let r=q(e);if(r?.isOAuth){if(r.onOAuthLogout)try{await r.onOAuthLogout()}catch(t){Y.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(r.getOAuthLogoutUrl){let i=r.getOAuthLogoutUrl(t);if(i){let{openIdpLogoutUrl:t}=await n(async()=>{let{openIdpLogoutUrl:e}=await import(`./oauth-service-nBlvta_T.js`);return{openIdpLogoutUrl:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));await t(i).catch(t=>{Y.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await pr(X().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await hr(e)}}async function vr(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function yr(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await vr(()=>t.sendMaskRequest(r),n);if(!i){Y.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}function br(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function xr(e){let t=X().find(t=>t.providerId===e.providerId),n=X().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl,scopes:br(e,t)}),await pr(n);let r=q(e.providerId)?.oauthTokenDomains??[],i=cr(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let s=d();try{if(s===`extension-direct`)await yr({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&Y.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&Y.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:X,saveAccounts:pr});else if(s===`extension-delegate`)await yr({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>f(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&Y.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(Y.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:X,saveAccounts:pr});else if(s!==`connect`){let t=await fetch(l(`/api/secrets/oauth-update`),{method:`POST`,headers:u({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=X(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await pr(t))}else Y.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else Y.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){Y.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:s,error:t instanceof Error?t.message:String(t)})}}var Sr=`local`;function Cr(e){let t=X().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function wr(e){let t=X().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(q(e).optionalApiKey?Sr:null):null}function Z(e){return X().find(t=>t.providerId===e)?.baseUrl??null}function Tr(e){return X().find(t=>t.providerId===e)?.deployment??null}function Er(e){return X().find(t=>t.providerId===e)?.apiVersion??null}function Q(){let e=localStorage.getItem(K)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function Dr(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...p(),...Xn()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(K,e);return}}let n=$();localStorage.setItem(K,`${n}:${e}`)}function Or(){return localStorage.getItem(K)||``}function $(){let e=Or(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=X(),r=Q();if(r){let e=n.find(e=>Zn(e.providerId)&&Qn(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>Zn(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function kr(e){let t=Q();localStorage.setItem(K,`${e}:${t}`)}function Ar(){let e=Q();localStorage.setItem(K,e)}function jr(){return wr($())}function Mr(e){let t=$();mr(t,e,Z(t)??void 0)}async function Nr(){await gr($())}function Pr(){return Z($())}function Fr(e){let t=$(),n=Cr(t);n&&mr(t,n,e||void 0)}function Ir(){let e=$(),t=Cr(e);t&&mr(e,t)}function Lr(){let e=X(),t=$(),n=Q();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function Rr(){let e=X();await Promise.allSettled(e.map(e=>gr(e.providerId))),localStorage.removeItem(G),localStorage.removeItem(K);for(let e of Hn)localStorage.removeItem(e)}function zr(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function Br(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${zr(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function Vr(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function Hr(e,t,n){let r=J(e).find(e=>e.id===t);return r?n?{...r,baseUrl:n}:r:null}function Ur(e,t,n,r){return n.isOAuth?J(t).find(e=>e.id===r)||{...e,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`?{...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}:e}function Wr(e,t,n,r,i){if(t.isOAuth)return Hr(e,n,r)??Br(e,n,r);if(i)throw Error(`Model ${n} is not available from provider ${e}`);return qr()}function Gr(e,t){if(!e)return qr();let n=t??$(),r=Z(n),i=q(n);if(t!==void 0){let t=Hr(n,e,r);if(t)return t}try{let t=Bn(Vr(n,i),e);if(!t?.id)throw Error(`Model ${e} not found`);let a=Ur(t,n,i,e);return r?{...a,baseUrl:r}:a}catch(a){return Y.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:n,modelId:e,error:a instanceof Error?a.message:String(a)}),Wr(n,i,e,r,t!==void 0)}}function Kr(e,t){return e.provider===t||e.provider===Vr(t,q(t))}function qr(){let e=$(),t=Q(),n=Z(e),r=J(e),i=q(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=Vr(e,i),a=Bn(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){Y.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?Br(e,o,n):Bn(`anthropic`,`claude-sonnet-4-0`)}}function Jr(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=$()}catch{}if(n!==null){let e=Yr(t,[n]);if(e!==null)return e}return Yr(t,X().map(e=>e.providerId))}function Yr(e,t){let n=null,r=-1;for(let i of t)for(let t of J(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&ci(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function Xr(){let e=[];try{for(let t of X())e.includes(t.providerId)||e.push(t.providerId)}catch{}try{let t=$();e.includes(t)||e.push(t)}catch{}return e}function Zr(e){let t=e.indexOf(`:`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1),i=Xr().includes(n);if(i)return{providerId:n,modelId:r,configured:i};let a=!1;try{a=Xn().includes(n)}catch{}return a?{providerId:n,modelId:r,configured:!1}:null}function Qr(e,t,n=!0){let r=[e],i=n?Yr(e.toLowerCase(),[t]):null;i!==null&&i!==e&&r.push(i);let a=[];try{a=J(t)}catch{}for(let n of r)if(!(a.length>0&&!a.some(e=>e.id===n)))try{if(Gr(n,t).id===n)return{modelId:n,providerId:t}}catch(r){Y.debug(`selectModelFromProvider: candidate did not resolve`,{input:e,candidate:n,providerId:t,error:r instanceof Error?r.message:String(r)})}return null}function $r(e){return e.map(e=>`${e.providerId}:${e.modelId}`).join(`, `)}function ei(e){if(!e)return{ok:!1,error:`unknown model: (empty)`};let t=Zr(e);if(t)return ai(e,t);let n=null;try{n=$()}catch{}if(n!==null){let t=Qr(e,n);if(t)return ii(t)}return oi(e,n)}function ti(){try{return $()}catch{return null}}function ni(e){let t=ti();return t===null||Fn(Ln(),t,e.providerId,e.modelId)}function ri(e){let t=ti()??`<none>`;return{ok:!1,error:`model not allowed: ${`${e.providerId}:${e.modelId}`} is blocked by ${An} while "${t}" is selected — ${Rn(t,e.providerId,e.modelId)}`}}function ii(e){return ni(e)?{ok:!0,selection:e}:ri(e)}function ai(e,t){if(!t.configured){let n=Xr();return{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" is not configured${n.length>0?`; configured: ${n.join(`, `)}`:``})`}}let n=Qr(t.modelId,t.providerId);return n?ii(n):{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" does not offer "${t.modelId}")`}}function oi(e,t){let n=Xr().filter(e=>e!==t);for(let t of[`exact`,`shorthand`]){let r=[];for(let i of n){let n=t===`exact`?e:Yr(e.toLowerCase(),[i]);if(n===null)continue;let a=Qr(n,i,!1);a&&r.push(a)}let i=r.filter(ni);if(i.length===0&&r.length>0)return ri(r[0]);if(i.length===1)return{ok:!0,selection:i[0]};if(i.length>1)return{ok:!1,error:`ambiguous model: ${e} matches ${$r(i)} — qualify it as provider:model`}}return{ok:!1,error:`unknown model: ${e}`}}function si(e){let t=ei(e);return t.ok?t.selection.modelId:null}function ci(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{vr as A,si as B,q as C,$ as D,Q as E,Zn as F,lr as G,xr as H,gr as I,kr as J,ur as K,qr as L,Kr as M,yr as N,ir as O,or as P,Cn as Q,Gr as R,er as S,Cr as T,Mr as U,ei as V,Fr as W,wn as X,kn as Y,Tn as Z,Xn as _,nr as a,Tr as b,Ir as c,X as d,sr as f,Er as g,wr as h,mr as i,qn as j,_r as k,Ar as l,jr as m,Yn as n,Rr as o,dr as p,Dr as q,zn as r,Nr as s,G as t,Lr as u,Pr as v,J as w,cr as x,Z as y,Jr as z};
63
+ `).trim()}async function Cn(e){let t=xn(_n(e.messages));return Sn(e.model,e.apiKey,t,e.instruction,e.maxTokens,e.headers,e.signal)}var wn=bn,Tn=`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.`,En=`slicc_oauth_extra_domains`;function Dn(e){try{let t=e.getItem(En);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function On(e,t){try{e.setItem(En,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}c(`secret-scrub`),c(`image-processor`),c(`tool-adapter`);function kn(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},i=r(e);if(!i)return n;let a;for(let e of t.values()){let t=r(e.id);!t||t.family!==i.family||(!a||t.major>a.major||t.major===a.major&&t.minor>a.minor)&&(a={major:t.major,minor:t.minor,cost:e.cost})}return a?.cost??n}c(`model-policy`);var An=`/etc/models`;function jn(){return{sections:{}}}function Mn(e,t,n){return e.providerId===t?e.modelId===`*`||e.modelId===n:!1}function Nn(e,t){return e.sections[t]??[]}function Pn(e,t,n,r){return Nn(e,t).some(e=>e.deny&&Mn(e,n,r))}function Fn(e,t,n,r){let i=Nn(e,t);return i.some(e=>e.deny&&Mn(e,n,r))?!1:n===t||i.some(e=>!e.deny&&Mn(e,n,r))}var In=jn();function Ln(){return In}function Rn(e,t,n){return`add \`${t}:${n}\` (or \`${t}:*\`) under \`[${e}]\` in ${An}`}var zn=e({ACCOUNTS_KEY:()=>G,__test__:()=>Yn,addAccount:()=>mr,applyProviderDefaults:()=>nr,clearAllSettings:()=>Rr,clearApiKey:()=>Nr,clearBaseUrl:()=>Ir,clearSelectedProvider:()=>Ar,exportProviders:()=>Lr,getAccounts:()=>X,getAllAvailableModels:()=>sr,getAllExtraOAuthDomains:()=>dr,getApiKey:()=>jr,getApiKeyForProvider:()=>wr,getApiVersionForProvider:()=>Er,getAvailableProviders:()=>Xn,getBaseUrl:()=>Pr,getBaseUrlForProvider:()=>Z,getDeploymentForProvider:()=>Tr,getExtraOAuthDomains:()=>cr,getOAuthAccountInfo:()=>er,getProviderConfig:()=>q,getProviderModels:()=>J,getRawApiKeyForProvider:()=>Cr,getSelectedModelId:()=>Q,getSelectedProvider:()=>$,isModelHiddenFromPicker:()=>ir,logoutOAuthAccount:()=>_r,maskOAuthTokenWithRetry:()=>vr,migrateLegacyAuthOnlySelection:()=>qn,modelRunsOnProvider:()=>Kr,persistOAuthMaskViaServiceWorker:()=>yr,policyVisible:()=>or,providerOffersLlmModels:()=>Zn,removeAccount:()=>gr,resolveCurrentModel:()=>qr,resolveModelById:()=>Gr,resolveModelByShorthand:()=>Jr,resolveModelIdForScoop:()=>si,resolveModelSelectionForScoop:()=>ei,saveOAuthAccount:()=>xr,setApiKey:()=>Mr,setBaseUrl:()=>Fr,setExtraOAuthDomains:()=>lr,setExtraOAuthDomainsAsync:()=>ur,setSelectedModelId:()=>Dr,setSelectedProvider:()=>kr}),Bn=s,Vn=i,G=`slicc_accounts`,K=`selected-model`,Hn=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],Un=new Set([`github`]);function Wn(e){let t;try{t=a()}catch{return!1}return t.includes(e)&&!m(e)}var Gn=!1;function Kn(){if(!Gn){Gn=!0;for(let e of Hn)try{localStorage.removeItem(e)}catch{}qn()}}function qn(){try{let e=localStorage.getItem(K);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(Un.has(n)||Wn(n))&&localStorage.removeItem(K)}}}catch{}try{let e=localStorage.getItem(G);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&Wn(e.providerId)));n.length!==t.length&&localStorage.setItem(G,JSON.stringify(n))}catch{}}function Jn(){Gn=!1}var Yn={_resetLegacyCleanup:Jn};function Xn(){let e=a().filter(m),t=p();return[...new Set([...e,...t])].filter(e=>!h(e)?.hidden)}function Zn(e){try{if(J(e).length>0)return!0}catch{}try{if(i(e).length>0)return!0}catch{}let t=h(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function Qn(e,t){try{if(J(e).some(e=>e.id===t))return!0}catch{}try{if(i(e).some(e=>e.id===t))return!0}catch{}let n=h(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function q(e){return h(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function $n(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function J(e){try{if(e===`bedrock-camp`){let e=y(Z(`bedrock-camp`));return Vn(`amazon-bedrock`).filter(t=>v(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=q(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return Y.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of a())try{for(let t of Vn(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=Br(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=kn(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&$n(s,c),$n(s,n),s})}if(t.isOAuth){let n=Vn(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&$n(i,a),i})}return Vn(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return Y.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function er(e){let t=X().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,scopes:t.scopes,expired:n}}var tr=Object.assign({})[`/packages/webapp/providers.json`]??[],Y=c(`provider-settings`);function nr(e=tr){if(e.length===0||X().length>0)return;let t=new Set(Xn());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){Y.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}mr(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(K)&&localStorage.setItem(K,`${n.providerId}:${n.model}`)}var rr=[/haiku/i];function ir(e){return rr.some(t=>t.test(e))}function ar(e){return e.filter(e=>!ir(e.id))}function or(e,t){let n=ti();if(n===null)return e;let r=Ln();return e.filter(e=>!Pn(r,n,t,e.id))}function sr(){let e=X();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=q(n.providerId);if(e.hidden||Wn(n.providerId))continue;let r=or(ar(J(n.providerId)),n.providerId);if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function X(){Kn();let e=localStorage.getItem(G);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function cr(e){return Dn(localStorage)[e]??[]}function lr(e,t){let n=Dn(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,On(localStorage,n)}async function ur(e,t){if(g()){lr(e,t);return}let n=_();if(!n)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:r}=await n.call(`oauth-extras-set`,{providerId:e,domains:t});try{On(localStorage,r)}catch(t){Y.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function dr(){return Dn(localStorage)}function fr(e){localStorage.setItem(G,JSON.stringify(e))}async function pr(e){if(g()){fr(e);return}let t=_();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let n=JSON.stringify(e),{storedJson:r}=await t.call(`save-oauth-accounts`,{accountsJson:n});try{localStorage.setItem(G,r)}catch(e){Y.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function mr(e,t,n,r,i){let a=X().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),fr(a)}async function hr(e){let t=d();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&Y.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&Y.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await f(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&Y.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(l(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:u()});!t.ok&&t.status!==404&&Y.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){Y.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function gr(e){let t=X().find(t=>t.providerId===e),n=q(e);t&&n?.isOAuth&&await _r(e),await hr(e),await pr(X().filter(t=>t.providerId!==e));let r=localStorage.getItem(K)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(K)}async function _r(e){let t=X().find(t=>t.providerId===e);if(!t)return;let r=q(e);if(r?.isOAuth){if(r.onOAuthLogout)try{await r.onOAuthLogout()}catch(t){Y.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(r.getOAuthLogoutUrl){let i=r.getOAuthLogoutUrl(t);if(i){let{openIdpLogoutUrl:t}=await n(async()=>{let{openIdpLogoutUrl:e}=await import(`./oauth-service-t2taQm3p.js`);return{openIdpLogoutUrl:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));await t(i).catch(t=>{Y.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await pr(X().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await hr(e)}}async function vr(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function yr(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await vr(()=>t.sendMaskRequest(r),n);if(!i){Y.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}function br(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function xr(e){let t=X().find(t=>t.providerId===e.providerId),n=X().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl,scopes:br(e,t)}),await pr(n);let r=q(e.providerId)?.oauthTokenDomains??[],i=cr(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let s=d();try{if(s===`extension-direct`)await yr({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&Y.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&Y.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:X,saveAccounts:pr});else if(s===`extension-delegate`)await yr({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>f(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&Y.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(Y.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:X,saveAccounts:pr});else if(s!==`connect`){let t=await fetch(l(`/api/secrets/oauth-update`),{method:`POST`,headers:u({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=X(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await pr(t))}else Y.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else Y.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){Y.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:s,error:t instanceof Error?t.message:String(t)})}}var Sr=`local`;function Cr(e){let t=X().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function wr(e){let t=X().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(q(e).optionalApiKey?Sr:null):null}function Z(e){return X().find(t=>t.providerId===e)?.baseUrl??null}function Tr(e){return X().find(t=>t.providerId===e)?.deployment??null}function Er(e){return X().find(t=>t.providerId===e)?.apiVersion??null}function Q(){let e=localStorage.getItem(K)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function Dr(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...p(),...Xn()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(K,e);return}}let n=$();localStorage.setItem(K,`${n}:${e}`)}function Or(){return localStorage.getItem(K)||``}function $(){let e=Or(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=X(),r=Q();if(r){let e=n.find(e=>Zn(e.providerId)&&Qn(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>Zn(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function kr(e){let t=Q();localStorage.setItem(K,`${e}:${t}`)}function Ar(){let e=Q();localStorage.setItem(K,e)}function jr(){return wr($())}function Mr(e){let t=$();mr(t,e,Z(t)??void 0)}async function Nr(){await gr($())}function Pr(){return Z($())}function Fr(e){let t=$(),n=Cr(t);n&&mr(t,n,e||void 0)}function Ir(){let e=$(),t=Cr(e);t&&mr(e,t)}function Lr(){let e=X(),t=$(),n=Q();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function Rr(){let e=X();await Promise.allSettled(e.map(e=>gr(e.providerId))),localStorage.removeItem(G),localStorage.removeItem(K);for(let e of Hn)localStorage.removeItem(e)}function zr(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function Br(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${zr(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function Vr(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function Hr(e,t,n){let r=J(e).find(e=>e.id===t);return r?n?{...r,baseUrl:n}:r:null}function Ur(e,t,n,r){return n.isOAuth?J(t).find(e=>e.id===r)||{...e,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`?{...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}:e}function Wr(e,t,n,r,i){if(t.isOAuth)return Hr(e,n,r)??Br(e,n,r);if(i)throw Error(`Model ${n} is not available from provider ${e}`);return qr()}function Gr(e,t){if(!e)return qr();let n=t??$(),r=Z(n),i=q(n);if(t!==void 0){let t=Hr(n,e,r);if(t)return t}try{let t=Bn(Vr(n,i),e);if(!t?.id)throw Error(`Model ${e} not found`);let a=Ur(t,n,i,e);return r?{...a,baseUrl:r}:a}catch(a){return Y.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:n,modelId:e,error:a instanceof Error?a.message:String(a)}),Wr(n,i,e,r,t!==void 0)}}function Kr(e,t){return e.provider===t||e.provider===Vr(t,q(t))}function qr(){let e=$(),t=Q(),n=Z(e),r=J(e),i=q(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=Vr(e,i),a=Bn(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){Y.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?Br(e,o,n):Bn(`anthropic`,`claude-sonnet-4-0`)}}function Jr(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=$()}catch{}if(n!==null){let e=Yr(t,[n]);if(e!==null)return e}return Yr(t,X().map(e=>e.providerId))}function Yr(e,t){let n=null,r=-1;for(let i of t)for(let t of J(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&ci(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function Xr(){let e=[];try{for(let t of X())e.includes(t.providerId)||e.push(t.providerId)}catch{}try{let t=$();e.includes(t)||e.push(t)}catch{}return e}function Zr(e){let t=e.indexOf(`:`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1),i=Xr().includes(n);if(i)return{providerId:n,modelId:r,configured:i};let a=!1;try{a=Xn().includes(n)}catch{}return a?{providerId:n,modelId:r,configured:!1}:null}function Qr(e,t,n=!0){let r=[e],i=n?Yr(e.toLowerCase(),[t]):null;i!==null&&i!==e&&r.push(i);let a=[];try{a=J(t)}catch{}for(let n of r)if(!(a.length>0&&!a.some(e=>e.id===n)))try{if(Gr(n,t).id===n)return{modelId:n,providerId:t}}catch(r){Y.debug(`selectModelFromProvider: candidate did not resolve`,{input:e,candidate:n,providerId:t,error:r instanceof Error?r.message:String(r)})}return null}function $r(e){return e.map(e=>`${e.providerId}:${e.modelId}`).join(`, `)}function ei(e){if(!e)return{ok:!1,error:`unknown model: (empty)`};let t=Zr(e);if(t)return ai(e,t);let n=null;try{n=$()}catch{}if(n!==null){let t=Qr(e,n);if(t)return ii(t)}return oi(e,n)}function ti(){try{return $()}catch{return null}}function ni(e){let t=ti();return t===null||Fn(Ln(),t,e.providerId,e.modelId)}function ri(e){let t=ti()??`<none>`;return{ok:!1,error:`model not allowed: ${`${e.providerId}:${e.modelId}`} is blocked by ${An} while "${t}" is selected — ${Rn(t,e.providerId,e.modelId)}`}}function ii(e){return ni(e)?{ok:!0,selection:e}:ri(e)}function ai(e,t){if(!t.configured){let n=Xr();return{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" is not configured${n.length>0?`; configured: ${n.join(`, `)}`:``})`}}let n=Qr(t.modelId,t.providerId);return n?ii(n):{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" does not offer "${t.modelId}")`}}function oi(e,t){let n=Xr().filter(e=>e!==t);for(let t of[`exact`,`shorthand`]){let r=[];for(let i of n){let n=t===`exact`?e:Yr(e.toLowerCase(),[i]);if(n===null)continue;let a=Qr(n,i,!1);a&&r.push(a)}let i=r.filter(ni);if(i.length===0&&r.length>0)return ri(r[0]);if(i.length===1)return{ok:!0,selection:i[0]};if(i.length>1)return{ok:!1,error:`ambiguous model: ${e} matches ${$r(i)} — qualify it as provider:model`}}return{ok:!1,error:`unknown model: ${e}`}}function si(e){let t=ei(e);return t.ok?t.selection.modelId:null}function ci(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{vr as A,si as B,q as C,$ as D,Q as E,Zn as F,lr as G,xr as H,gr as I,kr as J,ur as K,qr as L,Kr as M,yr as N,ir as O,or as P,Cn as Q,Gr as R,er as S,Cr as T,Mr as U,ei as V,Fr as W,wn as X,kn as Y,Tn as Z,Xn as _,nr as a,Tr as b,Ir as c,X as d,sr as f,Er as g,wr as h,mr as i,qn as j,_r as k,Ar as l,jr as m,Yn as n,Rr as o,dr as p,Dr as q,zn as r,Nr as s,G as t,Lr as u,Pr as v,J as w,cr as x,Z as y,Jr as z};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{n,r}from"./panel-rpc-BPwAqRch.js";import{n as i,o as a,t as o}from"./providers-CF2FF0H2.js";import"./proxied-fetch-DUC7X0GS.js";import{a as s,t as c}from"./api-endpoint-Lx_FU5cP.js";import{u as ee}from"./core-B8y1Kyh_.js";import{i as l,n as te,r as u}from"./compat-uEPf6-XW.js";import{t as ne}from"./secrets-bridge-client-C3MaYf_O.js";import{r as re,t as ie}from"./bedrock-camp-compat-CYnC9BQI.js";import{a as d}from"./claude-model-version-CJiITCDG.js";const f=`slicc_oauth_extra_domains`;function p(e){try{let t=e.getItem(f);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function ae(e,t){try{e.setItem(f,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}function oe(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},r=d(e);if(!r)return n;let i;for(let e of t.values()){let t=d(e.id);!t||t.family!==r.family||(!i||t.major>i.major||t.major===i.major&&t.minor>i.minor)&&(i={major:t.major,minor:t.minor,cost:e.cost})}return i?.cost??n}const se=t(`model-policy`),m=`/etc/models`;function h(){return{sections:{}}}function ce(e){let t=e.indexOf(`#`);return(t===-1?e:e.slice(0,t)).trim()}function le(e){let t=h();if(typeof e!=`string`)return t;let n=null;for(let r of e.split(/\r?\n/)){let e=ce(r);if(!e)continue;let i=/^\[([^\]]+)\]$/.exec(e);if(i){n=i[1].trim(),t.sections[n]??=[];continue}if(n===null){se.warn(`model policy entry before any [provider] section — ignored`,{entry:e});continue}let a=e.startsWith(`-`),o=a?e.slice(1).trim():e,s=o.indexOf(`:`);if(s<=0||s===o.length-1){se.warn(`model policy entry is not provider:model — ignored`,{entry:e});continue}t.sections[n].push({providerId:o.slice(0,s).trim(),modelId:o.slice(s+1).trim(),deny:a})}return t}function g(e,t,n){return e.providerId===t?e.modelId===`*`||e.modelId===n:!1}function ue(e,t){return e.sections[t]??[]}function de(e,t,n,r){return ue(e,t).some(e=>e.deny&&g(e,n,r))}function fe(e,t,n,r){let i=ue(e,t);return i.some(e=>e.deny&&g(e,n,r))?!1:n===t||i.some(e=>!e.deny&&g(e,n,r))}let pe=h();function me(e){pe=e}function _(){return pe}function he(e,t,n){return`add \`${t}:${n}\` (or \`${t}:*\`) under \`[${e}]\` in ${m}`}var ge=e({ACCOUNTS_KEY:()=>b,__test__:()=>Se,addAccount:()=>I,applyProviderDefaults:()=>Te,clearAllSettings:()=>Ze,clearApiKey:()=>Ke,clearBaseUrl:()=>Ye,clearSelectedProvider:()=>Ue,exportProviders:()=>Xe,getAccounts:()=>N,getAllAvailableModels:()=>Oe,getAllExtraOAuthDomains:()=>je,getApiKey:()=>We,getApiKeyForProvider:()=>B,getApiVersionForProvider:()=>ze,getAvailableProviders:()=>w,getBaseUrl:()=>qe,getBaseUrlForProvider:()=>V,getDeploymentForProvider:()=>Re,getExtraOAuthDomains:()=>P,getOAuthAccountInfo:()=>k,getProviderConfig:()=>E,getProviderModels:()=>O,getRawApiKeyForProvider:()=>z,getSelectedModelId:()=>H,getSelectedProvider:()=>U,isModelHiddenFromPicker:()=>j,logoutOAuthAccount:()=>Pe,maskOAuthTokenWithRetry:()=>Fe,migrateLegacyAuthOnlySelection:()=>be,modelRunsOnProvider:()=>q,persistOAuthMaskViaServiceWorker:()=>R,policyVisible:()=>M,providerOffersLlmModels:()=>T,removeAccount:()=>L,resolveCurrentModel:()=>J,resolveModelById:()=>K,resolveModelByShorthand:()=>nt,resolveModelIdForScoop:()=>ut,resolveModelSelectionForScoop:()=>Q,saveOAuthAccount:()=>Le,setApiKey:()=>Ge,setBaseUrl:()=>Je,setExtraOAuthDomains:()=>ke,setExtraOAuthDomainsAsync:()=>Ae,setSelectedModelId:()=>Be,setSelectedProvider:()=>He});const v=te,y=u,b=`slicc_accounts`,x=`selected-model`,_e=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],ve=new Set([`github`]);function S(e){let t;try{t=l()}catch{return!1}return t.includes(e)&&!a(e)}let C=!1;function ye(){if(!C){C=!0;for(let e of _e)try{localStorage.removeItem(e)}catch{}be()}}function be(){try{let e=localStorage.getItem(x);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(ve.has(n)||S(n))&&localStorage.removeItem(x)}}}catch{}try{let e=localStorage.getItem(b);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&S(e.providerId)));n.length!==t.length&&localStorage.setItem(b,JSON.stringify(n))}catch{}}function xe(){C=!1}const Se={_resetLegacyCleanup:xe};function w(){let e=l().filter(a),t=i();return[...new Set([...e,...t])].filter(e=>!o(e)?.hidden)}function T(e){try{if(O(e).length>0)return!0}catch{}try{if(u(e).length>0)return!0}catch{}let t=o(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function Ce(e,t){try{if(O(e).some(e=>e.id===t))return!0}catch{}try{if(u(e).some(e=>e.id===t))return!0}catch{}let n=o(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function E(e){return o(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function D(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function O(e){try{if(e===`bedrock-camp`){let e=ie(V(`bedrock-camp`));return y(`amazon-bedrock`).filter(t=>re(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=E(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return A.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of l())try{for(let t of y(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=W(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=oe(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&D(s,c),D(s,n),s})}if(t.isOAuth){let n=y(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&D(i,a),i})}return y(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return A.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function k(e){let t=N().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,scopes:t.scopes,expired:n}}const we=Object.assign({})[`/packages/webapp/providers.json`]??[],A=t(`provider-settings`);function Te(e=we){if(e.length===0||N().length>0)return;let t=new Set(w());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){A.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}I(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(x)&&localStorage.setItem(x,`${n.providerId}:${n.model}`)}const Ee=[/haiku/i];function j(e){return Ee.some(t=>t.test(e))}function De(e){return e.filter(e=>!j(e.id))}function M(e,t){let n=$();if(n===null)return e;let r=_();return e.filter(e=>!de(r,n,t,e.id))}function Oe(){let e=N();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=E(n.providerId);if(e.hidden||S(n.providerId))continue;let r=M(De(O(n.providerId)),n.providerId);if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function N(){ye();let e=localStorage.getItem(b);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function P(e){return p(localStorage)[e]??[]}function ke(e,t){let n=p(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,ae(localStorage,n)}async function Ae(e,t){if(r()){ke(e,t);return}let i=n();if(!i)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:a}=await i.call(`oauth-extras-set`,{providerId:e,domains:t});try{ae(localStorage,a)}catch(t){A.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function je(){return p(localStorage)}function Me(e){localStorage.setItem(b,JSON.stringify(e))}async function F(e){if(r()){Me(e);return}let t=n();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let i=JSON.stringify(e),{storedJson:a}=await t.call(`save-oauth-accounts`,{accountsJson:i});try{localStorage.setItem(b,a)}catch(e){A.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function I(e,t,n,r,i){let a=N().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),Me(a)}async function Ne(e){let t=ee();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&A.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&A.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await ne(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&A.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(s(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:c()});!t.ok&&t.status!==404&&A.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){A.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function L(e){let t=N().find(t=>t.providerId===e),n=E(e);t&&n?.isOAuth&&await Pe(e),await Ne(e),await F(N().filter(t=>t.providerId!==e));let r=localStorage.getItem(x)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(x)}async function Pe(e){let t=N().find(t=>t.providerId===e);if(!t)return;let n=E(e);if(n?.isOAuth){if(n.onOAuthLogout)try{await n.onOAuthLogout()}catch(t){A.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(n.getOAuthLogoutUrl){let r=n.getOAuthLogoutUrl(t);if(r){let{openIdpLogoutUrl:t}=await import(`./oauth-service-Bconf2Pz.js`);await t(r).catch(t=>{A.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await F(N().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await Ne(e)}}async function Fe(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function R(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await Fe(()=>t.sendMaskRequest(r),n);if(!i){A.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}function Ie(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function Le(e){let t=N().find(t=>t.providerId===e.providerId),n=N().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl,scopes:Ie(e,t)}),await F(n);let r=E(e.providerId)?.oauthTokenDomains??[],i=P(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let l=ee();try{if(l===`extension-direct`)await R({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&A.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&A.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:N,saveAccounts:F});else if(l===`extension-delegate`)await R({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>ne(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&A.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(A.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:N,saveAccounts:F});else if(l!==`connect`){let t=await fetch(s(`/api/secrets/oauth-update`),{method:`POST`,headers:c({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=N(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await F(t))}else A.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else A.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){A.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:l,error:t instanceof Error?t.message:String(t)})}}function z(e){let t=N().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function B(e){let t=N().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(E(e).optionalApiKey?`local`:null):null}function V(e){return N().find(t=>t.providerId===e)?.baseUrl??null}function Re(e){return N().find(t=>t.providerId===e)?.deployment??null}function ze(e){return N().find(t=>t.providerId===e)?.apiVersion??null}function H(){let e=localStorage.getItem(x)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function Be(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...i(),...w()]),a=n.includes(`.`);if(r.has(n)||!a){localStorage.setItem(x,e);return}}let n=U();localStorage.setItem(x,`${n}:${e}`)}function Ve(){return localStorage.getItem(x)||``}function U(){let e=Ve(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=N(),r=H();if(r){let e=n.find(e=>T(e.providerId)&&Ce(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>T(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function He(e){let t=H();localStorage.setItem(x,`${e}:${t}`)}function Ue(){let e=H();localStorage.setItem(x,e)}function We(){return B(U())}function Ge(e){let t=U();I(t,e,V(t)??void 0)}async function Ke(){await L(U())}function qe(){return V(U())}function Je(e){let t=U(),n=z(t);n&&I(t,n,e||void 0)}function Ye(){let e=U(),t=z(e);t&&I(e,t)}function Xe(){let e=N(),t=U(),n=H();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function Ze(){let e=N();await Promise.allSettled(e.map(e=>L(e.providerId))),localStorage.removeItem(b),localStorage.removeItem(x);for(let e of _e)localStorage.removeItem(e)}function Qe(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function W(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${Qe(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function G(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function $e(e,t,n){let r=O(e).find(e=>e.id===t);return r?n?{...r,baseUrl:n}:r:null}function et(e,t,n,r){return n.isOAuth?O(t).find(e=>e.id===r)||{...e,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`?{...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}:e}function tt(e,t,n,r,i){if(t.isOAuth)return $e(e,n,r)??W(e,n,r);if(i)throw Error(`Model ${n} is not available from provider ${e}`);return J()}function K(e,t){if(!e)return J();let n=t??U(),r=V(n),i=E(n);if(t!==void 0){let t=$e(n,e,r);if(t)return t}try{let t=G(n,i),a=v(t,e);if(!a?.id)throw Error(`Model ${e} not found`);let o=et(a,n,i,e);return r?{...o,baseUrl:r}:o}catch(a){return A.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:n,modelId:e,error:a instanceof Error?a.message:String(a)}),tt(n,i,e,r,t!==void 0)}}function q(e,t){return e.provider===t||e.provider===G(t,E(t))}function J(){let e=U(),t=H(),n=V(e),r=O(e),i=E(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=G(e,i),a=v(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){A.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?W(e,o,n):v(`anthropic`,`claude-sonnet-4-0`)}}function nt(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=U()}catch{}if(n!==null){let e=Y(t,[n]);if(e!==null)return e}return Y(t,N().map(e=>e.providerId))}function Y(e,t){let n=null,r=-1;for(let i of t)for(let t of O(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&dt(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function X(){let e=[];try{for(let t of N())e.includes(t.providerId)||e.push(t.providerId)}catch{}try{let t=U();e.includes(t)||e.push(t)}catch{}return e}function rt(e){let t=e.indexOf(`:`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1),i=X().includes(n);if(i)return{providerId:n,modelId:r,configured:i};let a=!1;try{a=w().includes(n)}catch{}return a?{providerId:n,modelId:r,configured:!1}:null}function Z(e,t,n=!0){let r=[e],i=n?Y(e.toLowerCase(),[t]):null;i!==null&&i!==e&&r.push(i);let a=[];try{a=O(t)}catch{}for(let n of r)if(!(a.length>0&&!a.some(e=>e.id===n)))try{if(K(n,t).id===n)return{modelId:n,providerId:t}}catch(r){A.debug(`selectModelFromProvider: candidate did not resolve`,{input:e,candidate:n,providerId:t,error:r instanceof Error?r.message:String(r)})}return null}function it(e){return e.map(e=>`${e.providerId}:${e.modelId}`).join(`, `)}function Q(e){if(!e)return{ok:!1,error:`unknown model: (empty)`};let t=rt(e);if(t)return ct(e,t);let n=null;try{n=U()}catch{}if(n!==null){let t=Z(e,n);if(t)return st(t)}return lt(e,n)}function $(){try{return U()}catch{return null}}function at(e){let t=$();return t===null||fe(_(),t,e.providerId,e.modelId)}function ot(e){let t=$()??`<none>`;return{ok:!1,error:`model not allowed: ${`${e.providerId}:${e.modelId}`} is blocked by ${m} while "${t}" is selected — ${he(t,e.providerId,e.modelId)}`}}function st(e){return at(e)?{ok:!0,selection:e}:ot(e)}function ct(e,t){if(!t.configured){let n=X();return{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" is not configured${n.length>0?`; configured: ${n.join(`, `)}`:``})`}}let n=Z(t.modelId,t.providerId);return n?st(n):{ok:!1,error:`unknown model: ${e} (provider "${t.providerId}" does not offer "${t.modelId}")`}}function lt(e,t){let n=X().filter(e=>e!==t);for(let t of[`exact`,`shorthand`]){let r=[];for(let i of n){let n=t===`exact`?e:Y(e.toLowerCase(),[i]);if(n===null)continue;let a=Z(n,i,!1);a&&r.push(a)}let i=r.filter(at);if(i.length===0&&r.length>0)return ot(r[0]);if(i.length===1)return{ok:!0,selection:i[0]};if(i.length>1)return{ok:!1,error:`ambiguous model: ${e} matches ${it(i)} — qualify it as provider:model`}}return{ok:!1,error:`unknown model: ${e}`}}function ut(e){let t=Q(e);return t.ok?t.selection.modelId:null}function dt(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{m as _,ze as a,me as b,k as c,U as d,q as f,Le as g,Q as h,B as i,O as l,K as m,N as n,V as o,J as p,We as r,Re as s,ge as t,H as u,h as v,oe as x,le as y};
@@ -1 +1 @@
1
- import{n as e}from"./panel-rpc-BPwAqRch.js";import{g as t,n,o as r,x as i}from"./account-store-CCqSr710.js";import{a}from"./diagnostics-DN_idNHx.js";import{a as o,i as s,r as c}from"./compat-uEPf6-XW.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-jKEvBgOL.js";import{i as p,n as m,r as h}from"./claude-model-version-CJiITCDG.js";import{n as g}from"./llm-session-id-BZyXP_j2.js";import{n as _,t as v}from"./silent-renew-backoff-B8p8Ja1t.js";import{getOAuthPageOrigin as ee}from"./oauth-service-CT-Lvflt.js";import{n as y}from"./temperature-support-BCoY8YuX.js";import"./provider-settings-CHQp2onM.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function b(e,t){return m(e,t)}function x(e,t,n){return e!==`xhigh`||!t?e:p(t,n)?`xhigh`:h(t,n)?`max`:`high`}function ne(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return x((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function re(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function S(e,t){if(!b(e.id,e.name))return t;let n=t,r=x(n.effort??ne(n.reasoning,e),e.id,e.name);return{...t,onPayload:re(r,n.onPayload)}}function ie(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const C=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function w(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(C.proxyEndpoint)return C.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const T=new Map,E=new Map,D=`slicc-adobe-models`;function O(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}async function k(e){let t=T.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.130.0`}});if(t.ok){let n=await t.json();return T.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function A(e){let t=e.clientId||C.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function j(e){return e.scopes||C.scopes}function M(e){return e.imsEnvironment||C.imsEnvironment||`prod`}const N={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function P(e){return N[e??C.imsEnvironment??`prod`]??N.prod}const F=typeof chrome<`u`&&!!chrome?.runtime?.id;function I(){return n().find(e=>e.providerId===`adobe`)}async function ae(e,t){try{let n=await fetch(`${P(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function L(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const R={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!C.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`,`api.aem.live`],getModelIds:()=>{let e=e=>ie(e,E.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return O(n),n}for(let t of T.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,n,r)=>{let i=w(),a=await k(i),o=A(a),s=j(a),c=M(a),l=F?null:await ee(),u=F?null:_({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),d=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${P(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=L(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await ae(g.accessToken,c);await t({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:g.scope,baseUrl:C.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),n()},onOAuthLogout:async()=>{let e=I();if(e?.accessToken)try{let t=T.values().next().value??{},n=t.clientId||C.clientId,r=M(t);if(n){let t=await fetch(`${P(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await t({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>I()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=R.getModelIds?.();t?.length&&O(t)}};let z=null;const oe=v();async function B(){let e=I();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await oe.run(()=>V());if(t)return t;let n=I();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function se(){let e=I();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return z===null&&(z=U().finally(()=>{z=null})),z}function ce(e,t){let n=A(t),r=j(t),i=M(t),a=F?null:_({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),o=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${P(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function le(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,n){let r=I();await t({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:e.scope,baseUrl:C.proxyEndpoint?void 0:n})}async function U(){try{let e=w(),{authorizeUrl:t,expectedNonce:n}=ce(e,await k(e)),{createOAuthLauncher:r}=await import(`./oauth-service-CT-Lvflt.js`),i=await r()(t,{interactive:!1});if(!i||!le(i,n))return null;let a=L(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.130.0`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":g(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,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()}}}function Y(e){console.error(`[adobe] Stream error:`,e instanceof Error?e.message:String(e))}const X=(e,t,n={})=>{let r=a();return de(r,e,t,n).catch(Y),r};async function de(e,t,n,r){try{let i=await B();if(String(t.api).includes(`openai`)){let a={...t,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=u(a,n,G(q({...r,apiKey:i},`streamAdobe[openai]`)));for await(let t of o)e.push(t)}else{let a={...t,baseUrl:w(),api:`anthropic-messages`},o=f(a,n,G(q(S(t,y(t.id,t.name,{...r,apiKey:i})),`streamAdobe[anthropic]`)));for await(let t of o)e.push(t)}e.end()}catch(n){Y(n),e.push(J(t,n)),e.end()}}const Z=(e,t,n)=>{let r=a();return fe(r,e,t,n).catch(Y),r};async function fe(e,t,n,r){try{let i=await B();if(String(t.api).includes(`openai`)){let a={...t,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=d(a,n,G(q({...r,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let t of o)e.push(t)}else{let a={...t,baseUrl:w(),api:`anthropic-messages`},o=l(a,n,G(q(S(t,y(t.id,t.name,{...r,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let t of o)e.push(t)}e.end()}catch(n){Y(n),e.push(J(t,n)),e.end()}}function pe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function me(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function he(e,t,n){let r=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=n.get(e.id);if(a)return{...a,provider:`adobe`,api:r};let o=i(e.id,n);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:r,baseUrl:t,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function ge(e,t){for(let t of e)E.set(t.id,pe(t));let n=me();return e.map(e=>he(e,t,n))}async function _e(e){try{let t=e??await B(),n=w(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.130.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return ge(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function ve(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=w(),n=Q.get(t);if(n)return n;let r=await _e(e);return r?(Q.set(t,r),r):ve()}function ye(){o({api:`adobe-anthropic`,stream:X,streamSimple:Z}),o({api:`adobe-openai`,stream:X,streamSimple:Z})}export{ue as __resetAdobeSessionIdWarningCacheForTests,R as config,L as extractTokenFromUrl,$ as getAdobeModels,B as getValidAccessToken,se as isTokenExpired,ye as register};
1
+ import{n as e}from"./panel-rpc-BPwAqRch.js";import{g as t,n,o as r,x as i}from"./account-store-naVgJKHe.js";import{a}from"./diagnostics-DN_idNHx.js";import{a as o,i as s,r as c}from"./compat-uEPf6-XW.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-jKEvBgOL.js";import{i as p,n as m,r as h}from"./claude-model-version-CJiITCDG.js";import{n as g}from"./llm-session-id-BZyXP_j2.js";import{n as _,t as v}from"./silent-renew-backoff-DIMz5UqB.js";import{getOAuthPageOrigin as ee}from"./oauth-service-Bconf2Pz.js";import{n as y}from"./temperature-support-BCoY8YuX.js";import"./provider-settings-C6uIHjd4.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function b(e,t){return m(e,t)}function x(e,t,n){return e!==`xhigh`||!t?e:p(t,n)?`xhigh`:h(t,n)?`max`:`high`}function ne(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return x((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function re(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function S(e,t){if(!b(e.id,e.name))return t;let n=t,r=x(n.effort??ne(n.reasoning,e),e.id,e.name);return{...t,onPayload:re(r,n.onPayload)}}function ie(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const C=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function w(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(C.proxyEndpoint)return C.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const T=new Map,E=new Map,D=`slicc-adobe-models`;function O(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}async function k(e){let t=T.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.131.0`}});if(t.ok){let n=await t.json();return T.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function A(e){let t=e.clientId||C.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function j(e){return e.scopes||C.scopes}function M(e){return e.imsEnvironment||C.imsEnvironment||`prod`}const N={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function P(e){return N[e??C.imsEnvironment??`prod`]??N.prod}const F=typeof chrome<`u`&&!!chrome?.runtime?.id;function I(){return n().find(e=>e.providerId===`adobe`)}async function ae(e,t){try{let n=await fetch(`${P(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function L(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const R={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!C.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`,`api.aem.live`],getModelIds:()=>{let e=e=>ie(e,E.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return O(n),n}for(let t of T.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,n,r)=>{let i=w(),a=await k(i),o=A(a),s=j(a),c=M(a),l=F?null:await ee(),u=F?null:_({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),d=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${P(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=L(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await ae(g.accessToken,c);await t({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:g.scope,baseUrl:C.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),n()},onOAuthLogout:async()=>{let e=I();if(e?.accessToken)try{let t=T.values().next().value??{},n=t.clientId||C.clientId,r=M(t);if(n){let t=await fetch(`${P(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await t({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>I()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=R.getModelIds?.();t?.length&&O(t)}};let z=null;const oe=v();async function B(){let e=I();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await oe.run(()=>V());if(t)return t;let n=I();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function se(){let e=I();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return z===null&&(z=U().finally(()=>{z=null})),z}function ce(e,t){let n=A(t),r=j(t),i=M(t),a=F?null:_({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),o=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${P(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function le(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,n){let r=I();await t({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:e.scope,baseUrl:C.proxyEndpoint?void 0:n})}async function U(){try{let e=w(),{authorizeUrl:t,expectedNonce:n}=ce(e,await k(e)),{createOAuthLauncher:r}=await import(`./oauth-service-Bconf2Pz.js`),i=await r()(t,{interactive:!1});if(!i||!le(i,n))return null;let a=L(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.131.0`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":g(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,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()}}}function Y(e){console.error(`[adobe] Stream error:`,e instanceof Error?e.message:String(e))}const X=(e,t,n={})=>{let r=a();return de(r,e,t,n).catch(Y),r};async function de(e,t,n,r){try{let i=await B();if(String(t.api).includes(`openai`)){let a={...t,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=u(a,n,G(q({...r,apiKey:i},`streamAdobe[openai]`)));for await(let t of o)e.push(t)}else{let a={...t,baseUrl:w(),api:`anthropic-messages`},o=f(a,n,G(q(S(t,y(t.id,t.name,{...r,apiKey:i})),`streamAdobe[anthropic]`)));for await(let t of o)e.push(t)}e.end()}catch(n){Y(n),e.push(J(t,n)),e.end()}}const Z=(e,t,n)=>{let r=a();return fe(r,e,t,n).catch(Y),r};async function fe(e,t,n,r){try{let i=await B();if(String(t.api).includes(`openai`)){let a={...t,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...t.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=d(a,n,G(q({...r,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let t of o)e.push(t)}else{let a={...t,baseUrl:w(),api:`anthropic-messages`},o=l(a,n,G(q(S(t,y(t.id,t.name,{...r,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let t of o)e.push(t)}e.end()}catch(n){Y(n),e.push(J(t,n)),e.end()}}function pe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function me(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function he(e,t,n){let r=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=n.get(e.id);if(a)return{...a,provider:`adobe`,api:r};let o=i(e.id,n);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:r,baseUrl:t,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function ge(e,t){for(let t of e)E.set(t.id,pe(t));let n=me();return e.map(e=>he(e,t,n))}async function _e(e){try{let t=e??await B(),n=w(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.131.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return ge(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function ve(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=w(),n=Q.get(t);if(n)return n;let r=await _e(e);return r?(Q.set(t,r),r):ve()}function ye(){o({api:`adobe-anthropic`,stream:X,streamSimple:Z}),o({api:`adobe-openai`,stream:X,streamSimple:Z})}export{ue as __resetAdobeSessionIdWarningCacheForTests,R as config,L as extractTokenFromUrl,$ as getAdobeModels,B as getValidAccessToken,se as isTokenExpired,ye as register};