sliccy 6.239.1 → 6.240.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/ui/.vite/manifest.json +206 -206
  2. package/dist/ui/assets/{account-store-BspEP7gu.js → account-store-Co7p6uLK.js} +1 -1
  3. package/dist/ui/assets/{account-store-BMuQVHFz.js → account-store-Dcuv1CAr.js} +1 -1
  4. package/dist/ui/assets/{adobe-lvs94eE-.js → adobe-C8D8r5Fe.js} +1 -1
  5. package/dist/ui/assets/{adobe-Bno0A9Rh.js → adobe-DScuixZ8.js} +1 -1
  6. package/dist/ui/assets/{agent-panels-Dw3EUkgf.js → agent-panels-O5YJfC1_.js} +1 -1
  7. package/dist/ui/assets/{almost-bash-shell-headless-DjH45LFx.js → almost-bash-shell-headless-C4AVF2S6.js} +15 -15
  8. package/dist/ui/assets/{apply-layout-OjpkOPJI.js → apply-layout-BZ9iuS4D.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-BPfNF8uA.js → azure-openai-DGNroO-7.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-Dd5EJ5OF.js → azure-openai-jPUEdFGb.js} +1 -1
  11. package/dist/ui/assets/{cdp-C1aEyl98.js → cdp-DfHqMmOw.js} +1 -1
  12. package/dist/ui/assets/{cerebras-CCfRW5qr.js → cerebras--GK0UhYQ.js} +1 -1
  13. package/dist/ui/assets/{cerebras-BIXXLNra.js → cerebras-DJsSEczS.js} +1 -1
  14. package/dist/ui/assets/{composer-speech-CGejp4Op.js → composer-speech-Bdzozil9.js} +1 -1
  15. package/dist/ui/assets/{connect-surface-C-YnHz9O.js → connect-surface-BQ_yaiI0.js} +1 -1
  16. package/dist/ui/assets/{directed-approval-Dqeeo7Ur.js → directed-approval-CM6zsUB_.js} +1 -1
  17. package/dist/ui/assets/{emscripten-vfs-hook-DIUvgf55.js → emscripten-vfs-hook-BykczwZL.js} +1 -1
  18. package/dist/ui/assets/{frozen-archive-writer-1Sfd3_hn.js → frozen-archive-writer-BoBWoTrh.js} +1 -1
  19. package/dist/ui/assets/{frozen-archive-writer-BCuzFGRS.js → frozen-archive-writer-DHqVNK3z.js} +1 -1
  20. package/dist/ui/assets/{frozen-session-delete-DknkxXFd.js → frozen-session-delete-CmVE8uz7.js} +1 -1
  21. package/dist/ui/assets/{frozen-session-identity-pkUWEifZ.js → frozen-session-identity-CRTDWmSN.js} +1 -1
  22. package/dist/ui/assets/{frozen-session-identity-Ba-yRITY.js → frozen-session-identity-ChrV93y5.js} +1 -1
  23. package/dist/ui/assets/{gelatiere-unit-BANCZ9x3.js → gelatiere-unit-Dnug4wB5.js} +1 -1
  24. package/dist/ui/assets/{github-DCZKorBz.js → github-B2Jmtl5T.js} +1 -1
  25. package/dist/ui/assets/{github-BlMprkf6.js → github-DBHS2Dqt.js} +1 -1
  26. package/dist/ui/assets/{github-copilot-D23XZpG6.js → github-copilot-Cb-AGqlO.js} +1 -1
  27. package/dist/ui/assets/{github-copilot-C8Hqj_iR.js → github-copilot-jU2_bitu.js} +1 -1
  28. package/dist/ui/assets/{go-driver-CvHJRpyw.js → go-driver-Bl_pd-vs.js} +1 -1
  29. package/dist/ui/assets/{hear-BHugiT-P.js → hear-C8rKY1FP.js} +1 -1
  30. package/dist/ui/assets/icons-BJTFywJo.js +1 -0
  31. package/dist/ui/assets/{js-realm-worker-CmibdX_h.js → js-realm-worker-kX5NT2rg.js} +2 -2
  32. package/dist/ui/assets/{jsh-executor-DHAF6dFq.js → jsh-executor-BVRmWOcY.js} +2 -2
  33. package/dist/ui/assets/{kernel-worker-Dd6UT_Hw.js → kernel-worker-B8dQ6oD2.js} +8 -8
  34. package/dist/ui/assets/{lick-ws-bridge-B6GPqj60.js → lick-ws-bridge-B55KMh7y.js} +1 -1
  35. package/dist/ui/assets/{lick-ws-bridge-LW2pivtS.js → lick-ws-bridge-xmS7PfYb.js} +1 -1
  36. package/dist/ui/assets/{live-session-curation-B6nC2IwS.js → live-session-curation-BNMM5Cko.js} +1 -1
  37. package/dist/ui/assets/{live-session-curation-Cj_Et3yL.js → live-session-curation-C8WI_jMh.js} +1 -1
  38. package/dist/ui/assets/{live-session-snapshot-BhWFvQrZ.js → live-session-snapshot-BW_iWuYO.js} +1 -1
  39. package/dist/ui/assets/{local-llm-_r9oESrG.js → local-llm-BTE5kJfp.js} +1 -1
  40. package/dist/ui/assets/{local-llm-bB4uQj3y.js → local-llm-CJUTJaEr.js} +1 -1
  41. package/dist/ui/assets/{main-DJ1JbcDS.js → main-Cxb1a5Uz.js} +3 -3
  42. package/dist/ui/assets/{main-cherry-Cg_eulXT.js → main-cherry-Oc5q4aB-.js} +1 -1
  43. package/dist/ui/assets/{mcp-command-Br5ePgQj.js → mcp-command-CwuwVp6r.js} +9 -9
  44. package/dist/ui/assets/{memory-curation-seam-D74FwxQn.js → memory-curation-seam-BMeMHKkg.js} +1 -1
  45. package/dist/ui/assets/{memory-health-CpD91kc7.js → memory-health-Bvv6LYKB.js} +1 -1
  46. package/dist/ui/assets/{memory-write-execute-B7mSsyNT.js → memory-write-execute-CPixKZV3.js} +1 -1
  47. package/dist/ui/assets/{merge-folded-cost-into-frozen-9g-oWfCg.js → merge-folded-cost-into-frozen-hv0-jK2p.js} +1 -1
  48. package/dist/ui/assets/{new-session-BEyoS6w7.js → new-session-DspiDGrn.js} +2 -2
  49. package/dist/ui/assets/{oauth-bootstrap-Cbq8G8pM.js → oauth-bootstrap-Dya1IvMk.js} +2 -2
  50. package/dist/ui/assets/{onboarding-orchestrator-CUANwcPE.js → onboarding-orchestrator-DkOtMT6l.js} +1 -1
  51. package/dist/ui/assets/{openai-codex-Dqq1RGXY.js → openai-codex-DPx8bB-I.js} +1 -1
  52. package/dist/ui/assets/{openai-codex-BWzG7p7O.js → openai-codex-DqI-LV1p.js} +1 -1
  53. package/dist/ui/assets/{openrouter-CYjM-kZx.js → openrouter-Bm5NKbSA.js} +1 -1
  54. package/dist/ui/assets/{openrouter-DZ-E1wuB.js → openrouter-CX8Bzh4-.js} +1 -1
  55. package/dist/ui/assets/{openrouter-free-D9nGhI8x.js → openrouter-free-BtMhJjpj.js} +1 -1
  56. package/dist/ui/assets/{openrouter-free-BOWeJi1P.js → openrouter-free-Dio8R8YY.js} +1 -1
  57. package/dist/ui/assets/{openrouter-oauth-wf55kglO.js → openrouter-oauth-CYyzK9z-.js} +1 -1
  58. package/dist/ui/assets/{openrouter-oauth-CtSL7Qxf.js → openrouter-oauth-DTvqvfHg.js} +1 -1
  59. package/dist/ui/assets/{panel-rpc-handlers-Xpdj6WbR.js → panel-rpc-handlers-DfSkY8OF.js} +2 -2
  60. package/dist/ui/assets/{panelize-shell-C04CGO5Z.js → panelize-shell-BF3KcP4C.js} +1 -1
  61. package/dist/ui/assets/{pi-edit-execution-CKBidACs.js → pi-edit-execution-2UPU8l9Z.js} +1 -1
  62. package/dist/ui/assets/{process-worker-Qo-KJQnm.js → process-worker-B_jMhtwi.js} +1 -1
  63. package/dist/ui/assets/{provider-B6KB41WB.js → provider-BVH2DJ2j.js} +1 -1
  64. package/dist/ui/assets/{provider-BvJJikM5.js → provider-C8H2Tzfg.js} +1 -1
  65. package/dist/ui/assets/{provider-settings-D5h7Kn8Y.js → provider-settings-SY82ESoD.js} +1 -1
  66. package/dist/ui/assets/provider-store-access-Cd8AQEiQ.js +1 -0
  67. package/dist/ui/assets/provider-store-access-DbDmDCT_.js +1 -0
  68. package/dist/ui/assets/{providers-H2QVvHIo.js → providers-CefzTaF8.js} +1 -1
  69. package/dist/ui/assets/{providers-CrXalGVD.js → providers-DollmArp.js} +2 -2
  70. package/dist/ui/assets/{quick-llm-CVspCSPa.js → quick-llm-DiEAuzzI.js} +1 -1
  71. package/dist/ui/assets/{realm-inprocess-BcXidk7x.js → realm-inprocess-Cc3228-9.js} +2 -2
  72. package/dist/ui/assets/{realm-unhandled-rejections-C17KMSUA.js → realm-unhandled-rejections-BcZm-Y2j.js} +1 -1
  73. package/dist/ui/assets/{realm-unhandled-rejections-C_hJHL3a.js → realm-unhandled-rejections-TLpLRRgO.js} +1 -1
  74. package/dist/ui/assets/{recovery-screen-B3EIqd1H.js → recovery-screen-Cl89ahLT.js} +1 -1
  75. package/dist/ui/assets/{remote-terminal-view-B8c0sr0S.js → remote-terminal-view-D82qMvNy.js} +2 -2
  76. package/dist/ui/assets/{restore-D0xn5gYN.js → restore-yq1C_osw.js} +1 -1
  77. package/dist/ui/assets/{run-yIEzBr4M.js → run-BPeIvqOM.js} +1 -1
  78. package/dist/ui/assets/{run-C3Hy4SBY.js → run-Cu8PtYCw.js} +2 -2
  79. package/dist/ui/assets/{run-DKWaudm_.js → run-DW65sPip.js} +12 -12
  80. package/dist/ui/assets/{run-x2hyttPz.js → run-DZrK_oOt.js} +2 -2
  81. package/dist/ui/assets/{run-E8fkhkYA.js → run-tc2VFBej.js} +1 -1
  82. package/dist/ui/assets/{session-command-memory-LPNx4Ykm.js → session-command-memory-CDOmbg5g.js} +2 -2
  83. package/dist/ui/assets/{session-jsonl-DzjYDmn3.js → session-jsonl-C4593KNn.js} +1 -1
  84. package/dist/ui/assets/{session-jsonl-C2urTY7z.js → session-jsonl-D_UZgGp5.js} +1 -1
  85. package/dist/ui/assets/{session-search-index-Eq_qfrjB.js → session-search-index-CUPFfLvv.js} +1 -1
  86. package/dist/ui/assets/{setup-feature-flags-remote-Ch1uljUD.js → setup-feature-flags-remote-cYu5aVbG.js} +1 -1
  87. package/dist/ui/assets/{setup-model-catalog-DTQU8cnr.js → setup-model-catalog-CR19K3-A.js} +1 -1
  88. package/dist/ui/assets/{silent-renew-backoff-ClxUKo41.js → silent-renew-backoff-Bvrf2Hhh.js} +1 -1
  89. package/dist/ui/assets/slicc-version-BxghrDTL.js +1 -0
  90. package/dist/ui/assets/{soundscape-DmMhiSiT.js → soundscape-DxIHlkzy.js} +1 -1
  91. package/dist/ui/assets/{speak-B-nz5uMy.js → speak-DkUF9yAq.js} +1 -1
  92. package/dist/ui/assets/{sprinkle-manager-I5F18apA.js → sprinkle-manager-UTFA1mfr.js} +1 -1
  93. package/dist/ui/assets/{sprinkle-renderer-BtNj8eVS.js → sprinkle-renderer-Cr1UxyZz.js} +1 -1
  94. package/dist/ui/assets/{sudo-CR-Y4poZ.js → sudo-SwaFp2JP.js} +1 -1
  95. package/dist/ui/assets/{supervisor-rbjp5Jxz.js → supervisor-DvFfdQZG.js} +1 -1
  96. package/dist/ui/assets/{sync-dialog-Cjgp-t5Q.js → sync-dialog-89X_eADs.js} +1 -1
  97. package/dist/ui/assets/{transformers-env-CCuheXlU.js → transformers-env-C6jpYwFE.js} +1 -1
  98. package/dist/ui/assets/{tray-leader-CnIx31Lw.js → tray-leader-2nVEUays.js} +1 -1
  99. package/dist/ui/assets/{tray-leave-runtime-D1qkvSFd.js → tray-leave-runtime-Bn1GC9Cf.js} +1 -1
  100. package/dist/ui/assets/{tray-sidecar-DQO-4oRP.js → tray-sidecar-DmR9wMCP.js} +1 -1
  101. package/dist/ui/assets/{upgrade-detection-bn5ZPVwB.js → upgrade-detection-CHMH6iyk.js} +1 -1
  102. package/dist/ui/assets/{voice-reply-ByGMcwzr.js → voice-reply-BSouYhfc.js} +1 -1
  103. package/dist/ui/assets/{wasi-runtime-D50sf0fY.js → wasi-runtime-BBxEcrtW.js} +5 -5
  104. package/dist/ui/assets/{wc-attach-AkwSo7Fl.js → wc-attach-4HlzE8yC.js} +2 -2
  105. package/dist/ui/assets/{wc-browser-D8-89DQs.js → wc-browser-_YDya6R4.js} +1 -1
  106. package/dist/ui/assets/{wc-computers-BSwZi2VG.js → wc-computers-DsTSGd08.js} +1 -1
  107. package/dist/ui/assets/{wc-detached-BmB8d_Yi.js → wc-detached-Cnh8X5Wm.js} +1 -1
  108. package/dist/ui/assets/{wc-extension-CaM9V86I.js → wc-extension-CTg_a4Zu.js} +2 -2
  109. package/dist/ui/assets/{wc-follower-B7ksSDDH.js → wc-follower-CpxmTt8d.js} +3 -3
  110. package/dist/ui/assets/{wc-follower-oauth-Dm8dPxfI.js → wc-follower-oauth-D8E_ti39.js} +1 -1
  111. package/dist/ui/assets/{wc-gelatiere-DVODoBJi.js → wc-gelatiere-BCuLQnrY.js} +1 -1
  112. package/dist/ui/assets/{wc-live-DF9dh-BS.js → wc-live-1-EV8_qk.js} +5 -5
  113. package/dist/ui/assets/{wc-nav-CKnUmkye.js → wc-nav-BJ5I51NK.js} +2 -2
  114. package/dist/ui/assets/{wc-onboarding-BRP76Hoi.js → wc-onboarding-myCW-Onf.js} +2 -2
  115. package/dist/ui/assets/{wc-permissions-Bah1z66z.js → wc-permissions-Baf4WNdK.js} +2 -2
  116. package/dist/ui/assets/{wc-placeholder-KZttIyjU.js → wc-placeholder-C0mKH-Yt.js} +3 -3
  117. package/dist/ui/assets/{wc-secret-request-BHU1XUwC.js → wc-secret-request-DLrIa256.js} +1 -1
  118. package/dist/ui/assets/{wc-settings-DrY7SIeo.js → wc-settings-C14VLbGh.js} +3 -3
  119. package/dist/ui/assets/{wc-shell-Bt8UzfFa.js → wc-shell-BTfKKBgo.js} +3 -3
  120. package/dist/ui/assets/{wc-shortcut-config-D7PIvlOi.js → wc-shortcut-config-BvDHKCy0.js} +1 -1
  121. package/dist/ui/assets/{wc-sprinkles-BWilXn3I.js → wc-sprinkles-ZL0xE_Cs.js} +2 -2
  122. package/dist/ui/assets/{wc-transcript-export-BPYmvVFN.js → wc-transcript-export-CyRiKnwi.js} +2 -2
  123. package/dist/ui/assets/{wc-tray-BO3RL4ye.js → wc-tray-jeohKKcJ.js} +4 -4
  124. package/dist/ui/assets/welcome-detection-CuDKZAa8.js +1 -0
  125. package/dist/ui/assets/{whisper-session-DL1fUZYq.js → whisper-session-Ch8cDNVc.js} +2 -2
  126. package/dist/ui/assets/{xai-grok-DS8TkopE.js → xai-grok-BFykbO4p.js} +1 -1
  127. package/dist/ui/assets/{xai-grok-BWDHZnXP.js → xai-grok-CpBrt9ak.js} +1 -1
  128. package/dist/ui/index.html +3 -3
  129. package/dist/ui/lucide-icons.js +358 -355
  130. package/dist/ui/packages/webapp/index.html +3 -3
  131. package/package.json +1 -1
  132. package/dist/ui/assets/icons-2DY2vYOc.js +0 -1
  133. package/dist/ui/assets/provider-store-access-Dfk23puf.js +0 -1
  134. package/dist/ui/assets/provider-store-access-g6Y5oeM5.js +0 -1
  135. package/dist/ui/assets/slicc-version-DRlU9ovU.js +0 -1
  136. package/dist/ui/assets/welcome-detection-DrCUfyTd.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-B3It6xQY.js";import{C as l,d as u,f as d,i as f,u as p}from"./account-store-BspEP7gu.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-F-dCBEfh.js";import{t as ee}from"./sha256-DynDhwRL.js";import{t as te}from"./runtime-env-DadgceZk.js";import{t as ne}from"./slugify-BYJ6QVAt.js";import{i as re,n as ie,r as ae,t as oe}from"./host-command-CvUauhDf.js";import{a as se,c as ce,d as y,f as le,i as ue,l as de,m as fe,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye}from"./snapshot-HHgn9isb.js";import{n as be,t as b}from"./panel-rpc-accessor-B4BfPLSo.js";import{a as xe,c as Se,n as Ce,o as we,s as Te,t as Ee}from"./feature-flags-QlgHaQc1.js";import{t as De}from"./providers-H2QVvHIo.js";import{r as Oe}from"./binary-cache-bSOhqXB1.js";import{i as ke,n as Ae,r as je}from"./fetch-body-CuwTaJC_.js";import{s as Me,t as Ne}from"./api-endpoint-D8lUKmPu.js";import{t as Pe}from"./compat-nGhSz-U1.js";import"./core-C1m4D34S.js";import{n as Fe,t as Ie}from"./mime-types-D7IV6i7k.js";import{n as Le,t as Re}from"./float-topology-COIC4j_U.js";import{t as ze}from"./secrets-bridge-client-GOCzDscb.js";import{a as Be,i as Ve,n as He,r as Ue}from"./tool-ui-DRnUkp2g.js";import{a as We,i as Ge,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as Ke,r as qe,t as Je}from"./merge-file-core-VJlzucJY.js";import{n as Ye,t as Xe}from"./types-D8gIX-W-.js";import{i as Ze}from"./mount-index-CQfmUPuZ.js";import{a as Qe,i as $e,n as et,o as tt,s as nt,t as rt}from"./signed-fetch-DeDG40wV.js";import{o as it}from"./mount-table-store-DrF_Ifaz.js";import{t as at}from"./remote-cache-UwMD8EkX.js";import{n as ot}from"./fs-D_cFUSir.js";import{a as st}from"./tray-leader-status-CpkFr6n7.js";import{n as ct,t as lt}from"./slicc-version-DRlU9ovU.js";import{a as ut,i as dt,o as ft,r as C,t as pt}from"./browser-CGX7MbCQ.js";import{t as w}from"./subcommand-flags-BZi7j78Q.js";import{n as mt,r as ht,t as T}from"./subcommand-help-CgO7wRS5.js";import{n as gt}from"./cost-command-TMcbUPyN.js";import{d as _t,g as vt,i as yt,n as bt,o as xt}from"./sudoers-BdBYQPUn.js";import{t as St}from"./sudo-refusal-DVwTXFRE.js";import{n as Ct}from"./types-Dj5TU-Qg.js";import{a as wt,c as Tt,i as Et,l as Dt,n as Ot,o as kt,r as At,t as jt}from"./types-JfhqX7lD.js";import{n as E,t as Mt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Nt}from"./html-B_Hg2WOy.js";import{n as Pt}from"./llm-session-id-CKpY5F_-.js";import{t as Ft}from"./src-CUSndb9K.js";import{i as It,o as Lt}from"./browser-DuyhpHbR.js";import{a as Rt,c as zt,i as Bt,n as Vt,o as Ht,s as Ut,t as Wt}from"./pipe-status-BBrT3VeG.js";import{i as Gt,r as Kt,t as qt}from"./mount-picker-popup-BMils9JY.js";import{t as Jt}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Yt,B as D,C as Xt,D as O,E as Zt,F as Qt,G as $t,H as k,I as A,J as en,K as tn,L as nn,M as rn,N as an,O as on,P as sn,R as cn,S as ln,T as un,U as dn,V as fn,W as pn,Y as mn,_ as hn,a as gn,b as _n,c as vn,d as yn,f as bn,g as xn,h as Sn,i as Cn,j as wn,k as Tn,l as En,m as Dn,n as On,o as kn,p as j,q as An,r as jn,s as Mn,t as Nn,u as Pn,v as Fn,w as In,x as Ln,y as Rn,z as zn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{C as Bn,S as M,a as Vn,b as Hn,c as Un,d as Wn,f as Gn,g as Kn,i as qn,l as Jn,m as Yn,n as Xn,o as Zn,p as Qn,r as $n,s as er,t as tr,u as nr,x as rr,y as N}from"./state-Dx_7TiP6.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-Bdgu8kD2.js";import{a as P,i as cr,r as lr,t as ur}from"./just-bash-compat-B-SPHuh_.js";import{h as dr,i as fr,r as pr}from"./stdio-tty-CipJs8Mm.js";import{i as mr,r as hr}from"./global-prefix-DqCuANmV.js";import{t as gr}from"./wasm-programs-Bd5YaoqY.js";import{a as _r,n as vr,o as yr,r as br,s as xr}from"./jsh-discovery-CnvNKojr.js";import{C as Sr,a as Cr,b as wr,c as Tr,d as Er,f as Dr,h as Or,i as kr,l as Ar,m as jr,n as Mr,o as Nr,p as Pr,r as Fr,s as Ir,t as F,u as Lr,v as Rr,y as zr}from"./shared-D-ZRFYou.js";import{_ as Br,a as Vr,b as Hr,d as Ur,f as Wr,g as Gr,h as Kr,i as qr,l as Jr,m as Yr,p as Xr,r as Zr,s as Qr,u as $r,v as ei,y as ti}from"./require-guards-dUdxJmkR.js";import{_ as ni,a as ri,b as ii,c as ai,d as oi,f as si,g as ci,h as li,l as ui,m as di,n as fi,p as pi,s as mi,t as hi,u as gi,v as _i,x as vi,y as yi}from"./jsh-executor-DHAF6dFq.js";import{n as bi,t as xi}from"./esbuild-wasm-DeTghvWH.js";import{n as Si}from"./wasm-compiler-Ct7QZURL.js";import{a as Ci,o as wi,s as Ti,t as Ei}from"./usb-device-registry-DFzxaOky.js";import{i as Di,r as Oi,t as ki}from"./script-catalog-D5joO5l7.js";import{a as Ai,c as ji,o as Mi,s as Ni,t as Pi}from"./types-Dzr0qYl3.js";import{a as Fi,c as Ii,d as Li,f as Ri,n as zi,r as Bi,u as Vi}from"./github-zip-CMSbKC3q.js";import{i as Hi,t as Ui}from"./github-auth-D-_-pCrt.js";import{a as Wi,i as Gi,o as Ki,r as qi,t as Ji}from"./provenance-DdmsQ3Nr.js";import{a as Yi,c as Xi,i as Zi,n as Qi,o as $i,r as ea,s as ta}from"./github-install-NHKpL-_w.js";import{n as na,t as ra}from"./magick-wasm-BbnwhVj1.js";import{i as ia,n as aa,r as oa,t as sa}from"./pdf-raster-BWk6ezTX.js";import{n as ca}from"./lick-target-env-8JxfVcIV.js";import{t as la}from"./tmpdir-env-ate4iNcK.js";import{n as ua,t as da}from"./keyboard-TcuVIW9F.js";import{n as fa,t as pa}from"./hf-defaults-BwJdGLgk.js";import{t as ma}from"./ffmpeg-wasm-sx-3yVAE.js";import{t as ha}from"./local-llm-_r9oESrG.js";import{i as ga,n as _a,r as va,t as ya}from"./tar-BWIPCxI2.js";import{a as ba,c as xa,i as Sa,o as Ca,r as wa,s as Ta}from"./v86-vm-DCm7zA2r.js";import{n as Ea,r as Da}from"./lick-urls-CgPiVwD-.js";let Oa=null;function ka(e){Oa=e!==null&&Number.isFinite(e)&&e>0?e:null}function Aa(){if(Oa!==null)return Oa;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const ja=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ma(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=ja.exec(t.split(`.`)[0]??``);if(!n||!t.includes(`.`))return null;let r=n[1].toLowerCase();return`${[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20)].join(`-`)}.${n[2].toLowerCase()}`}[`ghp_`,`gho_`,`ghu_`,`ghs_`,`ghr_`,`github_pat_`,`sk-`,`pk-`,`xoxb-`,`xoxp-`,`xoxa-`,`xoxs-`,`AKIA`,`ABIA`,`ACCA`,`ASIA`,`sk-ant-`,`Bearer `].sort((e,t)=>t.length-e.length);function Na(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n===`*`)return!0;if(!n.startsWith(`*.`))return n===r;let i=n.slice(1);return r.length>i.length&&r.endsWith(i)}function Pa(e,t){return e.some(e=>Na(e,t))}const Fa=`slicc-transcript`,Ia=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],La=new Set(`/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Ra(e){return La.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var za=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Ba=new Set(Ia),Va=/^[0-9a-fA-F]{64}$/,Ha=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ua(e){return typeof e==`string`&&Va.test(e)}function Wa(e){return Ha.test(e)&&Number.isFinite(Date.parse(e))}function Ga(e,t){let n=t.map(e=>`"${e}"`),r=n[n.length-1];return n.length===2?`${e} must be ${n[0]} or ${r}`:`${e} must be ${n.slice(0,-1).join(`, `)}, or ${r}`}function Ka(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ga(n,t)}:{ok:!0}}function qa(e,t,n){for(let r=0;r<e.length;r++){let i=t(e[r],`${n}[${r}]`);if(!i.ok)return i}return{ok:!0}}function Ja(e,t){let n=e.type;if(n===`text`){if(typeof e.text!=`string`)return{ok:!1,error:`${t}.text must be a string`}}else if(n===`tool-call`){if(typeof e.id!=`string`||e.id===``)return{ok:!1,error:`${t}.id must be a non-empty string`};if(typeof e.name!=`string`||e.name===``)return{ok:!1,error:`${t}.name must be a non-empty string`};if(!(`input`in e))return{ok:!1,error:`${t}.input must be present`}}else if(typeof e.attachmentId!=`string`||e.attachmentId===``)return{ok:!1,error:`${t}.attachmentId must be a non-empty string`};return{ok:!0}}function Ya(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ka(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ja(e,t):n}function Xa(e,t){for(let n of[`input`,`output`,`cacheRead`,`cacheWrite`,`totalTokens`]){let r=e[n];if(typeof r!=`number`)return{ok:!1,error:`${t}.${n} must be a number`};if(!Number.isInteger(r)||r<0)return{ok:!1,error:`${t}.${n} must be a non-negative integer`}}return{ok:!0}}function Za(e,t){for(let n of[`input`,`output`,`cacheRead`,`cacheWrite`,`total`]){let r=e[n];if(typeof r!=`number`)return{ok:!1,error:`${t}.${n} must be a number`};if(!Number.isFinite(r)||r<0)return{ok:!1,error:`${t}.${n} must be a finite non-negative number`}}return{ok:!0}}function Qa(e,t){let n=Xa(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?Za(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function $a(e,t){if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.sequence!=`number`)return{ok:!1,error:`${t}.sequence must be a number`};let n=e.sequence;return!Number.isInteger(n)||n<1?{ok:!1,error:`${t}.sequence must be a positive integer`}:typeof e.timestamp==`string`?Wa(e.timestamp)?{ok:!0}:{ok:!1,error:`${t}.timestamp must be a valid ISO 8601 date-time string`}:{ok:!1,error:`${t}.timestamp must be a string`}}function eo(e,t){let n=e.toolCallId;return typeof n!=`string`||n===``?{ok:!1,error:`${t}.toolCallId must be a non-empty string for tool-result messages`}:{ok:!0}}function to(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?Qa(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function no(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ka(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=eo(e,t);if(!n.ok)return n}let r=$a(e,t);if(!r.ok)return r;let i=e.content;if(!Array.isArray(i))return{ok:!1,error:`${t}.content must be an array`};let a=qa(i,Ya,`${t}.content`);return a.ok?to(e,t):a}function ro(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.name!=`string`)return{ok:!1,error:`${t}.name must be a string`};let n=Ka(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?qa(r,no,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function io(e,t){for(let n of[`id`,`path`,`originalName`,`mimeType`,`sha256`,`sourceConversationId`,`sourceMessageId`])if(typeof e[n]!=`string`)return{ok:!1,error:`${t}.${n} must be a string`};return{ok:!0}}function ao(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?{ok:!1,error:`${t}.path must be non-empty when present`}:Ua(r)?!Number.isInteger(i)||i<0?{ok:!1,error:`${t}.byteLength must be a non-negative integer when present`}:e.missingReason===void 0?{ok:!0}:{ok:!1,error:`${t}.missingReason must be absent when present is true`}:{ok:!1,error:`${t}.sha256 must be a 64-char hex string when present`}}const oo=[`attachment-file-missing`,`attachment-association-unavailable`];function so(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ka(e.missingReason,oo,`${t}.missingReason`):{ok:!1,error:`${t}.byteLength must be zero when not present`}:{ok:!1,error:`${t}.sha256 must be empty when not present`}:{ok:!1,error:`${t}.path must be empty when not present`}}function co(e,t){return e.present?ao(e,t):so(e,t)}function lo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=io(e,t);if(!n.ok)return n;if(typeof e.byteLength!=`number`)return{ok:!1,error:`${t}.byteLength must be a number`};if(typeof e.present!=`boolean`)return{ok:!1,error:`${t}.present must be a boolean`};let r=Ka(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?co(e,t):r}function uo(e,t){let n=Ka(e.kind,[`json`,`attachment`],`${t}.kind`);if(!n.ok)return n;if(e.kind===`json`){if(typeof e.pointer!=`string`)return{ok:!1,error:`${t}.pointer must be a string`};let n=e.pointer;if(n!==``&&!n.startsWith(`/`))return{ok:!1,error:`${t}.pointer must be a valid RFC 6901 JSON pointer`}}else if(typeof e.attachmentId!=`string`||e.attachmentId===``)return{ok:!1,error:`${t}.attachmentId must be a non-empty string`};return{ok:!0}}function fo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.category!=`string`)return{ok:!1,error:`${t}.category must be a string`};let n=Ka(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?uo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function po(e,t){return I(e)?typeof e.sourceConversationId==`string`?typeof e.targetConversationId==`string`?{ok:!0}:{ok:!1,error:`${t}.targetConversationId must be a string`}:{ok:!1,error:`${t}.sourceConversationId must be a string`}:{ok:!1,error:`${t} must be a non-null object`}}function mo(e,t){return typeof e!=`string`||!Ba.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function ho(e){if(!I(e))return{ok:!1,error:`export must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`export.id must be a string`};if(typeof e.generatedAt!=`string`)return{ok:!1,error:`export.generatedAt must be a string`};if(e.format!==`slicc-transcript`)return{ok:!1,error:`export.format must equal "slicc-transcript"`};let t=e.producer;return I(t)?t.application===`slicc`?typeof t.version==`string`?{ok:!0}:{ok:!1,error:`export.producer.version must be a string`}:{ok:!1,error:`export.producer.application must equal "slicc"`}:{ok:!1,error:`export.producer must be a non-null object`}}function go(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ka(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?qa(e.missing,mo,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function _o(e){if(!I(e))return{ok:!1,error:`session must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`session.id must be a string`};if(typeof e.title!=`string`)return{ok:!1,error:`session.title must be a string`};let t=Ka(e.state,[`active`,`frozen`],`session.state`);return t.ok?go(e.completeness):t}function vo(e){if(!I(e))return{ok:!1,error:`privacy must be a non-null object`};if(e.reasoningExcluded!==!0)return{ok:!1,error:`privacy.reasoningExcluded must be true`};let t=e.excludedReasoningBlocks;if(typeof t!=`number`)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a number`};if(!Number.isInteger(t)||t<0)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a non-negative integer`};if(e.binaryAttachments!==`included-unchanged`)return{ok:!1,error:`privacy.binaryAttachments must equal "included-unchanged"`};if(!I(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?qa(n,fo,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function yo(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=qa(t,ro,`conversations`);if(!n.ok)return n;let r=e.delegations;if(!Array.isArray(r))return{ok:!1,error:`delegations must be an array`};let i=qa(r,po,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?qa(a,lo,`attachments`):{ok:!1,error:`attachments must be an array`}}function bo(e){let t=new Set,n=new Set;for(let r of e){if(!I(r)||typeof r.id!=`string`)continue;if(t.has(r.id))return{ok:!1,error:`duplicate conversation id "${r.id}"`};t.add(r.id);let e=r.messages;if(Array.isArray(e)){for(let t of e)if(!(!I(t)||typeof t.id!=`string`)){if(n.has(t.id))return{ok:!1,error:`duplicate message id "${t.id}"`};n.add(t.id)}}}return{ok:!0}}function xo(e){for(let t of e){if(!I(t))continue;let e=t.messages;if(!Array.isArray(e))continue;let n=typeof t.id==`string`?t.id:`?`,r=0;for(let t of e){if(!I(t)||typeof t.sequence!=`number`)continue;let e=t.sequence;if(e<=r)return{ok:!1,error:`sequences in conversation "${n}" must be strictly increasing`};r=e}}return{ok:!0}}function So(e){let t=[];for(let n of e){if(!I(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)I(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function Co(e){let t=new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of So(e))t.add(n)}return t}function wo(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n)||n.role!==`tool-result`)continue;let e=n.toolCallId;if(typeof e==`string`&&e!==``&&!t.has(e))return{ok:!1,error:`tool-result message references unknown toolCallId "${e}"`}}}return{ok:!0}}function To(e){return wo(e,Co(e))}function Eo(e,t){for(let n of e){if(!I(n)||n.type!==`attachment-ref`)continue;let e=n.attachmentId;if(typeof e!=`string`||!t.has(e))return{ok:!1,error:`attachment-ref references unknown attachmentId "${e}"`}}return{ok:!0}}function Do(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=Eo(e,t);if(!r.ok)return r}}return{ok:!0}}function Oo(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Do(e,n)}function ko(e){let t=new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=new Set,r=n.messages;if(Array.isArray(r))for(let t of r)I(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function Ao(e,t){let n=ko(t);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.sourceConversationId,a=r.sourceMessageId;if(typeof i!=`string`||typeof a!=`string`)continue;let o=n.get(i);if(!o)return{ok:!1,error:`attachments[${t}].sourceConversationId "${i}" does not exist`};if(!o.has(a))return{ok:!1,error:`attachments[${t}].sourceMessageId "${a}" does not exist in conversation "${i}"`}}return{ok:!0}}function jo(e){let t=new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(So(e)))}return t}function Mo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!I(i))continue;let a=i.sourceConversationId,o=i.targetConversationId;if(typeof a!=`string`||!t.has(a))return{ok:!1,error:`delegations[${r}].sourceConversationId "${a}" does not exist`};if(typeof o!=`string`||!t.has(o))return{ok:!1,error:`delegations[${r}].targetConversationId "${o}" does not exist`};let s=i.toolCallId;if(typeof s==`string`&&s!==``&&!n.get(a)?.has(s))return{ok:!1,error:`delegations[${r}].toolCallId "${s}" does not exist in source conversation "${a}"`}}return{ok:!0}}function No(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Mo(e,n,jo(t))}function Po(e,t,n){if(e.kind!==`attachment`)return{ok:!0};let r=e.attachmentId;return typeof r!=`string`||!t.has(r)?{ok:!1,error:`${n}.attachmentId "${r}" does not reference a known attachment`}:{ok:!0}}function Fo(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.target;if(!I(i))continue;let a=Po(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Io(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=bo(t);if(!o.ok)return o;let s=xo(t);if(!s.ok)return s;let c=To(t);if(!c.ok)return c;let l=Oo(t,n);if(!l.ok)return l;let u=Ao(n,t);if(!u.ok)return u;let d=No(r,t);return d.ok?Fo(a,n):d}function Lo(e){let t=yo(e);return t.ok?Io(e):t}function Ro(e){if(!I(e))return{ok:!1,error:`document must be a non-null object`};if(e.schemaVersion!==1)return{ok:!1,error:`schemaVersion must equal 1`};let t=ho(e.export);if(!t.ok)return t;let n=_o(e.session);if(!n.ok)return n;let r=vo(e.privacy);return r.ok?Lo(e):r}async function zo(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:tt});if(r.status===401||r.status===403)throw Error(`not authorized to read the site config for ${e}/${t} — log in via Settings → Providers → Adobe, or pass --backend to skip the probe`);if(r.status===404)throw Error(`no site config for ${e}/${t} — check the org and site names`);if(r.status>=400)throw Error(`site config probe failed for ${e}/${t}: ${r.status}`);let i;try{i=await r.json()}catch(n){throw Error(`site config for ${e}/${t} is not JSON: ${n instanceof Error?n.message:String(n)}`)}let a=i.content?.source?.url;return{backend:Bo(a),sourceUrl:a}}function Bo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Vo=`slicc-sprinkle-routes`;function Ho(){try{let e=localStorage.getItem(Vo);return e?JSON.parse(e):{}}catch{return{}}}function Uo(e){try{localStorage.setItem(Vo,JSON.stringify(e))}catch{}}function Wo(e){return Ho()[e]}function Go(e,t){let n=Ho();n[e]=t,Uo(n)}function Ko(e){let t=Ho();delete t[e],Uo(t)}function qo(){return Ho()}function Jo(e,t,n){return Tt(t,n,`${e} adapter does not implement ${t}.${n}`)}function Yo(e,t,n,r){let i=n.filter(e=>typeof r?.[e]==`function`),a=n.map(n=>{let i=r?.[n];return[n,typeof i==`function`?i:()=>Promise.resolve(Jo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Xo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Yo(t,`browser`,Ot,e.browser),network:Yo(t,`network`,wt,e.network),secrets:Yo(t,`secrets`,kt,e.secrets),devices:Yo(t,`devices`,At,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Yo(t,`mounts`,Et,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Yo(t,`approvals`,jt,e.approvals)}}function Zo(e={}){return Xo({adapter:`connect`,pageGestures:e.pageGestures})}function Qo(e){let t=Mt(()=>import(`./extension-ops-OtrqWANJ.js`).then(t=>t.createExtensionOps(e)));return Xo({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function $o(e={}){let t=Mt(()=>import(`./rest-ops-j0P6ql7f.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Xo({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function es(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return $o({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Qo({adapter:e,pageGestures:n});case`connect`:return Zo({pageGestures:n})}}function ts(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=n+1<e.length?e.charCodeAt(n+1):0;r>=56320&&r<=57343?(t+=e.slice(n,n+2),n+=1):t+=`�`}else t+=r>=56320&&r<=57343?`�`:e.slice(n,n+1)}return t}function ns(e){let t=String.prototype.toWellFormed;return typeof t==`function`?t.call(e):ts(e)}const rs=e(`quick-llm`);async function is(e){let t=f();if(!t)return rs.debug(`No API key for active provider — skipping`),null;let n=d(),r=u(),i;if(i=e.modelId?cs(n,e.modelId)??cs(n,r):as(n,r),!i)return rs.debug(`No model available for provider`,{providerId:n}),null;let a=ns(e.prompt),o=e.system===void 0?void 0:ns(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=ls());try{let n=(await Pe(i,{systemPrompt:o,messages:[s]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(c).length>0?c:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return rs.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function as(e,t){let n=p(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=ss(r.id),a=n.filter(e=>os(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function os(e,t,n){if(e.id===t.id)return!1;let r=t.cost?.input??1/0;if((e.cost?.input??1/0)>=r)return!1;let i=e.id.toLowerCase();switch(n){case`claude`:return i.includes(`haiku`);case`gpt`:return/(^|-)mini(-|$)|(^|-)nano(-|$)/.test(i);case`gemini`:return i.includes(`flash`);case`grok`:return/(^|-)mini(-|$)|(^|-)fast(-|$)/.test(i);case`unknown`:return!0}}function ss(e){let t=e.toLowerCase();return t.includes(`claude`)?`claude`:t.includes(`gemini`)?`gemini`:t.includes(`grok`)?`grok`:/^(gpt|o\d)/.test(t)?`gpt`:`unknown`}function cs(e,t){return p(e).find(e=>e.id===t)}function ls(){return Pt(`ui-quick-llm`)}const us=e(`sudo-suggest`),ds=[`You generalize a single shell command into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the leading command/sub-command verbatim and replace only`,`the volatile tail (args, paths, refs) with a single trailing "*".`,`Examples:`,` git push origin main -> git push*`,` rm -rf build/cache -> rm -rf*`,` npm install left-pad -> npm install*`].join(`
