sliccy 6.181.0 → 6.182.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 (175) hide show
  1. package/dist/ui/.vite/manifest.json +188 -188
  2. package/dist/ui/assets/__vite-browser-external-CJkRLpJ-.js +1 -0
  3. package/dist/ui/assets/{account-store-J3ybiSNw.js → account-store-BxB3138q.js} +1 -1
  4. package/dist/ui/assets/{account-store-0RMtbmqz.js → account-store-UA_3Tz4g.js} +1 -1
  5. package/dist/ui/assets/{adobe-YOeKKYUk.js → adobe-C5iQ4vVx.js} +1 -1
  6. package/dist/ui/assets/{adobe-DEXpooxf.js → adobe-CGl3cGPR.js} +1 -1
  7. package/dist/ui/assets/{agent-panels-B4hlhzVG.js → agent-panels-DfmjvBS2.js} +1 -1
  8. package/dist/ui/assets/{almost-bash-shell-headless-BR1Hr6tM.js → almost-bash-shell-headless-l1xuiFhc.js} +36 -36
  9. package/dist/ui/assets/{apply-layout-BgFVMSBx.js → apply-layout-Bq6bvrT2.js} +1 -1
  10. package/dist/ui/assets/{apps-oyrUmtWx.js → apps-BX-IbYH9.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-Ytc_MWDd.js → azure-openai-BXvWNypo.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-B6qTFVGv.js → azure-openai-C2dDMpxW.js} +1 -1
  13. package/dist/ui/assets/{backend-hostfs-CEXlx0cW.js → backend-hostfs-DV8kfBUj.js} +1 -1
  14. package/dist/ui/assets/{browser-DG5MjvHF.js → browser-BM_DFzrh.js} +2 -2
  15. package/dist/ui/assets/{bsh-watchdog-DBtF-C4h.js → bsh-watchdog-CmaS7wa9.js} +1 -1
  16. package/dist/ui/assets/{cdp-DVWJozRc.js → cdp-B0aSo4ch.js} +1 -1
  17. package/dist/ui/assets/{cerebras-brHRFUH2.js → cerebras-B2SDJ5pX.js} +1 -1
  18. package/dist/ui/assets/{cerebras-BT44OLPt.js → cerebras-D29ytBVb.js} +1 -1
  19. package/dist/ui/assets/{composer-speech-BZQtz7u1.js → composer-speech-Dt-gM11M.js} +1 -1
  20. package/dist/ui/assets/{connect-surface-D7cq2QI7.js → connect-surface-Cb3XqWWR.js} +1 -1
  21. package/dist/ui/assets/{core-aQUekdF7.js → core-CDo7qjEn.js} +1 -1
  22. package/dist/ui/assets/{cost-command-DZQVtgRS.js → cost-command-CitGzr6C.js} +1 -1
  23. package/dist/ui/assets/{directed-approval-DvAxEX5J.js → directed-approval-BEel8QYA.js} +1 -1
  24. package/dist/ui/assets/{emscripten-vfs-hook-agmT6Hsz.js → emscripten-vfs-hook-bNKkM3Zb.js} +1 -1
  25. package/dist/ui/assets/{ensure-speech-assets-CQ05z2Xw.js → ensure-speech-assets-DnCun_bM.js} +1 -1
  26. package/dist/ui/assets/{esbuild-wasm-DS_YG2EY.js → esbuild-wasm-CeZYVyQ9.js} +1 -1
  27. package/dist/ui/assets/{ffmpeg-wasm-B77gfnB_.js → ffmpeg-wasm-CV1BmGNS.js} +1 -1
  28. package/dist/ui/assets/{frozen-archive-writer-qxZ9jGOV.js → frozen-archive-writer-DWckLPIx.js} +1 -1
  29. package/dist/ui/assets/{fs-Dkh-H6Cd.js → fs-Bl1dGTw7.js} +2 -2
  30. package/dist/ui/assets/{fs-D6FCLu_F.js → fs-Bvj_6WV6.js} +1 -1
  31. package/dist/ui/assets/{gelatiere-store-ChogqkEu.js → gelatiere-store-CslswlOn.js} +1 -1
  32. package/dist/ui/assets/{gelatiere-unit-DxFUh33e.js → gelatiere-unit-DOffAKPD.js} +1 -1
  33. package/dist/ui/assets/{github-D31l6kcK.js → github-DRuWNJ0x.js} +2 -2
  34. package/dist/ui/assets/{github-CrHzeKQ8.js → github-DVquHzS1.js} +1 -1
  35. package/dist/ui/assets/{github-auth-VTbKhlbJ.js → github-auth-C5UPE82y.js} +1 -1
  36. package/dist/ui/assets/{github-copilot-eUb4Djg_.js → github-copilot-DXbnFsoC.js} +1 -1
  37. package/dist/ui/assets/{github-copilot-CVwHDKPD.js → github-copilot-ha5V9jKJ.js} +1 -1
  38. package/dist/ui/assets/{github-install-Dkt1u6HU.js → github-install-z8nzKR56.js} +1 -1
  39. package/dist/ui/assets/{github-zip-B6gHXxqd.js → github-zip-YeBT3Ny7.js} +1 -1
  40. package/dist/ui/assets/{guest-tool-gate-YxkVsl15.js → guest-tool-gate-Dn4Cs-oT.js} +1 -1
  41. package/dist/ui/assets/{hear-BKQjhhNP.js → hear-ClByyjXy.js} +1 -1
  42. package/dist/ui/assets/{help-C7WHd3Ia.js → help-p6vq-7bY.js} +1 -1
  43. package/dist/ui/assets/{host-command-ODKvqvjN.js → host-command-PUA7nfMk.js} +1 -1
  44. package/dist/ui/assets/{installer-D35TzRKw.js → installer-hyWN7t-8.js} +1 -1
  45. package/dist/ui/assets/{interrupted-work-recovery-BK9ZDM7F.js → interrupted-work-recovery-C3eyzaf0.js} +1 -1
  46. package/dist/ui/assets/js-realm-worker-C8L3DYxo.js +53 -0
  47. package/dist/ui/assets/jsh-executor-BRw7B4H0.js +18 -0
  48. package/dist/ui/assets/{kernel-worker-UUfeG-Eg.js → kernel-worker-DJ8FZwqE.js} +9 -9
  49. package/dist/ui/assets/{lick-ws-bridge-DoyPgrSr.js → lick-ws-bridge-AHYpxmrH.js} +1 -1
  50. package/dist/ui/assets/{lick-ws-bridge-DdgwrW91.js → lick-ws-bridge-DjxKrqtY.js} +1 -1
  51. package/dist/ui/assets/{live-session-curation-6O9TA5qM.js → live-session-curation-ChbHqCg_.js} +1 -1
  52. package/dist/ui/assets/{live-session-snapshot-D_7T7FHe.js → live-session-snapshot-CEM9afjE.js} +1 -1
  53. package/dist/ui/assets/{local-llm-BYaSa2xI.js → local-llm-3Pq3W9JZ.js} +1 -1
  54. package/dist/ui/assets/{local-llm-TK4oGrWD.js → local-llm-DSfR5Yt1.js} +1 -1
  55. package/dist/ui/assets/{magick-wasm-DCNZhAyd.js → magick-wasm-KFp97Nzb.js} +1 -1
  56. package/dist/ui/assets/{main-Bgkf5d3Z.js → main-DtPQfxOa.js} +3 -3
  57. package/dist/ui/assets/{main-cherry-BUdIAeG5.js → main-cherry-GQeDS2ns.js} +1 -1
  58. package/dist/ui/assets/{memory-curation-seam-CNOuxuz4.js → memory-curation-seam-COOFWWtR.js} +1 -1
  59. package/dist/ui/assets/{memory-health-BSo0HKQx.js → memory-health-DxPjxnOp.js} +1 -1
  60. package/dist/ui/assets/{memory-write-execute-mQfg-aG4.js → memory-write-execute-CRxpEM2X.js} +1 -1
  61. package/dist/ui/assets/{mount-h-dwh5GL.js → mount-9N6h5nwh.js} +3 -3
  62. package/dist/ui/assets/{mount-BpcQX-Sq.js → mount-Dkwa5rwA.js} +1 -1
  63. package/dist/ui/assets/{new-session-CTx7YRbr.js → new-session-C2Unp_ay.js} +2 -2
  64. package/dist/ui/assets/{oauth-bootstrap-B18nfDG4.js → oauth-bootstrap-3r1LKeNV.js} +2 -2
  65. package/dist/ui/assets/{onboarding-orchestrator-Df3UDgbD.js → onboarding-orchestrator-DagKmKCB.js} +1 -1
  66. package/dist/ui/assets/{openai-codex-Cu1dT_JE.js → openai-codex--tiTbtXj.js} +1 -1
  67. package/dist/ui/assets/{openai-codex-DBUtEEk3.js → openai-codex-CJC7uwBp.js} +1 -1
  68. package/dist/ui/assets/{openrouter-BwrZKpwu.js → openrouter-aXBsdtFI.js} +1 -1
  69. package/dist/ui/assets/{openrouter-free-B_LRYNX8.js → openrouter-free-BeCg7Ecw.js} +1 -1
  70. package/dist/ui/assets/{openrouter-free-CXqUunRn.js → openrouter-free-DqFFRvst.js} +1 -1
  71. package/dist/ui/assets/{openrouter-CrB0BbnV.js → openrouter-mBY_6dIp.js} +1 -1
  72. package/dist/ui/assets/{openrouter-oauth-Bnohq7Ac.js → openrouter-oauth-C7CZ9fp_.js} +1 -1
  73. package/dist/ui/assets/{openrouter-oauth-Bpzo9cvY.js → openrouter-oauth-DQIC6b5R.js} +1 -1
  74. package/dist/ui/assets/{opfs-mount-CmDtZOGy.js → opfs-mount-tiZR34GY.js} +1 -1
  75. package/dist/ui/assets/{panel-rpc-handlers-BFG-ZvfW.js → panel-rpc-handlers-D8NOrxvf.js} +2 -2
  76. package/dist/ui/assets/{panelize-shell-CLHSr5bz.js → panelize-shell-C_Xs3rhf.js} +1 -1
  77. package/dist/ui/assets/{pi-edit-execution-wHbJ4R48.js → pi-edit-execution-kItlGFSm.js} +1 -1
  78. package/dist/ui/assets/{provider-BXK9OD8Z.js → provider-BtTOwLci.js} +2 -2
  79. package/dist/ui/assets/{provider-DyqdvQeZ.js → provider-DuCd6_sr.js} +1 -1
  80. package/dist/ui/assets/{provider-settings-BO6Fedc5.js → provider-settings-PedRbxpK.js} +1 -1
  81. package/dist/ui/assets/provider-store-access-BbD8NSzf.js +1 -0
  82. package/dist/ui/assets/provider-store-access-BvzkUnma.js +1 -0
  83. package/dist/ui/assets/{providers-BvApGkM9.js → providers-BkwBVwkB.js} +2 -2
  84. package/dist/ui/assets/{providers-CAcycJZb.js → providers-CWFcdblf.js} +1 -1
  85. package/dist/ui/assets/{py-live-vfs-Di71Rd2P.js → py-live-vfs-DMc0LhCg.js} +12 -0
  86. package/dist/ui/assets/{py-live-vfs-CJWt_6ye.js → py-live-vfs-Dm8bBjqR.js} +12 -0
  87. package/dist/ui/assets/py-realm-worker-BaO89JAR.js +255 -0
  88. package/dist/ui/assets/{pyodide-W71AWfnt.js → pyodide-DY17DXNV.js} +2 -2
  89. package/dist/ui/assets/{quick-llm-BENSRBxD.js → quick-llm-DKsocfis.js} +1 -1
  90. package/dist/ui/assets/realm-inprocess-CI_Msk8I.js +33 -0
  91. package/dist/ui/assets/{recovery-screen-Tq3wGnmV.js → recovery-screen-HGByYfVb.js} +1 -1
  92. package/dist/ui/assets/{remote-terminal-view-C8LiE7Sl.js → remote-terminal-view-C6Ao0U4O.js} +1 -1
  93. package/dist/ui/assets/{require-guards-DPd9EYEo.js → require-guards-DPf5QETL.js} +14 -3
  94. package/dist/ui/assets/{restore-DVP0SPlY.js → restore-BsViTTTd.js} +1 -1
  95. package/dist/ui/assets/{run-zLr2k5ZP.js → run-BEHokdPX.js} +1 -1
  96. package/dist/ui/assets/{run-BGZP3j5p.js → run-BLi5_vwK.js} +1 -1
  97. package/dist/ui/assets/{run-CKp8YCSO.js → run-BOMvKGOX.js} +1 -1
  98. package/dist/ui/assets/{run-C-OJvA2b.js → run-BP0Pyqp1.js} +1 -1
  99. package/dist/ui/assets/{run-FyOp8GaC.js → run-C0CADtt5.js} +1 -1
  100. package/dist/ui/assets/{run-CX6BUmN-.js → run-C1e4W7pJ.js} +1 -1
  101. package/dist/ui/assets/{run-BV_OY-0v.js → run-CKI507uv.js} +1 -1
  102. package/dist/ui/assets/{run-BKItPKix.js → run-CKdymE5z.js} +3 -3
  103. package/dist/ui/assets/{run-CiUSMP3Y.js → run-DEBWO_VC.js} +2 -2
  104. package/dist/ui/assets/{run-CPT6_R-_.js → run-DgblerTV.js} +2 -2
  105. package/dist/ui/assets/{screencapture-run-BnyfqO9F.js → screencapture-run-Dt7lEfIp.js} +1 -1
  106. package/dist/ui/assets/{session-command-memory-HovmIuMP.js → session-command-memory-D-p81a7P.js} +2 -2
  107. package/dist/ui/assets/{session-jsonl-DK-0Hm8U.js → session-jsonl-C-BZSOHy.js} +1 -1
  108. package/dist/ui/assets/{session-jsonl-PCOch0_B.js → session-jsonl-CXY4TQ4Y.js} +1 -1
  109. package/dist/ui/assets/{session-search-index-BNvhiRLv.js → session-search-index-nhvgyuxV.js} +1 -1
  110. package/dist/ui/assets/{setup-feature-flags-remote-2RQqEGaT.js → setup-feature-flags-remote-CpzgUHLB.js} +1 -1
  111. package/dist/ui/assets/{setup-model-catalog-B911rONc.js → setup-model-catalog-BGx3XYFY.js} +1 -1
  112. package/dist/ui/assets/shared-BDXQKitm.js +1 -0
  113. package/dist/ui/assets/shared-DfMXB1pm.js +4 -0
  114. package/dist/ui/assets/{signed-fetch-gB25Bw53.js → signed-fetch-t5uBcIk_.js} +1 -1
  115. package/dist/ui/assets/{silent-renew-backoff-Brcr76an.js → silent-renew-backoff-Q1A_jbQH.js} +1 -1
  116. package/dist/ui/assets/slicc-version-YnqCI9lq.js +1 -0
  117. package/dist/ui/assets/{snapshot-Ci8jnY_A.js → snapshot-Bb3mZrhI.js} +1 -1
  118. package/dist/ui/assets/{snapshot-features-BYEGCVfZ.js → snapshot-features-D44t7iA7.js} +1 -1
  119. package/dist/ui/assets/{soundscape-CdQvLeB0.js → soundscape-CUzGNWGR.js} +1 -1
  120. package/dist/ui/assets/{speak-BT4Xdlvj.js → speak-B-rF7cd2.js} +1 -1
  121. package/dist/ui/assets/{sprinkle-manager-8T1XJmL3.js → sprinkle-manager-BWdoEwv2.js} +1 -1
  122. package/dist/ui/assets/{sprinkle-renderer-_vOdPt8H.js → sprinkle-renderer-B-1HSkrF.js} +16 -16
  123. package/dist/ui/assets/{ssh-BGtVaOJn.js → ssh-DGBxesfZ.js} +1 -1
  124. package/dist/ui/assets/{state-nnDajRje.js → state-B7Ano9ql.js} +1 -1
  125. package/dist/ui/assets/{store-BxxMrsS7.js → store-B3uS3nQU.js} +1 -1
  126. package/dist/ui/assets/{store-D9XL9aIQ.js → store-DTMATE-h.js} +1 -1
  127. package/dist/ui/assets/{sudo-CnXURhFV.js → sudo-D8OGZd6t.js} +1 -1
  128. package/dist/ui/assets/{supervisor-fOZGoD0G.js → supervisor-Ck1Ryx2i.js} +1 -1
  129. package/dist/ui/assets/{sync-dialog-oh_O9Mv5.js → sync-dialog-C2TF9Y3h.js} +1 -1
  130. package/dist/ui/assets/{transformers-env-zmBF2In6.js → transformers-env-h8uZoLwJ.js} +1 -1
  131. package/dist/ui/assets/{tray-leader-Co-1rs4b.js → tray-leader-BHyMCdCH.js} +1 -1
  132. package/dist/ui/assets/{tray-leave-runtime-PpRt0K76.js → tray-leave-runtime-DR6t2Cuo.js} +1 -1
  133. package/dist/ui/assets/{tray-sidecar-DYuM8Ifi.js → tray-sidecar-BdEGdpUe.js} +1 -1
  134. package/dist/ui/assets/{turn-journal-_Hrn3Aoy.js → turn-journal-B4vV4fDV.js} +1 -1
  135. package/dist/ui/assets/{upgrade-detection-jhAzOLSL.js → upgrade-detection-BXyDgjYd.js} +1 -1
  136. package/dist/ui/assets/{upskill-lick-skip-D1vFOKgN.js → upskill-lick-skip-8Ozx8QGg.js} +1 -1
  137. package/dist/ui/assets/{voice-reply--Z1dXvPT.js → voice-reply-ChDAb3Rf.js} +1 -1
  138. package/dist/ui/assets/{wc-attach-BadBFuc7.js → wc-attach-BN8rykoa.js} +2 -2
  139. package/dist/ui/assets/{wc-browser-DqUJaWcH.js → wc-browser-z1N3wGuK.js} +1 -1
  140. package/dist/ui/assets/{wc-computers-CTPf-95b.js → wc-computers-C1g9iCUj.js} +1 -1
  141. package/dist/ui/assets/{wc-detached-UIVnUZp5.js → wc-detached-DHD--8Tf.js} +1 -1
  142. package/dist/ui/assets/{wc-extension-Bxc7adS3.js → wc-extension-qof5b3tN.js} +2 -2
  143. package/dist/ui/assets/{wc-follower-oauth-DEBzlhDR.js → wc-follower-oauth-Bsskcjc7.js} +1 -1
  144. package/dist/ui/assets/{wc-follower-CcQiy0Ep.js → wc-follower-sKXDjyv-.js} +3 -3
  145. package/dist/ui/assets/{wc-gelatiere-B3T_MsYw.js → wc-gelatiere-D_uq7S-T.js} +1 -1
  146. package/dist/ui/assets/{wc-live-B4gJYGS5.js → wc-live-DWEUEDdK.js} +5 -5
  147. package/dist/ui/assets/{wc-nav-Cc31eRBb.js → wc-nav-DqIdooNV.js} +2 -2
  148. package/dist/ui/assets/{wc-onboarding-A_43Ieo4.js → wc-onboarding-38WwDwrA.js} +2 -2
  149. package/dist/ui/assets/{wc-permissions-C9woviuI.js → wc-permissions-o70pdgUK.js} +2 -2
  150. package/dist/ui/assets/{wc-placeholder-t7YMeS_j.js → wc-placeholder-DMKTZY8P.js} +3 -3
  151. package/dist/ui/assets/{wc-secret-request-Dfm9QvyE.js → wc-secret-request-CmpDh1Bs.js} +1 -1
  152. package/dist/ui/assets/{wc-settings-BD6JONjg.js → wc-settings-7DxLA_ig.js} +3 -3
  153. package/dist/ui/assets/{wc-shell-Ba5uNdmF.js → wc-shell-DFszC8_0.js} +3 -3
  154. package/dist/ui/assets/{wc-shortcut-config-DeU2Q2BU.js → wc-shortcut-config-Co6ONiUg.js} +1 -1
  155. package/dist/ui/assets/{wc-sprinkles-D4sQVRG5.js → wc-sprinkles-zxKMU9ju.js} +2 -2
  156. package/dist/ui/assets/{wc-transcript-export-CsUhlwMo.js → wc-transcript-export-BnOv-hzh.js} +2 -2
  157. package/dist/ui/assets/{wc-tray-CwvVidS8.js → wc-tray-B2w3dtCQ.js} +4 -4
  158. package/dist/ui/assets/welcome-detection-Cik05qcd.js +1 -0
  159. package/dist/ui/assets/{whisper-session-MB0YiZ0q.js → whisper-session-BB92W1rY.js} +2 -2
  160. package/dist/ui/assets/{xai-grok-0BxCS34q.js → xai-grok-Btqu459a.js} +1 -1
  161. package/dist/ui/assets/{xai-grok-rwJAZiuv.js → xai-grok-DsDg76ef.js} +1 -1
  162. package/dist/ui/index.html +3 -3
  163. package/dist/ui/packages/webapp/index.html +3 -3
  164. package/package.json +1 -1
  165. package/dist/ui/assets/__vite-browser-external-BlQ4QU88.js +0 -1
  166. package/dist/ui/assets/js-realm-worker-BIVxi3Fa.js +0 -50
  167. package/dist/ui/assets/jsh-executor-DhdH2_yG.js +0 -18
  168. package/dist/ui/assets/provider-store-access-BFeKOGcv.js +0 -1
  169. package/dist/ui/assets/provider-store-access-C2X0AryS.js +0 -1
  170. package/dist/ui/assets/py-realm-worker-DLb3nkyD.js +0 -244
  171. package/dist/ui/assets/realm-inprocess-BBw2Fa8u.js +0 -30
  172. package/dist/ui/assets/shared-C_68vn79.js +0 -4
  173. package/dist/ui/assets/shared-mBEktoxE.js +0 -1
  174. package/dist/ui/assets/slicc-version-CAje2bW-.js +0 -1
  175. package/dist/ui/assets/welcome-detection-CIDbn0ev.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./fetch-body-CuwTaJC_.js";import{a as n}from"./types-Dzr0qYl3.js";import{a as r,c as i,l as a,o,r as s,s as c,t as l,u}from"./github-zip-B6gHXxqd.js";import{i as d,o as f,r as p}from"./provenance-DdmsQ3Nr.js";async function m(){try{let e=(typeof window<`u`?window:globalThis).__slicc_reloadSkills;if(typeof e==`function`){await e();return}typeof chrome<`u`&&chrome?.runtime?.sendMessage&&chrome.runtime.sendMessage({source:`panel`,payload:{type:`reload-skills`}})}catch{}}async function h(){try{let e=globalThis.__slicc_sprinkleManager;typeof e?.openNewAutoOpenSprinkles==`function`&&await e.openNewAutoOpenSprinkles()}catch{}}async function g(){await h(),await m()}async function _(e,t,r,o,s=!1,c){let l=`${n}/${t}`,d=!1;try{if(await o.stat(l),!s)return{ok:!1,error:`skill "${t}" already exists (use --force to overwrite)`};d=!0,await u(o,l,await v(o,t))}catch{}let p=e.replace(/^\/|\/$/g,``),m=p?p+`/`:``;await o.mkdir(l,{recursive:!0});let h=0,g=[];try{for(let[e,t]of Object.entries(r)){if(!e.startsWith(m))continue;let n=e.slice(m.length);if(!n||e.endsWith(`/`)||!await a(o,l,n)||!i(n))continue;let r=`${l}/${n}`,s=r.substring(0,r.lastIndexOf(`/`));s!==l&&await o.mkdir(s,{recursive:!0}),await o.writeFile(r,t),g.push(n),h++}}catch(e){throw await y(o,l,d),e}return h===0?(await y(o,l,d),{ok:!1,error:`no files found for skill "${t}" in ZIP`}):(c&&await f(o,t,{...c,skill:t,files:g.sort()}),{ok:!0})}async function v(e,t){let n=await p(e,t);return n?.files?.length?new Set(n.files):void 0}async function y(e,t,n){if(n){await u(e,t).catch(()=>!1);return}await e.rm(t,{recursive:!0}).catch(()=>{})}var b=e({installFromGitHub:()=>w,listGitHubSkills:()=>S,parseGitHubRef:()=>T,parseGitHubUrl:()=>x});function x(e){let t=e.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);return t?{owner:t[1],repo:t[2].replace(/\.git$/,``)}:null}async function S(e,n,i,a,o,l){if(o){let t=await s(e,n,o,l);if(t.status===`ok`){let e=r(t.files),n=[],i=a?a.replace(/^\/|\/$/g,``)+`/`:``;for(let t of Object.keys(e))if(t.startsWith(i)&&(t.split(`/`).pop()||``)===`SKILL.md`){let e=t.replace(/\/SKILL\.md$/,``),r=e.split(`/`).pop()||e;n.push({name:r,path:e})}return{skills:n}}}let u=[];async function d(r){let a=`https://api.github.com/repos/${e}/${n}/contents/${r}`,o=l?`${a}?ref=${encodeURIComponent(l)}`:a,s=await i.request(o);if(s.status!==200)throw Error(c(s,`${e}/${n}${r?`/${r}`:``}`,i.hasToken));let f=t(s.body);for(let e of f)if(e.type===`file`&&e.name===`SKILL.md`){let t=e.path.replace(`/SKILL.md`,``),n=t.split(`/`).pop()||t;u.push({name:n,path:t})}else e.type===`dir`&&await d(e.path)}try{return await d(a||``),{skills:u}}catch(e){return{skills:[],error:e instanceof Error?e.message:String(e)}}}async function C(e,t,n,r,i,a,o,s){let c=await d(t,n,a,o,!0,r.replace(/^\/+|\/+$/g,``));await f(e,i,{kind:`github`,source:`${t}/${n}`,skill:i,ref:a,path:r.replace(/^\/|\/$/g,``),sha:c,files:s})}async function w(e,i,a,d,f,p,_=!1,b,x){let S=!1;try{let w=`${n}/${d}`;try{if(await f.stat(w),!_)return{stdout:``,stderr:`upskill: skill "${d}" already exists (use --force to overwrite)\n`,exitCode:1};S=!0,await u(f,w,await v(f,d))}catch{}if(b){let t=await s(e,i,b,x);if(t.status===`ok`){let n=r(t.files),s=a.replace(/^\/|\/$/g,``)+`/`;await f.mkdir(w,{recursive:!0});let c=await o(n,s,w,f);if(c.length>0)return await C(f,e,i,a,d,x,p,c),await h(),await m(),{stdout:`Installed skill "${d}" from ${e}/${i}\n`,stderr:``,exitCode:0}}}let T=`https://api.github.com/repos/${e}/${i}/contents/${a}`,E=x?`${T}?ref=${encodeURIComponent(x)}`:T,D=await p.request(E);if(D.status!==200)return{stdout:``,stderr:`upskill: ${c(D,`${e}/${i}/${a}`,p.hasToken)}\n`,exitCode:1};let O=t(D.body);await f.mkdir(w,{recursive:!0});let k;try{k=await l(O,w,e,i,x,f,p)}catch(e){throw await y(f,w,S),e}return await C(f,e,i,a,d,x,p,k),await g(),{stdout:`Installed skill "${d}" from ${e}/${i}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`upskill: failed to install from GitHub: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function T(e){let t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/tree\/([^/]+?)(?:\/(.+?))?)?\/?$/);if(t)return{owner:t[1],repo:t[2],branch:t[3],path:t[4]};let n=e.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:@([a-zA-Z0-9_./-]+))?$/);return n?{owner:n[1],repo:n[2],branch:n[3]}:null}export{x as a,g as c,T as i,w as n,_ as o,S as r,v as s,b as t};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./fetch-body-CuwTaJC_.js";import{a as n}from"./types-Dzr0qYl3.js";import{a as r,c as i,l as a,o,r as s,s as c,t as l,u}from"./github-zip-YeBT3Ny7.js";import{i as d,o as f,r as p}from"./provenance-DdmsQ3Nr.js";async function m(){try{let e=(typeof window<`u`?window:globalThis).__slicc_reloadSkills;if(typeof e==`function`){await e();return}typeof chrome<`u`&&chrome?.runtime?.sendMessage&&chrome.runtime.sendMessage({source:`panel`,payload:{type:`reload-skills`}})}catch{}}async function h(){try{let e=globalThis.__slicc_sprinkleManager;typeof e?.openNewAutoOpenSprinkles==`function`&&await e.openNewAutoOpenSprinkles()}catch{}}async function g(){await h(),await m()}async function _(e,t,r,o,s=!1,c){let l=`${n}/${t}`,d=!1;try{if(await o.stat(l),!s)return{ok:!1,error:`skill "${t}" already exists (use --force to overwrite)`};d=!0,await u(o,l,await v(o,t))}catch{}let p=e.replace(/^\/|\/$/g,``),m=p?p+`/`:``;await o.mkdir(l,{recursive:!0});let h=0,g=[];try{for(let[e,t]of Object.entries(r)){if(!e.startsWith(m))continue;let n=e.slice(m.length);if(!n||e.endsWith(`/`)||!await a(o,l,n)||!i(n))continue;let r=`${l}/${n}`,s=r.substring(0,r.lastIndexOf(`/`));s!==l&&await o.mkdir(s,{recursive:!0}),await o.writeFile(r,t),g.push(n),h++}}catch(e){throw await y(o,l,d),e}return h===0?(await y(o,l,d),{ok:!1,error:`no files found for skill "${t}" in ZIP`}):(c&&await f(o,t,{...c,skill:t,files:g.sort()}),{ok:!0})}async function v(e,t){let n=await p(e,t);return n?.files?.length?new Set(n.files):void 0}async function y(e,t,n){if(n){await u(e,t).catch(()=>!1);return}await e.rm(t,{recursive:!0}).catch(()=>{})}var b=e({installFromGitHub:()=>w,listGitHubSkills:()=>S,parseGitHubRef:()=>T,parseGitHubUrl:()=>x});function x(e){let t=e.match(/github\.com\/([^/?#]+)\/([^/?#]+)/);return t?{owner:t[1],repo:t[2].replace(/\.git$/,``)}:null}async function S(e,n,i,a,o,l){if(o){let t=await s(e,n,o,l);if(t.status===`ok`){let e=r(t.files),n=[],i=a?a.replace(/^\/|\/$/g,``)+`/`:``;for(let t of Object.keys(e))if(t.startsWith(i)&&(t.split(`/`).pop()||``)===`SKILL.md`){let e=t.replace(/\/SKILL\.md$/,``),r=e.split(`/`).pop()||e;n.push({name:r,path:e})}return{skills:n}}}let u=[];async function d(r){let a=`https://api.github.com/repos/${e}/${n}/contents/${r}`,o=l?`${a}?ref=${encodeURIComponent(l)}`:a,s=await i.request(o);if(s.status!==200)throw Error(c(s,`${e}/${n}${r?`/${r}`:``}`,i.hasToken));let f=t(s.body);for(let e of f)if(e.type===`file`&&e.name===`SKILL.md`){let t=e.path.replace(`/SKILL.md`,``),n=t.split(`/`).pop()||t;u.push({name:n,path:t})}else e.type===`dir`&&await d(e.path)}try{return await d(a||``),{skills:u}}catch(e){return{skills:[],error:e instanceof Error?e.message:String(e)}}}async function C(e,t,n,r,i,a,o,s){let c=await d(t,n,a,o,!0,r.replace(/^\/+|\/+$/g,``));await f(e,i,{kind:`github`,source:`${t}/${n}`,skill:i,ref:a,path:r.replace(/^\/|\/$/g,``),sha:c,files:s})}async function w(e,i,a,d,f,p,_=!1,b,x){let S=!1;try{let w=`${n}/${d}`;try{if(await f.stat(w),!_)return{stdout:``,stderr:`upskill: skill "${d}" already exists (use --force to overwrite)\n`,exitCode:1};S=!0,await u(f,w,await v(f,d))}catch{}if(b){let t=await s(e,i,b,x);if(t.status===`ok`){let n=r(t.files),s=a.replace(/^\/|\/$/g,``)+`/`;await f.mkdir(w,{recursive:!0});let c=await o(n,s,w,f);if(c.length>0)return await C(f,e,i,a,d,x,p,c),await h(),await m(),{stdout:`Installed skill "${d}" from ${e}/${i}\n`,stderr:``,exitCode:0}}}let T=`https://api.github.com/repos/${e}/${i}/contents/${a}`,E=x?`${T}?ref=${encodeURIComponent(x)}`:T,D=await p.request(E);if(D.status!==200)return{stdout:``,stderr:`upskill: ${c(D,`${e}/${i}/${a}`,p.hasToken)}\n`,exitCode:1};let O=t(D.body);await f.mkdir(w,{recursive:!0});let k;try{k=await l(O,w,e,i,x,f,p)}catch(e){throw await y(f,w,S),e}return await C(f,e,i,a,d,x,p,k),await g(),{stdout:`Installed skill "${d}" from ${e}/${i}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`upskill: failed to install from GitHub: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function T(e){let t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/tree\/([^/]+?)(?:\/(.+?))?)?\/?$/);if(t)return{owner:t[1],repo:t[2],branch:t[3],path:t[4]};let n=e.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:@([a-zA-Z0-9_./-]+))?$/);return n?{owner:n[1],repo:n[2],branch:n[3]}:null}export{x as a,g as c,T as i,w as n,_ as o,S as r,v as s,b as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{i as n,n as r,r as i}from"./fetch-body-CuwTaJC_.js";import{i as a}from"./browser-DuyhpHbR.js";import{i as o,n as s}from"./github-auth-VTbKhlbJ.js";function c(e){return e.split(`/`).some(e=>e.startsWith(`.`))}async function l(e,t,n){return!c(n)||!await e.exists(`${t}/${n}`)}async function u(e,t,n,r=``){let i;try{i=await e.readDir(t)}catch{return!1}let a=!1;for(let o of i){let i=`${t}/${o.name}`,s=r?`${r}/${o.name}`:o.name;if(o.name.startsWith(`.`)){a=!0;continue}o.type===`directory`?await u(e,i,n,s)?a=!0:await e.rm(i,{recursive:!0}):n&&!n.has(s)?a=!0:await e.rm(i)}return a}async function d(e,t,n=!1,r=``){let i;try{i=await e.readDir(t)}catch{return[]}let a=[];for(let o of i){if(!n&&o.name.startsWith(`.`))continue;let i=r?`${r}/${o.name}`:o.name;o.type===`directory`?a.push(...await d(e,`${t}/${o.name}`,n,i)):a.push(i)}return a.sort()}function f(e){return!e||e.startsWith(`/`)||e.includes(`\0`)||e.includes(`\\`)||/^[A-Za-z]:/.test(e)?!1:!e.split(`/`).some(e=>e===``||e===`.`||e===`..`)}function p(e){let t=r(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function m(e,t,n){let r=p(e.body),i=r?` GitHub said: ${r}`:``,a=s(e.headers,`retry-after`),o=s(e.headers,`x-ratelimit-remaining`),c=r?.toLowerCase()??``;if(e.status===429||o===`0`||c.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let l=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${l}).${i}`}var h=e({downloadGitHubDir:()=>b,fetchGitHubDirFiles:()=>y,fetchRepoZip:()=>g,stripZipPrefix:()=>_,writeZipFilesToDir:()=>v});async function g(e,n,r,s=`main`){let c=`https://codeload.github.com/${e}/${n}/zip/refs/heads/${s}`,l;try{l=await r(c,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:o(e,c)}}if(l.status===404)return s===`main`?g(e,n,r,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(l.status!==200)return{status:`error`,message:`codeload returned HTTP ${l.status}`};let u=t(c);u||=i(l.body);try{return{status:`ok`,files:a(u)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function _(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function v(e,t,n,r,i=!0){let a=[];for(let[o,s]of Object.entries(e)){if(!o.startsWith(t))continue;let e=o.slice(t.length);if(o.endsWith(`/`)||!f(e)||i&&!await l(r,n,e))continue;let c=`${n}/${e}`,u=c.substring(0,c.lastIndexOf(`/`));u!==n&&await r.mkdir(u,{recursive:!0}),await r.writeFile(c,s),a.push(e)}return a.sort()}async function y(e,r,a,o,s,c=new Map,l=``){let u=`https://api.github.com/repos/${e}/${r}/contents/${a}`,d=o?`${u}?ref=${encodeURIComponent(o)}`:u,p=await s.request(d);if(p.status!==200)throw Error(m(p,`${e}/${r}${a?`/${a}`:``}`,s.hasToken));for(let a of n(p.body)){let n=l?`${l}/${a.name}`:a.name;if(f(n)){if(a.type===`file`&&a.download_url){let o=await s.request(a.download_url,`*/*`);if(o.status!==200)throw Error(m(o,`${e}/${r}/${a.path}`,s.hasToken));let l=t(a.download_url);c.set(n,l??i(o.body))}else a.type===`dir`&&await y(e,r,a.path,o,s,c,n)}}return c}async function b(e,r,i,a,o,s,l,u=[],d=``){for(let p of e){let e=d?`${d}/${p.name}`:p.name;if(f(e)){if(p.type===`file`&&p.download_url){if(c(e)&&await s.exists(`${r}/${p.name}`))continue;let n=await l.request(p.download_url,`*/*`);if(n.status!==200)throw Error(m(n,`${i}/${a}/${p.path}`,l.hasToken));let o=t(p.download_url);await s.writeFile(`${r}/${p.name}`,o??n.body),u.push(e)}else if(p.type===`dir`){let t=`https://api.github.com/repos/${i}/${a}/contents/${p.path}`,c=o?`${t}?ref=${encodeURIComponent(o)}`:t,d=await l.request(c);if(d.status!==200)throw Error(m(d,`${i}/${a}/${p.path}`,l.hasToken));let f=n(d.body);await s.mkdir(`${r}/${p.name}`,{recursive:!0}),await b(f,`${r}/${p.name}`,i,a,o,s,l,u,e)}}}return u.sort()}export{_ as a,f as c,c as d,d as f,h as i,l,y as n,v as o,g as r,m as s,b as t,u};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{i as n,n as r,r as i}from"./fetch-body-CuwTaJC_.js";import{i as a}from"./browser-DuyhpHbR.js";import{i as o,n as s}from"./github-auth-C5UPE82y.js";function c(e){return e.split(`/`).some(e=>e.startsWith(`.`))}async function l(e,t,n){return!c(n)||!await e.exists(`${t}/${n}`)}async function u(e,t,n,r=``){let i;try{i=await e.readDir(t)}catch{return!1}let a=!1;for(let o of i){let i=`${t}/${o.name}`,s=r?`${r}/${o.name}`:o.name;if(o.name.startsWith(`.`)){a=!0;continue}o.type===`directory`?await u(e,i,n,s)?a=!0:await e.rm(i,{recursive:!0}):n&&!n.has(s)?a=!0:await e.rm(i)}return a}async function d(e,t,n=!1,r=``){let i;try{i=await e.readDir(t)}catch{return[]}let a=[];for(let o of i){if(!n&&o.name.startsWith(`.`))continue;let i=r?`${r}/${o.name}`:o.name;o.type===`directory`?a.push(...await d(e,`${t}/${o.name}`,n,i)):a.push(i)}return a.sort()}function f(e){return!e||e.startsWith(`/`)||e.includes(`\0`)||e.includes(`\\`)||/^[A-Za-z]:/.test(e)?!1:!e.split(`/`).some(e=>e===``||e===`.`||e===`..`)}function p(e){let t=r(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function m(e,t,n){let r=p(e.body),i=r?` GitHub said: ${r}`:``,a=s(e.headers,`retry-after`),o=s(e.headers,`x-ratelimit-remaining`),c=r?.toLowerCase()??``;if(e.status===429||o===`0`||c.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let l=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${l}).${i}`}var h=e({downloadGitHubDir:()=>b,fetchGitHubDirFiles:()=>y,fetchRepoZip:()=>g,stripZipPrefix:()=>_,writeZipFilesToDir:()=>v});async function g(e,n,r,s=`main`){let c=`https://codeload.github.com/${e}/${n}/zip/refs/heads/${s}`,l;try{l=await r(c,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:o(e,c)}}if(l.status===404)return s===`main`?g(e,n,r,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(l.status!==200)return{status:`error`,message:`codeload returned HTTP ${l.status}`};let u=t(c);u||=i(l.body);try{return{status:`ok`,files:a(u)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function _(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function v(e,t,n,r,i=!0){let a=[];for(let[o,s]of Object.entries(e)){if(!o.startsWith(t))continue;let e=o.slice(t.length);if(o.endsWith(`/`)||!f(e)||i&&!await l(r,n,e))continue;let c=`${n}/${e}`,u=c.substring(0,c.lastIndexOf(`/`));u!==n&&await r.mkdir(u,{recursive:!0}),await r.writeFile(c,s),a.push(e)}return a.sort()}async function y(e,r,a,o,s,c=new Map,l=``){let u=`https://api.github.com/repos/${e}/${r}/contents/${a}`,d=o?`${u}?ref=${encodeURIComponent(o)}`:u,p=await s.request(d);if(p.status!==200)throw Error(m(p,`${e}/${r}${a?`/${a}`:``}`,s.hasToken));for(let a of n(p.body)){let n=l?`${l}/${a.name}`:a.name;if(f(n)){if(a.type===`file`&&a.download_url){let o=await s.request(a.download_url,`*/*`);if(o.status!==200)throw Error(m(o,`${e}/${r}/${a.path}`,s.hasToken));let l=t(a.download_url);c.set(n,l??i(o.body))}else a.type===`dir`&&await y(e,r,a.path,o,s,c,n)}}return c}async function b(e,r,i,a,o,s,l,u=[],d=``){for(let p of e){let e=d?`${d}/${p.name}`:p.name;if(f(e)){if(p.type===`file`&&p.download_url){if(c(e)&&await s.exists(`${r}/${p.name}`))continue;let n=await l.request(p.download_url,`*/*`);if(n.status!==200)throw Error(m(n,`${i}/${a}/${p.path}`,l.hasToken));let o=t(p.download_url);await s.writeFile(`${r}/${p.name}`,o??n.body),u.push(e)}else if(p.type===`dir`){let t=`https://api.github.com/repos/${i}/${a}/contents/${p.path}`,c=o?`${t}?ref=${encodeURIComponent(o)}`:t,d=await l.request(c);if(d.status!==200)throw Error(m(d,`${i}/${a}/${p.path}`,l.hasToken));let f=n(d.body);await s.mkdir(`${r}/${p.name}`,{recursive:!0}),await b(f,`${r}/${p.name}`,i,a,o,s,l,u,e)}}}return u.sort()}export{_ as a,f as c,c as d,d as f,h as i,l,y as n,v as o,g as r,m as s,b as t,u};
@@ -1 +1 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import{n as t}from"./core-aQUekdF7.js";const n=e(`guest-tool-gate`);async function r(e,t,r,a){if(!a)return n.warn(`Guest-caused turn with no approval route — refusing tool call`,{tool:t}),!1;let o=i(t,r);for(let t of e)if((await a({kind:`guest-tool`,detail:o,requester:t.requester,...t.approver?{approver:t.approver}:{}})).decision===`deny`)return!1;return!0}function i(e,n){let[r]=t(n);return r?`${e}: ${r.replace(/\s+/g,` `).trim().slice(0,300)}`:e}export{r as approveToolCallForGuests};
1
+ import{t as e}from"./logger-LESFN7Hj.js";import{n as t}from"./core-CDo7qjEn.js";const n=e(`guest-tool-gate`);async function r(e,t,r,a){if(!a)return n.warn(`Guest-caused turn with no approval route — refusing tool call`,{tool:t}),!1;let o=i(t,r);for(let t of e)if((await a({kind:`guest-tool`,detail:o,requester:t.requester,...t.approver?{approver:t.approver}:{}})).decision===`deny`)return!1;return!0}function i(e,n){let[r]=t(n);return r?`${e}: ${r.replace(/\s+/g,` `).trim().slice(0,300)}`:e}export{r as approveToolCallForGuests};
@@ -1 +1 @@
1
- import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-MB0YiZ0q.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
1
+ import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-BB92W1rY.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./subcommand-help-CgO7wRS5.js";import{r as t}from"./state-nnDajRje.js";function n(e){return`Usage: ${e} <command> [args...]
1
+ import{r as e}from"./subcommand-help-CgO7wRS5.js";import{r as t}from"./state-B7Ano9ql.js";function n(e){return`Usage: ${e} <command> [args...]
2
2
 
3
3
  Most commands operate on a tab and REQUIRE --tab=<targetId>. There is no
4
4
  implicit "current tab" — run "${e} tab-list" to get tab IDs.
@@ -1,4 +1,4 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import{r as t}from"./panel-rpc-DW7W4w6_.js";import{i as n,t as r}from"./tray-leader-status-CpkFr6n7.js";import{r as i}from"./browser-DG5MjvHF.js";function a(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``,t.pathname!==`/`&&(t.pathname=t.pathname.replace(/\/+$/,``)||`/`);let n=t.toString();return n.endsWith(`/`)?n.slice(0,-1):n}catch{return null}}function o(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.toString(),r=t.pathname.split(`/`).filter(Boolean);if(r.length<2||r.at(-2)!==`join`)return null;let[i,o,...s]=decodeURIComponent(r.at(-1)).split(`.`);if(!i||!o||s.length>0)return null;r.splice(-2,2),t.pathname=r.length>0?`/${r.join(`/`)}`:`/`;let c=a(t.toString());return c?{workerBaseUrl:c,trayId:i,joinUrl:n}:null}catch{return null}}let s={state:`inactive`,joinUrl:null,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null};function c(){return{...s}}function l(){let e=c();if(e.state!==`inactive`)return e;try{let e=globalThis.localStorage?.getItem(n);if(e){let t=JSON.parse(e);if(t?.state&&t.state!==`inactive`)return t}}catch{}return e}const u=new Set;function d(e){return u.add(e),()=>{u.delete(e)}}const f=`slicc.trayWorkerBaseUrl`,p=`slicc.trayJoinUrl`;function m(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=null;if(n.length>=2&&n.at(-2)===`tray`)r=decodeURIComponent(n.at(-1)),n.splice(-2,2),t.pathname=n.length>0?`/${n.join(`/`)}`:`/`;else if(n.length>=2&&n.at(-2)===`join`)return o(t.toString());let i=a(t.toString());return i?{workerBaseUrl:i,trayId:r,joinUrl:null}:null}catch{return null}}function h(e){let t=m(e);return t?.joinUrl?t:null}const g=e(`scoops.tray-leave`);function _(){let e=globalThis.localStorage,t=e&&typeof e.setItem==`function`&&typeof e.removeItem==`function`?e:null;return typeof window<`u`&&typeof window.dispatchEvent==`function`?{wire:{kind:`standalone-page`,dispatchEvent:e=>window.dispatchEvent(e)},storage:t}:{wire:null,storage:t}}async function v(e={},t=_()){let n=e.workerBaseUrl??null;if(t.storage)try{t.storage.removeItem(p),n===null?t.storage.removeItem(f):t.storage.setItem(f,n)}catch(t){g.error(`tray-leave storage write failed`,{workerBaseUrl:n,requestId:e.requestId,error:t instanceof Error?t.message:String(t)})}if(!t.wire)throw Error(`leaveTray: no transport available — inject a panelRpcClient (worker) or run in a context with window`);switch(t.wire.kind){case`standalone-worker`:await t.wire.panelRpcClient.call(`tray-leave`,{workerBaseUrl:n,requestId:e.requestId});return;case`standalone-page`:t.wire.dispatchEvent(new CustomEvent(`slicc:tray-leave`,{detail:{workerBaseUrl:n,requestId:e.requestId}}));return}}const y=e(`scoops.tray-join`);async function b(e,t={},n=_()){if(n.storage){let r=h(e);try{n.storage.setItem(p,r?.joinUrl??e),r&&n.storage.setItem(f,r.workerBaseUrl)}catch(e){y.error(`tray-join storage write failed`,{requestId:t.requestId,error:e instanceof Error?e.message:String(e)})}}if(!n.wire)throw Error(`joinTray: no transport available — inject a panelRpcClient (worker) or run in a context with window`);switch(n.wire.kind){case`standalone-page`:n.wire.dispatchEvent(new CustomEvent(`slicc:tray-join`,{detail:{joinUrl:e,requestId:t.requestId}}));return;case`standalone-worker`:throw Error(`joinTray: standalone-worker transport must be driven via panel-RPC tray-join`)}}function x(){return S()}function S(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderTrayFollowers`);if(e)return JSON.parse(e)}catch{}return[]}function C(){let e=t();if(e)return async()=>await e.call(`tray-reset`,void 0)}function w(){return{stdout:`host - display or manage the current tray host status
1
+ import{t as e}from"./logger-LESFN7Hj.js";import{r as t}from"./panel-rpc-DW7W4w6_.js";import{i as n,t as r}from"./tray-leader-status-CpkFr6n7.js";import{r as i}from"./browser-BM_DFzrh.js";function a(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``,t.pathname!==`/`&&(t.pathname=t.pathname.replace(/\/+$/,``)||`/`);let n=t.toString();return n.endsWith(`/`)?n.slice(0,-1):n}catch{return null}}function o(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.toString(),r=t.pathname.split(`/`).filter(Boolean);if(r.length<2||r.at(-2)!==`join`)return null;let[i,o,...s]=decodeURIComponent(r.at(-1)).split(`.`);if(!i||!o||s.length>0)return null;r.splice(-2,2),t.pathname=r.length>0?`/${r.join(`/`)}`:`/`;let c=a(t.toString());return c?{workerBaseUrl:c,trayId:i,joinUrl:n}:null}catch{return null}}let s={state:`inactive`,joinUrl:null,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null};function c(){return{...s}}function l(){let e=c();if(e.state!==`inactive`)return e;try{let e=globalThis.localStorage?.getItem(n);if(e){let t=JSON.parse(e);if(t?.state&&t.state!==`inactive`)return t}}catch{}return e}const u=new Set;function d(e){return u.add(e),()=>{u.delete(e)}}const f=`slicc.trayWorkerBaseUrl`,p=`slicc.trayJoinUrl`;function m(e){if(!e)return null;try{let t=new URL(e.trim());t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=null;if(n.length>=2&&n.at(-2)===`tray`)r=decodeURIComponent(n.at(-1)),n.splice(-2,2),t.pathname=n.length>0?`/${n.join(`/`)}`:`/`;else if(n.length>=2&&n.at(-2)===`join`)return o(t.toString());let i=a(t.toString());return i?{workerBaseUrl:i,trayId:r,joinUrl:null}:null}catch{return null}}function h(e){let t=m(e);return t?.joinUrl?t:null}const g=e(`scoops.tray-leave`);function _(){let e=globalThis.localStorage,t=e&&typeof e.setItem==`function`&&typeof e.removeItem==`function`?e:null;return typeof window<`u`&&typeof window.dispatchEvent==`function`?{wire:{kind:`standalone-page`,dispatchEvent:e=>window.dispatchEvent(e)},storage:t}:{wire:null,storage:t}}async function v(e={},t=_()){let n=e.workerBaseUrl??null;if(t.storage)try{t.storage.removeItem(p),n===null?t.storage.removeItem(f):t.storage.setItem(f,n)}catch(t){g.error(`tray-leave storage write failed`,{workerBaseUrl:n,requestId:e.requestId,error:t instanceof Error?t.message:String(t)})}if(!t.wire)throw Error(`leaveTray: no transport available — inject a panelRpcClient (worker) or run in a context with window`);switch(t.wire.kind){case`standalone-worker`:await t.wire.panelRpcClient.call(`tray-leave`,{workerBaseUrl:n,requestId:e.requestId});return;case`standalone-page`:t.wire.dispatchEvent(new CustomEvent(`slicc:tray-leave`,{detail:{workerBaseUrl:n,requestId:e.requestId}}));return}}const y=e(`scoops.tray-join`);async function b(e,t={},n=_()){if(n.storage){let r=h(e);try{n.storage.setItem(p,r?.joinUrl??e),r&&n.storage.setItem(f,r.workerBaseUrl)}catch(e){y.error(`tray-join storage write failed`,{requestId:t.requestId,error:e instanceof Error?e.message:String(e)})}}if(!n.wire)throw Error(`joinTray: no transport available — inject a panelRpcClient (worker) or run in a context with window`);switch(n.wire.kind){case`standalone-page`:n.wire.dispatchEvent(new CustomEvent(`slicc:tray-join`,{detail:{joinUrl:e,requestId:t.requestId}}));return;case`standalone-worker`:throw Error(`joinTray: standalone-worker transport must be driven via panel-RPC tray-join`)}}function x(){return S()}function S(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderTrayFollowers`);if(e)return JSON.parse(e)}catch{}return[]}function C(){let e=t();if(e)return async()=>await e.call(`tray-reset`,void 0)}function w(){return{stdout:`host - display or manage the current tray host status
2
2
 
3
3
  Usage: host [join <join-url> | reset | leave [--leader <worker-url>]]
4
4
 
@@ -1,4 +1,4 @@
1
- import{t as e}from"./types-D8gIX-W-.js";import"./fs-D6FCLu_F.js";import{n as t,t as n}from"./browser-DuyhpHbR.js";import{A as r,D as i,E as a,M as o,O as s,T as c,j as l,k as u,w as d}from"./shared-C_68vn79.js";const f=`https://${[`huggingface`,`co`].join(`.`)}`;function p(e){let t=e?.trim();if(!t)return f;try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?f:e.href.replace(/\/+$/,``)}catch{return f}}function m(e,t,n){return`${e}/api/models/${t}/tree/${n}?recursive=true`}function h(e,t,n,r){return`${e}/${t}/resolve/${n}/${r}`}function g(e){try{return new URL(e).host}catch{return e}}async function _(e,t,n){try{return await e(t,n)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`request to ${g(t)} failed (${n}); check the bridge fetch-proxy is reachable`)}}async function v(e,t,n,r=f){let i=await _(e,m(r,t,n),{method:`GET`});if(i.status<200||i.status>=300)throw Error(`HF API ${i.status} ${i.statusText} for ${t}@${n}`);let a=new TextDecoder(`utf-8`).decode(i.body);return JSON.parse(a).filter(e=>e.type===`file`).map(e=>({path:e.path,size:typeof e.size==`number`?e.size:0}))}async function y(e,t){let n=t.lastIndexOf(`/`);if(n<=0)return;let r=t.slice(0,n);await e.mkdir(r,{recursive:!0})}async function ee(e,t,n,r,i,a,o,s,c){let l=`${a}/${i}`;if(!o&&await t.exists(l))try{let e=await t.stat(l);if(c===void 0||c<=0||e.size===c)return{status:`skipped`,bytes:e.size??0}}catch{}let u=await _(e,h(s,n,r,i),{method:`GET`});if(u.status<200||u.status>=300)throw Error(`HTTP ${u.status} ${u.statusText} for ${i}`);return await y(t,l),await t.writeFile(l,u.body),{status:`downloaded`,bytes:u.body.byteLength}}function te(e,t,n){let r=t??`/workspace/models/${e}`;return(r.startsWith(`/`)?r:`${n.replace(/\/+$/,``)}/${r}`).replace(/\/+$/,``)}var ne=class extends Error{file;constructor(e,t){super(t instanceof Error?t.message:String(t)),this.name=`HfFileDownloadError`,this.file=e}};async function re(e){let t=e.revision??`main`,n=e.force??!1,r=p(e.endpoint),i=e.files??[],a=new Map;if(i.length===0){let n=await v(e.fetch,e.repo,t,r);if(n.length===0)throw Error(`repo ${e.repo}@${t} has no files`);i=n.map(e=>e.path);for(let e of n)a.set(e.path,e.size);let o=n.reduce((e,t)=>e+t.size,0);e.progress?.onListed?.({files:i,totalBytes:o})}await e.fs.mkdir(e.targetDir,{recursive:!0});let o=0,s=0,c=0;for(let l=0;l<i.length;l++){let u=i[l],d;try{d=await ee(e.fetch,e.fs,e.repo,t,u,e.targetDir,n,r,a.get(u))}catch(e){throw new ne(u,e)}c+=d.bytes,d.status===`downloaded`?o+=1:s+=1,e.progress?.onFile?.({file:u,status:d.status,bytes:d.bytes,index:l+1,total:i.length})}return{repo:e.repo,revision:t,targetDir:e.targetDir,files:i,downloaded:o,skipped:s,totalBytes:c}}function b(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function ie(e){let t=JSON.stringify(e);return[`// ${s}`,`const { start } = require('sliccy:exec');`,`const __bin = ${t};`,`const __argv = ['ipx', '--global', __bin, ...process.argv.slice(2)];`,`const __stdin = typeof stdin !== 'undefined' ? stdin : undefined;`,`const __h = start(__argv, __stdin !== undefined ? { stdin: __stdin } : undefined);`,`__h.stdin.end();`,`const __r = await __h.done;`,`if (__r.stdout) process.stdout.write(__r.stdout);`,`if (__r.stderr) process.stderr.write(__r.stderr);`,`process.exit(__r.exitCode);`,``].join(`
1
+ import{t as e}from"./types-D8gIX-W-.js";import"./fs-Bvj_6WV6.js";import{n as t,t as n}from"./browser-DuyhpHbR.js";import{A as r,D as i,E as a,M as o,O as s,T as c,j as l,k as u,w as d}from"./shared-DfMXB1pm.js";const f=`https://${[`huggingface`,`co`].join(`.`)}`;function p(e){let t=e?.trim();if(!t)return f;try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?f:e.href.replace(/\/+$/,``)}catch{return f}}function m(e,t,n){return`${e}/api/models/${t}/tree/${n}?recursive=true`}function h(e,t,n,r){return`${e}/${t}/resolve/${n}/${r}`}function g(e){try{return new URL(e).host}catch{return e}}async function _(e,t,n){try{return await e(t,n)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`request to ${g(t)} failed (${n}); check the bridge fetch-proxy is reachable`)}}async function v(e,t,n,r=f){let i=await _(e,m(r,t,n),{method:`GET`});if(i.status<200||i.status>=300)throw Error(`HF API ${i.status} ${i.statusText} for ${t}@${n}`);let a=new TextDecoder(`utf-8`).decode(i.body);return JSON.parse(a).filter(e=>e.type===`file`).map(e=>({path:e.path,size:typeof e.size==`number`?e.size:0}))}async function y(e,t){let n=t.lastIndexOf(`/`);if(n<=0)return;let r=t.slice(0,n);await e.mkdir(r,{recursive:!0})}async function ee(e,t,n,r,i,a,o,s,c){let l=`${a}/${i}`;if(!o&&await t.exists(l))try{let e=await t.stat(l);if(c===void 0||c<=0||e.size===c)return{status:`skipped`,bytes:e.size??0}}catch{}let u=await _(e,h(s,n,r,i),{method:`GET`});if(u.status<200||u.status>=300)throw Error(`HTTP ${u.status} ${u.statusText} for ${i}`);return await y(t,l),await t.writeFile(l,u.body),{status:`downloaded`,bytes:u.body.byteLength}}function te(e,t,n){let r=t??`/workspace/models/${e}`;return(r.startsWith(`/`)?r:`${n.replace(/\/+$/,``)}/${r}`).replace(/\/+$/,``)}var ne=class extends Error{file;constructor(e,t){super(t instanceof Error?t.message:String(t)),this.name=`HfFileDownloadError`,this.file=e}};async function re(e){let t=e.revision??`main`,n=e.force??!1,r=p(e.endpoint),i=e.files??[],a=new Map;if(i.length===0){let n=await v(e.fetch,e.repo,t,r);if(n.length===0)throw Error(`repo ${e.repo}@${t} has no files`);i=n.map(e=>e.path);for(let e of n)a.set(e.path,e.size);let o=n.reduce((e,t)=>e+t.size,0);e.progress?.onListed?.({files:i,totalBytes:o})}await e.fs.mkdir(e.targetDir,{recursive:!0});let o=0,s=0,c=0;for(let l=0;l<i.length;l++){let u=i[l],d;try{d=await ee(e.fetch,e.fs,e.repo,t,u,e.targetDir,n,r,a.get(u))}catch(e){throw new ne(u,e)}c+=d.bytes,d.status===`downloaded`?o+=1:s+=1,e.progress?.onFile?.({file:u,status:d.status,bytes:d.bytes,index:l+1,total:i.length})}return{repo:e.repo,revision:t,targetDir:e.targetDir,files:i,downloaded:o,skipped:s,totalBytes:c}}function b(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function ie(e){let t=JSON.stringify(e);return[`// ${s}`,`const { start } = require('sliccy:exec');`,`const __bin = ${t};`,`const __argv = ['ipx', '--global', __bin, ...process.argv.slice(2)];`,`const __stdin = typeof stdin !== 'undefined' ? stdin : undefined;`,`const __h = start(__argv, __stdin !== undefined ? { stdin: __stdin } : undefined);`,`__h.stdin.end();`,`const __r = await __h.done;`,`if (__r.stdout) process.stdout.write(__r.stdout);`,`if (__r.stderr) process.stderr.write(__r.stderr);`,`process.exit(__r.exitCode);`,``].join(`
2
2
  `)}var ae=class extends Error{binName;path;constructor(e,t){super(`ipk: refusing to overwrite user script at ${t} (bin '${e}')`),this.binName=e,this.path=t,this.name=`GlobalBinCollisionError`}};async function x(e,t){if(t.size!==0){await e.exists(`/shared/bin`)||await e.mkdir(u,{recursive:!0});for(let n of t){if(!n||n.includes(`/`))continue;let t=b(u,`${n}.jsh`);if(await e.exists(t)&&!await S(e,t))throw new ae(n,t)}}}async function S(e,t){try{let n=await e.readFile(t);return(typeof n==`string`?n:new TextDecoder().decode(n)).includes(s)}catch{return!1}}async function C(e,t){if(!await e.exists(`/shared/bin`)){if(t.size===0)return;await e.mkdir(u,{recursive:!0})}let n=[];try{n=await e.readDir(u)}catch{n=[]}for(let r of n){if(r.type!==`file`||!r.name.endsWith(`.jsh`))continue;let n=r.name.slice(0,-4);if(t.has(n))continue;let i=b(u,r.name);await S(e,i)&&await e.rm(i)}for(let n of t){if(!n||n.includes(`/`))continue;let t=b(u,`${n}.jsh`);if(await e.exists(t)&&!await S(e,t))throw new ae(n,t);await e.writeFile(t,ie(n))}}const oe={0:`file`,1:`hardLink`,2:`symbolicLink`,3:`characterDevice`,4:`blockDevice`,5:`directory`,6:`fifo`,7:`contiguousFile`,g:`globalExtendedHeader`,x:`extendedHeader`,D:`gnuDirectory`,I:`gnuInodeMetadata`,K:`gnuLongLinkName`,L:`gnuLongFileName`,N:`gnuOldLongFileName`,M:`gnuMultiVolume`,S:`gnuSparseFile`,E:`gnuExtendedSparse`,A:`solarisAcl`,V:`solarisVolumeLabel`,X:`solarisOldExtendedHeader`};function se(e,t){let n=e.buffer||e,r=[],i=0,a,o;for(;i<n.byteLength-512;){let e=w(n,i,100);if(e.length===0)break;if(a){let t=a.path||a.linkpath;t&&(e=t)}let s=w(n,i+100,8).trim(),c=Number.parseInt(w(n,i+108,8)),l=Number.parseInt(w(n,i+116,8)),u=le(n,i+124,12),d=512+512*Math.trunc(u/512)+(u%512?512:0),f=le(n,i+136,12),p=w(n,i+156,1)||`0`,m=oe[p]||p;switch(m){case`extendedHeader`:case`globalExtendedHeader`:{let e=ue(new Uint8Array(n,i+512,u));m===`extendedHeader`?a=e:(a=void 0,o={...o,...e}),i+=d;continue}case`gnuLongFileName`:case`gnuOldLongFileName`:case`gnuLongLinkName`:a={path:w(n,i+512,u)},i+=d;continue}let h=w(n,i+265,32),g=w(n,i+297,32);e=ce(e);let _={name:e,type:m,size:u,attrs:{...o,...a,mode:s,uid:c,gid:l,mtime:f,user:h,group:g}};if(a=void 0,t?.filter&&!t.filter(_)){i+=d;continue}if(t?.metaOnly){r.push(_),i+=d;continue}let v=u===0?void 0:new Uint8Array(n,i+512,u);r.push({..._,data:v,get text(){return new TextDecoder().decode(this.data)}}),i+=d}return r}function ce(e){let t=e.replace(/\\/g,`/`);t=t.replace(/^[a-zA-Z]:\//,``),t=t.replace(/^\/+/,``);let n=t.startsWith(`./`),r=t.split(`/`),i=[];for(let e of r)e===`..`?i.pop():e!==`.`&&e!==``&&i.push(e);let a=i.join(`/`);return n&&!a.startsWith(`./`)&&(a=`./`+a),e.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function w(e,t,n){let r=new Uint8Array(e,t,n),i=r.indexOf(0);return new TextDecoder().decode(i===-1?r:r.slice(0,i))}function le(e,t,n){let r=new Uint8Array(e,t,n),i=``;for(let e=0;e<n;e++)i+=String.fromCodePoint(r[e]);return Number.parseInt(i,8)}function ue(e){let t=new TextDecoder().decode(e),n={};for(let e of t.split(`
3
3
  `)){let t=e.split(` `)[1]?.split(`=`);t&&(n[t[0]]=t[1])}return n}function de(e,t={}){let n=e.map(e=>{let t=fe(e.data);return{...e,data:t,size:t?.length||0}}),r=0;for(let t=0;t<e.length;t++){let e=n[t].data?.length??0;r+=512+512*Math.trunc(e/512),e%512&&(r+=512)}let i=10240*Math.trunc(r/10240);r%10240&&(i+=10240);let a=new ArrayBuffer(i),o=0;for(let e of n){let n=!e.data;T(a,e.name,o,100),T(a,E(e.attrs?.mode??t.attrs?.mode??(n?`775`:`664`),7),o+100,8),T(a,E((e.attrs?.uid??t.attrs?.uid??1e3).toString(8),7),o+108,8),T(a,E((e.attrs?.gid??t.attrs?.gid??1e3).toString(8),7),o+116,8),T(a,E(e.size.toString(8),11),o+124,12);let r=e.attrs?.mtime??t.attrs?.mtime??Date.now();T(a,E(Math.trunc(r/1e3).toString(8),11),o+136,12),T(a,n?`5`:`0`,o+156,1),T(a,`ustar`,o+257,6),T(a,`00`,o+263,2),T(a,e.attrs?.user??t.attrs?.user??``,o+265,32),T(a,e.attrs?.group??t.attrs?.group??``,o+297,32),T(a,` `,o+148,8);let i=new Uint8Array(a,o,512),s=0;for(let e=0;e<512;e++)s+=i[e];if(T(a,s.toString(8),o+148,8),!n){let t=new Uint8Array(a,o+512,e.size);for(let n=0;n<e.size;n++)t[n]=e.data[n];o+=512*Math.trunc(e.size/512),e.size%512&&(o+=512)}o+=512}return new Uint8Array(a)}function T(e,t,n,r){let i=new Uint8Array(e,n,r),a=new TextEncoder().encodeInto(t,i).written;for(let e=a;e<r;e++)i[e]=0}function E(e,t){return String(e).padStart(t,`0`)}function fe(e){if(e!=null)return typeof e==`string`?new TextEncoder().encode(e):e instanceof ArrayBuffer?new Uint8Array(e):e}function pe(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e:new Uint8Array(e)}function D(e){if(!(e instanceof Uint8Array))throw Error(`gunzip: input must be a Uint8Array`);if(e.length<18||e[0]!==31||e[1]!==139)throw Error(`gunzip: input is not a valid gzip stream (bad magic)`);try{return n(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`gunzip: failed to decompress (${t})`)}}function me(e){if(!(e instanceof Uint8Array))throw Error(`gzip: input must be a Uint8Array`);try{return t(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`gzip: failed to compress (${t})`)}}function he(e){if(!Array.isArray(e))throw Error(`writeTar: entries must be an array`);try{return de(e.map(e=>({name:e.path,...e.directory?{}:{data:e.bytes}})))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`writeTar: failed to create tar archive (${t})`)}}function ge(e){return e.startsWith(`package/`)?e.slice(8):e}function O(e,t,n){let r=new Uint8Array(e,t,n),i=r.indexOf(0);return new TextDecoder().decode(i===-1?r:r.subarray(0,i))}function _e(e,t,n){let r=new Uint8Array(e,t,n),i=``;for(let e=0;e<n;e++)i+=String.fromCodePoint(r[e]);return Number.parseInt(i,8)}function ve(e,t,n){let r=new TextDecoder().decode(new Uint8Array(e,t,n)),i,a;for(let e of r.split(`
4
4
  `)){let t=e.split(` `)[1]?.split(`=`);t&&(t[0]===`path`?i=t[1]:t[0]===`linkpath`&&(a=t[1]))}return i||a}function ye(e){let t=e.replace(/\\/g,`/`);t=t.replace(/^[a-zA-Z]:\//,``),t=t.replace(/^\/+/,``);let n=t.startsWith(`./`),r=t.split(`/`),i=[];for(let e of r)e===`..`?i.pop():e!==`.`&&e!==``&&i.push(e);let a=i.join(`/`);return n&&!a.startsWith(`./`)&&(a=`./`+a),e.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function be(e,t){let n=e.buffer,r=[],i=0,a;for(;i<n.byteLength-512;){let e=O(n,i,100);if(e.length===0)break;let o=_e(n,i+124,12),s=512+512*Math.trunc(o/512)+(o%512?512:0),c=O(n,i+156,1)||`0`;if(c===`x`||c===`g`){a=c===`x`?ve(n,i+512,o):void 0,i+=s;continue}if(c===`L`||c===`N`||c===`K`){a=O(n,i+512,o),i+=s;continue}let l;if(a)l=a;else{let t=O(n,i+345,155);l=t.length>0?`${t}/${e}`:e}r.push(t?l:ye(l)),a=void 0,i+=s}return r}function k(e,t={}){if(!(e instanceof Uint8Array))throw Error(`readTar: input must be a Uint8Array`);let n=pe(e),r;try{r=se(n)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`readTar: failed to parse tar archive (${t})`)}let i=t.stripNpmPrefix??!0,a=t.includeDirectories??!1,o=be(n,t.preserveRawPaths??!1),s=o.length===r.length;if(t.preserveRawPaths&&!s)throw Error(`readTar: raw path resolution did not align with archive entries`);let c=[];return r.forEach((e,t)=>{let n=e.type===`directory`;if(!n&&e.type!==`file`&&e.type!==`contiguousFile`||n&&!a)return;let r=s?o[t]:e.name;c.push({path:i?ge(r):r,bytes:e.data?e.data.slice():new Uint8Array,...n?{directory:!0}:{}})}),c}function A(e){let t=(e??``).trim();if(!t)throw Error(`ipk: package spec is required`);if(t.startsWith(`@`)){let e=t.indexOf(`/`);if(e===-1)throw Error(`ipk: scoped spec '${t}' is missing a name (expected @scope/name)`);let n=t.slice(e+1),r=n.indexOf(`@`),i=t.slice(0,e);return r===-1?{name:`${i}/${n}`,range:``}:{name:`${i}/${n.slice(0,r)}`,range:n.slice(r+1)}}let n=t.indexOf(`@`);return n===-1?{name:t,range:``}:{name:t.slice(0,n),range:t.slice(n+1)}}function j(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function M(e,t){if(t.startsWith(`@`)){let[n,r]=t.split(`/`,2);return j(e,n,r)}return j(e,t)}async function N(e,t){await e.mkdir(t,{recursive:!0})}async function P(e,t){await e.exists(t)&&await e.rm(t,{recursive:!0})}function xe(e){return`^${e}`}function Se(e,t){let n=e.range.trim();return n===``||n===`*`||n===`latest`||/^[A-Za-z][A-Za-z0-9_-]*$/.test(n)?xe(t):n}async function Ce(e,t,n){for(let r of n){if(!r.path)continue;let n=r.path.replace(/\\/g,`/`).replace(/^\/+/,``);if(n.split(`/`).some(e=>e===`..`))throw Error(`installer: refusing to extract entry escaping package root: ${r.path}`);let i=j(t,n),a=i.lastIndexOf(`/`);a>0&&await N(e,i.slice(0,a)),await e.writeFile(i,r.bytes)}}async function F(t,n,r){let i;try{i=await t.readFile(n)}catch(t){if(t instanceof e&&t.code===`ENOENT`)return r;throw t}return JSON.parse(i)}async function I(t,n,r){let i;try{i=await t.readFile(n)}catch(t){if(t instanceof e&&t.code===`ENOENT`)return r;throw t}if(!i?.trim())return r;try{return JSON.parse(i)}catch{return r}}const L=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`];function R(e,t){return e!==void 0&&Object.hasOwn(e,t)}function z(e,t,n){return n||R(e.devDependencies,t)?`devDependencies`:R(e.optionalDependencies,t)?`optionalDependencies`:R(e.peerDependencies,t)?`peerDependencies`:`dependencies`}function we(e,t){let n=e[z(e,t,!1)]?.[t];return typeof n==`string`&&n.trim()!==``?n:void 0}function Te(e,t){if(e.range.trim()!==``)return e;let n=we(t,e.name);return n===void 0?e:{name:e.name,range:n}}function Ee(e,t){let n={dependencies:{...e.dependencies??{}},devDependencies:{...e.devDependencies??{}},optionalDependencies:{...e.optionalDependencies??{}},peerDependencies:{...e.peerDependencies??{}}},r=new Set;for(let e of t){for(let t of L)delete n[t][e.name];n[e.section][e.name]=e.range,r.add(e.section)}let i={...e};for(let t of L)(e[t]!==void 0||r.has(t))&&(i[t]=n[t]);return i}function B(e,t){let n=new Map;return{supplier:async r=>{let i=n.get(r);return i||(i=await c(r,e,{timeoutMs:t}),n.set(r,i),i)},cache:n}}async function De(e,t,n){let r=[],a=[],o=new Set;for(let s of e){let e;try{e=A(s)}catch(e){a.push({spec:s,error:V(e)});continue}if(n&&(e=Te(e,n)),o.has(e.name)){let t=r.findIndex(t=>t.parsed.name===e.name);t>=0&&r.splice(t,1)}try{let n=await t(e.name);i(n,e.range)}catch(e){a.push({spec:s,error:V(e)});continue}r.push({spec:s,parsed:e}),o.add(e.name)}return{directs:r,errors:a}}function V(e){return e instanceof Error?e:Error(String(e))}async function H(e,t,n,r,i){let o=M(t,n.name),s=j(o,`package.json`),c=!1;if(await e.exists(s)&&(await I(e,s,null))?.version===n.version&&(c=!0),!c){let t=k(D(await a(n.resolved,r,{timeoutMs:i})));await P(e,o),await N(e,o);try{await Ce(e,o,t)}catch(t){throw await P(e,o),t}}let l=Object.keys(n.dependencies);if(l.length>0){let t=j(o,`node_modules`);await N(e,t);for(let a of l)await H(e,t,n.dependencies[a],r,i)}}async function U(e,t,n,r,i){let a=Object.keys(n.root);if(a.length!==0){await N(e,t);for(let o of a)await H(e,t,n.root[o],r,i)}}function Oe(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function W(e,t){return typeof e==`string`?{[Oe(t)]:e}:e}function ke(e){return e.replace(/^\.\//,``).replace(/^\/+/,``)}function Ae(e){return`#!/usr/bin/env node\nrequire(${JSON.stringify(e)});\n`}async function G(e,t){let n=[];return await K(e,t,0,n),n}async function K(e,t,n,r){if(!await e.exists(t))return;let i;try{i=await e.readDir(t)}catch{return}for(let a of i){if(a.type!==`directory`||a.name===`.bin`)continue;if(a.name.startsWith(`@`)){let i=j(t,a.name),o;try{o=await e.readDir(i)}catch{continue}for(let t of o){if(t.type!==`directory`)continue;let o=`${a.name}/${t.name}`;await q(e,j(i,t.name),o,n,r)}continue}let i=a.name;await q(e,j(t,a.name),i,n,r)}}async function q(e,t,n,r,i){let a=await I(e,j(t,`package.json`),null);if(a?.bin!==void 0&&a.bin!==null){let e=W(a.bin,n);for(let[a,o]of Object.entries(e))typeof a==`string`&&a.length!==0&&typeof o==`string`&&o.length!==0&&i.push({binName:a,pkgName:n,installDir:t,binPath:o,depth:r})}await K(e,j(t,`node_modules`),r+1,i)}function J(e){let t=new Map;for(let n of e){let e=t.get(n.binName);if(!e){t.set(n.binName,n);continue}(n.depth<e.depth||n.depth===e.depth&&n.pkgName<e.pkgName)&&t.set(n.binName,n)}return t}function je(e,t,n,r){let i=M(e,t.name);if(t.bin!==void 0&&t.bin!==null){let e=W(t.bin,t.name);for(let[a,o]of Object.entries(e))typeof a==`string`&&a.length!==0&&typeof o==`string`&&o.length!==0&&r.push({binName:a,pkgName:t.name,installDir:i,binPath:o,depth:n})}let a=j(i,`node_modules`);for(let e of Object.values(t.dependencies))je(a,e,n+1,r)}function Me(e,t){let n=[];for(let r of Object.values(e.root))je(t,r,0,n);return n}function Ne(e,t){return new Set(J(Me(e,t)).keys())}function Pe(e,t,n){return`..${t.slice(e.length)}/${ke(n)}`}async function Y(e,t){let n=J(await G(e,t)),r=j(t,`.bin`);if(await e.exists(r)){let t;try{t=await e.readDir(r)}catch{t=[]}for(let i of t)i.type===`file`&&(n.has(i.name)||await e.rm(j(r,i.name)))}if(n.size!==0){await N(e,r);for(let i of n.values()){let n=j(r,i.binName),a=Ae(Pe(t,i.installDir,i.binPath));await e.writeFile(n,a)}}}async function Fe(e,t,n){let r=j(t,`package.json`),i=Ee(await F(e,r,{}),n);return await e.writeFile(r,`${JSON.stringify(i,null,2)}\n`),r}async function Ie(e,t){let{fs:n,fetch:i,cwd:a,timeoutMs:o,global:s=!1,saveDev:c=!1}=t;if(e.length===0)return{results:[],errors:[]};let u=s?l:a,f=await F(n,j(u,`package.json`),{}),{supplier:p}=B(i,o),{directs:m,errors:h}=await De(e,p,f);if(m.length===0)return{results:[],errors:h};let g={};if(s)for(let e of Q(f))g[e.name]=e.range;for(let e of m)g[e.parsed.name]=e.parsed.range;let _=await d({rootDependencies:g,fetchPackument:p}),v=s?r:j(a,`node_modules`);if(s&&(await $(n,v,new Set(Object.keys(_.root))),await x(n,Ne(_,v))),await U(n,v,_,i,o),await Y(n,v),s){let e=J(await G(n,v));await C(n,new Set(e.keys()))}let y=await Fe(n,u,m.map(e=>{let t=_.root[e.parsed.name];if(!t)throw Error(`installer: resolved node missing for ${e.parsed.name}`);return{name:e.parsed.name,range:Se(e.parsed,t.version),section:z(f,e.parsed.name,c)}}));return{results:m.map(e=>{let t=_.root[e.parsed.name],n=M(v,e.parsed.name);return{ok:!0,name:e.parsed.name,version:t.version,installPath:n,range:Se(e.parsed,t.version),manifestPath:y}}),errors:h}}var X=class extends Error{constructor(e){super(`no package.json found at ${e} (run 'ipk install <pkg>' to create one, or add a package.json)`),this.name=`ManifestNotFoundError`}};function Z(e,t){if(!(!t||typeof t!=`object`))for(let[n,r]of Object.entries(t))typeof n==`string`&&typeof r==`string`&&e.set(n,r)}function Le(e){let t=new Map;return Z(t,e.devDependencies),Z(t,e.dependencies),Array.from(t.entries()).map(([e,t])=>({name:e,range:t}))}function Q(e){let t=new Map;return Z(t,e.dependencies),Z(t,e.peerDependencies),Z(t,e.optionalDependencies),Z(t,e.devDependencies),Array.from(t.entries()).map(([e,t])=>({name:e,range:t}))}async function Re(e){let{fs:t,fetch:n,cwd:r,timeoutMs:a}=e,o=j(r,`package.json`);if(!await t.exists(o))throw new X(o);let s=Le(await F(t,o,{}));if(s.length===0)return{results:[],errors:[],empty:!0};let{supplier:c}=B(n,a),l=[],u=[];for(let e of s)try{let t=await c(e.name);i(t,e.range),l.push(e)}catch(t){u.push({spec:`${e.name}@${e.range}`,error:V(t)})}if(l.length===0)return{results:[],errors:u,empty:!1};let f={};for(let e of l)f[e.name]=e.range;let p=await d({rootDependencies:f,fetchPackument:c}),m=j(r,`node_modules`);return await U(t,m,p,n,a),await Y(t,m),{results:l.map(e=>{let t=p.root[e.name];return t?{ok:!0,name:e.name,version:t.version,installPath:M(m,e.name),range:e.range,manifestPath:o}:null}).filter(e=>e!==null),errors:u,empty:!1}}function ze(e,t){return L.some(n=>R(e[n],t))}function Be(e,t){let n={...e};for(let r of L){let i={...e[r]??{}};for(let e of t)delete i[e];e[r]!==void 0&&(n[r]=i)}return n}async function Ve(e,t,n){await e.writeFile(t,`${JSON.stringify(n,null,2)}\n`)}async function $(e,t,n){if(!await e.exists(t))return;let r;try{r=await e.readDir(t)}catch{return}for(let i of r)if(i.name!==`.bin`&&i.type===`directory`){if(i.name.startsWith(`@`)){let r=j(t,i.name),a;try{a=await e.readDir(r)}catch{continue}for(let t of a){if(t.type!==`directory`)continue;let a=`${i.name}/${t.name}`;n.has(a)||await P(e,j(r,t.name))}continue}n.has(i.name)||await P(e,j(t,i.name))}}async function He(e,t,n,i){let a=Q(i??await F(e,o,{}));if(a.length===0){await P(e,r),await C(e,new Set);return}let{supplier:s}=B(t,n),c={};for(let e of a)c[e.name]=e.range;let l=await d({rootDependencies:c,fetchPackument:s});await $(e,r,new Set(Object.keys(l.root))),await x(e,Ne(l,r)),await U(e,r,l,t,n),await Y(e,r);let u=J(await G(e,r));await C(e,new Set(u.keys()))}async function Ue(e,t){let{fs:n,fetch:r,cwd:i,timeoutMs:a,global:o=!1}=t;if(e.length===0)return{results:[],errors:[]};let s=new Set,c=[];for(let t of e)try{s.add(A(t).name)}catch(e){c.push({spec:t,error:V(e)})}if(s.size===0)return{results:[],errors:c};let u=j(o?l:i,`package.json`);if(!await n.exists(u)){for(let t of e)c.push({spec:t,error:new X(u)});return{results:[],errors:c}}let d=await F(n,u,{}),f=[];for(let e of s)f.push({name:e,removed:ze(d,e)});let p=Be(d,s);try{o?await He(n,r,a,p):await We(n,r,i,a,p)}catch(t){return c.push({spec:e.join(` `),error:V(t)}),{results:f,errors:c}}return await Ve(n,u,p),{results:f,errors:c}}async function We(e,t,n,r,i){let a=j(n,`package.json`),o=Q(i??await F(e,a,{})),s=j(n,`node_modules`);if(o.length===0){await P(e,s);return}let{supplier:c}=B(t,r),l={};for(let e of o)l[e.name]=e.range;let u=await d({rootDependencies:l,fetchPackument:c});await $(e,s,new Set(Object.keys(u.root))),await U(e,s,u,t,r),await Y(e,s)}async function Ge(e){let t=Q(await F(e,o,{})),n=[];for(let i of t){let t=await I(e,j(M(r,i.name),`package.json`),{});n.push({name:i.name,version:typeof t.version==`string`?t.version:`?`,range:i.range})}return n.sort((e,t)=>e.name.localeCompare(t.name)),n}async function Ke(e,t){let n=j(t,`package.json`);if(!await e.exists(n))return[];let r=Q(await F(e,n,{})),i=j(t,`node_modules`),a=[];for(let t of r){let n=await I(e,j(M(i,t.name),`package.json`),{});a.push({name:t.name,version:typeof n.version==`string`?n.version:`?`,range:t.range})}return a.sort((e,t)=>e.name.localeCompare(t.name)),a}export{Ke as a,me as c,ne as d,re as f,Ge as i,k as l,Re as n,Ue as o,te as p,Ie as r,D as s,X as t,he as u};
@@ -1 +1 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import"./core-aQUekdF7.js";import{previewArgs as t}from"./turn-journal-_Hrn3Aoy.js";const n=e(`interrupted-work-recovery`);function r(e,n){let r=new Set,i=new Set;for(let t of e)if(u(t,`toolResult`)&&r.add(t.toolCallId),u(t,`assistant`))for(let e of l(t))i.add(e.id);let a=[],o=e[e.length-1],s=d(e,e=>u(e,`assistant`)),c=s>=0&&e.slice(s+1).some(e=>u(e,`user`));if(s>=0&&!c){let i=new Map(n.tools.map(e=>[e.toolCallId,e]));for(let n of l(e[s]))r.has(n.id)||a.push({toolCallId:n.id,toolName:n.name,argsPreview:i.get(n.id)?.argsPreview??t(n.arguments),inHistory:!0})}for(let e of n.tools)i.has(e.toolCallId)||r.has(e.toolCallId)||a.push({toolCallId:e.toolCallId,toolName:e.toolName,argsPreview:e.argsPreview,inHistory:!1});return a.length>0?{kind:`tools`,calls:a}:o&&(u(o,`user`)||u(o,`toolResult`))?{kind:`turn`}:{kind:`none`}}async function i(e,t){let r=[];for(let i of e)try{r.push(await a(i,t))}catch(e){n.warn(`Recovering an interrupted turn failed`,{jid:i.jid,error:e instanceof Error?e.message:String(e)}),r.push({jid:i.jid,action:`skipped`})}return r}async function a(e,t){let{jid:i}=e,a=t.getScoop(i),s=t.getUnit(i);if(!a||!s?.hasAgent())return t.journal.isLive(i)||await t.journal.clear(i),{jid:i,action:`skipped`};let l=r(s.getAgentMessages(),e);if(s.isBusy)return l.kind===`tools`?(o(a.folder,e,l.calls,s,t),{jid:i,action:`tools-reported`,calls:l.calls}):{jid:i,action:`superseded`};switch(await t.journal.clear(i),l.kind){case`none`:return{jid:i,action:`none`};case`tools`:return s.settleInterruptedToolCalls(l.calls.filter(e=>e.inHistory).map(e=>({...e,text:c}))),o(a.folder,e,l.calls,s,t),n.info(`Reported tool calls interrupted by a reload`,{folder:a.folder,tools:l.calls.map(e=>e.toolName)}),{jid:i,action:`tools-reported`,calls:l.calls};case`turn`:{if(e.resumeCount>=2)return n.warn(`Interrupted turn not resumed again`,{folder:a.folder,resumeCount:e.resumeCount}),s.reportError(`The page reloaded ${e.resumeCount+1} times while this turn was running; it was not retried again. Send a message to continue.`),{jid:i,action:`gave-up`,resumeCount:e.resumeCount};let r=e.resumeCount+1;return n.info(`Resuming a turn interrupted by a reload`,{folder:a.folder,resumeCount:r}),t.resumeTurn(i,r,e.guestGates).catch(e=>{n.warn(`Resumed turn failed`,{folder:a.folder,error:e instanceof Error?e.message:String(e)})}),{jid:i,action:`resumed`,resumeCount:r}}}}function o(e,t,n,r,i){if(t.guestGates.length>0){r.reportError(`The page reloaded while ${n.map(e=>e.toolName).join(`, `)} ${n.length===1?`was`:`were`} running for a guest; the result was lost and the call was not re-run.`);return}i.emitLick(s(e,t,n))}function s(e,t,n){return{type:`session-reload`,targetScoop:e,timestamp:new Date().toISOString(),body:{reason:`tool-call-interrupted`,interruptedAt:new Date(t.updatedAt).toISOString(),tools:n.map(e=>({toolName:e.toolName,toolCallId:e.toolCallId,args:e.argsPreview}))}}}const c=`Interrupted: the page reloaded while this tool call was running, so its result was lost. It may or may not have completed, and it was not re-run.`;function l(e){let t=e.content;return Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`toolCall`&&typeof e.id==`string`):[]}function u(e,t){return e?.role===t}function d(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}export{i as recoverInterruptedWork};
1
+ import{t as e}from"./logger-LESFN7Hj.js";import"./core-CDo7qjEn.js";import{previewArgs as t}from"./turn-journal-B4vV4fDV.js";const n=e(`interrupted-work-recovery`);function r(e,n){let r=new Set,i=new Set;for(let t of e)if(u(t,`toolResult`)&&r.add(t.toolCallId),u(t,`assistant`))for(let e of l(t))i.add(e.id);let a=[],o=e[e.length-1],s=d(e,e=>u(e,`assistant`)),c=s>=0&&e.slice(s+1).some(e=>u(e,`user`));if(s>=0&&!c){let i=new Map(n.tools.map(e=>[e.toolCallId,e]));for(let n of l(e[s]))r.has(n.id)||a.push({toolCallId:n.id,toolName:n.name,argsPreview:i.get(n.id)?.argsPreview??t(n.arguments),inHistory:!0})}for(let e of n.tools)i.has(e.toolCallId)||r.has(e.toolCallId)||a.push({toolCallId:e.toolCallId,toolName:e.toolName,argsPreview:e.argsPreview,inHistory:!1});return a.length>0?{kind:`tools`,calls:a}:o&&(u(o,`user`)||u(o,`toolResult`))?{kind:`turn`}:{kind:`none`}}async function i(e,t){let r=[];for(let i of e)try{r.push(await a(i,t))}catch(e){n.warn(`Recovering an interrupted turn failed`,{jid:i.jid,error:e instanceof Error?e.message:String(e)}),r.push({jid:i.jid,action:`skipped`})}return r}async function a(e,t){let{jid:i}=e,a=t.getScoop(i),s=t.getUnit(i);if(!a||!s?.hasAgent())return t.journal.isLive(i)||await t.journal.clear(i),{jid:i,action:`skipped`};let l=r(s.getAgentMessages(),e);if(s.isBusy)return l.kind===`tools`?(o(a.folder,e,l.calls,s,t),{jid:i,action:`tools-reported`,calls:l.calls}):{jid:i,action:`superseded`};switch(await t.journal.clear(i),l.kind){case`none`:return{jid:i,action:`none`};case`tools`:return s.settleInterruptedToolCalls(l.calls.filter(e=>e.inHistory).map(e=>({...e,text:c}))),o(a.folder,e,l.calls,s,t),n.info(`Reported tool calls interrupted by a reload`,{folder:a.folder,tools:l.calls.map(e=>e.toolName)}),{jid:i,action:`tools-reported`,calls:l.calls};case`turn`:{if(e.resumeCount>=2)return n.warn(`Interrupted turn not resumed again`,{folder:a.folder,resumeCount:e.resumeCount}),s.reportError(`The page reloaded ${e.resumeCount+1} times while this turn was running; it was not retried again. Send a message to continue.`),{jid:i,action:`gave-up`,resumeCount:e.resumeCount};let r=e.resumeCount+1;return n.info(`Resuming a turn interrupted by a reload`,{folder:a.folder,resumeCount:r}),t.resumeTurn(i,r,e.guestGates).catch(e=>{n.warn(`Resumed turn failed`,{folder:a.folder,error:e instanceof Error?e.message:String(e)})}),{jid:i,action:`resumed`,resumeCount:r}}}}function o(e,t,n,r,i){if(t.guestGates.length>0){r.reportError(`The page reloaded while ${n.map(e=>e.toolName).join(`, `)} ${n.length===1?`was`:`were`} running for a guest; the result was lost and the call was not re-run.`);return}i.emitLick(s(e,t,n))}function s(e,t,n){return{type:`session-reload`,targetScoop:e,timestamp:new Date().toISOString(),body:{reason:`tool-call-interrupted`,interruptedAt:new Date(t.updatedAt).toISOString(),tools:n.map(e=>({toolName:e.toolName,toolCallId:e.toolCallId,args:e.argsPreview}))}}}const c=`Interrupted: the page reloaded while this tool call was running, so its result was lost. It may or may not have completed, and it was not re-run.`;function l(e){let t=e.content;return Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`toolCall`&&typeof e.id==`string`):[]}function u(e,t){return e?.role===t}function d(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}export{i as recoverInterruptedWork};