sliccy 6.210.0 → 6.210.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/ui/.vite/manifest.json +182 -182
  2. package/dist/ui/assets/{account-store-DgfR_tf2.js → account-store-BXs7YUd1.js} +1 -1
  3. package/dist/ui/assets/{account-store-ByX1Dt0d.js → account-store-Bj2sWuL9.js} +1 -1
  4. package/dist/ui/assets/{adobe-DxaC2zCR.js → adobe-DtoNpFL2.js} +1 -1
  5. package/dist/ui/assets/{adobe-R_y7Dfut.js → adobe-F-IKKOJO.js} +1 -1
  6. package/dist/ui/assets/{agent-panels-C_PSIfT1.js → agent-panels-CVsqg2-h.js} +1 -1
  7. package/dist/ui/assets/{almost-bash-shell-headless-Ccu3_Uhw.js → almost-bash-shell-headless-CH7VDHBB.js} +38 -38
  8. package/dist/ui/assets/{apply-layout-OKdF-hhc.js → apply-layout-FFHCB9bO.js} +1 -1
  9. package/dist/ui/assets/{apps-JHYPOU64.js → apps-BJzl3RZW.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-DXBUUMQQ.js → azure-openai-BLEG5MlZ.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-BVUK3KXE.js → azure-openai-CpRQdIQb.js} +1 -1
  12. package/dist/ui/assets/{backend-hostfs-88hAlDb5.js → backend-hostfs-DZyH5GFZ.js} +1 -1
  13. package/dist/ui/assets/{bsh-watchdog-xbXqblUt.js → bsh-watchdog-CqfihC2k.js} +1 -1
  14. package/dist/ui/assets/{bunny-probe-Y6RN8nEm.js → bunny-probe-ZpG6E7n2.js} +1 -1
  15. package/dist/ui/assets/{bunny-run-C4HFX6FX.js → bunny-run-ysVsr1mX.js} +1 -1
  16. package/dist/ui/assets/{cdp-DjJWaZz6.js → cdp-DwsDXLhg.js} +1 -1
  17. package/dist/ui/assets/{cerebras-Cd6zKgza.js → cerebras-CnpcT2_8.js} +1 -1
  18. package/dist/ui/assets/{cerebras-BJZYfn89.js → cerebras-gnXcXmk7.js} +1 -1
  19. package/dist/ui/assets/{composer-speech-CJc-2k5O.js → composer-speech-BURN-dPW.js} +1 -1
  20. package/dist/ui/assets/{connect-surface-DPvoPj55.js → connect-surface-D0BfSkwe.js} +1 -1
  21. package/dist/ui/assets/{core-VO3EvqHP.js → core-Dj0t7hQO.js} +1 -1
  22. package/dist/ui/assets/{directed-approval-DLUTxlNM.js → directed-approval-BWqIdB9e.js} +1 -1
  23. package/dist/ui/assets/{emscripten-vfs-hook-DaUD5bwd.js → emscripten-vfs-hook-Boy5xq-Z.js} +1 -1
  24. package/dist/ui/assets/{ensure-speech-assets-DcFMkg1m.js → ensure-speech-assets-CzLCdx9h.js} +1 -1
  25. package/dist/ui/assets/{esbuild-wasm-BqY5rzxc.js → esbuild-wasm-C-mKofIl.js} +1 -1
  26. package/dist/ui/assets/{fast-path-vLRu2cHH.js → fast-path-hOi08xeS.js} +1 -1
  27. package/dist/ui/assets/{ffmpeg-wasm-NIvl0oHG.js → ffmpeg-wasm-DsXD0tX2.js} +1 -1
  28. package/dist/ui/assets/{frozen-archive-writer-Ct9GJG54.js → frozen-archive-writer-o7ImcSbe.js} +1 -1
  29. package/dist/ui/assets/{fs-rBjZTyof.js → fs-BaM5oYgh.js} +2 -2
  30. package/dist/ui/assets/{fs-B3WU3yr9.js → fs-C7Qh7l0E.js} +1 -1
  31. package/dist/ui/assets/{gelatiere-store-cZnVaRlS.js → gelatiere-store-BkPyZ5mV.js} +1 -1
  32. package/dist/ui/assets/{gelatiere-unit-CLZPrZzv.js → gelatiere-unit-BYlMZ2v4.js} +1 -1
  33. package/dist/ui/assets/{github-BW1eM6J3.js → github-D0VXVUSM.js} +2 -2
  34. package/dist/ui/assets/{github-Cq1sNS_K.js → github-N-Ega4Po.js} +1 -1
  35. package/dist/ui/assets/{github-auth-O6zGPogb.js → github-auth-DvbRhyIc.js} +1 -1
  36. package/dist/ui/assets/{github-copilot-1kPf7awr.js → github-copilot-C2Lk0xfw.js} +1 -1
  37. package/dist/ui/assets/{github-copilot-CUJZELWh.js → github-copilot-CCvuY9BS.js} +1 -1
  38. package/dist/ui/assets/{github-install-CXBoYKYM.js → github-install-DPTw6LV_.js} +1 -1
  39. package/dist/ui/assets/{github-zip-DHBvTUIf.js → github-zip-Bbft7vZj.js} +1 -1
  40. package/dist/ui/assets/{guest-tool-gate-BzUxTS0o.js → guest-tool-gate-C3mMUKtL.js} +1 -1
  41. package/dist/ui/assets/{hear-BVHHBpIb.js → hear-l_e8vu4Q.js} +1 -1
  42. package/dist/ui/assets/{help-BYCrQyQm.js → help-C5uNreTt.js} +1 -1
  43. package/dist/ui/assets/{installer-pOTEH6_f.js → installer-BidZuNnC.js} +1 -1
  44. package/dist/ui/assets/{interrupted-work-recovery-DkaikSRv.js → interrupted-work-recovery-D5TFE2JG.js} +1 -1
  45. package/dist/ui/assets/{ipk-mamba-13yN29Fi.js → ipk-mamba-CvGbcFF_.js} +1 -1
  46. package/dist/ui/assets/{js-realm-worker-OZbA_gYe.js → js-realm-worker-BFJHUvlI.js} +2 -2
  47. package/dist/ui/assets/{jsh-executor-DZO1HSOR.js → jsh-executor-B4ySdjop.js} +2 -2
  48. package/dist/ui/assets/{kernel-worker-B9c7Iv6C.js → kernel-worker-BzcdrkzF.js} +9 -9
  49. package/dist/ui/assets/{lick-ws-bridge-TTmDE5-3.js → lick-ws-bridge-B248zI2U.js} +1 -1
  50. package/dist/ui/assets/{lick-ws-bridge-DjeZVXRW.js → lick-ws-bridge-CodIkT51.js} +1 -1
  51. package/dist/ui/assets/{live-session-curation-hidMwgql.js → live-session-curation-vrJYxCgm.js} +1 -1
  52. package/dist/ui/assets/{live-session-snapshot-STfu1AIh.js → live-session-snapshot-lJ3w4rOH.js} +1 -1
  53. package/dist/ui/assets/{local-llm-B8dhTls8.js → local-llm-dkgrXktX.js} +1 -1
  54. package/dist/ui/assets/{local-llm-D0k2uDUi.js → local-llm-vgDCJvkZ.js} +1 -1
  55. package/dist/ui/assets/{magick-wasm-DjyHtD1t.js → magick-wasm-qrxQJP5k.js} +1 -1
  56. package/dist/ui/assets/{main-Ylszjlde.js → main-CXeU8DQz.js} +3 -3
  57. package/dist/ui/assets/{main-cherry-C-bsI9l6.js → main-cherry-sfCt3gLL.js} +1 -1
  58. package/dist/ui/assets/{memory-curation-seam-B7hMTwGX.js → memory-curation-seam-T4WRfl1n.js} +1 -1
  59. package/dist/ui/assets/{memory-health-as7mEPc6.js → memory-health-EXXqHw1x.js} +1 -1
  60. package/dist/ui/assets/{memory-write-execute-DaCQKUN-.js → memory-write-execute-DIYIwJKg.js} +1 -1
  61. package/dist/ui/assets/{merge-folded-cost-into-frozen-D-2Ph0GN.js → merge-folded-cost-into-frozen-bDakT1WR.js} +1 -1
  62. package/dist/ui/assets/{mount-BByFpMAL.js → mount-BABm_hJd.js} +3 -3
  63. package/dist/ui/assets/{mount-BYEvANlb.js → mount-C7dlV4rl.js} +1 -1
  64. package/dist/ui/assets/{new-session-BXB2Cf7y.js → new-session-D2rtUiOZ.js} +2 -2
  65. package/dist/ui/assets/{oauth-bootstrap-DeA2SKlj.js → oauth-bootstrap-3P5XkiLD.js} +2 -2
  66. package/dist/ui/assets/{onboarding-orchestrator-ByFpaN7_.js → onboarding-orchestrator-CYP3TBxO.js} +1 -1
  67. package/dist/ui/assets/{openai-codex-CCo3ZmW2.js → openai-codex-CUa5FPoQ.js} +1 -1
  68. package/dist/ui/assets/{openai-codex-CgYrmMUk.js → openai-codex-DvxYitk6.js} +1 -1
  69. package/dist/ui/assets/{openrouter-97wg-v_R.js → openrouter-Btmqh3ZY.js} +1 -1
  70. package/dist/ui/assets/{openrouter-CKicFuSH.js → openrouter-BxUHkfTR.js} +1 -1
  71. package/dist/ui/assets/{openrouter-free-B5IsIaNO.js → openrouter-free-BCIYdkt3.js} +1 -1
  72. package/dist/ui/assets/{openrouter-free-B9XNv61G.js → openrouter-free-nn_h_WC_.js} +1 -1
  73. package/dist/ui/assets/{openrouter-oauth-BwMN3x2M.js → openrouter-oauth-8cwBPqX7.js} +1 -1
  74. package/dist/ui/assets/{openrouter-oauth-B7xNpdYW.js → openrouter-oauth-Bba1qXT3.js} +1 -1
  75. package/dist/ui/assets/{opfs-mount-DpaBHmd-.js → opfs-mount-DbON63F4.js} +1 -1
  76. package/dist/ui/assets/{panel-rpc-handlers-BbazEhj0.js → panel-rpc-handlers-aqHjP3Jn.js} +2 -2
  77. package/dist/ui/assets/{panelize-shell-jWC6JaCw.js → panelize-shell-CjtBTrHH.js} +1 -1
  78. package/dist/ui/assets/{pi-edit-execution-D79zjNpH.js → pi-edit-execution-DFk-ThoQ.js} +1 -1
  79. package/dist/ui/assets/{provider-SsZ1z43S.js → provider-B7Epu3fA.js} +2 -2
  80. package/dist/ui/assets/{provider-CCQRZg4A.js → provider-DFROVc_U.js} +1 -1
  81. package/dist/ui/assets/{provider-settings-CZLKq2oa.js → provider-settings-WmZqlEWG.js} +1 -1
  82. package/dist/ui/assets/provider-store-access-XxfYiVq-.js +1 -0
  83. package/dist/ui/assets/provider-store-access-bqTWCaz8.js +1 -0
  84. package/dist/ui/assets/{providers-xwZovvsP.js → providers-CUOgmyqw.js} +2 -2
  85. package/dist/ui/assets/{providers-TV6NIsPL.js → providers-CnFwVWZQ.js} +1 -1
  86. package/dist/ui/assets/{quick-llm-CruFRi7n.js → quick-llm-TyBh96Nl.js} +1 -1
  87. package/dist/ui/assets/{realm-inprocess-CKEpOeay.js → realm-inprocess-DtJhD5Fl.js} +2 -2
  88. package/dist/ui/assets/{realm-unhandled-rejections-Ab7EMcr4.js → realm-unhandled-rejections-DgtQR_nu.js} +1 -1
  89. package/dist/ui/assets/{realm-unhandled-rejections-DrdoJZTU.js → realm-unhandled-rejections-vs4_4-j5.js} +1 -1
  90. package/dist/ui/assets/{recovery-screen-BHZNLcMl.js → recovery-screen-DCebt00Y.js} +1 -1
  91. package/dist/ui/assets/{remote-terminal-view-B83V8Qzf.js → remote-terminal-view-hFKpOJq6.js} +4 -3
  92. package/dist/ui/assets/{require-guards-Dor7ByR7.js → require-guards-Bo27pPOL.js} +1 -1
  93. package/dist/ui/assets/{restore-D5Y9NVvF.js → restore-zcvXidEG.js} +1 -1
  94. package/dist/ui/assets/run-2WVtdZpl.js +8 -0
  95. package/dist/ui/assets/{run-gr518xGk.js → run-BV9MB7ra.js} +1 -1
  96. package/dist/ui/assets/{run-B1CbbbHn.js → run-C2DCKniQ.js} +1 -1
  97. package/dist/ui/assets/{run-DWA1_d1u.js → run-CS2W694M.js} +2 -2
  98. package/dist/ui/assets/{run-OtfZUGcj.js → run-Cd_VCcVf.js} +2 -2
  99. package/dist/ui/assets/{run-DkflycnX.js → run-CuBHWlsa.js} +2 -2
  100. package/dist/ui/assets/{run-D3Yam1R4.js → run-D_M6FYKF.js} +2 -2
  101. package/dist/ui/assets/{run-Dp-YY09r.js → run-DjxRQ23G.js} +1 -1
  102. package/dist/ui/assets/{run-BKqRP8Pt.js → run-Q7BN7qk3.js} +2 -2
  103. package/dist/ui/assets/{run-yvQfuwPq.js → run-UiQipOb7.js} +1 -1
  104. package/dist/ui/assets/{screencapture-run-CJF_k55t.js → screencapture-run-CBm4TDjf.js} +1 -1
  105. package/dist/ui/assets/{session-command-memory-Di_ppNKR.js → session-command-memory-CcaZsaLQ.js} +2 -2
  106. package/dist/ui/assets/{session-jsonl-sT2AW-s9.js → session-jsonl-BmGkCWUz.js} +1 -1
  107. package/dist/ui/assets/{session-jsonl-BDKaDkEF.js → session-jsonl-DmxnjLdx.js} +1 -1
  108. package/dist/ui/assets/{session-search-index-BD311OX5.js → session-search-index-KJ0_eoRM.js} +1 -1
  109. package/dist/ui/assets/{setup-feature-flags-remote-C0Sedip7.js → setup-feature-flags-remote-C803V0VC.js} +1 -1
  110. package/dist/ui/assets/{setup-model-catalog-BFF0xdNS.js → setup-model-catalog-bxrNmkOq.js} +1 -1
  111. package/dist/ui/assets/{shared-Bi8EHIOr.js → shared-De1sMYMX.js} +4 -4
  112. package/dist/ui/assets/{signed-fetch-BnBm1LRC.js → signed-fetch-CK_GPwxJ.js} +1 -1
  113. package/dist/ui/assets/{silent-renew-backoff-Zup94X9e.js → silent-renew-backoff-CWJs245J.js} +1 -1
  114. package/dist/ui/assets/slicc-version-Da6sXKjo.js +1 -0
  115. package/dist/ui/assets/{snapshot-C-rMXS0v.js → snapshot-CcXAgR24.js} +1 -1
  116. package/dist/ui/assets/{snapshot-features-BGJFBLV3.js → snapshot-features-Bb6rt3T9.js} +1 -1
  117. package/dist/ui/assets/{soundscape-DPMkpYDE.js → soundscape-DWkIHoSH.js} +1 -1
  118. package/dist/ui/assets/{speak-DUcCnV6D.js → speak-bIrefGJW.js} +1 -1
  119. package/dist/ui/assets/{sprinkle-manager-BnLfND_U.js → sprinkle-manager-HaLL6TAH.js} +1 -1
  120. package/dist/ui/assets/{sprinkle-renderer-Daaqfzq4.js → sprinkle-renderer-CH7z9LWi.js} +1 -1
  121. package/dist/ui/assets/{src-tqB6XcSU.js → src-ngGdoF7q.js} +12 -12
  122. package/dist/ui/assets/{ssh-D2rNItRY.js → ssh-HG-JzaxD.js} +1 -1
  123. package/dist/ui/assets/{state-DuLjW_a4.js → state-y36olpuJ.js} +1 -1
  124. package/dist/ui/assets/{store-BXNUAqDB.js → store-DI5uS3CV.js} +1 -1
  125. package/dist/ui/assets/{store-HjKkYqua.js → store-Dy2vvTSi.js} +1 -1
  126. package/dist/ui/assets/{sudo-B65OoUDr.js → sudo-7nF2-79o.js} +1 -1
  127. package/dist/ui/assets/{supervisor-CEzUkfGl.js → supervisor-CEG_pawR.js} +1 -1
  128. package/dist/ui/assets/{sync-dialog-DWj_c3Ea.js → sync-dialog-B28jW7rW.js} +1 -1
  129. package/dist/ui/assets/{transformers-env-BjXj92XS.js → transformers-env-G9ZvPj4i.js} +1 -1
  130. package/dist/ui/assets/{tray-leader-Cf1nSAit.js → tray-leader-CxQceUY8.js} +1 -1
  131. package/dist/ui/assets/{tray-leave-runtime-BoHLFXbM.js → tray-leave-runtime-B7ePnPKy.js} +1 -1
  132. package/dist/ui/assets/{tray-sidecar-C7Cc8eNz.js → tray-sidecar-BlpsBLlK.js} +1 -1
  133. package/dist/ui/assets/{turn-journal-C1eVrq7Y.js → turn-journal-aW8ez41d.js} +1 -1
  134. package/dist/ui/assets/{upgrade-detection-YgD-QcYW.js → upgrade-detection-BpdjDhSG.js} +1 -1
  135. package/dist/ui/assets/{upskill-lick-skip-BeQH8zNC.js → upskill-lick-skip-DLAifByM.js} +1 -1
  136. package/dist/ui/assets/{voice-reply-QkeBs58G.js → voice-reply-DERl1Bi0.js} +1 -1
  137. package/dist/ui/assets/{wc-attach-BVDYvHNr.js → wc-attach-DTYFvNFe.js} +2 -2
  138. package/dist/ui/assets/{wc-browser-Dyx8RrLZ.js → wc-browser-CfT_4eXt.js} +1 -1
  139. package/dist/ui/assets/{wc-computers-CY0ywrNG.js → wc-computers-CZzSDuty.js} +1 -1
  140. package/dist/ui/assets/{wc-detached-DWzA5mFf.js → wc-detached-C-E9uOpQ.js} +1 -1
  141. package/dist/ui/assets/{wc-extension-v381y0tj.js → wc-extension-dtGYhAVK.js} +2 -2
  142. package/dist/ui/assets/{wc-follower-BKeKPCgx.js → wc-follower-gU-qxutC.js} +3 -3
  143. package/dist/ui/assets/{wc-follower-oauth-jDvLJ5_W.js → wc-follower-oauth-BGkJQhXu.js} +1 -1
  144. package/dist/ui/assets/{wc-gelatiere-BuN5Z24F.js → wc-gelatiere-Bwy-mfMy.js} +1 -1
  145. package/dist/ui/assets/{wc-live-BY93WkXA.js → wc-live-DOg7ifPs.js} +5 -5
  146. package/dist/ui/assets/{wc-nav-DhCoJ7Ga.js → wc-nav-Dwr_mhPy.js} +2 -2
  147. package/dist/ui/assets/{wc-onboarding-B1XwN74x.js → wc-onboarding-BE9A-Amw.js} +2 -2
  148. package/dist/ui/assets/{wc-permissions-DAesjSSK.js → wc-permissions-BloJ3nhv.js} +2 -2
  149. package/dist/ui/assets/{wc-placeholder-oCOmyAX6.js → wc-placeholder-C4vxqDp9.js} +3 -3
  150. package/dist/ui/assets/{wc-secret-request-hrqZov3u.js → wc-secret-request-BgFU3Vv4.js} +1 -1
  151. package/dist/ui/assets/{wc-settings-6XtcwxYz.js → wc-settings-D4tUKiOo.js} +3 -3
  152. package/dist/ui/assets/{wc-shell-B4HSSzcL.js → wc-shell-DWs7UK-n.js} +3 -3
  153. package/dist/ui/assets/{wc-shortcut-config-BJZuY_qb.js → wc-shortcut-config-DVN2gtoP.js} +1 -1
  154. package/dist/ui/assets/{wc-sprinkles-CDlry7Bq.js → wc-sprinkles-DKpkBiOU.js} +2 -2
  155. package/dist/ui/assets/{wc-transcript-export-su4AiYik.js → wc-transcript-export-BIr7xQ8r.js} +2 -2
  156. package/dist/ui/assets/{wc-tray-DjO5tw9f.js → wc-tray-CPoilaMn.js} +4 -4
  157. package/dist/ui/assets/welcome-detection-B8xTkXMq.js +1 -0
  158. package/dist/ui/assets/{whisper-session-3nC_uMHL.js → whisper-session-CjnOyfPM.js} +2 -2
  159. package/dist/ui/assets/{xai-grok-CYP2lVaC.js → xai-grok-CKBHF5WO.js} +1 -1
  160. package/dist/ui/assets/{xai-grok-Cfyo0OTy.js → xai-grok-CsjlfFq3.js} +1 -1
  161. package/dist/ui/index.html +3 -3
  162. package/dist/ui/packages/webapp/index.html +3 -3
  163. package/package.json +1 -1
  164. package/dist/ui/assets/provider-store-access-DBSmvoO2.js +0 -1
  165. package/dist/ui/assets/provider-store-access-_IyYl-Xo.js +0 -1
  166. package/dist/ui/assets/run-Bx861p9q.js +0 -7
  167. package/dist/ui/assets/slicc-version-klgPNoH5.js +0 -1
  168. package/dist/ui/assets/welcome-detection-CMSBlwRb.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-DHBvTUIf.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-Bbft7vZj.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-O6zGPogb.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-DvbRhyIc.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-VO3EvqHP.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-Dj0t7hQO.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-3nC_uMHL.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-CjnOyfPM.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-DuLjW_a4.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-y36olpuJ.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,2 +1,2 @@