1
+ import{t as e}from"./logger-LESFN7Hj.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-B3It6xQY.js";import{C as l,d as u,f as d,i as f,u as p}from"./account-store-Co7p6uLK.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-F-dCBEfh.js";import{t as ee}from"./sha256-DynDhwRL.js";import{t as te}from"./runtime-env-DadgceZk.js";import{t as ne}from"./slugify-BYJ6QVAt.js";import{i as re,n as ie,r as ae,t as oe}from"./host-command-CvUauhDf.js";import{a as se,c as ce,d as y,f as le,i as ue,l as de,m as fe,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye}from"./snapshot-HHgn9isb.js";import{n as be,t as b}from"./panel-rpc-accessor-B4BfPLSo.js";import{a as xe,c as Se,n as Ce,o as we,s as Te,t as Ee}from"./feature-flags-QlgHaQc1.js";import{t as De}from"./providers-CefzTaF8.js";import{r as Oe}from"./binary-cache-bSOhqXB1.js";import{i as ke,n as Ae,r as je}from"./fetch-body-CuwTaJC_.js";import{s as Me,t as Ne}from"./api-endpoint-D8lUKmPu.js";import{t as Pe}from"./compat-nGhSz-U1.js";import"./core-C1m4D34S.js";import{n as Fe,t as Ie}from"./mime-types-D7IV6i7k.js";import{n as Le,t as Re}from"./float-topology-COIC4j_U.js";import{t as ze}from"./secrets-bridge-client-GOCzDscb.js";import{a as Be,i as Ve,n as He,r as Ue}from"./tool-ui-DRnUkp2g.js";import{a as We,i as Ge,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as Ke,r as qe,t as Je}from"./merge-file-core-VJlzucJY.js";import{n as Ye,t as Xe}from"./types-D8gIX-W-.js";import{i as Ze}from"./mount-index-CQfmUPuZ.js";import{a as Qe,i as $e,n as et,o as tt,s as nt,t as rt}from"./signed-fetch-DeDG40wV.js";import{o as it}from"./mount-table-store-DrF_Ifaz.js";import{t as at}from"./remote-cache-UwMD8EkX.js";import{n as ot}from"./fs-D_cFUSir.js";import{a as st}from"./tray-leader-status-CpkFr6n7.js";import{n as ct,t as lt}from"./slicc-version-BxghrDTL.js";import{a as ut,i as dt,o as ft,r as C,t as pt}from"./browser-CGX7MbCQ.js";import{t as w}from"./subcommand-flags-BZi7j78Q.js";import{n as mt,r as ht,t as T}from"./subcommand-help-CgO7wRS5.js";import{n as gt}from"./cost-command-TMcbUPyN.js";import{d as _t,g as vt,i as yt,n as bt,o as xt}from"./sudoers-BdBYQPUn.js";import{t as St}from"./sudo-refusal-DVwTXFRE.js";import{n as Ct}from"./types-Dj5TU-Qg.js";import{a as wt,c as Tt,i as Et,l as Dt,n as Ot,o as kt,r as At,t as jt}from"./types-JfhqX7lD.js";import{n as E,t as Mt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Nt}from"./html-B_Hg2WOy.js";import{n as Pt}from"./llm-session-id-CKpY5F_-.js";import{t as Ft}from"./src-CUSndb9K.js";import{i as It,o as Lt}from"./browser-DuyhpHbR.js";import{a as Rt,c as zt,i as Bt,n as Vt,o as Ht,s as Ut,t as Wt}from"./pipe-status-BBrT3VeG.js";import{i as Gt,r as Kt,t as qt}from"./mount-picker-popup-BMils9JY.js";import{t as Jt}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Yt,B as D,C as Xt,D as O,E as Zt,F as Qt,G as $t,H as k,I as A,J as en,K as tn,L as nn,M as rn,N as an,O as on,P as sn,R as cn,S as ln,T as un,U as dn,V as fn,W as pn,Y as mn,_ as hn,a as gn,b as _n,c as vn,d as yn,f as bn,g as xn,h as Sn,i as Cn,j as wn,k as Tn,l as En,m as Dn,n as On,o as kn,p as j,q as An,r as jn,s as Mn,t as Nn,u as Pn,v as Fn,w as In,x as Ln,y as Rn,z as zn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{C as Bn,S as M,a as Vn,b as Hn,c as Un,d as Wn,f as Gn,g as Kn,i as qn,l as Jn,m as Yn,n as Xn,o as Zn,p as Qn,r as $n,s as er,t as tr,u as nr,x as rr,y as N}from"./state-Dx_7TiP6.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-Bdgu8kD2.js";import{a as P,i as cr,r as lr,t as ur}from"./just-bash-compat-B-SPHuh_.js";import{h as dr,i as fr,r as pr}from"./stdio-tty-CipJs8Mm.js";import{i as mr,r as hr}from"./global-prefix-DqCuANmV.js";import{t as gr}from"./wasm-programs-Bd5YaoqY.js";import{a as _r,n as vr,o as yr,r as br,s as xr}from"./jsh-discovery-CnvNKojr.js";import{C as Sr,a as Cr,b as wr,c as Tr,d as Er,f as Dr,h as Or,i as kr,l as Ar,m as jr,n as Mr,o as Nr,p as Pr,r as Fr,s as Ir,t as F,u as Lr,v as Rr,y as zr}from"./shared-D-ZRFYou.js";import{_ as Br,a as Vr,b as Hr,d as Ur,f as Wr,g as Gr,h as Kr,i as qr,l as Jr,m as Yr,p as Xr,r as Zr,s as Qr,u as $r,v as ei,y as ti}from"./require-guards-dUdxJmkR.js";import{_ as ni,a as ri,b as ii,c as ai,d as oi,f as si,g as ci,h as li,l as ui,m as di,n as fi,p as pi,s as mi,t as hi,u as gi,v as _i,x as vi,y as yi}from"./jsh-executor-BVRmWOcY.js";import{n as bi,t as xi}from"./esbuild-wasm-DeTghvWH.js";import{n as Si}from"./wasm-compiler-Ct7QZURL.js";import{a as Ci,o as wi,s as Ti,t as Ei}from"./usb-device-registry-DFzxaOky.js";import{i as Di,r as Oi,t as ki}from"./script-catalog-D5joO5l7.js";import{a as Ai,c as ji,o as Mi,s as Ni,t as Pi}from"./types-Dzr0qYl3.js";import{a as Fi,c as Ii,d as Li,f as Ri,n as zi,r as Bi,u as Vi}from"./github-zip-CMSbKC3q.js";import{i as Hi,t as Ui}from"./github-auth-D-_-pCrt.js";import{a as Wi,i as Gi,o as Ki,r as qi,t as Ji}from"./provenance-DdmsQ3Nr.js";import{a as Yi,c as Xi,i as Zi,n as Qi,o as $i,r as ea,s as ta}from"./github-install-NHKpL-_w.js";import{n as na,t as ra}from"./magick-wasm-BbnwhVj1.js";import{i as ia,n as aa,r as oa,t as sa}from"./pdf-raster-BWk6ezTX.js";import{n as ca}from"./lick-target-env-8JxfVcIV.js";import{t as la}from"./tmpdir-env-ate4iNcK.js";import{n as ua,t as da}from"./keyboard-TcuVIW9F.js";import{n as fa,t as pa}from"./hf-defaults-BwJdGLgk.js";import{t as ma}from"./ffmpeg-wasm-sx-3yVAE.js";import{t as ha}from"./local-llm-BTE5kJfp.js";import{i as ga,n as _a,r as va,t as ya}from"./tar-BWIPCxI2.js";import{a as ba,c as xa,i as Sa,o as Ca,r as wa,s as Ta}from"./v86-vm-DCm7zA2r.js";import{n as Ea,r as Da}from"./lick-urls-CgPiVwD-.js";let Oa=null;function ka(e){Oa=e!==null&&Number.isFinite(e)&&e>0?e:null}function Aa(){if(Oa!==null)return Oa;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const ja=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ma(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=ja.exec(t.split(`.`)[0]??``);if(!n||!t.includes(`.`))return null;let r=n[1].toLowerCase();return`${[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20)].join(`-`)}.${n[2].toLowerCase()}`}[`ghp_`,`gho_`,`ghu_`,`ghs_`,`ghr_`,`github_pat_`,`sk-`,`pk-`,`xoxb-`,`xoxp-`,`xoxa-`,`xoxs-`,`AKIA`,`ABIA`,`ACCA`,`ASIA`,`sk-ant-`,`Bearer `].sort((e,t)=>t.length-e.length);function Na(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n===`*`)return!0;if(!n.startsWith(`*.`))return n===r;let i=n.slice(1);return r.length>i.length&&r.endsWith(i)}function Pa(e,t){return e.some(e=>Na(e,t))}const Fa=`slicc-transcript`,Ia=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],La=new Set(`/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Ra(e){return La.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var za=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Ba=new Set(Ia),Va=/^[0-9a-fA-F]{64}$/,Ha=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ua(e){return typeof e==`string`&&Va.test(e)}function Wa(e){return Ha.test(e)&&Number.isFinite(Date.parse(e))}function Ga(e,t){let n=t.map(e=>`"${e}"`),r=n[n.length-1];return n.length===2?`${e} must be ${n[0]} or ${r}`:`${e} must be ${n.slice(0,-1).join(`, `)}, or ${r}`}function Ka(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ga(n,t)}:{ok:!0}}function qa(e,t,n){for(let r=0;r<e.length;r++){let i=t(e[r],`${n}[${r}]`);if(!i.ok)return i}return{ok:!0}}function Ja(e,t){let n=e.type;if(n===`text`){if(typeof e.text!=`string`)return{ok:!1,error:`${t}.text must be a string`}}else if(n===`tool-call`){if(typeof e.id!=`string`||e.id===``)return{ok:!1,error:`${t}.id must be a non-empty string`};if(typeof e.name!=`string`||e.name===``)return{ok:!1,error:`${t}.name must be a non-empty string`};if(!(`input`in e))return{ok:!1,error:`${t}.input must be present`}}else if(typeof e.attachmentId!=`string`||e.attachmentId===``)return{ok:!1,error:`${t}.attachmentId must be a non-empty string`};return{ok:!0}}function Ya(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ka(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ja(e,t):n}function Xa(e,t){for(let n of[`input`,`output`,`cacheRead`,`cacheWrite`,`totalTokens`]){let r=e[n];if(typeof r!=`number`)return{ok:!1,error:`${t}.${n} must be a number`};if(!Number.isInteger(r)||r<0)return{ok:!1,error:`${t}.${n} must be a non-negative integer`}}return{ok:!0}}function Za(e,t){for(let n of[`input`,`output`,`cacheRead`,`cacheWrite`,`total`]){let r=e[n];if(typeof r!=`number`)return{ok:!1,error:`${t}.${n} must be a number`};if(!Number.isFinite(r)||r<0)return{ok:!1,error:`${t}.${n} must be a finite non-negative number`}}return{ok:!0}}function Qa(e,t){let n=Xa(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?Za(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function $a(e,t){if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.sequence!=`number`)return{ok:!1,error:`${t}.sequence must be a number`};let n=e.sequence;return!Number.isInteger(n)||n<1?{ok:!1,error:`${t}.sequence must be a positive integer`}:typeof e.timestamp==`string`?Wa(e.timestamp)?{ok:!0}:{ok:!1,error:`${t}.timestamp must be a valid ISO 8601 date-time string`}:{ok:!1,error:`${t}.timestamp must be a string`}}function eo(e,t){let n=e.toolCallId;return typeof n!=`string`||n===``?{ok:!1,error:`${t}.toolCallId must be a non-empty string for tool-result messages`}:{ok:!0}}function to(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?Qa(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function no(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ka(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=eo(e,t);if(!n.ok)return n}let r=$a(e,t);if(!r.ok)return r;let i=e.content;if(!Array.isArray(i))return{ok:!1,error:`${t}.content must be an array`};let a=qa(i,Ya,`${t}.content`);return a.ok?to(e,t):a}function ro(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.name!=`string`)return{ok:!1,error:`${t}.name must be a string`};let n=Ka(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?qa(r,no,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function io(e,t){for(let n of[`id`,`path`,`originalName`,`mimeType`,`sha256`,`sourceConversationId`,`sourceMessageId`])if(typeof e[n]!=`string`)return{ok:!1,error:`${t}.${n} must be a string`};return{ok:!0}}function ao(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?{ok:!1,error:`${t}.path must be non-empty when present`}:Ua(r)?!Number.isInteger(i)||i<0?{ok:!1,error:`${t}.byteLength must be a non-negative integer when present`}:e.missingReason===void 0?{ok:!0}:{ok:!1,error:`${t}.missingReason must be absent when present is true`}:{ok:!1,error:`${t}.sha256 must be a 64-char hex string when present`}}const oo=[`attachment-file-missing`,`attachment-association-unavailable`];function so(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ka(e.missingReason,oo,`${t}.missingReason`):{ok:!1,error:`${t}.byteLength must be zero when not present`}:{ok:!1,error:`${t}.sha256 must be empty when not present`}:{ok:!1,error:`${t}.path must be empty when not present`}}function co(e,t){return e.present?ao(e,t):so(e,t)}function lo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=io(e,t);if(!n.ok)return n;if(typeof e.byteLength!=`number`)return{ok:!1,error:`${t}.byteLength must be a number`};if(typeof e.present!=`boolean`)return{ok:!1,error:`${t}.present must be a boolean`};let r=Ka(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?co(e,t):r}function uo(e,t){let n=Ka(e.kind,[`json`,`attachment`],`${t}.kind`);if(!n.ok)return n;if(e.kind===`json`){if(typeof e.pointer!=`string`)return{ok:!1,error:`${t}.pointer must be a string`};let n=e.pointer;if(n!==``&&!n.startsWith(`/`))return{ok:!1,error:`${t}.pointer must be a valid RFC 6901 JSON pointer`}}else if(typeof e.attachmentId!=`string`||e.attachmentId===``)return{ok:!1,error:`${t}.attachmentId must be a non-empty string`};return{ok:!0}}function fo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.category!=`string`)return{ok:!1,error:`${t}.category must be a string`};let n=Ka(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?uo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function po(e,t){return I(e)?typeof e.sourceConversationId==`string`?typeof e.targetConversationId==`string`?{ok:!0}:{ok:!1,error:`${t}.targetConversationId must be a string`}:{ok:!1,error:`${t}.sourceConversationId must be a string`}:{ok:!1,error:`${t} must be a non-null object`}}function mo(e,t){return typeof e!=`string`||!Ba.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function ho(e){if(!I(e))return{ok:!1,error:`export must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`export.id must be a string`};if(typeof e.generatedAt!=`string`)return{ok:!1,error:`export.generatedAt must be a string`};if(e.format!==`slicc-transcript`)return{ok:!1,error:`export.format must equal "slicc-transcript"`};let t=e.producer;return I(t)?t.application===`slicc`?typeof t.version==`string`?{ok:!0}:{ok:!1,error:`export.producer.version must be a string`}:{ok:!1,error:`export.producer.application must equal "slicc"`}:{ok:!1,error:`export.producer must be a non-null object`}}function go(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ka(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?qa(e.missing,mo,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function _o(e){if(!I(e))return{ok:!1,error:`session must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`session.id must be a string`};if(typeof e.title!=`string`)return{ok:!1,error:`session.title must be a string`};let t=Ka(e.state,[`active`,`frozen`],`session.state`);return t.ok?go(e.completeness):t}function vo(e){if(!I(e))return{ok:!1,error:`privacy must be a non-null object`};if(e.reasoningExcluded!==!0)return{ok:!1,error:`privacy.reasoningExcluded must be true`};let t=e.excludedReasoningBlocks;if(typeof t!=`number`)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a number`};if(!Number.isInteger(t)||t<0)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a non-negative integer`};if(e.binaryAttachments!==`included-unchanged`)return{ok:!1,error:`privacy.binaryAttachments must equal "included-unchanged"`};if(!I(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?qa(n,fo,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function yo(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=qa(t,ro,`conversations`);if(!n.ok)return n;let r=e.delegations;if(!Array.isArray(r))return{ok:!1,error:`delegations must be an array`};let i=qa(r,po,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?qa(a,lo,`attachments`):{ok:!1,error:`attachments must be an array`}}function bo(e){let t=new Set,n=new Set;for(let r of e){if(!I(r)||typeof r.id!=`string`)continue;if(t.has(r.id))return{ok:!1,error:`duplicate conversation id "${r.id}"`};t.add(r.id);let e=r.messages;if(Array.isArray(e)){for(let t of e)if(!(!I(t)||typeof t.id!=`string`)){if(n.has(t.id))return{ok:!1,error:`duplicate message id "${t.id}"`};n.add(t.id)}}}return{ok:!0}}function xo(e){for(let t of e){if(!I(t))continue;let e=t.messages;if(!Array.isArray(e))continue;let n=typeof t.id==`string`?t.id:`?`,r=0;for(let t of e){if(!I(t)||typeof t.sequence!=`number`)continue;let e=t.sequence;if(e<=r)return{ok:!1,error:`sequences in conversation "${n}" must be strictly increasing`};r=e}}return{ok:!0}}function So(e){let t=[];for(let n of e){if(!I(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)I(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function Co(e){let t=new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of So(e))t.add(n)}return t}function wo(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n)||n.role!==`tool-result`)continue;let e=n.toolCallId;if(typeof e==`string`&&e!==``&&!t.has(e))return{ok:!1,error:`tool-result message references unknown toolCallId "${e}"`}}}return{ok:!0}}function To(e){return wo(e,Co(e))}function Eo(e,t){for(let n of e){if(!I(n)||n.type!==`attachment-ref`)continue;let e=n.attachmentId;if(typeof e!=`string`||!t.has(e))return{ok:!1,error:`attachment-ref references unknown attachmentId "${e}"`}}return{ok:!0}}function Do(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=Eo(e,t);if(!r.ok)return r}}return{ok:!0}}function Oo(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Do(e,n)}function ko(e){let t=new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=new Set,r=n.messages;if(Array.isArray(r))for(let t of r)I(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function Ao(e,t){let n=ko(t);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.sourceConversationId,a=r.sourceMessageId;if(typeof i!=`string`||typeof a!=`string`)continue;let o=n.get(i);if(!o)return{ok:!1,error:`attachments[${t}].sourceConversationId "${i}" does not exist`};if(!o.has(a))return{ok:!1,error:`attachments[${t}].sourceMessageId "${a}" does not exist in conversation "${i}"`}}return{ok:!0}}function jo(e){let t=new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(So(e)))}return t}function Mo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!I(i))continue;let a=i.sourceConversationId,o=i.targetConversationId;if(typeof a!=`string`||!t.has(a))return{ok:!1,error:`delegations[${r}].sourceConversationId "${a}" does not exist`};if(typeof o!=`string`||!t.has(o))return{ok:!1,error:`delegations[${r}].targetConversationId "${o}" does not exist`};let s=i.toolCallId;if(typeof s==`string`&&s!==``&&!n.get(a)?.has(s))return{ok:!1,error:`delegations[${r}].toolCallId "${s}" does not exist in source conversation "${a}"`}}return{ok:!0}}function No(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Mo(e,n,jo(t))}function Po(e,t,n){if(e.kind!==`attachment`)return{ok:!0};let r=e.attachmentId;return typeof r!=`string`||!t.has(r)?{ok:!1,error:`${n}.attachmentId "${r}" does not reference a known attachment`}:{ok:!0}}function Fo(e,t){let n=new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.target;if(!I(i))continue;let a=Po(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Io(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=bo(t);if(!o.ok)return o;let s=xo(t);if(!s.ok)return s;let c=To(t);if(!c.ok)return c;let l=Oo(t,n);if(!l.ok)return l;let u=Ao(n,t);if(!u.ok)return u;let d=No(r,t);return d.ok?Fo(a,n):d}function Lo(e){let t=yo(e);return t.ok?Io(e):t}function Ro(e){if(!I(e))return{ok:!1,error:`document must be a non-null object`};if(e.schemaVersion!==1)return{ok:!1,error:`schemaVersion must equal 1`};let t=ho(e.export);if(!t.ok)return t;let n=_o(e.session);if(!n.ok)return n;let r=vo(e.privacy);return r.ok?Lo(e):r}async function zo(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:tt});if(r.status===401||r.status===403)throw Error(`not authorized to read the site config for ${e}/${t} — log in via Settings → Providers → Adobe, or pass --backend to skip the probe`);if(r.status===404)throw Error(`no site config for ${e}/${t} — check the org and site names`);if(r.status>=400)throw Error(`site config probe failed for ${e}/${t}: ${r.status}`);let i;try{i=await r.json()}catch(n){throw Error(`site config for ${e}/${t} is not JSON: ${n instanceof Error?n.message:String(n)}`)}let a=i.content?.source?.url;return{backend:Bo(a),sourceUrl:a}}function Bo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Vo=`slicc-sprinkle-routes`;function Ho(){try{let e=localStorage.getItem(Vo);return e?JSON.parse(e):{}}catch{return{}}}function Uo(e){try{localStorage.setItem(Vo,JSON.stringify(e))}catch{}}function Wo(e){return Ho()[e]}function Go(e,t){let n=Ho();n[e]=t,Uo(n)}function Ko(e){let t=Ho();delete t[e],Uo(t)}function qo(){return Ho()}function Jo(e,t,n){return Tt(t,n,`${e} adapter does not implement ${t}.${n}`)}function Yo(e,t,n,r){let i=n.filter(e=>typeof r?.[e]==`function`),a=n.map(n=>{let i=r?.[n];return[n,typeof i==`function`?i:()=>Promise.resolve(Jo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Xo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Yo(t,`browser`,Ot,e.browser),network:Yo(t,`network`,wt,e.network),secrets:Yo(t,`secrets`,kt,e.secrets),devices:Yo(t,`devices`,At,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Yo(t,`mounts`,Et,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Yo(t,`approvals`,jt,e.approvals)}}function Zo(e={}){return Xo({adapter:`connect`,pageGestures:e.pageGestures})}function Qo(e){let t=Mt(()=>import(`./extension-ops-OtrqWANJ.js`).then(t=>t.createExtensionOps(e)));return Xo({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function $o(e={}){let t=Mt(()=>import(`./rest-ops-j0P6ql7f.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Xo({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function es(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return $o({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Qo({adapter:e,pageGestures:n});case`connect`:return Zo({pageGestures:n})}}function ts(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=n+1<e.length?e.charCodeAt(n+1):0;r>=56320&&r<=57343?(t+=e.slice(n,n+2),n+=1):t+=`�`}else t+=r>=56320&&r<=57343?`�`:e.slice(n,n+1)}return t}function ns(e){let t=String.prototype.toWellFormed;return typeof t==`function`?t.call(e):ts(e)}const rs=e(`quick-llm`);async function is(e){let t=f();if(!t)return rs.debug(`No API key for active provider — skipping`),null;let n=d(),r=u(),i;if(i=e.modelId?cs(n,e.modelId)??cs(n,r):as(n,r),!i)return rs.debug(`No model available for provider`,{providerId:n}),null;let a=ns(e.prompt),o=e.system===void 0?void 0:ns(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=ls());try{let n=(await Pe(i,{systemPrompt:o,messages:[s]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(c).length>0?c:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return rs.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function as(e,t){let n=p(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=ss(r.id),a=n.filter(e=>os(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function os(e,t,n){if(e.id===t.id)return!1;let r=t.cost?.input??1/0;if((e.cost?.input??1/0)>=r)return!1;let i=e.id.toLowerCase();switch(n){case`claude`:return i.includes(`haiku`);case`gpt`:return/(^|-)mini(-|$)|(^|-)nano(-|$)/.test(i);case`gemini`:return i.includes(`flash`);case`grok`:return/(^|-)mini(-|$)|(^|-)fast(-|$)/.test(i);case`unknown`:return!0}}function ss(e){let t=e.toLowerCase();return t.includes(`claude`)?`claude`:t.includes(`gemini`)?`gemini`:t.includes(`grok`)?`grok`:/^(gpt|o\d)/.test(t)?`gpt`:`unknown`}function cs(e,t){return p(e).find(e=>e.id===t)}function ls(){return Pt(`ui-quick-llm`)}const us=e(`sudo-suggest`),ds=[`You generalize a single shell command into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the leading command/sub-command verbatim and replace only`,`the volatile tail (args, paths, refs) with a single trailing "*".`,`Examples:`,` git push origin main -> git push*`,` rm -rf build/cache -> rm -rf*`,` npm install left-pad -> npm install*`].join(`
2
2
  `),fs=[`You generalize a single filesystem path into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the meaningful directory prefix and replace the volatile`,`leaf (and below) with "**". Examples:`,` /workspace/.git/config -> /workspace/.git/**`,` /shared/secrets/openai.key -> /shared/secrets/**`,` /workspace/src/app/main.ts -> /workspace/src/**`].join(`
3
3
  `);async function ps(e,t){if(e.suggestedPattern&&e.suggestedPattern.trim().length>0)return e.suggestedPattern.trim();let n=e.detail.trim();if(e.kind===`guest-message`||e.kind===`guest-tool`)return n;let r=e.kind===`command`?ds:fs,i=null;try{i=await is({prompt:n,system:r,maxTokens:40,temperature:0,signal:t})}catch(e){us.debug(`suggestPattern: quickLabel threw`,{error:e instanceof Error?e.message:String(e)}),i=null}return ms(i)||n}function ms(e){if(!e)return null;let t=(e.split(`
4
4
  `,1)[0]?.trim()??``).replace(/^`+/,``).replace(/`+$/,``).replace(/^["']/,``).replace(/["']$/,``).trim();return t.length===0?null:t}const hs=e(`sudo:capability-gesture`);function gs(e,t={}){let n=t.suggest??ps;return{async requestApproval(t,r){let i=r?.signal,a;if(t.suggestedPattern)a=t.suggestedPattern;else try{a=await n(t,i)}catch{a=t.detail}if(i?.aborted)return hs.warn(`sudo approval aborted before prompting — denying`,{detail:t.detail}),Ct();if(!e)return hs.warn(`no CapabilityBroker injected for the sudo gesture hop — denying (composition bug, never a guessed transport)`,{detail:t.detail}),Ct();let o=await e.approvals.request({kind:t.kind,detail:t.detail,suggestedPattern:a,...t.requester?{requester:t.requester}:{},...t.reason?{reason:t.reason}:{},...t.approver?{approver:t.approver}:{},...i?{signal:i}:{}});return o.ok?Dt(o.value,a):(hs.warn(`capability broker approvals.request failed — denying`,{message:o.message}),Ct())}}}const _s=e(`sudo:tray-first`);function vs(e,t={}){let n=t.suggest??ps,r=t.timeoutMs??6e5,i=t.getClient??(async()=>{let{getPanelRpcClient:e}=await import(`./panel-rpc-CR9k3qWE.js`).then(e=>e.r);return e()});return{async requestApproval(t,a){if(a?.signal?.aborted)return Ct();let o=t.suggestedPattern;if(!o)try{o=await n(t,a?.signal)}catch{o=t.detail}let s={...t,suggestedPattern:o},c=null;try{c=await i()}catch(e){_s.debug?.(`panel-RPC client lookup threw — using native broker`,{error:e instanceof Error?e.message:String(e)})}if(c)try{let e=await c.call(`sudo-request`,{request:s,mode:`tray-first`},{timeoutMs:r});if(e?.handled!==!1)return bs(e?.decision,o)}catch(e){_s.warn(`tray-first sudo probe failed — using native broker`,{error:e instanceof Error?e.message:String(e)})}return e.requestApproval(s,a)}}}const ys=[`user-timeout`,`cone-timeout`,`unavailable`];function bs(e,t){if(!e||typeof e!=`object`)return Ct();let n=e,r=n.attestation===`biometric`||n.attestation===`passcode`||n.attestation===`none`?n.attestation:void 0;if(n.decision===`allow`)return{decision:`allow`,...r?{attestation:r}:{}};if(n.decision===`always`)return{decision:`always`,pattern:typeof n.pattern==`string`&&n.pattern.trim().length>0?n.pattern.trim():t,...r?{attestation:r}:{}};if(n.decision!==`deny`)return Ct();let i=ys.find(e=>e===n.reason);return i?{decision:`deny`,reason:i}:{decision:`deny`}}function xs(e,t){return{requestApproval(n){return t.enqueueSudoRequest(e,n)}}}function Ss(){return`lick-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var Cs=class{pending=new Map;timeoutMs;newId;setTimer;clearTimer;onAutoSettle;constructor(e={}){this.timeoutMs=e.timeoutMs??3e5,this.newId=e.newId??Ss,this.setTimer=e.setTimer??((e,t)=>setTimeout(e,t)),this.clearTimer=e.clearTimer??(e=>clearTimeout(e)),this.onAutoSettle=e.onAutoSettle??(()=>{})}notifyAutoSettle(e,t,n){try{this.onAutoSettle(e,t,n)}catch{}}register(e,t,n){let r=this.newId();return{id:r,pending:new Promise(i=>{let a=null;Number.isFinite(this.timeoutMs)&&this.timeoutMs>0&&(a=this.setTimer(()=>{let e=this.pending.get(r);e&&(this.pending.delete(r),e.resolve(ae(`cone-timeout`)),this.notifyAutoSettle(r,`expired`,e.scoopJid))},this.timeoutMs)),this.pending.set(r,{scoopJid:e,request:t,resolve:i,timerHandle:a,approverJid:n})})}}resolve(e,t){let n=this.pending.get(e);return n?(this.pending.delete(e),n.timerHandle!=null&&this.clearTimer(n.timerHandle),n.resolve(t),!0):!1}failScoop(e){let t=0;for(let[n,r]of this.pending)r.scoopJid===e&&(this.pending.delete(n),r.timerHandle!=null&&this.clearTimer(r.timerHandle),r.resolve({decision:`deny`,reason:`unavailable`}),this.notifyAutoSettle(n,`scoop-dropped`,r.scoopJid),t++);return t}failAll(){let e=0;for(let[t,n]of this.pending)n.timerHandle!=null&&this.clearTimer(n.timerHandle),n.resolve({decision:`deny`,reason:`unavailable`}),this.notifyAutoSettle(t,`shutdown`,n.scoopJid),e++;return this.pending.clear(),e}get(e){let t=this.pending.get(e);return t?{id:e,scoopJid:t.scoopJid,request:t.request,...t.approverJid?{approverJid:t.approverJid}:{}}:null}list(){let e=[];for(let[t,n]of this.pending)e.push({id:t,scoopJid:n.scoopJid,request:n.request,...n.approverJid?{approverJid:n.approverJid}:{}});return e}size(){return this.pending.size}};e(`sudo-panel`),typeof globalThis.confirm==`function`&&globalThis.confirm.bind(globalThis),typeof globalThis.prompt==`function`&&globalThis.prompt.bind(globalThis),e(`sudo:page`),e(`sudo`);function ws(e){return re(Ts(e))}function Ts(e){let t=gs(e);return e?.adapter===`extension-direct`||e?.adapter===`extension-delegate`?t:vs(t)}let Es=null;function Ds(e){return Es=e,()=>{Es===e&&(Es=null)}}function Os(){if(!Es)throw new za(`session-not-found`);return Es}const ks=`focus`,As={type:`leaf`,surfaceId:`chat`};function js(e,t={},n={}){return{zones:{top:null,left:null,middle:null,right:null,bottom:null,...e},rowFr:{top:1,center:1,bottom:1,...n},colFr:{left:1,middle:1,right:1,...t}}}const Ms={focus:{name:`focus`,tree:js({left:As},{left:3,middle:1})}};function Ns(e){return Ms[e]??null}const Ps=`progress`;async function Fs(){try{let e=await Kt();if(e.cancelled)throw Error(`mount: cancelled`);if(e.error)throw Error(`mount: ${e.error}`);if(e.handleInIdb&&typeof e.idbKey==`string`){let t=await qt(e.idbKey);if(!t)throw Error(`mount: no directory handle found in storage`);return await Gt(t),t}throw Error(`mount: unexpected popup result`)}catch(e){throw Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}async function Is(){if(typeof window>`u`||!(`showDirectoryPicker`in window))throw Error(`mount: local picker requires a user gesture in the panel (unavailable in this runtime). Ask the agent to mount it instead.`);try{return await window.showDirectoryPicker({mode:`readwrite`})}catch(e){throw e instanceof Error&&e.name===`AbortError`?Error(`mount: cancelled`):Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}async function Ls(e,t){let n;try{({grants:n}=await e.call(`permission-request`,{kinds:[`filesystem`],description:`A command in the terminal asks to mount a local directory at ${t}.`},{timeoutMs:3e5}))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(t.replace(/^permission-request: /,``))}let r=n.find(e=>e.kind===`filesystem`);if(!r||!(`idbKey`in r))throw Error(`no directory selected`);let i=await qt(r.idbKey);if(!i)throw Error(`no directory handle found in storage`);return await Gt(i),i}function Rs(e){let t={positional:[],noProbe:!1,clearCache:!1,bodies:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n];if(r===`--source`)t.source=e[++n];else if(r===`--profile`)t.profile=e[++n];else if(r===`--backend`){let r=e[++n];r===`da`||r===`aem`?t.backend=r:t.backendError=r}else r===`--no-probe`?t.noProbe=!0:r===`--max-body-mb`?t.maxBodyMb=Number(e[++n]):r===`--clear-cache`?t.clearCache=!0:r===`--bodies`?t.bodies=!0:r===`--json`?t.json=!0:t.positional.push(r)}return t}function zs(e){let t=e.match(/^(da|aem):\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);return t?{scheme:t[1],org:t[2],name:t[3],path:(t[4]??``).replace(/^\/+/,``).replace(/\/+$/,``)}:null}const Bs=new Set([`--source`,`--profile`,`--backend`,`--max-body-mb`]);function Vs(e){for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`)return!1;if(n===`--help`||n===`-h`)return!0;Bs.has(n)&&t++}return!1}function Hs(e){return`aem://${e.org}/${e.name}${e.path?`/${e.path}`:``}`}var Us=class{options;signedFetchS3;signedFetchDa;constructor(e){this.options=e,this.signedFetchS3=e.signedFetchS3,this.signedFetchDa=e.signedFetchDa}async execute(e,t,n){let r=e[0];if(r===`--help`||r===`-h`)return this.help();if(r===`unmount`||r===`-u`)return this.handleUnmount(e.slice(1),t,`mount unmount`);if(r===`list`||r===`-l`||r===`--list`)return this.handleList();if(r===`refresh`)return this.handleRefresh(e.slice(1),t,n);if(r===`info`)return this.handleInfo(e.slice(1),t);let i=Rs(e);if(i.positional.length===0)return this.usageError(`mount: mount point required`);let a=this.resolvePath(i.positional[0],t);return i.backendError===void 0?i.source?i.source.startsWith(`s3://`)?this.mountS3(a,i):i.source.startsWith(`da://`)||i.source.startsWith(`aem://`)?this.mountAdobe(a,i):this.usageError(`mount: invalid source '${i.source}' — expected s3://..., da://... or aem://...`):this.mountLocal(a,n):this.usageError(`mount: invalid --backend '${i.backendError}' — expected 'da' or 'aem'`)}async executeUmount(e,t){return this.handleUnmount(e,t,`umount`)}async mountLocal(e,t){try{if((this.options.isScoop??(()=>!1))())throw Error(`mount: cannot mount local directories from a scoop (no UI). Ask the cone.`);let n=Be();if(!n){let n=await Ws(e);if(n)return await this.options.fs.mount(e,n,{env:t}),{stdout:`Mounted '${n.describe().displayName}' → ${e}\nIndexing in background for fast file discovery.\nNote: External changes are not auto-detected — use 'mount refresh ${e}' after modifying files outside the browser.\n`,stderr:``,exitCode:0}}let r=be()?null:b(),i;if(n){let t=this.options.acquireLocalMountViaToolUI;if(!t)throw Error(`mount: tool UI not available in this runtime`);i=await t(n,e)}else i=te()?await Fs():r?await Ls(r,e):await Is();let a=Ze.fromHandle(i,{mountId:it()});return await this.options.fs.mount(e,a,{env:t}),{stdout:`Mounted '${a.describe().displayName}' → ${e}\nIndexing in background for fast file discovery.\nNote: External changes are not auto-detected — use 'mount refresh ${e}' after modifying files outside the browser.\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`mount: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}async mountS3(e,t){if(!t.source)return this.usageError(`mount: --source required`);let n=t.profile??`default`,r=it(),i=new at({mountId:r,ttlMs:3e4}),a=new $e({source:t.source,profile:n,cache:i,maxBodyBytes:t.maxBodyMb?t.maxBodyMb*1024*1024:void 0,mountId:r,signedFetch:this.signedFetchS3??et(n)});if(!t.noProbe)try{await a.readDir(`/`)}catch(e){return await a.close(),{stdout:``,stderr:`mount: probe failed for ${t.source} — ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}return await this.options.fs.mount(e,a),{stdout:`Mounted '${a.describe().displayName}' → ${e} (profile: ${n})\n`,stderr:``,exitCode:0}}async mountAdobe(e,t){if(!t.source)return this.usageError(`mount: --source required`);let n=t.profile??`default`,r=this.signedFetchDa??rt(),i=zs(t.source);if(!i)return this.usageError(`mount: invalid source '${t.source}' — expected da://org/repo or aem://org/site`);let a=i.scheme===`aem`?`aem`:`da`,o=``;if(t.backend)a=t.backend;else if(i.scheme===`da`)try{a=(await zo(i.org,i.name,r)).backend,a===`aem`&&(o=`mount: ${i.org}/${i.name} is on Helix 6 — its content lives in the Source Bus at https://api.aem.live/${i.org}/sites/${i.name}/source, not admin.da.live. Mounting through aem://${i.org}/${i.name}. Pass --backend da to force the old endpoint.\n`)}catch(e){return{stdout:``,stderr:`mount: could not determine the content source for ${t.source} — ${e instanceof Error?e.message:String(e)}. Pass --backend da or --backend aem to skip this probe.\n`,exitCode:1}}let s=it(),c=new at({mountId:s,ttlMs:3e4}),l={source:a===`aem`?Hs(i):`da://${i.org}/${i.name}${i.path?`/${i.path}`:``}`,profile:n,cache:c,maxBodyBytes:t.maxBodyMb?t.maxBodyMb*1024*1024:void 0,mountId:s,signedFetch:r},u=a===`aem`?new nt(l):new Qe(l);if(!t.noProbe)try{await u.readDir(`/`)}catch(e){return await u.close(),{stdout:``,stderr:o+`mount: probe failed for ${l.source} — ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}return await this.options.fs.mount(e,u),{stdout:`Mounted '${u.describe().displayName}' → ${e} (profile: ${n})\n`,stderr:o,exitCode:0}}async handleUnmount(e,t,n){if(Vs(e))return n===`umount`?this.umountHelp():this.help();let r=Rs(e);if(r.positional.length===0)return{stdout:``,stderr:`${n}: path required\n`,exitCode:1};let i=this.resolvePath(r.positional[0],t);try{let e,t;if(r.clearCache){let{getAllMountEntries:n}=await import(`./mount-table-store-DrF_Ifaz.js`).then(e=>e.r),r=(await n()).find(e=>e.targetPath===i),a=r?.descriptor.kind;r&&(a===`s3`||a===`da`||a===`aem`)&&(e=r.descriptor.mountId,t=r.descriptor.kind)}await this.options.fs.unmount(i);let n=``;if(r.clearCache&&e&&t){let{RemoteMountCache:t}=await import(`./remote-cache-UwMD8EkX.js`).then(e=>e.n);await new t({mountId:e,ttlMs:3e4}).clearMount(),n=` (cache cleared)`}else r.clearCache&&(n=` (no remote cache to clear)`);return{stdout:`Unmounted ${i}${n}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`${n}: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}async handleList(){try{let e=this.options.fs.listMounts();if(e.length===0)return{stdout:`No active mounts
@@ -165,7 +165,7 @@ default (credential.helper=slicc). Reads git's key=value request on stdin.
165
165
  erase Renews SLICC's GitHub token when it was the one rejected.
166
166
  `,stderr:``,exitCode:+(r===void 0)};let i=Object.fromEntries(n.env),a=Np(P(n.stdin));return r===`get`?Rp(a,i,e):r===`erase`?zp(a,i,e):{stdout:``,stderr:``,exitCode:0}})}async function Vp(e){let t=De(`github`);if(t){if(e?.force){await t.onSilentRenew?.();return}await t.getValidAccessToken?.()}}function Hp(){let e=De(`github`);if(!e)return jp;let t=typeof localStorage>`u`?[]:l(localStorage).github;return[...e.oauthTokenDomains??jp,...t??[]]}const Up=new Map([[`jsh`,`node`]]);function Wp(e,t){return`${Up.get(e)??e} ${t.join(` `)}`.trim()}function Gp(e){return St(`sudo`,e)}async function Kp(e,t){let n=e.trim();if(!n||yt(_t(t.policy,n),t.defaultDisposition??`allow`)!==`require-approval`)return{allowed:!0};let r=await t.broker.requestApproval({kind:`command`,detail:n,...t.reason?{reason:t.reason}:{}});if(r.decision===`deny`)return{allowed:!1,message:Gp(r),exitCode:77};if(r.decision===`always`){let e=r.pattern?.trim()||n;await t.persistGrant(e)}return{allowed:!0}}const qp=`__SLICC_SUDO_REASON`,Jp=/^#!/;function Yp(e){let t=[];for(let n of e.split(`
167
167
  `)){let e=n.trim();if(e.length===0){if(t.length>0)break;continue}if(!e.startsWith(`#`))break;if(Jp.test(e))continue;let r=e.replace(/^#+/,``).trim();r&&t.push(r)}return Ut(t.join(` `))}var Xp=class{options;pendingCommandGrants=[];pendingSudoBypasses=new Map;constructor(e){this.options=e}isTransparentGatingEnabled(){let e=this.options.getSudo();return!!e&&e.transparentGating!==!1}wrapCommandForSudo(e){if(!this.isTransparentGatingEnabled()||Ap.has(e.name))return e;let t=(t,n)=>this.gateCommandDispatch(e.name,t,n);return{...e,async execute(n,r){return await t(n,r.env?.get(qp))||e.execute(n,r)}}}async gateCommandDispatch(e,t,n){let r=this.options.getSudo();if(!r)return null;let i=Wp(e,t);if(this.consumeSudoBypass(i))return null;let a=r.getPolicy();if(!a)return null;let o=await Kp(i,{policy:a,broker:r.broker,persistGrant:async e=>{this.queueGrant(e)},defaultDisposition:r.defaultDisposition,...n?{reason:n}:{}});return o.allowed?null:{stdout:``,stderr:`${o.message}\n`,exitCode:o.exitCode??77}}queueGrant(e){this.pendingCommandGrants.push(e)}registerSudoBypass(e){let t=e.trim();t&&this.pendingSudoBypasses.set(t,(this.pendingSudoBypasses.get(t)??0)+1)}consumeSudoBypass(e){let t=this.pendingSudoBypasses.get(e);return t?(t===1?this.pendingSudoBypasses.delete(e):this.pendingSudoBypasses.set(e,t-1),!0):!1}async flushPendingCommandGrants(){if(this.pendingCommandGrants.length===0)return;let e=this.pendingCommandGrants;this.pendingCommandGrants=[];for(let t of e)try{await this.persistCommandGrant(t)}catch{}}async persistCommandGrant(e){let t=this.options.getSudo()?.persistCommandGrant;if(t){await t(e);return}let n=vt(e);if(!n)return;let r=`${bt}/granted`,i=this.options.fs,a=``;try{await i.exists(r)&&(a=await i.readFile(r))}catch(e){if(!(e instanceof Xe&&e.code===`ENOENT`))throw e}let o=a&&!a.endsWith(`
168
- `)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}};const Zp={maxTraversalEntries:1e5,maxTraversalDepth:256,maxTraversalWork:1e5,maxGlobOperations:1e5,maxLiveBytes:67108864,maxInputBytes:33554432,maxArchiveBytes:134217728,maxArchiveCompressedBytes:67108864,maxArchiveEntryBytes:67108864,maxArchiveEntries:1e5};function Qp(e,t){return e?{...Zp,...t}:t}const $p=new Set([`SHLVL`,`_`]);function em(e){let t=e.split(`\0`);if(t.length<4)return null;let[n=``,r=``,i=``,...a]=t;if(!/^\d+$/.test(n)||!i.startsWith(`/`))return null;let o={};for(let e of a){let t=e.indexOf(`=`);t>0&&(o[e.slice(0,t)]=e.slice(t+1))}let s=r.trim()===``?[]:r.trim().split(/\s+/).map(Number);return{status:Number(n),pipeStatus:s,cwd:i,env:o}}function tm(e,t=[]){let n=new Set([...$p,...t]);return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function nm(e,t){if(t!==`bytes`)return e;let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t)&255;return new TextDecoder().decode(n)}async function rm(e,t){let n=[],r=dr(e=>n.push(e)),i=await t.run([`bash`,`-c`,`__slicc_save() { local __s=\$1 __p=\$2 __c __n; { printf "%s\\0%s\\0%s\\0" "\$__s" "\$__p" "\$PWD"; for __c in {A..Z} {a..z} _; do eval "__slicc_names=(\\"\\\${!\${__c}@}\\")"; for __n in "\${__slicc_names[@]}"; do [[ \${!__n@a} == *x* ]] && printf "%s=%s\\0" "\$__n" "\${!__n}"; done; done; } >&97 2>/dev/null; }; trap '__slicc_save "\$?" "\${PIPESTATUS[*]}"' EXIT; ${e}`],t.env,[[97,r]]),a=n.reduce((e,t)=>e+t.length,0),o=new Uint8Array(a),s=0;for(let e of n)o.set(e,s),s+=e.length;return{stdout:nm(i.stdout,i.stdoutKind),stderr:i.stderr,exitCode:i.exitCode,state:a>0?em(new TextDecoder().decode(o)):null}}const im=`__SLICC_RUN_PID`,am=`__SLICC_OUTPUT_TEE__`;function om(e){let t=e?.get(im);if(t===void 0)return;let n=Number.parseInt(t,10);return Number.isSafeInteger(n)&&n>0?n:void 0}var sm=class{host;constructor(e){this.host=e}async usesGnuBash(){let e=this.host;return!e.gnuBash||e.lastEnv.SLICC_SHELL===`just-bash`||typeof SharedArrayBuffer!=`function`?!1:(await e.scriptCatalog.getWasmCommands()).has(`bash`)}async runOnGnuBash(e,t,n,r,i,a){let o=this.host,{runWasmCommand:s,withoutRealmDefaults:c}=await import(`./run-DKWaudm_.js`),l=Yp(e),u={...o.lastEnv,...n===void 0?{}:{[im]:String(n)},...l?{[qp]:l}:{}},d=i===void 0?void 0:o.outputTees.get(i),f=await rm(e,{env:u,run:(e,i,a)=>s(e,this.wasmContext(i,t,r),{processConfig:o.buildJshProcessConfig(n),gate:o.gateNativeCommand,onOutput:d,fds:a,commands:()=>o.scriptCatalog.getWasmCommands(),gitIdentity:()=>o.gitIdentity()})}),p=o.lastEnv.PATH;return f.state&&(o.adoptCwd(f.state.cwd),o.adoptEnv(tm(c(f.state.env,u),[im,qp,am]))),o.lastEnv.PATH!==p&&await o.syncJshCommands().catch(()=>void 0),await o.flushPendingCommandGrants(),o.applyPendingEnvWrites(),{stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:{...o.lastEnv},...a&&f.state?{pipeStatus:f.state.pipeStatus}:{}}}wasmContext(e,t,n){let r=this.host;return{fs:r.vfsAdapter,cwd:r.cwd,env:new Map(Object.entries(e)),exportedEnv:e,stdin:n,signal:t,exec:(e,t)=>r.bash.exec(e,{...t,umask:r.umask})}}};const cm=`/home/user`;async function lm(e){try{let t=await e.readDir(`/home`),n=null,r=null;for(let i of t)if(i.type===`directory`){r??=i.name;try{let t=(await e.stat(`/home/${i.name}/.welcome.json`)).mtime??0;(!n||t>n.mtime)&&(n={name:i.name,mtime:t})}catch{}}let i=n?.name??r;return i?`/home/${i}`:cm}catch{return cm}}function um(e){return e.replace(/\/+$/,``).split(`/`).pop()||`user`}function dm(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`"`){for(r++;r<e.length&&e[r]!==`"`;)n+=e[r],r++;r++}else if(i===`'`){for(r++;r<e.length&&e[r]!==`'`;)n+=e[r],r++;r++}else i===`\\`&&r+1<e.length&&e[r+1]===` `?(n+=` `,r+=2):/\s/.test(i)?(n.length>0&&(t.push(n),n=``),r++):(n+=i,r++)}return n.length>0&&t.push(n),t}const fm=e(`almost-bash-shell`);var pm=class{host;registeredJshCommands=new Map;registeredWorkflowCommands=new Set;registeredWasmCommands=new Set;jshSyncInflight=null;jshSyncDirty=!1;constructor(e){this.host=e}scriptRegisteredNames(){return[...this.registeredJshCommands.keys(),...this.registeredWorkflowCommands,...this.registeredWasmCommands]}scanRoots(){return yr(this.host.path())}async getJshCommandNames(){return[...(await this.getFilteredJshCommands()).keys()]}async getWorkflowCommandNames(){return[...(await this.getFilteredWorkflowCommands()).keys()]}async syncJshCommands(){return this.jshSyncInflight===null?(this.jshSyncInflight=this.doSyncJshCommands(),this.jshSyncInflight):(this.jshSyncDirty=!0,this.jshSyncInflight)}async getFilteredJshCommands(){let e=await this.host.scriptCatalog.getJshCommands(this.scanRoots()),t=new Map;for(let[n,r]of e)this.host.builtinCommandNames.has(n)||this.host.isCommandAllowed(n)&&t.set(n,r);return t}async getFilteredWorkflowCommands(){let e=await this.host.scriptCatalog.getWorkflowCommands(),t=new Map;for(let[n,r]of e)this.host.isCommandAllowed(n)&&t.set(n,r);return t}async tryJshFallback(e,t){let n=e.trim(),r=n.indexOf(` `),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1).trim():``,o=(await this.getFilteredJshCommands()).get(i);if(!o)return null;let s=a?dm(a):[],c;try{let e=await this.host.discoveryFs.readFile(o,{encoding:`utf-8`});c=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${o}'\n`,exitCode:127,env:this.host.lastEnv}}let l=[`node`,o,...s],u=await hi(c,l,{fs:this.host.vfsAdapter,cwd:this.host.cwd,env:new Map(Object.entries(this.host.lastEnv)),stdin:``,exec:(e,t)=>this.host.bash.exec(e,{env:t?.env??this.host.lastEnv,cwd:t?.cwd??this.host.cwd,umask:this.host.umask,...t?.env===void 0?{}:{replaceEnv:!0}})},this.host.buildJshProcessConfig(t));return{stdout:u.stdout,stderr:u.stderr,exitCode:u.exitCode,env:this.host.lastEnv}}makeScriptCommand(e){let t=this.host,n=t.scriptCatalog,r=t.discoveryFs,i=e,a=async(e,a)=>{let o=a.exec??((e,n)=>t.bash.exec(e,{env:n?.env??Object.fromEntries(a.env),cwd:n?.cwd??a.cwd,args:n?.args,...n?.env===void 0?{}:{replaceEnv:!0}})),s=(await n.getJshCommands(this.scanRoots())).get(i);if(s){let n;try{let e=await r.readFile(s,{encoding:`utf-8`});n=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${s}'\n`,exitCode:127}}return hi(n,[`node`,s,...e],{fs:a.fs,cwd:a.cwd,env:a.env,stdin:a.stdin,exec:o},t.buildJshProcessConfig(om(a.env)))}let c=(await n.getWasmCommands()).get(i);if(c){let{runWasmCommand:r}=await import(`./run-DKWaudm_.js`);return r(c.script?[i,...e]:[`--argv0`,c.argv0,`--module`,c.wasm,c.glue,...c.args??[],...e],a,{processConfig:t.buildJshProcessConfig(om(a.env)),gate:t.gateNativeCommand,defaults:c.env,commands:()=>n.getWasmCommands(),gitIdentity:()=>t.gitIdentity()})}let l=(await n.getWorkflowCommands()).get(i);if(l){let t=Oi(l.path,e);return o(t[0],{args:t.slice(1),cwd:a.cwd})}return{stdout:``,stderr:`${i}: command no longer exists\n`,exitCode:127}};return{name:e,trusted:!0,async execute(e,t){try{return await a(e,t)}catch(e){let t=e instanceof Error?e.message:String(e);return{stdout:``,stderr:`${i}: ${t}\n`,exitCode:1}}}}}async doSyncJshCommands(){try{let e=await this.host.scriptCatalog.getJshIndex(this.scanRoots()),t=e.commands;for(let t of e.collisions)fm.warn(`jsh command '${t.name}' is provided by more than one skill; using ${t.winnerPath} (${t.reason}), shadowed ${t.shadowedPaths.join(`, `)}`);let n=await this.getFilteredWorkflowCommands(),r=await this.host.scriptCatalog.getWasmCommands();for(let[e,n]of t)this.host.isCommandAllowed(e)&&(this.host.builtinCommandNames.has(e)&&!this.registeredJshCommands.has(e)||this.registeredJshCommands.get(e)!==n&&(this.host.bash.registerCommand(this.host.wrapCommandForDispatch(this.makeScriptCommand(e))),this.registeredJshCommands.set(e,n),this.host.builtinCommandNames.add(e)));let i=[...r.keys()].filter(e=>this.host.isCommandAllowed(e));this.registerLateScriptNames(i,this.registeredWasmCommands),this.registerLateScriptNames(n.keys(),this.registeredWorkflowCommands)}finally{this.jshSyncInflight=null,this.jshSyncDirty&&(this.jshSyncDirty=!1,this.syncJshCommands().catch(()=>void 0))}}registerLateScriptNames(e,t){let n=[this.registeredJshCommands,this.registeredWasmCommands,this.registeredWorkflowCommands];for(let r of e)if(!t.has(r)){if(n.some(e=>e!==t&&e.has(r))){t.add(r);continue}this.host.builtinCommandNames.has(r)||(this.host.bash.registerCommand(this.host.wrapCommandForDispatch(this.makeScriptCommand(r))),t.add(r),this.host.builtinCommandNames.add(r))}}},mm=class{aggregator=null;now;explicitSink;scrubLabel;ids=new Map;seq=0;constructor(e={}){this.now=e.now??Date.now,this.explicitSink=e.sink,this.scrubLabel=e.scrubLabel}allocateId(e=`p`){return this.seq+=1,`${e}-${this.seq}`}hasSink(){return this.resolveSink()!==null}setAggregator(e){this.aggregator=e}emit(e){let t=this.aggregator;if(t&&e.id!==t.id)return t.onChild(e),!0;let n=this.resolveSink();if(!n)return e.phase===`end`&&this.ids.delete(e.id),!1;let r=this.ids.get(e.id);if(e.phase===`update`){if(!r)return!1;let t=this.now();return t-r.lastUpdateAt<250?!1:(r.lastUpdateAt=t,this.deliver(r,n,e),!0)}if(e.phase===`start`){let t={lastUpdateAt:-1/0,rawLabel:e.label,label:this.scrubbed(e.label),tail:Promise.resolve()};return this.ids.set(e.id,t),this.deliver(t,n,e),!0}return r?(this.ids.delete(e.id),this.deliver(r,n,e),!0):!1}resolveSink(){if(this.explicitSink)return this.explicitSink;let e=Be();if(!e)return null;let t=e.onUpdate;return e=>{t({content:[{type:Ps,progress:e}]})}}scrubbed(e){return this.scrubLabel?hm(this.scrubLabel,e):e}deliver(e,t,n){n.label!==e.rawLabel&&(e.rawLabel=n.label,e.label=this.scrubbed(n.label));let{label:r}=e;if(typeof r==`string`){let e=gm(r);t(e===n.label?n:{...n,label:e});return}e.tail=e.tail.then(async()=>{let i=await r;e.label=i,t({...n,label:gm(i)})})}};async function hm(e,t){if(!t)return t;try{return await e(t)}catch{return`[label withheld: secret scrub unavailable]`}}function gm(e,t=80){return e.length>t?`${e.slice(0,t-1)}…`:e}function _m(e,t){return t.length?`${e} ${t.join(` `)}`:e}function vm(e){try{let t=new URL(e);return`↓ ${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return`↓ ${e}`}}function ym(e,t=Date.now){let n=new Map,r=e=>n.get(e)?.[0];return{start(r,i){if(!e.hasSink())return;let a={id:e.allocateId(`net`),label:vm(r),startedAt:t()},o=n.get(r);o?o.push(a):n.set(r,[a]),e.emit({id:a.id,label:a.label,fraction:i===void 0?void 0:0,done:0,total:i,unit:`bytes`,phase:`start`})},chunk(n,i,a){let o=r(n);if(!o)return;let s,c;if(a!==void 0&&a>0){s=Math.min(1,i/a);let e=t()-o.startedAt;i>0&&(c=Math.max(0,e/i*(a-i)))}e.emit({id:o.id,label:o.label,fraction:s,etaMs:c,done:i,total:a,unit:`bytes`,phase:`update`})},end(t){let r=n.get(t),i=r?.shift();r&&r.length===0&&n.delete(t),i&&e.emit({id:i.id,label:i.label,fraction:1,etaMs:0,unit:`bytes`,phase:`end`})}}}const bm={timeout:e=>{let t=0;for(;t<e.length&&e[t].startsWith(`-`)&&e[t]!==`--`;)[`-k`,`--kill-after`,`-s`,`--signal`].includes(e[t])&&(t+=1),t+=1;return e[t]===`--`&&(t+=1),t+1},env:e=>{let t=0;for(;t<e.length&&(e[t].startsWith(`-`)||e[t].includes(`=`));)t+=1;return t},nohup:()=>0,nice:e=>{let t=0;for(;t<e.length&&e[t].startsWith(`-`);)t+=1;return t}},xm=new Set([`xargs`,`watch`,`parallel`,`bash`,`sh`,`eval`,`source`,`.`]);function Sm(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:case`SingleQuoted`:case`Escaped`:t+=n.value;break;case`DoubleQuoted`:for(let e of n.parts){if(e.type!==`Literal`&&e.type!==`Escaped`)return null;t+=e.value}break;default:return null}return t}function Cm(e,t){switch(e.type){case`CommandSubstitution`:return Pm(e.body,t);case`DoubleQuoted`:{let n=0;for(let r of e.parts){let e=Cm(r,t);if(e===null)return null;n+=e}return n}case`ProcessSubstitution`:return null;default:return 0}}function wm(e,t){let n=0;for(let r of e.parts){let e=Cm(r,t);if(e===null)return null;n+=e}return n}function Tm(e,t){let n=0;for(let r of e.assignments){if(!r.value)continue;let e=wm(r.value,t);if(e===null)return null;n+=e}for(let r of e.args){let e=wm(r,t);if(e===null)return null;n+=e}if(!e.name)return n;let r=Sm(e.name);if(r===null||xm.has(r))return null;if(!t.has(r))return n;n+=1;let i=bm[r];if(i){let r=e.args.map(Sm);if(r.some(e=>e===null))return null;let a=r[i(r)];if(a===void 0)return n;if(xm.has(a))return null;t.has(a)&&(n+=1)}return n}function Em(e){let t=typeof e.start==`number`?e.start:Number(e.start),n=typeof e.end==`number`?e.end:Number(e.end);if(!Number.isFinite(t)||!Number.isFinite(n)){let t=String(e.start),n=String(e.end);return t.length!==1||n.length!==1?null:Math.abs(n.charCodeAt(0)-t.charCodeAt(0))+1}let r=Math.abs(e.step??1)||1;return Math.floor(Math.abs(n-t)/r)+1}function Dm(e){if(e.parts.length!==1||e.parts[0].type!==`CommandSubstitution`)return null;let t=e.parts[0].body;if(t.statements.length!==1)return null;let n=t.statements[0];if(n.pipelines.length!==1||n.pipelines[0].commands.length!==1)return null;let r=n.pipelines[0].commands[0];if(r.type!==`SimpleCommand`||!r.name||Sm(r.name)!==`seq`)return null;let i=r.args.map(e=>{let t=Sm(e);return t===null?NaN:Number(t)});if(i.some(e=>!Number.isFinite(e)))return null;let a=1,o=1,s;if(i.length===1)[s]=i;else if(i.length===2)[a,s]=i;else if(i.length===3)[a,o,s]=i;else return null;if(o===0)return null;let c=Math.floor((s-a)/o)+1;return c>0?c:0}function Om(e){let t=0;for(let n of e){let e=n.type===`Word`?km(n.word):Em(n);if(e===null)return null;t+=e}return t}function km(e){let t=Dm(e);if(t!==null)return t;let n=1;for(let t of e.parts)switch(t.type){case`Literal`:case`SingleQuoted`:case`Escaped`:break;case`DoubleQuoted`:if(t.parts.some(e=>e.type!==`Literal`&&e.type!==`Escaped`))return null;break;case`BraceExpansion`:{let e=Om(t.items);if(e===null)return null;n*=e;break}default:return null}return n}function Am(e){let t=0;for(let n of e){let e=km(n);if(e===null)return null;t+=e}return t}function jm(e,t){let n=0;for(let r of e){let e=Nm(r,t);if(e===null)return null;n+=e}return n}function Mm(e,t){switch(e.type){case`SimpleCommand`:return Tm(e,t);case`For`:{if(!e.words)return null;let n=Am(e.words),r=jm(e.body,t);return n===null||r===null?null:e.words.filter(e=>Dm(e)!==null&&t.has(`seq`)).length+n*r}case`Subshell`:case`Group`:return jm(e.body,t);case`FunctionDef`:return 0;default:return null}}function Nm(e,t){let n=0;for(let r of e.pipelines)for(let e of r.commands){let r=Mm(e,t);if(r===null)return null;n+=r}return n}function Pm(e,t){return jm(e.statements,t)}function Fm(e,t){let n=Pm(e,t);return{totalSteps:n!==null&&n>0?n:null}}function Im(e){return e.split(`
168
+ `)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}};const Zp={maxTraversalEntries:1e5,maxTraversalDepth:256,maxTraversalWork:1e5,maxGlobOperations:1e5,maxLiveBytes:67108864,maxInputBytes:33554432,maxArchiveBytes:134217728,maxArchiveCompressedBytes:67108864,maxArchiveEntryBytes:67108864,maxArchiveEntries:1e5};function Qp(e,t){return e?{...Zp,...t}:t}const $p=new Set([`SHLVL`,`_`]);function em(e){let t=e.split(`\0`);if(t.length<4)return null;let[n=``,r=``,i=``,...a]=t;if(!/^\d+$/.test(n)||!i.startsWith(`/`))return null;let o={};for(let e of a){let t=e.indexOf(`=`);t>0&&(o[e.slice(0,t)]=e.slice(t+1))}let s=r.trim()===``?[]:r.trim().split(/\s+/).map(Number);return{status:Number(n),pipeStatus:s,cwd:i,env:o}}function tm(e,t=[]){let n=new Set([...$p,...t]);return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function nm(e,t){if(t!==`bytes`)return e;let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t)&255;return new TextDecoder().decode(n)}async function rm(e,t){let n=[],r=dr(e=>n.push(e)),i=await t.run([`bash`,`-c`,`__slicc_save() { local __s=\$1 __p=\$2 __c __n; { printf "%s\\0%s\\0%s\\0" "\$__s" "\$__p" "\$PWD"; for __c in {A..Z} {a..z} _; do eval "__slicc_names=(\\"\\\${!\${__c}@}\\")"; for __n in "\${__slicc_names[@]}"; do [[ \${!__n@a} == *x* ]] && printf "%s=%s\\0" "\$__n" "\${!__n}"; done; done; } >&97 2>/dev/null; }; trap '__slicc_save "\$?" "\${PIPESTATUS[*]}"' EXIT; ${e}`],t.env,[[97,r]]),a=n.reduce((e,t)=>e+t.length,0),o=new Uint8Array(a),s=0;for(let e of n)o.set(e,s),s+=e.length;return{stdout:nm(i.stdout,i.stdoutKind),stderr:i.stderr,exitCode:i.exitCode,state:a>0?em(new TextDecoder().decode(o)):null}}const im=`__SLICC_RUN_PID`,am=`__SLICC_OUTPUT_TEE__`;function om(e){let t=e?.get(im);if(t===void 0)return;let n=Number.parseInt(t,10);return Number.isSafeInteger(n)&&n>0?n:void 0}var sm=class{host;constructor(e){this.host=e}async usesGnuBash(){let e=this.host;return!e.gnuBash||e.lastEnv.SLICC_SHELL===`just-bash`||typeof SharedArrayBuffer!=`function`?!1:(await e.scriptCatalog.getWasmCommands()).has(`bash`)}async runOnGnuBash(e,t,n,r,i,a){let o=this.host,{runWasmCommand:s,withoutRealmDefaults:c}=await import(`./run-DW65sPip.js`),l=Yp(e),u={...o.lastEnv,...n===void 0?{}:{[im]:String(n)},...l?{[qp]:l}:{}},d=i===void 0?void 0:o.outputTees.get(i),f=await rm(e,{env:u,run:(e,i,a)=>s(e,this.wasmContext(i,t,r),{processConfig:o.buildJshProcessConfig(n),gate:o.gateNativeCommand,onOutput:d,fds:a,commands:()=>o.scriptCatalog.getWasmCommands(),gitIdentity:()=>o.gitIdentity()})}),p=o.lastEnv.PATH;return f.state&&(o.adoptCwd(f.state.cwd),o.adoptEnv(tm(c(f.state.env,u),[im,qp,am]))),o.lastEnv.PATH!==p&&await o.syncJshCommands().catch(()=>void 0),await o.flushPendingCommandGrants(),o.applyPendingEnvWrites(),{stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:{...o.lastEnv},...a&&f.state?{pipeStatus:f.state.pipeStatus}:{}}}wasmContext(e,t,n){let r=this.host;return{fs:r.vfsAdapter,cwd:r.cwd,env:new Map(Object.entries(e)),exportedEnv:e,stdin:n,signal:t,exec:(e,t)=>r.bash.exec(e,{...t,umask:r.umask})}}};const cm=`/home/user`;async function lm(e){try{let t=await e.readDir(`/home`),n=null,r=null;for(let i of t)if(i.type===`directory`){r??=i.name;try{let t=(await e.stat(`/home/${i.name}/.welcome.json`)).mtime??0;(!n||t>n.mtime)&&(n={name:i.name,mtime:t})}catch{}}let i=n?.name??r;return i?`/home/${i}`:cm}catch{return cm}}function um(e){return e.replace(/\/+$/,``).split(`/`).pop()||`user`}function dm(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`"`){for(r++;r<e.length&&e[r]!==`"`;)n+=e[r],r++;r++}else if(i===`'`){for(r++;r<e.length&&e[r]!==`'`;)n+=e[r],r++;r++}else i===`\\`&&r+1<e.length&&e[r+1]===` `?(n+=` `,r+=2):/\s/.test(i)?(n.length>0&&(t.push(n),n=``),r++):(n+=i,r++)}return n.length>0&&t.push(n),t}const fm=e(`almost-bash-shell`);var pm=class{host;registeredJshCommands=new Map;registeredWorkflowCommands=new Set;registeredWasmCommands=new Set;jshSyncInflight=null;jshSyncDirty=!1;constructor(e){this.host=e}scriptRegisteredNames(){return[...this.registeredJshCommands.keys(),...this.registeredWorkflowCommands,...this.registeredWasmCommands]}scanRoots(){return yr(this.host.path())}async getJshCommandNames(){return[...(await this.getFilteredJshCommands()).keys()]}async getWorkflowCommandNames(){return[...(await this.getFilteredWorkflowCommands()).keys()]}async syncJshCommands(){return this.jshSyncInflight===null?(this.jshSyncInflight=this.doSyncJshCommands(),this.jshSyncInflight):(this.jshSyncDirty=!0,this.jshSyncInflight)}async getFilteredJshCommands(){let e=await this.host.scriptCatalog.getJshCommands(this.scanRoots()),t=new Map;for(let[n,r]of e)this.host.builtinCommandNames.has(n)||this.host.isCommandAllowed(n)&&t.set(n,r);return t}async getFilteredWorkflowCommands(){let e=await this.host.scriptCatalog.getWorkflowCommands(),t=new Map;for(let[n,r]of e)this.host.isCommandAllowed(n)&&t.set(n,r);return t}async tryJshFallback(e,t){let n=e.trim(),r=n.indexOf(` `),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1).trim():``,o=(await this.getFilteredJshCommands()).get(i);if(!o)return null;let s=a?dm(a):[],c;try{let e=await this.host.discoveryFs.readFile(o,{encoding:`utf-8`});c=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${o}'\n`,exitCode:127,env:this.host.lastEnv}}let l=[`node`,o,...s],u=await hi(c,l,{fs:this.host.vfsAdapter,cwd:this.host.cwd,env:new Map(Object.entries(this.host.lastEnv)),stdin:``,exec:(e,t)=>this.host.bash.exec(e,{env:t?.env??this.host.lastEnv,cwd:t?.cwd??this.host.cwd,umask:this.host.umask,...t?.env===void 0?{}:{replaceEnv:!0}})},this.host.buildJshProcessConfig(t));return{stdout:u.stdout,stderr:u.stderr,exitCode:u.exitCode,env:this.host.lastEnv}}makeScriptCommand(e){let t=this.host,n=t.scriptCatalog,r=t.discoveryFs,i=e,a=async(e,a)=>{let o=a.exec??((e,n)=>t.bash.exec(e,{env:n?.env??Object.fromEntries(a.env),cwd:n?.cwd??a.cwd,args:n?.args,...n?.env===void 0?{}:{replaceEnv:!0}})),s=(await n.getJshCommands(this.scanRoots())).get(i);if(s){let n;try{let e=await r.readFile(s,{encoding:`utf-8`});n=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${s}'\n`,exitCode:127}}return hi(n,[`node`,s,...e],{fs:a.fs,cwd:a.cwd,env:a.env,stdin:a.stdin,exec:o},t.buildJshProcessConfig(om(a.env)))}let c=(await n.getWasmCommands()).get(i);if(c){let{runWasmCommand:r}=await import(`./run-DW65sPip.js`);return r(c.script?[i,...e]:[`--argv0`,c.argv0,`--module`,c.wasm,c.glue,...c.args??[],...e],a,{processConfig:t.buildJshProcessConfig(om(a.env)),gate:t.gateNativeCommand,defaults:c.env,commands:()=>n.getWasmCommands(),gitIdentity:()=>t.gitIdentity()})}let l=(await n.getWorkflowCommands()).get(i);if(l){let t=Oi(l.path,e);return o(t[0],{args:t.slice(1),cwd:a.cwd})}return{stdout:``,stderr:`${i}: command no longer exists\n`,exitCode:127}};return{name:e,trusted:!0,async execute(e,t){try{return await a(e,t)}catch(e){let t=e instanceof Error?e.message:String(e);return{stdout:``,stderr:`${i}: ${t}\n`,exitCode:1}}}}}async doSyncJshCommands(){try{let e=await this.host.scriptCatalog.getJshIndex(this.scanRoots()),t=e.commands;for(let t of e.collisions)fm.warn(`jsh command '${t.name}' is provided by more than one skill; using ${t.winnerPath} (${t.reason}), shadowed ${t.shadowedPaths.join(`, `)}`);let n=await this.getFilteredWorkflowCommands(),r=await this.host.scriptCatalog.getWasmCommands();for(let[e,n]of t)this.host.isCommandAllowed(e)&&(this.host.builtinCommandNames.has(e)&&!this.registeredJshCommands.has(e)||this.registeredJshCommands.get(e)!==n&&(this.host.bash.registerCommand(this.host.wrapCommandForDispatch(this.makeScriptCommand(e))),this.registeredJshCommands.set(e,n),this.host.builtinCommandNames.add(e)));let i=[...r.keys()].filter(e=>this.host.isCommandAllowed(e));this.registerLateScriptNames(i,this.registeredWasmCommands),this.registerLateScriptNames(n.keys(),this.registeredWorkflowCommands)}finally{this.jshSyncInflight=null,this.jshSyncDirty&&(this.jshSyncDirty=!1,this.syncJshCommands().catch(()=>void 0))}}registerLateScriptNames(e,t){let n=[this.registeredJshCommands,this.registeredWasmCommands,this.registeredWorkflowCommands];for(let r of e)if(!t.has(r)){if(n.some(e=>e!==t&&e.has(r))){t.add(r);continue}this.host.builtinCommandNames.has(r)||(this.host.bash.registerCommand(this.host.wrapCommandForDispatch(this.makeScriptCommand(r))),t.add(r),this.host.builtinCommandNames.add(r))}}},mm=class{aggregator=null;now;explicitSink;scrubLabel;ids=new Map;seq=0;constructor(e={}){this.now=e.now??Date.now,this.explicitSink=e.sink,this.scrubLabel=e.scrubLabel}allocateId(e=`p`){return this.seq+=1,`${e}-${this.seq}`}hasSink(){return this.resolveSink()!==null}setAggregator(e){this.aggregator=e}emit(e){let t=this.aggregator;if(t&&e.id!==t.id)return t.onChild(e),!0;let n=this.resolveSink();if(!n)return e.phase===`end`&&this.ids.delete(e.id),!1;let r=this.ids.get(e.id);if(e.phase===`update`){if(!r)return!1;let t=this.now();return t-r.lastUpdateAt<250?!1:(r.lastUpdateAt=t,this.deliver(r,n,e),!0)}if(e.phase===`start`){let t={lastUpdateAt:-1/0,rawLabel:e.label,label:this.scrubbed(e.label),tail:Promise.resolve()};return this.ids.set(e.id,t),this.deliver(t,n,e),!0}return r?(this.ids.delete(e.id),this.deliver(r,n,e),!0):!1}resolveSink(){if(this.explicitSink)return this.explicitSink;let e=Be();if(!e)return null;let t=e.onUpdate;return e=>{t({content:[{type:Ps,progress:e}]})}}scrubbed(e){return this.scrubLabel?hm(this.scrubLabel,e):e}deliver(e,t,n){n.label!==e.rawLabel&&(e.rawLabel=n.label,e.label=this.scrubbed(n.label));let{label:r}=e;if(typeof r==`string`){let e=gm(r);t(e===n.label?n:{...n,label:e});return}e.tail=e.tail.then(async()=>{let i=await r;e.label=i,t({...n,label:gm(i)})})}};async function hm(e,t){if(!t)return t;try{return await e(t)}catch{return`[label withheld: secret scrub unavailable]`}}function gm(e,t=80){return e.length>t?`${e.slice(0,t-1)}…`:e}function _m(e,t){return t.length?`${e} ${t.join(` `)}`:e}function vm(e){try{let t=new URL(e);return`↓ ${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return`↓ ${e}`}}function ym(e,t=Date.now){let n=new Map,r=e=>n.get(e)?.[0];return{start(r,i){if(!e.hasSink())return;let a={id:e.allocateId(`net`),label:vm(r),startedAt:t()},o=n.get(r);o?o.push(a):n.set(r,[a]),e.emit({id:a.id,label:a.label,fraction:i===void 0?void 0:0,done:0,total:i,unit:`bytes`,phase:`start`})},chunk(n,i,a){let o=r(n);if(!o)return;let s,c;if(a!==void 0&&a>0){s=Math.min(1,i/a);let e=t()-o.startedAt;i>0&&(c=Math.max(0,e/i*(a-i)))}e.emit({id:o.id,label:o.label,fraction:s,etaMs:c,done:i,total:a,unit:`bytes`,phase:`update`})},end(t){let r=n.get(t),i=r?.shift();r&&r.length===0&&n.delete(t),i&&e.emit({id:i.id,label:i.label,fraction:1,etaMs:0,unit:`bytes`,phase:`end`})}}}const bm={timeout:e=>{let t=0;for(;t<e.length&&e[t].startsWith(`-`)&&e[t]!==`--`;)[`-k`,`--kill-after`,`-s`,`--signal`].includes(e[t])&&(t+=1),t+=1;return e[t]===`--`&&(t+=1),t+1},env:e=>{let t=0;for(;t<e.length&&(e[t].startsWith(`-`)||e[t].includes(`=`));)t+=1;return t},nohup:()=>0,nice:e=>{let t=0;for(;t<e.length&&e[t].startsWith(`-`);)t+=1;return t}},xm=new Set([`xargs`,`watch`,`parallel`,`bash`,`sh`,`eval`,`source`,`.`]);function Sm(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:case`SingleQuoted`:case`Escaped`:t+=n.value;break;case`DoubleQuoted`:for(let e of n.parts){if(e.type!==`Literal`&&e.type!==`Escaped`)return null;t+=e.value}break;default:return null}return t}function Cm(e,t){switch(e.type){case`CommandSubstitution`:return Pm(e.body,t);case`DoubleQuoted`:{let n=0;for(let r of e.parts){let e=Cm(r,t);if(e===null)return null;n+=e}return n}case`ProcessSubstitution`:return null;default:return 0}}function wm(e,t){let n=0;for(let r of e.parts){let e=Cm(r,t);if(e===null)return null;n+=e}return n}function Tm(e,t){let n=0;for(let r of e.assignments){if(!r.value)continue;let e=wm(r.value,t);if(e===null)return null;n+=e}for(let r of e.args){let e=wm(r,t);if(e===null)return null;n+=e}if(!e.name)return n;let r=Sm(e.name);if(r===null||xm.has(r))return null;if(!t.has(r))return n;n+=1;let i=bm[r];if(i){let r=e.args.map(Sm);if(r.some(e=>e===null))return null;let a=r[i(r)];if(a===void 0)return n;if(xm.has(a))return null;t.has(a)&&(n+=1)}return n}function Em(e){let t=typeof e.start==`number`?e.start:Number(e.start),n=typeof e.end==`number`?e.end:Number(e.end);if(!Number.isFinite(t)||!Number.isFinite(n)){let t=String(e.start),n=String(e.end);return t.length!==1||n.length!==1?null:Math.abs(n.charCodeAt(0)-t.charCodeAt(0))+1}let r=Math.abs(e.step??1)||1;return Math.floor(Math.abs(n-t)/r)+1}function Dm(e){if(e.parts.length!==1||e.parts[0].type!==`CommandSubstitution`)return null;let t=e.parts[0].body;if(t.statements.length!==1)return null;let n=t.statements[0];if(n.pipelines.length!==1||n.pipelines[0].commands.length!==1)return null;let r=n.pipelines[0].commands[0];if(r.type!==`SimpleCommand`||!r.name||Sm(r.name)!==`seq`)return null;let i=r.args.map(e=>{let t=Sm(e);return t===null?NaN:Number(t)});if(i.some(e=>!Number.isFinite(e)))return null;let a=1,o=1,s;if(i.length===1)[s]=i;else if(i.length===2)[a,s]=i;else if(i.length===3)[a,o,s]=i;else return null;if(o===0)return null;let c=Math.floor((s-a)/o)+1;return c>0?c:0}function Om(e){let t=0;for(let n of e){let e=n.type===`Word`?km(n.word):Em(n);if(e===null)return null;t+=e}return t}function km(e){let t=Dm(e);if(t!==null)return t;let n=1;for(let t of e.parts)switch(t.type){case`Literal`:case`SingleQuoted`:case`Escaped`:break;case`DoubleQuoted`:if(t.parts.some(e=>e.type!==`Literal`&&e.type!==`Escaped`))return null;break;case`BraceExpansion`:{let e=Om(t.items);if(e===null)return null;n*=e;break}default:return null}return n}function Am(e){let t=0;for(let n of e){let e=km(n);if(e===null)return null;t+=e}return t}function jm(e,t){let n=0;for(let r of e){let e=Nm(r,t);if(e===null)return null;n+=e}return n}function Mm(e,t){switch(e.type){case`SimpleCommand`:return Tm(e,t);case`For`:{if(!e.words)return null;let n=Am(e.words),r=jm(e.body,t);return n===null||r===null?null:e.words.filter(e=>Dm(e)!==null&&t.has(`seq`)).length+n*r}case`Subshell`:case`Group`:return jm(e.body,t);case`FunctionDef`:return 0;default:return null}}function Nm(e,t){let n=0;for(let r of e.pipelines)for(let e of r.commands){let r=Mm(e,t);if(r===null)return null;n+=r}return n}function Pm(e,t){return jm(e.statements,t)}function Fm(e,t){let n=Pm(e,t);return{totalSteps:n!==null&&n>0?n:null}}function Im(e){return e.split(`
169
169
  `).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))||`bash`}var Lm=class{plan;emitter;label;now;id;steps=0;startedAt;finished=!1;children=new Map;constructor(e,t,n,r=Date.now){this.plan=e,this.emitter=t,this.label=n,this.now=r,this.id=t.allocateId(`script`),this.startedAt=r(),this.emitter.setAggregator(this),this.publish(`start`)}stepDone(){this.finished||(this.steps+=1,this.publish(`update`))}onChild(e){if(!this.finished){if(e.phase===`end`){this.children.delete(e.id);return}this.children.set(e.id,{fraction:e.fraction,label:e.label}),(e.fraction!==void 0||e.phase===`start`)&&this.publish(`update`)}}end(){this.finished||(this.finished=!0,this.emitter.setAggregator(null),this.emitter.emit({id:this.id,label:this.label,fraction:1,etaMs:0,done:this.steps,total:this.plan.totalSteps??void 0,unit:`iterations`,phase:`end`}))}fraction(){let e=[...this.children.values()].at(-1)?.fraction,t=this.plan.totalSteps;if(t===null)return e;let n=e??0;return Math.min(1,(this.steps+n)/t)}publish(e){let t=this.fraction(),n=this.now()-this.startedAt,r=t!==void 0&&t>0&&t<1?Math.max(0,n/t*(1-t)):t===1?0:void 0,i=[...this.children.values()].at(-1);this.emitter.emit({id:this.id,label:i?`${this.label} · ${i.label}`:this.label,fraction:t,etaMs:r,done:this.steps,total:this.plan.totalSteps??void 0,unit:`iterations`,phase:e})}};const Rm=globalThis.setTimeout.bind(globalThis);function zm(e){let t=e/1e3;return`sleep ${Number.isInteger(t)?t:t.toFixed(1)}`}function Bm(e,t={}){let n=t.now??Date.now,r=t.setTimeout??Rm,i=t.isAborted??(()=>!1),a=t.label??zm,o=e=>new Promise(t=>r(t,e));return async t=>{let r=Math.max(0,t),s=e.allocateId(`sleep`),c=a(r),l=n();e.emit({id:s,label:c,fraction:0,etaMs:r,done:0,total:r,unit:`ms`,phase:`start`});try{let t=0;for(;t<r;){if(i())return;if(await o(Math.min(250,r-t)),t=n()-l,t<r){let n=Math.min(1,t/r);e.emit({id:s,label:c,fraction:n,etaMs:Math.max(0,r-t),done:Math.min(t,r),total:r,unit:`ms`,phase:`update`})}}}finally{e.emit({id:s,label:c,fraction:1,etaMs:0,done:r,total:r,unit:`ms`,phase:`end`})}}}const Vm=globalThis.setTimeout.bind(globalThis);function Hm(e){let t=/^(\d+(?:\.\d+)?|\.\d+)([smhd]?)$/.exec(e.trim());return t?Number(t[1])*({"":1e3,s:1e3,m:6e4,h:36e5,d:864e5}[t[2]]??1e3):null}function Um(e){let t=0;for(;t<e.length;){let n=e[t];if(n===`--`)return t+1<e.length?t+1:-1;if(!n.startsWith(`-`))return t;[`-k`,`--kill-after`,`-s`,`--signal`].includes(n)&&(t+=1),t+=1}return-1}function Wm(e,t,n={}){let r=n.now??Date.now,i=n.setTimeout??Vm;return{...e,async execute(n,a){let o=Um(n),s=o>=0?Hm(n[o]):null;if(!t.hasSink()||s===null||s<=0)return e.execute(n,a);let c=t.allocateId(`timeout`),l=_m(e.name,n),u=r(),d=!0,f=()=>{if(!d)return;let e=r()-u,n=Math.min(1,e/s);t.emit({id:c,label:l,fraction:n,etaMs:Math.max(0,s-e),done:Math.min(e,s),total:s,unit:`ms`,phase:`update`}),e<s&&i(f,250)};t.emit({id:c,label:l,fraction:0,etaMs:s,done:0,total:s,unit:`ms`,phase:`start`}),i(f,250);try{return await e.execute(n,a)}finally{d=!1,t.emit({id:c,label:l,fraction:1,etaMs:0,done:s,total:s,unit:`ms`,phase:`end`})}}}}const Gm=new Set(`sleep,echo,printf,true,false,test,[,cd,pwd,export,unset,set,shift,local,return,break,continue,exit,:,read,let,declare,typeset,readonly,eval,exec,source,.,alias,unalias,type,command,builtin,wait,trap,basename,dirname,seq,expr`.split(`,`));function Km(e,t,n={}){if((n.skip??Gm).has(e.name))return e;let r=e.name;return{...e,async execute(n,i){if(!t.hasSink())return e.execute(n,i);let a=t.allocateId(`cmd`),o=_m(r,n);t.emit({id:a,label:o,phase:`start`});try{return await e.execute(n,i)}finally{t.emit({id:a,label:o,phase:`end`})}}}}const qm={stdout:``,stderr:``,exitCode:130};function Jm(e,t){if(!t)return e();if(t.aborted)return Promise.resolve(qm);let n,r=new Promise(e=>{n=()=>e(qm),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}const Ym={directory:{title:`Mount local directory`,approve:`Select directory`},"usb-device":{title:`Connect USB device`,approve:`Select USB device`},"serial-port":{title:`Connect serial port`,approve:`Select serial port`},"hid-device":{title:`Connect HID device`,approve:`Select HID device`}};function Xm(e,t=[],n){let r=Ym[e],i=t.length?` data-action-data='${JSON.stringify({filters:t}).replace(/'/g,`&apos;`)}'`:``,a=e===`directory`&&n?`<div class="sprinkle-action-card__meta">Target: ${Nt(n)}</div>`:``;return`
170
170
  <div class="sprinkle-action-card">
171
171
  <div class="sprinkle-action-card__header">
@@ -288,7 +288,7 @@ Examples:
288
288
  skill list
289
289
  skill info bluebubbles
290
290
  skill read bluebubbles
291
- `,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-Dd6UT_Hw.js`).then(e=>e.r);try{switch(r){case`list`:return Kh(t,e,i,n.env.get(`PATH`));case`info`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: info requires a skill name
291
+ `,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-B8dQ6oD2.js`).then(e=>e.r);try{switch(r){case`list`:return Kh(t,e,i,n.env.get(`PATH`));case`info`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: info requires a skill name
292
292
  `,exitCode:1};let r=await i.getSkillInfo(e,n);return r?{stdout:Wh(r),stderr:``,exitCode:0}:{stdout:``,stderr:`skill: "${n}" not found\n`,exitCode:1}}case`read`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: read requires a skill name
293
293
  `,exitCode:1};let r=await i.readSkillInstructions(e,n);return r===null?{stdout:``,stderr:`skill: no SKILL.md found for "${n}"\n`,exitCode:1}:{stdout:r+`
294
294
  `,stderr:``,exitCode:0}}default:return{stdout:``,stderr:`skill: unknown command "${r}"\n`,exitCode:1}}}catch(e){return{stdout:``,stderr:`skill: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}const Jh=[{names:[`--branch`,`-b`],validate:e=>!e.startsWith(`-`)&&i(e),error:`upskill: --branch must be a git ref of [A-Za-z0-9._/-]+ with no "..", leading "-"/"/", trailing "/" or ".lock", or shell metacharacters`,apply:(e,t)=>{e.branch=t}},{names:[`--from`],validate:e=>Zi(e)!==null,error:`upskill: --from requires a GitHub source (owner/repo, owner/repo@branch, or a github.com URL)`,apply:(e,t)=>{e.from=t}},{names:[`--path`,`-p`],validate:e=>o(e),error:`upskill: --path must be a repo-relative sub-path of [A-Za-z0-9._/-]+ with no "..", leading "-"/"/", or shell metacharacters`,apply:(e,t)=>{e.path=t}}];function Yh(e){let t={skills:[],dryRun:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n],i=Jh.find(e=>e.names.includes(r));if(i){let r=e[++n];if(!r||!i.validate(r))return t.error=i.error,t;i.apply(t,r)}else if(r===`--dry-run`||r===`-n`)t.dryRun=!0;else if(r===`--json`)t.json=!0;else if(r.startsWith(`-`))return t.error=`upskill: unknown option "${r}" for update`,t;else t.skills.push(r)}return t}function Xh(e,t){return!e||!t||e.byteLength!==t.byteLength?!1:e.every((e,n)=>e===t[n])}async function Zh(e,t){try{let n=await e.readFile(t,{encoding:`binary`});return n instanceof Uint8Array?n:new TextEncoder().encode(String(n))}catch{return}}async function Qh(e,t,n,r){let i=await Zh(e,t);return Li(n)?i?{status:`kept-local`,write:!1}:{status:`added`,write:!0}:i?Xh(i,r)?{status:`unchanged`,write:!1}:{status:`updated`,write:!0}:{status:`added`,write:!0}}async function $h(e,t,n,r){let i={changes:[],writes:[],removals:[]};for(let[r,a]of n){let n=`${t}/${r}`,{status:o,write:s}=await Qh(e,n,r,a);i.changes.push({path:r,status:o}),s&&i.writes.push({path:n,content:a})}let a=new Set(r.files??[]);for(let r of await Ri(e,t)){if(n.has(r))continue;let e=a.has(r);i.changes.push({path:r,status:e?`removed`:`kept-local`}),e&&i.removals.push(`${t}/${r}`)}return i.changes.sort((e,t)=>e.path.localeCompare(t.path)),i}async function eg(e,t,n,r,i,a){let o={skill:n,source:`${r.kind}:${r.source}`,ref:i??r.ref,from:r.sha,outcome:`current`,changes:[]},[s,c]=r.source.split(`/`);if(!s||!c)return{...o,outcome:`error`,error:`unusable source "${r.source}"`};let l=(r.path??``).replace(/^\/|\/$/g,``),u=await Ui(t),d=await Gi(s,c,o.ref,u,!0,l||void 0);if(d&&r.sha===d&&await tg(e,n,r))return{...o,to:d,outcome:`current`,changes:[]};let f=await ng(s,c,l,n,o.ref,t,u);if(`error`in f)return{...o,outcome:`error`,error:f.error};let p=f.files,m=f.path;if(p.size===0)return{...o,outcome:`error`,error:`no files at ${s}/${c}${m?`/${m}`:``} — the skill may have moved or been removed upstream`};let{changes:h,writes:g,removals:_}=await $h(e,`${Ai}/${n}`,p,r),v=g.length>0||_.length>0;if(a)return{...o,outcome:v?`updated`:`current`,changes:h};let ee=d??r.sha;return v&&await sg(e,{changes:h,writes:g,removals:_}),await Ki(e,n,{...r,ref:o.ref,path:m,sha:ee,files:[...p.keys()].sort()}),{...o,to:ee,outcome:v?`updated`:`current`,changes:h}}async function tg(e,t,n){if(!n.files?.length)return!1;for(let r of n.files)if(!await e.exists(`/workspace/skills/${t}/${r}`))return!1;return!0}async function ng(e,t,n,r,i,a,o){let s=await Bi(e,t,a,i??`main`);if(s.status===`ok`){let i=Fi(s.files),a=n||rg(i,r);return a===null?{error:`could not find "${r}/SKILL.md" in ${e}/${t} — pass --path <dir> to say where the skill lives`}:{files:og(i,a),path:a}}try{return{files:ag(ig(await zi(e,t,n,i,o))),path:n}}catch(e){let t=e instanceof Error?e.message:String(e);return{error:`${s.message}; Contents API fallback failed: ${t}`}}}function rg(e,t){let n=[];for(let r of Object.keys(e))r===`SKILL.md`?n.push(``):(r.endsWith(`/${t}/SKILL.md`)||r===`${t}/SKILL.md`)&&n.push(r.slice(0,-9));return n.length===0?null:(n.sort((e,t)=>e.split(`/`).length-t.split(`/`).length||e.localeCompare(t)),n[0])}function ig(e){return new Map([...e].filter(([e])=>Ii(e)))}function ag(e){return new Map([...e].sort(([e],[t])=>e.localeCompare(t)))}function og(e,t){let n=t?`${t}/`:``,r=new Map;for(let[t,i]of Object.entries(e)){if(!t.startsWith(n)||t.endsWith(`/`))continue;let e=t.slice(n.length);Ii(e)&&r.set(e,i)}return ag(r)}async function sg(e,t){for(let n of t.writes){let t=n.path.slice(0,n.path.lastIndexOf(`/`));await e.mkdir(t,{recursive:!0}),await e.writeFile(n.path,n.content)}for(let n of t.removals)await e.rm(n).catch(()=>{})}async function cg(e,t,n,r,i){let a={skill:n,source:`${r.kind}:${r.source}`,outcome:`current`,changes:[]},[o,s]=r.source.split(`/`);if(!o||!s)return{...a,outcome:`error`,error:`unusable source "${r.source}"`};let c=await zh(o,s,t);if(!c.ok)return{...a,outcome:`error`,error:c.error};let l=`${Ai}/${n}/SKILL.md`,u=await Zh(e,l),d=new TextEncoder().encode(c.content),f=u!==void 0&&Lh(new TextDecoder().decode(u))===Lh(c.content);if(Xh(u,d)||f)return{...a,changes:[{path:`SKILL.md`,status:`unchanged`}]};let p=u?`updated`:`added`;return i||(await e.mkdir(`${Ai}/${n}`,{recursive:!0}),await e.writeFile(l,d),await Ki(e,n,{...r,files:[`SKILL.md`]})),{...a,outcome:`updated`,changes:[{path:`SKILL.md`,status:p}]}}function lg(e,t){if(e.outcome===`error`)return` ${e.skill}: failed — ${e.error}\n`;let n=new Map;for(let t of e.changes)n.set(t.status,(n.get(t.status)??0)+1);let r=e.to&&e.to!==e.from?` → ${e.to.slice(0,7)}`:``;if(e.outcome===`current`)return` ${e.skill}: already current (${e.source}${r})\n`;let i=t?`would update`:`updated`,a=` ${e.skill}: ${i} from ${e.source}${r}\n`;for(let t of e.changes)t.status!==`unchanged`&&(a+=` ${t.status.padEnd(10)} ${t.path}\n`);let o=n.get(`kept-local`)??0;return o>0&&(a+=` (${o} kept-local — dotfiles and local additions are never touched)\n`),a}function ug(e,t,n,r){let i=Zi(t);return i?{version:1,kind:`github`,source:`${i.owner}/${i.repo}`,skill:e,ref:r??i.branch,path:n??i.path,installed:new Date().toISOString()}:null}async function dg(e,t,n){if(t.length===0){let t=await Wi(e);return{targets:t.provenanced,missing:[],skipped:t.unattributed}}let r=[],i=[];for(let a of t){let t=await qi(e,a);if(t){r.push({name:a,provenance:t});continue}if(!await e.exists(`/workspace/skills/${a}`)){i.push({name:a,reason:`not-installed`});continue}let o=n.from?ug(a,n.from,n.path,n.branch):null;o?r.push({name:a,provenance:o}):i.push({name:a,reason:`no-provenance`})}return{targets:r,missing:i,skipped:[]}}function fg(e){return e.reason===`not-installed`?`upskill: no skill named "${e.name}" is installed — check \`upskill list\`
@@ -299,7 +299,7 @@ Examples:
299
299
  `}function hg(e,t,n,r,i){let a=t?`Skill update (dry run — nothing written):
300
300
  `:`Skill update:
301
301
  `;for(let n of e)a+=lg(n,t);if(i.length>0&&(a+=mg(i)),!n&&r&&e.length>0){let n=i.length>0?`all ${pg(e.length,`skill`)} with provenance ${e.length===1?`is`:`are`}`:`all skills are`;a+=t?`\n${n.charAt(0).toUpperCase()}${n.slice(1)} current.\n`:`\nNothing to update — ${n} current.\n`}return a}async function gg(e,t,n){let{targets:r,missing:i,skipped:a}=await dg(e,n.skills,{skills:n.skills,dryRun:n.dryRun,json:!1,branch:n.branch,from:n.from,path:n.path}),o=[];for(let i of r)o.push(i.provenance.kind===`browse.sh`?await cg(e,t,i.name,i.provenance,n.dryRun):await eg(e,t,i.name,i.provenance,n.branch,n.dryRun));return{results:o,skipped:a,missing:i}}async function _g(e,t,n){let r=Yh(e);if(r.error)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{results:i,missing:a,skipped:o}=await gg(t,n,r);if(i.length===0)return a.length===0&&o.length>0?{stdout:r.json?`${JSON.stringify({ok:!0,dryRun:r.dryRun,results:[],skipped:o})}\n`:hg([],r.dryRun,!1,!0,o),stderr:``,exitCode:0}:{stdout:``,stderr:a.length?a.map(fg).join(``):"upskill: no skill has install provenance yet — reinstall a skill, or run `upskill update <skill> --from <owner>/<repo>`, to record its source\n",exitCode:1};let s=i.filter(e=>e.outcome===`error`),c=i.some(e=>e.outcome===`updated`);c&&!r.dryRun&&await Xi();let l=a.map(fg).join(``)+s.map(e=>`upskill: ${e.skill}: ${e.error}\n`).join(``),u=s.length===0&&a.length===0;return r.json?{stdout:`${JSON.stringify({ok:u,dryRun:r.dryRun,results:i,skipped:o})}\n`,stderr:l,exitCode:+!u}:{stdout:hg(i,r.dryRun,c,u,o),stderr:l,exitCode:+!u}}function vg(e){let t={outdated:!1,json:!1};for(let n of e)if(n===`--outdated`)t.outdated=!0;else if(n===`--json`)t.json=!0;else if(n.startsWith(`-`))return t.error=`upskill: unknown option "${n}" for list`,t;else return t.error=`upskill: unexpected argument "${n}" for list`,t;return t}function yg(e){return e.to&&e.from&&e.to!==e.from?` ${e.from.slice(0,7)} → ${e.to.slice(0,7)}`:e.to?` ${e.to.slice(0,7)}`:``}function bg(e,t){let n=e.filter(e=>e.outcome===`updated`),r=[];if(n.length===0)r.push(`No outdated skills.`);else{r.push(`Outdated skills:`,``);for(let e of n)r.push(` ${e.skill} ${e.source}${yg(e)}`)}if(t.length>0){let e=t.length===1?`skill`:`skills`;r.push(``,`Skipped ${t.length} ${e} with no install provenance — not checked.`)}let i=e.filter(e=>e.outcome===`error`);if(i.length>0){let e=i.length===1?`skill`:`skills`;r.push(``,`Could not check ${i.length} ${e}:`);for(let e of i)r.push(` ${e.skill}: failed — ${e.error}`)}return`${r.join(`
302
- `)}\n`}async function xg(e,t,n){let r=await(await import(`./kernel-worker-Dd6UT_Hw.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await br(e,_r(n));return t?{stdout:`${JSON.stringify({ok:!0,skills:r,commandCollisions:i})}\n`,stderr:``,exitCode:0}:r.length===0?{stdout:`No discoverable local skills found.\n\n${Vh()}`,stderr:``,exitCode:0}:{...xr(`upskill`,Uh(r,`Discoverable local skills`),i,{builtinNames:new Set(ft())}),exitCode:0}}async function Sg(e,t,n){let{results:r,skipped:i}=await gg(e,t,{skills:[],dryRun:!0}),a=r.filter(e=>e.outcome===`updated`),o=r.filter(e=>e.outcome===`error`),s=o.length===0,c=o.map(e=>`upskill: ${e.skill}: ${e.error}\n`).join(``);return n?{stdout:`${JSON.stringify({ok:s,results:[...a,...o],skipped:i})}\n`,stderr:c,exitCode:+!s}:{stdout:bg(r,i),stderr:c,exitCode:+!s}}async function Cg(e,t,n,r){let i=vg(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?Sg(t,n,i.json):xg(t,i.json,r)}async function wg(e,t){let n=`${ji}/experimental/search?q=${encodeURIComponent(e)}&contentType=skills&page%5Bsize%5D=20`,r;try{r=await t(n,{headers:{Accept:`application/json`}})}catch(e){throw Error(Hi(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ke(r.body);if(!i.data)return[];let a=new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=Yi(t.sourceUrl),r=n?`${n.owner}/${n.repo}`:void 0,i=t.scores.aggregate==null?null:Math.round(t.scores.aggregate*100),o=t.sourceUrl||e.id,s=a.get(o);if(s&&s.qualityScore!=null&&i!=null&&s.qualityScore>=i)continue;let c=t.path.replace(/\/SKILL\.md$/i,``),l=c.split(`/`).pop()||t.name,u=n?`upskill ${n.owner}/${n.repo} --path ${c.split(`/`).slice(0,-1).join(`/`)||`.`} --skill ${l}`:`upskill tessl:${t.name}`;a.set(o,{name:t.name,displayName:t.name,summary:t.description||``,source:`tessl`,qualityScore:i,installHint:u,featured:t.featured,sourceRepo:r})}return Array.from(a.values())}async function Tg(e,t){let n=`${ji}/experimental/search?q=${encodeURIComponent(e)}&contentType=skills&page%5Bsize%5D=5`,r;try{r=await t(n,{headers:{Accept:`application/json`}})}catch(e){return{error:`Tessl search failed: ${Hi(e,n)}`}}if(r.status!==200)return{error:`Tessl search failed (HTTP ${r.status})`};let i=ke(r.body).data?.find(t=>t.type===`skill`&&t.attributes.name===e);if(!i)return{error:`skill "${e}" not found on Tessl registry`};let a=Yi(i.attributes.sourceUrl);if(!a)return{error:`skill "${e}" has no GitHub source URL`};let o=i.attributes.path.replace(/\/SKILL\.md$/i,``);return{owner:a.owner,repo:a.repo,skillPath:o,skillName:e}}const Eg=[{label:`Tessl`,host:new URL(ji).host,fetch:wg},{label:`browse.sh`,host:new URL(Pi).host,fetch:jh}];function Dg(e){let t=[],n=e.reduce((e,t)=>Math.max(e,t.length),0);for(let r=0;r<n;r++)for(let n of e)r<n.length&&t.push(n[r]);return t}async function Og(e,t,n=1){let r=await Promise.allSettled(Eg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Dg(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Eg[e],r=t.reason instanceof Error?t.reason.message:String(t.reason);s+=`warning: ${n.label} registry unavailable (${n.host}): ${r}\n`}}if(o.length===0){let t=a?`${s}upskill: registries failed to respond\n`:s;return{stdout:`No skills found for "${e}"\n\nTry a different search term or browse the registries at https://tessl.io/registry or https://browse.sh\n`,stderr:t,exitCode:+!!a}}let c=o.length,l=Math.ceil(c/10),u=Math.max(1,Math.min(n,l)),d=(u-1)*10,f=o.slice(d,d+10),p=`Search results for "${e}" (page ${u}/${l}, ${c} total):\n\n`;for(let e of f){let t=e.qualityScore==null?` `:String(e.qualityScore).padStart(3),n=`[${e.source}]`,r=e.sourceRepo?` ${e.sourceRepo}`:``;p+=` ${e.name.padEnd(30)} ${t} ${n.padEnd(10)}${r}\n`,e.summary&&(p+=` ${e.summary}\n`),p+=`
302
+ `)}\n`}async function xg(e,t,n){let r=await(await import(`./kernel-worker-B8dQ6oD2.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await br(e,_r(n));return t?{stdout:`${JSON.stringify({ok:!0,skills:r,commandCollisions:i})}\n`,stderr:``,exitCode:0}:r.length===0?{stdout:`No discoverable local skills found.\n\n${Vh()}`,stderr:``,exitCode:0}:{...xr(`upskill`,Uh(r,`Discoverable local skills`),i,{builtinNames:new Set(ft())}),exitCode:0}}async function Sg(e,t,n){let{results:r,skipped:i}=await gg(e,t,{skills:[],dryRun:!0}),a=r.filter(e=>e.outcome===`updated`),o=r.filter(e=>e.outcome===`error`),s=o.length===0,c=o.map(e=>`upskill: ${e.skill}: ${e.error}\n`).join(``);return n?{stdout:`${JSON.stringify({ok:s,results:[...a,...o],skipped:i})}\n`,stderr:c,exitCode:+!s}:{stdout:bg(r,i),stderr:c,exitCode:+!s}}async function Cg(e,t,n,r){let i=vg(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?Sg(t,n,i.json):xg(t,i.json,r)}async function wg(e,t){let n=`${ji}/experimental/search?q=${encodeURIComponent(e)}&contentType=skills&page%5Bsize%5D=20`,r;try{r=await t(n,{headers:{Accept:`application/json`}})}catch(e){throw Error(Hi(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ke(r.body);if(!i.data)return[];let a=new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=Yi(t.sourceUrl),r=n?`${n.owner}/${n.repo}`:void 0,i=t.scores.aggregate==null?null:Math.round(t.scores.aggregate*100),o=t.sourceUrl||e.id,s=a.get(o);if(s&&s.qualityScore!=null&&i!=null&&s.qualityScore>=i)continue;let c=t.path.replace(/\/SKILL\.md$/i,``),l=c.split(`/`).pop()||t.name,u=n?`upskill ${n.owner}/${n.repo} --path ${c.split(`/`).slice(0,-1).join(`/`)||`.`} --skill ${l}`:`upskill tessl:${t.name}`;a.set(o,{name:t.name,displayName:t.name,summary:t.description||``,source:`tessl`,qualityScore:i,installHint:u,featured:t.featured,sourceRepo:r})}return Array.from(a.values())}async function Tg(e,t){let n=`${ji}/experimental/search?q=${encodeURIComponent(e)}&contentType=skills&page%5Bsize%5D=5`,r;try{r=await t(n,{headers:{Accept:`application/json`}})}catch(e){return{error:`Tessl search failed: ${Hi(e,n)}`}}if(r.status!==200)return{error:`Tessl search failed (HTTP ${r.status})`};let i=ke(r.body).data?.find(t=>t.type===`skill`&&t.attributes.name===e);if(!i)return{error:`skill "${e}" not found on Tessl registry`};let a=Yi(i.attributes.sourceUrl);if(!a)return{error:`skill "${e}" has no GitHub source URL`};let o=i.attributes.path.replace(/\/SKILL\.md$/i,``);return{owner:a.owner,repo:a.repo,skillPath:o,skillName:e}}const Eg=[{label:`Tessl`,host:new URL(ji).host,fetch:wg},{label:`browse.sh`,host:new URL(Pi).host,fetch:jh}];function Dg(e){let t=[],n=e.reduce((e,t)=>Math.max(e,t.length),0);for(let r=0;r<n;r++)for(let n of e)r<n.length&&t.push(n[r]);return t}async function Og(e,t,n=1){let r=await Promise.allSettled(Eg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Dg(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Eg[e],r=t.reason instanceof Error?t.reason.message:String(t.reason);s+=`warning: ${n.label} registry unavailable (${n.host}): ${r}\n`}}if(o.length===0){let t=a?`${s}upskill: registries failed to respond\n`:s;return{stdout:`No skills found for "${e}"\n\nTry a different search term or browse the registries at https://tessl.io/registry or https://browse.sh\n`,stderr:t,exitCode:+!!a}}let c=o.length,l=Math.ceil(c/10),u=Math.max(1,Math.min(n,l)),d=(u-1)*10,f=o.slice(d,d+10),p=`Search results for "${e}" (page ${u}/${l}, ${c} total):\n\n`;for(let e of f){let t=e.qualityScore==null?` `:String(e.qualityScore).padStart(3),n=`[${e.source}]`,r=e.sourceRepo?` ${e.sourceRepo}`:``;p+=` ${e.name.padEnd(30)} ${t} ${n.padEnd(10)}${r}\n`,e.summary&&(p+=` ${e.summary}\n`),p+=`
303
303
  `}return u<l&&(p+=`Showing ${d+1}-${d+f.length} of ${c}. `,p+=`Next page: upskill search ${e} --page ${u+1}\n\n`),p+=`To install:
304
304
  `,p+=` From Tessl: upskill <owner/repo> --skill <name>
305
305
  `,p+=` From browse.sh: upskill browse:<hostname>/<task>
@@ -322,7 +322,7 @@ Examples:
322
322
  `,{stdout:s,stderr:``,exitCode:0}}function Fg(e){return!e||e.startsWith(`-`)?{stdout:``,stderr:`upskill: --branch requires a value
323
323
  `,exitCode:1}:i(e)?null:{stdout:``,stderr:`upskill: --branch must be a git ref of [A-Za-z0-9._/-]+ with no "..", leading "-"/"/", trailing "/" or ".lock", or shell metacharacters
324
324
  `,exitCode:1}}function Ig(e){let t={selectedSkills:[],listOnly:!1,installAll:!1,force:!1,sourceRef:``},n=0;for(;n<e.length;){let r=e[n];if(r===`--skill`)t.selectedSkills.push(e[++n]);else if(r===`--path`||r===`-p`){let r=e[++n];if(typeof r!=`string`||!o(r))return t.earlyReturn={stdout:``,stderr:`upskill: --path must be a repo-relative sub-path of [A-Za-z0-9._/-]+ with no "..", leading "-"/"/", or shell metacharacters
325
- `,exitCode:1},t;t.subPath=r}else if(r===`--list`)t.listOnly=!0;else if(r===`--all`)t.installAll=!0;else if(r===`--force`)t.force=!0;else if(r===`--branch`||r===`-b`){let r=Fg(e[n+1]);if(r)return t.earlyReturn=r,t;t.branch=e[++n]}else r.startsWith(`-`)||(t.sourceRef=r);n++}return t}async function Lg(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-Dd6UT_Hw.js`).then(e=>e.r);if(e===`info`){let e=await r.getSkillInfo(n,t);if(!e)return{stdout:``,stderr:`upskill: skill "${t}" not found\n`,exitCode:1};let i=await qi(n,t),a=i?Ji(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Wh(e)+a,stderr:``,exitCode:0}}let i=await r.readSkillInstructions(n,t);return i===null?{stdout:``,stderr:`upskill: no SKILL.md found for "${t}"\n`,exitCode:1}:{stdout:i+`
325
+ `,exitCode:1},t;t.subPath=r}else if(r===`--list`)t.listOnly=!0;else if(r===`--all`)t.installAll=!0;else if(r===`--force`)t.force=!0;else if(r===`--branch`||r===`-b`){let r=Fg(e[n+1]);if(r)return t.earlyReturn=r,t;t.branch=e[++n]}else r.startsWith(`-`)||(t.sourceRef=r);n++}return t}async function Lg(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-B8dQ6oD2.js`).then(e=>e.r);if(e===`info`){let e=await r.getSkillInfo(n,t);if(!e)return{stdout:``,stderr:`upskill: skill "${t}" not found\n`,exitCode:1};let i=await qi(n,t),a=i?Ji(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Wh(e)+a,stderr:``,exitCode:0}}let i=await r.readSkillInstructions(n,t);return i===null?{stdout:``,stderr:`upskill: no SKILL.md found for "${t}"\n`,exitCode:1}:{stdout:i+`
326
326
  `,stderr:``,exitCode:0}}async function Rg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0,d=e.length;for(let f=0;f<e.length;f++){let p=e[f],m=await $i(p.path,p.name,r,i,a,s?{...s,path:p.path}:void 0),h=f+1,g=((Date.now()-o)/1e3).toFixed(1),_=(Date.now()-o)/h,v=h<d?` (~${Math.round((d-h)*_/1e3)}s remaining)`:``;m.ok?(c+=`[${h}/${d}] Installed "${p.name}" from ${t}/${n} (${g}s)${v}\n`,u++):(c+=`[${h}/${d}] Failed "${p.name}": ${m.error}${v}\n`,l+=`upskill: ${m.error}\n`)}return{output:c,errors:l,successCount:u}}async function zg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0,d=e.length;for(let f=0;f<e.length;f++){let p=e[f],m=await Qi(t,n,p.path,p.name,i,r,a,void 0,o),h=f+1,g=((Date.now()-s)/1e3).toFixed(1),_=(Date.now()-s)/h,v=h<d?` (~${Math.round((d-h)*_/1e3)}s remaining)`:``;m.exitCode===0?(c+=`[${h}/${d}] Installed "${p.name}" from ${t}/${n} (${g}s)${v}\n`,u++):(c+=`[${h}/${d}] Failed "${p.name}": ${m.stderr.trim()}${v}\n`,l+=m.stderr)}return{output:c,errors:l,successCount:u}}async function Bg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0;for(let d of e){let e=await Qi(t,n,d.path,d.name,i,r,a,o,s);e.exitCode===0?(c+=e.stdout,u++):l+=e.stderr}return{output:c,errors:l,successCount:u}}function Vg(e,t,n){let r=`Available skills in ${t}/${n}:\n\n`;for(let t of e)r+=` ${t.name.padEnd(30)} ${t.path}\n`;return r+=`\nFound ${e.length} skill(s)\n`,r}async function Hg(e,t,n,r){let{owner:i,repo:a}=e,o=t.branch??e.branch,s=t.subPath??e.path,c=await Ui(r),l=await ea(i,a,c,s,r,o);if(l.error)return{stdout:``,stderr:`upskill: failed to list skills: ${l.error}\n`,exitCode:1};if(l.skills.length===0)return{stdout:`No skills found in ${i}/${a}${s?`/`+s:``}\n`,stderr:``,exitCode:0};if(t.listOnly)return{stdout:Vg(l.skills,i,a)+`\nTo install: upskill ${t.sourceRef} --skill <name>\nTo install all: upskill ${t.sourceRef} --all\n`,stderr:``,exitCode:0};let u=l.skills;if(t.selectedSkills.length>0){u=l.skills.filter(e=>t.selectedSkills.includes(e.name));for(let e of t.selectedSkills)if(!l.skills.find(t=>t.name===e))return{stdout:``,stderr:`upskill: skill "${e}" not found in ${i}/${a}\n`,exitCode:1}}else if(!t.installAll)return{stdout:Vg(l.skills,i,a)+`\nTo install specific skills: upskill ${t.sourceRef} --skill <name>\nTo install all: upskill ${t.sourceRef} --all\n`,stderr:``,exitCode:0};let d=u.length,f=Date.now(),p=``,m=``,h=0;if(d>1){let e=await Bi(i,a,r,o);if(e.status===`ok`){let r=await Gi(i,a,o,c,!0,s),l=await Rg(u,i,a,Fi(e.files),n,t.force,f,{kind:`github`,source:`${i}/${a}`,ref:o,sha:r});({output:p,errors:m,successCount:h}=l)}else{let e=await zg(u,i,a,c,n,t.force,o,f);({output:p,errors:m,successCount:h}=e)}}else({output:p,errors:m,successCount:h}=await Bg(u,i,a,c,n,t.force,r,o));let g=((Date.now()-f)/1e3).toFixed(1);return h>0&&(p+=`\nInstalled ${h} skill(s)${d>1?` in ${g}s`:``}\n`,await Xi()),{stdout:p,stderr:m,exitCode:+!!m}}async function Ug(e,t,n,r,i){switch(e[0]){case`tabs`:return Ng(t,n,r,e.includes(`--json`));case`recommendations`:return Pg(t,n,e.includes(`--install`));case`update`:case`upgrade`:return _g(e.slice(1),t,n);case`list`:return Cg(e.slice(1),t,n,i);case`info`:case`read`:return Lg(e[0],e[1],t);case`search`:return Gg(e,n);default:return null}}function Wg(e,t,n){return C(`upskill`,async(r,i)=>{if(r.length===0||r.includes(`--help`)||r.includes(`-h`))return Gh();let a=await Ug(r,e,t,n,i.env.get(`PATH`));if(a)return a;let o=Ig(r);if(o.earlyReturn)return o.earlyReturn;if(!o.sourceRef)return Gh();if(o.sourceRef.startsWith(`tessl:`))return Kg(o.sourceRef,o.force,e,t);let s=Ph(o.sourceRef);if(s)return Bh(s.hostname,s.task,e,t,o.force);let c=Zi(o.sourceRef);return c?Hg(c,o,e,t):{stdout:``,stderr:`upskill: unrecognized source "${o.sourceRef}"\n\nExpected: owner/repo, tessl:<name>, or browse:<hostname>/<task>\n`,exitCode:1}})}async function Gg(e,t){let n=[...e.slice(1)],r=n.indexOf(`--page`),i=1;r>=0&&(i=parseInt(n[r+1],10)||1,n.splice(r,2));let a=n.join(` `);return a?Og(a,t,i):Gh()}async function Kg(e,t,n,r){let i=e.slice(6);if(!i)return{stdout:``,stderr:`upskill: tessl: requires a skill name
327
327
  `,exitCode:1};let a=await Tg(i,r);if(`error`in a)return{stdout:``,stderr:`upskill: ${a.error}\n`,exitCode:1};let o=await Ui(r);return Qi(a.owner,a.repo,a.skillPath,a.skillName,n,o,t,r)}function qg(){return{stdout:`usage: afplay [-v volume] [-r rate] <file>
328
328
 
@@ -842,7 +842,7 @@ Options:
842
842
  --pattern <glob> File pattern to match, e.g. "*.md", "*.bsh" (required)
843
843
  --scoop <target> Scoop name, cone name, or folder. Omit for your own cone.
844
844
  --name <name> Human-readable name for the watcher
845
- `);switch(n){case`list`:return $S(e);case`delete`:return eC(e);case`create`:return await rC(e,t.env);default:return ZS(`unknown command: ${n}`)}})}function aC(e){return C(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-ZVh0R1Qb.js`);return r(t,n,e)})}function oC(e={}){return C(`go`,async(t,n)=>{let{runGoCommand:r}=await import(`./go-driver-CvHJRpyw.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}function sC(){return{stdout:`usage: hear [-i file] [-l lang] [-T seconds] [-d deviceId] [--engine name]
845
+ `);switch(n){case`list`:return $S(e);case`delete`:return eC(e);case`create`:return await rC(e,t.env);default:return ZS(`unknown command: ${n}`)}})}function aC(e){return C(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-ZVh0R1Qb.js`);return r(t,n,e)})}function oC(e={}){return C(`go`,async(t,n)=>{let{runGoCommand:r}=await import(`./go-driver-Bl_pd-vs.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}function sC(){return{stdout:`usage: hear [-i file] [-l lang] [-T seconds] [-d deviceId] [--engine name]
846
846
  hear --devices | --status | --warmup
847
847
 
848
848
  Speech recognition: listens on the microphone until you pause, then
@@ -1353,7 +1353,7 @@ Options:
1353
1353
  --global Resolve only from the shared global prefix (/shared/lib/node_modules)
1354
1354
  -h, --help Show this help message
1355
1355
  `}async function rk(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function ik(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function ak(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*ok(e,t=!1){if(t){yield hr;return}let n=x(e);for(;yield S(n,`node_modules`),n!==`/`;)n=We(n).dir;yield hr}async function sk(e,t,n,r=!1){for(let i of ok(t,r)){let t=S(i,`.bin`,n);if(!await ik(e,t))continue;let r=await rk(e,t),a=tk.exec(r),o=We(t).dir;return{binFilePath:a?S(o,a[1]):t,argvName:t}}return null}function ck(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function lk(e,t){if(typeof e==`string`)return{binName:ck(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,ck(t)];for(let t of n){let n=Object.getOwnPropertyDescriptor(e,t)?.value;if(typeof n==`string`)return{binName:t,binPath:n}}let r=Object.entries(e).filter(e=>typeof e[1]==`string`);if(r.length===1){let[e,t]=r[0];return{binName:e,binPath:t}}return null}async function uk(e,t,n,r=!1){for(let i of ok(t,r)){let t=S(i,n),r=S(t,`package.json`);if(!await ik(e,r))continue;let a;try{a=JSON.parse(await rk(e,r))}catch{return null}let o=lk(a.bin,n);if(!o)return null;let s=o.binPath.replace(/^\.\//,``);return{binFilePath:S(t,s),argvName:S(i,`.bin`,o.binName)}}return null}async function dk(e,t,n,r=!1){return await sk(e,t,n,r)??await uk(e,t,n,r)}async function fk(e,t,n){for(let r of ok(t))if(await ik(e,S(r,n,`package.json`)))return!0;return!1}function pk(e){return e instanceof Error?e.message:String(e)}function mk(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function hk(e,t,n,r){try{let{installPackages:i}=await import(`./installer-iQBJzSUD.js`),a=await i([t],{fs:r.fs,fetch:r.fetch,cwd:n.cwd});if(a.errors.length>0)return{error:mk(e,`failed to install '${t}': ${pk(a.errors[0].error)}`)};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version}`);return{progress:o.length>0?`${o.join(`
1356
- `)}\n`:``}}catch(n){return{error:mk(e,`failed to install '${t}': ${pk(n)}`)}}}async function gk(e,t,n,r){return await ik(r,n)?null:await ak(r,n)?mk(e,`bin target '${n}' is a directory, not a file`):mk(e,`bin file '${n}' for '${t}' does not exist`)}async function _k(e,t,n,r,i,a){if(await fk(a.fs,i.cwd,t))return{error:mk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:QO(t);if(o)return{error:{stdout:``,stderr:ek(e,t,n,o),exitCode:1}};let s=await hk(e,t,i,a);if(`error`in s)return s;let c=await dk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:mk(e,`package '${t}' was installed but does not expose an executable bin`)}}function vk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:nk(e),stderr:``,exitCode:+(n.length===0)};let i=n[0]===`--force`,a=i?n.slice(1):n,o=a[0]===`--global`;o&&(a=a.slice(1));let s=a;if(s.length===0)return{stdout:nk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await dk(t.fs,r.cwd,c,o)}catch(t){return mk(e,pk(t))}let d=``;if(!u){if(o)return mk(e,`no global bin '${c}' found in ${hr}`);let n=await _k(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await gk(e,c,u.binFilePath,t.fs);if(f)return f;let p=_i(await rk(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await hi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function yk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-C3Hy4SBY.js`);return r(t,n,e)})}const bk=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function xk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Dk();let n=e.processManager??Sk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
1356
+ `)}\n`:``}}catch(n){return{error:mk(e,`failed to install '${t}': ${pk(n)}`)}}}async function gk(e,t,n,r){return await ik(r,n)?null:await ak(r,n)?mk(e,`bin target '${n}' is a directory, not a file`):mk(e,`bin file '${n}' for '${t}' does not exist`)}async function _k(e,t,n,r,i,a){if(await fk(a.fs,i.cwd,t))return{error:mk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:QO(t);if(o)return{error:{stdout:``,stderr:ek(e,t,n,o),exitCode:1}};let s=await hk(e,t,i,a);if(`error`in s)return s;let c=await dk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:mk(e,`package '${t}' was installed but does not expose an executable bin`)}}function vk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:nk(e),stderr:``,exitCode:+(n.length===0)};let i=n[0]===`--force`,a=i?n.slice(1):n,o=a[0]===`--global`;o&&(a=a.slice(1));let s=a;if(s.length===0)return{stdout:nk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await dk(t.fs,r.cwd,c,o)}catch(t){return mk(e,pk(t))}let d=``;if(!u){if(o)return mk(e,`no global bin '${c}' found in ${hr}`);let n=await _k(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await gk(e,c,u.binFilePath,t.fs);if(f)return f;let p=_i(await rk(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await hi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function yk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-Cu8PtYCw.js`);return r(t,n,e)})}const bk=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function xk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Dk();let n=e.processManager??Sk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
1357
1357
  `,exitCode:1};let r=Ck(t);if(!r.ok)return{stdout:``,stderr:r.stderr,exitCode:r.exitCode};let{allDelivered:i,errors:a}=wk(n,r.pids,r.signal);return{stdout:``,stderr:a.length?`${a.join(`
1358
1358
  `)}\n`:``,exitCode:+!i}})}function Sk(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function Ck(e){let t=`SIGTERM`,n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i===`-s`||i===`--signal`){let n=e[++r];if(!n)return{ok:!1,stderr:`kill: -s requires a signal name
1359
1359
  `,exitCode:2};let i=Tk(n);if(i instanceof Error)return{ok:!1,stderr:`kill: ${i.message}\n`,exitCode:2};t=i;continue}if(i.startsWith(`-`)){let e=Ek(i);if(e instanceof Error)return{ok:!1,stderr:`kill: ${e.message}\n`,exitCode:2};t=e;continue}let a=Number.parseInt(i,10);if(!Number.isFinite(a)||String(a)!==i)return{ok:!1,stderr:`kill: invalid pid '${i}'\n`,exitCode:2};n.push(a)}return n.length===0?{ok:!1,stderr:`kill: no pids supplied
@@ -1426,7 +1426,7 @@ Common base URLs:
1426
1426
  `)+`
1427
1427
  `,stderr:``,exitCode:0}}function eA(e,t){let n=t.models.length;return{stdout:[`✓ ${e} (${Xk(t.runtime,!1)})`,` Saved ${n} model${n===1?``:`s`} to Settings:`,...Zk(t.models)].join(`
1428
1428
  `)+`
1429
- `,stderr:``,exitCode:0}}function tA(){return C(Jk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Yk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-BspEP7gu.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-_r9oESrG.js`).then(e=>e.n),o=e[0]??`status`;if(o!==`status`&&o!==`discover`)return{stdout:``,stderr:`Unknown subcommand: ${o}. See \`local-llm --help\`.\n`,exitCode:2};let s=r(Jk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
1429
+ `,stderr:``,exitCode:0}}function tA(){return C(Jk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Yk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-Co7p6uLK.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-BTE5kJfp.js`).then(e=>e.n),o=e[0]??`status`;if(o!==`status`&&o!==`discover`)return{stdout:``,stderr:`Unknown subcommand: ${o}. See \`local-llm --help\`.\n`,exitCode:2};let s=r(Jk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
1430
1430
  `,exitCode:1};let c=await a(s,t(Jk)??void 0);if(!c.ok)return Qk(s,c);if(o===`discover`){let e=n(Jk)??``;return i(Jk,e,s,c.models.join(`, `)),eA(s,c)}return $k(s,c)})}function nA(){return{stdout:`usage: man <topic>
1431
1431
 
1432
1432
  Fetches documentation for a given topic from sliccy.com.
@@ -1445,7 +1445,7 @@ Notes:
1445
1445
  Document-Isolation-Policy). Embedded floats cannot be isolated and
1446
1446
  report why instead.
1447
1447
  - The browser randomizes measurement timing — expect a short delay.
1448
- `,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??sA();if(!r&&!e.measure)return aA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return aA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return aA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:lA(a),stderr:``,exitCode:0}})}function dA(e){return C(`memory`,async t=>{let{runMemory:n}=await import(`./run-E8fkhkYA.js`);return n(t,e)})}function fA(){return C(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-dAJe7sKp.js`);return n(e,t)})}const pA=`/.cache/artificial-analysis.json`,mA=[`--all`,`--all-versions`,`--json`,`--refresh`,`--no-benchmarks`,`--help`,`-h`],hA=[`--provider`];function gA(e){return{stdout:``,stderr:e.endsWith(`
1448
+ `,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??sA();if(!r&&!e.measure)return aA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return aA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return aA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:lA(a),stderr:``,exitCode:0}})}function dA(e){return C(`memory`,async t=>{let{runMemory:n}=await import(`./run-tc2VFBej.js`);return n(t,e)})}function fA(){return C(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-dAJe7sKp.js`);return n(e,t)})}const pA=`/.cache/artificial-analysis.json`,mA=[`--all`,`--all-versions`,`--json`,`--refresh`,`--no-benchmarks`,`--help`,`-h`],hA=[`--provider`];function gA(e){return{stdout:``,stderr:e.endsWith(`
1449
1449
  `)?e:`${e}\n`,exitCode:1}}async function _A(e){try{let t=await e.readFile(pA),n=JSON.parse(t);if(Date.now()-n.fetchedAt<864e5)return n.models}catch{}return null}function vA(){try{return localStorage.getItem(`aa_api_key`)}catch{return null}}function yA(e){return e.map(e=>{let t=e;return{slug:t.slug??``,name:t.name??``,creator_slug:t.model_creator?.slug??``,intelligence_index:t.evaluations?.artificial_analysis_intelligence_index??null,coding_index:t.evaluations?.artificial_analysis_coding_index??null,speed_tps:t.median_output_tokens_per_second??null}})}async function bA(e,t){let n={fetchedAt:Date.now(),models:t};try{await e.mkdir(`/.cache`,{recursive:!0}),await e.writeFile(pA,JSON.stringify(n))}catch{}}async function xA(e,t=!1){if(e&&!t){let t=await _A(e);if(t)return t}let n={Accept:`application/json`},r=vA();r&&(n[`x-api-key`]=r);let i=g(),a;try{a=await i(`https://artificialanalysis.ai/api/v2/data/llms/models`,{method:`GET`,headers:n})}catch{return[]}if(a.status===401||a.status<200||a.status>=300)return[];let o;try{o=JSON.parse(new TextDecoder().decode(a.body))}catch{return[]}if(typeof o!=`object`||!o)return[];let s=o,c=yA(Array.isArray(s)?s:s.data??s.models??[]);return e&&c.length>0&&await bA(e,c),c}function SA(e){return e.toLowerCase().replace(/\./g,`-`).replace(/-\d{8}$/,``).replace(/-\d{4}$/,``)}function CA(e,t){let n=e.toLowerCase(),r=t.find(e=>e.slug===n);if(r)return r;let i=SA(e),a=t.find(e=>SA(e.slug)===i);if(a)return a;let o=t.filter(e=>n.includes(e.slug)||e.slug.includes(n));if(o.length!==0)return o.sort((e,t)=>t.slug.length-e.slug.length),o[0]}function wA(){return`models - list available LLM models
1450
1450
 
1451
1451
  Usage: models [options]
@@ -1460,7 +1460,7 @@ Options:
1460
1460
  -h, --help Show this help message
1461
1461
  `}function TA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`.replace(`.0M`,`M`):e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function EA(e){return`$${e.toFixed(2)}`}const DA=/\b(embedding|embed|tts|whisper|dall-e|image-gen|audio|vision-preview)\b/i;function OA(e){let t=`${e.id} ${e.name??``}`;return!DA.test(t)}function kA(e){let t=e.match(/^(claude-(?:opus|sonnet|haiku))/);if(t)return t[1];let n=e.match(/^(gpt-\d+)(?:\.\d+)?(-[a-z][-a-z]*)?$/);if(n)return n[1]+(n[2]??``);let r=e.match(/^gemini-[\d.]+-(.+)$/);if(r)return`gemini-${r[1]}`;let i=e.match(/^gemini-(\d+)-(.+)$/);if(i)return`gemini-${i[2]}`;let a=e.match(/^grok-[\d.]+-([\w-]+)$/);if(a)return`grok-${a[1]}`;if(e.match(/^(grok)-[\d.]+$/))return`grok`;let o=e.match(/^(o\d+(?:-[a-z]+)?)(?:-\d.*)?$/);if(o)return o[1]}function AA(e){let t=e.toLowerCase();return t=t.replace(/-\d{8}$/,``),t=t.replace(/-\d{4}$/,``),t=t.replace(/-(preview|latest)$/,``),kA(t)??t.replace(/-[\d.]+$/,``)}function jA(e){let t=new Map;for(let n of e){let e=AA(n.id);(!t.has(e)||n.selected)&&t.set(e,n)}return[...t.values()]}function MA(e,t,n,r,i){let a=i?CA(e.id,i):void 0,o={id:e.id,name:e.name,provider:t,cost:e.cost??{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:e.contextWindow??0,maxTokens:e.maxTokens??0,reasoning:!!e.reasoning,input:e.input??[`text`],selected:e.id===n&&t===r};return a?.intelligence_index!=null&&(o.intelligence=a.intelligence_index),a?.coding_index!=null&&(o.codingScore=a.coding_index),a?.speed_tps!=null&&(o.speed=a.speed_tps),o}function NA(e,t,n,r){let i=[];i.push(`Models for "${e}" (${t}):\n`);for(let e of n){let t=e.selected?` ► `:` `,n=e.id.padEnd(30),r=`${EA(e.cost.input)} / ${EA(e.cost.output)}`,a=`${TA(e.contextWindow)} ctx`,o=e.intelligence==null?``:`IQ:${e.intelligence}`,s=e.speed==null?``:`${Math.round(e.speed)} t/s`,c=e.reasoning?`reasoning`:``,l=o||s?`${o.padEnd(6)} ${s.padEnd(8)}`:``;i.push(`${t}${n} ${r.padEnd(16)} ${a.padEnd(10)} ${l} ${c}`)}return i.push(`\n ${n.length} model${n.length===1?``:`s`} available.`),r&&i.push(` Intelligence data: artificialanalysis.ai`),i.join(`
1462
1462
  `)+`
1463
- `}function PA(e){let t=w(e,{bool:mA,value:hA});return`error`in t?t:{jsonMode:t.bools.has(`--json`),allMode:t.bools.has(`--all`),allVersions:t.bools.has(`--all-versions`),forceRefresh:t.bools.has(`--refresh`),noBenchmarks:t.bools.has(`--no-benchmarks`),explicitProvider:t.values.get(`--provider`)}}function FA(e,t,n){if(t.explicitProvider){let n=e.getAvailableProviders();return n.includes(t.explicitProvider)?[t.explicitProvider]:{error:`Unknown provider: ${t.explicitProvider}. Available: ${n.join(`, `)}\n`}}return t.allMode?[...new Set(e.getAccounts().map(e=>e.providerId))]:[n]}function IA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(OA);if(o.length===0)return[];let s=o.map(e=>MA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=jA(s)),s}function LA(e,t,n,r){let i=`${e}:${t}`,a=`${n}:${r}`;return i===a?`Currently using: ${i}\n`:`Currently using: ${i} (selected ${a} — resolved to a different model)\n`}async function RA(e,t){if(T(e,{valueFlags:hA}))return{stdout:wA(),stderr:``,exitCode:0};let n=PA(e);if(`error`in n)return gA(`models: ${n.error}`);let r=await import(`./account-store-BspEP7gu.js`).then(e=>e.t);if(r.getAccounts().length===0)return gA(`No provider accounts configured. Run the provider settings to add one.
1463
+ `}function PA(e){let t=w(e,{bool:mA,value:hA});return`error`in t?t:{jsonMode:t.bools.has(`--json`),allMode:t.bools.has(`--all`),allVersions:t.bools.has(`--all-versions`),forceRefresh:t.bools.has(`--refresh`),noBenchmarks:t.bools.has(`--no-benchmarks`),explicitProvider:t.values.get(`--provider`)}}function FA(e,t,n){if(t.explicitProvider){let n=e.getAvailableProviders();return n.includes(t.explicitProvider)?[t.explicitProvider]:{error:`Unknown provider: ${t.explicitProvider}. Available: ${n.join(`, `)}\n`}}return t.allMode?[...new Set(e.getAccounts().map(e=>e.providerId))]:[n]}function IA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(OA);if(o.length===0)return[];let s=o.map(e=>MA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=jA(s)),s}function LA(e,t,n,r){let i=`${e}:${t}`,a=`${n}:${r}`;return i===a?`Currently using: ${i}\n`:`Currently using: ${i} (selected ${a} — resolved to a different model)\n`}async function RA(e,t){if(T(e,{valueFlags:hA}))return{stdout:wA(),stderr:``,exitCode:0};let n=PA(e);if(`error`in n)return gA(`models: ${n.error}`);let r=await import(`./account-store-Co7p6uLK.js`).then(e=>e.t);if(r.getAccounts().length===0)return gA(`No provider accounts configured. Run the provider settings to add one.
1464
1464
  `);let i=r.resolveCurrentModel(),a=i.id,o=i.provider,s=r.getSelectedProvider(),c=r.getSelectedModelId(),l;if(!n.noBenchmarks){let e=await xA(t,n.forceRefresh);e.length>0&&(l=e)}let u=FA(r,n,s);if(`error`in u)return gA(u.error);let d=[],f=[];for(let e of u){let t=IA(r,e,a,o,l,n.allVersions);if(t.length===0){if(!n.allMode)return gA(`No models available for provider ${e}.\n`);continue}if(d.push(...t),!n.jsonMode){let n=r.getProviderConfig(e);f.push(NA(n.name,e,t,!!l))}}return n.jsonMode?{stdout:JSON.stringify(d,null,2)+`
1465
1465
  `,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
1466
1466
  `),f.push(LA(o,a,s,c)),{stdout:f.join(`
@@ -1518,7 +1518,7 @@ Examples:
1518
1518
  `)}\n`,stderr:``,exitCode:0}}async function lj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
1519
1519
  `,exitCode:1};let r=e.getExtraOAuthDomains(t),i=n.toLowerCase();return r.some(e=>e.toLowerCase()===i)?{stdout:`(${n} already in ${t} extras)\n`,stderr:``,exitCode:0}:(await e.setExtraOAuthDomainsAsync(t,[...r,n]),{stdout:`Added ${n} to ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0})}async function uj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain remove: requires <providerId> and <domain>
1520
1520
  `,exitCode:1};let r=e.getExtraOAuthDomains(t),i=n.toLowerCase(),a=r.filter(e=>e.toLowerCase()!==i);return a.length===r.length?{stdout:`(${n} not found in ${t} extras)\n`,stderr:``,exitCode:0}:(await e.setExtraOAuthDomainsAsync(t,a),{stdout:`Removed ${n} from ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0})}async function dj(e,t){return t?(await e.setExtraOAuthDomainsAsync(t,[]),{stdout:`Cleared extra domains for ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0}):{stdout:``,stderr:`oauth-domain clear: requires <providerId>
1521
- `,exitCode:1}}async function fj(e,t,n,r){switch(t){case`list`:return cj(e,n);case`add`:return lj(e,n,r);case`remove`:return uj(e,n,r);case`clear`:return dj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${oj()}`,exitCode:1}}}function pj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:oj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return sj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-BspEP7gu.js`).then(e=>e.t);try{return await fj(a,n,r,i)}catch(e){return sj(e instanceof Error?e.message:String(e))}})}function mj(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-x2hyttPz.js`);return n(e,t)})}const hj=[`--download`,`-d`,`--view`,`-v`],gj=[`--size`],_j={low:256,medium:768,high:1536};function vj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
1521
+ `,exitCode:1}}async function fj(e,t,n,r){switch(t){case`list`:return cj(e,n);case`add`:return lj(e,n,r);case`remove`:return uj(e,n,r);case`clear`:return dj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${oj()}`,exitCode:1}}}function pj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:oj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return sj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-Co7p6uLK.js`).then(e=>e.t);try{return await fj(a,n,r,i)}catch(e){return sj(e instanceof Error?e.message:String(e))}})}function mj(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-DZrK_oOt.js`);return n(e,t)})}const hj=[`--download`,`-d`,`--view`,`-v`],gj=[`--size`],_j={low:256,medium:768,high:1536};function vj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
1522
1522
 
