sliccy 5.22.1 → 5.23.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 (272) hide show
  1. package/dist/ui/assets/__vite-browser-external-B0uIxSgw.js +1 -0
  2. package/dist/ui/assets/__vite-browser-external-SwrSgYTf.js +1 -0
  3. package/dist/ui/assets/{account-store-B5AAJzBt.js → account-store-BPvwufEr.js} +3 -3
  4. package/dist/ui/assets/account-store-DRcHIayv.js +38 -0
  5. package/dist/ui/assets/addon-fit-Crogpbda.js +13 -0
  6. package/dist/ui/assets/addon-fit-DIOBYJe3.js +1 -0
  7. package/dist/ui/assets/{adobe-DBwkbkPG.js → adobe-BQa2f_tZ.js} +2 -2
  8. package/dist/ui/assets/{adobe-Y2joCBjz.js → adobe-C1RMD4-d.js} +1 -1
  9. package/dist/ui/assets/{adobe-oauth-state-JZ01HRhm.js → adobe-oauth-state-CblNBQQR.js} +1 -1
  10. package/dist/ui/assets/{agent-message-to-chat-B7DxkLtx.js → agent-message-to-chat-LRySxnvm.js} +1 -1
  11. package/dist/ui/assets/{anthropic-DwYAPtk5.js → anthropic-BOEkIcb-.js} +1 -1
  12. package/dist/ui/assets/{anthropic-UMaEJx-B.js → anthropic-LjoeX6v-.js} +1 -1
  13. package/dist/ui/assets/{apps-NPLXYm7k.js → apps-CZ4QaYIZ.js} +1 -1
  14. package/dist/ui/assets/{azure-openai-DQD0h1cf.js → azure-openai-D-59h58z.js} +1 -1
  15. package/dist/ui/assets/{azure-openai-zQvRqW3S.js → azure-openai-DZghfFcd.js} +1 -1
  16. package/dist/ui/assets/{azure-openai-responses-Bnxym5u-.js → azure-openai-responses-CbJrQGi8.js} +1 -1
  17. package/dist/ui/assets/{azure-openai-responses-Ds4b3a5B.js → azure-openai-responses-DPSrcT4o.js} +1 -1
  18. package/dist/ui/assets/{backend-local-D7FqJaoi.js → backend-local-BgTSBOxM.js} +1 -1
  19. package/dist/ui/assets/bedrock-camp-DjKgax8m.js +1 -0
  20. package/dist/ui/assets/{bedrock-camp-C1lmRgcD.js → bedrock-camp-DlP7CPgV.js} +2 -2
  21. package/dist/ui/assets/{browser-D0vICVpZ.js → browser-2wdq8OwU.js} +5 -5
  22. package/dist/ui/assets/{cdp-5C0rLyuM.js → cdp-D7cRI5-J.js} +1 -1
  23. package/dist/ui/assets/clipboard-DuHpK59o.js +1 -0
  24. package/dist/ui/assets/{composer-speech-DXkl5-5T.js → composer-speech-CzcwBzGA.js} +1 -1
  25. package/dist/ui/assets/{connect-surface-DPgfQrfS.js → connect-surface-RiZUIrxS.js} +1 -1
  26. package/dist/ui/assets/{context-compaction-CFWyOzX1.js → context-compaction-DvlXtgVG.js} +1 -1
  27. package/dist/ui/assets/dip-BFDee3ZP.js +1 -0
  28. package/dist/ui/assets/{dist-jdlcYxrm.js → dist-0c-Ms6jt.js} +1 -1
  29. package/dist/ui/assets/{dist-k2Xmqc09.js → dist-BHXb30bf.js} +2 -2
  30. package/dist/ui/assets/{dist-BBhtjNOt.js → dist-Bw2SRiP7.js} +1 -1
  31. package/dist/ui/assets/dist-C30gQBcj2.js +12 -0
  32. package/dist/ui/assets/{dist-Dnh15m1q.js → dist-CC_gNVTb.js} +1 -1
  33. package/dist/ui/assets/dist-Cn_I6fkq.js +18 -0
  34. package/dist/ui/assets/{dist-DQRYKv91.js → dist-D1pcMg_U.js} +1 -1
  35. package/dist/ui/assets/{dist-CrC-F8vu.js → dist-D58cmC11.js} +1 -1
  36. package/dist/ui/assets/{dist-BmWy99kl.js → dist-D69OmKNn.js} +3 -3
  37. package/dist/ui/assets/{dist-AEf8Bitj2.js → dist-DD6YY4Ks2.js} +1 -1
  38. package/dist/ui/assets/{dist-cWUxvK-0.js → dist-SzMJHiOE.js} +1 -1
  39. package/dist/ui/assets/{ensure-speech-assets-PqnGhxvS.js → ensure-speech-assets-Bax4J0R4.js} +1 -1
  40. package/dist/ui/assets/{es-C8ey2woP.js → es-kEo2Tmh4.js} +4 -4
  41. package/dist/ui/assets/esp32-D9ZurRwV.js +1 -0
  42. package/dist/ui/assets/{esp32c2-CpROmlB0.js → esp32c2-F0yCL7ES.js} +1 -1
  43. package/dist/ui/assets/esp32c3-wVAODszM.js +1 -0
  44. package/dist/ui/assets/{esp32c5-KJSqwo2Q.js → esp32c5-ChTI-uFN.js} +1 -1
  45. package/dist/ui/assets/{esp32c6-BMEnOhZ6.js → esp32c6-IwoGEmKl.js} +1 -1
  46. package/dist/ui/assets/{esp32c61-sRp43nbI.js → esp32c61-BJScMw70.js} +1 -1
  47. package/dist/ui/assets/{esp32h2-BKv-WORi.js → esp32h2-YosZEx9u.js} +1 -1
  48. package/dist/ui/assets/{esp32p4-g1tFG0sh.js → esp32p4-BSe822vW.js} +1 -1
  49. package/dist/ui/assets/{esp32s2-BE2gO68i.js → esp32s2-Dhlhu16A.js} +1 -1
  50. package/dist/ui/assets/{esp32s3-CjMu3q4c.js → esp32s3-PqxbnxPZ.js} +1 -1
  51. package/dist/ui/assets/esp8266-CgqhR4Wc.js +1 -0
  52. package/dist/ui/assets/esp8266-CuMaVNVI.js +1 -0
  53. package/dist/ui/assets/{esptool-operations-CtOW5Bvs.js → esptool-operations-CNxPdlH_.js} +2 -2
  54. package/dist/ui/assets/esptool-operations-KWVZgO7d.js +12 -0
  55. package/dist/ui/assets/{follower-navigate-watcher-CnHWEu_l.js → follower-navigate-watcher-quUh7-CS.js} +1 -1
  56. package/dist/ui/assets/fs-D6GWcrVb.js +1 -0
  57. package/dist/ui/assets/{fs-DsYwmfat.js → fs-njSrzhNh.js} +2 -2
  58. package/dist/ui/assets/{github-Cvm06fID.js → github-C5iKeyIZ.js} +2 -2
  59. package/dist/ui/assets/{github-DC_I-4id.js → github-CY1vTcwt.js} +1 -1
  60. package/dist/ui/assets/{github-copilot-D1jvjcWk.js → github-copilot-BkzVAtWq.js} +1 -1
  61. package/dist/ui/assets/{github-copilot-CaycmR7s.js → github-copilot-C_XDJI-F.js} +2 -2
  62. package/dist/ui/assets/{google-CEOynCO5.js → google-C3U0TK_l.js} +1 -1
  63. package/dist/ui/assets/{google-CSaY-DQE.js → google-DPvIPcfE.js} +1 -1
  64. package/dist/ui/assets/google-shared-CFmFmYdk.js +11 -0
  65. package/dist/ui/assets/{google-shared-RiqqHuiz.js → google-shared-CwjAeP6N.js} +1 -1
  66. package/dist/ui/assets/{google-vertex-CBHKHWKe.js → google-vertex-BbeV3aSP.js} +1 -1
  67. package/dist/ui/assets/{google-vertex-C7BX8ATF.js → google-vertex-CEGsokz8.js} +1 -1
  68. package/dist/ui/assets/{handoff-link-ywwq4k0t.js → handoff-link-w8LYa3Ua.js} +1 -1
  69. package/dist/ui/assets/{hear-DH3US_c_.js → hear--VyWD7WJ.js} +1 -1
  70. package/dist/ui/assets/{hear-DcdV-O0r.js → hear-DMzpXyvS.js} +1 -1
  71. package/dist/ui/assets/hid-device-registry-6w-g8ZpF.js +1 -0
  72. package/dist/ui/assets/hid-picker-CE6gGmQt.js +1 -0
  73. package/dist/ui/assets/icons-C5g936Qd.js +1 -0
  74. package/dist/ui/assets/{index-BeMnZBAU.js → index-AMF5XZgS.js} +72 -71
  75. package/dist/ui/assets/intercepted-oauth-CaCw-rJ5.js +1 -0
  76. package/dist/ui/assets/js-realm-worker-BYZQ59hJ.js +49 -0
  77. package/dist/ui/assets/json-parse-B51EftGA.js +3 -0
  78. package/dist/ui/assets/json-parse-C7d6hyOc.js +3 -0
  79. package/dist/ui/assets/{kernel-worker-BPzoZWCC.js → kernel-worker-BuLAKxNE.js} +1236 -834
  80. package/dist/ui/assets/kokoro-BFFlHn4y.js +4 -0
  81. package/dist/ui/assets/kokoro-C-DxSDte.js +4 -0
  82. package/dist/ui/assets/{kokoro-engine-C_U1dfXB.js → kokoro-engine-CVpfUNNb.js} +2 -2
  83. package/dist/ui/assets/{legacy-styles-4PP74ISo.js → legacy-styles-CF6h7ytf.js} +1 -1
  84. package/dist/ui/assets/{lick-ws-bridge-B5dwesqM.js → lick-ws-bridge--Vksc7F9.js} +1 -1
  85. package/dist/ui/assets/{lick-ws-bridge-BEQEICiF.js → lick-ws-bridge-DAzGsuBg.js} +1 -1
  86. package/dist/ui/assets/llm-session-id-bZQs6gBN.js +1 -0
  87. package/dist/ui/assets/{local-llm-BdRRF3n_.js → local-llm-B3sNRJii.js} +1 -1
  88. package/dist/ui/assets/{main-ikPJox6X.js → main-BME4pJJo.js} +4 -4
  89. package/dist/ui/assets/{main-cherry-NiJ4PeFm.js → main-cherry-DkK6hE90.js} +1 -1
  90. package/dist/ui/assets/mistral-CLF3Mo4W.js +46 -0
  91. package/dist/ui/assets/mistral-DkJAVbOW.js +46 -0
  92. package/dist/ui/assets/mount-Bix58hlG.js +1 -0
  93. package/dist/ui/assets/{mount-BzqSY0Ds.js → mount-CW5miKSN.js} +2 -2
  94. package/dist/ui/assets/mount-bridge-client-DnDk55XZ.js +2 -0
  95. package/dist/ui/assets/mount-picker-popup-Cw_D7c_n.js +1 -0
  96. package/dist/ui/assets/mount-table-store-CfQUN_2R.js +1 -0
  97. package/dist/ui/assets/mount-table-store-s20mtVA3.js +1 -0
  98. package/dist/ui/assets/{navigation-watcher-BxAAD5To.js → navigation-watcher-C2s0i0h4.js} +1 -1
  99. package/dist/ui/assets/{new-session-BuL7Wbcu.js → new-session-CS1WEhLm.js} +2 -2
  100. package/dist/ui/assets/{oauth-bootstrap-CZmzBdaJ.js → oauth-bootstrap-B2wuItHI.js} +2 -2
  101. package/dist/ui/assets/{oauth-service-D-lmxdpH.js → oauth-service-R7EZswi4.js} +1 -1
  102. package/dist/ui/assets/{oauth-service-ahaKd8Mt.js → oauth-service-ySAsf2gs.js} +1 -1
  103. package/dist/ui/assets/{onboarding-orchestrator-CADSztcp.js → onboarding-orchestrator-cZ36aqC6.js} +1 -1
  104. package/dist/ui/assets/{openai-Cn5LRPCm.js → openai-BeH6aC_-.js} +1 -1
  105. package/dist/ui/assets/{openai-i4HWKCeW.js → openai-BvKpRLAG.js} +1 -1
  106. package/dist/ui/assets/{openai-codex-D0rJf0rr.js → openai-codex-BnYyNqXj.js} +1 -1
  107. package/dist/ui/assets/{openai-codex-hB78BX6P.js → openai-codex-D_k1NXCs.js} +1 -1
  108. package/dist/ui/assets/{openai-codex-responses-Cq5XDqVc.js → openai-codex-responses-B2oZ1hgB.js} +1 -1
  109. package/dist/ui/assets/{openai-codex-responses-7JN1dUxK.js → openai-codex-responses-Dumyd9t2.js} +1 -1
  110. package/dist/ui/assets/{openai-completions-DLI0t_lj.js → openai-completions-B2n4Op2S.js} +1 -1
  111. package/dist/ui/assets/openai-completions-aHU8w14d.js +5 -0
  112. package/dist/ui/assets/{openai-responses-ANbRIlpa.js → openai-responses-4ryIAXQS.js} +1 -1
  113. package/dist/ui/assets/{openai-responses-nczmKECx.js → openai-responses-BurVahs3.js} +1 -1
  114. package/dist/ui/assets/{openai-responses-shared-CM2vkuNI.js → openai-responses-shared-BebU8o_f.js} +1 -1
  115. package/dist/ui/assets/{openai-responses-shared-9YVaeX5D.js → openai-responses-shared-D9O9OCYB.js} +1 -1
  116. package/dist/ui/assets/{openrouter-Cy2dLX1Z.js → openrouter-B1ruTb6k.js} +1 -1
  117. package/dist/ui/assets/{openrouter-QETwrep8.js → openrouter-XmffhsNH.js} +1 -1
  118. package/dist/ui/assets/page-follower-tray-CKvoa8Vc.js +5 -0
  119. package/dist/ui/assets/panel-rpc-CjFVE0nK.js +1 -0
  120. package/dist/ui/assets/panel-rpc-DmJSNs0I.js +1 -0
  121. package/dist/ui/assets/panel-rpc-handlers-B-gE3pP7.js +2 -0
  122. package/dist/ui/assets/{pdfjs-C3ks1z_T.js → pdfjs-BdCnB7P8.js} +7 -7
  123. package/dist/ui/assets/preload-helper-CZgWQFsJ.js +1 -0
  124. package/dist/ui/assets/{provider-Dv05sEX_.js → provider-DO4PGsF_.js} +2 -2
  125. package/dist/ui/assets/{provider-ByZ5S_p0.js → provider-lR1ovrWJ.js} +1 -1
  126. package/dist/ui/assets/provider-store-access-4kR4SrNf.js +1 -0
  127. package/dist/ui/assets/provider-store-access-Clj85PSW.js +1 -0
  128. package/dist/ui/assets/providers-CChuPgRN.js +1 -0
  129. package/dist/ui/assets/providers-lNcU6L-a.js +2 -0
  130. package/dist/ui/assets/proxied-fetch-DzLglfG5.js +2 -0
  131. package/dist/ui/assets/proxied-fetch-R_Zw2ZFI.js +1 -0
  132. package/dist/ui/assets/py-realm-worker-Cr26Gsx8.js +244 -0
  133. package/dist/ui/assets/{pyodide-CPgzyJWn.js → pyodide-CHuPF4e3.js} +2 -2
  134. package/dist/ui/assets/{pyodide-BFyW4kyI.js → pyodide-Dp0v7U2K.js} +2 -2
  135. package/dist/ui/assets/quick-llm-BcXxSY4e.js +1 -0
  136. package/dist/ui/assets/remote-cache-D59F5FOx.js +1 -0
  137. package/dist/ui/assets/remote-cdp-transport-DTCu2BgA.js +1 -0
  138. package/dist/ui/assets/{remote-terminal-view-DIEOCe9M.js → remote-terminal-view-B_2LHY8s.js} +1 -1
  139. package/dist/ui/assets/{secret-env-Bs2du0RF.js → secret-env-guT2rdYI.js} +1 -1
  140. package/dist/ui/assets/{secret-topology-Bp0wH2ni.js → secret-topology-CC_yKaqL.js} +1 -1
  141. package/dist/ui/assets/secrets-bridge-client-C3K9ItX4.js +2 -0
  142. package/dist/ui/assets/serial-picker-1VVNQI8D.js +1 -0
  143. package/dist/ui/assets/serial-port-registry-DsPZvGpT.js +1 -0
  144. package/dist/ui/assets/session-freezer-CgXtJVLu.js +1 -0
  145. package/dist/ui/assets/session-store-DAM8GRJ0.js +1 -0
  146. package/dist/ui/assets/{setup-sprinkle-exec-C7SBZY7y.js → setup-sprinkle-exec-P2hO-taT.js} +1 -1
  147. package/dist/ui/assets/shared-CrHp2zdc.js +1 -0
  148. package/dist/ui/assets/{slicc-editor-BdfBeQCF.js → slicc-editor-DKckizoI.js} +2 -2
  149. package/dist/ui/assets/{speak-MyRHeKEI.js → speak-B0KXFDjL.js} +1 -1
  150. package/dist/ui/assets/{speak-7UzWyUVB.js → speak-BwWMiCus.js} +3 -3
  151. package/dist/ui/assets/speech-assets-bridge-CFYafE89.js +1 -0
  152. package/dist/ui/assets/{sprinkle-bridge-CwelAMwV.js → sprinkle-bridge-DL0PzEfD.js} +1 -1
  153. package/dist/ui/assets/{sprinkle-manager-BO97yMYB.js → sprinkle-manager-BrnXYZNe.js} +1 -1
  154. package/dist/ui/assets/{sprinkle-renderer-GiRRbdBx.js → sprinkle-renderer-CsUow5K7.js} +3 -3
  155. package/dist/ui/assets/{sql-wasm-BWbkWL23.js → sql-wasm-JpZkOS2Q.js} +1 -1
  156. package/dist/ui/assets/store-CiLd7Ltk.js +1 -0
  157. package/dist/ui/assets/{sudo-B3pJPQs-.js → sudo-SbEy0lx-.js} +3 -3
  158. package/dist/ui/assets/{sync-dialog-BFKWO6DT.js → sync-dialog-Ie_5SqoO.js} +1 -1
  159. package/dist/ui/assets/theme-Ca4mHxHv.js +1 -0
  160. package/dist/ui/assets/theme-engine-LmGLoWYX.js +3 -0
  161. package/dist/ui/assets/theme-presets-xiOb9AFN.js +1 -0
  162. package/dist/ui/assets/transform-messages-DiIjWKhh.js +1 -0
  163. package/dist/ui/assets/{transformers-env-ChIHsg1x.js → transformers-env-Blt6HC_1.js} +1 -1
  164. package/dist/ui/assets/{transformers-env-aCI8ZBPo.js → transformers-env-D24AdCVb.js} +1 -1
  165. package/dist/ui/assets/{transformers.web-BxHOGVSB.js → transformers.web-C6PlPLR-.js} +1 -1
  166. package/dist/ui/assets/{transformers.web-CuUo4MLm.js → transformers.web-DkJGoARp.js} +1 -1
  167. package/dist/ui/assets/tray-leader-Ce8YyKO5.js +1 -0
  168. package/dist/ui/assets/{tray-leave-runtime-Cp7gif8T.js → tray-leave-runtime-DWG6ewDi.js} +1 -1
  169. package/dist/ui/assets/{upgrade-detection-wH_AibnK.js → upgrade-detection-Bahy2mfY.js} +1 -1
  170. package/dist/ui/assets/usb-device-registry-k6vTKonT.js +1 -0
  171. package/dist/ui/assets/{usb-operations-CkcrNzZw.js → usb-operations-D-YdmmuG.js} +1 -1
  172. package/dist/ui/assets/usb-picker-SsbXAvwt.js +1 -0
  173. package/dist/ui/assets/{voice-reply-BDk5Fpiq.js → voice-reply-CdDTbx5C.js} +1 -1
  174. package/dist/ui/assets/{wc-attach-DGZYM1OK.js → wc-attach-P61GYoY8.js} +3 -3
  175. package/dist/ui/assets/wc-extension-C_Atv9M1.js +2 -0
  176. package/dist/ui/assets/{wc-float-label-h04JFcqz.js → wc-float-label-COQsLLC2.js} +1 -1
  177. package/dist/ui/assets/wc-follower-DLWJH9Wm.js +2 -0
  178. package/dist/ui/assets/{wc-live-DuR78HgI.js → wc-live-CKisGrn6.js} +16 -16
  179. package/dist/ui/assets/wc-nav-C8bnEda_.js +2 -0
  180. package/dist/ui/assets/{wc-onboarding-C0d6FLJ4.js → wc-onboarding-DQOqFqNj.js} +2 -2
  181. package/dist/ui/assets/{wc-permissions-DmHMvdiC.js → wc-permissions-CBFvg_0i.js} +3 -3
  182. package/dist/ui/assets/{wc-permissions-providers-BufEXbhX.js → wc-permissions-providers-Cdznv6xX.js} +2 -2
  183. package/dist/ui/assets/wc-permissions-registry-Blyunq37.js +1 -0
  184. package/dist/ui/assets/wc-permissions-registry-C7PhTX3c.js +1 -0
  185. package/dist/ui/assets/{wc-placeholder-kmCcazRQ.js → wc-placeholder-ClGtIyUC.js} +3 -3
  186. package/dist/ui/assets/wc-settings-CH0fgu4m.js +48 -0
  187. package/dist/ui/assets/{wc-shell-K09L81_T.js → wc-shell-FqlPeZfJ.js} +4 -4
  188. package/dist/ui/assets/wc-sprinkles-BtyrEgiD.js +2 -0
  189. package/dist/ui/assets/wc-tray-Dgcd1QIL.js +2 -0
  190. package/dist/ui/assets/welcome-detection-CQY88hjL.js +1 -0
  191. package/dist/ui/assets/{whisper-engine-BQDoahWw.js → whisper-engine-DcSK9vG0.js} +1 -1
  192. package/dist/ui/assets/{whisper-session-bkHemaIa.js → whisper-session-tJ8m9ShN.js} +2 -2
  193. package/dist/ui/assets/{xai-grok-Cor2f5tX.js → xai-grok-CEiCsU5v.js} +1 -1
  194. package/dist/ui/assets/{xai-grok-DoeknEbg.js → xai-grok-CtCLXgPn.js} +1 -1
  195. package/dist/ui/assets/{xterm-DooSxjI5.js → xterm-DMlKjmUi.js} +2 -2
  196. package/dist/ui/assets/{xterm-B5O_KJMf.js → xterm-Dwh1I9AE.js} +2 -2
  197. package/dist/ui/index.html +16 -16
  198. package/dist/ui/packages/webapp/index.html +16 -16
  199. package/package.json +4 -4
  200. package/dist/ui/assets/__vite-browser-external-BdY91arR.js +0 -1
  201. package/dist/ui/assets/__vite-browser-external-C7iut881.js +0 -1
  202. package/dist/ui/assets/account-store-CWhir8ug.js +0 -38
  203. package/dist/ui/assets/addon-fit-CuuUKmBe.js +0 -13
  204. package/dist/ui/assets/addon-fit-DthTIhi3.js +0 -1
  205. package/dist/ui/assets/bedrock-camp-9-QEmC9Z.js +0 -1
  206. package/dist/ui/assets/clipboard-DgFtRQbq.js +0 -1
  207. package/dist/ui/assets/dip-DJpITso2.js +0 -1
  208. package/dist/ui/assets/dist-C9EI5Muo.js +0 -18
  209. package/dist/ui/assets/dist-eRjRxbMY2.js +0 -12
  210. package/dist/ui/assets/esp32-CatgC_Vd.js +0 -1
  211. package/dist/ui/assets/esp32c3-heViyR1Q.js +0 -1
  212. package/dist/ui/assets/esp8266-B85qh4x8.js +0 -1
  213. package/dist/ui/assets/esp8266-BPLrOmN4.js +0 -1
  214. package/dist/ui/assets/esptool-operations-CiX8mbpu.js +0 -12
  215. package/dist/ui/assets/fs-CmruV6CG.js +0 -1
  216. package/dist/ui/assets/google-shared-CVRDRmWo.js +0 -11
  217. package/dist/ui/assets/hid-device-registry-D2LsJCRr.js +0 -1
  218. package/dist/ui/assets/hid-picker-DUJBI46p.js +0 -1
  219. package/dist/ui/assets/icons-BU6llBsN.js +0 -1
  220. package/dist/ui/assets/intercepted-oauth-E9BfBX02.js +0 -1
  221. package/dist/ui/assets/js-realm-worker-CPYpgfMX.js +0 -49
  222. package/dist/ui/assets/json-parse-BUunmmNl.js +0 -3
  223. package/dist/ui/assets/json-parse-CWht3lea.js +0 -3
  224. package/dist/ui/assets/kokoro-B5jJ2WUJ.js +0 -4
  225. package/dist/ui/assets/kokoro-BdpwC7DT.js +0 -4
  226. package/dist/ui/assets/llm-session-id-DVmZ9C2t.js +0 -1
  227. package/dist/ui/assets/mistral-BTNTllXI.js +0 -46
  228. package/dist/ui/assets/mistral-BzfpfZhh.js +0 -46
  229. package/dist/ui/assets/mount-BuISK4CQ.js +0 -1
  230. package/dist/ui/assets/mount-bridge-client-tEnjiHyh.js +0 -2
  231. package/dist/ui/assets/mount-picker-popup-Hrvzr69c.js +0 -1
  232. package/dist/ui/assets/mount-table-store-DAENz45Q.js +0 -1
  233. package/dist/ui/assets/mount-table-store-ggb440m4.js +0 -1
  234. package/dist/ui/assets/openai-completions-YNL_qr9N.js +0 -5
  235. package/dist/ui/assets/page-follower-tray-B9zUJ1fF.js +0 -4
  236. package/dist/ui/assets/panel-rpc-D0J5pskz.js +0 -1
  237. package/dist/ui/assets/panel-rpc-DqT2FG7c.js +0 -1
  238. package/dist/ui/assets/panel-rpc-handlers-BeKhgKcK.js +0 -2
  239. package/dist/ui/assets/preload-helper-zJ_50EbN.js +0 -1
  240. package/dist/ui/assets/provider-store-access-C2Qckshj.js +0 -1
  241. package/dist/ui/assets/provider-store-access-DXcnGsNd.js +0 -1
  242. package/dist/ui/assets/providers-D0vM4fsT.js +0 -2
  243. package/dist/ui/assets/providers-D9vYR704.js +0 -1
  244. package/dist/ui/assets/proxied-fetch-B5vr_AP8.js +0 -2
  245. package/dist/ui/assets/proxied-fetch-I4cndszg.js +0 -1
  246. package/dist/ui/assets/py-realm-worker-LVNFvu8J.js +0 -244
  247. package/dist/ui/assets/quick-llm-ZN9ts94Z.js +0 -1
  248. package/dist/ui/assets/remote-cache-BL6NRenp.js +0 -1
  249. package/dist/ui/assets/remote-cdp-transport-BrkfZae9.js +0 -1
  250. package/dist/ui/assets/secrets-bridge-client-DXw32cXb.js +0 -2
  251. package/dist/ui/assets/serial-picker-B6s4NeaB.js +0 -1
  252. package/dist/ui/assets/serial-port-registry-Bc4wlwED.js +0 -1
  253. package/dist/ui/assets/session-freezer-CQVd5phs.js +0 -1
  254. package/dist/ui/assets/session-store-CCH7W8KY.js +0 -1
  255. package/dist/ui/assets/shared-DAA_6m5R.js +0 -1
  256. package/dist/ui/assets/speech-assets-bridge-B8NqCAE8.js +0 -1
  257. package/dist/ui/assets/store-DexWd9-T.js +0 -1
  258. package/dist/ui/assets/theme-BBwuyzvz.js +0 -1
  259. package/dist/ui/assets/transform-messages-DzB_lMo-.js +0 -1
  260. package/dist/ui/assets/tray-leader-CwSJfo44.js +0 -1
  261. package/dist/ui/assets/usb-device-registry-BP58Vi0S.js +0 -1
  262. package/dist/ui/assets/usb-picker-D_K0weAY.js +0 -1
  263. package/dist/ui/assets/wc-extension-DHGJo5yR.js +0 -2
  264. package/dist/ui/assets/wc-follower-Dgol0MDj.js +0 -2
  265. package/dist/ui/assets/wc-nav-DTWpeCdl.js +0 -2
  266. package/dist/ui/assets/wc-permissions-registry-CR1rTd2H.js +0 -1
  267. package/dist/ui/assets/wc-permissions-registry-Dx-BRiKK.js +0 -1
  268. package/dist/ui/assets/wc-settings-BJ4KJnGi.js +0 -24
  269. package/dist/ui/assets/wc-sprinkles-DQDee7_G.js +0 -2
  270. package/dist/ui/assets/wc-tray-Dk_byhlx.js +0 -2
  271. package/dist/ui/assets/welcome-detection-Cr8mNEkt.js +0 -1
  272. /package/dist/ui/assets/{chunk-aKtaBQYM.js → rolldown-runtime-aKtaBQYM.js} +0 -0
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./logger-LESFN7Hj.js";import{_ as n,g as r,o as i,r as a,t as o}from"./proxied-fetch-R_Zw2ZFI.js";import"./backend-local-mrUgrni5.js";import{t as s}from"./types-idfTVsM8.js";import{t as c}from"./mime-types-BqLkKWa7.js";import{t as l}from"./remote-cache-D59F5FOx.js";function u(e,t,n){let r=`----DaMount${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,i=new TextEncoder,a=i.encode(`--${r}\r\nContent-Disposition: form-data; name="data"; filename="${e}"\r\nContent-Type: ${t}\r\n\r\n`),o=i.encode(`\r\n--${r}--\r\n`),s=new Uint8Array(a.byteLength+n.byteLength+o.byteLength);return s.set(a,0),s.set(n,a.byteLength),s.set(o,a.byteLength+n.byteLength),{contentType:`multipart/form-data; boundary=${r}`,body:s}}function d(e){return e.split(`/`).pop()||`data`}function f(e){let t=e.match(/^da:\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid DA source '${e}' — expected da://org/repo[/path]`);return{org:t[1],repo:t[2],path:(t[3]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var p=class{kind=`da`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=f(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??5242880,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toSourcePath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/source/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}toListPath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/list/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,path:this.toSourcePath(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`da access denied`,e);if(i.status>=400)throw new s(`EIO`,`da readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``,u=l.startsWith(`W/`)?l.slice(2):l;return await this.cache.putBody(t,c,u),c}async writeFile(e,t){if(this.assertOpen(e),t.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let n=this.toMountRelative(e),r=await this.cache.getBody(n),i=u(d(e),c(e),t),a={"content-type":i.contentType,"content-length":String(i.body.byteLength)};r?.etag?a[`if-match`]=r.etag.startsWith(`W/`)?r.etag.slice(2):r.etag:r||(a[`if-none-match`]=`*`);let o=()=>this.transport({method:`POST`,path:this.toSourcePath(n),headers:a,body:i.body}),l,f=1;try{l=await o()}catch{f=2,l=await o()}if(l.status===412){if(f===2){let r=await this.transport({method:`HEAD`,path:this.toSourcePath(n)});if(r.status>=400)throw new s(`EIO`,`da reconcile HEAD failed: ${r.status}`,e);let i=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,i);let a=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(l.status===401||l.status===403)throw new s(`EACCES`,`da write denied`,e);if(l.status>=400)throw new s(`EIO`,`da writeFile failed: ${l.status}`,e);let p=l.headers.get(`etag`)??``;await this.cache.putBody(n,t,p);let m=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(m)}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.transport({method:`GET`,path:this.toListPath(t)});if(r.status===404)throw new s(`ENOENT`,`no such directory`,e);if(r.status>=400)throw new s(`EIO`,`da list failed: ${r.status}`,e);let i=(await r.json()).map(e=>e.ext?{name:`${e.name}.${e.ext}`,kind:`file`,etag:e.etag,lastModified:e.lastModified}:{name:e.name,kind:`directory`,lastModified:e.lastModified});return await this.cache.putListing(t,i),i}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.size,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,path:this.toSourcePath(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`),r=n?Date.parse(n):0;if(o){let n=o.entries.map(n=>n.name===i&&n.kind===`file`?{...n,size:e,etag:t,lastModified:r}:n);await this.cache.putListing(a,n)}return{kind:`file`,size:e,mtime:r,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`da stat failed: ${c.status}`,e)}async mkdir(e){}async remove(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.transport({method:`DELETE`,path:this.toSourcePath(t)});if(n.status===404)throw new s(`ENOENT`,`no such file`,e);if(n.status===401||n.status===403)throw new s(`EACCES`,`da delete denied`,e);if(n.status>=400)throw new s(`EIO`,`da delete failed: ${n.status}`,e);await this.cache.invalidateBody(t);let r=t.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(r)}async refresh(e){this.assertOpen(`/`);let t={added:[],removed:[],changed:[],unchanged:0,errors:[]},n=[``];for(;n.length>0;){let e=n.pop();try{await this.refreshDir(e,t,n)}catch(n){t.errors.push({path:e,message:n instanceof Error?n.message:String(n)})}}return e?.bodies&&await this.refreshBodies(t),t}async classifyFile(e,t,n){let r=await this.cache.getBody(e);r?t&&r.etag!==t?(await this.cache.invalidateBody(e),n.changed.push(e)):n.unchanged++:n.added.push(e)}async refreshDir(e,t,n){let r=await this.transport({method:`GET`,path:this.toListPath(e)});if(r.status>=400){t.errors.push({path:e,message:`list failed: ${r.status}`});return}let i=await r.json(),a=[];for(let r of i)if(r.ext){let n=e?`${e}/${r.name}.${r.ext}`:`${r.name}.${r.ext}`;a.push({name:`${r.name}.${r.ext}`,kind:`file`,etag:r.etag,lastModified:r.lastModified}),await this.classifyFile(n,r.etag,t)}else a.push({name:r.name,kind:`directory`}),n.push(e?`${e}/${r.name}`:r.name);await this.cache.putListing(e,a)}async refreshBodies(e){for(let t of e.changed)try{await this.readFile(t)}catch(n){e.errors.push({path:t,message:n instanceof Error?n.message:String(n)})}}describe(){return{displayName:`${this.parsed.org}/${this.parsed.repo}${this.parsed.path?`/${this.parsed.path}`:``}`,source:this.source,profile:this.profile}}async close(){this.closed||=!0}};function m(e){let t=e.match(/^s3:\/\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid S3 source '${e}' — expected s3://bucket[/prefix]`);return{bucket:t[1],prefix:(t[2]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var h=class{kind=`s3`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=m(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??26214400,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toS3Key(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``);return[this.parsed.prefix,t].filter(e=>e.length>0).join(`/`)}toMountRelativeKey(e){return this.parsed.prefix?e.slice(this.parsed.prefix.length+1):e}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:this.toS3Key(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`s3 access denied`,e);if(i.status>=400)throw new s(`EIO`,`s3 readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes (${o} > ${this.maxBodyBytes})`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``;return await this.cache.putBody(t,c,l),c}async writeFile(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=await this.cache.getBody(n),i={"content-type":`application/octet-stream`,"content-length":String(t.byteLength)};r?i[`if-match`]=r.etag:i[`if-none-match`]=`*`;let a=()=>this.transport({method:`PUT`,bucket:this.parsed.bucket,key:this.toS3Key(n),headers:i,body:t}),o,c=1;try{o=await a()}catch{c=2,o=await a()}if(o.status===412){if(c===2){let r=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status>=400)throw new s(`EIO`,`s3 reconcile HEAD failed: ${r.status}`,e);let i=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,i);let a=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(o.status===401||o.status===403)throw new s(`EACCES`,`s3 write denied`,e);if(o.status>=400)throw new s(`EIO`,`s3 writeFile failed: ${o.status}`,e);let l=o.headers.get(`etag`)??``;await this.cache.putBody(n,t,l);let u=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(u)}async listObjectsV2(){let e=[],t;do{let n={"list-type":`2`};this.parsed.prefix&&(n.prefix=`${this.parsed.prefix}/`),t&&(n[`continuation-token`]=t);let r=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:``,query:n});if(r.status>=400)throw new s(`EIO`,`s3 list failed: ${r.status}`,`/`);let i=await r.text(),a=this.parseListingXml(i);e.push(...a.contents),t=a.nextContinuationToken}while(t);return e}parseListingXml(e){let t=[];for(let n of e.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g)){let e=n[1],r=e.match(/<Key>([^<]+)<\/Key>/)?.[1]??``,i=e.match(/<ETag>([^<]+)<\/ETag>/)?.[1]??``,a=e.match(/<Size>([^<]+)<\/Size>/)?.[1]??`0`,o=e.match(/<LastModified>([^<]+)<\/LastModified>/)?.[1]??``;t.push({key:r,etag:i,size:Number(a),lastModified:o?Date.parse(o):0})}return{contents:t,nextContinuationToken:e.match(/<IsTruncated>([^<]+)<\/IsTruncated>/)?.[1]===`true`?e.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/)?.[1]:void 0}}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.listObjectsV2(),i=this.groupByDir(r);for(let[e,t]of i)await this.cache.putListing(e,t);return i.get(t)??[]}groupByDir(e){let t=new Map,n=e=>(t.has(e)||t.set(e,[]),t.get(e));n(``);for(let t of e){let e=this.toMountRelativeKey(t.key).split(`/`),r=e.pop();n(e.join(`/`)).push({name:r,kind:`file`,size:t.size,etag:t.etag,lastModified:t.lastModified});let i=``;for(let t of e){let e=i;i=i?`${i}/${t}`:t;let r=n(e);r.find(e=>e.name===t&&e.kind===`directory`)||r.push({name:t,kind:`directory`}),n(i)}}return t}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.body.byteLength,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`);return{kind:`file`,size:e,mtime:n?Date.parse(n):0,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`s3 stat failed: ${c.status}`,e)}async refresh(e){this.assertOpen(`/`);let t=await this.listObjectsV2(),n=new Set(t.map(e=>this.toMountRelativeKey(e.key))),r=new Map(t.map(e=>[this.toMountRelativeKey(e.key),e.etag])),i={added:[],removed:[],changed:[],unchanged:0,errors:[]};for(let e of n){let t=await this.cache.getBody(e),n=r.get(e);t?t.etag===n?i.unchanged++:(await this.cache.invalidateBody(e),i.changed.push(e)):i.added.push(e)}let a=this.groupByDir(t);for(let[e,t]of a)await this.cache.putListing(e,t);if(e?.bodies)for(let e of i.changed)try{await this.readFile(e)}catch(t){i.errors.push({path:e,message:t instanceof Error?t.message:String(t)})}return i}async mkdir(e){}async remove(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t?.recursive)throw new s(`EINVAL`,`recursive remove not yet supported on S3`,e);let r=await this.transport({method:`DELETE`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status===404)throw new s(`ENOENT`,`no such file`,e);if(r.status===401||r.status===403)throw new s(`EACCES`,`s3 delete denied`,e);if(r.status>=400)throw new s(`EIO`,`s3 delete failed: ${r.status}`,e);await this.cache.invalidateBody(n);let i=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(i)}describe(){return{displayName:this.parsed.prefix?`${this.parsed.bucket}/${this.parsed.prefix}`:this.parsed.bucket,source:this.source,profile:this.profile}}async close(){this.closed||=!0}},g=class extends Error{constructor(e){super(e),this.name=`ProfileNotConfiguredError`}};async function _(){let{getAccounts:e}=await import(`./account-store-BPvwufEr.js`).then(e=>e.n),t=e().find(e=>e.providerId===`adobe`);if(!t?.accessToken)throw new g(`No Adobe IMS account found. Log in via Settings → Providers → Adobe first.`);return{identity:`adobe-ims`,getBearerToken:async()=>t.accessToken}}const v=t(`mount-bridge`),y=12e4;let b=null,x=1;const S=new Map;function C(e){let t=e;if(typeof t?.id!=`number`)return;let n=S.get(t.id);n&&(S.delete(t.id),clearTimeout(n.timer),n.resolve(t.response))}function w(){b=null;for(let[,e]of S)clearTimeout(e.timer),e.reject(new s(`EIO`,`mount.sign-and-forward port disconnected`));S.clear(),v.debug(`mount.sign-and-forward port disconnected; pending cleared, will reconnect`)}function T(){if(b)return b;let e=a();if(!e)return v.warn(`cannot open mount.sign-and-forward port: no extension delegate id`),null;if(typeof chrome>`u`||typeof chrome?.runtime?.connect!=`function`)return v.warn(`cannot open mount.sign-and-forward port: chrome.runtime.connect unavailable`),null;let t=chrome.runtime.connect,n=t(e,{name:`mount.sign-and-forward`});return n.onMessage.addListener(C),n.onDisconnect.addListener(w),b=n,n}function E(e,t){return typeof chrome>`u`&&a()?O(e,t):D(e,t)}function D(e,t){return new Promise((n,r)=>{let i=T();if(!i){r(new s(`EIO`,`mount transport failed: extension delegate unavailable (${e})`));return}let a=x++,o=setTimeout(()=>{S.delete(a)&&r(new s(`EIO`,`mount transport: ${e} timed out`))},y);S.set(a,{resolve:n,reject:r,timer:o});try{i.postMessage({id:a,type:e,envelope:t})}catch(e){S.delete(a),clearTimeout(o),b=null,r(new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)}`))}})}async function O(e,t){let{getPanelRpcClient:n}=await import(`./panel-rpc-CjFVE0nK.js`).then(e=>e.i),r=n();if(!r)throw new s(`EIO`,`mount transport failed: panel-RPC client unavailable in worker realm (${e})`);let{reply:i}=await r.call(`mount-sign-and-forward`,{type:e,envelope:t},{timeoutMs:y});return i}function k(){return typeof chrome<`u`&&!!chrome?.runtime?.id}const A=r,j=n,M=new Set([`invalid_profile`,`invalid_request`,`profile_not_configured`,`fetch_failed`,`internal`]),N=new Set([101,103,204,205,304]);function P(e){if(!e.ok)throw e.errorCode===`profile_not_configured`||e.errorCode===`invalid_profile`?new s(`EACCES`,e.error):e.errorCode===`invalid_request`?new s(`EINVAL`,e.error):e.errorCode===`fetch_failed`||e.errorCode===`internal`||M.has(String(e.errorCode))?new s(`EIO`,e.error):new s(`EINVAL`,`mount transport returned unrecognized errorCode '${e.errorCode}': ${e.error}`);let t;try{t=A(e.bodyBase64)}catch(e){throw new s(`EIO`,`mount transport: response body decode failed: ${e instanceof Error?e.message:String(e)}`)}let n=N.has(e.status)?null:t;return new Response(n,{status:e.status,headers:new Headers(e.headers)})}async function F(e,t){let n;try{n=await fetch(i(e),{method:`POST`,headers:o({"content-type":`application/json`}),body:JSON.stringify(t)})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (SLICC backend at localhost may not be running)`)}try{return await n.json()}catch(e){throw new s(`EIO`,`mount transport: response is not a JSON envelope (status ${n.status}): ${e instanceof Error?e.message:String(e)}`)}}async function I(e,t){try{return await chrome.runtime.sendMessage({type:e,envelope:t})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (extension service worker not responding)`)}}async function L(e,t,n){return k()?I(e,n):a()?E(e,n):F(t,n)}function R(e){return async t=>P(await L(`mount.s3-sign-and-forward`,`/api/s3-sign-and-forward`,{profile:e,method:t.method,bucket:t.bucket,key:t.key,query:t.query,headers:t.headers,bodyBase64:t.body?j(t.body):void 0}))}function z(e){let t=e?.getImsToken??(async()=>(await _()).getBearerToken());return async e=>{let n;try{n=await t()}catch(e){throw new s(`EACCES`,`DA mount: ${e instanceof Error?e.message:String(e)}`)}return P(await L(`mount.da-sign-and-forward`,`/api/da-sign-and-forward`,{imsToken:n,method:e.method,path:e.path,query:e.query,headers:e.headers,bodyBase64:e.body?j(e.body):void 0}))}}var B=e({DaMountBackend:()=>p,RemoteMountCache:()=>l,S3MountBackend:()=>h,makeSignedFetchDa:()=>z,makeSignedFetchS3:()=>R});export{p as a,h as i,z as n,R as r,B as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/account-store-CWhir8ug.js","assets/chunk-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/dist-BmWy99kl.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-BUunmmNl.js","assets/__vite-browser-external-C7iut881.js","assets/context-compaction-CFWyOzX1.js","assets/logger-DDBAeTLF.js","assets/providers-D0vM4fsT.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-B5vr_AP8.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-Bp0wH2ni.js","assets/secrets-bridge-client-DXw32cXb.js","assets/panel-rpc-DqT2FG7c.js","assets/bedrock-camp-9-QEmC9Z.js","assets/transform-messages-DzB_lMo-.js","assets/tool-ui-DfXu6quJ.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{t}from"./mime-types-ugOWOUZ9.js";import{i as n,r}from"./src-x0cJ68Fe.js";import{a as i,n as a,t as o}from"./proxied-fetch-B5vr_AP8.js";import{t as s}from"./types-idfTVsM8.js";import"./backend-local-D7FqJaoi.js";import"./mount-table-store-DAENz45Q.js";import{t as c}from"./mount-bridge-client-tEnjiHyh.js";function l(e,t,n){let r=`----DaMount${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,i=new TextEncoder,a=i.encode(`--${r}\r\nContent-Disposition: form-data; name="data"; filename="${e}"\r\nContent-Type: ${t}\r\n\r\n`),o=i.encode(`\r\n--${r}--\r\n`),s=new Uint8Array(a.byteLength+n.byteLength+o.byteLength);return s.set(a,0),s.set(n,a.byteLength),s.set(o,a.byteLength+n.byteLength),{contentType:`multipart/form-data; boundary=${r}`,body:s}}function u(e){return e.split(`/`).pop()||`data`}function d(e){let t=e.match(/^da:\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid DA source '${e}' — expected da://org/repo[/path]`);return{org:t[1],repo:t[2],path:(t[3]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var f=5*1024*1024,p=class{kind=`da`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=d(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??f,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toSourcePath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/source/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}toListPath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/list/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,path:this.toSourcePath(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`da access denied`,e);if(i.status>=400)throw new s(`EIO`,`da readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``,u=l.startsWith(`W/`)?l.slice(2):l;return await this.cache.putBody(t,c,u),c}async writeFile(e,n){if(this.assertOpen(e),n.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=this.toMountRelative(e),i=await this.cache.getBody(r),a=l(u(e),t(e),n),o={"content-type":a.contentType,"content-length":String(a.body.byteLength)};i?.etag?o[`if-match`]=i.etag.startsWith(`W/`)?i.etag.slice(2):i.etag:i||(o[`if-none-match`]=`*`);let c=()=>this.transport({method:`POST`,path:this.toSourcePath(r),headers:o,body:a.body}),d,f=1;try{d=await c()}catch{f=2,d=await c()}if(d.status===412){if(f===2){let t=await this.transport({method:`HEAD`,path:this.toSourcePath(r)});if(t.status>=400)throw new s(`EIO`,`da reconcile HEAD failed: ${t.status}`,e);let i=t.headers.get(`etag`)??``;await this.cache.putBody(r,n,i);let a=r.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(r);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(d.status===401||d.status===403)throw new s(`EACCES`,`da write denied`,e);if(d.status>=400)throw new s(`EIO`,`da writeFile failed: ${d.status}`,e);let p=d.headers.get(`etag`)??``;await this.cache.putBody(r,n,p);let m=r.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(m)}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.transport({method:`GET`,path:this.toListPath(t)});if(r.status===404)throw new s(`ENOENT`,`no such directory`,e);if(r.status>=400)throw new s(`EIO`,`da list failed: ${r.status}`,e);let i=(await r.json()).map(e=>e.ext?{name:`${e.name}.${e.ext}`,kind:`file`,etag:e.etag,lastModified:e.lastModified}:{name:e.name,kind:`directory`,lastModified:e.lastModified});return await this.cache.putListing(t,i),i}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.size,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,path:this.toSourcePath(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`),r=n?Date.parse(n):0;if(o){let n=o.entries.map(n=>n.name===i&&n.kind===`file`?{...n,size:e,etag:t,lastModified:r}:n);await this.cache.putListing(a,n)}return{kind:`file`,size:e,mtime:r,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`da stat failed: ${c.status}`,e)}async mkdir(e){}async remove(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.transport({method:`DELETE`,path:this.toSourcePath(t)});if(n.status===404)throw new s(`ENOENT`,`no such file`,e);if(n.status===401||n.status===403)throw new s(`EACCES`,`da delete denied`,e);if(n.status>=400)throw new s(`EIO`,`da delete failed: ${n.status}`,e);await this.cache.invalidateBody(t);let r=t.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(r)}async refresh(e){this.assertOpen(`/`);let t={added:[],removed:[],changed:[],unchanged:0,errors:[]},n=[``];for(;n.length>0;){let e=n.pop();try{await this.refreshDir(e,t,n)}catch(n){t.errors.push({path:e,message:n instanceof Error?n.message:String(n)})}}return e?.bodies&&await this.refreshBodies(t),t}async classifyFile(e,t,n){let r=await this.cache.getBody(e);r?t&&r.etag!==t?(await this.cache.invalidateBody(e),n.changed.push(e)):n.unchanged++:n.added.push(e)}async refreshDir(e,t,n){let r=await this.transport({method:`GET`,path:this.toListPath(e)});if(r.status>=400){t.errors.push({path:e,message:`list failed: ${r.status}`});return}let i=await r.json(),a=[];for(let r of i)if(r.ext){let n=e?`${e}/${r.name}.${r.ext}`:`${r.name}.${r.ext}`;a.push({name:`${r.name}.${r.ext}`,kind:`file`,etag:r.etag,lastModified:r.lastModified}),await this.classifyFile(n,r.etag,t)}else a.push({name:r.name,kind:`directory`}),n.push(e?`${e}/${r.name}`:r.name);await this.cache.putListing(e,a)}async refreshBodies(e){for(let t of e.changed)try{await this.readFile(t)}catch(n){e.errors.push({path:t,message:n instanceof Error?n.message:String(n)})}}describe(){return{displayName:`${this.parsed.org}/${this.parsed.repo}${this.parsed.path?`/${this.parsed.path}`:``}`,source:this.source,profile:this.profile}}async close(){this.closed||=!0}};function m(e){let t=e.match(/^s3:\/\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid S3 source '${e}' — expected s3://bucket[/prefix]`);return{bucket:t[1],prefix:(t[2]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var h=25*1024*1024,g=class{kind=`s3`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=m(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??h,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toS3Key(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``);return[this.parsed.prefix,t].filter(e=>e.length>0).join(`/`)}toMountRelativeKey(e){return this.parsed.prefix?e.slice(this.parsed.prefix.length+1):e}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:this.toS3Key(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`s3 access denied`,e);if(i.status>=400)throw new s(`EIO`,`s3 readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes (${o} > ${this.maxBodyBytes})`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``;return await this.cache.putBody(t,c,l),c}async writeFile(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=await this.cache.getBody(n),i={"content-type":`application/octet-stream`,"content-length":String(t.byteLength)};r?i[`if-match`]=r.etag:i[`if-none-match`]=`*`;let a=()=>this.transport({method:`PUT`,bucket:this.parsed.bucket,key:this.toS3Key(n),headers:i,body:t}),o,c=1;try{o=await a()}catch{c=2,o=await a()}if(o.status===412){if(c===2){let r=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status>=400)throw new s(`EIO`,`s3 reconcile HEAD failed: ${r.status}`,e);let i=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,i);let a=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(o.status===401||o.status===403)throw new s(`EACCES`,`s3 write denied`,e);if(o.status>=400)throw new s(`EIO`,`s3 writeFile failed: ${o.status}`,e);let l=o.headers.get(`etag`)??``;await this.cache.putBody(n,t,l);let u=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(u)}async listObjectsV2(){let e=[],t;do{let n={"list-type":`2`};this.parsed.prefix&&(n.prefix=`${this.parsed.prefix}/`),t&&(n[`continuation-token`]=t);let r=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:``,query:n});if(r.status>=400)throw new s(`EIO`,`s3 list failed: ${r.status}`,`/`);let i=await r.text(),a=this.parseListingXml(i);e.push(...a.contents),t=a.nextContinuationToken}while(t);return e}parseListingXml(e){let t=[];for(let n of e.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g)){let e=n[1],r=e.match(/<Key>([^<]+)<\/Key>/)?.[1]??``,i=e.match(/<ETag>([^<]+)<\/ETag>/)?.[1]??``,a=e.match(/<Size>([^<]+)<\/Size>/)?.[1]??`0`,o=e.match(/<LastModified>([^<]+)<\/LastModified>/)?.[1]??``;t.push({key:r,etag:i,size:Number(a),lastModified:o?Date.parse(o):0})}return{contents:t,nextContinuationToken:e.match(/<IsTruncated>([^<]+)<\/IsTruncated>/)?.[1]===`true`?e.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/)?.[1]:void 0}}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.listObjectsV2(),i=this.groupByDir(r);for(let[e,t]of i)await this.cache.putListing(e,t);return i.get(t)??[]}groupByDir(e){let t=new Map,n=e=>(t.has(e)||t.set(e,[]),t.get(e));n(``);for(let t of e){let e=this.toMountRelativeKey(t.key).split(`/`),r=e.pop();n(e.join(`/`)).push({name:r,kind:`file`,size:t.size,etag:t.etag,lastModified:t.lastModified});let i=``;for(let t of e){let e=i;i=i?`${i}/${t}`:t;let r=n(e);r.find(e=>e.name===t&&e.kind===`directory`)||r.push({name:t,kind:`directory`}),n(i)}}return t}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.body.byteLength,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`);return{kind:`file`,size:e,mtime:n?Date.parse(n):0,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`s3 stat failed: ${c.status}`,e)}async refresh(e){this.assertOpen(`/`);let t=await this.listObjectsV2(),n=new Set(t.map(e=>this.toMountRelativeKey(e.key))),r=new Map(t.map(e=>[this.toMountRelativeKey(e.key),e.etag])),i={added:[],removed:[],changed:[],unchanged:0,errors:[]};for(let e of n){let t=await this.cache.getBody(e),n=r.get(e);t?t.etag===n?i.unchanged++:(await this.cache.invalidateBody(e),i.changed.push(e)):i.added.push(e)}let a=this.groupByDir(t);for(let[e,t]of a)await this.cache.putListing(e,t);if(e?.bodies)for(let e of i.changed)try{await this.readFile(e)}catch(t){i.errors.push({path:e,message:t instanceof Error?t.message:String(t)})}return i}async mkdir(e){}async remove(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t?.recursive)throw new s(`EINVAL`,`recursive remove not yet supported on S3`,e);let r=await this.transport({method:`DELETE`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status===404)throw new s(`ENOENT`,`no such file`,e);if(r.status===401||r.status===403)throw new s(`EACCES`,`s3 delete denied`,e);if(r.status>=400)throw new s(`EIO`,`s3 delete failed: ${r.status}`,e);await this.cache.invalidateBody(n);let i=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(i)}describe(){return{displayName:this.parsed.prefix?`${this.parsed.bucket}/${this.parsed.prefix}`:this.parsed.bucket,source:this.source,profile:this.profile}}async close(){this.closed||=!0}},_=class extends Error{constructor(e){super(e),this.name=`ProfileNotConfiguredError`}};async function v(){let{getAccounts:t}=await e(async()=>{let{getAccounts:e}=await import(`./account-store-CWhir8ug.js`).then(e=>e.r);return{getAccounts:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),n=t().find(e=>e.providerId===`adobe`);if(!n?.accessToken)throw new _(`No Adobe IMS account found. Log in via Settings → Providers → Adobe first.`);return{identity:`adobe-ims`,getBearerToken:async()=>n.accessToken}}var y=`slicc-mount-cache`,b=`listings`,x=`bodies`,S=class{mountId;ttlMs;dbName;dbPromise=null;constructor(e){this.mountId=e.mountId,this.ttlMs=e.ttlMs,this.dbName=e.dbName??y}isStale(e,t){return Date.now()-e>=(t??this.ttlMs)}async openDb(){return this.dbPromise||=new Promise((e,t)=>{let n=indexedDB.open(this.dbName,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(b)||e.createObjectStore(b),e.objectStoreNames.contains(x)||e.createObjectStore(x)},n.onsuccess=()=>{let t=n.result;t.onversionchange=()=>{t.close(),this.dbPromise=null},t.onclose=()=>{this.dbPromise=null},e(t)},n.onerror=()=>t(n.error)}),this.dbPromise}key(e){return`${this.mountId}::${e}`}async getListing(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(b,`readonly`).objectStore(b).get(this.key(e));i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}async putListing(e,t){let n=await this.openDb();return new Promise((r,i)=>{let a=n.transaction(b,`readwrite`),o={entries:t,cachedAt:Date.now()};a.objectStore(b).put(o,this.key(e)),a.oncomplete=()=>r(),a.onerror=()=>i(a.error)})}async invalidateListing(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(b,`readwrite`);i.objectStore(b).delete(this.key(e)),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async getBody(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(x,`readonly`).objectStore(x).get(this.key(e));i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}async putBody(e,t,n){let r=await this.openDb(),i={body:t,etag:n,size:t.byteLength,cachedAt:Date.now()};try{await this.txPut(r,x,this.key(e),i)}catch(t){if(t instanceof DOMException&&t.name===`QuotaExceededError`){await this.evictLru(.25);try{await this.txPut(r,x,this.key(e),i)}catch{}return}throw t}}async invalidateBody(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(x,`readwrite`);i.objectStore(x).delete(this.key(e)),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async clearMount(){let e=await this.openDb(),t=`${this.mountId}::`,n=n=>new Promise((r,i)=>{let a=e.transaction(n,`readwrite`),o=a.objectStore(n),s=o.getAllKeys();s.onsuccess=()=>{for(let e of s.result)typeof e==`string`&&e.startsWith(t)&&o.delete(e)},a.oncomplete=()=>r(),a.onerror=()=>i(a.error)});await Promise.all([n(b),n(x)])}txPut(e,t,n,r){return new Promise((i,a)=>{let o=e.transaction(t,`readwrite`);o.objectStore(t).put(r,n),o.oncomplete=()=>i(),o.onerror=()=>a(o.error)})}async evictLru(e){let t=await this.openDb(),n=`${this.mountId}::`,r=await new Promise((e,r)=>{let i=t.transaction(x,`readonly`).objectStore(x),a=[],o=i.openCursor();o.onsuccess=()=>{let t=o.result;if(!t){e(a);return}if(typeof t.key==`string`&&t.key.startsWith(n)){let e=t.value;a.push({key:t.key,cachedAt:e.cachedAt})}t.continue()},o.onerror=()=>r(o.error)});r.sort((e,t)=>e.cachedAt-t.cachedAt);let i=Math.max(1,Math.ceil(r.length*e)),a=r.slice(0,i);await new Promise((e,n)=>{let r=t.transaction(x,`readwrite`),i=r.objectStore(x);for(let{key:e}of a)i.delete(e);r.oncomplete=()=>e(),r.onerror=()=>n(r.error)})}};function C(){return typeof chrome<`u`&&!!chrome?.runtime?.id}var w=r,T=n,E=new Set([`invalid_profile`,`invalid_request`,`profile_not_configured`,`fetch_failed`,`internal`]),D=new Set([101,103,204,205,304]);function O(e){if(!e.ok)throw e.errorCode===`profile_not_configured`||e.errorCode===`invalid_profile`?new s(`EACCES`,e.error):e.errorCode===`invalid_request`?new s(`EINVAL`,e.error):e.errorCode===`fetch_failed`||e.errorCode===`internal`||E.has(String(e.errorCode))?new s(`EIO`,e.error):new s(`EINVAL`,`mount transport returned unrecognized errorCode '${e.errorCode}': ${e.error}`);let t;try{t=w(e.bodyBase64)}catch(e){throw new s(`EIO`,`mount transport: response body decode failed: ${e instanceof Error?e.message:String(e)}`)}let n=D.has(e.status)?null:t;return new Response(n,{status:e.status,headers:new Headers(e.headers)})}async function k(e,t){let n;try{n=await fetch(i(e),{method:`POST`,headers:o({"content-type":`application/json`}),body:JSON.stringify(t)})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (SLICC backend at localhost may not be running)`)}try{return await n.json()}catch(e){throw new s(`EIO`,`mount transport: response is not a JSON envelope (status ${n.status}): ${e instanceof Error?e.message:String(e)}`)}}async function A(e,t){try{return await chrome.runtime.sendMessage({type:e,envelope:t})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (extension service worker not responding)`)}}async function j(e,t,n){return C()?A(e,n):a()?c(e,n):k(t,n)}function M(e){return async t=>O(await j(`mount.s3-sign-and-forward`,`/api/s3-sign-and-forward`,{profile:e,method:t.method,bucket:t.bucket,key:t.key,query:t.query,headers:t.headers,bodyBase64:t.body?T(t.body):void 0}))}function N(e){let t=e?.getImsToken??(async()=>(await v()).getBearerToken());return async e=>{let n;try{n=await t()}catch(e){throw new s(`EACCES`,`DA mount: ${e instanceof Error?e.message:String(e)}`)}return O(await j(`mount.da-sign-and-forward`,`/api/da-sign-and-forward`,{imsToken:n,method:e.method,path:e.path,query:e.query,headers:e.headers,bodyBase64:e.body?T(e.body):void 0}))}}export{p as DaMountBackend,S as RemoteMountCache,g as S3MountBackend,N as makeSignedFetchDa,M as makeSignedFetchS3};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/account-store-DRcHIayv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-D69OmKNn.js","assets/preload-helper-CZgWQFsJ.js","assets/__vite-browser-external-SwrSgYTf.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-C7d6hyOc.js","assets/context-compaction-DvlXtgVG.js","assets/logger-DDBAeTLF.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-DzLglfG5.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-CC_yKaqL.js","assets/secrets-bridge-client-C3K9ItX4.js","assets/tool-ui-DfXu6quJ.js","assets/providers-lNcU6L-a.js","assets/panel-rpc-DmJSNs0I.js","assets/bedrock-camp-DjKgax8m.js","assets/transform-messages-DiIjWKhh.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./preload-helper-CZgWQFsJ.js";import{t}from"./mime-types-ugOWOUZ9.js";import{i as n,r}from"./src-x0cJ68Fe.js";import{a as i,n as a,t as o}from"./proxied-fetch-DzLglfG5.js";import{t as s}from"./types-idfTVsM8.js";import"./backend-local-BgTSBOxM.js";import"./mount-table-store-CfQUN_2R.js";import{t as c}from"./mount-bridge-client-DnDk55XZ.js";function l(e,t,n){let r=`----DaMount${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,i=new TextEncoder,a=i.encode(`--${r}\r\nContent-Disposition: form-data; name="data"; filename="${e}"\r\nContent-Type: ${t}\r\n\r\n`),o=i.encode(`\r\n--${r}--\r\n`),s=new Uint8Array(a.byteLength+n.byteLength+o.byteLength);return s.set(a,0),s.set(n,a.byteLength),s.set(o,a.byteLength+n.byteLength),{contentType:`multipart/form-data; boundary=${r}`,body:s}}function u(e){return e.split(`/`).pop()||`data`}function d(e){let t=e.match(/^da:\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid DA source '${e}' — expected da://org/repo[/path]`);return{org:t[1],repo:t[2],path:(t[3]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var f=5*1024*1024,p=class{kind=`da`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=d(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??f,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toSourcePath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/source/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}toListPath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/list/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,path:this.toSourcePath(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`da access denied`,e);if(i.status>=400)throw new s(`EIO`,`da readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``,u=l.startsWith(`W/`)?l.slice(2):l;return await this.cache.putBody(t,c,u),c}async writeFile(e,n){if(this.assertOpen(e),n.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=this.toMountRelative(e),i=await this.cache.getBody(r),a=l(u(e),t(e),n),o={"content-type":a.contentType,"content-length":String(a.body.byteLength)};i?.etag?o[`if-match`]=i.etag.startsWith(`W/`)?i.etag.slice(2):i.etag:i||(o[`if-none-match`]=`*`);let c=()=>this.transport({method:`POST`,path:this.toSourcePath(r),headers:o,body:a.body}),d,f=1;try{d=await c()}catch{f=2,d=await c()}if(d.status===412){if(f===2){let t=await this.transport({method:`HEAD`,path:this.toSourcePath(r)});if(t.status>=400)throw new s(`EIO`,`da reconcile HEAD failed: ${t.status}`,e);let i=t.headers.get(`etag`)??``;await this.cache.putBody(r,n,i);let a=r.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(r);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(d.status===401||d.status===403)throw new s(`EACCES`,`da write denied`,e);if(d.status>=400)throw new s(`EIO`,`da writeFile failed: ${d.status}`,e);let p=d.headers.get(`etag`)??``;await this.cache.putBody(r,n,p);let m=r.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(m)}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.transport({method:`GET`,path:this.toListPath(t)});if(r.status===404)throw new s(`ENOENT`,`no such directory`,e);if(r.status>=400)throw new s(`EIO`,`da list failed: ${r.status}`,e);let i=(await r.json()).map(e=>e.ext?{name:`${e.name}.${e.ext}`,kind:`file`,etag:e.etag,lastModified:e.lastModified}:{name:e.name,kind:`directory`,lastModified:e.lastModified});return await this.cache.putListing(t,i),i}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.size,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,path:this.toSourcePath(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`),r=n?Date.parse(n):0;if(o){let n=o.entries.map(n=>n.name===i&&n.kind===`file`?{...n,size:e,etag:t,lastModified:r}:n);await this.cache.putListing(a,n)}return{kind:`file`,size:e,mtime:r,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`da stat failed: ${c.status}`,e)}async mkdir(e){}async remove(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.transport({method:`DELETE`,path:this.toSourcePath(t)});if(n.status===404)throw new s(`ENOENT`,`no such file`,e);if(n.status===401||n.status===403)throw new s(`EACCES`,`da delete denied`,e);if(n.status>=400)throw new s(`EIO`,`da delete failed: ${n.status}`,e);await this.cache.invalidateBody(t);let r=t.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(r)}async refresh(e){this.assertOpen(`/`);let t={added:[],removed:[],changed:[],unchanged:0,errors:[]},n=[``];for(;n.length>0;){let e=n.pop();try{await this.refreshDir(e,t,n)}catch(n){t.errors.push({path:e,message:n instanceof Error?n.message:String(n)})}}return e?.bodies&&await this.refreshBodies(t),t}async classifyFile(e,t,n){let r=await this.cache.getBody(e);r?t&&r.etag!==t?(await this.cache.invalidateBody(e),n.changed.push(e)):n.unchanged++:n.added.push(e)}async refreshDir(e,t,n){let r=await this.transport({method:`GET`,path:this.toListPath(e)});if(r.status>=400){t.errors.push({path:e,message:`list failed: ${r.status}`});return}let i=await r.json(),a=[];for(let r of i)if(r.ext){let n=e?`${e}/${r.name}.${r.ext}`:`${r.name}.${r.ext}`;a.push({name:`${r.name}.${r.ext}`,kind:`file`,etag:r.etag,lastModified:r.lastModified}),await this.classifyFile(n,r.etag,t)}else a.push({name:r.name,kind:`directory`}),n.push(e?`${e}/${r.name}`:r.name);await this.cache.putListing(e,a)}async refreshBodies(e){for(let t of e.changed)try{await this.readFile(t)}catch(n){e.errors.push({path:t,message:n instanceof Error?n.message:String(n)})}}describe(){return{displayName:`${this.parsed.org}/${this.parsed.repo}${this.parsed.path?`/${this.parsed.path}`:``}`,source:this.source,profile:this.profile}}async close(){this.closed||=!0}};function m(e){let t=e.match(/^s3:\/\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid S3 source '${e}' — expected s3://bucket[/prefix]`);return{bucket:t[1],prefix:(t[2]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var h=25*1024*1024,g=class{kind=`s3`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=m(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??h,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new s(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toS3Key(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``);return[this.parsed.prefix,t].filter(e=>e.length>0).join(`/`)}toMountRelativeKey(e){return this.parsed.prefix?e.slice(this.parsed.prefix.length+1):e}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let i=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:this.toS3Key(t),headers:r});if(i.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(i.status===404)throw await this.cache.invalidateBody(t),new s(`ENOENT`,`no such file`,e);if(i.status===401||i.status===403)throw new s(`EACCES`,`s3 access denied`,e);if(i.status>=400)throw new s(`EIO`,`s3 readFile failed: ${i.status}`,e);let a=i.headers.get(`content-length`),o=a?Number(a):void 0;if(o!==void 0&&o>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes (${o} > ${this.maxBodyBytes})`,e);let c=new Uint8Array(await i.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=i.headers.get(`etag`)??``;return await this.cache.putBody(t,c,l),c}async writeFile(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t.byteLength>this.maxBodyBytes)throw new s(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=await this.cache.getBody(n),i={"content-type":`application/octet-stream`,"content-length":String(t.byteLength)};r?i[`if-match`]=r.etag:i[`if-none-match`]=`*`;let a=()=>this.transport({method:`PUT`,bucket:this.parsed.bucket,key:this.toS3Key(n),headers:i,body:t}),o,c=1;try{o=await a()}catch{c=2,o=await a()}if(o.status===412){if(c===2){let r=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status>=400)throw new s(`EIO`,`s3 reconcile HEAD failed: ${r.status}`,e);let i=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,i);let a=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new s(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(o.status===401||o.status===403)throw new s(`EACCES`,`s3 write denied`,e);if(o.status>=400)throw new s(`EIO`,`s3 writeFile failed: ${o.status}`,e);let l=o.headers.get(`etag`)??``;await this.cache.putBody(n,t,l);let u=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(u)}async listObjectsV2(){let e=[],t;do{let n={"list-type":`2`};this.parsed.prefix&&(n.prefix=`${this.parsed.prefix}/`),t&&(n[`continuation-token`]=t);let r=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:``,query:n});if(r.status>=400)throw new s(`EIO`,`s3 list failed: ${r.status}`,`/`);let i=await r.text(),a=this.parseListingXml(i);e.push(...a.contents),t=a.nextContinuationToken}while(t);return e}parseListingXml(e){let t=[];for(let n of e.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g)){let e=n[1],r=e.match(/<Key>([^<]+)<\/Key>/)?.[1]??``,i=e.match(/<ETag>([^<]+)<\/ETag>/)?.[1]??``,a=e.match(/<Size>([^<]+)<\/Size>/)?.[1]??`0`,o=e.match(/<LastModified>([^<]+)<\/LastModified>/)?.[1]??``;t.push({key:r,etag:i,size:Number(a),lastModified:o?Date.parse(o):0})}return{contents:t,nextContinuationToken:e.match(/<IsTruncated>([^<]+)<\/IsTruncated>/)?.[1]===`true`?e.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/)?.[1]:void 0}}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.listObjectsV2(),i=this.groupByDir(r);for(let[e,t]of i)await this.cache.putListing(e,t);return i.get(t)??[]}groupByDir(e){let t=new Map,n=e=>(t.has(e)||t.set(e,[]),t.get(e));n(``);for(let t of e){let e=this.toMountRelativeKey(t.key).split(`/`),r=e.pop();n(e.join(`/`)).push({name:r,kind:`file`,size:t.size,etag:t.etag,lastModified:t.lastModified});let i=``;for(let t of e){let e=i;i=i?`${i}/${t}`:t;let r=n(e);r.find(e=>e.name===t&&e.kind===`directory`)||r.push({name:t,kind:`directory`}),n(i)}}return t}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.body.byteLength,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),i=r.pop()??``,a=r.join(`/`),o=await this.cache.getListing(a);if(o&&!this.cache.isStale(o.cachedAt)){let t=o.entries.find(e=>e.name===i);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??o.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??o.cachedAt};if(!t)throw new s(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`);return{kind:`file`,size:e,mtime:n?Date.parse(n):0,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new s(`ENOENT`,`no such file or directory`,e)}throw new s(`EIO`,`s3 stat failed: ${c.status}`,e)}async refresh(e){this.assertOpen(`/`);let t=await this.listObjectsV2(),n=new Set(t.map(e=>this.toMountRelativeKey(e.key))),r=new Map(t.map(e=>[this.toMountRelativeKey(e.key),e.etag])),i={added:[],removed:[],changed:[],unchanged:0,errors:[]};for(let e of n){let t=await this.cache.getBody(e),n=r.get(e);t?t.etag===n?i.unchanged++:(await this.cache.invalidateBody(e),i.changed.push(e)):i.added.push(e)}let a=this.groupByDir(t);for(let[e,t]of a)await this.cache.putListing(e,t);if(e?.bodies)for(let e of i.changed)try{await this.readFile(e)}catch(t){i.errors.push({path:e,message:t instanceof Error?t.message:String(t)})}return i}async mkdir(e){}async remove(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t?.recursive)throw new s(`EINVAL`,`recursive remove not yet supported on S3`,e);let r=await this.transport({method:`DELETE`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status===404)throw new s(`ENOENT`,`no such file`,e);if(r.status===401||r.status===403)throw new s(`EACCES`,`s3 delete denied`,e);if(r.status>=400)throw new s(`EIO`,`s3 delete failed: ${r.status}`,e);await this.cache.invalidateBody(n);let i=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(i)}describe(){return{displayName:this.parsed.prefix?`${this.parsed.bucket}/${this.parsed.prefix}`:this.parsed.bucket,source:this.source,profile:this.profile}}async close(){this.closed||=!0}},_=class extends Error{constructor(e){super(e),this.name=`ProfileNotConfiguredError`}};async function v(){let{getAccounts:t}=await e(async()=>{let{getAccounts:e}=await import(`./account-store-DRcHIayv.js`).then(e=>e.r);return{getAccounts:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),n=t().find(e=>e.providerId===`adobe`);if(!n?.accessToken)throw new _(`No Adobe IMS account found. Log in via Settings → Providers → Adobe first.`);return{identity:`adobe-ims`,getBearerToken:async()=>n.accessToken}}var y=`slicc-mount-cache`,b=`listings`,x=`bodies`,S=class{mountId;ttlMs;dbName;dbPromise=null;constructor(e){this.mountId=e.mountId,this.ttlMs=e.ttlMs,this.dbName=e.dbName??y}isStale(e,t){return Date.now()-e>=(t??this.ttlMs)}async openDb(){return this.dbPromise||=new Promise((e,t)=>{let n=indexedDB.open(this.dbName,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(b)||e.createObjectStore(b),e.objectStoreNames.contains(x)||e.createObjectStore(x)},n.onsuccess=()=>{let t=n.result;t.onversionchange=()=>{t.close(),this.dbPromise=null},t.onclose=()=>{this.dbPromise=null},e(t)},n.onerror=()=>t(n.error)}),this.dbPromise}key(e){return`${this.mountId}::${e}`}async getListing(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(b,`readonly`).objectStore(b).get(this.key(e));i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}async putListing(e,t){let n=await this.openDb();return new Promise((r,i)=>{let a=n.transaction(b,`readwrite`),o={entries:t,cachedAt:Date.now()};a.objectStore(b).put(o,this.key(e)),a.oncomplete=()=>r(),a.onerror=()=>i(a.error)})}async invalidateListing(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(b,`readwrite`);i.objectStore(b).delete(this.key(e)),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async getBody(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(x,`readonly`).objectStore(x).get(this.key(e));i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}async putBody(e,t,n){let r=await this.openDb(),i={body:t,etag:n,size:t.byteLength,cachedAt:Date.now()};try{await this.txPut(r,x,this.key(e),i)}catch(t){if(t instanceof DOMException&&t.name===`QuotaExceededError`){await this.evictLru(.25);try{await this.txPut(r,x,this.key(e),i)}catch{}return}throw t}}async invalidateBody(e){let t=await this.openDb();return new Promise((n,r)=>{let i=t.transaction(x,`readwrite`);i.objectStore(x).delete(this.key(e)),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async clearMount(){let e=await this.openDb(),t=`${this.mountId}::`,n=n=>new Promise((r,i)=>{let a=e.transaction(n,`readwrite`),o=a.objectStore(n),s=o.getAllKeys();s.onsuccess=()=>{for(let e of s.result)typeof e==`string`&&e.startsWith(t)&&o.delete(e)},a.oncomplete=()=>r(),a.onerror=()=>i(a.error)});await Promise.all([n(b),n(x)])}txPut(e,t,n,r){return new Promise((i,a)=>{let o=e.transaction(t,`readwrite`);o.objectStore(t).put(r,n),o.oncomplete=()=>i(),o.onerror=()=>a(o.error)})}async evictLru(e){let t=await this.openDb(),n=`${this.mountId}::`,r=await new Promise((e,r)=>{let i=t.transaction(x,`readonly`).objectStore(x),a=[],o=i.openCursor();o.onsuccess=()=>{let t=o.result;if(!t){e(a);return}if(typeof t.key==`string`&&t.key.startsWith(n)){let e=t.value;a.push({key:t.key,cachedAt:e.cachedAt})}t.continue()},o.onerror=()=>r(o.error)});r.sort((e,t)=>e.cachedAt-t.cachedAt);let i=Math.max(1,Math.ceil(r.length*e)),a=r.slice(0,i);await new Promise((e,n)=>{let r=t.transaction(x,`readwrite`),i=r.objectStore(x);for(let{key:e}of a)i.delete(e);r.oncomplete=()=>e(),r.onerror=()=>n(r.error)})}};function C(){return typeof chrome<`u`&&!!chrome?.runtime?.id}var w=r,T=n,E=new Set([`invalid_profile`,`invalid_request`,`profile_not_configured`,`fetch_failed`,`internal`]),D=new Set([101,103,204,205,304]);function O(e){if(!e.ok)throw e.errorCode===`profile_not_configured`||e.errorCode===`invalid_profile`?new s(`EACCES`,e.error):e.errorCode===`invalid_request`?new s(`EINVAL`,e.error):e.errorCode===`fetch_failed`||e.errorCode===`internal`||E.has(String(e.errorCode))?new s(`EIO`,e.error):new s(`EINVAL`,`mount transport returned unrecognized errorCode '${e.errorCode}': ${e.error}`);let t;try{t=w(e.bodyBase64)}catch(e){throw new s(`EIO`,`mount transport: response body decode failed: ${e instanceof Error?e.message:String(e)}`)}let n=D.has(e.status)?null:t;return new Response(n,{status:e.status,headers:new Headers(e.headers)})}async function k(e,t){let n;try{n=await fetch(i(e),{method:`POST`,headers:o({"content-type":`application/json`}),body:JSON.stringify(t)})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (SLICC backend at localhost may not be running)`)}try{return await n.json()}catch(e){throw new s(`EIO`,`mount transport: response is not a JSON envelope (status ${n.status}): ${e instanceof Error?e.message:String(e)}`)}}async function A(e,t){try{return await chrome.runtime.sendMessage({type:e,envelope:t})}catch(e){throw new s(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)} (extension service worker not responding)`)}}async function j(e,t,n){return C()?A(e,n):a()?c(e,n):k(t,n)}function M(e){return async t=>O(await j(`mount.s3-sign-and-forward`,`/api/s3-sign-and-forward`,{profile:e,method:t.method,bucket:t.bucket,key:t.key,query:t.query,headers:t.headers,bodyBase64:t.body?T(t.body):void 0}))}function N(e){let t=e?.getImsToken??(async()=>(await v()).getBearerToken());return async e=>{let n;try{n=await t()}catch(e){throw new s(`EACCES`,`DA mount: ${e instanceof Error?e.message:String(e)}`)}return O(await j(`mount.da-sign-and-forward`,`/api/da-sign-and-forward`,{imsToken:n,method:e.method,path:e.path,query:e.query,headers:e.headers,bodyBase64:e.body?T(e.body):void 0}))}}export{p as DaMountBackend,S as RemoteMountCache,g as S3MountBackend,N as makeSignedFetchDa,M as makeSignedFetchS3};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-rpc-DmJSNs0I.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./preload-helper-CZgWQFsJ.js";import{t as n}from"./logger-DDBAeTLF.js";import{n as r}from"./proxied-fetch-DzLglfG5.js";import{t as i}from"./types-idfTVsM8.js";var a=e({callMountBridge:()=>m}),o=n(`mount-bridge`),s=12e4,c=null,l=1,u=new Map;function d(e){let t=e;if(typeof t?.id!=`number`)return;let n=u.get(t.id);n&&(u.delete(t.id),clearTimeout(n.timer),n.resolve(t.response))}function f(){c=null;for(let[,e]of u)clearTimeout(e.timer),e.reject(new i(`EIO`,`mount.sign-and-forward port disconnected`));u.clear(),o.debug(`mount.sign-and-forward port disconnected; pending cleared, will reconnect`)}function p(){if(c)return c;let e=r();if(!e)return o.warn(`cannot open mount.sign-and-forward port: no extension delegate id`),null;if(typeof chrome>`u`||typeof chrome?.runtime?.connect!=`function`)return o.warn(`cannot open mount.sign-and-forward port: chrome.runtime.connect unavailable`),null;let t=chrome.runtime.connect,n=t(e,{name:`mount.sign-and-forward`});return n.onMessage.addListener(d),n.onDisconnect.addListener(f),c=n,n}function m(e,t){return typeof chrome>`u`&&r()?g(e,t):h(e,t)}function h(e,t){return new Promise((n,r)=>{let a=p();if(!a){r(new i(`EIO`,`mount transport failed: extension delegate unavailable (${e})`));return}let o=l++,d=setTimeout(()=>{u.delete(o)&&r(new i(`EIO`,`mount transport: ${e} timed out`))},s);u.set(o,{resolve:n,reject:r,timer:d});try{a.postMessage({id:o,type:e,envelope:t})}catch(e){u.delete(o),clearTimeout(d),c=null,r(new i(`EIO`,`mount transport failed: ${e instanceof Error?e.message:String(e)}`))}})}async function g(e,n){let{getPanelRpcClient:r}=await t(async()=>{let{getPanelRpcClient:e}=await import(`./panel-rpc-DmJSNs0I.js`).then(e=>e.i);return{getPanelRpcClient:e}},__vite__mapDeps([0,1])),a=r();if(!a)throw new i(`EIO`,`mount transport failed: panel-RPC client unavailable in worker realm (${e})`);let{reply:o}=await a.call(`mount-sign-and-forward`,{type:e,envelope:n},{timeoutMs:s});return o}export{a as n,m as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./logger-DDBAeTLF.js";import{n}from"./picker-popup-CpulHQsi.js";var r=e({loadAndClearPendingHandle:()=>l,openMountPickerPopup:()=>s,reactivateHandle:()=>u,storePendingHandle:()=>c}),i=t(`mount-picker-popup`),a=`slicc-pending-mount`,o=6e4;function s(e){let t=e??`mount-${Date.now().toString(36)}`;return new Promise(e=>{let r=!1,a=t=>{r||(r=!0,clearTimeout(s),e(t))},s=setTimeout(()=>a({cancelled:!0}),o);n(`directory`,[],t,{timeoutMs:o}).then(e=>{let n=e;if(n.error){i.error(`picker popup launch failed for directory kind`,{requestId:t,error:n.error}),a({error:`Failed to open directory picker window`});return}a(n)}).catch(e=>{i.error(`picker popup launch threw for directory kind`,{requestId:t,error:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:void 0}),a({error:`Failed to open directory picker window`})})})}async function c(e,t){let n=await new Promise((e,t)=>{let n=indexedDB.open(a,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(`handles`)||n.result.createObjectStore(`handles`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),r=n.transaction(`handles`,`readwrite`);r.objectStore(`handles`).put(t,e),await new Promise((e,t)=>{r.oncomplete=()=>e(),r.onerror=()=>t(r.error??Error(`IDB transaction failed`)),r.onabort=()=>t(r.error??Error(`IDB transaction aborted`))}),n.close()}async function l(e){let t=await new Promise((e,t)=>{let n=indexedDB.open(a,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(`handles`)||n.result.createObjectStore(`handles`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),n=t.transaction(`handles`,`readwrite`),r=n.objectStore(`handles`),o=r.get(e),s=r.delete(e);s.onerror=()=>{i.warn(`Failed to delete pending handle from IDB`,{idbKey:e,error:s.error})};let c=await new Promise((e,t)=>{n.oncomplete=()=>e(o.result??null),o.onerror=()=>t(o.error??Error(`IDB get failed`)),n.onerror=()=>t(n.error??Error(`IDB transaction failed`)),n.onabort=()=>t(n.error??Error(`IDB transaction aborted`))});return t.close(),c}async function u(e){let t=e;if(t.requestPermission){let n=await t.requestPermission({mode:`readwrite`});if(n!==`granted`)throw Error(`Permission denied for "${e.name}" (${n})`)}}export{c as a,u as i,r as n,s as r,l as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";function t(){return crypto.randomUUID()}var n=e({clearMountEntries:()=>f,getAllMountEntries:()=>u,loadMountHandle:()=>d,removeMountEntry:()=>l,saveMountEntry:()=>c}),r=`slicc-mount-table`,i=2,a=`mounts`,o=`mount-entries`;function s(){return new Promise((e,n)=>{let s=indexedDB.open(r,i);s.onupgradeneeded=e=>{let n=s.result,r=e.oldVersion;if(n.objectStoreNames.contains(a)||n.createObjectStore(a),n.objectStoreNames.contains(o)||n.createObjectStore(o),r<2){let e=s.transaction,n=e.objectStore(a),r=e.objectStore(o),i=n.getAllKeys();i.onsuccess=()=>{for(let e of i.result){if(typeof e!=`string`)continue;let n={targetPath:e,descriptor:{kind:`local`,mountId:t(),idbHandleKey:e},createdAt:Date.now()};r.put(n,e)}}}},s.onsuccess=()=>e(s.result),s.onerror=()=>n(s.error)})}async function c(e,t){let n=await s();try{let r=e.descriptor.kind===`local`&&t?[a,o]:[o],i=n.transaction(r,`readwrite`);i.objectStore(o).put(e,e.targetPath),e.descriptor.kind===`local`&&t&&i.objectStore(a).put(t,e.descriptor.idbHandleKey),await new Promise((e,t)=>{i.oncomplete=()=>e(),i.onerror=()=>t(i.error),i.onabort=()=>t(i.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{n.close()}}async function l(e){let t=await s();try{let n=t.transaction([a,o],`readwrite`);n.objectStore(o).delete(e),n.objectStore(a).delete(e),await new Promise((e,t)=>{n.oncomplete=()=>e(),n.onerror=()=>t(n.error),n.onabort=()=>t(n.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{t.close()}}async function u(){let e=await s();try{return await new Promise((t,n)=>{let r=e.transaction(o,`readonly`),i=r.objectStore(o).getAll();i.onsuccess=()=>t(i.result),i.onerror=()=>n(i.error),r.onabort=()=>n(r.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{e.close()}}async function d(e){let t=await s();try{return await new Promise((n,r)=>{let i=t.transaction(a,`readonly`).objectStore(a).get(e);i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}finally{t.close()}}async function f(){let e=await s();try{let t=e.transaction([a,o],`readwrite`);t.objectStore(a).clear(),t.objectStore(o).clear(),await new Promise((e,n)=>{t.oncomplete=()=>e(),t.onerror=()=>n(t.error),t.onabort=()=>n(t.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{e.close()}}export{c as a,l as i,d as n,t as o,n as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./mount-id-nJcx05eu.js";var n=e({clearMountEntries:()=>u,getAllMountEntries:()=>c,loadMountHandle:()=>l,removeMountEntry:()=>s,saveMountEntry:()=>o});const r=`mounts`,i=`mount-entries`;function a(){return new Promise((e,n)=>{let a=indexedDB.open(`slicc-mount-table`,2);a.onupgradeneeded=e=>{let n=a.result,o=e.oldVersion;if(n.objectStoreNames.contains(r)||n.createObjectStore(r),n.objectStoreNames.contains(i)||n.createObjectStore(i),o<2){let e=a.transaction,n=e.objectStore(r),o=e.objectStore(i),s=n.getAllKeys();s.onsuccess=()=>{for(let e of s.result){if(typeof e!=`string`)continue;let n={targetPath:e,descriptor:{kind:`local`,mountId:t(),idbHandleKey:e},createdAt:Date.now()};o.put(n,e)}}}},a.onsuccess=()=>e(a.result),a.onerror=()=>n(a.error)})}async function o(e,t){let n=await a();try{let a=e.descriptor.kind===`local`&&t?[r,i]:[i],o=n.transaction(a,`readwrite`);o.objectStore(i).put(e,e.targetPath),e.descriptor.kind===`local`&&t&&o.objectStore(r).put(t,e.descriptor.idbHandleKey),await new Promise((e,t)=>{o.oncomplete=()=>e(),o.onerror=()=>t(o.error),o.onabort=()=>t(o.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{n.close()}}async function s(e){let t=await a();try{let n=t.transaction([r,i],`readwrite`);n.objectStore(i).delete(e),n.objectStore(r).delete(e),await new Promise((e,t)=>{n.oncomplete=()=>e(),n.onerror=()=>t(n.error),n.onabort=()=>t(n.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{t.close()}}async function c(){let e=await a();try{return await new Promise((t,n)=>{let r=e.transaction(i,`readonly`),a=r.objectStore(i).getAll();a.onsuccess=()=>t(a.result),a.onerror=()=>n(a.error),r.onabort=()=>n(r.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{e.close()}}async function l(e){let t=await a();try{return await new Promise((n,i)=>{let a=t.transaction(r,`readonly`).objectStore(r).get(e);a.onsuccess=()=>n(a.result??null),a.onerror=()=>i(a.error)})}finally{t.close()}}async function u(){let e=await a();try{let t=e.transaction([r,i],`readwrite`);t.objectStore(r).clear(),t.objectStore(i).clear(),await new Promise((e,n)=>{t.oncomplete=()=>e(),t.onerror=()=>n(t.error),t.onabort=()=>n(t.error??new DOMException(`IndexedDB transaction aborted`,`AbortError`))})}finally{e.close()}}export{o as a,s as i,l as n,n as r,u as t};
@@ -1 +1 @@
1
- import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./handoff-link-ywwq4k0t.js";var n=e(`navigation-watcher`);function r(e,n){return t(e,n)}var i=class{transport;onEvent;sessions=new Map;started=!1;onAttachedToTarget=e=>{this.handleAttachedToTarget(e)};onDetachedFromTarget=e=>{let t=e.sessionId;t&&this.sessions.delete(t)};onTargetInfoChanged=e=>{let t=e.targetInfo;if(t?.targetId)for(let e of this.sessions.values())e.targetId===t.targetId&&(typeof t.title==`string`&&(e.title=t.title),typeof t.url==`string`&&(e.url=t.url))};onTargetCreated=e=>{this.handleTargetCreated(e)};onFrameNavigated=e=>{let t=e.sessionId;if(!t)return;let n=this.sessions.get(t);if(!n)return;let r=e.frame;r?.id&&(r.parentId||(n.rootFrameId=r.id,typeof r.url==`string`&&(n.url=r.url)))};onResponseReceived=e=>{let t=e.sessionId;if(!t)return;let n=this.sessions.get(t);if(!n||e.type!==`Document`)return;let i=e.frameId;if(!i||i!==n.rootFrameId)return;let a=e.response;if(!a)return;let o=typeof a.url==`string`&&a.url.length>0?a.url:n.url;if(!o)return;let{match:s,links:c}=r(a.headers,o);if(!s)return;let l={url:o,verb:s.verb,target:s.target,links:c,targetId:n.targetId};s.instruction!=null&&(l.instruction=s.instruction),s.branch!=null&&(l.branch=s.branch),s.path!=null&&(l.path=s.path),n.title!=null&&(l.title=n.title),this.onEvent(l)};constructor(e,t){this.transport=e,this.onEvent=t}async start(){if(!this.started){this.transport.on(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.on(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.on(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.on(`Target.targetCreated`,this.onTargetCreated),this.transport.on(`Page.frameNavigated`,this.onFrameNavigated),this.transport.on(`Network.responseReceived`,this.onResponseReceived);try{await this.transport.send(`Target.setDiscoverTargets`,{discover:!0})}catch(e){n.error(`Failed to enable target discovery`,{error:e instanceof Error?e.message:String(e)}),this.transport.off(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.off(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.off(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.off(`Target.targetCreated`,this.onTargetCreated),this.transport.off(`Page.frameNavigated`,this.onFrameNavigated),this.transport.off(`Network.responseReceived`,this.onResponseReceived);return}this.started=!0;try{let e=(await this.transport.send(`Target.getTargets`)).targetInfos??[];for(let t of e){if(t.type!==`page`)continue;let e=t.attached===!0,r=t.targetId;if(!(e||typeof r!=`string`))try{await this.transport.send(`Target.attachToTarget`,{targetId:r,flatten:!0})}catch(e){n.debug(`Failed to attach to preexisting target`,{targetId:r,error:e instanceof Error?e.message:String(e)})}}}catch(e){n.debug(`Failed to enumerate preexisting targets`,{error:e instanceof Error?e.message:String(e)})}}}async stop(){if(this.started){this.started=!1,this.transport.off(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.off(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.off(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.off(`Target.targetCreated`,this.onTargetCreated),this.transport.off(`Page.frameNavigated`,this.onFrameNavigated),this.transport.off(`Network.responseReceived`,this.onResponseReceived),this.sessions.clear();try{await this.transport.send(`Target.setDiscoverTargets`,{discover:!1})}catch(e){n.debug(`Failed to disable target discovery on stop`,{error:e instanceof Error?e.message:String(e)})}}}async handleTargetCreated(e){let t=e.targetInfo;if(!(t?.type!==`page`||typeof t.targetId!=`string`)&&!t.attached)try{await this.transport.send(`Target.attachToTarget`,{targetId:t.targetId,flatten:!0})}catch(e){n.debug(`Failed to attach to discovered target`,{targetId:t.targetId,error:e instanceof Error?e.message:String(e)})}}async handleAttachedToTarget(e){let t=e.sessionId,r=e.targetInfo;if(!(!t||!r||r.type!==`page`||typeof r.targetId!=`string`)){this.sessions.set(t,{targetId:r.targetId,rootFrameId:null,title:r.title,url:r.url});try{await this.transport.send(`Page.enable`,{},t),await this.transport.send(`Network.enable`,{},t);let e=(await this.transport.send(`Page.getFrameTree`,{},t)).frameTree?.frame;if(e?.id&&typeof e.id==`string`){let n=this.sessions.get(t);n&&(n.rootFrameId=e.id)}}catch(e){n.debug(`Failed to enable Page/Network on attached target`,{sessionId:t,error:e instanceof Error?e.message:String(e)})}}}};export{r as n,i as t};
1
+ import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./handoff-link-w8LYa3Ua.js";var n=e(`navigation-watcher`);function r(e,n){return t(e,n)}var i=class{transport;onEvent;sessions=new Map;started=!1;onAttachedToTarget=e=>{this.handleAttachedToTarget(e)};onDetachedFromTarget=e=>{let t=e.sessionId;t&&this.sessions.delete(t)};onTargetInfoChanged=e=>{let t=e.targetInfo;if(t?.targetId)for(let e of this.sessions.values())e.targetId===t.targetId&&(typeof t.title==`string`&&(e.title=t.title),typeof t.url==`string`&&(e.url=t.url))};onTargetCreated=e=>{this.handleTargetCreated(e)};onFrameNavigated=e=>{let t=e.sessionId;if(!t)return;let n=this.sessions.get(t);if(!n)return;let r=e.frame;r?.id&&(r.parentId||(n.rootFrameId=r.id,typeof r.url==`string`&&(n.url=r.url)))};onResponseReceived=e=>{let t=e.sessionId;if(!t)return;let n=this.sessions.get(t);if(!n||e.type!==`Document`)return;let i=e.frameId;if(!i||i!==n.rootFrameId)return;let a=e.response;if(!a)return;let o=typeof a.url==`string`&&a.url.length>0?a.url:n.url;if(!o)return;let{match:s,links:c}=r(a.headers,o);if(!s)return;let l={url:o,verb:s.verb,target:s.target,links:c,targetId:n.targetId};s.instruction!=null&&(l.instruction=s.instruction),s.branch!=null&&(l.branch=s.branch),s.path!=null&&(l.path=s.path),n.title!=null&&(l.title=n.title),this.onEvent(l)};constructor(e,t){this.transport=e,this.onEvent=t}async start(){if(!this.started){this.transport.on(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.on(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.on(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.on(`Target.targetCreated`,this.onTargetCreated),this.transport.on(`Page.frameNavigated`,this.onFrameNavigated),this.transport.on(`Network.responseReceived`,this.onResponseReceived);try{await this.transport.send(`Target.setDiscoverTargets`,{discover:!0})}catch(e){n.error(`Failed to enable target discovery`,{error:e instanceof Error?e.message:String(e)}),this.transport.off(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.off(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.off(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.off(`Target.targetCreated`,this.onTargetCreated),this.transport.off(`Page.frameNavigated`,this.onFrameNavigated),this.transport.off(`Network.responseReceived`,this.onResponseReceived);return}this.started=!0;try{let e=(await this.transport.send(`Target.getTargets`)).targetInfos??[];for(let t of e){if(t.type!==`page`)continue;let e=t.attached===!0,r=t.targetId;if(!(e||typeof r!=`string`))try{await this.transport.send(`Target.attachToTarget`,{targetId:r,flatten:!0})}catch(e){n.debug(`Failed to attach to preexisting target`,{targetId:r,error:e instanceof Error?e.message:String(e)})}}}catch(e){n.debug(`Failed to enumerate preexisting targets`,{error:e instanceof Error?e.message:String(e)})}}}async stop(){if(this.started){this.started=!1,this.transport.off(`Target.attachedToTarget`,this.onAttachedToTarget),this.transport.off(`Target.detachedFromTarget`,this.onDetachedFromTarget),this.transport.off(`Target.targetInfoChanged`,this.onTargetInfoChanged),this.transport.off(`Target.targetCreated`,this.onTargetCreated),this.transport.off(`Page.frameNavigated`,this.onFrameNavigated),this.transport.off(`Network.responseReceived`,this.onResponseReceived),this.sessions.clear();try{await this.transport.send(`Target.setDiscoverTargets`,{discover:!1})}catch(e){n.debug(`Failed to disable target discovery on stop`,{error:e instanceof Error?e.message:String(e)})}}}async handleTargetCreated(e){let t=e.targetInfo;if(!(t?.type!==`page`||typeof t.targetId!=`string`)&&!t.attached)try{await this.transport.send(`Target.attachToTarget`,{targetId:t.targetId,flatten:!0})}catch(e){n.debug(`Failed to attach to discovered target`,{targetId:t.targetId,error:e instanceof Error?e.message:String(e)})}}async handleAttachedToTarget(e){let t=e.sessionId,r=e.targetInfo;if(!(!t||!r||r.type!==`page`||typeof r.targetId!=`string`)){this.sessions.set(t,{targetId:r.targetId,rootFrameId:null,title:r.title,url:r.url});try{await this.transport.send(`Page.enable`,{},t),await this.transport.send(`Network.enable`,{},t);let e=(await this.transport.send(`Page.getFrameTree`,{},t)).frameTree?.frame;if(e?.id&&typeof e.id==`string`){let n=this.sessions.get(t);n&&(n.rootFrameId=e.id)}}catch(e){n.debug(`Failed to enable Page/Network on attached target`,{sessionId:t,error:e instanceof Error?e.message:String(e)})}}}};export{r as n,i as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/quick-llm-ZN9ts94Z.js","assets/chunk-aKtaBQYM.js","assets/account-store-CWhir8ug.js","assets/preload-helper-zJ_50EbN.js","assets/dist-BmWy99kl.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-BUunmmNl.js","assets/__vite-browser-external-C7iut881.js","assets/context-compaction-CFWyOzX1.js","assets/logger-DDBAeTLF.js","assets/providers-D0vM4fsT.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-B5vr_AP8.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-Bp0wH2ni.js","assets/secrets-bridge-client-DXw32cXb.js","assets/panel-rpc-DqT2FG7c.js","assets/bedrock-camp-9-QEmC9Z.js","assets/transform-messages-DzB_lMo-.js","assets/tool-ui-DfXu6quJ.js","assets/icons-BU6llBsN.js","assets/llm-session-id-DVmZ9C2t.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{F as t,m as n}from"./account-store-CWhir8ug.js";import{t as r}from"./logger-DDBAeTLF.js";import"./main-ikPJox6X.js";import{t as i}from"./llm-session-id-DVmZ9C2t.js";import{SessionStore as a}from"./session-store-CCH7W8KY.js";import{a as o,i as s}from"./wc-live-DuR78HgI.js";var c=r(`new-session`),l=`ui-new-session`,u=2e4,d=250;async function f(r){let d=r.enrichmentRaceMs??u,f=n()??void 0,m;try{m=t()}catch(e){c.info(`No active model — freezing without LLM enrichment`,{error:e instanceof Error?e.message:String(e)})}let h=m?.provider===`adobe`?{"X-Session-Id":i(l)}:void 0,g=new a;try{await g.init()}catch(e){return c.warn(`SessionStore init failed — cannot freeze`,{error:e instanceof Error?e.message:String(e)}),null}let _=await o({sessionStore:g,vfs:r.vfs,mode:`quick`});if(!_)return null;if(!f||!m)return c.info(`Frozen without enrichment (no LLM credentials) — left pending`,{filename:_.filename}),_;let v=m,y=s(r.vfs,_,{model:v,apiKey:f,headers:h,pickIcon:t=>e(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-ZN9ts94Z.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({pickLucideIcon:e})=>e(t))}).catch(e=>(c.warn(`Single-click enrichment threw (entry stays pending)`,{filename:_.filename,error:e instanceof Error?e.message:String(e)}),null)),b=await p(y,d,r.onProgress);return b.kind===`llm`?b.updated?{...b.updated,archive:_.archive}:_:(y.then(e=>{c.info(`Background enrichment resolved after race window`,{filename:_.filename,enriched:e?.filename??null}),r.onBackgroundEnriched?.(e)}),_)}async function p(e,t,n){let r=Date.now(),i,a;n?.(0),n&&(i=setInterval(()=>{n(Math.min(1,(Date.now()-r)/t))},d));let o=new Promise(e=>{a=setTimeout(()=>e({kind:`timer`}),t)}),s=e.then(e=>({kind:`llm`,updated:e}));try{return await Promise.race([s,o])}finally{i&&clearInterval(i),a&&clearTimeout(a),n?.(null)}}async function m(e){let t=new a;try{await t.init()}catch(e){return c.warn(`SessionStore init failed — cannot quick-freeze`,{error:e instanceof Error?e.message:String(e)}),null}return o({sessionStore:t,vfs:e.vfs,mode:`quick`})}export{f as runNewSessionFreeze,m as runNewSessionFreezeQuick};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/quick-llm-BcXxSY4e.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-D69OmKNn.js","assets/preload-helper-CZgWQFsJ.js","assets/__vite-browser-external-SwrSgYTf.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-C7d6hyOc.js","assets/account-store-DRcHIayv.js","assets/context-compaction-DvlXtgVG.js","assets/logger-DDBAeTLF.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-DzLglfG5.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-CC_yKaqL.js","assets/secrets-bridge-client-C3K9ItX4.js","assets/tool-ui-DfXu6quJ.js","assets/providers-lNcU6L-a.js","assets/panel-rpc-DmJSNs0I.js","assets/bedrock-camp-DjKgax8m.js","assets/transform-messages-DiIjWKhh.js","assets/llm-session-id-bZQs6gBN.js","assets/icons-C5g936Qd.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./preload-helper-CZgWQFsJ.js";import{F as t,m as n}from"./account-store-DRcHIayv.js";import{t as r}from"./logger-DDBAeTLF.js";import"./main-BME4pJJo.js";import{t as i}from"./llm-session-id-bZQs6gBN.js";import{SessionStore as a}from"./session-store-DAM8GRJ0.js";import{a as o,i as s}from"./wc-live-CKisGrn6.js";var c=r(`new-session`),l=`ui-new-session`,u=2e4,d=250;async function f(r){let d=r.enrichmentRaceMs??u,f=n()??void 0,m;try{m=t()}catch(e){c.info(`No active model — freezing without LLM enrichment`,{error:e instanceof Error?e.message:String(e)})}let h=m?.provider===`adobe`?{"X-Session-Id":i(l)}:void 0,g=new a;try{await g.init()}catch(e){return c.warn(`SessionStore init failed — cannot freeze`,{error:e instanceof Error?e.message:String(e)}),null}let _=await o({sessionStore:g,vfs:r.vfs,mode:`quick`});if(!_)return null;if(!f||!m)return c.info(`Frozen without enrichment (no LLM credentials) — left pending`,{filename:_.filename}),_;let v=m,y=s(r.vfs,_,{model:v,apiKey:f,headers:h,pickIcon:t=>e(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-BcXxSY4e.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({pickLucideIcon:e})=>e(t))}).catch(e=>(c.warn(`Single-click enrichment threw (entry stays pending)`,{filename:_.filename,error:e instanceof Error?e.message:String(e)}),null)),b=await p(y,d,r.onProgress);return b.kind===`llm`?b.updated?{...b.updated,archive:_.archive}:_:(y.then(e=>{c.info(`Background enrichment resolved after race window`,{filename:_.filename,enriched:e?.filename??null}),r.onBackgroundEnriched?.(e)}),_)}async function p(e,t,n){let r=Date.now(),i,a;n?.(0),n&&(i=setInterval(()=>{n(Math.min(1,(Date.now()-r)/t))},d));let o=new Promise(e=>{a=setTimeout(()=>e({kind:`timer`}),t)}),s=e.then(e=>({kind:`llm`,updated:e}));try{return await Promise.race([s,o])}finally{i&&clearInterval(i),a&&clearTimeout(a),n?.(null)}}async function m(e){let t=new a;try{await t.init()}catch(e){return c.warn(`SessionStore init failed — cannot quick-freeze`,{error:e instanceof Error?e.message:String(e)}),null}return o({sessionStore:t,vfs:e.vfs,mode:`quick`})}export{f as runNewSessionFreeze,m as runNewSessionFreezeQuick};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/provider-Dv05sEX_.js","assets/preload-helper-zJ_50EbN.js","assets/account-store-CWhir8ug.js","assets/chunk-aKtaBQYM.js","assets/dist-BmWy99kl.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-BUunmmNl.js","assets/__vite-browser-external-C7iut881.js","assets/context-compaction-CFWyOzX1.js","assets/logger-DDBAeTLF.js","assets/providers-D0vM4fsT.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-B5vr_AP8.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-Bp0wH2ni.js","assets/secrets-bridge-client-DXw32cXb.js","assets/panel-rpc-DqT2FG7c.js","assets/bedrock-camp-9-QEmC9Z.js","assets/transform-messages-DzB_lMo-.js","assets/tool-ui-DfXu6quJ.js","assets/global-db-CbuLl-zx.js","assets/types-idfTVsM8.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{R as t,d as n}from"./account-store-CWhir8ug.js";import{t as r}from"./logger-DDBAeTLF.js";import{t as i}from"./providers-D0vM4fsT.js";import"./main-ikPJox6X.js";var a=r(`oauth-bootstrap`),o=6e4;async function s(){try{let{ensureAllMcpProvidersRegistered:t}=await e(async()=>{let{ensureAllMcpProvidersRegistered:e}=await import(`./provider-Dv05sEX_.js`);return{ensureAllMcpProvidersRegistered:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),n=await t();n.length>0&&a.debug(`Pre-registered MCP providers for OAuth bootstrap`,{count:n.length})}catch(e){a.warn(`Failed to pre-register MCP providers for OAuth bootstrap`,{error:e instanceof Error?e.message:String(e)})}let r=n();a.info(`Bootstrap OAuth replicas`,{count:r.length});for(let e of r){if(!e.accessToken){a.debug(`Skipping account without token`,{providerId:e.providerId});continue}if((e.tokenExpiresAt??1/0)-Date.now()<=o){let t=i(e.providerId);if(t?.onSilentRenew)try{if(await t.onSilentRenew()){a.info(`Silently renewed OAuth token`,{providerId:e.providerId});continue}a.warn(`Silent renewal yielded no token; user must re-authenticate`,{providerId:e.providerId});continue}catch(t){a.warn(`Silent renewal failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)});continue}a.debug(`Skipping expired account (no silent-renew hook)`,{providerId:e.providerId});continue}try{await t({providerId:e.providerId,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar}),a.debug(`Bootstrapped OAuth replica`,{providerId:e.providerId})}catch(t){a.error(`OAuth bootstrap failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)})}}}export{s as bootstrapOAuthReplicas};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/provider-DO4PGsF_.js","assets/preload-helper-CZgWQFsJ.js","assets/account-store-DRcHIayv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/dist-D69OmKNn.js","assets/__vite-browser-external-SwrSgYTf.js","assets/event-stream-BJI_nGaK.js","assets/json-parse-C7d6hyOc.js","assets/context-compaction-DvlXtgVG.js","assets/logger-DDBAeTLF.js","assets/src-x0cJ68Fe.js","assets/proxied-fetch-DzLglfG5.js","assets/fetch-body-D2PwksUW.js","assets/secret-topology-CC_yKaqL.js","assets/secrets-bridge-client-C3K9ItX4.js","assets/tool-ui-DfXu6quJ.js","assets/providers-lNcU6L-a.js","assets/panel-rpc-DmJSNs0I.js","assets/bedrock-camp-DjKgax8m.js","assets/transform-messages-DiIjWKhh.js","assets/global-db-CbuLl-zx.js","assets/types-idfTVsM8.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./preload-helper-CZgWQFsJ.js";import{R as t,d as n}from"./account-store-DRcHIayv.js";import{t as r}from"./logger-DDBAeTLF.js";import{t as i}from"./providers-lNcU6L-a.js";import"./main-BME4pJJo.js";var a=r(`oauth-bootstrap`),o=6e4;async function s(){try{let{ensureAllMcpProvidersRegistered:t}=await e(async()=>{let{ensureAllMcpProvidersRegistered:e}=await import(`./provider-DO4PGsF_.js`);return{ensureAllMcpProvidersRegistered:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),n=await t();n.length>0&&a.debug(`Pre-registered MCP providers for OAuth bootstrap`,{count:n.length})}catch(e){a.warn(`Failed to pre-register MCP providers for OAuth bootstrap`,{error:e instanceof Error?e.message:String(e)})}let r=n();a.info(`Bootstrap OAuth replicas`,{count:r.length});for(let e of r){if(!e.accessToken){a.debug(`Skipping account without token`,{providerId:e.providerId});continue}if((e.tokenExpiresAt??1/0)-Date.now()<=o){let t=i(e.providerId);if(t?.onSilentRenew)try{if(await t.onSilentRenew()){a.info(`Silently renewed OAuth token`,{providerId:e.providerId});continue}a.warn(`Silent renewal yielded no token; user must re-authenticate`,{providerId:e.providerId});continue}catch(t){a.warn(`Silent renewal failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)});continue}a.debug(`Skipping expired account (no silent-renew hook)`,{providerId:e.providerId});continue}try{await t({providerId:e.providerId,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar}),a.debug(`Bootstrapped OAuth replica`,{providerId:e.providerId})}catch(t){a.error(`OAuth bootstrap failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)})}}}export{s as bootstrapOAuthReplicas};
@@ -1 +1 @@
1
- import{o as e,t}from"./proxied-fetch-I4cndszg.js";import{n}from"./panel-rpc-D0J5pskz.js";import{t as r}from"./wc-permissions-registry-Dx-BRiKK.js";import{t as i}from"./intercepted-oauth-E9BfBX02.js";const a=typeof chrome<`u`&&!!chrome?.runtime?.id;function o(){return a?g:typeof window>`u`?u:d}async function s(){let e=await c();return e?i(e):null}async function c(){try{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function l(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let e=n();if(!e)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let t=await e.call(`page-info`,void 0);return{origin:t.origin,href:t.href}}async function u(e){let t=n();if(!t)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await t.call(`oauth-popup`,{url:e},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function d(e){if(f())return p(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let t=r();if(t){let n=await m(t,e);return n===void 0?null:p(n)}return p(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function f(){return(typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0}function p(n){return new Promise(r=>{let i=!1,a=null,o=null,s=()=>{i||(i=!0,window.removeEventListener(`message`,c),clearTimeout(l),a&&clearInterval(a),o&&clearInterval(o))},c=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(s(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),r(null);return}let t=e.data.redirectUrl;typeof t!=`string`&&t!=null||r(t??null)};window.addEventListener(`message`,c),a=setInterval(async()=>{if(!i)try{let n=await fetch(e(`/api/oauth-result`),{headers:t()});if(n.status===204||!n.ok)return;let a=await n.json();if(i)return;if(s(),a.error){console.error(`[oauth-service] Server relay OAuth error:`,a.error),r(null);return}r(a.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(o=setInterval(()=>{n.closed&&(clearInterval(o),o=null,setTimeout(()=>{i||(s(),r(null))},1500))},500));let l=setTimeout(()=>{s();try{n?.close()}catch{}r(null)},12e4)})}async function m(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}async function h(e,t=180*1e3){if(typeof window>`u`||a)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function g(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{s as createInterceptingOAuthLauncherForCurrentRuntime,o as createOAuthLauncher,l as getOAuthPageOrigin,h as openIdpLogoutUrl};
1
+ import{o as e,t}from"./proxied-fetch-R_Zw2ZFI.js";import{n}from"./panel-rpc-CjFVE0nK.js";import{t as r}from"./wc-permissions-registry-C7PhTX3c.js";import{t as i}from"./intercepted-oauth-CaCw-rJ5.js";const a=typeof chrome<`u`&&!!chrome?.runtime?.id;function o(){return a?g:typeof window>`u`?u:d}async function s(){let e=await c();return e?i(e):null}async function c(){try{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function l(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let e=n();if(!e)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let t=await e.call(`page-info`,void 0);return{origin:t.origin,href:t.href}}async function u(e){let t=n();if(!t)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await t.call(`oauth-popup`,{url:e},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function d(e){if(f())return p(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let t=r();if(t){let n=await m(t,e);return n===void 0?null:p(n)}return p(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function f(){return(typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0}function p(n){return new Promise(r=>{let i=!1,a=null,o=null,s=()=>{i||(i=!0,window.removeEventListener(`message`,c),clearTimeout(l),a&&clearInterval(a),o&&clearInterval(o))},c=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(s(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),r(null);return}let t=e.data.redirectUrl;typeof t!=`string`&&t!=null||r(t??null)};window.addEventListener(`message`,c),a=setInterval(async()=>{if(!i)try{let n=await fetch(e(`/api/oauth-result`),{headers:t()});if(n.status===204||!n.ok)return;let a=await n.json();if(i)return;if(s(),a.error){console.error(`[oauth-service] Server relay OAuth error:`,a.error),r(null);return}r(a.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(o=setInterval(()=>{n.closed&&(clearInterval(o),o=null,setTimeout(()=>{i||(s(),r(null))},1500))},500));let l=setTimeout(()=>{s();try{n?.close()}catch{}r(null)},12e4)})}async function m(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}async function h(e,t=180*1e3){if(typeof window>`u`||a)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function g(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{s as createInterceptingOAuthLauncherForCurrentRuntime,o as createOAuthLauncher,l as getOAuthPageOrigin,h as openIdpLogoutUrl};
@@ -1 +1 @@
1
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{a as t,t as n}from"./proxied-fetch-B5vr_AP8.js";import{t as r}from"./panel-rpc-DqT2FG7c.js";import{t as i}from"./wc-permissions-registry-CR1rTd2H.js";var a=12e4;function o(e,t){return t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}#`)}function s(e){return e.endsWith(`*`)?e:`${e}*`}function c(e,t){if(!t||t.length===0)return e;let n=e;for(let e of t)if(n.includes(e.match)){if(e.replaceUrl){n=e.replaceUrl;continue}if(e.appendParams)try{let t=new URL(n);for(let[n,r]of Object.entries(e.appendParams))t.searchParams.set(n,r);n=t.toString()}catch{}}return n}function l(e){return async t=>{let n=t.timeoutMs??a,r=t.rewrite??[],i=t.onCapture??`close`,l,u,d=!1,f=null,p=async()=>{if(u){try{await e.send(`Fetch.disable`,{},u)}catch{}try{await e.send(`Target.detachFromTarget`,{sessionId:u})}catch{}}if(l&&i===`close`)try{await e.send(`Target.closeTarget`,{targetId:l})}catch{}};return await new Promise(i=>{let a=async t=>{d||(d=!0,clearTimeout(h),e.off(`Fetch.requestPaused`,m),await p(),i(t))},m=n=>{let i=n;if(!i?.request?.url||!u||(typeof n.sessionId==`string`?n.sessionId:void 0)!==u)return;if(o(i.request.url,t.redirectUriPattern)){f=i.request.url,e.send(`Fetch.failRequest`,{requestId:i.requestId,errorReason:`Aborted`},u).catch(()=>{}),a(f);return}let s=c(i.request.url,r);if(s!==i.request.url){e.send(`Fetch.continueRequest`,{requestId:i.requestId,url:s},u).catch(e=>{console.warn(`[intercepted-oauth] continueRequest (rewrite) failed:`,e instanceof Error?e.message:String(e))});return}e.send(`Fetch.continueRequest`,{requestId:i.requestId},u).catch(()=>{})},h=setTimeout(()=>{a(null)},n);(async()=>{try{l=(await e.send(`Target.createTarget`,{url:`about:blank`})).targetId,u=(await e.send(`Target.attachToTarget`,{targetId:l,flatten:!0})).sessionId,e.on(`Fetch.requestPaused`,m),await e.send(`Fetch.enable`,{patterns:[{urlPattern:s(t.redirectUriPattern),requestStage:`Request`},...r.map(e=>({urlPattern:`*${e.match}*`,requestStage:`Request`}))]},u),await e.send(`Page.navigate`,{url:t.authorizeUrl},u)}catch(e){console.error(`[intercepted-oauth] setup failed:`,e instanceof Error?e.message:String(e)),a(null)}})()})}}var u=typeof chrome<`u`&&!!chrome?.runtime?.id;function d(){return u?x:typeof window>`u`?h:g}async function f(){let e=await p();return e?l(e):null}async function p(){try{let{getActiveCdpTransport:t}=await e(async()=>{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return{getActiveCdpTransport:e}},[]);return await t()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function m(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let e=r();if(!e)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let t=await e.call(`page-info`,void 0);return{origin:t.origin,href:t.href}}async function h(e){let t=r();if(!t)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await t.call(`oauth-popup`,{url:e},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function g(e){if(_())return v(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let t=i();if(t){let n=await y(t,e);return n===void 0?null:v(n)}return v(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function _(){return(typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0}function v(e){return new Promise(r=>{let i=!1,a=null,o=null,s=()=>{i||(i=!0,window.removeEventListener(`message`,c),clearTimeout(l),a&&clearInterval(a),o&&clearInterval(o))},c=t=>{if(t.data?.type!==`oauth-callback`||t.origin!==window.location.origin||e&&t.source!==e)return;if(s(),t.data.error){console.error(`[oauth-service] CLI OAuth error:`,t.data.error),r(null);return}let n=t.data.redirectUrl;typeof n!=`string`&&n!=null||r(n??null)};window.addEventListener(`message`,c),a=setInterval(async()=>{if(!i)try{let e=await fetch(t(`/api/oauth-result`),{headers:n()});if(e.status===204||!e.ok)return;let a=await e.json();if(i)return;if(s(),a.error){console.error(`[oauth-service] Server relay OAuth error:`,a.error),r(null);return}r(a.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),e&&(o=setInterval(()=>{e.closed&&(clearInterval(o),o=null,setTimeout(()=>{i||(s(),r(null))},1500))},500));let l=setTimeout(()=>{s();try{e?.close()}catch{}r(null)},12e4)})}async function y(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}async function b(e,t=180*1e3){if(typeof window>`u`||u)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function x(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{f as createInterceptingOAuthLauncherForCurrentRuntime,d as createOAuthLauncher,m as getOAuthPageOrigin,b as openIdpLogoutUrl};
1
+ import{t as e}from"./preload-helper-CZgWQFsJ.js";import{a as t,t as n}from"./proxied-fetch-DzLglfG5.js";import{t as r}from"./panel-rpc-DmJSNs0I.js";import{t as i}from"./wc-permissions-registry-Blyunq37.js";var a=12e4;function o(e,t){return t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}#`)}function s(e){return e.endsWith(`*`)?e:`${e}*`}function c(e,t){if(!t||t.length===0)return e;let n=e;for(let e of t)if(n.includes(e.match)){if(e.replaceUrl){n=e.replaceUrl;continue}if(e.appendParams)try{let t=new URL(n);for(let[n,r]of Object.entries(e.appendParams))t.searchParams.set(n,r);n=t.toString()}catch{}}return n}function l(e){return async t=>{let n=t.timeoutMs??a,r=t.rewrite??[],i=t.onCapture??`close`,l,u,d=!1,f=null,p=async()=>{if(u){try{await e.send(`Fetch.disable`,{},u)}catch{}try{await e.send(`Target.detachFromTarget`,{sessionId:u})}catch{}}if(l&&i===`close`)try{await e.send(`Target.closeTarget`,{targetId:l})}catch{}};return await new Promise(i=>{let a=async t=>{d||(d=!0,clearTimeout(h),e.off(`Fetch.requestPaused`,m),await p(),i(t))},m=n=>{let i=n;if(!i?.request?.url||!u||(typeof n.sessionId==`string`?n.sessionId:void 0)!==u)return;if(o(i.request.url,t.redirectUriPattern)){f=i.request.url,e.send(`Fetch.failRequest`,{requestId:i.requestId,errorReason:`Aborted`},u).catch(()=>{}),a(f);return}let s=c(i.request.url,r);if(s!==i.request.url){e.send(`Fetch.continueRequest`,{requestId:i.requestId,url:s},u).catch(e=>{console.warn(`[intercepted-oauth] continueRequest (rewrite) failed:`,e instanceof Error?e.message:String(e))});return}e.send(`Fetch.continueRequest`,{requestId:i.requestId},u).catch(()=>{})},h=setTimeout(()=>{a(null)},n);(async()=>{try{l=(await e.send(`Target.createTarget`,{url:`about:blank`})).targetId,u=(await e.send(`Target.attachToTarget`,{targetId:l,flatten:!0})).sessionId,e.on(`Fetch.requestPaused`,m),await e.send(`Fetch.enable`,{patterns:[{urlPattern:s(t.redirectUriPattern),requestStage:`Request`},...r.map(e=>({urlPattern:`*${e.match}*`,requestStage:`Request`}))]},u),await e.send(`Page.navigate`,{url:t.authorizeUrl},u)}catch(e){console.error(`[intercepted-oauth] setup failed:`,e instanceof Error?e.message:String(e)),a(null)}})()})}}var u=typeof chrome<`u`&&!!chrome?.runtime?.id;function d(){return u?x:typeof window>`u`?h:g}async function f(){let e=await p();return e?l(e):null}async function p(){try{let{getActiveCdpTransport:t}=await e(async()=>{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return{getActiveCdpTransport:e}},[]);return await t()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function m(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let e=r();if(!e)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let t=await e.call(`page-info`,void 0);return{origin:t.origin,href:t.href}}async function h(e){let t=r();if(!t)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await t.call(`oauth-popup`,{url:e},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function g(e){if(_())return v(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let t=i();if(t){let n=await y(t,e);return n===void 0?null:v(n)}return v(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function _(){return(typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0}function v(e){return new Promise(r=>{let i=!1,a=null,o=null,s=()=>{i||(i=!0,window.removeEventListener(`message`,c),clearTimeout(l),a&&clearInterval(a),o&&clearInterval(o))},c=t=>{if(t.data?.type!==`oauth-callback`||t.origin!==window.location.origin||e&&t.source!==e)return;if(s(),t.data.error){console.error(`[oauth-service] CLI OAuth error:`,t.data.error),r(null);return}let n=t.data.redirectUrl;typeof n!=`string`&&n!=null||r(n??null)};window.addEventListener(`message`,c),a=setInterval(async()=>{if(!i)try{let e=await fetch(t(`/api/oauth-result`),{headers:n()});if(e.status===204||!e.ok)return;let a=await e.json();if(i)return;if(s(),a.error){console.error(`[oauth-service] Server relay OAuth error:`,a.error),r(null);return}r(a.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),e&&(o=setInterval(()=>{e.closed&&(clearInterval(o),o=null,setTimeout(()=>{i||(s(),r(null))},1500))},500));let l=setTimeout(()=>{s();try{e?.close()}catch{}r(null)},12e4)})}async function y(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}async function b(e,t=180*1e3){if(typeof window>`u`||u)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function x(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{f as createInterceptingOAuthLauncherForCurrentRuntime,d as createOAuthLauncher,m as getOAuthPageOrigin,b as openIdpLogoutUrl};
@@ -1 +1 @@
1
- import{t as e}from"./logger-DDBAeTLF.js";import{n as t}from"./welcome-detection-Cr8mNEkt.js";var n={openai:{url:e=>`${(e??`https://api.openai.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},anthropic:{url:e=>`${(e??`https://api.anthropic.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({"x-api-key":e,"anthropic-version":`2023-06-01`})},groq:{url:e=>`${(e??`https://api.groq.com/openai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},cerebras:{url:e=>`${(e??`https://api.cerebras.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},mistral:{url:e=>`${(e??`https://api.mistral.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},"x-ai":{url:e=>`${(e??`https://api.x.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},deepseek:{url:e=>`${(e??`https://api.deepseek.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},openrouter:{url:e=>`${(e??`https://openrouter.ai/api`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},google:{url:e=>`${(e??`https://generativelanguage.googleapis.com`).replace(/\/$/,``)}/v1beta/models`,headers:()=>({})}};function r(e,t){if(e===401||e===403)return`Authentication failed — the key was rejected by the provider.`;if(e===404)return`Endpoint not found — check the base URL.`;if(e===429)return`Rate-limited — try again in a moment.`;if(e>=500)return`Provider returned a server error.`;let n=t.trim();return n?`${e}: ${n.slice(0,160)}`:`Provider responded with HTTP ${e}.`}async function i(e){let{provider:t,apiKey:i,baseUrl:a,signal:o}=e,s=e.fetchImpl??fetch,c=i.trim();if(!c)return{kind:`failed`,status:null,message:`API key is empty.`};let l=n[t];if(!l)return{kind:`skipped`,reason:`No live validation available for "${t}" — saving without testing.`};let u=l.url(a);if(t===`google`){let e=u.includes(`?`)?`&`:`?`;u=`${u}${e}key=${encodeURIComponent(c)}`}try{let e=await s(u,{method:`GET`,headers:l.headers(c),signal:o});if(e.ok)return{kind:`ok`};let t=``;try{t=await e.text()}catch{}return e.status===401||e.status,{kind:`failed`,status:e.status,message:r(e.status,t)}}catch(e){if(e?.name===`AbortError`)throw e;return{kind:`skipped`,reason:`Couldn't reach the provider (${e instanceof Error?e.message:String(e)}). Saving without live test — you can retry from Settings.`}}}var a=[e=>`Nice to meet you, ${e}.`,e=>`Hello ${e} — glad you stopped by.`,e=>`Hey ${e}, welcome aboard.`,e=>`${e}! Pleasure to make your acquaintance.`],o=[`Nice to meet you, mysterious stranger — I'll respect the incognito.`,`Hello, anonymous traveler. You can always tell me your name later if you change your mind.`,`An unnamed visitor — intriguing. Whenever you'd like to introduce yourself, just say the word.`,`Hey there, ghost — happy to keep things first-name-optional. The door's always open if you decide to drop the cloak.`],s={work:[`Work mode — let's make today productive.`,`On the clock? Same. Let's chip away at it.`],school:[`School business — I love a good study session.`,`Hitting the books? Glad to ride along.`],personal:[`Personal project energy is the best kind.`,`Tinkering for yourself is how the good stuff happens.`],"side-project":[`Side projects keep the lights on creatively.`,`Two-job life — respect.`],exploring:[`Just poking around? Excellent. The best discoveries start there.`,`Exploration mode — no agenda, no pressure.`]},c={developer:[`I can write code, run shell commands, drive a real browser, and ship pages.`,`Code, terminals, browsers, repos — I live in all of them.`],designer:[`I can prototype layouts, generate assets, and walk page editors with you.`,`Pixels, components, screenshots — design ops are my jam.`],"content-creator":[`I can draft copy, edit, scrape references, and stitch publish-ready pages.`,`Words, structure, SEO, polish — say the topic and I'll get moving.`],marketer:[`I can audit funnels, scrape competitors, and stand up landing pages quickly.`,`Campaigns, analytics, creatives — plug me in and I'll go.`],"product-pm":[`I can summarise research, draft specs, and crunch competitive intel.`,`Briefs, roadmaps, comparisons — I take the boring half off your plate.`],founder:[`I can prototype landing pages, automate ops, and prep investor decks.`,`Idea → MVP → repeat. I'll do the legwork between coffee refills.`],student:[`I can read papers with you, draft notes, and turn lectures into outlines.`,`Studying together makes it bearable — let me handle the busywork.`],researcher:[`I can scrape sources, summarise findings, and keep a running bibliography.`,`Lit reviews, datasets, write-ups — I'm all in.`],other:[`I'm flexible — give me a task and I'll figure out the right tools.`,`Whatever the role, I can probably help. Tell me what's on the docket.`]},l=[`I can browse the web, run commands, write code, and automate the boring parts.`,`I'm comfortable with terminals, browsers, files, and a long backlog of skills.`],u=[`But to be honest, I'm not really an AI yet — I'm an empty shell. You'll need to help me become intelligent. Pick a model and I'll wake up:`,`Confession time: I can't actually think yet. Wire me up to an LLM and I'll start earning my keep:`,`Plot twist — there's no brain in here. Choose a provider so I can do more than read this script:`,`Truthfully? I'm a very polite placeholder until you give me a model. Help me out:`];function d(e,t){return e[Math.floor(t()*e.length)%e.length]}function f(e){return e.replace(/-/g,` `)}function p(e){if(e.length===0)return``;if(e.length===1)return e[0];if(e.length===2)return`${e[0]} and ${e[1]}`;let t=e[e.length-1];return`${e.slice(0,-1).join(`, `)}, and ${t}`}function m(e,t=Math.random){let n=(e.name||``).trim(),r=e.purpose?s[e.purpose]:void 0;return n?`${d(a,t)(n)}${r?` ${d(r,t)}`:``}`:`${d(o,t)}${r?` ${d(r,t)}`:``}`}function h(e,t=Math.random){let n=e.role&&c[e.role]?e.role:``,r=d(n?c[n]:l,t),i=(e.tasks??[]).slice(0,3).map(f);return`I'm sliccy. ${r}${i.length>0?` Especially handy for ${p(i)}.`:``} I'm an AI agent.`}function g(e,t=Math.random){return d(u,t)}function _(e,t=Math.random){return[m(e,t),h(e,t),g(e,t)]}var v=e(`onboarding-orchestrator`),y=class{deps;stage=`idle`;profile={};constructor(e){this.deps=e}getStage(){return this.stage}getProfile(){return{...this.profile}}handleFirstRun(){this.stage===`idle`&&(this.stage=`collect-profile`,this.deps.postDipReference(`Welcome to SLICC — let's get you set up.`),this.deps.postDipReference(`![Welcome](/shared/sprinkles/welcome/welcome.shtml)`))}async handleOnboardingComplete(e){if(this.stage!==`idle`&&this.stage!==`collect-profile`)return v.debug(`Ignoring duplicate onboarding-complete`,{stage:this.stage}),!0;this.profile=e??{},this.stage=`awaiting-connect`,t(this.deps.fs).catch(e=>v.warn(`recordWelcomed failed`,e)),this.persistProfile(this.profile).catch(e=>v.warn(`persistProfile failed`,e));let n=_(this.profile,this.deps.rand);for(let e of n)this.deps.postSystemMessage(e);return this.deps.postDipReference(`![Connect a model](/shared/sprinkles/welcome/connect-llm.shtml)`),!0}handleConnectReady(){if(this.stage===`complete`)return;let e=this.deps.getProviderCatalogue();this.deps.broadcastToDip({type:`slicc-providers`,providers:e.providers,models:e.models})}async handleConnectAttempt(e){if(this.stage===`complete`)return;this.stage=`connecting`;let{provider:t,apiKey:n,baseUrl:r,deployment:a,apiVersion:o,model:s}=e;if(!t||typeof n!=`string`||!n.trim()){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Provider and API key are required.`}),this.stage=`awaiting-connect`;return}let c=this.validateProviderRequiredFields(t,r,a);if(c){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:c}),this.stage=`awaiting-connect`;return}let l;try{l=await i({provider:t,apiKey:n.trim(),baseUrl:r??void 0,fetchImpl:this.deps.fetchImpl})}catch(e){v.warn(`validateApiKey threw`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Validation request was aborted.`}),this.stage=`awaiting-connect`;return}if(l.kind===`failed`){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:l.message}),this.stage=`awaiting-connect`;return}let u=s||null;if(!u)try{let e=this.deps.getProviderCatalogue().models?.[t]?.[0]?.id;e&&(u=e)}catch(e){v.warn(`Failed to resolve fallback model for provider`,{provider:t,err:e})}try{this.deps.saveAccount(t,n.trim(),r?.trim()||void 0,a?.trim()||void 0,o?.trim()||void 0),u&&this.deps.setSelectedModel(b(t,u))}catch(e){v.warn(`saveAccount failed`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Failed to save credentials locally.`}),this.stage=`awaiting-connect`;return}try{this.deps.onAccountsChanged?.()}catch(e){v.warn(`onAccountsChanged threw`,e)}let d=l.kind===`skipped`?`Saved — ${l.reason}`:`Validated against the provider. Ready when you are.`;this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!0,kind:l.kind,note:d});let f=u&&this.deps.resolveModelLabel?.(t,u)?this.deps.resolveModelLabel?.(t,u):u||null;this.stage=`complete`,this.deps.fireFinalLick({action:`onboarding-complete-with-provider`,data:{profile:this.profile,provider:t,model:u??null,modelLabel:f,validation:l.kind}})}async handleOAuthAttempt(e){if(this.stage===`complete`)return;if(!this.deps.launchOAuth){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`OAuth login is not available in this runtime.`});return}this.stage=`connecting`;let t;try{t=await this.deps.launchOAuth(e.provider,e.baseUrl??null)}catch(e){v.warn(`launchOAuth threw`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:e instanceof Error?e.message:`Login was cancelled.`}),this.stage=`awaiting-connect`;return}if(!t.ok){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:t.message||`Login was cancelled.`}),this.stage=`awaiting-connect`;return}if(t.model)try{this.deps.setSelectedModel(b(e.provider,t.model))}catch(e){v.warn(`setSelectedModel after OAuth failed`,e)}try{this.deps.onAccountsChanged?.()}catch(e){v.warn(`onAccountsChanged threw`,e)}this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!0,kind:`ok`,note:t.message||`Logged in.`});let n=t.model&&this.deps.resolveModelLabel?.(e.provider,t.model)?this.deps.resolveModelLabel?.(e.provider,t.model):t.model??null;this.stage=`complete`,this.deps.fireFinalLick({action:`onboarding-complete-with-provider`,data:{profile:this.profile,provider:e.provider,model:t.model??null,modelLabel:n,validation:`oauth`}})}validateProviderRequiredFields(e,t,n){let r;try{r=this.deps.getProviderCatalogue().providers.find(t=>t.id===e)}catch(e){return v.warn(`getProviderCatalogue threw during required-field gate`,e),`Could not load provider requirements. Please try again.`}return r?.requiresDeployment&&!n?.trim()?`${r.name} requires a deployment name.`:r?.requiresBaseUrl&&!t?.trim()?`${r.name} requires a base URL.`:null}async persistProfile(e){let t=(e.name||`user`).toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/(^-+|-+$)/g,``)||`user`;await this.deps.fs.writeFile(`/home/${t}/.welcome.json`,JSON.stringify(e,null,2))}};function b(e,t){return t.startsWith(`${e}:`)?t:`${e}:${t}`}export{y as OnboardingOrchestrator};
1
+ import{t as e}from"./logger-DDBAeTLF.js";import{n as t}from"./welcome-detection-CQY88hjL.js";var n={openai:{url:e=>`${(e??`https://api.openai.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},anthropic:{url:e=>`${(e??`https://api.anthropic.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({"x-api-key":e,"anthropic-version":`2023-06-01`})},groq:{url:e=>`${(e??`https://api.groq.com/openai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},cerebras:{url:e=>`${(e??`https://api.cerebras.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},mistral:{url:e=>`${(e??`https://api.mistral.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},"x-ai":{url:e=>`${(e??`https://api.x.ai`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},deepseek:{url:e=>`${(e??`https://api.deepseek.com`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},openrouter:{url:e=>`${(e??`https://openrouter.ai/api`).replace(/\/$/,``)}/v1/models`,headers:e=>({Authorization:`Bearer ${e}`})},google:{url:e=>`${(e??`https://generativelanguage.googleapis.com`).replace(/\/$/,``)}/v1beta/models`,headers:()=>({})}};function r(e,t){if(e===401||e===403)return`Authentication failed — the key was rejected by the provider.`;if(e===404)return`Endpoint not found — check the base URL.`;if(e===429)return`Rate-limited — try again in a moment.`;if(e>=500)return`Provider returned a server error.`;let n=t.trim();return n?`${e}: ${n.slice(0,160)}`:`Provider responded with HTTP ${e}.`}async function i(e){let{provider:t,apiKey:i,baseUrl:a,signal:o}=e,s=e.fetchImpl??fetch,c=i.trim();if(!c)return{kind:`failed`,status:null,message:`API key is empty.`};let l=n[t];if(!l)return{kind:`skipped`,reason:`No live validation available for "${t}" — saving without testing.`};let u=l.url(a);if(t===`google`){let e=u.includes(`?`)?`&`:`?`;u=`${u}${e}key=${encodeURIComponent(c)}`}try{let e=await s(u,{method:`GET`,headers:l.headers(c),signal:o});if(e.ok)return{kind:`ok`};let t=``;try{t=await e.text()}catch{}return e.status===401||e.status,{kind:`failed`,status:e.status,message:r(e.status,t)}}catch(e){if(e?.name===`AbortError`)throw e;return{kind:`skipped`,reason:`Couldn't reach the provider (${e instanceof Error?e.message:String(e)}). Saving without live test — you can retry from Settings.`}}}var a=[e=>`Nice to meet you, ${e}.`,e=>`Hello ${e} — glad you stopped by.`,e=>`Hey ${e}, welcome aboard.`,e=>`${e}! Pleasure to make your acquaintance.`],o=[`Nice to meet you, mysterious stranger — I'll respect the incognito.`,`Hello, anonymous traveler. You can always tell me your name later if you change your mind.`,`An unnamed visitor — intriguing. Whenever you'd like to introduce yourself, just say the word.`,`Hey there, ghost — happy to keep things first-name-optional. The door's always open if you decide to drop the cloak.`],s={work:[`Work mode — let's make today productive.`,`On the clock? Same. Let's chip away at it.`],school:[`School business — I love a good study session.`,`Hitting the books? Glad to ride along.`],personal:[`Personal project energy is the best kind.`,`Tinkering for yourself is how the good stuff happens.`],"side-project":[`Side projects keep the lights on creatively.`,`Two-job life — respect.`],exploring:[`Just poking around? Excellent. The best discoveries start there.`,`Exploration mode — no agenda, no pressure.`]},c={developer:[`I can write code, run shell commands, drive a real browser, and ship pages.`,`Code, terminals, browsers, repos — I live in all of them.`],designer:[`I can prototype layouts, generate assets, and walk page editors with you.`,`Pixels, components, screenshots — design ops are my jam.`],"content-creator":[`I can draft copy, edit, scrape references, and stitch publish-ready pages.`,`Words, structure, SEO, polish — say the topic and I'll get moving.`],marketer:[`I can audit funnels, scrape competitors, and stand up landing pages quickly.`,`Campaigns, analytics, creatives — plug me in and I'll go.`],"product-pm":[`I can summarise research, draft specs, and crunch competitive intel.`,`Briefs, roadmaps, comparisons — I take the boring half off your plate.`],founder:[`I can prototype landing pages, automate ops, and prep investor decks.`,`Idea → MVP → repeat. I'll do the legwork between coffee refills.`],student:[`I can read papers with you, draft notes, and turn lectures into outlines.`,`Studying together makes it bearable — let me handle the busywork.`],researcher:[`I can scrape sources, summarise findings, and keep a running bibliography.`,`Lit reviews, datasets, write-ups — I'm all in.`],other:[`I'm flexible — give me a task and I'll figure out the right tools.`,`Whatever the role, I can probably help. Tell me what's on the docket.`]},l=[`I can browse the web, run commands, write code, and automate the boring parts.`,`I'm comfortable with terminals, browsers, files, and a long backlog of skills.`],u=[`But to be honest, I'm not really an AI yet — I'm an empty shell. You'll need to help me become intelligent. Pick a model and I'll wake up:`,`Confession time: I can't actually think yet. Wire me up to an LLM and I'll start earning my keep:`,`Plot twist — there's no brain in here. Choose a provider so I can do more than read this script:`,`Truthfully? I'm a very polite placeholder until you give me a model. Help me out:`];function d(e,t){return e[Math.floor(t()*e.length)%e.length]}function f(e){return e.replace(/-/g,` `)}function p(e){if(e.length===0)return``;if(e.length===1)return e[0];if(e.length===2)return`${e[0]} and ${e[1]}`;let t=e[e.length-1];return`${e.slice(0,-1).join(`, `)}, and ${t}`}function m(e,t=Math.random){let n=(e.name||``).trim(),r=e.purpose?s[e.purpose]:void 0;return n?`${d(a,t)(n)}${r?` ${d(r,t)}`:``}`:`${d(o,t)}${r?` ${d(r,t)}`:``}`}function h(e,t=Math.random){let n=e.role&&c[e.role]?e.role:``,r=d(n?c[n]:l,t),i=(e.tasks??[]).slice(0,3).map(f);return`I'm sliccy. ${r}${i.length>0?` Especially handy for ${p(i)}.`:``} I'm an AI agent.`}function g(e,t=Math.random){return d(u,t)}function _(e,t=Math.random){return[m(e,t),h(e,t),g(e,t)]}var v=e(`onboarding-orchestrator`),y=class{deps;stage=`idle`;profile={};constructor(e){this.deps=e}getStage(){return this.stage}getProfile(){return{...this.profile}}handleFirstRun(){this.stage===`idle`&&(this.stage=`collect-profile`,this.deps.postDipReference(`Welcome to SLICC — let's get you set up.`),this.deps.postDipReference(`![Welcome](/shared/sprinkles/welcome/welcome.shtml)`))}async handleOnboardingComplete(e){if(this.stage!==`idle`&&this.stage!==`collect-profile`)return v.debug(`Ignoring duplicate onboarding-complete`,{stage:this.stage}),!0;this.profile=e??{},this.stage=`awaiting-connect`,t(this.deps.fs).catch(e=>v.warn(`recordWelcomed failed`,e)),this.persistProfile(this.profile).catch(e=>v.warn(`persistProfile failed`,e));let n=_(this.profile,this.deps.rand);for(let e of n)this.deps.postSystemMessage(e);return this.deps.postDipReference(`![Connect a model](/shared/sprinkles/welcome/connect-llm.shtml)`),!0}handleConnectReady(){if(this.stage===`complete`)return;let e=this.deps.getProviderCatalogue();this.deps.broadcastToDip({type:`slicc-providers`,providers:e.providers,models:e.models})}async handleConnectAttempt(e){if(this.stage===`complete`)return;this.stage=`connecting`;let{provider:t,apiKey:n,baseUrl:r,deployment:a,apiVersion:o,model:s}=e;if(!t||typeof n!=`string`||!n.trim()){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Provider and API key are required.`}),this.stage=`awaiting-connect`;return}let c=this.validateProviderRequiredFields(t,r,a);if(c){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:c}),this.stage=`awaiting-connect`;return}let l;try{l=await i({provider:t,apiKey:n.trim(),baseUrl:r??void 0,fetchImpl:this.deps.fetchImpl})}catch(e){v.warn(`validateApiKey threw`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Validation request was aborted.`}),this.stage=`awaiting-connect`;return}if(l.kind===`failed`){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:l.message}),this.stage=`awaiting-connect`;return}let u=s||null;if(!u)try{let e=this.deps.getProviderCatalogue().models?.[t]?.[0]?.id;e&&(u=e)}catch(e){v.warn(`Failed to resolve fallback model for provider`,{provider:t,err:e})}try{this.deps.saveAccount(t,n.trim(),r?.trim()||void 0,a?.trim()||void 0,o?.trim()||void 0),u&&this.deps.setSelectedModel(b(t,u))}catch(e){v.warn(`saveAccount failed`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`Failed to save credentials locally.`}),this.stage=`awaiting-connect`;return}try{this.deps.onAccountsChanged?.()}catch(e){v.warn(`onAccountsChanged threw`,e)}let d=l.kind===`skipped`?`Saved — ${l.reason}`:`Validated against the provider. Ready when you are.`;this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!0,kind:l.kind,note:d});let f=u&&this.deps.resolveModelLabel?.(t,u)?this.deps.resolveModelLabel?.(t,u):u||null;this.stage=`complete`,this.deps.fireFinalLick({action:`onboarding-complete-with-provider`,data:{profile:this.profile,provider:t,model:u??null,modelLabel:f,validation:l.kind}})}async handleOAuthAttempt(e){if(this.stage===`complete`)return;if(!this.deps.launchOAuth){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:`OAuth login is not available in this runtime.`});return}this.stage=`connecting`;let t;try{t=await this.deps.launchOAuth(e.provider,e.baseUrl??null)}catch(e){v.warn(`launchOAuth threw`,e),this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:e instanceof Error?e.message:`Login was cancelled.`}),this.stage=`awaiting-connect`;return}if(!t.ok){this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!1,kind:`failed`,message:t.message||`Login was cancelled.`}),this.stage=`awaiting-connect`;return}if(t.model)try{this.deps.setSelectedModel(b(e.provider,t.model))}catch(e){v.warn(`setSelectedModel after OAuth failed`,e)}try{this.deps.onAccountsChanged?.()}catch(e){v.warn(`onAccountsChanged threw`,e)}this.deps.broadcastToDip({type:`slicc-connect-result`,ok:!0,kind:`ok`,note:t.message||`Logged in.`});let n=t.model&&this.deps.resolveModelLabel?.(e.provider,t.model)?this.deps.resolveModelLabel?.(e.provider,t.model):t.model??null;this.stage=`complete`,this.deps.fireFinalLick({action:`onboarding-complete-with-provider`,data:{profile:this.profile,provider:e.provider,model:t.model??null,modelLabel:n,validation:`oauth`}})}validateProviderRequiredFields(e,t,n){let r;try{r=this.deps.getProviderCatalogue().providers.find(t=>t.id===e)}catch(e){return v.warn(`getProviderCatalogue threw during required-field gate`,e),`Could not load provider requirements. Please try again.`}return r?.requiresDeployment&&!n?.trim()?`${r.name} requires a deployment name.`:r?.requiresBaseUrl&&!t?.trim()?`${r.name} requires a base URL.`:null}async persistProfile(e){let t=(e.name||`user`).toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/(^-+|-+$)/g,``)||`user`;await this.deps.fs.writeFile(`/home/${t}/.welcome.json`,JSON.stringify(e,null,2))}};function b(e,t){return t.startsWith(`${e}:`)?t:`${e}:${t}`}export{y as OnboardingOrchestrator};