1
- import{t as e}from"./types-D8gIX-W-.js";import"./fs-B3WU3yr9.js";import{a as t,i as n,n as r,r as i,t as a}from"./global-prefix-DqCuANmV.js";import{D as o,E as s,T as c,w as l}from"./shared-Bi8EHIOr.js";import{r as u,t as d}from"./tar-BWIPCxI2.js";function f(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function p(e){let t=JSON.stringify(e);return[`// ${a}`,`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-C7Qh7l0E.js";import{a as t,i as n,n as r,r as i,t as a}from"./global-prefix-DqCuANmV.js";import{D as o,E as s,T as c,w as l}from"./shared-De1sMYMX.js";import{r as u,t as d}from"./tar-BWIPCxI2.js";function f(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function p(e){let t=JSON.stringify(e);return[`// ${a}`,`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 m=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 h(e,t){if(t.size!==0){await e.exists(`/shared/bin`)||await e.mkdir(r,{recursive:!0});for(let n of t){if(!n||n.includes(`/`))continue;let t=f(r,`${n}.jsh`);if(await e.exists(t)&&!await g(e,t))throw new m(n,t)}}}async function g(e,t){try{let n=await e.readFile(t);return(typeof n==`string`?n:new TextDecoder().decode(n)).includes(a)}catch{return!1}}async function _(e,t){if(!await e.exists(`/shared/bin`)){if(t.size===0)return;await e.mkdir(r,{recursive:!0})}let n=[];try{n=await e.readDir(r)}catch{n=[]}for(let i of n){if(i.type!==`file`||!i.name.endsWith(`.jsh`))continue;let n=i.name.slice(0,-4);if(t.has(n))continue;let a=f(r,i.name);await g(e,a)&&await e.rm(a)}for(let n of t){if(!n||n.includes(`/`))continue;let t=f(r,`${n}.jsh`);if(await e.exists(t)&&!await g(e,t))throw new m(n,t);await e.writeFile(t,p(n))}}function v(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 y(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}function b(e,t){if(t.startsWith(`@`)){let[n,r]=t.split(`/`,2);return y(e,n,r)}return y(e,t)}async function x(e,t){await e.mkdir(t,{recursive:!0})}async function S(e,t){await e.exists(t)&&await e.rm(t,{recursive:!0})}function C(e){return`^${e}`}function w(e,t){let n=e.range.trim();return n===``||n===`*`||n===`latest`||/^[A-Za-z][A-Za-z0-9_-]*$/.test(n)?C(t):n}async function T(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=y(t,n),a=i.lastIndexOf(`/`);a>0&&await x(e,i.slice(0,a)),await e.writeFile(i,r.bytes)}}async function E(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 D(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 O=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`];function k(e,t){return e!==void 0&&Object.hasOwn(e,t)}function A(e,t,n){return n||k(e.devDependencies,t)?`devDependencies`:k(e.optionalDependencies,t)?`optionalDependencies`:k(e.peerDependencies,t)?`peerDependencies`:`dependencies`}function ee(e,t){let n=e[A(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=ee(t,e.name);return n===void 0?e:{name:e.name,range:n}}function ne(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 O)delete n[t][e.name];n[e.section][e.name]=e.range,r.add(e.section)}let i={...e};for(let t of O)(e[t]!==void 0||r.has(t))&&(i[t]=n[t]);return i}function j(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 re(e,t,n){let r=[],i=[],a=new Set;for(let s of e){let e;try{e=v(s)}catch(e){i.push({spec:s,error:M(e)});continue}if(n&&(e=te(e,n)),a.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);o(n,e.range)}catch(e){i.push({spec:s,error:M(e)});continue}r.push({spec:s,parsed:e}),a.add(e.name)}return{directs:r,errors:i}}function M(e){return e instanceof Error?e:Error(String(e))}async function N(e,t,n,r,i){let a=b(t,n.name),o=y(a,`package.json`),c=!1;if(await e.exists(o)&&(await D(e,o,null))?.version===n.version&&(c=!0),!c){let t=await s(n.resolved,r,{timeoutMs:i}),o=u(d(t));await S(e,a),await x(e,a);try{await T(e,a,o)}catch(t){throw await S(e,a),t}}let l=Object.keys(n.dependencies);if(l.length>0){let t=y(a,`node_modules`);await x(e,t);for(let a of l)await N(e,t,n.dependencies[a],r,i)}}async function P(e,t,n,r,i){let a=Object.keys(n.root);if(a.length!==0){await x(e,t);for(let o of a)await N(e,t,n.root[o],r,i)}}function F(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function I(e,t){return typeof e==`string`?{[F(t)]:e}:e}function L(e){return e.replace(/^\.\//,``).replace(/^\/+/,``)}function ie(e){return`#!/usr/bin/env node\nrequire(${JSON.stringify(e)});\n`}async function R(e,t){let n=[];return await z(e,t,0,n),n}async function z(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=y(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 B(e,y(i,t.name),o,n,r)}continue}let i=a.name;await B(e,y(t,a.name),i,n,r)}}async function B(e,t,n,r,i){let a=await D(e,y(t,`package.json`),null);if(a?.bin!==void 0&&a.bin!==null){let e=I(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 z(e,y(t,`node_modules`),r+1,i)}function V(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 H(e,t,n,r){let i=b(e,t.name);if(t.bin!==void 0&&t.bin!==null){let e=I(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=y(i,`node_modules`);for(let e of Object.values(t.dependencies))H(a,e,n+1,r)}function U(e,t){let n=[];for(let r of Object.values(e.root))H(t,r,0,n);return n}function W(e,t){return new Set(V(U(e,t)).keys())}function G(e,t,n){return`..${t.slice(e.length)}/${L(n)}`}async function K(e,t){let n=V(await R(e,t)),r=y(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(y(r,i.name)))}if(n.size!==0){await x(e,r);for(let i of n.values()){let n=y(r,i.binName),a=ie(G(t,i.installDir,i.binPath));await e.writeFile(n,a)}}}async function q(e,t,n){let r=y(t,`package.json`),i=ne(await E(e,r,{}),n);return await e.writeFile(r,`${JSON.stringify(i,null,2)}\n`),r}async function J(e,t){let{fs:r,fetch:a,cwd:o,timeoutMs:s,global:c=!1,saveDev:u=!1}=t;if(e.length===0)return{results:[],errors:[]};let d=c?n:o,f=await E(r,y(d,`package.json`),{}),{supplier:p}=j(a,s),{directs:m,errors:g}=await re(e,p,f);if(m.length===0)return{results:[],errors:g};let v={};if(c)for(let e of Z(f))v[e.name]=e.range;for(let e of m)v[e.parsed.name]=e.parsed.range;let x=await l({rootDependencies:v,fetchPackument:p}),S=c?i:y(o,`node_modules`);if(c&&(await $(r,S,new Set(Object.keys(x.root))),await h(r,W(x,S))),await P(r,S,x,a,s),await K(r,S),c){let e=V(await R(r,S));await _(r,new Set(e.keys()))}let C=await q(r,d,m.map(e=>{let t=x.root[e.parsed.name];if(!t)throw Error(`installer: resolved node missing for ${e.parsed.name}`);return{name:e.parsed.name,range:w(e.parsed,t.version),section:A(f,e.parsed.name,u)}}));return{results:m.map(e=>{let t=x.root[e.parsed.name],n=b(S,e.parsed.name);return{ok:!0,name:e.parsed.name,version:t.version,installPath:n,range:w(e.parsed,t.version),manifestPath:C}}),errors:g}}var Y=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 X(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 ae(e){let t=new Map;return X(t,e.devDependencies),X(t,e.dependencies),Array.from(t.entries()).map(([e,t])=>({name:e,range:t}))}function Z(e){let t=new Map;return X(t,e.dependencies),X(t,e.peerDependencies),X(t,e.optionalDependencies),X(t,e.devDependencies),Array.from(t.entries()).map(([e,t])=>({name:e,range:t}))}async function oe(e){let{fs:t,fetch:n,cwd:r,timeoutMs:i}=e,a=y(r,`package.json`);if(!await t.exists(a))throw new Y(a);let s=ae(await E(t,a,{}));if(s.length===0)return{results:[],errors:[],empty:!0};let{supplier:c}=j(n,i),u=[],d=[];for(let e of s)try{let t=await c(e.name);o(t,e.range),u.push(e)}catch(t){d.push({spec:`${e.name}@${e.range}`,error:M(t)})}if(u.length===0)return{results:[],errors:d,empty:!1};let f={};for(let e of u)f[e.name]=e.range;let p=await l({rootDependencies:f,fetchPackument:c}),m=y(r,`node_modules`);return await P(t,m,p,n,i),await K(t,m),{results:u.map(e=>{let t=p.root[e.name];return t?{ok:!0,name:e.name,version:t.version,installPath:b(m,e.name),range:e.range,manifestPath:a}:null}).filter(e=>e!==null),errors:d,empty:!1}}function se(e,t){return O.some(n=>k(e[n],t))}function Q(e,t){let n={...e};for(let r of O){let i={...e[r]??{}};for(let e of t)delete i[e];e[r]!==void 0&&(n[r]=i)}return n}async function ce(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=y(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 S(e,y(r,t.name))}continue}n.has(i.name)||await S(e,y(t,i.name))}}async function le(e,n,r,a){let o=Z(a??await E(e,t,{}));if(o.length===0){await S(e,i),await _(e,new Set);return}let{supplier:s}=j(n,r),c={};for(let e of o)c[e.name]=e.range;let u=await l({rootDependencies:c,fetchPackument:s});await $(e,i,new Set(Object.keys(u.root))),await h(e,W(u,i)),await P(e,i,u,n,r),await K(e,i);let d=V(await R(e,i));await _(e,new Set(d.keys()))}async function ue(e,t){let{fs:r,fetch:i,cwd:a,timeoutMs:o,global:s=!1}=t;if(e.length===0)return{results:[],errors:[]};let c=new Set,l=[];for(let t of e)try{c.add(v(t).name)}catch(e){l.push({spec:t,error:M(e)})}if(c.size===0)return{results:[],errors:l};let u=y(s?n:a,`package.json`);if(!await r.exists(u)){for(let t of e)l.push({spec:t,error:new Y(u)});return{results:[],errors:l}}let d=await E(r,u,{}),f=[];for(let e of c)f.push({name:e,removed:se(d,e)});let p=Q(d,c);try{s?await le(r,i,o,p):await de(r,i,a,o,p)}catch(t){return l.push({spec:e.join(` `),error:M(t)}),{results:f,errors:l}}return await ce(r,u,p),{results:f,errors:l}}async function de(e,t,n,r,i){let a=y(n,`package.json`),o=Z(i??await E(e,a,{})),s=y(n,`node_modules`);if(o.length===0){await S(e,s);return}let{supplier:c}=j(t,r),u={};for(let e of o)u[e.name]=e.range;let d=await l({rootDependencies:u,fetchPackument:c});await $(e,s,new Set(Object.keys(d.root))),await P(e,s,d,t,r),await K(e,s)}async function fe(e){let n=Z(await E(e,t,{})),r=[];for(let t of n){let n=await D(e,y(b(i,t.name),`package.json`),{});r.push({name:t.name,version:typeof n.version==`string`?n.version:`?`,range:t.range})}return r.sort((e,t)=>e.name.localeCompare(t.name)),r}async function pe(e,t){let n=y(t,`package.json`);if(!await e.exists(n))return[];let r=Z(await E(e,n,{})),i=y(t,`node_modules`),a=[];for(let t of r){let n=await D(e,y(b(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{pe as a,fe as i,oe as n,ue as o,J as r,Y as t};
@@ -1 +1 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import"./core-VO3EvqHP.js";import{previewArgs as t}from"./turn-journal-C1eVrq7Y.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-Dj0t7hQO.js";import{previewArgs as t}from"./turn-journal-aW8ez41d.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,4 +1,4 @@
1
- import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{n,r}from"./fetch-body-CuwTaJC_.js";import{t as i}from"./types-D8gIX-W-.js";import"./fs-B3WU3yr9.js";import{r as a,t as o}from"./subcommand-help-CgO7wRS5.js";import{r as s,t as c}from"./tar-BWIPCxI2.js";var l=e(t(((e,t)=>{var n={};n.array=function(e){var t=0,n=0,r=[0,1,3,7,15,31,63,127,255];return function(i){for(var a=0;i>0;){var o=8-t;i>=o?(a<<=o,a|=r[o]&e[n++],t=0,i-=o):(a<<=i,a|=(e[n]&r[i]<<8-i-t)>>8-i-t,t+=i,i=0)}return a}},n.simple=function(e){var t=n.header(e),r,i,a=[],o=0;do i=n.decompress(e,t),i!=-1&&(a.push(i),o+=i.byteLength);while(i!=-1);r=new Uint8Array(o),o=0;for(var s=0;s<a.length;++s)i=a[s],r.set(i,o),o+=i.byteLength;return r},n.header=function(e){if(e(24)!=4348520)throw`No magic number found`;var t=e(8)-48;if(t<1||t>9)throw`Not a BZIP archive`;return t},n.decompress=function(e,t,n){for(var r=20,i=258,a=0,o=1,s=50,c=9e5,l=``,u=0;u<6;u++)l+=e(8).toString(16);if(l==`177245385090`)return-1;if(l!=`314159265359`)throw`eek not valid bzip data`;if(e(32),e(1))throw`unsupported obsolete version`;var d=e(24);if(d>c)throw`Initial position larger than buffer size`;var f=e(16),p=new Uint8Array(256),m=0;for(u=0;u<16;u++)if(f&1<<15-u){var h=e(16);for(b=0;b<16;b++)h&1<<15-b&&(p[m++]=16*u+b)}var g=e(3);if(g<2||g>6)throw`another error`;var _=e(15);if(_==0)throw`meh`;for(var v=[],u=0;u<g;u++)v[u]=u;for(var y=new Uint8Array(32768),u=0;u<_;u++){for(var b=0;e(1);b++)if(b>=g)throw`whoops another error`;var x=v[b];v.splice(b,1),v.splice(0,0,x),y[u]=x}for(var S=m+2,C=[],b=0;b<g;b++){var w=new Uint8Array(i),T=new Uint8Array(r+1);f=e(5);for(var u=0;u<S;u++){for(;;){if(f<1||f>r)throw`I gave up a while ago on writing error messages`;if(!e(1))break;e(1)?f--:f++}w[u]=f}for(var E=D=w[0],D,u=1;u<S;u++)w[u]>D?D=w[u]:w[u]<E&&(E=w[u]);var O=C[b]={};O.permute=new Uint32Array(i),O.limit=new Uint32Array(r+1),O.base=new Uint32Array(r+1),O.minLen=E,O.maxLen=D;for(var k=O.base.subarray(1),A=O.limit.subarray(1),j=0,u=E;u<=D;u++)for(var f=0;f<S;f++)w[f]==u&&(O.permute[j++]=f);for(u=E;u<=D;u++)T[u]=A[u]=0;for(u=0;u<S;u++)T[w[u]]++;for(j=f=0,u=E;u<D;u++)j+=T[u],A[u]=j-1,j<<=1,k[u+1]=j-(f+=T[u]);A[D]=j+T[D]-1,k[E]=0}for(var M=new Uint32Array(256),u=0;u<256;u++)v[u]=u;for(var N=P=S=F=0,P,S,F,I=new Uint32Array(c);;){if(!S--){if(S=s-1,F>=_)throw`meow i'm a kitty, that's an error`;O=C[y[F++]],k=O.base.subarray(1),A=O.limit.subarray(1)}for(u=O.minLen,b=e(u);;){if(u>O.maxLen)throw`rawr i'm a dinosaur`;if(b<=A[u])break;u++,b=b<<1|e(1)}if(b-=k[u],b<0||b>=i)throw`moo i'm a cow`;var L=O.permute[b];if(L==a||L==o){N||(N=1,f=0),f+=L==a?N:2*N,N<<=1;continue}if(N){if(N=0,P+f>=c)throw`Boom.`;for(x=p[v[0]],M[x]+=f;f--;)I[P++]=x}if(L>m)break;if(P>=c)throw`I can't think of anything. Error`;u=L-1,x=v[u],v.splice(u,1),v.splice(0,0,x),x=p[x],M[x]++,I[P++]=x}if(d<0||d>=P)throw`I'm a monkey and I'm throwing something at someone, namely you`;for(var b=0,u=0;u<256;u++)h=b+M[u],M[u]=b,b=h;for(var u=0;u<P;u++)x=I[u]&255,I[M[x]]|=u<<8,M[x]++;var R=0,z=0,B=0;P&&(R=I[d],z=R&255,R>>=8,B=-1),P=P;var V=new Uint8Array(c),H,U,W,G=0;for(n||=1/0;P;){for(P--,U=z,R=I[R],z=R&255,R>>=8,B++==3?(H=z,W=U,z=-1):(H=1,W=z);H--;)if(V[G++]=W,!--n)return V;z!=U&&(B=0)}return V.subarray(0,G)},t.exports=n}))(),1);function u(e,t){let n=e.replace(/\\/g,`/`).replace(/^\/+/,``);if(!n||n.split(`/`).some(e=>e===`..`))throw Error(`${t}: refusing to extract entry escaping package root: ${e}`);return n}function d(e,t){let n=[];for(let r of e){if(!r.path)continue;let e=u(r.path,t);if(r.symlink!==void 0){if(r.symlink.split(`/`).some(e=>e===`..`))throw Error(`${t}: refusing symlink '${e}' -> '${r.symlink}' (path escape)`);n.push({path:e,bytes:new Uint8Array,symlink:r.symlink});continue}n.push({path:e,bytes:r.bytes,...r.directory?{directory:!0}:{}})}return n}function f(e){if(!(e instanceof Uint8Array))throw Error(`bunzip2: input must be a Uint8Array`);if(e.length<4||e[0]!==66||e[1]!==90)throw Error(`bunzip2: input is not a valid bzip2 stream (bad magic)`);try{let t=l.default.simple(l.default.array(e));return Uint8Array.from(t)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`bunzip2: failed to decompress (${t})`)}}function p(e,t){let n=t.toLowerCase(),r=`extractCondaArchive(${t})`;if(n.endsWith(`.conda`))throw Error(`${r}: .conda (zip+zstd) packages are not supported yet; emscripten-forge currently ships .tar.bz2 — use that format`);let i;if(n.endsWith(`.tar.bz2`)||n.endsWith(`.tbz2`))i=f(e);else if(n.endsWith(`.tar.gz`)||n.endsWith(`.tgz`))i=c(e);else if(n.endsWith(`.tar`))i=e;else throw Error(`${r}: unsupported archive type (expected .tar.bz2, .tar.gz, or .tar)`);return d(s(i,{stripNpmPrefix:!1,includeDirectories:!1,includeSymlinks:!0,preserveRawPaths:!1}),r)}const m=`/shared/lib/conda`,h=[`https://repo.prefix.dev/emscripten-forge-4x`,`https://repo.prefix.dev/conda-forge`],g=new Set([`repo.prefix.dev`,`prefix.dev`]);function _(e,t,n){let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(`${n}: timed out after ${t}ms`)),Math.max(1,t))});return Promise.race([e,i]).finally(()=>{r!==void 0&&clearTimeout(r)})}function v(e,t){let n;try{n=new URL(e)}catch{throw Error(`${t}: URL is not a valid absolute URL`)}if(n.protocol!==`https:`)throw Error(`${t}: refused protocol '${n.protocol}' (expected 'https:')`);if(!g.has(n.hostname))throw Error(`${t}: refused host '${n.hostname}' (allowed: ${[...g].join(`, `)})`);return n}function y(e,t){let n=e.statusText?` ${e.statusText}`:``;return`${t} returned HTTP ${e.status}${n}`.trim()}function b(e){let t=(e??``).trim();if(!t)throw Error(`ipk mamba: package spec is required`);if(t.startsWith(`-`))throw Error(`ipk mamba: invalid package spec '${t}'`);let n=t.indexOf(`=`);if(n===-1)return{name:t,version:``};let r=t.slice(0,n),i=t.slice(n+1);if(i.startsWith(`=`)&&(i=i.slice(1)),!r||!i)throw Error(`ipk mamba: invalid package spec '${t}' (expected name=version)`);return{name:r,version:i}}function x(e,t,n){return`${e.replace(/\/+$/,``)}/${t}/${n}`}function S(e,t){return x(e,t,`repodata.json`)}function C(e,t){let n=e.build_number??0,r=t.build_number??0;return n===r?(e.timestamp??0)-(t.timestamp??0):n-r}function w(e,t){let n=e.split(/[.+_-]/).map(e=>/^\d+$/.test(e)?Number(e):e),r=t.split(/[.+_-]/).map(e=>/^\d+$/.test(e)?Number(e):e),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e]??0,i=r[e]??0;if(typeof t==`number`&&typeof i==`number`){if(t!==i)return t-i;continue}let a=String(t),o=String(i);if(a!==o)return a<o?-1:1}return 0}async function T(e,t,r={}){let i=S(e,r.subdir??`emscripten-wasm32`),a=`fetchRepodata(${i})`;v(i,a);let o=r.timeoutMs??6e4,s;try{s=await _(t(i,{method:`GET`,headers:{Accept:`application/json`},timeoutMs:o}),o,a)}catch(e){if(e instanceof Error&&/timed out/.test(e.message))throw e;let t=e instanceof Error?e.message:String(e);throw Error(`${a}: ${t}`)}if(s.status<200||s.status>=300)throw Error(y(s,a));if(s.body==null||typeof s.body==`string`&&s.body===``)throw Error(`${a}: empty body`);try{return JSON.parse(n(s.body))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`${a}: invalid JSON (${t})`)}}function E(e,t){let n=[];for(let[r,i]of[[`packages`,e.packages??{}],[`packages.conda`,e[`packages.conda`]??{}]])for(let[e,r]of Object.entries(i))e.toLowerCase().endsWith(`.conda`)||n.push({...r,channel:t,filename:e});return n}async function D(e,t,n){let r=`${e}|${t}`,i=n.indexes?.get(r);if(i)return i;try{let i=await T(e,n.fetch,{subdir:t,timeoutMs:n.timeoutMs});return n.indexes?.set(r,i),i}catch(e){if(t===`noarch`)return null;throw e}}function O(e,t,n,r){let i=[];for(let a of E(e,t))a.name===r.name&&(r.version&&a.version!==r.version||i.push({...a,subdir:a.subdir??n}));return i}function k(e,t){let n=e=>{let n=t.indexOf(e);return n===-1?t.length:n};return e.sort((e,t)=>{let r=w(e.version,t.version);if(r!==0)return r;let i=n(e.channel),a=n(t.channel);return i===a?C(e,t):a-i}),e[e.length-1]}async function A(e,t){let n=typeof e==`string`?b(e):e,r=t.channels??h,i=t.platform??`emscripten-wasm32`,a=t.includeNoarch??!0?[i,`noarch`]:[i],o=[];for(let e of r)for(let r of a){let i=await D(e,r,t);i&&o.push(...O(i,e,r,n))}if(o.length===0){let e=n.version?`${n.name}=${n.version}`:n.name;throw Error(`ipk mamba: package '${e}' not found on ${r.join(`, `)} (platform ${i})`)}return k(o,r)}function j(e){let t=e.subdir??`emscripten-wasm32`;return x(e.channel,t,e.filename)}async function M(e,t,n={}){let i=j(e),a=`downloadCondaPackage(${i})`;v(i,a);let o=n.timeoutMs??12e4,s;try{s=await _(t(i,{method:`GET`,headers:{Accept:`application/octet-stream`},timeoutMs:o}),o,a)}catch(e){if(e instanceof Error&&/timed out/.test(e.message))throw e;let t=e instanceof Error?e.message:String(e);throw Error(`${a}: ${t}`)}if(s.status<200||s.status>=300)throw Error(y(s,a));if(s.body==null||typeof s.body==`string`&&s.body===``)throw Error(`${a}: empty body`);let c=r(s.body);if(c.length===0)throw Error(`${a}: empty body`);return c}function N(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}async function P(e,t){await e.mkdir(t,{recursive:!0})}async function F(e,t){await e.exists(t)&&await e.rm(t,{recursive:!0})}function I(e){return`${e.name}-${e.version}-${e.build}.json`}function L(e,t){return N(e,`conda-meta`,I(t))}function R(e){let t=e.find(e=>e.path===`info/paths.json`&&!e.symlink);if(!t)return new Map;try{let e=JSON.parse(new TextDecoder().decode(t.bytes)),n=new Map;for(let t of e.paths??[])typeof t._path==`string`&&typeof t.prefix_placeholder==`string`&&t.prefix_placeholder.length>0&&n.set(t._path,t.prefix_placeholder);return n}catch{return new Map}}function z(e,t,n,r){let i=new TextEncoder,a=i.encode(t);if(a.length===0)return e;if(r===`text`){let r=new TextDecoder(`utf-8`,{fatal:!1}).decode(e);return r.includes(t)?i.encode(r.split(t).join(n)):e}let o=i.encode(n);if(o.length>a.length){let r=new TextDecoder(`utf-8`,{fatal:!1}).decode(e);return r.includes(t)?i.encode(r.split(t).join(n)):e}let s=new Uint8Array(e);for(let e=0;e<=s.length-a.length;e++){let t=!0;for(let n=0;n<a.length;n++)if(s[e+n]!==a[n]){t=!1;break}t&&(s.set(o,e),s.fill(0,e+o.length,e+a.length),e+=a.length-1)}return s}async function B(e,t,n){let r=R(n),i=new Map,a=n.find(e=>e.path===`info/paths.json`&&!e.symlink);if(a)try{let e=JSON.parse(new TextDecoder().decode(a.bytes));for(let t of e.paths??[])typeof t._path==`string`&&i.set(t._path,t)}catch{}let o=[],s=n.filter(e=>!e.symlink&&!e.directory),c=n.filter(e=>e.symlink);for(let n of s){if(n.path===`info`||n.path.startsWith(`info/`))continue;let a=N(t,n.path),s=a.lastIndexOf(`/`);s>0&&await P(e,a.slice(0,s));let c=n.bytes,l=r.get(n.path);l&&(c=z(c,l,t,i.get(n.path)?.file_mode)),await e.writeFile(a,c),o.push(n.path)}let l=[];for(let e of c){if(e.path===`info`||e.path.startsWith(`info/`))continue;let n=N(t,e.path);l.push({target:e.symlink,path:n}),o.push(e.path)}return l.length>0&&await e.symlinkBatch(l),o}async function V(e,t,n,r){await P(e,N(t,`conda-meta`));let i={name:n.name,version:n.version,build:n.build,build_number:n.build_number??0,channel:n.channel,filename:n.filename,depends:n.depends??[],files:r,paths_data:r.map(e=>({_path:e})),extracted_package_dir:``,requested_spec:`${n.name}=${n.version}=${n.build}`};await e.writeFile(L(t,n),`${JSON.stringify(i,null,2)}\n`)}async function H(e,t){let n=t.prefix??`/shared/lib/conda`,r=await A(e,{fetch:t.fetch,channels:t.channels??h,platform:t.platform,timeoutMs:t.timeoutMs,indexes:t.indexes}),i=p(await M(r,t.fetch,{timeoutMs:t.timeoutMs}),r.filename);await P(t.fs,n);let a=await G(t.fs,n);for(let e of a.filter(e=>e.name===r.name))await K(e.name,{fs:t.fs,prefix:n});let o=await B(t.fs,n,i);return await V(t.fs,n,r,o),{ok:!0,name:r.name,version:r.version,build:r.build,prefix:n,filename:r.filename,files:o.length,channel:r.channel}}async function U(e,t){let n=[],r=[],i=t.indexes??new Map;for(let a of e)try{b(a);let e=await H(a,{...t,indexes:i});n.push(e)}catch(e){r.push({spec:a,error:e instanceof Error?e:Error(String(e))})}return{results:n,errors:r}}async function W(e,t){try{let n=await e.readFile(t,{encoding:`utf-8`});return JSON.parse(n)}catch(e){if(e instanceof i&&e.code===`ENOENT`||e instanceof Error&&/ENOENT/.test(e.message))return null;throw e}}async function G(e,t=m){let n=N(t,`conda-meta`);if(!await e.exists(n))return[];let r;try{r=(await e.readDir(n)).map(e=>e.name).filter(e=>e.endsWith(`.json`))}catch{return[]}let i=[];for(let t of r.sort()){let r=await W(e,N(n,t));!r?.name||!r.version||!r.build||i.push({name:r.name,version:r.version,build:r.build,channel:r.channel,filename:r.filename,files:Array.isArray(r.files)?r.files:[]})}return i}async function K(e,t){let n=t.prefix??`/shared/lib/conda`,r=(await G(t.fs,n)).find(t=>t.name===e);if(!r)return{name:e,removed:!1};for(let e of r.files)await F(t.fs,N(n,e));return await F(t.fs,L(n,r)),{name:e,removed:!0,version:r.version,build:r.build}}async function q(e,t){let n=[],r=[];for(let i of e)try{n.push(await K(i,t))}catch(e){r.push({spec:i,error:e instanceof Error?e:Error(String(e))})}return{results:n,errors:r}}const J=new Set([`install`,`i`,`add`]),Y=new Set([`uninstall`,`remove`,`rm`,`un`]),X=new Set([`list`,`ls`]);function Z(e){return`${e} mamba - install emscripten-wasm32 packages from conda/emscripten-forge
1
+ import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{n,r}from"./fetch-body-CuwTaJC_.js";import{t as i}from"./types-D8gIX-W-.js";import"./fs-C7Qh7l0E.js";import{r as a,t as o}from"./subcommand-help-CgO7wRS5.js";import{r as s,t as c}from"./tar-BWIPCxI2.js";var l=e(t(((e,t)=>{var n={};n.array=function(e){var t=0,n=0,r=[0,1,3,7,15,31,63,127,255];return function(i){for(var a=0;i>0;){var o=8-t;i>=o?(a<<=o,a|=r[o]&e[n++],t=0,i-=o):(a<<=i,a|=(e[n]&r[i]<<8-i-t)>>8-i-t,t+=i,i=0)}return a}},n.simple=function(e){var t=n.header(e),r,i,a=[],o=0;do i=n.decompress(e,t),i!=-1&&(a.push(i),o+=i.byteLength);while(i!=-1);r=new Uint8Array(o),o=0;for(var s=0;s<a.length;++s)i=a[s],r.set(i,o),o+=i.byteLength;return r},n.header=function(e){if(e(24)!=4348520)throw`No magic number found`;var t=e(8)-48;if(t<1||t>9)throw`Not a BZIP archive`;return t},n.decompress=function(e,t,n){for(var r=20,i=258,a=0,o=1,s=50,c=9e5,l=``,u=0;u<6;u++)l+=e(8).toString(16);if(l==`177245385090`)return-1;if(l!=`314159265359`)throw`eek not valid bzip data`;if(e(32),e(1))throw`unsupported obsolete version`;var d=e(24);if(d>c)throw`Initial position larger than buffer size`;var f=e(16),p=new Uint8Array(256),m=0;for(u=0;u<16;u++)if(f&1<<15-u){var h=e(16);for(b=0;b<16;b++)h&1<<15-b&&(p[m++]=16*u+b)}var g=e(3);if(g<2||g>6)throw`another error`;var _=e(15);if(_==0)throw`meh`;for(var v=[],u=0;u<g;u++)v[u]=u;for(var y=new Uint8Array(32768),u=0;u<_;u++){for(var b=0;e(1);b++)if(b>=g)throw`whoops another error`;var x=v[b];v.splice(b,1),v.splice(0,0,x),y[u]=x}for(var S=m+2,C=[],b=0;b<g;b++){var w=new Uint8Array(i),T=new Uint8Array(r+1);f=e(5);for(var u=0;u<S;u++){for(;;){if(f<1||f>r)throw`I gave up a while ago on writing error messages`;if(!e(1))break;e(1)?f--:f++}w[u]=f}for(var E=D=w[0],D,u=1;u<S;u++)w[u]>D?D=w[u]:w[u]<E&&(E=w[u]);var O=C[b]={};O.permute=new Uint32Array(i),O.limit=new Uint32Array(r+1),O.base=new Uint32Array(r+1),O.minLen=E,O.maxLen=D;for(var k=O.base.subarray(1),A=O.limit.subarray(1),j=0,u=E;u<=D;u++)for(var f=0;f<S;f++)w[f]==u&&(O.permute[j++]=f);for(u=E;u<=D;u++)T[u]=A[u]=0;for(u=0;u<S;u++)T[w[u]]++;for(j=f=0,u=E;u<D;u++)j+=T[u],A[u]=j-1,j<<=1,k[u+1]=j-(f+=T[u]);A[D]=j+T[D]-1,k[E]=0}for(var M=new Uint32Array(256),u=0;u<256;u++)v[u]=u;for(var N=P=S=F=0,P,S,F,I=new Uint32Array(c);;){if(!S--){if(S=s-1,F>=_)throw`meow i'm a kitty, that's an error`;O=C[y[F++]],k=O.base.subarray(1),A=O.limit.subarray(1)}for(u=O.minLen,b=e(u);;){if(u>O.maxLen)throw`rawr i'm a dinosaur`;if(b<=A[u])break;u++,b=b<<1|e(1)}if(b-=k[u],b<0||b>=i)throw`moo i'm a cow`;var L=O.permute[b];if(L==a||L==o){N||(N=1,f=0),f+=L==a?N:2*N,N<<=1;continue}if(N){if(N=0,P+f>=c)throw`Boom.`;for(x=p[v[0]],M[x]+=f;f--;)I[P++]=x}if(L>m)break;if(P>=c)throw`I can't think of anything. Error`;u=L-1,x=v[u],v.splice(u,1),v.splice(0,0,x),x=p[x],M[x]++,I[P++]=x}if(d<0||d>=P)throw`I'm a monkey and I'm throwing something at someone, namely you`;for(var b=0,u=0;u<256;u++)h=b+M[u],M[u]=b,b=h;for(var u=0;u<P;u++)x=I[u]&255,I[M[x]]|=u<<8,M[x]++;var R=0,z=0,B=0;P&&(R=I[d],z=R&255,R>>=8,B=-1),P=P;var V=new Uint8Array(c),H,U,W,G=0;for(n||=1/0;P;){for(P--,U=z,R=I[R],z=R&255,R>>=8,B++==3?(H=z,W=U,z=-1):(H=1,W=z);H--;)if(V[G++]=W,!--n)return V;z!=U&&(B=0)}return V.subarray(0,G)},t.exports=n}))(),1);function u(e,t){let n=e.replace(/\\/g,`/`).replace(/^\/+/,``);if(!n||n.split(`/`).some(e=>e===`..`))throw Error(`${t}: refusing to extract entry escaping package root: ${e}`);return n}function d(e,t){let n=[];for(let r of e){if(!r.path)continue;let e=u(r.path,t);if(r.symlink!==void 0){if(r.symlink.split(`/`).some(e=>e===`..`))throw Error(`${t}: refusing symlink '${e}' -> '${r.symlink}' (path escape)`);n.push({path:e,bytes:new Uint8Array,symlink:r.symlink});continue}n.push({path:e,bytes:r.bytes,...r.directory?{directory:!0}:{}})}return n}function f(e){if(!(e instanceof Uint8Array))throw Error(`bunzip2: input must be a Uint8Array`);if(e.length<4||e[0]!==66||e[1]!==90)throw Error(`bunzip2: input is not a valid bzip2 stream (bad magic)`);try{let t=l.default.simple(l.default.array(e));return Uint8Array.from(t)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`bunzip2: failed to decompress (${t})`)}}function p(e,t){let n=t.toLowerCase(),r=`extractCondaArchive(${t})`;if(n.endsWith(`.conda`))throw Error(`${r}: .conda (zip+zstd) packages are not supported yet; emscripten-forge currently ships .tar.bz2 — use that format`);let i;if(n.endsWith(`.tar.bz2`)||n.endsWith(`.tbz2`))i=f(e);else if(n.endsWith(`.tar.gz`)||n.endsWith(`.tgz`))i=c(e);else if(n.endsWith(`.tar`))i=e;else throw Error(`${r}: unsupported archive type (expected .tar.bz2, .tar.gz, or .tar)`);return d(s(i,{stripNpmPrefix:!1,includeDirectories:!1,includeSymlinks:!0,preserveRawPaths:!1}),r)}const m=`/shared/lib/conda`,h=[`https://repo.prefix.dev/emscripten-forge-4x`,`https://repo.prefix.dev/conda-forge`],g=new Set([`repo.prefix.dev`,`prefix.dev`]);function _(e,t,n){let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(`${n}: timed out after ${t}ms`)),Math.max(1,t))});return Promise.race([e,i]).finally(()=>{r!==void 0&&clearTimeout(r)})}function v(e,t){let n;try{n=new URL(e)}catch{throw Error(`${t}: URL is not a valid absolute URL`)}if(n.protocol!==`https:`)throw Error(`${t}: refused protocol '${n.protocol}' (expected 'https:')`);if(!g.has(n.hostname))throw Error(`${t}: refused host '${n.hostname}' (allowed: ${[...g].join(`, `)})`);return n}function y(e,t){let n=e.statusText?` ${e.statusText}`:``;return`${t} returned HTTP ${e.status}${n}`.trim()}function b(e){let t=(e??``).trim();if(!t)throw Error(`ipk mamba: package spec is required`);if(t.startsWith(`-`))throw Error(`ipk mamba: invalid package spec '${t}'`);let n=t.indexOf(`=`);if(n===-1)return{name:t,version:``};let r=t.slice(0,n),i=t.slice(n+1);if(i.startsWith(`=`)&&(i=i.slice(1)),!r||!i)throw Error(`ipk mamba: invalid package spec '${t}' (expected name=version)`);return{name:r,version:i}}function x(e,t,n){return`${e.replace(/\/+$/,``)}/${t}/${n}`}function S(e,t){return x(e,t,`repodata.json`)}function C(e,t){let n=e.build_number??0,r=t.build_number??0;return n===r?(e.timestamp??0)-(t.timestamp??0):n-r}function w(e,t){let n=e.split(/[.+_-]/).map(e=>/^\d+$/.test(e)?Number(e):e),r=t.split(/[.+_-]/).map(e=>/^\d+$/.test(e)?Number(e):e),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e]??0,i=r[e]??0;if(typeof t==`number`&&typeof i==`number`){if(t!==i)return t-i;continue}let a=String(t),o=String(i);if(a!==o)return a<o?-1:1}return 0}async function T(e,t,r={}){let i=S(e,r.subdir??`emscripten-wasm32`),a=`fetchRepodata(${i})`;v(i,a);let o=r.timeoutMs??6e4,s;try{s=await _(t(i,{method:`GET`,headers:{Accept:`application/json`},timeoutMs:o}),o,a)}catch(e){if(e instanceof Error&&/timed out/.test(e.message))throw e;let t=e instanceof Error?e.message:String(e);throw Error(`${a}: ${t}`)}if(s.status<200||s.status>=300)throw Error(y(s,a));if(s.body==null||typeof s.body==`string`&&s.body===``)throw Error(`${a}: empty body`);try{return JSON.parse(n(s.body))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`${a}: invalid JSON (${t})`)}}function E(e,t){let n=[];for(let[r,i]of[[`packages`,e.packages??{}],[`packages.conda`,e[`packages.conda`]??{}]])for(let[e,r]of Object.entries(i))e.toLowerCase().endsWith(`.conda`)||n.push({...r,channel:t,filename:e});return n}async function D(e,t,n){let r=`${e}|${t}`,i=n.indexes?.get(r);if(i)return i;try{let i=await T(e,n.fetch,{subdir:t,timeoutMs:n.timeoutMs});return n.indexes?.set(r,i),i}catch(e){if(t===`noarch`)return null;throw e}}function O(e,t,n,r){let i=[];for(let a of E(e,t))a.name===r.name&&(r.version&&a.version!==r.version||i.push({...a,subdir:a.subdir??n}));return i}function k(e,t){let n=e=>{let n=t.indexOf(e);return n===-1?t.length:n};return e.sort((e,t)=>{let r=w(e.version,t.version);if(r!==0)return r;let i=n(e.channel),a=n(t.channel);return i===a?C(e,t):a-i}),e[e.length-1]}async function A(e,t){let n=typeof e==`string`?b(e):e,r=t.channels??h,i=t.platform??`emscripten-wasm32`,a=t.includeNoarch??!0?[i,`noarch`]:[i],o=[];for(let e of r)for(let r of a){let i=await D(e,r,t);i&&o.push(...O(i,e,r,n))}if(o.length===0){let e=n.version?`${n.name}=${n.version}`:n.name;throw Error(`ipk mamba: package '${e}' not found on ${r.join(`, `)} (platform ${i})`)}return k(o,r)}function j(e){let t=e.subdir??`emscripten-wasm32`;return x(e.channel,t,e.filename)}async function M(e,t,n={}){let i=j(e),a=`downloadCondaPackage(${i})`;v(i,a);let o=n.timeoutMs??12e4,s;try{s=await _(t(i,{method:`GET`,headers:{Accept:`application/octet-stream`},timeoutMs:o}),o,a)}catch(e){if(e instanceof Error&&/timed out/.test(e.message))throw e;let t=e instanceof Error?e.message:String(e);throw Error(`${a}: ${t}`)}if(s.status<200||s.status>=300)throw Error(y(s,a));if(s.body==null||typeof s.body==`string`&&s.body===``)throw Error(`${a}: empty body`);let c=r(s.body);if(c.length===0)throw Error(`${a}: empty body`);return c}function N(e,...t){return`/${[e,...t].join(`/`).split(`/`).filter(e=>e.length>0).join(`/`)}`}async function P(e,t){await e.mkdir(t,{recursive:!0})}async function F(e,t){await e.exists(t)&&await e.rm(t,{recursive:!0})}function I(e){return`${e.name}-${e.version}-${e.build}.json`}function L(e,t){return N(e,`conda-meta`,I(t))}function R(e){let t=e.find(e=>e.path===`info/paths.json`&&!e.symlink);if(!t)return new Map;try{let e=JSON.parse(new TextDecoder().decode(t.bytes)),n=new Map;for(let t of e.paths??[])typeof t._path==`string`&&typeof t.prefix_placeholder==`string`&&t.prefix_placeholder.length>0&&n.set(t._path,t.prefix_placeholder);return n}catch{return new Map}}function z(e,t,n,r){let i=new TextEncoder,a=i.encode(t);if(a.length===0)return e;if(r===`text`){let r=new TextDecoder(`utf-8`,{fatal:!1}).decode(e);return r.includes(t)?i.encode(r.split(t).join(n)):e}let o=i.encode(n);if(o.length>a.length){let r=new TextDecoder(`utf-8`,{fatal:!1}).decode(e);return r.includes(t)?i.encode(r.split(t).join(n)):e}let s=new Uint8Array(e);for(let e=0;e<=s.length-a.length;e++){let t=!0;for(let n=0;n<a.length;n++)if(s[e+n]!==a[n]){t=!1;break}t&&(s.set(o,e),s.fill(0,e+o.length,e+a.length),e+=a.length-1)}return s}async function B(e,t,n){let r=R(n),i=new Map,a=n.find(e=>e.path===`info/paths.json`&&!e.symlink);if(a)try{let e=JSON.parse(new TextDecoder().decode(a.bytes));for(let t of e.paths??[])typeof t._path==`string`&&i.set(t._path,t)}catch{}let o=[],s=n.filter(e=>!e.symlink&&!e.directory),c=n.filter(e=>e.symlink);for(let n of s){if(n.path===`info`||n.path.startsWith(`info/`))continue;let a=N(t,n.path),s=a.lastIndexOf(`/`);s>0&&await P(e,a.slice(0,s));let c=n.bytes,l=r.get(n.path);l&&(c=z(c,l,t,i.get(n.path)?.file_mode)),await e.writeFile(a,c),o.push(n.path)}let l=[];for(let e of c){if(e.path===`info`||e.path.startsWith(`info/`))continue;let n=N(t,e.path);l.push({target:e.symlink,path:n}),o.push(e.path)}return l.length>0&&await e.symlinkBatch(l),o}async function V(e,t,n,r){await P(e,N(t,`conda-meta`));let i={name:n.name,version:n.version,build:n.build,build_number:n.build_number??0,channel:n.channel,filename:n.filename,depends:n.depends??[],files:r,paths_data:r.map(e=>({_path:e})),extracted_package_dir:``,requested_spec:`${n.name}=${n.version}=${n.build}`};await e.writeFile(L(t,n),`${JSON.stringify(i,null,2)}\n`)}async function H(e,t){let n=t.prefix??`/shared/lib/conda`,r=await A(e,{fetch:t.fetch,channels:t.channels??h,platform:t.platform,timeoutMs:t.timeoutMs,indexes:t.indexes}),i=p(await M(r,t.fetch,{timeoutMs:t.timeoutMs}),r.filename);await P(t.fs,n);let a=await G(t.fs,n);for(let e of a.filter(e=>e.name===r.name))await K(e.name,{fs:t.fs,prefix:n});let o=await B(t.fs,n,i);return await V(t.fs,n,r,o),{ok:!0,name:r.name,version:r.version,build:r.build,prefix:n,filename:r.filename,files:o.length,channel:r.channel}}async function U(e,t){let n=[],r=[],i=t.indexes??new Map;for(let a of e)try{b(a);let e=await H(a,{...t,indexes:i});n.push(e)}catch(e){r.push({spec:a,error:e instanceof Error?e:Error(String(e))})}return{results:n,errors:r}}async function W(e,t){try{let n=await e.readFile(t,{encoding:`utf-8`});return JSON.parse(n)}catch(e){if(e instanceof i&&e.code===`ENOENT`||e instanceof Error&&/ENOENT/.test(e.message))return null;throw e}}async function G(e,t=m){let n=N(t,`conda-meta`);if(!await e.exists(n))return[];let r;try{r=(await e.readDir(n)).map(e=>e.name).filter(e=>e.endsWith(`.json`))}catch{return[]}let i=[];for(let t of r.sort()){let r=await W(e,N(n,t));!r?.name||!r.version||!r.build||i.push({name:r.name,version:r.version,build:r.build,channel:r.channel,filename:r.filename,files:Array.isArray(r.files)?r.files:[]})}return i}async function K(e,t){let n=t.prefix??`/shared/lib/conda`,r=(await G(t.fs,n)).find(t=>t.name===e);if(!r)return{name:e,removed:!1};for(let e of r.files)await F(t.fs,N(n,e));return await F(t.fs,L(n,r)),{name:e,removed:!0,version:r.version,build:r.build}}async function q(e,t){let n=[],r=[];for(let i of e)try{n.push(await K(i,t))}catch(e){r.push({spec:i,error:e instanceof Error?e:Error(String(e))})}return{results:n,errors:r}}const J=new Set([`install`,`i`,`add`]),Y=new Set([`uninstall`,`remove`,`rm`,`un`]),X=new Set([`list`,`ls`]);function Z(e){return`${e} mamba - install emscripten-wasm32 packages from conda/emscripten-forge
2
2
 
3
3
  Usage:
4
4
  ${e} mamba install <pkg>[=<version>] ...