1523
1523
  VFS paths are served in a new browser tab via the preview service worker.
1524
1524
  URLs (http/https/etc.) are opened directly in a new tab.
@@ -1544,7 +1544,7 @@ Examples:
1544
1544
  `);let i=!1;try{i=(await t.fs.stat(e)).isDirectory}catch{}let a=await Tr(t.fs,i?e:Nr(e)),o=Hr(e,a),s;try{s=await r(o)}catch(e){return G(`${e instanceof Error?e.message:String(e)}\n`)}return Dj(`opened ${e} → ${o}${Oj(s)}`)}async function Fj(e,t,n,r){if(!Dr(e)&&e.endsWith(`.shtml`)&&t.fs)return Aj(e,t,r.sprinkleManager,r.canOpenWindow,r.openExternal);if(!n.view&&!r.canOpenWindow)return G(`open: browser APIs are unavailable in this environment
1545
1545
  `);if(Dr(e))return jj(e,r.canOpenWindow,r.openExternal);let i=t.fs.resolvePath(t.cwd,e);return n.view?Mj(e,i,t,n.sizeSpec):n.download?Nj(e,i,t,r.hasDom):Pj(i,t,r.canOpenWindow,r.openExternal)}function Ij(e){return C(`open`,async(t,n)=>{if(t.length===0||T(t,{valueFlags:gj}))return vj();let r=Ej(t);if(`error`in r)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{download:i,view:a,sizeSpec:o,targets:s}=r;if(s.length===0)return vj();let c=globalThis.__slicc_sprinkleManager,l=typeof window<`u`&&typeof document<`u`,u=l?null:b(),d={canOpenWindow:!!e||l||!!u,hasDom:l,sprinkleManager:c,openExternal:kj(e,l,u)},f=[];for(let e of s){let t=await Fj(e,n,{view:a,download:i,sizeSpec:o},d);if(!t.ok)return t.result;f.push(t.message)}return{stdout:f.join(`
