sliccy 6.256.0 → 6.256.2

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 (143) hide show
  1. package/dist/node-server/cloud-status.d.ts +8 -0
  2. package/dist/node-server/cloud-status.js +38 -0
  3. package/dist/ui/.vite/manifest.json +183 -183
  4. package/dist/ui/assets/{account-store-QxWo48Y1.js → account-store-CYXcTNmf.js} +1 -1
  5. package/dist/ui/assets/{account-store-DRK_jfiB.js → account-store-DLG3Av-u.js} +1 -1
  6. package/dist/ui/assets/{adobe-BwSa2oAU.js → adobe-DcrhMctx.js} +1 -1
  7. package/dist/ui/assets/{adobe-XnlO8IOa.js → adobe-OKBElK5I.js} +1 -1
  8. package/dist/ui/assets/{agent-panels-DLsxOOjW.js → agent-panels-ZG3ebUSL.js} +1 -1
  9. package/dist/ui/assets/{almost-bash-shell-headless-YXVG1DPI.js → almost-bash-shell-headless-RU8iANoA.js} +15 -15
  10. package/dist/ui/assets/{apply-layout-BtzT4Jrn.js → apply-layout-qj_IZphr.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-BiTykqg3.js → azure-openai-DK0alNtF.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-BH03ks5Y.js → azure-openai-DPYo4Wln.js} +1 -1
  13. package/dist/ui/assets/{bunny-probe-Bq1N-AVN.js → bunny-probe-DKhPxZeZ.js} +1 -1
  14. package/dist/ui/assets/{bunny-run-DyJVGqsu.js → bunny-run-DwKL9l6t.js} +1 -1
  15. package/dist/ui/assets/{cdp-Dm3JXxCN.js → cdp-DSFJzViN.js} +1 -1
  16. package/dist/ui/assets/{cerebras-Cj-dhgCb.js → cerebras-B9mbkTZf.js} +1 -1
  17. package/dist/ui/assets/{cerebras-B5dFzZuU.js → cerebras-Cm_8OStE.js} +1 -1
  18. package/dist/ui/assets/{composer-speech-0uRgiL71.js → composer-speech-CoFdC6Ue.js} +1 -1
  19. package/dist/ui/assets/{connect-surface-BQgwhG8d.js → connect-surface-BBRi7lly.js} +1 -1
  20. package/dist/ui/assets/{directed-approval-BxWIFFqA.js → directed-approval-DgdRwugK.js} +1 -1
  21. package/dist/ui/assets/{emscripten-vfs-hook-C73xuKfz.js → emscripten-vfs-hook-BGmnPBF-.js} +1 -1
  22. package/dist/ui/assets/{fast-path-hqxZk1HF.js → fast-path-D86NfZfu.js} +1 -1
  23. package/dist/ui/assets/{frozen-archive-writer-Cr1_j3pp.js → frozen-archive-writer-Dk602Q9A.js} +1 -1
  24. package/dist/ui/assets/{frozen-session-delete-CpcHR1XS.js → frozen-session-delete-D41KLb1Q.js} +1 -1
  25. package/dist/ui/assets/{frozen-session-identity-dpueujl9.js → frozen-session-identity-Wawl3rz4.js} +1 -1
  26. package/dist/ui/assets/{gelatiere-unit-PHQc3WNq.js → gelatiere-unit-NbtPiF37.js} +1 -1
  27. package/dist/ui/assets/{github-Bj8suNGU.js → github-C_k9XNGJ.js} +1 -1
  28. package/dist/ui/assets/{github-Dvjydy3P.js → github-D2A7mZDF.js} +1 -1
  29. package/dist/ui/assets/{github-copilot-CpJKXWfn.js → github-copilot-20yc0eqx.js} +1 -1
  30. package/dist/ui/assets/{github-copilot-D8DdUlya.js → github-copilot-D-lJD9JM.js} +1 -1
  31. package/dist/ui/assets/{hear-DDr5S4Od.js → hear-CS8KuGJo.js} +1 -1
  32. package/dist/ui/assets/{js-realm-worker-CXD4SmqZ.js → js-realm-worker-CvBctwsA.js} +2 -2
  33. package/dist/ui/assets/{jsh-executor-BFwK2t97.js → jsh-executor-B54XDkz2.js} +3 -3
  34. package/dist/ui/assets/{kernel-worker-DadD3ayk.js → kernel-worker-DS575H__.js} +9 -9
  35. package/dist/ui/assets/{lick-ws-bridge-Bq9kUe4V.js → lick-ws-bridge-BBZpW-Dg.js} +1 -1
  36. package/dist/ui/assets/{lick-ws-bridge-DMNf8klz.js → lick-ws-bridge-DMRxA0GE.js} +1 -1
  37. package/dist/ui/assets/{live-session-curation-CSJCW_xQ.js → live-session-curation-ChoGCSOH.js} +1 -1
  38. package/dist/ui/assets/{live-session-curation-CNk-iYCa.js → live-session-curation-nSX_c9Jb.js} +1 -1
  39. package/dist/ui/assets/{live-session-snapshot-BedjttIR.js → live-session-snapshot-BQcFx9d7.js} +1 -1
  40. package/dist/ui/assets/{local-llm-NE-qI2cb.js → local-llm-BdhJYy6M.js} +1 -1
  41. package/dist/ui/assets/{local-llm-qPIX8NMO.js → local-llm-cy-hboD7.js} +1 -1
  42. package/dist/ui/assets/{main-DVD6CfWm.js → main-BvTNS5M1.js} +3 -3
  43. package/dist/ui/assets/{main-cherry-ByF5f6AT.js → main-cherry-CLPxNUOm.js} +1 -1
  44. package/dist/ui/assets/{mcp-command-n1wIw393.js → mcp-command-Bshk9-8r.js} +10 -10
  45. package/dist/ui/assets/{memory-curation-seam-CjYHWDBt.js → memory-curation-seam-NFHXE0W5.js} +1 -1
  46. package/dist/ui/assets/{memory-health-DnbzPxqU.js → memory-health-DpXsg2PB.js} +1 -1
  47. package/dist/ui/assets/{memory-write-execute-BQg4KGxO.js → memory-write-execute-D4wz6znH.js} +1 -1
  48. package/dist/ui/assets/{merge-folded-cost-into-frozen-DA0swiNk.js → merge-folded-cost-into-frozen-Ce6e9pCy.js} +1 -1
  49. package/dist/ui/assets/{new-session-BHvzb7bp.js → new-session-DX7Em69X.js} +2 -2
  50. package/dist/ui/assets/{oauth-bootstrap-CqivQ7HA.js → oauth-bootstrap-BIoESN8s.js} +2 -2
  51. package/dist/ui/assets/{onboarding-orchestrator-C6UC6cTM.js → onboarding-orchestrator-DgsmYqKs.js} +1 -1
  52. package/dist/ui/assets/{openai-codex-B7A6dTqN.js → openai-codex-2LN44-VU.js} +1 -1
  53. package/dist/ui/assets/{openai-codex-xtvQmRuH.js → openai-codex-BNDOGlHP.js} +1 -1
  54. package/dist/ui/assets/{openrouter-CQeyGGEy.js → openrouter-B-qvuFIC.js} +1 -1
  55. package/dist/ui/assets/{openrouter-_6zsj8-6.js → openrouter-Cbloo6-N.js} +1 -1
  56. package/dist/ui/assets/{openrouter-free-BM772ovL.js → openrouter-free-CPMEIAmD.js} +1 -1
  57. package/dist/ui/assets/{openrouter-free-Du1No0Z_.js → openrouter-free-YgWGIS-T.js} +1 -1
  58. package/dist/ui/assets/{openrouter-oauth-BSSNY_G1.js → openrouter-oauth-DspK3V7c.js} +1 -1
  59. package/dist/ui/assets/{openrouter-oauth-D9dklyIn.js → openrouter-oauth-d_WhF-i_.js} +1 -1
  60. package/dist/ui/assets/{panel-rpc-handlers-rMOPHOSf.js → panel-rpc-handlers-CiVSlbYh.js} +2 -2
  61. package/dist/ui/assets/{panelize-shell-DLm7AfDp.js → panelize-shell-CszEdwrr.js} +1 -1
  62. package/dist/ui/assets/{pi-edit-execution-dq5caQ-R.js → pi-edit-execution-BOt2UG1t.js} +1 -1
  63. package/dist/ui/assets/{provider-4M0-Za9p.js → provider-Da_Xha6T.js} +1 -1
  64. package/dist/ui/assets/{provider-C6V5bKb2.js → provider-ic7srMSZ.js} +1 -1
  65. package/dist/ui/assets/{provider-settings-C46VEmp7.js → provider-settings-DXTVzWZr.js} +1 -1
  66. package/dist/ui/assets/provider-store-access-C1OIs0Sn.js +1 -0
  67. package/dist/ui/assets/provider-store-access-C94YO93f.js +1 -0
  68. package/dist/ui/assets/{providers-B5VMaUWX.js → providers-BwKmSpLH.js} +2 -2
  69. package/dist/ui/assets/{providers-Bw0birsa.js → providers-DinkpGvr.js} +1 -1
  70. package/dist/ui/assets/{quick-llm-D5hmdHQQ.js → quick-llm-4ddeV6ZI.js} +1 -1
  71. package/dist/ui/assets/{realm-inprocess-DsBZtVOH.js → realm-inprocess-gfLwWl-i.js} +2 -2
  72. package/dist/ui/assets/{realm-unhandled-rejections-BDHLlsLp.js → realm-unhandled-rejections-CkX1BGEd.js} +1 -1
  73. package/dist/ui/assets/{realm-unhandled-rejections-BDnl84l4.js → realm-unhandled-rejections-iuOFsoIO.js} +1 -1
  74. package/dist/ui/assets/{remote-terminal-view-DYm18AE3.js → remote-terminal-view-DM_rdDTN.js} +2 -2
  75. package/dist/ui/assets/{restore-CKcu1P_Z.js → restore-ku3NI9gU.js} +1 -1
  76. package/dist/ui/assets/{run-Ds-D_Vog.js → run-B9uXGQYv.js} +2 -2
  77. package/dist/ui/assets/{run-DS9gNHJH.js → run-BHLpn7EO.js} +2 -2
  78. package/dist/ui/assets/{run-BV4IO7_J.js → run-C9mlrs_A.js} +1 -1
  79. package/dist/ui/assets/{run-C4x_nui1.js → run-DbR82j2G.js} +2 -2
  80. package/dist/ui/assets/{run-C1jQodOF.js → run-YyW5Bd1z.js} +1 -1
  81. package/dist/ui/assets/{run-DYDjMUGP.js → run-kDywGyI_.js} +2 -2
  82. package/dist/ui/assets/{run-CRGyQPIr.js → run-oiQnjELg.js} +1 -1
  83. package/dist/ui/assets/{serve-command-Dxu0zqDl.js → serve-command-CYP3K9ID.js} +2 -2
  84. package/dist/ui/assets/{serve-runtime-CEmOBSkh.js → serve-runtime-CwPc5Ipg.js} +1 -1
  85. package/dist/ui/assets/{session-command-memory-CZZ78BU8.js → session-command-memory-Bjbktm7f.js} +2 -2
  86. package/dist/ui/assets/{session-jsonl-kHYH-7Ib.js → session-jsonl-DvM9G2Ke.js} +1 -1
  87. package/dist/ui/assets/{session-search-index-eJnlwzC6.js → session-search-index-DtkT95V1.js} +1 -1
  88. package/dist/ui/assets/{setup-feature-flags-remote-Ci3nvXGY.js → setup-feature-flags-remote-DVDOwgnm.js} +1 -1
  89. package/dist/ui/assets/{setup-model-catalog-DWI-pcXH.js → setup-model-catalog-D_3w06PR.js} +1 -1
  90. package/dist/ui/assets/{silent-renew-backoff-2lMvXpiU.js → silent-renew-backoff-CAjvUu0c.js} +1 -1
  91. package/dist/ui/assets/slicc-version-CJuEM6d6.js +1 -0
  92. package/dist/ui/assets/{soundscape-DK8vzDpK.js → soundscape-BBfqPI7l.js} +1 -1
  93. package/dist/ui/assets/{speak-D_AKrPu0.js → speak-BZjF8HVW.js} +1 -1
  94. package/dist/ui/assets/{sprinkle-manager-CJGReRLz.js → sprinkle-manager-CZEpPXOO.js} +1 -1
  95. package/dist/ui/assets/{sprinkle-renderer-CcWhSBfB.js → sprinkle-renderer-BkwlbHXw.js} +1 -1
  96. package/dist/ui/assets/{src-DWA1MizA.js → src-BQREyqyX.js} +63 -63
  97. package/dist/ui/assets/{ssh-CAQr291h.js → ssh-COAG0Prl.js} +1 -1
  98. package/dist/ui/assets/{sudo-CSzJTCd9.js → sudo-wabmuIKV.js} +1 -1
  99. package/dist/ui/assets/{supervisor-DBofbxjT.js → supervisor-B2nXofh7.js} +1 -1
  100. package/dist/ui/assets/{sync-dialog-FwBEmm7W.js → sync-dialog-CHmuJIFU.js} +1 -1
  101. package/dist/ui/assets/{transformers-env-DfuTpXXR.js → transformers-env-CHgjo8-d.js} +1 -1
  102. package/dist/ui/assets/tray-leader-DG6Rmdd2.js +1 -0
  103. package/dist/ui/assets/{tray-leave-runtime-BoVSKaCt.js → tray-leave-runtime-CHqFireQ.js} +1 -1
  104. package/dist/ui/assets/{tray-sidecar-CYuPitKs.js → tray-sidecar-DM4mHGds.js} +1 -1
  105. package/dist/ui/assets/{upgrade-detection-B8TZhKUa.js → upgrade-detection-XwHj-EZO.js} +1 -1
  106. package/dist/ui/assets/{upgrade-to-seven-B2H6KnlF.js → upgrade-to-seven-DnMOrCDQ.js} +1 -1
  107. package/dist/ui/assets/{voice-reply-BKaB8Asb.js → voice-reply-DJEUbUbb.js} +1 -1
  108. package/dist/ui/assets/{wc-attach-CoR9zN1R.js → wc-attach-Blm4ssVC.js} +2 -2
  109. package/dist/ui/assets/{wc-browser-D2k3tkR-.js → wc-browser-DzD5njrA.js} +1 -1
  110. package/dist/ui/assets/{wc-computers-CPX2x6Th.js → wc-computers-BDapcAz_.js} +1 -1
  111. package/dist/ui/assets/{wc-detached-BHiC5h-Y.js → wc-detached-6AHVMP_P.js} +1 -1
  112. package/dist/ui/assets/{wc-extension-DnJc8F1P.js → wc-extension-Hao4ySoS.js} +2 -2
  113. package/dist/ui/assets/{wc-follower-CpqjednQ.js → wc-follower-CwMgvm3U.js} +3 -3
  114. package/dist/ui/assets/{wc-follower-oauth-CjMFLgHd.js → wc-follower-oauth-DDwNrB05.js} +1 -1
  115. package/dist/ui/assets/{wc-gelatiere-B1UhGGlW.js → wc-gelatiere-BAPOL7Z1.js} +1 -1
  116. package/dist/ui/assets/{wc-live-MMV5wx1F.js → wc-live-Cw6xVOGo.js} +5 -5
  117. package/dist/ui/assets/{wc-nav-BLmah4u4.js → wc-nav-CMY9ERM1.js} +2 -2
  118. package/dist/ui/assets/{wc-onboarding-BLjMaifw.js → wc-onboarding-bNg06Z62.js} +2 -2
  119. package/dist/ui/assets/{wc-permissions-BH_pyjzt.js → wc-permissions-D0w94vXH.js} +2 -2
  120. package/dist/ui/assets/{wc-placeholder-B5m9keHf.js → wc-placeholder-Ch7fQFM1.js} +2 -2
  121. package/dist/ui/assets/{wc-profile-export-CUSnMx4l.js → wc-profile-export-BFF90Vk2.js} +3 -3
  122. package/dist/ui/assets/{wc-secret-request-COrsGNVO.js → wc-secret-request-pXJeMHeS.js} +1 -1
  123. package/dist/ui/assets/{wc-settings-DbOCHvQA.js → wc-settings-KGpHvHOO.js} +3 -3
  124. package/dist/ui/assets/{wc-shell-Xrw2Q_l-.js → wc-shell-B5uhQoSH.js} +3 -3
  125. package/dist/ui/assets/{wc-shortcut-config-BQBPwMA2.js → wc-shortcut-config-DCatL4tb.js} +1 -1
  126. package/dist/ui/assets/{wc-sprinkles-D752QtPV.js → wc-sprinkles-BQyYYsOa.js} +2 -2
  127. package/dist/ui/assets/{wc-transcript-export-DvAF0rPF.js → wc-transcript-export-DyqvXeuU.js} +2 -2
  128. package/dist/ui/assets/wc-tray-CjYFNQr2.js +5 -0
  129. package/dist/ui/assets/welcome-detection-t1oPE25e.js +1 -0
  130. package/dist/ui/assets/{whisper-session-CExf0vBt.js → whisper-session-6A5TUCSd.js} +2 -2
  131. package/dist/ui/assets/{xai-grok-iOYIBxH8.js → xai-grok-5TMXFoso.js} +1 -1
  132. package/dist/ui/assets/{xai-grok-Cfob0nrx.js → xai-grok-CFvK8Gfg.js} +1 -1
  133. package/dist/ui/index.html +3 -3
  134. package/dist/ui/packages/webapp/index.html +3 -3
  135. package/dist/ui/packages/webapp/upgrade-to-seven.html +1 -1
  136. package/dist/ui/upgrade-to-seven.html +1 -1
  137. package/package.json +1 -1
  138. package/dist/ui/assets/provider-store-access-CgaKC7rB.js +0 -1
  139. package/dist/ui/assets/provider-store-access-DgrYdKML.js +0 -1
  140. package/dist/ui/assets/slicc-version-ComMn6Xo.js +0 -1
  141. package/dist/ui/assets/tray-leader-1ntSUEXa.js +0 -1
  142. package/dist/ui/assets/wc-tray-QWpxQYLb.js +0 -5
  143. package/dist/ui/assets/welcome-detection-Ny04c6Rd.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./logger-Cx6Y120U.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{d as l,f as u,i as d,u as f,w as p}from"./account-store-QxWo48Y1.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-1DfC_94U.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-CkJyrXy3.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-BqARfI1v.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-CoR3q8DD.js";import{t as De}from"./providers-Bw0birsa.js";import{r as Oe}from"./binary-cache-HVfvmwmL.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-CuWVDYYO.js";import{t as Fe}from"./utf16-clip-Dcxt-q1C.js";import{n as Ie,t as Le}from"./mime-types-D7IV6i7k.js";import"./core-TaEErdII.js";import{n as Re,t as ze}from"./float-topology-87nCRxRw.js";import{t as Be}from"./secrets-bridge-client-DlJPW3h4.js";import{a as Ve,i as He,n as Ue,r as We}from"./tool-ui-blvQ8qgI.js";import{a as Ge,i as Ke,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as qe,r as Je,t as Ye}from"./merge-file-core-YFxa1Gy8.js";import{n as Xe,t as Ze}from"./types-D8gIX-W-.js";import{i as Qe}from"./mount-index-LvDi_MEB.js";import{a as $e,i as et,n as tt,o as nt,s as rt,t as it}from"./signed-fetch-B4_syuGv.js";import{o as at}from"./mount-table-store-xM3U8UHg.js";import{t as ot}from"./remote-cache-MMXYpOmA.js";import{n as st}from"./fs-DNsJRW_E.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-ComMn6Xo.js";import{a as dt,i as C,n as ft,r as pt,t as mt}from"./browser-4sjVvKih.js";import{t as w}from"./subcommand-flags-RpCj0auy.js";import{n as ht,r as gt,t as T}from"./subcommand-help-CgO7wRS5.js";import{n as _t}from"./cost-command-CG3mKA1r.js";import{d as vt,g as yt,i as bt,n as xt,o as St}from"./sudoers-2C-BpgXh.js";import{t as Ct}from"./sudo-refusal-DVwTXFRE.js";import{n as wt}from"./types-Dj5TU-Qg.js";import{a as Tt,c as Et,i as Dt,l as Ot,n as kt,o as At,r as jt,t as Mt}from"./types-JfhqX7lD.js";import{n as E,t as Nt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Pt}from"./html-B_Hg2WOy.js";import{n as Ft}from"./llm-session-id-BkEQhxBR.js";import{t as It}from"./src-SFACrjnb.js";import{i as Lt,o as Rt}from"./browser-DKcnER7J.js";import{a as zt,c as Bt,i as Vt,n as Ht,o as Ut,s as Wt,t as Gt}from"./pipe-status-BBrT3VeG.js";import{i as Kt,r as qt,t as Jt}from"./mount-picker-popup-DdbRdPNA.js";import{t as Yt}from"./buffer-C6ncbtB_.js";import"./buffer-polyfill-CaN2liDv.js";import{A as Xt,B as D,C as Zt,D as O,E as Qt,F as $t,G as en,H as k,I as A,J as tn,K as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,Y as hn,_ as gn,a as _n,b as vn,c as yn,d as bn,f as xn,g as Sn,h as Cn,i as wn,j as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as j,q as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn,z as Bn}from"./isomorphic-git-Cmlj4OJW.js";import"./global-db-Bfy_NRtT.js";import{C as Vn,S as M,a as Hn,b as Un,c as Wn,d as Gn,f as Kn,g as qn,i as Jn,l as Yn,m as Xn,n as Zn,o as Qn,p as $n,r as er,s as tr,t as nr,u as rr,x as ir,y as N}from"./state-BEkTZ8Wn.js";import{a as ar,i as or,r as sr,t as cr}from"./git-config-CnzJWs4a.js";import{a as lr,i as ur,o as P,t as dr}from"./just-bash-compat-DWUHpp9U.js";import{h as fr,i as pr,r as mr}from"./stdio-tty-DhcdDEsf.js";import{i as hr,r as gr,t as _r}from"./home-dir-DAXEFyny.js";import{i as vr,r as yr}from"./global-prefix-DqCuANmV.js";import{t as br}from"./wasm-programs-BUEs4fiZ.js";import{a as xr,c as Sr,n as Cr,r as wr,s as Tr}from"./jsh-discovery-D7D5iKYT.js";import{C as Er,a as Dr,b as Or,c as kr,d as Ar,f as jr,h as Mr,i as Nr,l as Pr,m as Fr,n as Ir,o as Lr,p as Rr,r as zr,s as Br,t as F,u as Vr,v as Hr,y as Ur}from"./shared-DPVU7o5t.js";import{_ as Wr,a as Gr,b as Kr,d as qr,f as Jr,g as Yr,h as Xr,i as Zr,l as Qr,m as $r,p as ei,r as ti,s as ni,u as ri,v as ii,y as ai}from"./require-guards-CnSYqjDO.js";import{S as oi,_ as si,b as ci,c as li,d as ui,f as di,g as fi,h as pi,l as mi,m as hi,n as gi,o as _i,p as vi,t as yi,u as bi,v as xi,x as Si,y as Ci}from"./jsh-executor-BFwK2t97.js";import{n as wi,t as Ti}from"./esbuild-wasm-D-czepwO.js";import{n as Ei}from"./wasm-compiler-Ct7QZURL.js";import{a as Di,o as Oi,s as ki,t as Ai}from"./usb-device-registry-DEKs171n.js";import{i as ji,r as Mi,t as Ni}from"./script-catalog-DDeMaTU_.js";import{a as Pi,c as Fi,o as Ii,s as Li,t as Ri}from"./types-BR5TkXSs.js";import{a as zi,c as Bi,d as Vi,f as Hi,n as Ui,r as Wi,u as Gi}from"./github-zip-BSEJCt49.js";import{i as Ki,t as qi}from"./github-auth-CkLbjC-d.js";import{a as Ji,i as Yi,o as Xi,r as Zi,t as Qi}from"./provenance-C7BfNno_.js";import{a as $i,c as ea,i as ta,n as na,o as ra,r as ia,s as aa}from"./github-install-VgcR2-6K.js";import{n as oa,t as sa}from"./magick-wasm-BItevhnv.js";import{i as ca,n as la,r as ua,t as da}from"./pdf-raster-D30vfUF_.js";import{n as fa}from"./lick-target-env-8JxfVcIV.js";import{t as pa}from"./tmpdir-env-ate4iNcK.js";import{n as ma,t as ha}from"./keyboard-TcuVIW9F.js";import{n as ga,t as _a}from"./hf-defaults-BwJdGLgk.js";import{t as va}from"./ffmpeg-wasm-xaOnfsRx.js";import{t as ya}from"./local-llm-NE-qI2cb.js";import{i as ba,n as xa,r as Sa,t as Ca}from"./tar-BjnO16Uf.js";import{a as wa,c as Ta,i as Ea,o as Da,r as Oa,s as ka}from"./v86-vm-BlgIo0B_.js";import{n as Aa,r as ja}from"./lick-urls-CgPiVwD-.js";let Ma=null;function Na(e){Ma=e!==null&&Number.isFinite(e)&&e>0?e:null}function Pa(){if(Ma!==null)return Ma;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Fa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ia(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Fa.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 La(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 Ra(e,t){return e.some(e=>La(e,t))}const za=`slicc-transcript`,Ba=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Va=/* @__PURE__ */ new Set(/* @__PURE__ */ `/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 Ha(e){return Va.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Ua=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Wa=new Set(Ba),Ga=/^[0-9a-fA-F]{64}$/,Ka=/^\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 qa(e){return typeof e==`string`&&Ga.test(e)}function Ja(e){return Ka.test(e)&&Number.isFinite(Date.parse(e))}function Ya(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 Xa(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ya(n,t)}:{ok:!0}}function Za(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 Qa(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 $a(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Xa(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Qa(e,t):n}function eo(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 to(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 no(e,t){let n=eo(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?to(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function ro(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`?Ja(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 io(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 ao(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?no(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function oo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Xa(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=io(e,t);if(!n.ok)return n}let r=ro(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=Za(i,$a,`${t}.content`);return a.ok?ao(e,t):a}function so(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=Xa(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Za(r,oo,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function co(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 lo(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`}:qa(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 uo=[`attachment-file-missing`,`attachment-association-unavailable`];function fo(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Xa(e.missingReason,uo,`${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 po(e,t){return e.present?lo(e,t):fo(e,t)}function mo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=co(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=Xa(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?po(e,t):r}function ho(e,t){let n=Xa(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 go(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=Xa(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?ho(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function _o(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 vo(e,t){return typeof e!=`string`||!Wa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function yo(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 bo(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Xa(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Za(e.missing,vo,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function xo(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=Xa(e.state,[`active`,`frozen`],`session.state`);return t.ok?bo(e.completeness):t}function So(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)?Za(n,go,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function Co(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Za(t,so,`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=Za(r,_o,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Za(a,mo,`attachments`):{ok:!1,error:`attachments must be an array`}}function wo(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ 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 To(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 Eo(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 Do(e){let t=/* @__PURE__ */ new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of Eo(e))t.add(n)}return t}function Oo(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 ko(e){return Oo(e,Do(e))}function Ao(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 jo(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=Ao(e,t);if(!r.ok)return r}}return{ok:!0}}function Mo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return jo(e,n)}function No(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=/* @__PURE__ */ 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 Po(e,t){let n=No(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 Fo(e){let t=/* @__PURE__ */ 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(Eo(e)))}return t}function Io(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 Lo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Io(e,n,Fo(t))}function Ro(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 zo(e,t){let n=/* @__PURE__ */ 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=Ro(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Bo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=wo(t);if(!o.ok)return o;let s=To(t);if(!s.ok)return s;let c=ko(t);if(!c.ok)return c;let l=Mo(t,n);if(!l.ok)return l;let u=Po(n,t);if(!u.ok)return u;let d=Lo(r,t);return d.ok?zo(a,n):d}function Vo(e){let t=Co(e);return t.ok?Bo(e):t}function Ho(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=yo(e.export);if(!t.ok)return t;let n=xo(e.session);if(!n.ok)return n;let r=So(e.privacy);return r.ok?Vo(e):r}async function Uo(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:nt});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:Wo(a),sourceUrl:a}}function Wo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Go=`slicc-sprinkle-routes`;function Ko(){try{let e=localStorage.getItem(Go);return e?JSON.parse(e):{}}catch{return{}}}function qo(e){try{localStorage.setItem(Go,JSON.stringify(e))}catch{}}function Jo(e){return Ko()[e]}function Yo(e,t){let n=Ko();n[e]=t,qo(n)}function Xo(e){let t=Ko();delete t[e],qo(t)}function Zo(){return Ko()}function Qo(e,t,n){return Et(t,n,`${e} adapter does not implement ${t}.${n}`)}function $o(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(Qo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function es(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:$o(t,`browser`,kt,e.browser),network:$o(t,`network`,Tt,e.network),secrets:$o(t,`secrets`,At,e.secrets),devices:$o(t,`devices`,jt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:$o(t,`mounts`,Dt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:$o(t,`approvals`,Mt,e.approvals)}}function ts(e={}){return es({adapter:`connect`,pageGestures:e.pageGestures})}function ns(e){let t=Nt(()=>import(`./extension-ops-BWWe8FOb.js`).then(t=>t.createExtensionOps(e)));return es({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 rs(e={}){let t=Nt(()=>import(`./rest-ops-DdaQHTK4.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return es({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 is(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return rs({pageGestures:n});case`extension-direct`:case`extension-delegate`:return ns({adapter:e,pageGestures:n});case`connect`:return ts({pageGestures:n})}}const as=e(`quick-llm`);async function os(e){let t=d();if(!t)return as.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?us(n,e.modelId)??us(n,r):ss(n,r),!i)return as.debug(`No model available for provider`,{providerId:n}),null;let a=Fe(e.prompt),o=e.system===void 0?void 0:Fe(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=ds());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 as.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function ss(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=ls(r.id),a=n.filter(e=>cs(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function cs(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 ls(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 us(e,t){return f(e).find(e=>e.id===t)}function ds(){return Ft(`ui-quick-llm`)}const fs=e(`sudo-suggest`),ps=[`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-Cx6Y120U.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{d as l,f as u,i as d,u as f,w as p}from"./account-store-CYXcTNmf.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-1DfC_94U.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-CkJyrXy3.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-BqARfI1v.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-CoR3q8DD.js";import{t as De}from"./providers-DinkpGvr.js";import{r as Oe}from"./binary-cache-HVfvmwmL.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-CuWVDYYO.js";import{t as Fe}from"./utf16-clip-Dcxt-q1C.js";import{n as Ie,t as Le}from"./mime-types-D7IV6i7k.js";import"./core-TaEErdII.js";import{n as Re,t as ze}from"./float-topology-87nCRxRw.js";import{t as Be}from"./secrets-bridge-client-DlJPW3h4.js";import{a as Ve,i as He,n as Ue,r as We}from"./tool-ui-blvQ8qgI.js";import{a as Ge,i as Ke,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as qe,r as Je,t as Ye}from"./merge-file-core-YFxa1Gy8.js";import{n as Xe,t as Ze}from"./types-D8gIX-W-.js";import{i as Qe}from"./mount-index-LvDi_MEB.js";import{a as $e,i as et,n as tt,o as nt,s as rt,t as it}from"./signed-fetch-B4_syuGv.js";import{o as at}from"./mount-table-store-xM3U8UHg.js";import{t as ot}from"./remote-cache-MMXYpOmA.js";import{n as st}from"./fs-DNsJRW_E.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-CJuEM6d6.js";import{a as dt,i as C,n as ft,r as pt,t as mt}from"./browser-4sjVvKih.js";import{t as w}from"./subcommand-flags-RpCj0auy.js";import{n as ht,r as gt,t as T}from"./subcommand-help-CgO7wRS5.js";import{n as _t}from"./cost-command-CG3mKA1r.js";import{d as vt,g as yt,i as bt,n as xt,o as St}from"./sudoers-2C-BpgXh.js";import{t as Ct}from"./sudo-refusal-DVwTXFRE.js";import{n as wt}from"./types-Dj5TU-Qg.js";import{a as Tt,c as Et,i as Dt,l as Ot,n as kt,o as At,r as jt,t as Mt}from"./types-JfhqX7lD.js";import{n as E,t as Nt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Pt}from"./html-B_Hg2WOy.js";import{n as Ft}from"./llm-session-id-BkEQhxBR.js";import{t as It}from"./src-SFACrjnb.js";import{i as Lt,o as Rt}from"./browser-DKcnER7J.js";import{a as zt,c as Bt,i as Vt,n as Ht,o as Ut,s as Wt,t as Gt}from"./pipe-status-BBrT3VeG.js";import{i as Kt,r as qt,t as Jt}from"./mount-picker-popup-DdbRdPNA.js";import{t as Yt}from"./buffer-C6ncbtB_.js";import"./buffer-polyfill-CaN2liDv.js";import{A as Xt,B as D,C as Zt,D as O,E as Qt,F as $t,G as en,H as k,I as A,J as tn,K as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,Y as hn,_ as gn,a as _n,b as vn,c as yn,d as bn,f as xn,g as Sn,h as Cn,i as wn,j as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as j,q as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn,z as Bn}from"./isomorphic-git-Cmlj4OJW.js";import"./global-db-Bfy_NRtT.js";import{C as Vn,S as M,a as Hn,b as Un,c as Wn,d as Gn,f as Kn,g as qn,i as Jn,l as Yn,m as Xn,n as Zn,o as Qn,p as $n,r as er,s as tr,t as nr,u as rr,x as ir,y as N}from"./state-BEkTZ8Wn.js";import{a as ar,i as or,r as sr,t as cr}from"./git-config-CnzJWs4a.js";import{a as lr,i as ur,o as P,t as dr}from"./just-bash-compat-DWUHpp9U.js";import{h as fr,i as pr,r as mr}from"./stdio-tty-DhcdDEsf.js";import{i as hr,r as gr,t as _r}from"./home-dir-DAXEFyny.js";import{i as vr,r as yr}from"./global-prefix-DqCuANmV.js";import{t as br}from"./wasm-programs-BUEs4fiZ.js";import{a as xr,c as Sr,n as Cr,r as wr,s as Tr}from"./jsh-discovery-D7D5iKYT.js";import{C as Er,a as Dr,b as Or,c as kr,d as Ar,f as jr,h as Mr,i as Nr,l as Pr,m as Fr,n as Ir,o as Lr,p as Rr,r as zr,s as Br,t as F,u as Vr,v as Hr,y as Ur}from"./shared-DPVU7o5t.js";import{_ as Wr,a as Gr,b as Kr,d as qr,f as Jr,g as Yr,h as Xr,i as Zr,l as Qr,m as $r,p as ei,r as ti,s as ni,u as ri,v as ii,y as ai}from"./require-guards-CnSYqjDO.js";import{S as oi,_ as si,b as ci,c as li,d as ui,f as di,g as fi,h as pi,l as mi,m as hi,n as gi,o as _i,p as vi,t as yi,u as bi,v as xi,x as Si,y as Ci}from"./jsh-executor-B54XDkz2.js";import{n as wi,t as Ti}from"./esbuild-wasm-D-czepwO.js";import{n as Ei}from"./wasm-compiler-Ct7QZURL.js";import{a as Di,o as Oi,s as ki,t as Ai}from"./usb-device-registry-DEKs171n.js";import{i as ji,r as Mi,t as Ni}from"./script-catalog-DDeMaTU_.js";import{a as Pi,c as Fi,o as Ii,s as Li,t as Ri}from"./types-BR5TkXSs.js";import{a as zi,c as Bi,d as Vi,f as Hi,n as Ui,r as Wi,u as Gi}from"./github-zip-BSEJCt49.js";import{i as Ki,t as qi}from"./github-auth-CkLbjC-d.js";import{a as Ji,i as Yi,o as Xi,r as Zi,t as Qi}from"./provenance-C7BfNno_.js";import{a as $i,c as ea,i as ta,n as na,o as ra,r as ia,s as aa}from"./github-install-VgcR2-6K.js";import{n as oa,t as sa}from"./magick-wasm-BItevhnv.js";import{i as ca,n as la,r as ua,t as da}from"./pdf-raster-D30vfUF_.js";import{n as fa}from"./lick-target-env-8JxfVcIV.js";import{t as pa}from"./tmpdir-env-ate4iNcK.js";import{n as ma,t as ha}from"./keyboard-TcuVIW9F.js";import{n as ga,t as _a}from"./hf-defaults-BwJdGLgk.js";import{t as va}from"./ffmpeg-wasm-xaOnfsRx.js";import{t as ya}from"./local-llm-BdhJYy6M.js";import{i as ba,n as xa,r as Sa,t as Ca}from"./tar-BjnO16Uf.js";import{a as wa,c as Ta,i as Ea,o as Da,r as Oa,s as ka}from"./v86-vm-BlgIo0B_.js";import{n as Aa,r as ja}from"./lick-urls-CgPiVwD-.js";let Ma=null;function Na(e){Ma=e!==null&&Number.isFinite(e)&&e>0?e:null}function Pa(){if(Ma!==null)return Ma;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Fa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ia(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Fa.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 La(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 Ra(e,t){return e.some(e=>La(e,t))}const za=`slicc-transcript`,Ba=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Va=/* @__PURE__ */ new Set(/* @__PURE__ */ `/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 Ha(e){return Va.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Ua=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Wa=new Set(Ba),Ga=/^[0-9a-fA-F]{64}$/,Ka=/^\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 qa(e){return typeof e==`string`&&Ga.test(e)}function Ja(e){return Ka.test(e)&&Number.isFinite(Date.parse(e))}function Ya(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 Xa(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ya(n,t)}:{ok:!0}}function Za(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 Qa(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 $a(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Xa(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Qa(e,t):n}function eo(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 to(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 no(e,t){let n=eo(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?to(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function ro(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`?Ja(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 io(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 ao(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?no(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function oo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Xa(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=io(e,t);if(!n.ok)return n}let r=ro(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=Za(i,$a,`${t}.content`);return a.ok?ao(e,t):a}function so(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=Xa(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Za(r,oo,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function co(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 lo(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`}:qa(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 uo=[`attachment-file-missing`,`attachment-association-unavailable`];function fo(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Xa(e.missingReason,uo,`${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 po(e,t){return e.present?lo(e,t):fo(e,t)}function mo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=co(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=Xa(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?po(e,t):r}function ho(e,t){let n=Xa(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 go(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=Xa(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?ho(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function _o(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 vo(e,t){return typeof e!=`string`||!Wa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function yo(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 bo(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Xa(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Za(e.missing,vo,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function xo(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=Xa(e.state,[`active`,`frozen`],`session.state`);return t.ok?bo(e.completeness):t}function So(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)?Za(n,go,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function Co(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Za(t,so,`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=Za(r,_o,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Za(a,mo,`attachments`):{ok:!1,error:`attachments must be an array`}}function wo(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ 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 To(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 Eo(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 Do(e){let t=/* @__PURE__ */ new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of Eo(e))t.add(n)}return t}function Oo(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 ko(e){return Oo(e,Do(e))}function Ao(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 jo(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=Ao(e,t);if(!r.ok)return r}}return{ok:!0}}function Mo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return jo(e,n)}function No(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=/* @__PURE__ */ 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 Po(e,t){let n=No(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 Fo(e){let t=/* @__PURE__ */ 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(Eo(e)))}return t}function Io(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 Lo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Io(e,n,Fo(t))}function Ro(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 zo(e,t){let n=/* @__PURE__ */ 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=Ro(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Bo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=wo(t);if(!o.ok)return o;let s=To(t);if(!s.ok)return s;let c=ko(t);if(!c.ok)return c;let l=Mo(t,n);if(!l.ok)return l;let u=Po(n,t);if(!u.ok)return u;let d=Lo(r,t);return d.ok?zo(a,n):d}function Vo(e){let t=Co(e);return t.ok?Bo(e):t}function Ho(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=yo(e.export);if(!t.ok)return t;let n=xo(e.session);if(!n.ok)return n;let r=So(e.privacy);return r.ok?Vo(e):r}async function Uo(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:nt});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:Wo(a),sourceUrl:a}}function Wo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Go=`slicc-sprinkle-routes`;function Ko(){try{let e=localStorage.getItem(Go);return e?JSON.parse(e):{}}catch{return{}}}function qo(e){try{localStorage.setItem(Go,JSON.stringify(e))}catch{}}function Jo(e){return Ko()[e]}function Yo(e,t){let n=Ko();n[e]=t,qo(n)}function Xo(e){let t=Ko();delete t[e],qo(t)}function Zo(){return Ko()}function Qo(e,t,n){return Et(t,n,`${e} adapter does not implement ${t}.${n}`)}function $o(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(Qo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function es(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:$o(t,`browser`,kt,e.browser),network:$o(t,`network`,Tt,e.network),secrets:$o(t,`secrets`,At,e.secrets),devices:$o(t,`devices`,jt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:$o(t,`mounts`,Dt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:$o(t,`approvals`,Mt,e.approvals)}}function ts(e={}){return es({adapter:`connect`,pageGestures:e.pageGestures})}function ns(e){let t=Nt(()=>import(`./extension-ops-BWWe8FOb.js`).then(t=>t.createExtensionOps(e)));return es({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 rs(e={}){let t=Nt(()=>import(`./rest-ops-DdaQHTK4.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return es({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 is(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return rs({pageGestures:n});case`extension-direct`:case`extension-delegate`:return ns({adapter:e,pageGestures:n});case`connect`:return ts({pageGestures:n})}}const as=e(`quick-llm`);async function os(e){let t=d();if(!t)return as.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?us(n,e.modelId)??us(n,r):ss(n,r),!i)return as.debug(`No model available for provider`,{providerId:n}),null;let a=Fe(e.prompt),o=e.system===void 0?void 0:Fe(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=ds());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 as.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function ss(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=ls(r.id),a=n.filter(e=>cs(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function cs(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 ls(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 us(e,t){return f(e).find(e=>e.id===t)}function ds(){return Ft(`ui-quick-llm`)}const fs=e(`sudo-suggest`),ps=[`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
  `),ms=[`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 hs(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`?ps:ms,i=null;try{i=await os({prompt:n,system:r,maxTokens:40,temperature:0,signal:t})}catch(e){fs.debug(`suggestPattern: quickLabel threw`,{error:e instanceof Error?e.message:String(e)}),i=null}return gs(i)||n}function gs(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 _s=e(`sudo:capability-gesture`);function vs(e,t={}){let n=t.suggest??hs;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 _s.warn(`sudo approval aborted before prompting — denying`,{detail:t.detail}),wt();if(!e)return _s.warn(`no CapabilityBroker injected for the sudo gesture hop — denying (composition bug, never a guessed transport)`,{detail:t.detail}),wt();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?Ot(o.value,a):(_s.warn(`capability broker approvals.request failed — denying`,{message:o.message}),wt())}}}const ys=e(`sudo:tray-first`);function bs(e,t={}){let n=t.suggest??hs,r=t.timeoutMs??6e5,i=t.getClient??(async()=>{let{getPanelRpcClient:e}=await import(`./panel-rpc-BJU93e51.js`).then(e=>e.r);return e()});return{async requestApproval(t,a){if(a?.signal?.aborted)return wt();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){ys.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 Ss(e?.decision,o)}catch(e){ys.warn(`tray-first sudo probe failed — using native broker`,{error:e instanceof Error?e.message:String(e)})}return e.requestApproval(s,a)}}}const xs=[`user-timeout`,`cone-timeout`,`unavailable`];function Ss(e,t){if(!e||typeof e!=`object`)return wt();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 wt();let i=xs.find(e=>e===n.reason);return i?{decision:`deny`,reason:i}:{decision:`deny`}}function Cs(e,t){return{requestApproval(n){return t.enqueueSudoRequest(e,n)}}}function ws(){return`lick-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var Ts=class{pending=/* @__PURE__ */ new Map;timeoutMs;newId;setTimer;clearTimer;onAutoSettle;constructor(e={}){this.timeoutMs=e.timeoutMs??3e5,this.newId=e.newId??ws,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 Es(e){return re(Ds(e))}function Ds(e){let t=vs(e);return e?.adapter===`extension-direct`||e?.adapter===`extension-delegate`?t:bs(t)}let Os=null;function ks(e){return Os=e,()=>{Os===e&&(Os=null)}}function As(){if(!Os)throw new Ua(`session-not-found`);return Os}const js=`focus`,Ms={type:`leaf`,surfaceId:`chat`};function Ns(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 Ps={focus:{name:`focus`,tree:Ns({left:Ms},{left:3,middle:1})}};function Fs(e){return Ps[e]??null}const Is=`progress`;async function Ls(){try{let e=await qt();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 Jt(e.idbKey);if(!t)throw Error(`mount: no directory handle found in storage`);return await Kt(t),t}throw Error(`mount: unexpected popup result`)}catch(e){throw Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}async function Rs(){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 zs(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 Jt(r.idbKey);if(!i)throw Error(`no directory handle found in storage`);return await Kt(i),i}function Bs(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 Vs(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 Hs=/* @__PURE__ */ new Set([`--source`,`--profile`,`--backend`,`--max-body-mb`]);function Us(e){for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`)return!1;if(n===`--help`||n===`-h`)return!0;Hs.has(n)&&t++}return!1}function Ws(e){return`aem://${e.org}/${e.name}${e.path?`/${e.path}`:``}`}var Gs=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=Bs(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=Ve();if(!n){let n=await Ks(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 Ls():r?await zs(r,e):await Rs();let a=Qe.fromHandle(i,{mountId:at()});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=at(),i=new ot({mountId:r,ttlMs:3e4}),a=new et({source:t.source,profile:n,cache:i,maxBodyBytes:t.maxBodyMb?t.maxBodyMb*1024*1024:void 0,mountId:r,signedFetch:this.signedFetchS3??tt(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??it(),i=Vs(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 Uo(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=at(),c=new ot({mountId:s,ttlMs:3e4}),l={source:a===`aem`?Ws(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 rt(l):new $e(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(Us(e))return n===`umount`?this.umountHelp():this.help();let r=Bs(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-xM3U8UHg.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-MMXYpOmA.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
@@ -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-DadD3ayk.js`).then(e=>e.r);try{switch(r){case`list`:return Gh(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-DS575H__.js`).then(e=>e.r);try{switch(r){case`list`:return Gh(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:Uh(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 qh=[{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=>ta(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 Jh(e){let t={skills:[],dryRun:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n],i=qh.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 Yh(e,t){return!e||!t||e.byteLength!==t.byteLength?!1:e.every((e,n)=>e===t[n])}async function Xh(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 Zh(e,t,n,r){let i=await Xh(e,t);return Vi(n)?i?{status:`kept-local`,write:!1}:{status:`added`,write:!0}:i?Yh(i,r)?{status:`unchanged`,write:!1}:{status:`updated`,write:!0}:{status:`added`,write:!0}}async function Qh(e,t,n,r){let i={changes:[],writes:[],removals:[]};for(let[r,a]of n){let n=`${t}/${r}`,{status:o,write:s}=await Zh(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 Hi(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 $h(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 qi(t),d=await Yi(s,c,o.ref,u,!0,l||void 0);if(d&&r.sha===d&&await eg(e,n,r))return{...o,to:d,outcome:`current`,changes:[]};let f=await tg(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 Qh(e,`${Pi}/${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 og(e,{changes:h,writes:g,removals:_}),await Xi(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 eg(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 tg(e,t,n,r,i,a,o){let s=await Wi(e,t,a,i??`main`);if(s.status===`ok`){let i=zi(s.files),a=n||ng(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:ag(i,a),path:a}}try{return{files:ig(rg(await Ui(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 ng(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 rg(e){return new Map([...e].filter(([e])=>Bi(e)))}function ig(e){return new Map([...e].sort(([e],[t])=>e.localeCompare(t)))}function ag(e,t){let n=t?`${t}/`:``,r=/* @__PURE__ */ new Map;for(let[t,i]of Object.entries(e)){if(!t.startsWith(n)||t.endsWith(`/`))continue;let e=t.slice(n.length);Bi(e)&&r.set(e,i)}return ig(r)}async function og(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 sg(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 Rh(o,s,t);if(!c.ok)return{...a,outcome:`error`,error:c.error};let l=`${Pi}/${n}/SKILL.md`,u=await Xh(e,l),d=new TextEncoder().encode(c.content),f=u!==void 0&&Ih(new TextDecoder().decode(u))===Ih(c.content);if(Yh(u,d)||f)return{...a,changes:[{path:`SKILL.md`,status:`unchanged`}]};let p=u?`updated`:`added`;return i||(await e.mkdir(`${Pi}/${n}`,{recursive:!0}),await e.writeFile(l,d),await Xi(e,n,{...r,files:[`SKILL.md`]})),{...a,outcome:`updated`,changes:[{path:`SKILL.md`,status:p}]}}function cg(e,t){if(e.outcome===`error`)return` ${e.skill}: failed — ${e.error}\n`;let n=/* @__PURE__ */ 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 lg(e,t,n,r){let i=ta(t);return i?{version:1,kind:`github`,source:`${i.owner}/${i.repo}`,skill:e,ref:r??i.branch,path:n??i.path,installed:(/* @__PURE__ */ new Date()).toISOString()}:null}async function ug(e,t,n){if(t.length===0){let t=await Ji(e);return{targets:t.provenanced,missing:[],skipped:t.unattributed}}let r=[],i=[];for(let a of t){let t=await Zi(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?lg(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 dg(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 mg(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+=cg(n,t);if(i.length>0&&(a+=pg(i)),!n&&r&&e.length>0){let n=i.length>0?`all ${fg(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 hg(e,t,n){let{targets:r,missing:i,skipped:a}=await ug(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 sg(e,t,i.name,i.provenance,n.dryRun):await $h(e,t,i.name,i.provenance,n.branch,n.dryRun));return{results:o,skipped:a,missing:i}}async function gg(e,t,n){let r=Jh(e);if(r.error)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{results:i,missing:a,skipped:o}=await hg(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`:mg([],r.dryRun,!1,!0,o),stderr:``,exitCode:0}:{stdout:``,stderr:a.length?a.map(dg).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 ea();let l=a.map(dg).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:mg(i,r.dryRun,c,u,o),stderr:l,exitCode:+!u}}function _g(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 vg(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 yg(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}${vg(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 bg(e,t,n){let r=await(await import(`./kernel-worker-DadD3ayk.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await wr(e,xr(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${Bh()}`,stderr:``,exitCode:0}:{...Sr(`upskill`,Hh(r,`Discoverable local skills`),i,{builtinNames:new Set(mt())}),exitCode:0}}async function xg(e,t,n){let{results:r,skipped:i}=await hg(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:yg(r,i),stderr:c,exitCode:+!s}}async function Sg(e,t,n,r){let i=_g(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?xg(t,n,i.json):bg(t,i.json,r)}async function Cg(e,t){let n=`${Fi}/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(Ki(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ke(r.body);if(!i.data)return[];let a=/* @__PURE__ */ new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=$i(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 wg(e,t){let n=`${Fi}/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: ${Ki(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=$i(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 Tg=[{label:`Tessl`,host:new URL(Fi).host,fetch:Cg},{label:`browse.sh`,host:new URL(Ri).host,fetch:Ah}];function Eg(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 Dg(e,t,n=1){let r=await Promise.allSettled(Tg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Eg(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Tg[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 bg(e,t,n){let r=await(await import(`./kernel-worker-DS575H__.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await wr(e,xr(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${Bh()}`,stderr:``,exitCode:0}:{...Sr(`upskill`,Hh(r,`Discoverable local skills`),i,{builtinNames:new Set(mt())}),exitCode:0}}async function xg(e,t,n){let{results:r,skipped:i}=await hg(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:yg(r,i),stderr:c,exitCode:+!s}}async function Sg(e,t,n,r){let i=_g(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?xg(t,n,i.json):bg(t,i.json,r)}async function Cg(e,t){let n=`${Fi}/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(Ki(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ke(r.body);if(!i.data)return[];let a=/* @__PURE__ */ new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=$i(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 wg(e,t){let n=`${Fi}/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: ${Ki(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=$i(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 Tg=[{label:`Tessl`,host:new URL(Fi).host,fetch:Cg},{label:`browse.sh`,host:new URL(Ri).host,fetch:Ah}];function Eg(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 Dg(e,t,n=1){let r=await Promise.allSettled(Tg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Eg(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Tg[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 Pg(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 Fg(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=Pg(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 Ig(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-DadD3ayk.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 Zi(n,t),a=i?Qi(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Uh(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=Pg(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 Ig(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-DS575H__.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 Zi(n,t),a=i?Qi(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Uh(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 Lg(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 ra(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 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 na(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 zg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0;for(let d of e){let e=await na(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 Bg(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 Vg(e,t,n,r){let{owner:i,repo:a}=e,o=t.branch??e.branch,s=t.subPath??e.path,c=await qi(r),l=await ia(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:Bg(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:Bg(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 Wi(i,a,r,o);if(e.status===`ok`){let r=await Yi(i,a,o,c,!0,s),l=await Lg(u,i,a,zi(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 Rg(u,i,a,c,n,t.force,o,f);({output:p,errors:m,successCount:h}=e)}}else({output:p,errors:m,successCount:h}=await zg(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 ea()),{stdout:p,stderr:m,exitCode:+!!m}}async function Hg(e,t,n,r,i){switch(e[0]){case`tabs`:return Mg(t,n,r,e.includes(`--json`));case`recommendations`:return Ng(t,n,e.includes(`--install`));case`update`:case`upgrade`:return gg(e.slice(1),t,n);case`list`:return Sg(e.slice(1),t,n,i);case`info`:case`read`:return Ig(e[0],e[1],t);case`search`:return Wg(e,n);default:return null}}function Ug(e,t,n){return C(`upskill`,async(r,i)=>{if(r.length===0||r.includes(`--help`)||r.includes(`-h`))return Wh();let a=await Hg(r,e,t,n,i.env.get(`PATH`));if(a)return a;let o=Fg(r);if(o.earlyReturn)return o.earlyReturn;if(!o.sourceRef)return Wh();if(o.sourceRef.startsWith(`tessl:`))return Gg(o.sourceRef,o.force,e,t);let s=Nh(o.sourceRef);if(s)return zh(s.hostname,s.task,e,t,o.force);let c=ta(o.sourceRef);return c?Vg(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 Wg(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?Dg(a,t,i):Wh()}async function Gg(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 wg(i,r);if(`error`in a)return{stdout:``,stderr:`upskill: ${a.error}\n`,exitCode:1};let o=await qi(r);return na(a.owner,a.repo,a.skillPath,a.skillName,n,o,t,r)}function Kg(){return{stdout:`usage: afplay [-v volume] [-r rate] <file>
328
328
 
@@ -545,7 +545,7 @@ Usage: cherry-emit <name> [--detail <json>] [--runtime <id>]
545
545
  -o Force paste mode (write to stdout)
546
546
  (default) Auto-detect: stdin present = copy, no stdin = paste
547
547
  Example: echo hello | ${e}\n Example: ${e} -o > file.txt\n`,stderr:``,exitCode:0}}async function kv(e,t){let n=!!globalThis.navigator?.clipboard,r=n?null:b();if(!n&&!r)return{stdout:``,stderr:`${t}: clipboard API is unavailable\n`,exitCode:1};try{return n?await navigator.clipboard.writeText(e):await r.call(`clipboard-write-text`,{text:e}),{stdout:``,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`${t}: failed to write to clipboard: ${Tv(e)}\n`,exitCode:1}}}async function Av(e){let t=!!globalThis.navigator?.clipboard,n=t?null:b();if(!t&&!n)return{stdout:``,stderr:`${e}: clipboard API is unavailable\n`,exitCode:1};try{return{stdout:t?await navigator.clipboard.readText():(await n.call(`clipboard-read-text`,void 0)).text,stderr:``,exitCode:0}}catch(t){return{stdout:``,stderr:`${e}: failed to read from clipboard: ${Tv(t)}\n`,exitCode:1}}}function jv(){return C(`pbcopy`,async(e,t)=>e.includes(`--help`)||e.includes(`-h`)?Ev():kv(P(t.stdin),`pbcopy`))}function Mv(){return C(`pbpaste`,async e=>e.includes(`--help`)||e.includes(`-h`)?Dv():Av(`pbpaste`))}function Nv(e){return C(e,async(t,n)=>{if(t.includes(`--help`)||t.includes(`-h`))return Ov(e);let r=t.includes(`-i`),i=t.includes(`-o`);if(r&&i)return{stdout:``,stderr:`${e}: cannot use both -i and -o\n`,exitCode:1};if(i)return Av(e);let a=P(n.stdin);return r||a.length>0?kv(a,e):Av(e)})}function Pv(){return C(`cmp`,async(e,t)=>{let n=e.some(e=>e===`-s`||e===`--quiet`||e===`--silent`),r=e.filter(e=>![`-s`,`--quiet`,`--silent`].includes(e));if(r.length!==2||r.some(e=>e.startsWith(`-`)&&e!==`-`))return{stdout:``,stderr:`cmp: usage: cmp [-s|--quiet|--silent] FILE1 FILE2
548
- `,exitCode:2};let i=await Fv(t,r[0]);if(`error`in i)return n?{...i.error,stderr:``}:i.error;let a=await Fv(t,r[1]);if(`error`in a)return n?{...a.error,stderr:``}:a.error;let o=Iv(i.bytes,a.bytes);return o?n?{stdout:``,stderr:``,exitCode:1}:o.eof?{stdout:``,stderr:`cmp: EOF on ${i.bytes.length<a.bytes.length?r[0]:r[1]} after byte ${o.byte-1}, line ${o.line}\n`,exitCode:1}:{stdout:`${r[0]} ${r[1]} differ: byte ${o.byte}, line ${o.line}\n`,stderr:``,exitCode:1}:{stdout:``,stderr:``,exitCode:0}})}async function Fv(e,t){if(t===`-`){let t=lr(e.stdin);return{bytes:Uint8Array.from(t,e=>e.charCodeAt(0)&255)}}try{return{bytes:await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}}catch{return{error:{stdout:``,stderr:`cmp: ${t}: No such file or directory\n`,exitCode:2}}}}function Iv(e,t){let n=Math.min(e.length,t.length),r=1;for(let i=0;i<n;i++){if(e[i]!==t[i])return{byte:i+1,line:r,eof:!1};e[i]===10&&r++}return e.length===t.length?null:{byte:n+1,line:r,eof:!0}}function Lv(e={}){return C(`computer`,async(t,n)=>{let{runComputer:r}=await import(`./run-Ds-D_Vog.js`).then(e=>e.t);return r(t,n,e)})}var Rv=`/assets/AdobeClean-Regular-CVsq5gF7.otf`;function zv(e){return{reader:{exists:t=>e.fs.exists(t),isDirectory:async t=>{try{return(await e.fs.stat(t)).isDirectory}catch{return!1}},readFile:t=>e.fs.readFile(t)},readBytes:t=>e.fs.readFileBuffer(t),fromDir:e.cwd}}function Bv(e){let t=e.toLowerCase();return t.endsWith(`.jpg`)||t.endsWith(`.jpeg`)?`JPEG`:t.endsWith(`.png`)?`PNG`:t.endsWith(`.gif`)?`GIF`:t.endsWith(`.webp`)?`WEBP`:t.endsWith(`.bmp`)?`BMP`:t.endsWith(`.tiff`)||t.endsWith(`.tif`)?`TIFF`:t.endsWith(`.avif`)?`AVIF`:`PNG`}const Vv=`AdobeClean-Regular.otf`,Hv=/* @__PURE__ */ new WeakSet;let Uv=null;function Wv(){return{stdout:`usage: convert [input ...] [operations...] [output]
548
+ `,exitCode:2};let i=await Fv(t,r[0]);if(`error`in i)return n?{...i.error,stderr:``}:i.error;let a=await Fv(t,r[1]);if(`error`in a)return n?{...a.error,stderr:``}:a.error;let o=Iv(i.bytes,a.bytes);return o?n?{stdout:``,stderr:``,exitCode:1}:o.eof?{stdout:``,stderr:`cmp: EOF on ${i.bytes.length<a.bytes.length?r[0]:r[1]} after byte ${o.byte-1}, line ${o.line}\n`,exitCode:1}:{stdout:`${r[0]} ${r[1]} differ: byte ${o.byte}, line ${o.line}\n`,stderr:``,exitCode:1}:{stdout:``,stderr:``,exitCode:0}})}async function Fv(e,t){if(t===`-`){let t=lr(e.stdin);return{bytes:Uint8Array.from(t,e=>e.charCodeAt(0)&255)}}try{return{bytes:await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}}catch{return{error:{stdout:``,stderr:`cmp: ${t}: No such file or directory\n`,exitCode:2}}}}function Iv(e,t){let n=Math.min(e.length,t.length),r=1;for(let i=0;i<n;i++){if(e[i]!==t[i])return{byte:i+1,line:r,eof:!1};e[i]===10&&r++}return e.length===t.length?null:{byte:n+1,line:r,eof:!0}}function Lv(e={}){return C(`computer`,async(t,n)=>{let{runComputer:r}=await import(`./run-B9uXGQYv.js`).then(e=>e.t);return r(t,n,e)})}var Rv=`/assets/AdobeClean-Regular-CVsq5gF7.otf`;function zv(e){return{reader:{exists:t=>e.fs.exists(t),isDirectory:async t=>{try{return(await e.fs.stat(t)).isDirectory}catch{return!1}},readFile:t=>e.fs.readFile(t)},readBytes:t=>e.fs.readFileBuffer(t),fromDir:e.cwd}}function Bv(e){let t=e.toLowerCase();return t.endsWith(`.jpg`)||t.endsWith(`.jpeg`)?`JPEG`:t.endsWith(`.png`)?`PNG`:t.endsWith(`.gif`)?`GIF`:t.endsWith(`.webp`)?`WEBP`:t.endsWith(`.bmp`)?`BMP`:t.endsWith(`.tiff`)||t.endsWith(`.tif`)?`TIFF`:t.endsWith(`.avif`)?`AVIF`:`PNG`}const Vv=`AdobeClean-Regular.otf`,Hv=/* @__PURE__ */ new WeakSet;let Uv=null;function Wv(){return{stdout:`usage: convert [input ...] [operations...] [output]
549
549
 
550
550
  Operations:
551
551
  -resize GEOMETRY resize; supports %, !, ^, >, and < modifiers
@@ -838,7 +838,7 @@ A profile over 2 GiB or 60,000 files is split into one zip per cone.
838
838
 
839
839
  --dry-run plan and print the report; no dialog, nothing saved
840
840
  -h, --help show this help
841
- `;async function FS(e){let t=NS();if(t)return t({dryRun:e});let n=b();if(!n)throw Error(`the export runs in the SLICC leader tab, and none is connected`);return n.call(`profile-export`,{dryRun:e},{timeoutMs:36e5})}function IS(){return C(`export-profile`,async e=>{if(T(e))return{stdout:PS,stderr:``,exitCode:0};let t=!1;for(let n of e)if(n===`--dry-run`||n===`-n`)t=!0;else return{stdout:``,stderr:`export-profile: unknown argument ${JSON.stringify(n)}\n${PS}`,exitCode:2};try{let{report:e}=await FS(t);return{stdout:e,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`export-profile: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}function LS(){return C(`ffmpeg`,async(e,t)=>{let{runFfmpeg:n}=await import(`./run-C1jQodOF.js`);return n(e,t)})}function RS(){return C(`ffprobe`,async(e,t)=>{let{runFfprobe:n}=await import(`./run-DYDjMUGP.js`);return n(e,t)})}function zS(e){let t=xe().find(t=>t.id===e);return t?t.id:null}function BS(){return xe().map(e=>e.id)}function VS(e){return Ce(e)}function HS(e,t){if(Se(e,t),Te()[e]!==t)throw Error(`flag ${e} cannot be overridden on this float`)}function US(e){let t=globalThis.localStorage;if(!t||typeof t.setItem!=`function`)throw Error(`this realm has no localStorage to apply the override`);t.setItem(Ee,e)}const WS=`usage: flags set <id> on|off
841
+ `;async function FS(e){let t=NS();if(t)return t({dryRun:e});let n=b();if(!n)throw Error(`the export runs in the SLICC leader tab, and none is connected`);return n.call(`profile-export`,{dryRun:e},{timeoutMs:36e5})}function IS(){return C(`export-profile`,async e=>{if(T(e))return{stdout:PS,stderr:``,exitCode:0};let t=!1;for(let n of e)if(n===`--dry-run`||n===`-n`)t=!0;else return{stdout:``,stderr:`export-profile: unknown argument ${JSON.stringify(n)}\n${PS}`,exitCode:2};try{let{report:e}=await FS(t);return{stdout:e,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`export-profile: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}function LS(){return C(`ffmpeg`,async(e,t)=>{let{runFfmpeg:n}=await import(`./run-YyW5Bd1z.js`);return n(e,t)})}function RS(){return C(`ffprobe`,async(e,t)=>{let{runFfprobe:n}=await import(`./run-kDywGyI_.js`);return n(e,t)})}function zS(e){let t=xe().find(t=>t.id===e);return t?t.id:null}function BS(){return xe().map(e=>e.id)}function VS(e){return Ce(e)}function HS(e,t){if(Se(e,t),Te()[e]!==t)throw Error(`flag ${e} cannot be overridden on this float`)}function US(e){let t=globalThis.localStorage;if(!t||typeof t.setItem!=`function`)throw Error(`this realm has no localStorage to apply the override`);t.setItem(Ee,e)}const WS=`usage: flags set <id> on|off
842
842
  flags get <id>
843
843
 
844
844
  set <id> on|off Persist a local override. The next new session reads it.
@@ -1378,7 +1378,7 @@ Options:
1378
1378
  --global Resolve only from the shared global prefix (/shared/lib/node_modules)
1379
1379
  -h, --help Show this help message
1380
1380
  `}async function ok(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function sk(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function ck(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*lk(e,t=!1){if(t){yield yr;return}let n=x(e);for(;yield S(n,`node_modules`),n!==`/`;)n=Ge(n).dir;yield yr}async function uk(e,t,n,r=!1){for(let i of lk(t,r)){let t=S(i,`.bin`,n);if(!await sk(e,t))continue;let r=await ok(e,t),a=ik.exec(r),o=Ge(t).dir;return{binFilePath:a?S(o,a[1]):t,argvName:t}}return null}function dk(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function fk(e,t){if(typeof e==`string`)return{binName:dk(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,dk(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 pk(e,t,n,r=!1){for(let i of lk(t,r)){let t=S(i,n),r=S(t,`package.json`);if(!await sk(e,r))continue;let a;try{a=JSON.parse(await ok(e,r))}catch{return null}let o=fk(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 mk(e,t,n,r=!1){return await uk(e,t,n,r)??await pk(e,t,n,r)}async function hk(e,t,n){for(let r of lk(t))if(await sk(e,S(r,n,`package.json`)))return!0;return!1}function gk(e){return e instanceof Error?e.message:String(e)}function _k(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function vk(e,t,n,r){try{let{installPackages:i}=await import(`./installer-CZYG64aH.js`),a=await i([t],{fs:r.fs,fetch:r.fetch,cwd:n.cwd});if(a.errors.length>0)return{error:_k(e,`failed to install '${t}': ${gk(a.errors[0].error)}`)};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version}`);return{progress:o.length>0?`${o.join(`
1381
- `)}\n`:``}}catch(n){return{error:_k(e,`failed to install '${t}': ${gk(n)}`)}}}async function yk(e,t,n,r){return await sk(r,n)?null:await ck(r,n)?_k(e,`bin target '${n}' is a directory, not a file`):_k(e,`bin file '${n}' for '${t}' does not exist`)}async function bk(e,t,n,r,i,a){if(await hk(a.fs,i.cwd,t))return{error:_k(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:tk(t);if(o)return{error:{stdout:``,stderr:rk(e,t,n,o),exitCode:1}};let s=await vk(e,t,i,a);if(`error`in s)return s;let c=await mk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:_k(e,`package '${t}' was installed but does not expose an executable bin`)}}function xk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:ak(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:ak(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await mk(t.fs,r.cwd,c,o)}catch(t){return _k(e,gk(t))}let d=``;if(!u){if(o)return _k(e,`no global bin '${c}' found in ${yr}`);let n=await bk(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await yk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Ci(await ok(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await yi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function Sk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-C4x_nui1.js`);return r(t,n,e)})}const Ck=/* @__PURE__ */ new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function wk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Ak();let n=e.processManager??Tk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
1381
+ `)}\n`:``}}catch(n){return{error:_k(e,`failed to install '${t}': ${gk(n)}`)}}}async function yk(e,t,n,r){return await sk(r,n)?null:await ck(r,n)?_k(e,`bin target '${n}' is a directory, not a file`):_k(e,`bin file '${n}' for '${t}' does not exist`)}async function bk(e,t,n,r,i,a){if(await hk(a.fs,i.cwd,t))return{error:_k(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:tk(t);if(o)return{error:{stdout:``,stderr:rk(e,t,n,o),exitCode:1}};let s=await vk(e,t,i,a);if(`error`in s)return s;let c=await mk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:_k(e,`package '${t}' was installed but does not expose an executable bin`)}}function xk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:ak(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:ak(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await mk(t.fs,r.cwd,c,o)}catch(t){return _k(e,gk(t))}let d=``;if(!u){if(o)return _k(e,`no global bin '${c}' found in ${yr}`);let n=await bk(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await yk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Ci(await ok(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await yi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function Sk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-DbR82j2G.js`);return r(t,n,e)})}const Ck=/* @__PURE__ */ new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function wk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Ak();let n=e.processManager??Tk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
1382
1382
  `,exitCode:1};let r=Ek(t);if(!r.ok)return{stdout:``,stderr:r.stderr,exitCode:r.exitCode};let{allDelivered:i,errors:a}=Dk(n,r.pids,r.signal);return{stdout:``,stderr:a.length?`${a.join(`
1383
1383
  `)}\n`:``,exitCode:+!i}})}function Tk(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function Ek(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
1384
1384
  `,exitCode:2};let i=Ok(n);if(i instanceof Error)return{ok:!1,stderr:`kill: ${i.message}\n`,exitCode:2};t=i;continue}if(i.startsWith(`-`)){let e=kk(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
@@ -1451,7 +1451,7 @@ Common base URLs:
1451
1451
  `)+`
1452
1452
  `,stderr:``,exitCode:0}}function rA(e,t){let n=t.models.length;return{stdout:[`✓ ${e} (${$k(t.runtime,!1)})`,` Saved ${n} model${n===1?``:`s`} to Settings:`,...eA(t.models)].join(`
1453
1453
  `)+`
1454
- `,stderr:``,exitCode:0}}function iA(){return C(Zk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Qk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-QxWo48Y1.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-NE-qI2cb.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(Zk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
1454
+ `,stderr:``,exitCode:0}}function iA(){return C(Zk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Qk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-CYXcTNmf.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-BdhJYy6M.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(Zk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
1455
1455
  `,exitCode:1};let c=await a(s,t(Zk)??void 0);if(!c.ok)return tA(s,c);if(o===`discover`){let e=n(Zk)??``;return i(Zk,e,s,c.models.join(`, `)),rA(s,c)}return nA(s,c)})}function aA(){return{stdout:`usage: man <topic>
1456
1456
 
1457
1457
  Fetches documentation for a given topic from sliccy.com.
@@ -1470,7 +1470,7 @@ Notes:
1470
1470
  Document-Isolation-Policy). Embedded floats cannot be isolated and
1471
1471
  report why instead.
1472
1472
  - The browser randomizes measurement timing — expect a short delay.
1473
- `,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??uA();if(!r&&!e.measure)return cA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return cA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return cA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:fA(a),stderr:``,exitCode:0}})}function mA(e){return C(`memory`,async t=>{let{runMemory:n}=await import(`./run-CRGyQPIr.js`);return n(t,e)})}function hA(){return C(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-BVa_5XaQ.js`);return n(e,t)})}const gA=`/.cache/artificial-analysis.json`,_A=[`--all`,`--all-versions`,`--json`,`--refresh`,`--no-benchmarks`,`--help`,`-h`],vA=[`--provider`];function yA(e){return{stdout:``,stderr:e.endsWith(`
1473
+ `,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??uA();if(!r&&!e.measure)return cA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return cA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return cA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:fA(a),stderr:``,exitCode:0}})}function mA(e){return C(`memory`,async t=>{let{runMemory:n}=await import(`./run-oiQnjELg.js`);return n(t,e)})}function hA(){return C(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-BVa_5XaQ.js`);return n(e,t)})}const gA=`/.cache/artificial-analysis.json`,_A=[`--all`,`--all-versions`,`--json`,`--refresh`,`--no-benchmarks`,`--help`,`-h`],vA=[`--provider`];function yA(e){return{stdout:``,stderr:e.endsWith(`
1474
1474
  `)?e:`${e}\n`,exitCode:1}}async function bA(e){try{let t=await e.readFile(gA),n=JSON.parse(t);if(Date.now()-n.fetchedAt<864e5)return n.models}catch{}return null}function xA(){try{return localStorage.getItem(`aa_api_key`)}catch{return null}}function SA(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 CA(e,t){let n={fetchedAt:Date.now(),models:t};try{await e.mkdir(`/.cache`,{recursive:!0}),await e.writeFile(gA,JSON.stringify(n))}catch{}}async function wA(e,t=!1){if(e&&!t){let t=await bA(e);if(t)return t}let n={Accept:`application/json`},r=xA();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=SA(Array.isArray(s)?s:s.data??s.models??[]);return e&&c.length>0&&await CA(e,c),c}function TA(e){return e.toLowerCase().replace(/\./g,`-`).replace(/-\d{8}$/,``).replace(/-\d{4}$/,``)}function EA(e,t){let n=e.toLowerCase(),r=t.find(e=>e.slug===n);if(r)return r;let i=TA(e),a=t.find(e=>TA(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 DA(){return`models - list available LLM models
1475
1475
 
1476
1476
  Usage: models [options]
@@ -1485,7 +1485,7 @@ Options:
1485
1485
  -h, --help Show this help message
1486
1486
  `}function OA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`.replace(`.0M`,`M`):e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function kA(e){return`$${e.toFixed(2)}`}const AA=/\b(embedding|embed|tts|whisper|dall-e|image-gen|audio|vision-preview)\b/i;function jA(e){let t=`${e.id} ${e.name??``}`;return!AA.test(t)}function MA(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 NA(e){let t=e.toLowerCase();return t=t.replace(/-\d{8}$/,``),t=t.replace(/-\d{4}$/,``),t=t.replace(/-(preview|latest)$/,``),MA(t)??t.replace(/-[\d.]+$/,``)}function PA(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=NA(n.id);(!t.has(e)||n.selected)&&t.set(e,n)}return[...t.values()]}function FA(e,t,n,r,i){let a=i?EA(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 IA(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=`${kA(e.cost.input)} / ${kA(e.cost.output)}`,a=`${OA(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(`
1487
1487
  `)+`
1488
- `}function LA(e){let t=w(e,{bool:_A,value:vA});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 RA(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 zA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(jA);if(o.length===0)return[];let s=o.map(e=>FA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=PA(s)),s}function BA(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 VA(e,t){if(T(e,{valueFlags:vA}))return{stdout:DA(),stderr:``,exitCode:0};let n=LA(e);if(`error`in n)return yA(`models: ${n.error}`);let r=await import(`./account-store-QxWo48Y1.js`).then(e=>e.t);if(r.getAccounts().length===0)return yA(`No provider accounts configured. Run the provider settings to add one.
1488
+ `}function LA(e){let t=w(e,{bool:_A,value:vA});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 RA(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 zA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(jA);if(o.length===0)return[];let s=o.map(e=>FA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=PA(s)),s}function BA(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 VA(e,t){if(T(e,{valueFlags:vA}))return{stdout:DA(),stderr:``,exitCode:0};let n=LA(e);if(`error`in n)return yA(`models: ${n.error}`);let r=await import(`./account-store-CYXcTNmf.js`).then(e=>e.t);if(r.getAccounts().length===0)return yA(`No provider accounts configured. Run the provider settings to add one.
1489
1489
  `);let i=r.resolveCurrentModel(),a=i.id,o=i.provider,s=r.getSelectedProvider(),c=r.getSelectedModelId(),l;if(!n.noBenchmarks){let e=await wA(t,n.forceRefresh);e.length>0&&(l=e)}let u=RA(r,n,s);if(`error`in u)return yA(u.error);let d=[],f=[];for(let e of u){let t=zA(r,e,a,o,l,n.allVersions);if(t.length===0){if(!n.allMode)return yA(`No models available for provider ${e}.\n`);continue}if(d.push(...t),!n.jsonMode){let n=r.getProviderConfig(e);f.push(IA(n.name,e,t,!!l))}}return n.jsonMode?{stdout:JSON.stringify(d,null,2)+`
1490
1490
  `,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
1491
1491
  `),f.push(BA(o,a,s,c)),{stdout:f.join(`
@@ -1543,7 +1543,7 @@ Examples:
1543
1543
  `)}\n`,stderr:``,exitCode:0}}async function fj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
1544
1544
  `,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 pj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain remove: requires <providerId> and <domain>
1545
1545
  `,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 mj(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>
1546
- `,exitCode:1}}async function hj(e,t,n,r){switch(t){case`list`:return dj(e,n);case`add`:return fj(e,n,r);case`remove`:return pj(e,n,r);case`clear`:return mj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${lj()}`,exitCode:1}}}function gj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:lj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return uj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-QxWo48Y1.js`).then(e=>e.t);try{return await hj(a,n,r,i)}catch(e){return uj(e instanceof Error?e.message:String(e))}})}function _j(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-DS9gNHJH.js`);return n(e,t)})}const vj=[`--download`,`-d`,`--view`,`-v`],yj=[`--size`],bj={low:256,medium:768,high:1536};function xj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
1546
+ `,exitCode:1}}async function hj(e,t,n,r){switch(t){case`list`:return dj(e,n);case`add`:return fj(e,n,r);case`remove`:return pj(e,n,r);case`clear`:return mj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${lj()}`,exitCode:1}}}function gj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:lj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return uj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-CYXcTNmf.js`).then(e=>e.t);try{return await hj(a,n,r,i)}catch(e){return uj(e instanceof Error?e.message:String(e))}})}function _j(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-BHLpn7EO.js`);return n(e,t)})}const vj=[`--download`,`-d`,`--view`,`-v`],yj=[`--size`],bj={low:256,medium:768,high:1536};function xj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
1547
1547
 
1548
1548
  VFS paths are served in a new browser tab via the preview service worker.
1549
1549
  URLs (http/https/etc.) are opened directly in a new tab.
@@ -1569,7 +1569,7 @@ Examples:
1569
1569
  `);let i=!1;try{i=(await t.fs.stat(e)).isDirectory}catch{}let a=await kr(t.fs,i?e:Lr(e)),o=Kr(e,a),s;try{s=await r(o)}catch(e){return G(`${e instanceof Error?e.message:String(e)}\n`)}return Aj(`opened ${e} → ${o}${jj(s)}`)}async function Rj(e,t,n,r){if(!jr(e)&&e.endsWith(`.shtml`)&&t.fs)return Nj(e,t,r.sprinkleManager,r.canOpenWindow,r.openExternal);if(!n.view&&!r.canOpenWindow)return G(`open: browser APIs are unavailable in this environment
1570
1570
  `);if(jr(e))return Pj(e,r.canOpenWindow,r.openExternal);let i=t.fs.resolvePath(t.cwd,e);return n.view?Fj(e,i,t,n.sizeSpec):n.download?Ij(e,i,t,r.hasDom):Lj(i,t,r.canOpenWindow,r.openExternal)}function zj(e){return C(`open`,async(t,n)=>{if(t.length===0||T(t,{valueFlags:yj}))return xj();let r=kj(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 xj();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:Mj(e,l,u)},f=[];for(let e of s){let t=await Rj(e,n,{view:a,download:i,sizeSpec:o},d);if(!t.ok)return t.result;f.push(t.message)}return{stdout:f.join(`
1571
1571
  `)+`
1572
- `,stderr:``,exitCode:0}})}function Bj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-BV4IO7_J.js`);return n(e,t)})}function Vj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BckBWdRW.js`);return r(e,t,n)})}function Hj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
1572
+ `,stderr:``,exitCode:0}})}function Bj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-C9mlrs_A.js`);return n(e,t)})}function Vj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BckBWdRW.js`);return r(e,t,n)})}function Hj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
1573
1573
 
1574
1574
  Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
1575
1575
  is zero-padded to the digit width of the last page (out-1.png for a 9-page
@@ -1864,7 +1864,7 @@ Limits and lifetime:
1864
1864
  `,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
1865
1865
  `,exitCode:1}}async function UP(e,t,n){if(e.ttlMs!==void 0){if(!t)throw Error(`persistent snapshot filesystem unavailable`);return FP(t,n)}}async function WP(e,t,n,r){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return yP();let i=TP(e);if(i.error)return{stdout:``,stderr:i.error,exitCode:1};let a=await VP(i);if(a)return a;if(!i.directory)return yP();let o=HP(i);if(o)return o;let s=await EP(i.directory,i.entry,t.fs,t.cwd);if(DP(s))return s;let{fullDirectory:c,entryPath:l}=s,u;try{u=await UP(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)
1866
1866
  `:``,f=await zP(!i.noBridge&&i.bridge,d);return f.ok?BP(i,c,l,f.webhookId,d,u,n):f.result}function GP(e,t){return C(`serve`,(n,r)=>WP(n,r,e,t))}const KP=`usage: session export [--id <id>] [--output <path>]
1867
- `;function qP(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 JP(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${KP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${KP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${KP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${KP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${KP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${KP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function YP(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||It(r)!==a.sha256)throw new Ua(`transfer-corrupt`);return r}async function XP(e,t){let n=JP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=qP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${KP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await As().export(a,{}),n=await YP(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 Ua?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function ZP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return XP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-CZZ78BU8.js`);return n(e,t,KP)})}function QP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-Df4gWXzQ.js`);return await n(e,t)})}const $P=`leader`;function eF(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function tF(e){return+!!e.leader+e.followers.length}function nF(){return{stdout:`usage: sprinkle <subcommand> [args]
1867
+ `;function qP(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 JP(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${KP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${KP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${KP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${KP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${KP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${KP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function YP(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||It(r)!==a.sha256)throw new Ua(`transfer-corrupt`);return r}async function XP(e,t){let n=JP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=qP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${KP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await As().export(a,{}),n=await YP(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 Ua?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function ZP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return XP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-Bjbktm7f.js`);return n(e,t,KP)})}function QP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-Df4gWXzQ.js`);return await n(e,t)})}const $P=`leader`;function eF(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function tF(e){return+!!e.leader+e.followers.length}function nF(){return{stdout:`usage: sprinkle <subcommand> [args]
1868
1868
 
1869
1869
  list [--runtime <id>] List sprinkles + an instance line per runtime
1870
1870
  open <name> Open a sprinkle by name
@@ -3011,7 +3011,7 @@ Notes:
3011
3011
  curl -o ${IR}/vgabios.bin https://raw.githubusercontent.com/copy/v86/master/bios/vgabios.bin
3012
3012
  or pass -bios / -vgabios with explicit VFS paths.`,zR={"-n":BR,"-name":BR,"--name":BR,"-m":(e,t)=>{let n=Number.parseInt(t,10);return!Number.isFinite(n)||n<=0?`-m requires a positive MiB value`:n>512?`-m ${n} exceeds the 512 MiB cap`:(e.memoryMib=n,null)},"-vga":(e,t)=>{let n=Number.parseInt(t,10);return!Number.isFinite(n)||n<=0?`-vga requires a positive MiB value`:n>64?`-vga ${n} exceeds the 64 MiB cap`:(e.vgaMemoryMib=n,null)},"-cdrom":(e,t)=>VR(e,`cdrom`,t),"-hda":(e,t)=>VR(e,`hda`,t),"-fda":(e,t)=>VR(e,`fda`,t),"-kernel":(e,t)=>VR(e,`kernel`,t),"-initrd":(e,t)=>VR(e,`initrd`,t),"-append":(e,t)=>VR(e,`append`,t),"-bios":(e,t)=>VR(e,`bios`,t),"-vgabios":(e,t)=>VR(e,`vgabios`,t),"-state":(e,t)=>VR(e,`state`,t),"-fs9p":(e,t)=>/^https?:\/\//u.test(t)?(e.fs9p=t,null):`-fs9p requires an http(s) base URL`,"-net":(e,t)=>{let[n,...r]=t.split(`,`);if(n!==`ne2k`&&n!==`virtio`)return`-net requires ne2k or virtio`;for(let t of r){if(t!==`relay=fetch`)return`-net: unknown option '${t}' (only relay=fetch)`;e.netRelay=`fetch`}return e.net=n,null},"-boot":(e,t)=>t!==`a`&&t!==`c`&&t!==`d`?`-boot requires a, c, or d`:(e.boot=t,null)};function BR(e,t){return/^[A-Za-z0-9_-]+$/.test(t)?(e.name=t,null):`invalid VM name '${t}'`}function VR(e,t,n){return e[t]=n,null}const HR=[...Object.keys(zR),`--fps`,`--tail`,`--send`,`--to`];function UR(e){let t={name:`vm0`,memoryMib:128,vgaMemoryMib:8,nographic:!1};for(let n=0;n<e.length;n++){let r=e[n];if(r===`-nographic`){t.nographic=!0;continue}let i=Object.hasOwn(zR,r)?zR[r]:void 0;if(!i)return{ok:!1,error:`unknown option '${r}'`};let a=n+1<e.length?e[n+1]:null;if(a===null)return{ok:!1,error:`${r} requires a value`};let o=i(t,a);if(o)return{ok:!1,error:o};n++}return!t.cdrom&&!t.hda&&!t.fda&&!t.kernel&&!t.state?{ok:!1,error:`no bootable media (-cdrom, -hda, -fda, -kernel, or -state required)`}:{ok:!0,parsed:t}}function WR(e){return{reader:{exists:t=>e.fs.exists(t),isDirectory:async t=>{try{return(await e.fs.stat(t)).isDirectory}catch{return!1}},readFile:t=>e.fs.readFile(t)},readBytes:t=>e.fs.readFileBuffer(t),fromDir:e.cwd}}function Q(e){return{stdout:``,stderr:`v86: ${e}\n`,exitCode:1}}function $(e=``){return{stdout:e,stderr:``,exitCode:0}}function GR(e){let t=[],n=`vm0`;for(let r=0;r<e.length;r++){if(e[r]===`-n`||e[r]===`-name`||e[r]===`--name`){let t=e[r+1];if(t){n=t,r++;continue}}t.push(e[r])}return{name:n,rest:t}}function KR(e){return Oa(e)||Q(`no VM named '${e}' — boot one with \`v86 start -n ${e} ...\``)}function qR(e){return`exitCode`in e}async function JR(e,t,n){let r=e.fs.resolvePath(e.cwd,t);if(!await e.fs.exists(r))return Q(`${n}: no such file: ${t}`);let i=await e.fs.readFileBuffer(r),a=new ArrayBuffer(i.byteLength);return new Uint8Array(a).set(i),{buffer:a}}const YR={a:801,c:306,d:531};function XR(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function ZR(e={}){return C(`v86`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`||t[0]===`help`)return $(LR);if(t[0]===`--version`)return QR(n,e);let r=t[0];if(T(t.slice(1),{valueFlags:HR}))return $(gt(`v86`,r,LR,{prefix:`v86`}));let i=ht(t.slice(1));try{switch(r){case`start`:return await iz(i,n,e);case`ls`:return oz();case`type`:return await uz(i,n);case`key`:return await dz(i,n);case`mouse`:return await pz(i,n);case`screenshot`:return await mz(i,n);case`text`:return await hz(i,n);case`serve`:return gz(i);case`serial`:return _z(i);case`state`:return await vz(i,n);case`stop`:return await yz(i,e);default:return Q(`unknown subcommand '${r}' — see \`v86 --help\``)}}catch(e){return Q(e instanceof Error?e.message:String(e))}})}async function QR(e,t){if(t.loadEngine)return $(`v86 ${(await t.loadEngine(WR(e))).version} (qemu-flavored CLI)\n`);let n=await GO(WR(e));return n?$(`v86 ${n.version} (qemu-flavored CLI)\n`):Q(BO)}async function $R(e,t,n){if(e.state&&!e.bios&&!e.vgabios)return null;let r=await JR(t,e.bios??`${IR}/seabios.bin`,`-bios`);if(`exitCode`in r)return e.bios?r:Q(RR.replace(/^v86: /u,``));if(n.bios=r,e.nographic)return null;let i=await JR(t,e.vgabios??`${IR}/vgabios.bin`,`-vgabios`);return`exitCode`in i?e.vgabios?i:Q(RR.replace(/^v86: /u,``)):(n.vga_bios=i,null)}async function ez(e,t,n){let r=await $R(e,t,n);if(r)return r;for(let[r,i]of[[`cdrom`,`cdrom`],[`hda`,`hda`],[`fda`,`fda`],[`kernel`,`bzimage`],[`initrd`,`initrd`]]){let a=e[r];if(!a)continue;let o=await JR(t,a,`-${r}`);if(`exitCode`in o)return o;n[i]=o}if(e.append&&(n.cmdline=e.append),e.boot&&(n.boot_order=YR[e.boot]),e.state){let r=await JR(t,e.state,`-state`);if(`exitCode`in r)return r;n.initial_state=r}return e.fs9p&&(n.filesystem={baseurl:e.fs9p}),e.net&&(n.net_device=e.netRelay===`fetch`?{type:e.net,relay_url:`fetch`}:{type:e.net}),null}const tz=6e4;function nz(e){return e.v86?Promise.resolve():new Promise((t,n)=>{let r=setTimeout(()=>n(/* @__PURE__ */ Error(`engine init timed out after ${tz/1e3}s`)),tz);e.add_listener(`emulator-loaded`,()=>{clearTimeout(r),t()})})}function rz(e,t){let n=e.network_adapter;if(!n||typeof n.fetch!=`function`)return Q(`relay=fetch: engine exposed no fetch-relay network adapter`);let r=t.proxiedFetch??g();return n.fetch=async(e,t)=>{let n=e.replace(/^http:\/\/(?!localhost[:/]|127\.0\.0\.1[:/])/u,`https://`),i={};t?.headers?.forEach((e,t)=>{i[t]=e});let a;if(t?.body){let e=``;for(let n of t.body)e+=String.fromCharCode(n);a=e}let o=await r(n,{method:t?.method,headers:i,body:a}),s=o.body,c=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);return{status:o.status,statusText:o.statusText,headers:new Headers(o.headers),redirected:!1,url:o.url,arrayBuffer:async()=>c}},null}async function iz(e,t,n){let r=UR(e);if(!r.ok)return Q(r.error);let i=r.parsed;if(Oa(i.name))return Q(`VM '${i.name}' already running — stop it first or pick another -n name`);let a=WR(t),o=n.loadEngine?await n.loadEngine(a):await HO({ipk:a}),s={wasm_fn:qO(o.wasmModule),memory_size:i.memoryMib*1024*1024,vga_memory_size:i.vgaMemoryMib*1024*1024,autostart:!1,disable_speaker:!0,fastboot:!0},c=await ez(i,t,s);if(c)return c;let l=new o.V86(s),u={name:i.name,emulator:l,engineVersion:o.version,pid:null,startedAt:Date.now(),bootArgv:[`v86`,`start`,...e],serial:{buffer:``},screen:{mode:`text`,width:0,height:0,frame:null},serve:null},d=n.processManager??XR();if(d){let e=d.spawn({kind:`net`,argv:u.bootArgv,cwd:t.cwd,owner:{kind:`system`}});u.pid=e.pid,e.abort.signal.addEventListener(`abort`,()=>{az(u,d)})}Da(u);try{if(await nz(l),i.netRelay===`fetch`){let e=rz(l,n);if(e)return await az(u,d),e}Ea(u),await l.run()}catch(e){return await az(u,d),Q(`boot failed: ${e instanceof Error?e.message:String(e)}`)}u.onScreenChange=()=>{import(`./registry-Bxb0uXZH.js`).then(({getComputerRegistry:e})=>{e()?.refresh(`v86:${u.name}`)})},import(`./v86-BhyJfU3t.js`).then(({registerV86Computer:e})=>e(u)).catch(()=>{});let f=u.pid===null?``:` (pid ${u.pid})`;return $(`VM '${i.name}' booting in the background${f}.\nDrive it with: v86 text -n ${i.name} | v86 screenshot -n ${i.name} | v86 type -n ${i.name} "..."\n`)}async function az(e,t){ka(e),Ta(e.name),import(`./v86-BhyJfU3t.js`).then(({unregisterV86Computer:t})=>t(e.name)).catch(()=>{});try{e.emulator.is_running()&&await e.emulator.stop()}catch{}try{await e.emulator.destroy()}catch{}t&&e.pid!==null&&t.exit(e.pid,null)}function oz(){let e=wa();if(e.length===0)return $(`no VMs running
3013
3013
  `);let t=[`NAME PID STATE UP BOOT`];for(let n of e){let e=Math.round((Date.now()-n.startedAt)/1e3),r=e>=60?`${Math.floor(e/60)}m${e%60}s`:`${e}s`;t.push(`${n.name.padEnd(10)} ${String(n.pid??`-`).padEnd(6)} ${(n.emulator.is_running()?`running`:`stopped`).padEnd(9)} ${r.padEnd(9)} `+n.bootArgv.slice(2).join(` `))}return $(`${t.join(`
3014
- `)}\n`)}function sz(e,t){return`prefer: computer ${e} -c ${t}\n`}async function cz(e,t,n,r){let i=KR(t);if(qR(i))return i;let[{runComputer:a},{getComputerRegistry:o,installComputerRegistry:s},c]=await Promise.all([import(`./run-Ds-D_Vog.js`).then(e=>e.t),import(`./registry-Bxb0uXZH.js`),import(`./v86-BhyJfU3t.js`)]),l=c.v86ComputerId(t),u=o()??s(null);return u.get(l)||c.registerV86Computer(i,u),lz(await a([`-c`,l,...n],e,{registry:u}),r,l)}function lz(e,t,n){let r=sz(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 uz(e,t){let{name:n,rest:r}=GR(e);if(r.length===0){let e=KR(n);return qR(e)?e:Q(`type: no text supplied`)}return cz(t,n,[`type`,`--`,...r],`type`)}async function dz(e,t){let{name:n,rest:r}=GR(e);if(r.length===0){let e=KR(n);return qR(e)?e:Q(`key: no chord supplied`)}return cz(t,n,[`key`,...r],`key`)}const fz=[`left`,`middle`,`right`];async function pz(e,t){let{name:n,rest:r}=GR(e),i=KR(n);if(qR(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?cz(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>`):cz(t,n,[`--native`,`mousemove`,e,i,`--relative`],`mousemove`)}if(o===`click`){let e=r[1]??`left`;if(!fz.includes(e))return Q(`mouse: unknown button '${r[1]}'`);let i=[`click`,e];return r.includes(`--double`)&&i.push(`--repeat`,`2`),cz(t,n,i,`click`)}return Q(`mouse: expected move <dx> <dy>, click [button], or --to <x>,<y>`)}async function mz(e,t){let{name:n,rest:r}=GR(e);return cz(t,n,[`screenshot`,...r],`screenshot`)}async function hz(e,t){let{name:n}=GR(e);return cz(t,n,[`text`],`text`)}function gz(e){let{name:t}=GR(e);return $(`v86 serve is retired.\nUse: computer watch -c v86:${t}\nLive frames go to the overlay, lightbox, and bash rows.\n`)}function _z(e){let{name:t,rest:n}=GR(e),r=KR(t);if(qR(r))return r;let i=n.indexOf(`--send`);if(i!==-1){let e=n.slice(i+1).join(` `).replace(/\\n/gu,`
3014
+ `)}\n`)}function sz(e,t){return`prefer: computer ${e} -c ${t}\n`}async function cz(e,t,n,r){let i=KR(t);if(qR(i))return i;let[{runComputer:a},{getComputerRegistry:o,installComputerRegistry:s},c]=await Promise.all([import(`./run-B9uXGQYv.js`).then(e=>e.t),import(`./registry-Bxb0uXZH.js`),import(`./v86-BhyJfU3t.js`)]),l=c.v86ComputerId(t),u=o()??s(null);return u.get(l)||c.registerV86Computer(i,u),lz(await a([`-c`,l,...n],e,{registry:u}),r,l)}function lz(e,t,n){let r=sz(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 uz(e,t){let{name:n,rest:r}=GR(e);if(r.length===0){let e=KR(n);return qR(e)?e:Q(`type: no text supplied`)}return cz(t,n,[`type`,`--`,...r],`type`)}async function dz(e,t){let{name:n,rest:r}=GR(e);if(r.length===0){let e=KR(n);return qR(e)?e:Q(`key: no chord supplied`)}return cz(t,n,[`key`,...r],`key`)}const fz=[`left`,`middle`,`right`];async function pz(e,t){let{name:n,rest:r}=GR(e),i=KR(n);if(qR(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?cz(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>`):cz(t,n,[`--native`,`mousemove`,e,i,`--relative`],`mousemove`)}if(o===`click`){let e=r[1]??`left`;if(!fz.includes(e))return Q(`mouse: unknown button '${r[1]}'`);let i=[`click`,e];return r.includes(`--double`)&&i.push(`--repeat`,`2`),cz(t,n,i,`click`)}return Q(`mouse: expected move <dx> <dy>, click [button], or --to <x>,<y>`)}async function mz(e,t){let{name:n,rest:r}=GR(e);return cz(t,n,[`screenshot`,...r],`screenshot`)}async function hz(e,t){let{name:n}=GR(e);return cz(t,n,[`text`],`text`)}function gz(e){let{name:t}=GR(e);return $(`v86 serve is retired.\nUse: computer watch -c v86:${t}\nLive frames go to the overlay, lightbox, and bash rows.\n`)}function _z(e){let{name:t,rest:n}=GR(e),r=KR(t);if(qR(r))return r;let i=n.indexOf(`--send`);if(i!==-1){let e=n.slice(i+1).join(` `).replace(/\\n/gu,`
3015
3015
  `);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(`
3016
3016
  `).slice(-Math.max(1,e)).join(`
3017
3017
  `)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function vz(e,t){let{name:n,rest:r}=GR(e),i=KR(n);if(qR(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 yz(e,t){let{name:n,rest:r}=GR(e),i=KR(n);if(qR(i))return i;let a=t.processManager??XR();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await az(i,a),$(`VM '${n}' stopped\n`))}function bz(e={}){return C(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-BBaO_6mp.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}const xz=[`--name`,`--filter`,`--scoop`],Sz={state:`inactive`,session:null};function Cz(){return{stdout:`usage: webhook <command> [options]
@@ -3276,6 +3276,6 @@ pass --wait to block and print the full result.`,HB=/* @__PURE__ */ new Set([`li
3276
3276
  `,stderr:``,exitCode:0};let n;try{n=mV(e)}catch(e){return nV(e.message)}let r=n.positional[0],i=n.positional[1],a=!r||r===`-`,o;try{o=await gV(t,r,a)}catch{return nV(`${r}: No such file or directory`)}if(n.revert){let e=aV(o),r=n.plain?uV(e):dV(e);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),r),{stdout:``,stderr:``,exitCode:0}):{stdout:aV(r),stderr:``,exitCode:0}}let{data:s,base:c}=vV(n,o),l=_V(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 bV(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=Mr(t,o),s=n?`${n}/${o}`:o;a+=await bV(e,i,s,r)}return a}function xV(){return{stdout:`usage: zip [-r] <archive.zip> <path> [path...]
3277
3277
  `,stderr:``,exitCode:0}}function SV(){return C(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return xV();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
3278
3278
  `,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(/^\.\//,``))||Nr(r);if(i.isDirectory&&!n)return{stdout:``,stderr:`zip: ${e} is a directory (use -r)\n`,exitCode:1};s+=await bV(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
3279
- `,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function CV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-n1wIw393.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function wV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function TV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[MO(`ipk`,r),MO(`npm`,r),MO(`i`,r),xk(`ipx`,{fs:t,fetch:n}),xk(`npx`,{fs:t,fetch:n}),wb(`di`,{fs:t,fetch:n}),wb(`uv`,{fs:t,fetch:n}),YL({fs:t,fetch:n})]}function EV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>tN(e,t))}function DV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function OV(){return[ZP(),IS()]}function kV(e={}){let t=[LE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),NF(),QP(),GP(e.browserAPI,e.fs),zj(e.browserAPI),zy(e.browserAPI),HD(e),SV(),TL(),_I(e.fs?{fs:e.fs}:{}),BF(),qF(),WF(),Pv(),bz(DV(e)),lC(DV(e)),yV(),DF(`sqlite3`),DF(`sqllite`),PI(),eL(),Bx(),gv(),nj({buildProcessConfig:e.buildProcessConfig}),nj({buildProcessConfig:e.buildProcessConfig},`jsh`),...EV(e),...TV(e),...e.fs?[cC({fs:e.fs})]:[],...e.fs?[mA({fs:e.fs})]:[],...e.fetch?[JE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],LS(),RS(),XS(),Fz(e.webhook),bB(),Ry(e.crontask),CV(e),aM({fs:e.fs,fetch:e.fetch}),sC(),vF(),Bj(),Vj(`pdftk`),Vj(`pdf`),_v(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),_v(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Zj(`pdftoppm`),Zj(`pdftocairo`),Qj(`pdftotext`),Sy(`convert`),Sy(`magick`),AB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),iL(),bL(),RD(),zD(),xL(),hA(),aN(),sA(),dx(),_j(),gj(),iA(),gP(wV(e)),Zp(e.gitCredential),vN({fs:e.fs}),WN(),jv(),Mv(),Nv(`xclip`),Nv(`xsel`),UN(),TC(),c_(),l_(),HA(e.fs),_t(),sj(),u_({getParentJid:e.getParentJid}),yx(),DM({processManager:e.processManager}),uR({processManager:e.processManager}),wk({processManager:e.processManager}),Sk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...f_(),pA(),Xk(),FR(),bD(),xS(),ZR({processManager:e.processManager}),Lv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),MS(),wv({registry:e.cherryRuntimeRegistry}),Jy(),eb({fs:e.fs}),tb({fs:e.fs}),FF(e.sudoCommand),qB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),xB(),...OV()];return e.fs&&(eM(),t.push(...er.map(t=>PE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let AV=null;function jV(e){AV=e}function MV(e){AV?.(e)}var NV=Yt();const PV={user:`user`,home:_r},FV=/* @__PURE__ */ new Set([`root`,`nobody`,`nogroup`]),IV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function LV(e){return{user:IV.test(e.user)&&!FV.has(e.user)?e.user:PV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:PV.home}}function RV(e,t){let{user:n,home:r}=LV(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(`
3279
+ `,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function CV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-Bshk9-8r.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function wV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function TV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[MO(`ipk`,r),MO(`npm`,r),MO(`i`,r),xk(`ipx`,{fs:t,fetch:n}),xk(`npx`,{fs:t,fetch:n}),wb(`di`,{fs:t,fetch:n}),wb(`uv`,{fs:t,fetch:n}),YL({fs:t,fetch:n})]}function EV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>tN(e,t))}function DV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function OV(){return[ZP(),IS()]}function kV(e={}){let t=[LE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),NF(),QP(),GP(e.browserAPI,e.fs),zj(e.browserAPI),zy(e.browserAPI),HD(e),SV(),TL(),_I(e.fs?{fs:e.fs}:{}),BF(),qF(),WF(),Pv(),bz(DV(e)),lC(DV(e)),yV(),DF(`sqlite3`),DF(`sqllite`),PI(),eL(),Bx(),gv(),nj({buildProcessConfig:e.buildProcessConfig}),nj({buildProcessConfig:e.buildProcessConfig},`jsh`),...EV(e),...TV(e),...e.fs?[cC({fs:e.fs})]:[],...e.fs?[mA({fs:e.fs})]:[],...e.fetch?[JE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],LS(),RS(),XS(),Fz(e.webhook),bB(),Ry(e.crontask),CV(e),aM({fs:e.fs,fetch:e.fetch}),sC(),vF(),Bj(),Vj(`pdftk`),Vj(`pdf`),_v(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),_v(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Zj(`pdftoppm`),Zj(`pdftocairo`),Qj(`pdftotext`),Sy(`convert`),Sy(`magick`),AB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),iL(),bL(),RD(),zD(),xL(),hA(),aN(),sA(),dx(),_j(),gj(),iA(),gP(wV(e)),Zp(e.gitCredential),vN({fs:e.fs}),WN(),jv(),Mv(),Nv(`xclip`),Nv(`xsel`),UN(),TC(),c_(),l_(),HA(e.fs),_t(),sj(),u_({getParentJid:e.getParentJid}),yx(),DM({processManager:e.processManager}),uR({processManager:e.processManager}),wk({processManager:e.processManager}),Sk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...f_(),pA(),Xk(),FR(),bD(),xS(),ZR({processManager:e.processManager}),Lv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),MS(),wv({registry:e.cherryRuntimeRegistry}),Jy(),eb({fs:e.fs}),tb({fs:e.fs}),FF(e.sudoCommand),qB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),xB(),...OV()];return e.fs&&(eM(),t.push(...er.map(t=>PE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let AV=null;function jV(e){AV=e}function MV(e){AV?.(e)}var NV=Yt();const PV={user:`user`,home:_r},FV=/* @__PURE__ */ new Set([`root`,`nobody`,`nogroup`]),IV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function LV(e){return{user:IV.test(e.user)&&!FV.has(e.user)?e.user:PV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:PV.home}}function RV(e,t){let{user:n,home:r}=LV(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(`
3280
3280
  `);if(e===`/etc/group`)return[`root:x:0:`,`${n}:x:1000:`,`nogroup:x:65534:`,``].join(`
3281
3281
  `)}function zV(e,t=PV){let n=RV(e,t);return n===void 0?void 0:new TextEncoder().encode(n)}function BV(e){return e===`/etc`?[`group`,`passwd`]:[]}function VV(e){return e?.code===`ENOENT`}const HV=Reflect.get(ft,`DefenseInDepthBox`);function UV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function WV(e,t){if(typeof e!=`string`)return e;let n=UV(t);if(n===`binary`||n===`latin1`){let t=Oe(e);if(t)return t}return NV.Buffer.from(e,n)}function GV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}function KV(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 qV(e,t){let n=BV(e).filter(e=>!t.includes(e));return n.length?[...t,...n].sort():t}function JV(e,t){let n=BV(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 YV=class{vfs;registeredCommandsFn=null;identityFn=null;listingStats=/* @__PURE__ */ 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=Xe(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 zV(e,this.identityFn?.()??PV)}isVirtualBinCommand(e){return e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e)}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=GV(e);if(t===`/usr`||t===`/usr/bin`)return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:/* @__PURE__ */ 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:KV(e).length,mtime:/* @__PURE__ */ 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=HV?.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=UV(t),a=NV.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=GV(e);if(t.startsWith(`/usr/bin/`)&&this.isVirtualBinCommand(t.slice(9)))return KV(t.slice(9));let n;try{n=await this.vfs.readFile(e,{encoding:`binary`})}catch(t){let n=this.identityFile(e);if(n&&VV(t))return n;throw t}return n instanceof Uint8Array?n:new TextEncoder().encode(n)}identityStat(e,t){let n=this.identityFile(e);if(n&&VV(t))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:420,size:n.length,mtime:/* @__PURE__ */ new Date(0)}}async readFileBytes(e){let t=await this.readFileBuffer(e);return NV.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,WV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(x(e),WV(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(GV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return qV(t,n.map(e=>e.name));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),qV(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(GV(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 JV(t,this.mapFastEntriesToDirents(n));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),JV(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||!VV(e))throw e;await this.vfs.writeFile(i,t);return}if(a.type===`directory`){if(!n?.recursive)throw new Ze(`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 BV(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 XV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?XV(e.getUnderlyingFS?.()):null}const ZV=e(`almost-bash-shell`);function QV(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{[om]:t,[sm]:n,[Ep]:r,[Gt]:i,[Ht]:a,...o}=e;return o}function $V(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 eH=class e{options;bash;vfsAdapter;gitCommands;mountCommands;lastEnv;cwd;umask=18;builtinCommandNames;staticBuiltinNames;allowedCommands;scriptCatalog;initialJshSync=null;ownsScriptCatalog;commandGate;jshRegistry;gnuBashFallback;pendingEnvWrites=/* @__PURE__ */ new Map;activeShellPid;progress;activeRunSignal;commandAbort=new AbortController;scriptRun=null;scriptRunsActive=0;registryNames=/* @__PURE__ */ new Set;outputTees=/* @__PURE__ */ new Map;nextOutputTeeId=0;resolveJshProcessConfig=e=>this.buildJshProcessConfig(cm(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:_r,PATH:Cr,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return kV({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:xp},gitIdentity:()=>this.gitCommands.identity(),mcpConnectionManager:e.mcpConnectionManager})}constructor(t){this.options=t,this.vfsAdapter=new YV(t.fs),this.progress=new pm({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t),this.commandGate=new Qp({getSudo:()=>this.options.sudo,fs:t.fs});let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new vp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:bp}),this.mountCommands=new Gs({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:Qm});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=XV(i)??XV(a);this.scriptCatalog=t.scriptCatalog??new Ni({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||br(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=g({progress:vm(this.progress)}),l=_({progress:vm(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),Kh(t.fs),Ug(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...mt(),...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:zm(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:em(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(oh),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??[...mt(),...dt()];this.builtinCommandNames=/* @__PURE__ */ 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 fm({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 lm({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 gi(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 gr(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=hr(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){ZV.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(MV(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=Op(e),s={env:{...this.lastEnv,...n===void 0?{}:{[om]:String(n)},...i===void 0?{}:{[sm]:i},...o?{[Ep]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=$V([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(Ut(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.commandGate.flushPendingCommandGrants(),d=Vt(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=QV(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-DGW7999v.js`).then(e=>e.n);return zt(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()||Hp.has(e))return null;let r=await this.commandGate.gateCommandDispatch(e,t,n[Ep]);return r?{stderr:r.stderr,exitCode:r.exitCode}:null};wrapCommandForDispatch(e){let t=this.commandGate.wrapCommandForSudo(e),n=e.name===`timeout`?Um(t,this.progress):Gm(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(sm),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await qm(()=>n.execute(e,t),t.signal);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(sm);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=Pm(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Im(t,this.progress,Fm(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(Hp.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{Ha as _,LB as a,ks as c,Cs as d,is as f,Ua as g,za as h,NB as i,Es as l,Jo as m,YV as n,jB as o,rs as p,jV as r,Is as s,eH as t,Ts as u,Ho as v,Na as y};
@@ -1 +1 @@
1
- import{n as e,t}from"./dock-tree-spec-D-vXUz3b.js";import{CHAT_SURFACE_ID as n}from"./wc-sprinkles-D752QtPV.js";function r(r,i){switch(i.kind){case`set`:r.applyLayout(i.tree);break;case`reset`:{let n=e(t);n&&r.applyLayout(n.tree);break}case`chat`:r.moveSurfaceToZone(n,i.zone);break;case`open`:r.placeSurface(i.zone,i.surfaceId);break;case`close`:r.removeSurface(i.surfaceId);break;case`move`:r.moveSurfaceToZone(i.surfaceId,i.zone);break;case`size`:r.setSurfaceSize(i.surfaceId,i.size)}}export{r as applyLayout};
1
+ import{n as e,t}from"./dock-tree-spec-D-vXUz3b.js";import{CHAT_SURFACE_ID as n}from"./wc-sprinkles-BQyYYsOa.js";function r(r,i){switch(i.kind){case`set`:r.applyLayout(i.tree);break;case`reset`:{let n=e(t);n&&r.applyLayout(n.tree);break}case`chat`:r.moveSurfaceToZone(n,i.zone);break;case`open`:r.placeSurface(i.zone,i.surfaceId);break;case`close`:r.removeSurface(i.surfaceId);break;case`move`:r.moveSurfaceToZone(i.surfaceId,i.zone);break;case`size`:r.setSurfaceSize(i.surfaceId,i.size)}}export{r as applyLayout};
@@ -1,4 +1,4 @@
1
- import{c as e,o as t}from"./account-store-QxWo48Y1.js";import{a as n}from"./diagnostics-B-5VkVir.js";import{t as r}from"./models-7tbZ9MB5.js";import{a as i}from"./compat-CuWVDYYO.js";import{n as a,t as o}from"./pi-transcript-context-C6LXdArv.js";import{r as s,t as c}from"./transform-messages-Droy7O-v.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=/* @__PURE__ */ new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e);let S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,Oe,ke,Ae;const je=65536;var Me=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),l(this,T,/* @__PURE__ */ new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),l(this,ke,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,ke,`f`)&&(l(this,ke,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,Ae).call(this,t);let n=[],r;for(;(r=Ne(u(this,T,`f`),u(this,Oe,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,ke,!0,`f`)),l(this,Oe,u(this,E,`f`),`f`)}if(l(this,Oe,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),u(this,T,`f`).length>je&&l(this,T,/* @__PURE__ */ new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>je){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=je||u(this,T,`f`).length>e*4){let t=e<=je?Math.min(Math.max(e*2,256),je):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,Oe,e,`f`)}}return n}flush(){return l(this,ke,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
1
+ import{c as e,o as t}from"./account-store-CYXcTNmf.js";import{a as n}from"./diagnostics-B-5VkVir.js";import{t as r}from"./models-7tbZ9MB5.js";import{a as i}from"./compat-CuWVDYYO.js";import{n as a,t as o}from"./pi-transcript-context-C6LXdArv.js";import{r as s,t as c}from"./transform-messages-Droy7O-v.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=/* @__PURE__ */ new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e);let S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,Oe,ke,Ae;const je=65536;var Me=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),l(this,T,/* @__PURE__ */ new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),l(this,ke,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,ke,`f`)&&(l(this,ke,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,Ae).call(this,t);let n=[],r;for(;(r=Ne(u(this,T,`f`),u(this,Oe,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,ke,!0,`f`)),l(this,Oe,u(this,E,`f`),`f`)}if(l(this,Oe,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),u(this,T,`f`).length>je&&l(this,T,/* @__PURE__ */ new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>je){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=je||u(this,T,`f`).length>e*4){let t=e<=je?Math.min(Math.max(e*2,256),je):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,Oe,e,`f`)}}return n}flush(){return l(this,ke,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
2
2
  `)}};T=/* @__PURE__ */ new WeakMap,E=/* @__PURE__ */ new WeakMap,D=/* @__PURE__ */ new WeakMap,Oe=/* @__PURE__ */ new WeakMap,ke=/* @__PURE__ */ new WeakMap,De=/* @__PURE__ */ new WeakSet,Ae=function(e){if(u(this,D,`f`)+e.length>u(this,T,`f`).length){let t=u(this,D,`f`)-u(this,E,`f`);if(u(this,E,`f`)>=u(this,T,`f`).length/2&&t+e.length<=u(this,T,`f`).length)u(this,T,`f`).copyWithin(0,u(this,E,`f`),u(this,D,`f`));else{let n=Math.max(u(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,r,`f`)}l(this,Oe,u(this,Oe,`f`)-u(this,E,`f`),`f`),l(this,D,t,`f`),l(this,E,0,`f`)}u(this,T,`f`).set(e,u(this,D,`f`)),l(this,D,u(this,D,`f`)+e.length,`f`)},Me.NEWLINE_CHARS=/* @__PURE__ */ new Set([`
3
3
  `,`\r`]),Me.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ne(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Pe(e){for(let t=0;t<e.length-1;t++){let n=Fe(e,t);if(n>0){let r=t+n,i=Fe(e,r);if(i>0)return r+i}}return-1}function Fe(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}const Ie={off:0,error:200,warn:300,info:400,debug:500},Le=(e,t,n)=>{if(e){if(he(Ie,e))return e;O(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ie))}`)}};function Re(){}function ze(e,t,n){return!t||Ie[e]>Ie[n]?Re:t[e].bind(t)}const Be={error:Re,warn:Re,info:Re,debug:Re};let Ve=/* @__PURE__ */ new WeakMap;function O(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Be;let r=Ve.get(t);if(r&&r[0]===n)return r[1];let i={error:ze(`error`,t,n),warn:ze(`warn`,t,n),info:ze(`info`,t,n),debug:ze(`debug`,t,n)};return Ve.set(t,[n,i]),i}const He=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Ue,We=class e{constructor(e,t,n){Ue.set(this,void 0),this.iterator=e,this.controller=t,l(this,Ue,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?O(r):console;async function*s(){if(a)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of Ge(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new h(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new h(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||f(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new Me,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||f(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ue=/* @__PURE__ */ new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,u(this,Ue,`f`)),new e(()=>i(n),this.controller,u(this,Ue,`f`))]}toReadableStream(){let e;return be({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
4
4
  `);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*Ge(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new m(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new m(`Attempted to iterate over a response with no body`);let n=new qe,r=new Me,i=Se(e.body);for await(let e of Ke(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ke(e){let t=/* @__PURE__ */ new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=Pe(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-3)}r>n&&(yield t.slice(n,r))}var qe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`