1546
1546
  `)+`
1547
- `,stderr:``,exitCode:0}})}function Lj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-yIEzBr4M.js`);return n(e,t)})}function Rj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BEs473Sp.js`);return r(e,t,n)})}function zj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
1547
+ `,stderr:``,exitCode:0}})}function Lj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-BPeIvqOM.js`);return n(e,t)})}function Rj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BEs473Sp.js`);return r(e,t,n)})}function zj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
1548
1548
 
1549
1549
  Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
1550
1550
  is zero-padded to the digit width of the last page (out-1.png for a 9-page
@@ -1839,7 +1839,7 @@ Limits and lifetime:
1839
1839
  `,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
1840
1840
  `,exitCode:1}}async function BP(e,t,n){if(e.ttlMs!==void 0){if(!t)throw Error(`persistent snapshot filesystem unavailable`);return MP(t,n)}}async function VP(e,t,n,r){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return gP();let i=SP(e);if(i.error)return{stdout:``,stderr:i.error,exitCode:1};let a=await RP(i);if(a)return a;if(!i.directory)return gP();let o=zP(i);if(o)return o;let s=await CP(i.directory,i.entry,t.fs,t.cwd);if(wP(s))return s;let{fullDirectory:c,entryPath:l}=s,u;try{u=await BP(i,r,c)}catch(e){return{stdout:``,stderr:`serve: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}let d=i.project?`serve: --project is obsolete; ignored (root-absolute paths work natively under unified preview)
1841
1841
  `:``,f=await IP(!i.noBridge&&i.bridge,d);return f.ok?LP(i,c,l,f.webhookId,d,u,n):f.result}function HP(e,t){return C(`serve`,(n,r)=>VP(n,r,e,t))}const UP=`usage: session export [--id <id>] [--output <path>]
1842
- `;function WP(e){if(e.includes(`\0`))return{ok:!1,reason:`path must not contain NUL bytes`};if(e.includes(`\\`))return{ok:!1,reason:`path must not contain backslashes`};let t=e.split(`/`);for(let e of t)if(e===`..`)return{ok:!1,reason:`path must not contain ".."/traversal segments`};return{ok:!0}}function GP(e){let t=null,n=null,r=e.slice(1);for(let e=0;e<r.length;e++){let i=r[e];if(i===`--id`){if(t!==null)return{ok:!1,stderr:`session export: duplicate flag --id\n${UP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${UP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${UP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${UP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${UP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${UP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function KP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||Ft(r)!==a.sha256)throw new za(`transfer-corrupt`);return r}async function qP(e,t){let n=GP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=WP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${UP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Os().export(a,{}),n=await KP(e),r=i??`/workspace/${e.filename}`;return await t.fs.writeFile(r,n),{stdout:`exported ${r}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`session export: ${e instanceof za?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function JP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return qP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-LPNx4Ykm.js`);return n(e,t,UP)})}function YP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-BRFnmkzR.js`);return await n(e,t)})}const XP=`leader`;function ZP(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function QP(e){return+!!e.leader+e.followers.length}function $P(){return{stdout:`usage: sprinkle <subcommand> [args]
1842
+ `;function WP(e){if(e.includes(`\0`))return{ok:!1,reason:`path must not contain NUL bytes`};if(e.includes(`\\`))return{ok:!1,reason:`path must not contain backslashes`};let t=e.split(`/`);for(let e of t)if(e===`..`)return{ok:!1,reason:`path must not contain ".."/traversal segments`};return{ok:!0}}function GP(e){let t=null,n=null,r=e.slice(1);for(let e=0;e<r.length;e++){let i=r[e];if(i===`--id`){if(t!==null)return{ok:!1,stderr:`session export: duplicate flag --id\n${UP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${UP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${UP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${UP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${UP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${UP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function KP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||Ft(r)!==a.sha256)throw new za(`transfer-corrupt`);return r}async function qP(e,t){let n=GP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=WP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${UP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Os().export(a,{}),n=await KP(e),r=i??`/workspace/${e.filename}`;return await t.fs.writeFile(r,n),{stdout:`exported ${r}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`session export: ${e instanceof za?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function JP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return qP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-CDOmbg5g.js`);return n(e,t,UP)})}function YP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-BRFnmkzR.js`);return await n(e,t)})}const XP=`leader`;function ZP(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function QP(e){return+!!e.leader+e.followers.length}function $P(){return{stdout:`usage: sprinkle <subcommand> [args]
1843
1843
 
1844
1844
  list [--runtime <id>] List sprinkles + an instance line per runtime
1845
1845
  open <name> Open a sprinkle by name
@@ -2989,7 +2989,7 @@ or pass -bios / -vgabios with explicit VFS paths.`,NR={"-n":PR,"-name":PR,"--nam
2989
2989
  `)}\n`)}function tz(e,t){return`prefer: computer ${e} -c ${t}\n`}async function nz(e,t,n,r){let i=BR(t);if(VR(i))return i;let[{runComputer:a},{getComputerRegistry:o,installComputerRegistry:s},c]=await Promise.all([import(`./run-BJGzDxyk.js`).then(e=>e.t),import(`./registry-DfuJBCKY.js`),import(`./v86-16ZWsI-9.js`)]),l=c.v86ComputerId(t),u=o()??s(null);return u.get(l)||c.registerV86Computer(i,u),rz(await a([`-c`,l,...n],e,{registry:u}),r,l)}function rz(e,t,n){let r=tz(t,n);return e.exitCode===0?$(`${e.stdout}${r}`):e.stderr.includes(`screenshot failed after input`)?$(`${e.stderr}${r}`):{stdout:e.stdout,stderr:e.stderr.replace(/^computer: /u,`v86: `),exitCode:e.exitCode}}async function iz(e,t){let{name:n,rest:r}=zR(e);if(r.length===0){let e=BR(n);return VR(e)?e:Q(`type: no text supplied`)}return nz(t,n,[`type`,`--`,...r],`type`)}async function az(e,t){let{name:n,rest:r}=zR(e);if(r.length===0){let e=BR(n);return VR(e)?e:Q(`key: no chord supplied`)}return nz(t,n,[`key`,...r],`key`)}const oz=[`left`,`middle`,`right`];async function sz(e,t){let{name:n,rest:r}=zR(e),i=BR(n);if(VR(i))return i;let a=r.indexOf(`--to`);if(a!==-1){let e=r[a+1],i=e?/^(\d+),(\d+)$/u.exec(e):null;return i?nz(t,n,[`--native`,`mousemove`,i[1],i[2]],`mousemove`):Q(`mouse: --to requires <x>,<y>`)}let o=r[0];if(o===`move`){let e=r[1],i=r[2];return e===void 0||i===void 0||!Number.isFinite(Number(e))||!Number.isFinite(Number(i))?Q(`mouse: move requires <dx> <dy>`):nz(t,n,[`--native`,`mousemove`,e,i,`--relative`],`mousemove`)}if(o===`click`){let e=r[1]??`left`;if(!oz.includes(e))return Q(`mouse: unknown button '${r[1]}'`);let i=[`click`,e];return r.includes(`--double`)&&i.push(`--repeat`,`2`),nz(t,n,i,`click`)}return Q(`mouse: expected move <dx> <dy>, click [button], or --to <x>,<y>`)}async function cz(e,t){let{name:n,rest:r}=zR(e);return nz(t,n,[`screenshot`,...r],`screenshot`)}async function lz(e,t){let{name:n}=zR(e);return nz(t,n,[`text`],`text`)}function uz(e){let{name:t}=zR(e);return $(`v86 serve is retired.\nUse: computer watch -c v86:${t}\nLive frames go to the overlay, lightbox, and bash rows.\n`)}function dz(e){let{name:t,rest:n}=zR(e),r=BR(t);if(VR(r))return r;let i=n.indexOf(`--send`);if(i!==-1){let e=n.slice(i+1).join(` `).replace(/\\n/gu,`
2990
2990
  `);return e?(r.emulator.serial0_send(e),$()):Q(`serial: --send requires text`)}let a=n.indexOf(`--tail`);if(a!==-1){let e=Number.parseInt(n[a+1]??`25`,10);return $(`${r.serial.buffer.split(`
2991
2991
  `).slice(-Math.max(1,e)).join(`
2992
- `)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function fz(e,t){let{name:n,rest:r}=zR(e),i=BR(n);if(VR(i))return i;let[a,o]=r;if(a!==`save`&&a!==`load`||!o)return Q(`state: expected save|load <file>`);let s=t.fs.resolvePath(t.cwd,o);if(a===`save`){let e=await i.emulator.save_state();return await t.fs.writeFile(s,new Uint8Array(e)),$(`${s} (${e.byteLength} bytes)\n`)}if(!await t.fs.exists(s))return Q(`state: no such file: ${o}`);let c=await t.fs.readFileBuffer(s),l=new ArrayBuffer(c.byteLength);return new Uint8Array(l).set(c),await i.emulator.restore_state(l),$()}async function pz(e,t){let{name:n,rest:r}=zR(e),i=BR(n);if(VR(i))return i;let a=t.processManager??WR();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await $R(i,a),$(`VM '${n}' stopped\n`))}function mz(e={}){return C(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-DKWaudm_.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}const hz=[`--name`,`--filter`,`--scoop`],gz={state:`inactive`,session:null};function _z(){return{stdout:`usage: webhook <command> [options]
2992
+ `)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function fz(e,t){let{name:n,rest:r}=zR(e),i=BR(n);if(VR(i))return i;let[a,o]=r;if(a!==`save`&&a!==`load`||!o)return Q(`state: expected save|load <file>`);let s=t.fs.resolvePath(t.cwd,o);if(a===`save`){let e=await i.emulator.save_state();return await t.fs.writeFile(s,new Uint8Array(e)),$(`${s} (${e.byteLength} bytes)\n`)}if(!await t.fs.exists(s))return Q(`state: no such file: ${o}`);let c=await t.fs.readFileBuffer(s),l=new ArrayBuffer(c.byteLength);return new Uint8Array(l).set(c),await i.emulator.restore_state(l),$()}async function pz(e,t){let{name:n,rest:r}=zR(e),i=BR(n);if(VR(i))return i;let a=t.processManager??WR();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await $R(i,a),$(`VM '${n}' stopped\n`))}function mz(e={}){return C(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-DW65sPip.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}const hz=[`--name`,`--filter`,`--scoop`],gz={state:`inactive`,session:null};function _z(){return{stdout:`usage: webhook <command> [options]
2993
2993
 
2994
2994
  Commands:
2995
2995
  create [--scoop <name>] [--name <name>] [--filter <code>] Create a new webhook endpoint
@@ -3251,6 +3251,6 @@ pass --wait to block and print the full result.`,IB=new Set([`list`,`status`,`st
3251
3251
  `,stderr:``,exitCode:0};let n;try{n=cV(e)}catch(e){return XB(e.message)}let r=n.positional[0],i=n.positional[1],a=!r||r===`-`,o;try{o=await uV(t,r,a)}catch{return XB(`${r}: No such file or directory`)}if(n.revert){let e=$B(o),r=n.plain?iV(e):aV(e);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),r),{stdout:``,stderr:``,exitCode:0}):{stdout:$B(r),stderr:``,exitCode:0}}let{data:s,base:c}=fV(n,o),l=dV(n,s,c,r,a);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),l),{stdout:``,stderr:``,exitCode:0}):{stdout:l,stderr:``,exitCode:0}})}async function mV(e,t,n,r){if((await e.fs.stat(t)).isFile)return r[n]=await e.fs.readFileBuffer(t),1;let i=await e.fs.readdir(t),a=0;for(let o of i){let i=Or(t,o),s=n?`${n}/${o}`:o;a+=await mV(e,i,s,r)}return a}function hV(){return{stdout:`usage: zip [-r] <archive.zip> <path> [path...]
3252
3252
  `,stderr:``,exitCode:0}}function gV(){return C(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return hV();let n=!1,r=[];for(let t of e){if(t===`-r`){n=!0;continue}if(t.startsWith(`-`))return{stdout:``,stderr:`zip: unsupported option ${t}\n`,exitCode:1};r.push(t)}if(r.length<2)return{stdout:``,stderr:`zip: expected archive path and at least one input path
3253
3253
  `,exitCode:1};let i=t.fs.resolvePath(t.cwd,r[0]),a=r.slice(1),o={},s=0;for(let e of a){let r=t.fs.resolvePath(t.cwd,e),i=await t.fs.stat(r),a=(e.startsWith(`/`)?e.slice(1):e.replace(/^\.\//,``))||kr(r);if(i.isDirectory&&!n)return{stdout:``,stderr:`zip: ${e} is a directory (use -r)\n`,exitCode:1};s+=await mV(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
3254
- `,exitCode:1};let c=Lt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function _V(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-Br5ePgQj.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function vV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function yV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[kO(`ipk`,r),kO(`npm`,r),kO(`i`,r),vk(`ipx`,{fs:t,fetch:n}),vk(`npx`,{fs:t,fetch:n}),Tb(`di`,{fs:t,fetch:n}),Tb(`uv`,{fs:t,fetch:n}),UL({fs:t,fetch:n})]}function bV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>QM(e,t))}function xV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function SV(e={}){let t=[PE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),AF(),YP(),HP(e.browserAPI,e.fs),Ij(e.browserAPI),By(e.browserAPI),zD(e),gV(),yL(),dI(e.fs?{fs:e.fs}:{}),LF(),WF(),VF(),Fv(),mz(xV(e)),oC(xV(e)),pV(),wF(`sqlite3`),wF(`sqllite`),OI(),JI(),Vx(),_v(),$A({buildProcessConfig:e.buildProcessConfig}),$A({buildProcessConfig:e.buildProcessConfig},`jsh`),...bV(e),...yV(e),...e.fs?[aC({fs:e.fs})]:[],...e.fs?[dA({fs:e.fs})]:[],...e.fetch?[GE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],PS(),FS(),qS(),kz(e.webhook),mB(),zy(e.crontask),_V(e),nM({fs:e.fs,fetch:e.fetch}),iC(),hF(),Lj(),Rj(`pdftk`),Rj(`pdf`),vv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),vv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Jj(`pdftoppm`),Jj(`pdftocairo`),Yj(`pdftotext`),Cy(`convert`),Cy(`magick`),wB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),QI(),mL(),FD(),ID(),hL(),fA(),nN(),iA(),fx(),mj(),pj(),tA(),pP(vV(e)),Bp(e.gitCredential),hN({fs:e.fs}),VN(),Mv(),Nv(),Pv(`xclip`),Pv(`xsel`),BN(),SC(),l_(),u_(),zA(e.fs),gt(),ij(),d_({getParentJid:e.getParentJid}),bx(),wM({processManager:e.processManager}),iR({processManager:e.processManager}),xk({processManager:e.processManager}),yk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...p_(),uA(),qk(),kR(),_D(),SS(),GR({processManager:e.processManager}),Rv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),NS(),Tv({registry:e.cherryRuntimeRegistry}),Yy(),tb({fs:e.fs}),nb({fs:e.fs}),MF(e.sudoCommand),VB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),hB(),JP()];return e.fs&&(Zj(),t.push(...$n.map(t=>jE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let CV=null;function wV(e){CV=e}function TV(e){CV?.(e)}var EV=Jt();const DV={user:`user`,home:cm},OV=new Set([`root`,`nobody`,`nogroup`]),kV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function AV(e){return{user:kV.test(e.user)&&!OV.has(e.user)?e.user:DV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:DV.home}}function jV(e,t){let{user:n,home:r}=AV(t);if(e===`/etc/passwd`)return[`root:x:0:0:root:/root:/bin/bash`,`${n}:x:1000:1000:SLICC user:${r}:/bin/bash`,`nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin`,``].join(`
3254
+ `,exitCode:1};let c=Lt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function _V(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-CwuwVp6r.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function vV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function yV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[kO(`ipk`,r),kO(`npm`,r),kO(`i`,r),vk(`ipx`,{fs:t,fetch:n}),vk(`npx`,{fs:t,fetch:n}),Tb(`di`,{fs:t,fetch:n}),Tb(`uv`,{fs:t,fetch:n}),UL({fs:t,fetch:n})]}function bV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>QM(e,t))}function xV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function SV(e={}){let t=[PE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),AF(),YP(),HP(e.browserAPI,e.fs),Ij(e.browserAPI),By(e.browserAPI),zD(e),gV(),yL(),dI(e.fs?{fs:e.fs}:{}),LF(),WF(),VF(),Fv(),mz(xV(e)),oC(xV(e)),pV(),wF(`sqlite3`),wF(`sqllite`),OI(),JI(),Vx(),_v(),$A({buildProcessConfig:e.buildProcessConfig}),$A({buildProcessConfig:e.buildProcessConfig},`jsh`),...bV(e),...yV(e),...e.fs?[aC({fs:e.fs})]:[],...e.fs?[dA({fs:e.fs})]:[],...e.fetch?[GE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],PS(),FS(),qS(),kz(e.webhook),mB(),zy(e.crontask),_V(e),nM({fs:e.fs,fetch:e.fetch}),iC(),hF(),Lj(),Rj(`pdftk`),Rj(`pdf`),vv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),vv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Jj(`pdftoppm`),Jj(`pdftocairo`),Yj(`pdftotext`),Cy(`convert`),Cy(`magick`),wB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),QI(),mL(),FD(),ID(),hL(),fA(),nN(),iA(),fx(),mj(),pj(),tA(),pP(vV(e)),Bp(e.gitCredential),hN({fs:e.fs}),VN(),Mv(),Nv(),Pv(`xclip`),Pv(`xsel`),BN(),SC(),l_(),u_(),zA(e.fs),gt(),ij(),d_({getParentJid:e.getParentJid}),bx(),wM({processManager:e.processManager}),iR({processManager:e.processManager}),xk({processManager:e.processManager}),yk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...p_(),uA(),qk(),kR(),_D(),SS(),GR({processManager:e.processManager}),Rv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),NS(),Tv({registry:e.cherryRuntimeRegistry}),Yy(),tb({fs:e.fs}),nb({fs:e.fs}),MF(e.sudoCommand),VB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),hB(),JP()];return e.fs&&(Zj(),t.push(...$n.map(t=>jE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let CV=null;function wV(e){CV=e}function TV(e){CV?.(e)}var EV=Jt();const DV={user:`user`,home:cm},OV=new Set([`root`,`nobody`,`nogroup`]),kV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function AV(e){return{user:kV.test(e.user)&&!OV.has(e.user)?e.user:DV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:DV.home}}function jV(e,t){let{user:n,home:r}=AV(t);if(e===`/etc/passwd`)return[`root:x:0:0:root:/root:/bin/bash`,`${n}:x:1000:1000:SLICC user:${r}:/bin/bash`,`nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin`,``].join(`
3255
3255
  `);if(e===`/etc/group`)return[`root:x:0:`,`${n}:x:1000:`,`nogroup:x:65534:`,``].join(`
3256
3256
  `)}function MV(e,t=DV){let n=jV(e,t);return n===void 0?void 0:new TextEncoder().encode(n)}function NV(e){return e===`/etc`?[`group`,`passwd`]:[]}function PV(e){return e?.code===`ENOENT`}const FV=Reflect.get(ut,`DefenseInDepthBox`);function IV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function LV(e,t){if(typeof e!=`string`)return e;let n=IV(t);if(n===`binary`||n===`latin1`){let t=Oe(e);if(t)return t}return EV.Buffer.from(e,n)}function RV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}function zV(e){let t=/^[A-Za-z0-9._+-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`;return new TextEncoder().encode(`#!/bin/sh\n# SLICC command\nexec ${t} "$@"\n`)}function BV(e,t){let n=NV(e).filter(e=>!t.includes(e));return n.length?[...t,...n].sort():t}function VV(e,t){let n=NV(e).filter(e=>!t.some(t=>t.name===e));if(!n.length)return t;let r=n.map(e=>({name:e,isFile:!0,isDirectory:!1,isSymbolicLink:!1}));return[...t,...r].sort((e,t)=>e.name.localeCompare(t.name))}var HV=class{vfs;registeredCommandsFn=null;identityFn=null;listingStats=new Map;listingStatsMax;listingStatsTtlMs;constructor(e,t){this.vfs=e,this.listingStatsMax=Math.max(1,t?.listingStatsMax??2e4),this.listingStatsTtlMs=t?.listingStatsTtlMs??1e3,this.updateMetadataBatch=this.updateMetadataBatch.bind(this),this.symlinkBatch=this.symlinkBatch.bind(this)}get listingStatsSize(){return this.listingStats.size}primeListingStats(e,t){let n=Date.now();if(t.length>this.listingStatsMax){this.listingStats.clear();return}this.sweepExpiredListingStats(n),this.listingStats.size+t.length>this.listingStatsMax&&this.listingStats.clear();let r=e===`/`?`/`:`${e}/`;for(let e of t){let t=Ye(e),i=`${r}${e.name}`;this.listingStats.delete(i),t&&this.listingStats.set(i,{stats:t,at:n})}}sweepExpiredListingStats(e){for(let[t,n]of this.listingStats){if(e-n.at<=this.listingStatsTtlMs)break;this.listingStats.delete(t)}}primedStats(e){let t=this.listingStats.get(e);if(t){if(Date.now()-t.at>this.listingStatsTtlMs){this.listingStats.delete(e);return}return t.stats}}dropListingStats(){this.listingStats.clear()}setRegisteredCommandsFn(e){this.registeredCommandsFn=e}setIdentityFn(e){this.identityFn=e}identityFile(e){return MV(e,this.identityFn?.()??DV)}isVirtualBinCommand(e){return e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e)}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=RV(e);if(t===`/usr`||t===`/usr/bin`)return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date(0)};if(t.startsWith(`/usr/bin/`)){let e=t.slice(9);if(this.isVirtualBinCommand(e))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:493,size:zV(e).length,mtime:new Date(0)}}return null}canWrite(e){let t=this.vfs;return typeof t.canWrite!=`function`||t.canWrite(e)}listMountPoints(){let e=this.vfs;return typeof e.listMountPoints==`function`?e.listMountPoints():[]}trusted(e){let t=FV?.runTrustedAsync;return t?t(e):Promise.resolve().then(e)}async readFile(e,t){return this.trusted(async()=>{let n=x(e),r=await this.readRaw(n),i=IV(t),a=EV.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString(i);return i!==`hex`&&i!==`base64`&&m(a,r),a})}async readFileBuffer(e){return this.trusted(()=>this.readRaw(x(e)))}async readRaw(e){let t=RV(e);if(t.startsWith(`/usr/bin/`)&&this.isVirtualBinCommand(t.slice(9)))return zV(t.slice(9));let n;try{n=await this.vfs.readFile(e,{encoding:`binary`})}catch(t){let n=this.identityFile(e);if(n&&PV(t))return n;throw t}return n instanceof Uint8Array?n:new TextEncoder().encode(n)}identityStat(e,t){let n=this.identityFile(e);if(!(!n||!PV(t)))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:420,size:n.length,mtime:new Date(0)}}async readFileBytes(e){let t=await this.readFileBuffer(e);return EV.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString(`latin1`)}async getNativeFile(e){return this.trusted(()=>this.vfs.getNativeFile(x(e)))}async readFileRange(e,t,n){return this.trusted(()=>this.vfs.readFileRange(x(e),t,n))}async writeFile(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=x(e);await this.vfs.writeFile(r,LV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(x(e),LV(t,n)))}async exists(e){return this.trusted(async()=>{let t=x(e);return this.virtualUsrStat(t)?!0:await this.vfs.exists(t)||this.identityFile(t)!==void 0})}async stat(e){return this.trusted(async()=>{let t=x(e);try{return await this.statVfs(t)}catch(e){let n=this.identityStat(t,e);if(n)return n;throw e}})}async statVfs(e){let t=this.virtualUsrStat(e);if(t)return t;let n=this.vfs.statSync(e);if(n)return{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!!n.isSymlink,mode:n.mode??(n.type===`directory`?493:420),size:n.size,mtime:new Date(n.mtime),identity:n.identity,dev:n.dev,ino:n.identity===void 0?void 0:n.ino};let r=this.primedStats(e)??await this.vfs.stat(e);return{isFile:r.type===`file`,isDirectory:r.type===`directory`,isSymbolicLink:!!r.isSymlink,mode:r.mode??(r.type===`directory`?493:420),size:r.size,mtime:new Date(r.mtime),identity:r.identity,dev:r.dev,ino:r.identity===void 0?void 0:r.ino}}async lstat(e){return this.trusted(async()=>{let t=x(e);try{return await this.lstatVfs(t)}catch(e){let n=this.identityStat(t,e);if(n)return n;throw e}})}async lstatVfs(e){let t=this.virtualUsrStat(e);if(t)return t;let n=this.vfs.lstatSync(e);if(n)return{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:n.type===`symlink`,mode:n.mode??(n.type===`directory`?493:n.type===`symlink`?511:420),size:n.size,mtime:new Date(n.mtime),identity:n.identity,dev:n.dev,ino:n.identity===void 0?void 0:n.ino};let r=this.primedStats(e)??await this.vfs.lstat(e);return{isFile:r.type===`file`,isDirectory:r.type===`directory`,isSymbolicLink:r.type===`symlink`,mode:r.mode??(r.type===`directory`?493:r.type===`symlink`?511:420),size:r.size,mtime:new Date(r.mtime),identity:r.identity,dev:r.dev,ino:r.identity===void 0?void 0:r.ino}}async mkdir(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.mkdir(x(e),t)})}async readdir(e){return this.trusted(async()=>{let t=x(e);if(t===`/usr`)return[`bin`];if(RV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return BV(t,n.map(e=>e.name));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),BV(t,r.map(e=>e.name))})}async readdirWithFileTypes(e){return this.trusted(async()=>{let t=x(e);if(t===`/usr`)return[{name:`bin`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}];if(RV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort().map(e=>({name:e,isFile:!0,isDirectory:!1,isSymbolicLink:!1}));let n=this.vfs.readDirSync(t);if(n!==null)return VV(t,this.mapFastEntriesToDirents(n));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),VV(t,this.mapAsyncEntriesToDirents(r))})}mapFastEntriesToDirents(e){return e.map(e=>this.entryToDirent(e))}mapAsyncEntriesToDirents(e){return e.map(e=>this.entryToDirent(e))}entryToDirent(e){return e.type===`symlink`?{name:e.name,isFile:!1,isDirectory:!1,isSymbolicLink:!0}:{name:e.name,isFile:e.type===`file`,isDirectory:e.type===`directory`,isSymbolicLink:!1}}async rm(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rm(x(e),t)})}async cp(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=x(e),i=x(t),a;try{a=await this.vfs.stat(r)}catch(e){let t=this.identityFile(r);if(!t||!PV(e))throw e;await this.vfs.writeFile(i,t);return}if(a.type===`directory`){if(!n?.recursive)throw new Xe(`EISDIR`,`is a directory`,r);await this.cpDir(r,i)}else await this.vfs.copyFile(r,i)})}async cpDir(e,t){await this.vfs.mkdir(t,{recursive:!0});let n=await this.vfs.readDir(e);for(let r of n){let n=S(e,r.name),i=S(t,r.name);r.type===`directory`?await this.cpDir(n,i):await this.vfs.copyFile(n,i)}let r=new Set(n.map(e=>e.name));for(let n of NV(e)){let i=r.has(n)?void 0:this.identityFile(S(e,n));i&&await this.vfs.writeFile(S(t,n),i)}}async mv(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rename(x(e),x(t))})}async rename(e,t){return this.mv(e,t)}resolvePath(e,t){return t.startsWith(`/`)?x(t):x(S(e,t))}getAllPaths(){return[]}async chmod(e,t){return this.dropListingStats(),this.trusted(()=>this.vfs.chmod(x(e),t))}async updateMetadataBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.updateMetadataBatch(e.map(e=>({...e,path:x(e.path)}))))}async symlinkBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.symlinkBatch(e.map(e=>({target:e.target,path:x(e.path)}))))}async symlink(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.symlink(e,x(t))})}async link(e,t){throw Error(`Hard links not supported in VirtualFS`)}async readlink(e){return this.trusted(async()=>this.vfs.readlink(x(e)))}async realpath(e){return this.trusted(async()=>this.vfs.realpath(x(e)))}async utimes(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.utimes(x(e),t,n))}invalidatePaths(e){this.dropListingStats();let t=this.vfs;t.invalidatePaths&&t.invalidatePaths(e)}async forgetSidecarConsistency(){await this.vfs.forgetSidecarConsistency?.()}};function UV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?UV(e.getUnderlyingFS?.()):null}const WV=e(`almost-bash-shell`);function GV(e){if(!(`__SLICC_RUN_PID`in e)&&!(`__SLICC_OUTPUT_TEE__`in e)&&!(`__SLICC_SUDO_REASON`in e)&&!(`__SLICC_PIPESTATUS`in e)&&!(`__SLICC_PIPESTATUS_EX`in e))return{...e};let{[im]:t,[am]:n,[qp]:r,[Wt]:i,[Vt]:a,...o}=e;return o}function KV(e){let t=new AbortController,n=e.filter(e=>e!==void 0),r=()=>t.abort();for(let e of n)e.aborted?t.abort():e.addEventListener(`abort`,r,{once:!0});return{signal:t.signal,release(){for(let e of n)e.removeEventListener(`abort`,r)}}}var qV=class e{options;bash;vfsAdapter;gitCommands;mountCommands;lastEnv;cwd;umask=18;builtinCommandNames;staticBuiltinNames;allowedCommands;scriptCatalog;initialJshSync=null;ownsScriptCatalog;commandGate;jshRegistry;gnuBashFallback;pendingEnvWrites=new Map;activeShellPid;progress;activeRunSignal;commandAbort=new AbortController;scriptRun=null;scriptRunsActive=0;registryNames=new Set;outputTees=new Map;nextOutputTeeId=0;resolveJshProcessConfig=e=>this.buildJshProcessConfig(om(e));static buildAllowedCommandSet(e){return e.sudo?.defaultDisposition===`require-approval`||!e.allowedCommands||e.allowedCommands.includes(`*`)?null:new Set(e.allowedCommands)}static buildInitialEnv(e,t){return{HOME:cm,PATH:vr,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return SV({onMediaPreview:async e=>this.renderMediaPreview(e),getJshCommands:()=>this.getJshCommandNames(),getWorkflowCommands:()=>this.getWorkflowCommandNames(),syncScriptCommands:()=>this.syncJshCommands(),getStaticBuiltins:()=>[...this.staticBuiltinNames],getScriptRegisteredNames:()=>this.jshRegistry.scriptRegisteredNames(),fs:e.fs,fetch:t,streamFetch:n,scriptCatalog:this.scriptCatalog,browserAPI:e.browserAPI,webhook:e.webhook,crontask:e.crontask,getParentJid:e.getParentJid,isScoop:e.isScoop,buildProcessConfig:this.resolveJshProcessConfig,terminal:e.terminal,gateNativeCommand:this.gateNativeCommand,processManager:e.processManager,sudoCommand:e.sudo?{broker:e.sudo.broker,persistGrant:async e=>{this.commandGate.queueGrant(e)},suppressNextGate:e=>this.commandGate.registerSudoBypass(e)}:void 0,setEnv:(e,t)=>{this.pendingEnvWrites.set(e,t),this.lastEnv[e]=t},unsetEnv:e=>{this.pendingEnvWrites.set(e,null),delete this.lastEnv[e]},gitCredential:{githubToken:(e,t)=>this.gitCommands.githubCredential(e,t),githubDomains:Hp},gitIdentity:()=>this.gitCommands.identity(),mcpConnectionManager:e.mcpConnectionManager})}constructor(t){this.options=t,this.vfsAdapter=new HV(t.fs),this.progress=new mm({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t),this.commandGate=new Xp({getSudo:()=>this.options.sudo,fs:t.fs});let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new gp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:Vp}),this.mountCommands=new Us({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:$m});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=UV(i)??UV(a);this.scriptCatalog=t.scriptCatalog??new ki({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||gr(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=g({progress:ym(this.progress)}),l=_({progress:ym(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),qh(t.fs),Wg(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...ft(),...dt()],p=this.allowedCommands?f.filter(e=>this.isCommandAllowed(e)):void 0;if(this.bash=new pt({fs:this.vfsAdapter,cwd:n,env:{},fetch:c,commands:p,customCommands:d,sleep:Bm(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:Qp(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(sh),this.allowedCommands!==null){let e=this.bash;for(let t of dt())this.isCommandAllowed(t)||e.commands.delete(t)}{let e=this.bash;for(let[t,n]of e.commands)e.commands.set(t,this.wrapCommandForDispatch(n));this.registryNames=new Set(e.commands.keys())}let m=d.map(e=>e.name),h=p??[...ft(),...dt()];this.builtinCommandNames=new Set([...h,...m]),this.staticBuiltinNames=new Set(this.builtinCommandNames),this.vfsAdapter.setRegisteredCommandsFn(()=>[...this.builtinCommandNames]),this.vfsAdapter.setIdentityFn(()=>({user:this.lastEnv.USER??`user`,home:this.lastEnv.HOME??`/home/user`})),this.lastEnv={...r},this.cwd=n,this.bindCollaborators(t),this.startInitialJshSync()}bindCollaborators(e){let t=this;this.jshRegistry=new pm({get bash(){return t.bash},scriptCatalog:this.scriptCatalog,discoveryFs:e.jshDiscoveryFs??e.fs,vfsAdapter:this.vfsAdapter,get cwd(){return t.cwd},get lastEnv(){return t.lastEnv},get umask(){return t.umask},builtinCommandNames:this.builtinCommandNames,isCommandAllowed:e=>this.isCommandAllowed(e),wrapCommandForDispatch:e=>this.wrapCommandForDispatch(e),path:()=>this.lastEnv.PATH,buildJshProcessConfig:e=>this.buildJshProcessConfig(e),gateNativeCommand:this.gateNativeCommand,gitIdentity:()=>this.gitCommands.identity()}),this.gnuBashFallback=new sm({gnuBash:e.gnuBash===!0,get lastEnv(){return t.lastEnv},get cwd(){return t.cwd},get umask(){return t.umask},vfsAdapter:this.vfsAdapter,get bash(){return t.bash},scriptCatalog:this.scriptCatalog,outputTees:this.outputTees,gateNativeCommand:this.gateNativeCommand,buildJshProcessConfig:e=>this.buildJshProcessConfig(e),gitIdentity:()=>this.gitCommands.identity(),flushPendingCommandGrants:()=>this.commandGate.flushPendingCommandGrants(),applyPendingEnvWrites:()=>this.applyPendingEnvWrites(),syncJshCommands:()=>this.syncJshCommands(),adoptCwd:e=>{this.cwd=e},adoptEnv:e=>{this.lastEnv=e}})}getBash(){return this.bash}getCwd(){return this.cwd}getScriptCatalog(){return this.scriptCatalog}getEnv(){return{...this.lastEnv}}setMaskedEnvVar(e,t){this.pendingEnvWrites.set(e,t),this.lastEnv[e]=t}applySessionOverrides(e){e.cwd!==void 0&&(this.cwd=e.cwd,this.lastEnv.PWD=e.cwd),e.env&&Object.assign(this.lastEnv,e.env)}async getJshCommandNames(){return this.jshRegistry.getJshCommandNames()}async syncJshCommands(){return this.jshRegistry.syncJshCommands()}cancelActiveCommand(){this.commandAbort.abort(),this.commandAbort=new AbortController}async executeCommand(e,t,n,r=``,i){let a=this.activeShellPid;n!==void 0&&(this.activeShellPid=n);let o=i?.onOutput?`tee-${this.nextOutputTeeId+=1}`:void 0;o&&i?.onOutput&&this.outputTees.set(o,i.onOutput);try{let a=await this.runCommand(e,t,n,r,o,i?.capturePipeStatus);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode,...a.pipeStatus===void 0?{}:{pipeStatus:a.pipeStatus}}}finally{this.activeShellPid=a,o&&this.outputTees.delete(o)}}async executeScriptFile(e,t=[]){return fi(e,t,{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(this.lastEnv)),stdin:``,exec:(e,t)=>this.bash.exec(e,{env:t?.env??this.lastEnv,cwd:t?.cwd??this.cwd,umask:this.umask,...t?.env===void 0?{}:{replaceEnv:!0}})},this.buildJshProcessConfig())}dispose(){this.ownsScriptCatalog&&this.scriptCatalog.dispose()}async renderMediaPreview(e){throw Error(`terminal preview is unavailable in headless mode`)}startInitialJshSync(){this.initialJshSync=this.initHomeAndProfile().then(()=>this.syncJshCommands()).catch(()=>void 0).finally(()=>{this.initialJshSync=null})}async initHomeAndProfile(){let e=this.options.fs;try{let t=this.options.env?.HOME??await lm(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=um(t));let n=`${t.replace(/\/+$/,``)}/.profile`;if(!await e.exists(n).catch(()=>!1))return;let r=await this.bash.exec(`. "$HOME/.profile"`,{env:this.lastEnv,cwd:this.cwd,umask:this.umask});if(typeof r.umask==`number`&&(this.umask=r.umask),r.env){let{PWD:e,...t}=r.env;this.lastEnv={...t,PWD:this.lastEnv.PWD??this.cwd}}}catch(e){WV.warn(`HOME/profile init failed; continuing with defaults`,e)}}async waitForInitialJshSync(e){let t=this.initialJshSync;if(t===null)return;if(!e){await t;return}if(e.aborted)return;let n;try{await new Promise(r=>{n=()=>r(),e.addEventListener(`abort`,n,{once:!0}),t.then(()=>r(),()=>r())})}finally{n&&e.removeEventListener(`abort`,n)}}async runCommand(e,t,n,r=``,i,a=!1){if(TV(e.trim().split(/\s+/)[0]||`unknown`),v(),await this.waitForInitialJshSync(t),await this.gnuBashFallback.usesGnuBash())return this.gnuBashFallback.runOnGnuBash(e,t,n,r,i,a);let o=Yp(e),s={env:{...this.lastEnv,...n===void 0?{}:{[im]:String(n)},...i===void 0?{}:{[am]:i},...o?{[qp]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=KV([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(Ht(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.commandGate.flushPendingCommandGrants(),d=Bt(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=GV(d.env)),d.env&&this.lastEnv.PATH!==c&&await this.syncJshCommands().catch(()=>void 0),this.applyPendingEnvWrites(),d.env?.PWD&&(this.cwd=d.env.PWD),d.exitCode===127){let t=await this.jshRegistry.tryJshFallback(e,n);if(t)return this.syncJshCommands().catch(()=>void 0),t}if(d.exitCode!==0&&d.stderr.includes(`Permission denied`)){let{withShebangExecHint:e}=await import(`./shebang-exec-hint-CSwess-H.js`).then(e=>e.n);return Rt(await e(d,this.cwd,this.vfsAdapter),d.pipeStatus)}return d}applyPendingEnvWrites(){for(let[e,t]of this.pendingEnvWrites)t===null?delete this.lastEnv[e]:this.lastEnv[e]=t;this.pendingEnvWrites.clear()}gateNativeCommand=async(e,t,n)=>{if(this.allowedCommands!==null&&!this.isCommandAllowed(e))return{stderr:`bash: ${e}: command not found\n`,exitCode:127};if(!this.commandGate.isTransparentGatingEnabled()||Ap.has(e))return null;let r=await this.commandGate.gateCommandDispatch(e,t,n[qp]);return r?{stderr:r.stderr,exitCode:r.exitCode}:null};wrapCommandForDispatch(e){let t=this.commandGate.wrapCommandForSudo(e),n=e.name===`timeout`?Wm(t,this.progress):Km(t,this.progress),r=()=>this.scriptRun?.stepDone(),i=(e,t)=>this.teeCommandOutput(e,t),a=this.outputTees;return{...n,async execute(e,t){let o=t.env?.get(am),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await Jm(()=>n.execute(e,t),t.signal);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(am);if(!n)return;let r=this.outputTees.get(n);if(!r)return;let i=[t.stdout,t.stderr].filter(Boolean).join(``);i&&r(i)}beginScriptRun(e){if(this.scriptRunsActive+=1,!this.progress.hasSink())return null;if(this.scriptRunsActive>1)return this.scriptRun?.end(),this.scriptRun=null,null;let t={totalSteps:null};try{t=Fm(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Lm(t,this.progress,Im(e)),this.scriptRun}endScriptRun(e){this.scriptRunsActive=Math.max(0,this.scriptRunsActive-1),e&&(e.end(),this.scriptRun===e&&(this.scriptRun=null))}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(Ap.get(e)??e)}createGitCustomCommand(){let e=this.gitCommands;return C(`git`,async(t,n)=>{let r=n.cwd,i=await e.execute(t,r,n.env,P(n.stdin));return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}createMountCustomCommand(){let e=this.mountCommands;return C(`mount`,async(t,n)=>{let r=n.cwd,i=await e.execute(t,r,n.env);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}createUmountCustomCommand(){let e=this.mountCommands;return C(`umount`,async(t,n)=>{let r=n.cwd,i=await e.executeUmount(t,r);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}async getWorkflowCommandNames(){return this.jshRegistry.getWorkflowCommandNames()}buildJshProcessConfig(e){if(!(!this.options.processManager||!this.options.processOwner))return{processManager:this.options.processManager,owner:this.options.processOwner,getParentPid:()=>e??this.activeShellPid??this.options.getCurrentShellPid?.()}}};export{za as _,jB as a,ka as b,Ps as c,Cs as d,xs as f,Fa as g,Wo as h,DB as i,Ds as l,$o as m,HV as n,TB as o,es as p,wV as r,cm as s,qV as t,ws as u,Ra as v,Ro as y};
@@ -1 +1 @@
1
- import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-BWilXn3I.js";var t=`focus`,n={type:`leaf`,surfaceId:`chat`};function r(e,t={},n={}){return{zones:{top:null,left:null,middle:null,right:null,bottom:null,...e},rowFr:{top:1,center:1,bottom:1,...n},colFr:{left:1,middle:1,right:1,...t}}}var i={focus:{name:`focus`,tree:r({left:n},{left:3,middle:1})}};function a(e){return i[e]??null}function o(n,r){switch(r.kind){case`set`:n.applyLayout(r.tree);break;case`reset`:{let e=a(t);e&&n.applyLayout(e.tree);break}case`chat`:n.moveSurfaceToZone(e,r.zone);break;case`open`:n.placeSurface(r.zone,r.surfaceId);break;case`close`:n.removeSurface(r.surfaceId);break;case`move`:n.moveSurfaceToZone(r.surfaceId,r.zone);break;case`size`:n.setSurfaceSize(r.surfaceId,r.size)}}export{o as applyLayout};
1
+ import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-ZL0xE_Cs.js";var t=`focus`,n={type:`leaf`,surfaceId:`chat`};function r(e,t={},n={}){return{zones:{top:null,left:null,middle:null,right:null,bottom:null,...e},rowFr:{top:1,center:1,bottom:1,...n},colFr:{left:1,middle:1,right:1,...t}}}var i={focus:{name:`focus`,tree:r({left:n},{left:3,middle:1})}};function a(e){return i[e]??null}function o(n,r){switch(r.kind){case`set`:n.applyLayout(r.tree);break;case`reset`:{let e=a(t);e&&n.applyLayout(e.tree);break}case`chat`:n.moveSurfaceToZone(e,r.zone);break;case`open`:n.placeSurface(r.zone,r.surfaceId);break;case`close`:n.removeSurface(r.surfaceId);break;case`move`:n.moveSurfaceToZone(r.surfaceId,r.zone);break;case`size`:n.setSurfaceSize(r.surfaceId,r.size)}}export{o as applyLayout};