sliccy 6.229.2 → 6.230.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +182 -182
- package/dist/ui/assets/{account-store-CowcSecG.js → account-store-BFlTLY9n.js} +1 -1
- package/dist/ui/assets/{account-store-D2Icce05.js → account-store-_i7awS4-.js} +1 -1
- package/dist/ui/assets/{adobe-Du6Nn1Bo.js → adobe-DYLSvsR9.js} +1 -1
- package/dist/ui/assets/{adobe-BdyKsD7-.js → adobe-N-aR9S8D.js} +1 -1
- package/dist/ui/assets/{agent-panels-Cas9sml0.js → agent-panels-DLoceMVZ.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-BzHyvXK_.js → almost-bash-shell-headless-Bo-3Smqc.js} +28 -28
- package/dist/ui/assets/{apply-layout-C5z335qy.js → apply-layout-CZAPybV0.js} +1 -1
- package/dist/ui/assets/{apps-icbfxygL.js → apps-Tmd2i2Ui.js} +1 -1
- package/dist/ui/assets/{azure-openai-BsuLckzg.js → azure-openai-0Ewl4YAU.js} +1 -1
- package/dist/ui/assets/{azure-openai-9LrOUGdR.js → azure-openai-CLl4AbiA.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-ul38q_-V.js → backend-hostfs-B6M6MfL0.js} +1 -1
- package/dist/ui/assets/{cdp-BCoH-J6f.js → cdp-ItksyhaL.js} +1 -1
- package/dist/ui/assets/{cerebras-Csx3RKzj.js → cerebras-CH7DdE1e.js} +1 -1
- package/dist/ui/assets/{cerebras-CNIzRG1J.js → cerebras-CHbMjZhW.js} +1 -1
- package/dist/ui/assets/{composer-speech-CohGVRjH.js → composer-speech-fpL9_Wfa.js} +1 -1
- package/dist/ui/assets/{connect-surface-7ZqD6nq7.js → connect-surface-de48inQl.js} +1 -1
- package/dist/ui/assets/{directed-approval-DKZxbcBl.js → directed-approval-D6PWrNPm.js} +1 -1
- package/dist/ui/assets/{emscripten-vfs-hook-DERetoEH.js → emscripten-vfs-hook-B8f99XJZ.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-DxtfMNAN.js → ensure-speech-assets-D8QCvPIG.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-DWVDA4Y8.js → frozen-archive-writer-ByeA2yGc.js} +1 -1
- package/dist/ui/assets/{fs-BUsVEmsX.js → fs-BCL8Htu-.js} +1 -1
- package/dist/ui/assets/{fs-iwpNzQdl.js → fs-DSzlJ59w.js} +2 -2
- package/dist/ui/assets/{gelatiere-unit-hYV3q3Xz.js → gelatiere-unit-BPgq1Sab.js} +1 -1
- package/dist/ui/assets/{github-BTTZENwY.js → github-BP0l8F1q.js} +1 -1
- package/dist/ui/assets/{github-DBgsdeUW.js → github-DGI0cNhi.js} +2 -2
- package/dist/ui/assets/{github-auth-DXJer3bD.js → github-auth-Q0I6yeh8.js} +1 -1
- package/dist/ui/assets/{github-copilot-CIcQGn7Z.js → github-copilot-5JK11zoF.js} +1 -1
- package/dist/ui/assets/{github-copilot-BFaHTsGw.js → github-copilot-Mp0mmrWH.js} +1 -1
- package/dist/ui/assets/{github-install-7a9uVd3W.js → github-install-Cs4wWfEZ.js} +1 -1
- package/dist/ui/assets/{github-zip-fry304hI.js → github-zip-Byubjm5A.js} +1 -1
- package/dist/ui/assets/{go-driver-BgQVBO2H.js → go-driver-RbD3VF67.js} +1 -1
- package/dist/ui/assets/{hear-PbMgJEsO.js → hear-C63RFqp1.js} +1 -1
- package/dist/ui/assets/{help-BMmq6sq2.js → help-CltkLxU8.js} +1 -1
- package/dist/ui/assets/{installer-DeDv-dvS.js → installer-CqJH2NWX.js} +1 -1
- package/dist/ui/assets/{ipk-mamba-CMV3ELsC.js → ipk-mamba-3_fPiukj.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-oKo_arnO.js → js-realm-worker-IjA3BJVF.js} +2 -2
- package/dist/ui/assets/{jsh-executor-B7mIy4Lh.js → jsh-executor-aRNcFqMp.js} +2 -2
- package/dist/ui/assets/{kernel-worker-xLRYNltz.js → kernel-worker-DOvbZc-9.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-Cy_1ITjB.js → lick-ws-bridge-C4ex_Z-R.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-Bl_OJq4E.js → lick-ws-bridge-C7mfizDg.js} +1 -1
- package/dist/ui/assets/{live-session-curation-DEtj6GB8.js → live-session-curation-C0_1fAjP.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-CripoibY.js → live-session-snapshot-Bgo_gPdd.js} +1 -1
- package/dist/ui/assets/{local-llm-CqCsqzYy.js → local-llm-DVdX5889.js} +1 -1
- package/dist/ui/assets/{local-llm-D1tS2bBI.js → local-llm-VQikB6XZ.js} +1 -1
- package/dist/ui/assets/{main-Buhm0-hg.js → main-ClYvzbq4.js} +3 -3
- package/dist/ui/assets/{main-cherry-88p0gj3y.js → main-cherry-BjctM6Q9.js} +1 -1
- package/dist/ui/assets/{mcp-command-BBC5wuuf.js → mcp-command-BZ4YBir6.js} +12 -12
- package/dist/ui/assets/{memory-curation-seam-hIGWifBy.js → memory-curation-seam-BtyIWqnk.js} +1 -1
- package/dist/ui/assets/{memory-health-CCUxDHM0.js → memory-health-DOmBAmnq.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-CoIdm1G0.js → memory-write-execute-DtQv18gW.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-L94M_Dr9.js → merge-folded-cost-into-frozen-CtRKf2Ck.js} +1 -1
- package/dist/ui/assets/{mount-C6vddCAo.js → mount-B4p_tDTv.js} +3 -3
- package/dist/ui/assets/{mount-BkHkpfEI.js → mount-BwEsDkrw.js} +1 -1
- package/dist/ui/assets/{new-session-CYBsYHOV.js → new-session-CTkymQc4.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-DcSqBQ4G.js → oauth-bootstrap-e6esIf44.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-B14RkYJ7.js → onboarding-orchestrator-Bbjo2w96.js} +1 -1
- package/dist/ui/assets/{openai-codex-cJIdGHKD.js → openai-codex-BCp3h8b7.js} +1 -1
- package/dist/ui/assets/{openai-codex-Ti-2DwbB.js → openai-codex-BY49uV3x.js} +1 -1
- package/dist/ui/assets/{openrouter-9yZ1k_xq.js → openrouter-D9_Bl2Mf.js} +1 -1
- package/dist/ui/assets/{openrouter-DRDJwBRE.js → openrouter-Dx8hiE36.js} +1 -1
- package/dist/ui/assets/{openrouter-free-klRJRU31.js → openrouter-free-9CnixaMo.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CKOmXvc2.js → openrouter-free-wm6ifNCV.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DVR_BS-x.js → openrouter-oauth-CLEDrGbs.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CFr3s5Ly.js → openrouter-oauth-CVVM5OuK.js} +1 -1
- package/dist/ui/assets/{opfs-mount-C84mBe6t.js → opfs-mount-BqaC2nqe.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-b93FdNjY.js → panel-rpc-handlers-MNGNk2F4.js} +2 -2
- package/dist/ui/assets/{panelize-shell-DFKPkvtI.js → panelize-shell-CTewRWpP.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-Dri3WBiU.js → pi-edit-execution-Cy5ijlZP.js} +1 -1
- package/dist/ui/assets/{provider-CS6PHtoF.js → provider-C_TiKxLr.js} +1 -1
- package/dist/ui/assets/{provider-BfVpcbfk.js → provider-Cb-kfvwF.js} +2 -2
- package/dist/ui/assets/{provider-settings-BbsZ1qBl.js → provider-settings-C_zHfAvz.js} +1 -1
- package/dist/ui/assets/provider-store-access-BP4SKCRs.js +1 -0
- package/dist/ui/assets/provider-store-access-RstZhqfA.js +1 -0
- package/dist/ui/assets/{providers-Ckr9hn7r.js → providers-BAgx8HTx.js} +2 -2
- package/dist/ui/assets/{providers-D3DLebm2.js → providers-DoeOUxXB.js} +1 -1
- package/dist/ui/assets/{quick-llm-W7EV_6N3.js → quick-llm-BGpxh5P6.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-yBp5J4sf.js → realm-inprocess-B-pTzi16.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-DqId55hf.js → realm-unhandled-rejections-CC1GscSu.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-HWDWq7jy.js → realm-unhandled-rejections-FDxNYL7g.js} +1 -1
- package/dist/ui/assets/{recovery-screen-Dy5lXAWw.js → recovery-screen-BmWb5tes.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-BZmb1Wyz.js → remote-terminal-view-B5lf5vXi.js} +2 -2
- package/dist/ui/assets/{restore-CTsKVDFg.js → restore-BhJNP8G3.js} +1 -1
- package/dist/ui/assets/{run-BOcsKLg2.js → run-COFXmIVS.js} +1 -1
- package/dist/ui/assets/{run-BlhsThab.js → run-CbG5L__f.js} +1 -1
- package/dist/ui/assets/{run-DfZqbehT.js → run-D26_LV3G.js} +2 -2
- package/dist/ui/assets/{run-L3158s5p.js → run-DdV5_2MK.js} +2 -2
- package/dist/ui/assets/{run-BJJgZJ6E.js → run-Dx_PcgX_.js} +1 -1
- package/dist/ui/assets/{run-C-gx42zq.js → run-HzYAVLeI.js} +4 -4
- package/dist/ui/assets/{script-catalog-B5BTq3Ma.js → script-catalog-CqkljCRS.js} +1 -1
- package/dist/ui/assets/{session-command-memory-BVbB-SSu.js → session-command-memory-CPUaYr48.js} +2 -2
- package/dist/ui/assets/{session-jsonl-DmaNnhrx.js → session-jsonl-BYpdiKCU.js} +1 -1
- package/dist/ui/assets/{session-jsonl-9gKz-AVR.js → session-jsonl-Diyd-ZYN.js} +1 -1
- package/dist/ui/assets/{session-search-index-Di9Bd-h8.js → session-search-index-B_w76wFk.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-CZS9-z-U.js → setup-feature-flags-remote-CwmmuJrO.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-f5sDsrH4.js → setup-model-catalog-D8HWGphe.js} +1 -1
- package/dist/ui/assets/{signed-fetch-XVeKM2Ti.js → signed-fetch-BlNIbzYq.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-cyTtBzvQ.js → silent-renew-backoff-Bi9ipCVv.js} +1 -1
- package/dist/ui/assets/slicc-version-D2iu7XRa.js +1 -0
- package/dist/ui/assets/{snapshot-BjK1vO6N.js → snapshot-LUtmlYpd.js} +1 -1
- package/dist/ui/assets/{snapshot-features-DlnZzOsH.js → snapshot-features-BOJJbUaa.js} +1 -1
- package/dist/ui/assets/{soundscape-Mr88k6cc.js → soundscape-Cl0DF4_K.js} +1 -1
- package/dist/ui/assets/{speak-Cscd0BKG.js → speak-Z1ZmTtEq.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-C6JpaiSF.js → sprinkle-manager-COuXYZSS.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-SCt0TTBQ.js → sprinkle-renderer-IwLS2uY_.js} +1 -1
- package/dist/ui/assets/{state-BG2vLncn.js → state-BpKn94dl.js} +1 -1
- package/dist/ui/assets/{store-tnsLNVfM.js → store-C5SHHbCz.js} +1 -1
- package/dist/ui/assets/{store-BuxM7u4i.js → store-DdbW7p6y.js} +1 -1
- package/dist/ui/assets/{sudo-D-kr8T3t.js → sudo-CBJkBrpJ.js} +1 -1
- package/dist/ui/assets/{supervisor-VT-q91Bc.js → supervisor-ByYI0Upn.js} +1 -1
- package/dist/ui/assets/{sync-dialog-WPvxLKb3.js → sync-dialog-85siMVvT.js} +1 -1
- package/dist/ui/assets/{transformers-env-CgzLTJnY.js → transformers-env-DgQ3IKD3.js} +1 -1
- package/dist/ui/assets/{tray-leader-az_Ksbe-.js → tray-leader-BGYOanBE.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-7OydH3Nx.js → tray-leave-runtime-BaCYFuGP.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-CvnnbCd-.js → tray-sidecar-Iieo2qf6.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-Dl24TN6j.js → upgrade-detection-DQ7OirAw.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-B9YGLtpR.js → upskill-lick-skip-Hoc3WMTi.js} +1 -1
- package/dist/ui/assets/{voice-reply-BTBzo1t-.js → voice-reply-X94G-dKK.js} +1 -1
- package/dist/ui/assets/{wasm-programs-k6khOGzw.js → wasm-programs-DPZtEzCA.js} +1 -1
- package/dist/ui/assets/{wc-attach-BOQi3ieU.js → wc-attach-V_4H_OxZ.js} +2 -2
- package/dist/ui/assets/{wc-browser-BrrkBblB.js → wc-browser-D7bMtTLj.js} +1 -1
- package/dist/ui/assets/{wc-computers-B4GqHRtL.js → wc-computers-XEm14fbc.js} +1 -1
- package/dist/ui/assets/{wc-detached-BxCVikC_.js → wc-detached-CSMAyrSN.js} +1 -1
- package/dist/ui/assets/{wc-extension-mDPTv28u.js → wc-extension-iaUkDuXg.js} +2 -2
- package/dist/ui/assets/{wc-follower-CfNlcRHk.js → wc-follower-BEHsh3mm.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-CXignXZx.js → wc-follower-oauth-CI0yV23o.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-CVM1gC17.js → wc-gelatiere-DC6IySKW.js} +1 -1
- package/dist/ui/assets/{wc-live-_NBiyx3J.js → wc-live-Crkk0i2b.js} +5 -5
- package/dist/ui/assets/{wc-nav-CnD8Slg6.js → wc-nav-CpH9Voc6.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-BkJJiDEJ.js → wc-onboarding-B_PntcVD.js} +2 -2
- package/dist/ui/assets/{wc-permissions-DCIncKoG.js → wc-permissions-0ID7CTFI.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-sJbdGCLn.js → wc-placeholder-CrJY3QLl.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-Bq5Wqw8g.js → wc-secret-request-DvgNbWHA.js} +1 -1
- package/dist/ui/assets/{wc-settings-BTaQBsY7.js → wc-settings-EIloXSo4.js} +3 -3
- package/dist/ui/assets/{wc-shell-C8DQjqvF.js → wc-shell-BHYgEk9m.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-D-zXMNoN.js → wc-shortcut-config-BzI1aljk.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-B4WfcAW5.js → wc-sprinkles-9-5q5D8d.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-lifOC01N.js → wc-transcript-export-DjW02fth.js} +2 -2
- package/dist/ui/assets/{wc-tray-CwGnxnUW.js → wc-tray-D52kHx_6.js} +4 -4
- package/dist/ui/assets/welcome-detection-B-E6ut0P.js +1 -0
- package/dist/ui/assets/{whisper-session-DJmF3unQ.js → whisper-session-D_GqXe4z.js} +2 -2
- package/dist/ui/assets/{xai-grok-B0zLeZkh.js → xai-grok-C4HRfmMo.js} +1 -1
- package/dist/ui/assets/{xai-grok-3lm4P4we.js → xai-grok-D0haAMZM.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +2 -1
- package/dist/ui/assets/provider-store-access-BE0JQJTt.js +0 -1
- package/dist/ui/assets/provider-store-access-shPZ5Tzj.js +0 -1
- package/dist/ui/assets/slicc-version-HGp9X2HJ.js +0 -1
- package/dist/ui/assets/welcome-detection-DqF4hV8O.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-B3It6xQY.js";import{C as l,d as u,f as d,i as f,u as p}from"./account-store-D2Icce05.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-CoZ8jHud.js";import{t as ee}from"./runtime-env-DadgceZk.js";import{t as te}from"./slugify-BYJ6QVAt.js";import{n as ne,t as re}from"./host-command-Dn-Z4AbC.js";import{a as ie,i as ae,n as oe,r as se,t as ce}from"./snapshot-BjK1vO6N.js";import{i as le,r as y}from"./panel-rpc-DW7W4w6_.js";import{a as ue,c as de,n as fe,o as pe,s as me,t as he}from"./feature-flags-QlgHaQc1.js";import{t as ge}from"./providers-D3DLebm2.js";import{r as _e}from"./binary-cache-bSOhqXB1.js";import{i as ve,n as ye,r as be}from"./fetch-body-CuwTaJC_.js";import{s as xe,t as Se}from"./api-endpoint-D8lUKmPu.js";import{t as Ce}from"./compat-CGK4SwF8.js";import"./core-IQSnHO6h.js";import{n as we,t as Te}from"./mime-types-D7IV6i7k.js";import{n as Ee,t as De}from"./float-topology-DIH6ujZe.js";import{t as Oe}from"./secrets-bridge-client-EgBSROu5.js";import{a as ke,i as Ae,n as je,r as Me}from"./tool-ui-DRnUkp2g.js";import{a as Ne,i as Pe,n as b,t as x}from"./path-utils-DNJG-zQf.js";import{n as Fe,r as Ie,t as Le}from"./merge-file-core-VJlzucJY.js";import{r as Re}from"./workspace-mode-D0kUKBVS.js";import{n as ze,t as Be}from"./thinking-level-5x0UAu9N.js";import{n as Ve,t as He}from"./types-D8gIX-W-.js";import{i as Ue}from"./mount-index-CQfmUPuZ.js";import{a as We,i as Ge,n as Ke,o as qe,s as Je,t as Ye}from"./signed-fetch-XVeKM2Ti.js";import{o as Xe}from"./mount-table-store-DrF_Ifaz.js";import{t as Ze}from"./remote-cache-UwMD8EkX.js";import{n as Qe}from"./fs-BUsVEmsX.js";import{a as $e}from"./tray-leader-status-CpkFr6n7.js";import{n as et,t as tt}from"./slicc-version-HGp9X2HJ.js";import{a as nt,i as rt,o as it,r as S,t as at}from"./browser-Jlk38XAj.js";import{t as C}from"./subcommand-flags-BZi7j78Q.js";import{n as ot,r as st,t as w}from"./subcommand-help-CgO7wRS5.js";import{n as ct}from"./cost-command-C_1fldSP.js";import{d as lt,g as ut,i as dt,n as ft,o as pt}from"./sudoers-BdBYQPUn.js";import{n as mt}from"./types-Dj5TU-Qg.js";import{n as ht,r as gt,t as _t}from"./approval-timeout-CeQbGMnv.js";import{a as vt,c as yt,i as bt,l as xt,n as St,o as Ct,r as wt,t as Tt}from"./types-JfhqX7lD.js";import{n as T,t as Et}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Dt}from"./html-B_Hg2WOy.js";import{n as Ot}from"./llm-session-id-BZyXP_j2.js";import{t as kt}from"./src-CUSndb9K.js";import{i as At,o as jt}from"./browser-DuyhpHbR.js";import{a as Mt,c as Nt,n as Pt,o as Ft,r as It,s as Lt,t as Rt}from"./reason-l_1I9RdR.js";import{i as zt,r as Bt,t as Vt}from"./mount-picker-popup-BMils9JY.js";import{t as Ht}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Ut,B as E,C as Wt,D,E as Gt,F as Kt,G as qt,H as O,I as k,J as Jt,K as Yt,L as Xt,M as Zt,N as Qt,O as $t,P as en,R as tn,S as nn,T as rn,U as an,V as on,W as sn,Y as cn,_ as ln,a as un,b as dn,c as fn,d as pn,f as mn,g as hn,h as gn,i as _n,j as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as A,q as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn,z as Nn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{S as Pn,_ as Fn,a as In,b as Ln,c as Rn,d as zn,f as Bn,g as Vn,h as Hn,i as Un,l as Wn,n as Gn,o as Kn,p as qn,r as Jn,s as Yn,t as Xn,u as Zn,v as j,x as M,y as Qn}from"./state-BG2vLncn.js";import{a as $n,i as er,r as tr,t as nr}from"./git-config-Bdgu8kD2.js";import{i as rr,m as ir,r as ar}from"./stdio-tty-CA5sZxWL.js";import{i as or,r as sr}from"./global-prefix-DqCuANmV.js";import{t as cr}from"./wasm-programs-k6khOGzw.js";import{a as lr,n as ur,o as dr,r as fr,s as pr}from"./jsh-discovery-CnvNKojr.js";import{C as mr,a as hr,b as gr,c as _r,d as vr,f as yr,h as br,i as xr,l as Sr,m as Cr,n as wr,o as Tr,p as Er,r as Dr,s as Or,t as N,u as kr,v as Ar,y as jr}from"./shared-D-ZRFYou.js";import{_ as Mr,a as Nr,b as Pr,d as Fr,f as Ir,g as Lr,h as Rr,i as zr,l as Br,m as Vr,p as Hr,r as Ur,s as Wr,u as Gr,v as Kr,x as qr,y as Jr}from"./require-guards-CMPvNDQg.js";import{_ as Yr,a as Xr,b as Zr,c as Qr,d as $r,f as ei,g as ti,h as ni,l as ri,m as ii,n as ai,p as oi,s as si,t as ci,u as li,v as ui,x as di,y as fi}from"./jsh-executor-B7mIy4Lh.js";import{n as pi,t as mi}from"./esbuild-wasm-DeTghvWH.js";import{n as hi}from"./wasm-compiler-Ct7QZURL.js";import{a as gi,o as _i,s as vi,t as yi}from"./usb-device-registry-DFzxaOky.js";import{a as P,i as bi,r as xi,t as Si}from"./just-bash-compat-B-SPHuh_.js";import{i as Ci,r as wi,t as Ti}from"./script-catalog-B5BTq3Ma.js";import{a as Ei,c as Di,o as Oi,s as ki,t as Ai}from"./types-Dzr0qYl3.js";import{a as ji,c as Mi,d as Ni,f as Pi,n as Fi,r as Ii,u as Li}from"./github-zip-fry304hI.js";import{i as Ri,t as zi}from"./github-auth-DXJer3bD.js";import{a as Bi,i as Vi,o as Hi,r as Ui,t as Wi}from"./provenance-DdmsQ3Nr.js";import{a as Gi,c as Ki,i as qi,n as Ji,o as Yi,r as Xi,s as Zi}from"./github-install-7a9uVd3W.js";import{n as Qi,t as $i}from"./magick-wasm-BbnwhVj1.js";import{i as ea,n as ta,r as na,t as ra}from"./pdf-raster-BWk6ezTX.js";import{n as ia}from"./lick-target-env-8JxfVcIV.js";import{t as aa}from"./tmpdir-env-ate4iNcK.js";import{n as oa,t as sa}from"./hf-defaults-BwJdGLgk.js";import{t as ca}from"./ffmpeg-wasm-sx-3yVAE.js";import{t as la}from"./local-llm-CqCsqzYy.js";import{i as ua,n as da,r as fa,t as pa}from"./tar-BWIPCxI2.js";import{a as ma,c as ha,i as ga,o as _a,r as va,s as ya}from"./v86-vm-DCm7zA2r.js";import{n as ba,r as xa}from"./lick-urls-CgPiVwD-.js";let Sa=null;function Ca(e){Sa=e!==null&&Number.isFinite(e)&&e>0?e:null}function wa(){if(Sa!==null)return Sa;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Ta=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ea(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Ta.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 Da(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 Oa(e,t){return e.some(e=>Da(e,t))}const ka=`slicc-transcript`,Aa=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],ja=new Set(`/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Ma(e){return ja.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Na=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Pa=new Set(Aa),Fa=/^[0-9a-fA-F]{64}$/,Ia=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function La(e){return typeof e==`string`&&Fa.test(e)}function Ra(e){return Ia.test(e)&&Number.isFinite(Date.parse(e))}function za(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 Ba(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:za(n,t)}:{ok:!0}}function Va(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 Ha(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 Ua(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ba(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ha(e,t):n}function Wa(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 Ga(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 Ka(e,t){let n=Wa(e,t);if(!n.ok)return n;let r=e.cost;return F(r)?Ga(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function qa(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`?Ra(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 Ja(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 Ya(e,t){let n=e.usage;return n===void 0?{ok:!0}:F(n)?Ka(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function Xa(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ba(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=Ja(e,t);if(!n.ok)return n}let r=qa(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=Va(i,Ua,`${t}.content`);return a.ok?Ya(e,t):a}function Za(e,t){if(!F(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=Ba(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Va(r,Xa,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function Qa(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 $a(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`}:La(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 eo=[`attachment-file-missing`,`attachment-association-unavailable`];function to(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ba(e.missingReason,eo,`${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 no(e,t){return e.present?$a(e,t):to(e,t)}function ro(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Qa(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=Ba(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?no(e,t):r}function io(e,t){let n=Ba(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 ao(e,t){if(!F(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=Ba(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return F(r)?io(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function oo(e,t){return F(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 so(e,t){return typeof e!=`string`||!Pa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function co(e){if(!F(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 F(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 lo(e){if(!F(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ba(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Va(e.missing,so,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function uo(e){if(!F(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=Ba(e.state,[`active`,`frozen`],`session.state`);return t.ok?lo(e.completeness):t}function fo(e){if(!F(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(!F(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?Va(n,ao,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function po(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Va(t,Za,`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=Va(r,oo,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Va(a,ro,`attachments`):{ok:!1,error:`attachments must be an array`}}function mo(e){let t=new Set,n=new Set;for(let r of e){if(!F(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(!(!F(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 ho(e){for(let t of e){if(!F(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(!F(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 go(e){let t=[];for(let n of e){if(!F(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)F(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function _o(e){let t=new Set;for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of go(e))t.add(n)}return t}function vo(e,t){for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!F(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 yo(e){return vo(e,_o(e))}function bo(e,t){for(let n of e){if(!F(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 xo(e,t){for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!F(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=bo(e,t);if(!r.ok)return r}}return{ok:!0}}function So(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return xo(e,n)}function Co(e){let t=new Map;for(let n of e){if(!F(n)||typeof n.id!=`string`)continue;let e=new Set,r=n.messages;if(Array.isArray(r))for(let t of r)F(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function wo(e,t){let n=Co(t);for(let t=0;t<e.length;t++){let r=e[t];if(!F(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 To(e){let t=new Map;for(let n of e){if(!F(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(go(e)))}return t}function Eo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!F(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 Do(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return Eo(e,n,To(t))}function Oo(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 ko(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!F(r))continue;let i=r.target;if(!F(i))continue;let a=Oo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Ao(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=mo(t);if(!o.ok)return o;let s=ho(t);if(!s.ok)return s;let c=yo(t);if(!c.ok)return c;let l=So(t,n);if(!l.ok)return l;let u=wo(n,t);if(!u.ok)return u;let d=Do(r,t);return d.ok?ko(a,n):d}function jo(e){let t=po(e);return t.ok?Ao(e):t}function Mo(e){if(!F(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=co(e.export);if(!t.ok)return t;let n=uo(e.session);if(!n.ok)return n;let r=fo(e.privacy);return r.ok?jo(e):r}async function No(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:qe});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:Po(a),sourceUrl:a}}function Po(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Fo=`slicc-sprinkle-routes`;function Io(){try{let e=localStorage.getItem(Fo);return e?JSON.parse(e):{}}catch{return{}}}function Lo(e){try{localStorage.setItem(Fo,JSON.stringify(e))}catch{}}function Ro(e){return Io()[e]}function zo(e,t){let n=Io();n[e]=t,Lo(n)}function Bo(e){let t=Io();delete t[e],Lo(t)}function Vo(){return Io()}function Ho(e,t,n){return yt(t,n,`${e} adapter does not implement ${t}.${n}`)}function Uo(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(Ho(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Wo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Uo(t,`browser`,St,e.browser),network:Uo(t,`network`,vt,e.network),secrets:Uo(t,`secrets`,Ct,e.secrets),devices:Uo(t,`devices`,wt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Uo(t,`mounts`,bt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Uo(t,`approvals`,Tt,e.approvals)}}function Go(e={}){return Wo({adapter:`connect`,pageGestures:e.pageGestures})}function Ko(e){let t=Et(()=>import(`./extension-ops-Ded2__AC.js`).then(t=>t.createExtensionOps(e)));return Wo({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>T(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>T(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>T(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>T(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>T(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>T(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>T(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function qo(e={}){let t=Et(()=>import(`./rest-ops-DyAkn44S.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Wo({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>T(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>T(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>T(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>T(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>T(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>T(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>T(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function Jo(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return qo({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Ko({adapter:e,pageGestures:n});case`connect`:return Go({pageGestures:n})}}const Yo=e(`quick-llm`);async function Xo(e){let t=f();if(!t)return Yo.debug(`No API key for active provider — skipping`),null;let n=d(),r=u(),i;if(i=e.modelId?es(n,e.modelId)??es(n,r):Zo(n,r),!i)return Yo.debug(`No model available for provider`,{providerId:n}),null;let a={role:`user`,content:e.prompt,timestamp:Date.now()},o={};i.provider===`adobe`&&(o[`X-Session-Id`]=ts());try{let n=(await Ce(i,{systemPrompt:e.system,messages:[a]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(o).length>0?o:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return Yo.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function Zo(e,t){let n=p(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=$o(r.id),a=n.filter(e=>Qo(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function Qo(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 $o(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 es(e,t){return p(e).find(e=>e.id===t)}function ts(){return Ot(`ui-quick-llm`)}const ns=e(`sudo-suggest`),rs=[`You generalize a single shell command into a minimal glob pattern for an`,`allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,`,`no backticks. Keep the leading command/sub-command verbatim and replace only`,`the volatile tail (args, paths, refs) with a single trailing "*".`,`Examples:`,` git push origin main -> git push*`,` rm -rf build/cache -> rm -rf*`,` npm install left-pad -> npm install*`].join(`
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-B3It6xQY.js";import{C as l,d as u,f as d,i as f,u as p}from"./account-store-_i7awS4-.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-CoZ8jHud.js";import{t as ee}from"./runtime-env-DadgceZk.js";import{t as te}from"./slugify-BYJ6QVAt.js";import{n as ne,t as re}from"./host-command-Dn-Z4AbC.js";import{a as ie,i as ae,n as oe,r as se,t as ce}from"./snapshot-LUtmlYpd.js";import{i as le,r as y}from"./panel-rpc-DW7W4w6_.js";import{a as ue,c as de,n as fe,o as pe,s as me,t as he}from"./feature-flags-QlgHaQc1.js";import{t as ge}from"./providers-DoeOUxXB.js";import{r as _e}from"./binary-cache-bSOhqXB1.js";import{i as ve,n as ye,r as be}from"./fetch-body-CuwTaJC_.js";import{s as xe,t as Se}from"./api-endpoint-D8lUKmPu.js";import{t as Ce}from"./compat-CGK4SwF8.js";import"./core-IQSnHO6h.js";import{n as we,t as Te}from"./mime-types-D7IV6i7k.js";import{n as Ee,t as De}from"./float-topology-DIH6ujZe.js";import{t as Oe}from"./secrets-bridge-client-EgBSROu5.js";import{a as ke,i as Ae,n as je,r as Me}from"./tool-ui-DRnUkp2g.js";import{a as Ne,i as Pe,n as b,t as x}from"./path-utils-DNJG-zQf.js";import{n as Fe,r as Ie,t as Le}from"./merge-file-core-VJlzucJY.js";import{r as Re}from"./workspace-mode-D0kUKBVS.js";import{n as ze,t as Be}from"./thinking-level-5x0UAu9N.js";import{n as Ve,t as He}from"./types-D8gIX-W-.js";import{i as Ue}from"./mount-index-CQfmUPuZ.js";import{a as We,i as Ge,n as Ke,o as qe,s as Je,t as Ye}from"./signed-fetch-BlNIbzYq.js";import{o as Xe}from"./mount-table-store-DrF_Ifaz.js";import{t as Ze}from"./remote-cache-UwMD8EkX.js";import{n as Qe}from"./fs-BCL8Htu-.js";import{a as $e}from"./tray-leader-status-CpkFr6n7.js";import{n as et,t as tt}from"./slicc-version-D2iu7XRa.js";import{a as nt,i as rt,o as it,r as S,t as at}from"./browser-Jlk38XAj.js";import{t as C}from"./subcommand-flags-BZi7j78Q.js";import{n as ot,r as st,t as w}from"./subcommand-help-CgO7wRS5.js";import{n as ct}from"./cost-command-C_1fldSP.js";import{d as lt,g as ut,i as dt,n as ft,o as pt}from"./sudoers-BdBYQPUn.js";import{n as mt}from"./types-Dj5TU-Qg.js";import{n as ht,r as gt,t as _t}from"./approval-timeout-CeQbGMnv.js";import{a as vt,c as yt,i as bt,l as xt,n as St,o as Ct,r as wt,t as Tt}from"./types-JfhqX7lD.js";import{n as T,t as Et}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Dt}from"./html-B_Hg2WOy.js";import{n as Ot}from"./llm-session-id-BZyXP_j2.js";import{t as kt}from"./src-CUSndb9K.js";import{i as At,o as jt}from"./browser-DuyhpHbR.js";import{a as Mt,c as Nt,n as Pt,o as Ft,r as It,s as Lt,t as Rt}from"./reason-l_1I9RdR.js";import{i as zt,r as Bt,t as Vt}from"./mount-picker-popup-BMils9JY.js";import{t as Ht}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Ut,B as E,C as Wt,D,E as Gt,F as Kt,G as qt,H as O,I as k,J as Jt,K as Yt,L as Xt,M as Zt,N as Qt,O as $t,P as en,R as tn,S as nn,T as rn,U as an,V as on,W as sn,Y as cn,_ as ln,a as un,b as dn,c as fn,d as pn,f as mn,g as hn,h as gn,i as _n,j as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as A,q as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn,z as Nn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{S as Pn,_ as Fn,a as In,b as Ln,c as Rn,d as zn,f as Bn,g as Vn,h as Hn,i as Un,l as Wn,n as Gn,o as Kn,p as qn,r as Jn,s as Yn,t as Xn,u as Zn,v as j,x as M,y as Qn}from"./state-BpKn94dl.js";import{a as $n,i as er,r as tr,t as nr}from"./git-config-Bdgu8kD2.js";import{i as rr,m as ir,r as ar}from"./stdio-tty-CA5sZxWL.js";import{i as or,r as sr}from"./global-prefix-DqCuANmV.js";import{t as cr}from"./wasm-programs-DPZtEzCA.js";import{a as lr,n as ur,o as dr,r as fr,s as pr}from"./jsh-discovery-CnvNKojr.js";import{C as mr,a as hr,b as gr,c as _r,d as vr,f as yr,h as br,i as xr,l as Sr,m as Cr,n as wr,o as Tr,p as Er,r as Dr,s as Or,t as N,u as kr,v as Ar,y as jr}from"./shared-D-ZRFYou.js";import{_ as Mr,a as Nr,b as Pr,d as Fr,f as Ir,g as Lr,h as Rr,i as zr,l as Br,m as Vr,p as Hr,r as Ur,s as Wr,u as Gr,v as Kr,x as qr,y as Jr}from"./require-guards-CMPvNDQg.js";import{_ as Yr,a as Xr,b as Zr,c as Qr,d as $r,f as ei,g as ti,h as ni,l as ri,m as ii,n as ai,p as oi,s as si,t as ci,u as li,v as ui,x as di,y as fi}from"./jsh-executor-aRNcFqMp.js";import{n as pi,t as mi}from"./esbuild-wasm-DeTghvWH.js";import{n as hi}from"./wasm-compiler-Ct7QZURL.js";import{a as gi,o as _i,s as vi,t as yi}from"./usb-device-registry-DFzxaOky.js";import{a as P,i as bi,r as xi,t as Si}from"./just-bash-compat-B-SPHuh_.js";import{i as Ci,r as wi,t as Ti}from"./script-catalog-CqkljCRS.js";import{a as Ei,c as Di,o as Oi,s as ki,t as Ai}from"./types-Dzr0qYl3.js";import{a as ji,c as Mi,d as Ni,f as Pi,n as Fi,r as Ii,u as Li}from"./github-zip-Byubjm5A.js";import{i as Ri,t as zi}from"./github-auth-Q0I6yeh8.js";import{a as Bi,i as Vi,o as Hi,r as Ui,t as Wi}from"./provenance-DdmsQ3Nr.js";import{a as Gi,c as Ki,i as qi,n as Ji,o as Yi,r as Xi,s as Zi}from"./github-install-Cs4wWfEZ.js";import{n as Qi,t as $i}from"./magick-wasm-BbnwhVj1.js";import{i as ea,n as ta,r as na,t as ra}from"./pdf-raster-BWk6ezTX.js";import{n as ia}from"./lick-target-env-8JxfVcIV.js";import{t as aa}from"./tmpdir-env-ate4iNcK.js";import{n as oa,t as sa}from"./hf-defaults-BwJdGLgk.js";import{t as ca}from"./ffmpeg-wasm-sx-3yVAE.js";import{t as la}from"./local-llm-DVdX5889.js";import{i as ua,n as da,r as fa,t as pa}from"./tar-BWIPCxI2.js";import{a as ma,c as ha,i as ga,o as _a,r as va,s as ya}from"./v86-vm-DCm7zA2r.js";import{n as ba,r as xa}from"./lick-urls-CgPiVwD-.js";let Sa=null;function Ca(e){Sa=e!==null&&Number.isFinite(e)&&e>0?e:null}function wa(){if(Sa!==null)return Sa;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Ta=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Ea(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Ta.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 Da(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 Oa(e,t){return e.some(e=>Da(e,t))}const ka=`slicc-transcript`,Aa=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],ja=new Set(`/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Ma(e){return ja.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Na=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Pa=new Set(Aa),Fa=/^[0-9a-fA-F]{64}$/,Ia=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function La(e){return typeof e==`string`&&Fa.test(e)}function Ra(e){return Ia.test(e)&&Number.isFinite(Date.parse(e))}function za(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 Ba(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:za(n,t)}:{ok:!0}}function Va(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 Ha(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 Ua(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ba(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ha(e,t):n}function Wa(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 Ga(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 Ka(e,t){let n=Wa(e,t);if(!n.ok)return n;let r=e.cost;return F(r)?Ga(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function qa(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`?Ra(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 Ja(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 Ya(e,t){let n=e.usage;return n===void 0?{ok:!0}:F(n)?Ka(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function Xa(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ba(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=Ja(e,t);if(!n.ok)return n}let r=qa(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=Va(i,Ua,`${t}.content`);return a.ok?Ya(e,t):a}function Za(e,t){if(!F(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=Ba(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Va(r,Xa,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function Qa(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 $a(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`}:La(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 eo=[`attachment-file-missing`,`attachment-association-unavailable`];function to(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ba(e.missingReason,eo,`${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 no(e,t){return e.present?$a(e,t):to(e,t)}function ro(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Qa(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=Ba(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?no(e,t):r}function io(e,t){let n=Ba(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 ao(e,t){if(!F(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=Ba(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return F(r)?io(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function oo(e,t){return F(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 so(e,t){return typeof e!=`string`||!Pa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function co(e){if(!F(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 F(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 lo(e){if(!F(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ba(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Va(e.missing,so,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function uo(e){if(!F(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=Ba(e.state,[`active`,`frozen`],`session.state`);return t.ok?lo(e.completeness):t}function fo(e){if(!F(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(!F(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?Va(n,ao,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function po(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Va(t,Za,`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=Va(r,oo,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Va(a,ro,`attachments`):{ok:!1,error:`attachments must be an array`}}function mo(e){let t=new Set,n=new Set;for(let r of e){if(!F(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(!(!F(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 ho(e){for(let t of e){if(!F(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(!F(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 go(e){let t=[];for(let n of e){if(!F(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)F(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function _o(e){let t=new Set;for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of go(e))t.add(n)}return t}function vo(e,t){for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!F(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 yo(e){return vo(e,_o(e))}function bo(e,t){for(let n of e){if(!F(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 xo(e,t){for(let n of e){if(!F(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!F(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=bo(e,t);if(!r.ok)return r}}return{ok:!0}}function So(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return xo(e,n)}function Co(e){let t=new Map;for(let n of e){if(!F(n)||typeof n.id!=`string`)continue;let e=new Set,r=n.messages;if(Array.isArray(r))for(let t of r)F(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function wo(e,t){let n=Co(t);for(let t=0;t<e.length;t++){let r=e[t];if(!F(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 To(e){let t=new Map;for(let n of e){if(!F(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(go(e)))}return t}function Eo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!F(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 Do(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return Eo(e,n,To(t))}function Oo(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 ko(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!F(r))continue;let i=r.target;if(!F(i))continue;let a=Oo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Ao(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=mo(t);if(!o.ok)return o;let s=ho(t);if(!s.ok)return s;let c=yo(t);if(!c.ok)return c;let l=So(t,n);if(!l.ok)return l;let u=wo(n,t);if(!u.ok)return u;let d=Do(r,t);return d.ok?ko(a,n):d}function jo(e){let t=po(e);return t.ok?Ao(e):t}function Mo(e){if(!F(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=co(e.export);if(!t.ok)return t;let n=uo(e.session);if(!n.ok)return n;let r=fo(e.privacy);return r.ok?jo(e):r}async function No(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:qe});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:Po(a),sourceUrl:a}}function Po(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Fo=`slicc-sprinkle-routes`;function Io(){try{let e=localStorage.getItem(Fo);return e?JSON.parse(e):{}}catch{return{}}}function Lo(e){try{localStorage.setItem(Fo,JSON.stringify(e))}catch{}}function Ro(e){return Io()[e]}function zo(e,t){let n=Io();n[e]=t,Lo(n)}function Bo(e){let t=Io();delete t[e],Lo(t)}function Vo(){return Io()}function Ho(e,t,n){return yt(t,n,`${e} adapter does not implement ${t}.${n}`)}function Uo(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(Ho(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Wo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Uo(t,`browser`,St,e.browser),network:Uo(t,`network`,vt,e.network),secrets:Uo(t,`secrets`,Ct,e.secrets),devices:Uo(t,`devices`,wt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Uo(t,`mounts`,bt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Uo(t,`approvals`,Tt,e.approvals)}}function Go(e={}){return Wo({adapter:`connect`,pageGestures:e.pageGestures})}function Ko(e){let t=Et(()=>import(`./extension-ops-Ded2__AC.js`).then(t=>t.createExtensionOps(e)));return Wo({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>T(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>T(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>T(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>T(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>T(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>T(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>T(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function qo(e={}){let t=Et(()=>import(`./rest-ops-DyAkn44S.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Wo({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>T(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>T(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>T(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>T(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>T(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>T(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>T(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function Jo(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return qo({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Ko({adapter:e,pageGestures:n});case`connect`:return Go({pageGestures:n})}}const Yo=e(`quick-llm`);async function Xo(e){let t=f();if(!t)return Yo.debug(`No API key for active provider — skipping`),null;let n=d(),r=u(),i;if(i=e.modelId?es(n,e.modelId)??es(n,r):Zo(n,r),!i)return Yo.debug(`No model available for provider`,{providerId:n}),null;let a={role:`user`,content:e.prompt,timestamp:Date.now()},o={};i.provider===`adobe`&&(o[`X-Session-Id`]=ts());try{let n=(await Ce(i,{systemPrompt:e.system,messages:[a]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(o).length>0?o:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return Yo.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function Zo(e,t){let n=p(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=$o(r.id),a=n.filter(e=>Qo(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function Qo(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 $o(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 es(e,t){return p(e).find(e=>e.id===t)}function ts(){return Ot(`ui-quick-llm`)}const ns=e(`sudo-suggest`),rs=[`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
|
`),is=[`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 as(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`?rs:is,i=null;try{i=await Xo({prompt:n,system:r,maxTokens:40,temperature:0,signal:t})}catch(e){ns.debug(`suggestPattern: quickLabel threw`,{error:e instanceof Error?e.message:String(e)}),i=null}return os(i)||n}function os(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 ss=e(`sudo:capability-gesture`);function cs(e,t={}){let n=t.suggest??as;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 ss.warn(`sudo approval aborted before prompting — denying`,{detail:t.detail}),mt();if(!e)return ss.warn(`no CapabilityBroker injected for the sudo gesture hop — denying (composition bug, never a guessed transport)`,{detail:t.detail}),mt();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?xt(o.value,a):(ss.warn(`capability broker approvals.request failed — denying`,{message:o.message}),mt())}}}const ls=e(`sudo:tray-first`);function us(e,t={}){let n=t.suggest??as,r=t.timeoutMs??6e5,i=t.getClient??(async()=>{let{getPanelRpcClient:e}=await import(`./panel-rpc-DW7W4w6_.js`).then(e=>e.a);return e()});return{async requestApproval(t,a){if(a?.signal?.aborted)return mt();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){ls.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 fs(e?.decision,o)}catch(e){ls.warn(`tray-first sudo probe failed — using native broker`,{error:e instanceof Error?e.message:String(e)})}return e.requestApproval(s,a)}}}const ds=[`user-timeout`,`cone-timeout`,`unavailable`];function fs(e,t){if(!e||typeof e!=`object`)return mt();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 mt();let i=ds.find(e=>e===n.reason);return i?{decision:`deny`,reason:i}:{decision:`deny`}}function ps(e,t){return{requestApproval(n){return t.enqueueSudoRequest(e,n)}}}function ms(){return`lick-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var hs=class{pending=new Map;timeoutMs;newId;setTimer;clearTimer;onAutoSettle;constructor(e={}){this.timeoutMs=e.timeoutMs??3e5,this.newId=e.newId??ms,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(ht(`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 gs(e){return gt(_s(e))}function _s(e){let t=cs(e);return e?.adapter===`extension-direct`||e?.adapter===`extension-delegate`?t:us(t)}let vs=null;function ys(e){return vs=e,()=>{vs===e&&(vs=null)}}function bs(){if(!vs)throw new Na(`session-not-found`);return vs}const xs=`focus`,Ss={type:`leaf`,surfaceId:`chat`};function Cs(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 ws={focus:{name:`focus`,tree:Cs({left:Ss},{left:3,middle:1})}};function Ts(e){return ws[e]??null}const Es=`progress`;async function Ds(){try{let e=await Bt();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 Vt(e.idbKey);if(!t)throw Error(`mount: no directory handle found in storage`);return await zt(t),t}throw Error(`mount: unexpected popup result`)}catch(e){throw Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}async function Os(){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 ks(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 Vt(r.idbKey);if(!i)throw Error(`no directory handle found in storage`);return await zt(i),i}function As(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 js(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 Ms=new Set([`--source`,`--profile`,`--backend`,`--max-body-mb`]);function Ns(e){for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`)return!1;if(n===`--help`||n===`-h`)return!0;Ms.has(n)&&t++}return!1}function Ps(e){return`aem://${e.org}/${e.name}${e.path?`/${e.path}`:``}`}var Fs=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=As(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=ke();if(!n){let n=await Is(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=le()?null:y(),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=ee()?await Ds():r?await ks(r,e):await Os();let a=Ue.fromHandle(i,{mountId:Xe()});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=Xe(),i=new Ze({mountId:r,ttlMs:3e4}),a=new Ge({source:t.source,profile:n,cache:i,maxBodyBytes:t.maxBodyMb?t.maxBodyMb*1024*1024:void 0,mountId:r,signedFetch:this.signedFetchS3??Ke(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??Ye(),i=js(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 No(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=Xe(),c=new Ze({mountId:s,ttlMs:3e4}),l={source:a===`aem`?Ps(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 Je(l):new We(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(Ns(e))return n===`umount`?this.umountHelp():this.help();let r=As(e);if(r.positional.length===0)return{stdout:``,stderr:`${n}: path required\n`,exitCode:1};let i=this.resolvePath(r.positional[0],t);try{let e,t;if(r.clearCache){let{getAllMountEntries:n}=await import(`./mount-table-store-DrF_Ifaz.js`).then(e=>e.r),r=(await n()).find(e=>e.targetPath===i),a=r?.descriptor.kind;r&&(a===`s3`||a===`da`||a===`aem`)&&(e=r.descriptor.mountId,t=r.descriptor.kind)}await this.options.fs.unmount(i);let n=``;if(r.clearCache&&e&&t){let{RemoteMountCache:t}=await import(`./remote-cache-UwMD8EkX.js`).then(e=>e.n);await new t({mountId:e,ttlMs:3e4}).clearMount(),n=` (cache cleared)`}else r.clearCache&&(n=` (no remote cache to clear)`);return{stdout:`Unmounted ${i}${n}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`${n}: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}async handleList(){try{let e=this.options.fs.listMounts();if(e.length===0)return{stdout:`No active mounts
|
|
@@ -287,7 +287,7 @@ Examples:
|
|
|
287
287
|
skill list
|
|
288
288
|
skill info bluebubbles
|
|
289
289
|
skill read bluebubbles
|
|
290
|
-
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-
|
|
290
|
+
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-DOvbZc-9.js`).then(e=>e.r);try{switch(r){case`list`:return kh(t,e,i,n.env.get(`PATH`));case`info`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: info requires a skill name
|
|
291
291
|
`,exitCode:1};let r=await i.getSkillInfo(e,n);return r?{stdout:Dh(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
|
|
292
292
|
`,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+`
|
|
293
293
|
`,stderr:``,exitCode:0}}default:return{stdout:``,stderr:`skill: unknown command "${r}"\n`,exitCode:1}}}catch(e){return{stdout:``,stderr:`skill: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}const jh=[{names:[`--branch`,`-b`],validate:e=>!e.startsWith(`-`)&&i(e),error:`upskill: --branch must be a git ref of [A-Za-z0-9._/-]+ with no "..", leading "-"/"/", trailing "/" or ".lock", or shell metacharacters`,apply:(e,t)=>{e.branch=t}},{names:[`--from`],validate:e=>qi(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 Mh(e){let t={skills:[],dryRun:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n],i=jh.find(e=>e.names.includes(r));if(i){let r=e[++n];if(!r||!i.validate(r))return t.error=i.error,t;i.apply(t,r)}else if(r===`--dry-run`||r===`-n`)t.dryRun=!0;else if(r===`--json`)t.json=!0;else if(r.startsWith(`-`))return t.error=`upskill: unknown option "${r}" for update`,t;else t.skills.push(r)}return t}function Nh(e,t){return!e||!t||e.byteLength!==t.byteLength?!1:e.every((e,n)=>e===t[n])}async function Ph(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 Fh(e,t,n,r){let i=await Ph(e,t);return Ni(n)?i?{status:`kept-local`,write:!1}:{status:`added`,write:!0}:i?Nh(i,r)?{status:`unchanged`,write:!1}:{status:`updated`,write:!0}:{status:`added`,write:!0}}async function Ih(e,t,n,r){let i={changes:[],writes:[],removals:[]};for(let[r,a]of n){let n=`${t}/${r}`,{status:o,write:s}=await Fh(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 Pi(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 Lh(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 zi(t),d=await Vi(s,c,o.ref,u,!0,l||void 0);if(d&&r.sha===d&&await Rh(e,n,r))return{...o,to:d,outcome:`current`,changes:[]};let f=await zh(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 Ih(e,`${Ei}/${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 Wh(e,{changes:h,writes:g,removals:_}),await Hi(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 Rh(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 zh(e,t,n,r,i,a,o){let s=await Ii(e,t,a,i??`main`);if(s.status===`ok`){let i=ji(s.files),a=n||Bh(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:Uh(i,a),path:a}}try{return{files:Hh(Vh(await Fi(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 Bh(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 Vh(e){return new Map([...e].filter(([e])=>Mi(e)))}function Hh(e){return new Map([...e].sort(([e],[t])=>e.localeCompare(t)))}function Uh(e,t){let n=t?`${t}/`:``,r=new Map;for(let[t,i]of Object.entries(e)){if(!t.startsWith(n)||t.endsWith(`/`))continue;let e=t.slice(n.length);Mi(e)&&r.set(e,i)}return Hh(r)}async function Wh(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 Gh(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 Sh(o,s,t);if(!c.ok)return{...a,outcome:`error`,error:c.error};let l=`${Ei}/${n}/SKILL.md`,u=await Ph(e,l),d=new TextEncoder().encode(c.content),f=u!==void 0&&bh(new TextDecoder().decode(u))===bh(c.content);if(Nh(u,d)||f)return{...a,changes:[{path:`SKILL.md`,status:`unchanged`}]};let p=u?`updated`:`added`;return i||(await e.mkdir(`${Ei}/${n}`,{recursive:!0}),await e.writeFile(l,d),await Hi(e,n,{...r,files:[`SKILL.md`]})),{...a,outcome:`updated`,changes:[{path:`SKILL.md`,status:p}]}}function Kh(e,t){if(e.outcome===`error`)return` ${e.skill}: failed — ${e.error}\n`;let n=new Map;for(let t of e.changes)n.set(t.status,(n.get(t.status)??0)+1);let r=e.to&&e.to!==e.from?` → ${e.to.slice(0,7)}`:``;if(e.outcome===`current`)return` ${e.skill}: already current (${e.source}${r})\n`;let i=t?`would update`:`updated`,a=` ${e.skill}: ${i} from ${e.source}${r}\n`;for(let t of e.changes)t.status!==`unchanged`&&(a+=` ${t.status.padEnd(10)} ${t.path}\n`);let o=n.get(`kept-local`)??0;return o>0&&(a+=` (${o} kept-local — dotfiles and local additions are never touched)\n`),a}function qh(e,t,n,r){let i=qi(t);return i?{version:1,kind:`github`,source:`${i.owner}/${i.repo}`,skill:e,ref:r??i.branch,path:n??i.path,installed:new Date().toISOString()}:null}async function Jh(e,t,n){if(t.length===0){let t=await Bi(e);return{targets:t.provenanced,missing:[],skipped:t.unattributed}}let r=[],i=[];for(let a of t){let t=await Ui(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?qh(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 Yh(e){return e.reason===`not-installed`?`upskill: no skill named "${e.name}" is installed — check \`upskill list\`
|
|
@@ -298,7 +298,7 @@ Examples:
|
|
|
298
298
|
`}function Qh(e,t,n,r,i){let a=t?`Skill update (dry run — nothing written):
|
|
299
299
|
`:`Skill update:
|
|
300
300
|
`;for(let n of e)a+=Kh(n,t);if(i.length>0&&(a+=Zh(i)),!n&&r&&e.length>0){let n=i.length>0?`all ${Xh(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 $h(e,t,n){let{targets:r,missing:i,skipped:a}=await Jh(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 Gh(e,t,i.name,i.provenance,n.dryRun):await Lh(e,t,i.name,i.provenance,n.branch,n.dryRun));return{results:o,skipped:a,missing:i}}async function eg(e,t,n){let r=Mh(e);if(r.error)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{results:i,missing:a,skipped:o}=await $h(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`:Qh([],r.dryRun,!1,!0,o),stderr:``,exitCode:0}:{stdout:``,stderr:a.length?a.map(Yh).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 Ki();let l=a.map(Yh).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:Qh(i,r.dryRun,c,u,o),stderr:l,exitCode:+!u}}function tg(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 ng(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 rg(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}${ng(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(`
|
|
301
|
-
`)}\n`}async function ig(e,t,n){let r=await(await import(`./kernel-worker-
|
|
301
|
+
`)}\n`}async function ig(e,t,n){let r=await(await import(`./kernel-worker-DOvbZc-9.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await fr(e,lr(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${wh()}`,stderr:``,exitCode:0}:{...pr(`upskill`,Eh(r,`Discoverable local skills`),i,{builtinNames:new Set(it())}),exitCode:0}}async function ag(e,t,n){let{results:r,skipped:i}=await $h(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:rg(r,i),stderr:c,exitCode:+!s}}async function og(e,t,n,r){let i=tg(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?ag(t,n,i.json):ig(t,i.json,r)}async function sg(e,t){let n=`${Di}/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(Ri(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ve(r.body);if(!i.data)return[];let a=new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=Gi(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 cg(e,t){let n=`${Di}/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: ${Ri(e,n)}`}}if(r.status!==200)return{error:`Tessl search failed (HTTP ${r.status})`};let i=ve(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=Gi(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 lg=[{label:`Tessl`,host:new URL(Di).host,fetch:sg},{label:`browse.sh`,host:new URL(Ai).host,fetch:mh}];function ug(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(lg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=ug(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=lg[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
302
|
`}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:
|
|
303
303
|
`,p+=` From Tessl: upskill <owner/repo> --skill <name>
|
|
304
304
|
`,p+=` From browse.sh: upskill browse:<hostname>/<task>
|
|
@@ -321,7 +321,7 @@ Examples:
|
|
|
321
321
|
`,{stdout:s,stderr:``,exitCode:0}}function vg(e){return!e||e.startsWith(`-`)?{stdout:``,stderr:`upskill: --branch requires a value
|
|
322
322
|
`,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
|
|
323
323
|
`,exitCode:1}}function yg(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
|
|
324
|
-
`,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=vg(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 bg(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-
|
|
324
|
+
`,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=vg(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 bg(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-DOvbZc-9.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 Ui(n,t),a=i?Wi(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Dh(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
325
|
`,stderr:``,exitCode:0}}async function xg(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 Yi(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 Sg(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 Ji(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 Cg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0;for(let d of e){let e=await Ji(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 wg(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 Tg(e,t,n,r){let{owner:i,repo:a}=e,o=t.branch??e.branch,s=t.subPath??e.path,c=await zi(r),l=await Xi(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:wg(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:wg(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 Ii(i,a,r,o);if(e.status===`ok`){let r=await Vi(i,a,o,c,!0,s),l=await xg(u,i,a,ji(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 Sg(u,i,a,c,n,t.force,o,f);({output:p,errors:m,successCount:h}=e)}}else({output:p,errors:m,successCount:h}=await Cg(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 Ki()),{stdout:p,stderr:m,exitCode:+!!m}}async function Eg(e,t,n,r,i){switch(e[0]){case`tabs`:return gg(t,n,r,e.includes(`--json`));case`recommendations`:return _g(t,n,e.includes(`--install`));case`update`:case`upgrade`:return eg(e.slice(1),t,n);case`list`:return og(e.slice(1),t,n,i);case`info`:case`read`:return bg(e[0],e[1],t);case`search`:return Og(e,n);default:return null}}function Dg(e,t,n){return S(`upskill`,async(r,i)=>{if(r.length===0||r.includes(`--help`)||r.includes(`-h`))return Oh();let a=await Eg(r,e,t,n,i.env.get(`PATH`));if(a)return a;let o=yg(r);if(o.earlyReturn)return o.earlyReturn;if(!o.sourceRef)return Oh();if(o.sourceRef.startsWith(`tessl:`))return kg(o.sourceRef,o.force,e,t);let s=_h(o.sourceRef);if(s)return Ch(s.hostname,s.task,e,t,o.force);let c=qi(o.sourceRef);return c?Tg(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 Og(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):Oh()}async function kg(e,t,n,r){let i=e.slice(6);if(!i)return{stdout:``,stderr:`upskill: tessl: requires a skill name
|
|
326
326
|
`,exitCode:1};let a=await cg(i,r);if(`error`in a)return{stdout:``,stderr:`upskill: ${a.error}\n`,exitCode:1};let o=await zi(r);return Ji(a.owner,a.repo,a.skillPath,a.skillName,n,o,t,r)}function Ag(){return{stdout:`usage: afplay [-v volume] [-r rate] <file>
|
|
327
327
|
|
|
@@ -715,7 +715,7 @@ Examples:
|
|
|
715
715
|
`;for(let n of e)t+=` ${n.id} ${n.name.padEnd(20)} ${n.cron.padEnd(15)}`,n.scoop&&(t+=` -> ${n.scoop}`),n.filter&&(t+=` [filtered]`),t+=` (${n.status})`,n.nextRun&&(t+=` next: ${new Date(n.nextRun).toLocaleString()}`),t+=`
|
|
716
716
|
`;return t}async function By(e,t){let n=C(e.slice(1),{});if(`error`in n)return Ly(n.error);if(!t()){let e=await Ay();if(!e)return Ny(`list`);let t=await e.listCronTasks();return t.length===0?{stdout:`No active cron tasks
|
|
717
717
|
`,stderr:``,exitCode:0}:{stdout:zy(t),stderr:``,exitCode:0}}let{ok:r,data:i}=await Fy(`GET`,``);if(!r)return{stdout:``,stderr:`crontask: failed to list: ${i.error??`unknown error`}\n`,exitCode:1};let a=i;return a.length===0?{stdout:`No active cron tasks
|
|
718
|
-
`,stderr:``,exitCode:0}:{stdout:zy(a),stderr:``,exitCode:0}}async function Vy(e,t){let n=e[0],r=C(e.slice(1),{});if(`error`in r)return Ly(r.error);let i=r.positionals[0];if(!i)return{stdout:``,stderr:`crontask: ${n} requires an ID\n`,exitCode:1};if(!t()){let e=await Ay();return e?await e.deleteCronTask(i)?{stdout:`Deleted cron task "${i}"\n`,stderr:``,exitCode:0}:{stdout:``,stderr:`crontask: task "${i}" not found\n`,exitCode:1}:Ny(`delete`)}let{ok:a,status:o,data:s}=await Fy(`DELETE`,`/${i}`);return a?{stdout:`Deleted cron task "${i}"\n`,stderr:``,exitCode:0}:o===404?{stdout:``,stderr:`crontask: task "${i}" not found\n`,exitCode:1}:{stdout:``,stderr:`crontask: failed to delete: ${s.error??`unknown error`}\n`,exitCode:1}}function Hy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return S(`crontask`,async(e,n)=>{let r=e[0];if(!r||w(e,{valueFlags:Iy}))return Py();try{switch(r){case`create`:return await Ry(e,n.env,t);case`list`:return await By(e,t);case`delete`:case`kill`:return await Vy(e,t);default:return{stdout:``,stderr:`crontask: unknown command "${r}"\n`,exitCode:1}}}catch(e){return{stdout:``,stderr:`crontask: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}function Uy(e){return S(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-
|
|
718
|
+
`,stderr:``,exitCode:0}:{stdout:zy(a),stderr:``,exitCode:0}}async function Vy(e,t){let n=e[0],r=C(e.slice(1),{});if(`error`in r)return Ly(r.error);let i=r.positionals[0];if(!i)return{stdout:``,stderr:`crontask: ${n} requires an ID\n`,exitCode:1};if(!t()){let e=await Ay();return e?await e.deleteCronTask(i)?{stdout:`Deleted cron task "${i}"\n`,stderr:``,exitCode:0}:{stdout:``,stderr:`crontask: task "${i}" not found\n`,exitCode:1}:Ny(`delete`)}let{ok:a,status:o,data:s}=await Fy(`DELETE`,`/${i}`);return a?{stdout:`Deleted cron task "${i}"\n`,stderr:``,exitCode:0}:o===404?{stdout:``,stderr:`crontask: task "${i}" not found\n`,exitCode:1}:{stdout:``,stderr:`crontask: failed to delete: ${s.error??`unknown error`}\n`,exitCode:1}}function Hy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return S(`crontask`,async(e,n)=>{let r=e[0];if(!r||w(e,{valueFlags:Iy}))return Py();try{switch(r){case`create`:return await Ry(e,n.env,t);case`list`:return await By(e,t);case`delete`:case`kill`:return await Vy(e,t);default:return{stdout:``,stderr:`crontask: unknown command "${r}"\n`,exitCode:1}}}catch(e){return{stdout:``,stderr:`crontask: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}function Uy(e){return S(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-COFXmIVS.js`);return r(e,t,n)})}function Wy(e,t={}){if(!Number.isFinite(e)||e<0)return``;if(t.si){if(e<1e3)return`${Math.round(e)} B`;let t=[`kB`,`MB`,`GB`,`TB`],n=e/1e3,r=0;for(;n>=1e3&&r<t.length-1;)n/=1e3,r+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${t[r]}`}if(e<1024)return Number.isInteger(e)?`${e} B`:e>=.1?`${e.toFixed(1)} B`:e>0?`${Math.max(.01,Number(e.toFixed(2)))} B`:`0 B`;let n=[`KB`,`MB`,`GB`,`TB`,`PB`],r=e,i=-1;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]}`}function Gy(e){return Wy(e,{si:!1})}const Ky=`slicc-fs`;async function qy(){try{let e=globalThis.indexedDB;if(!e)return!1;let t=e.databases;return typeof t!=`function`||(await t.call(e)).some(e=>e.name===Ky)}catch{return!0}}async function Jy(){let e=globalThis.indexedDB;return e?new Promise(t=>{let n;try{n=e.deleteDatabase(Ky)}catch{t(`error`);return}n.onsuccess=()=>t(`deleted`),n.onerror=()=>t(`error`),n.onblocked=()=>t(`blocked`)}):`error`}async function Yy(){if(!await qy())return{kind:`absent`,message:`legacy slicc-fs IDB not present — nothing to clean`};let e=await Jy();return e===`deleted`?{kind:`deleted`,message:`legacy slicc-fs IDB deleted`}:e===`blocked`?{kind:`blocked`,message:`legacy slicc-fs IDB delete blocked by another connection — close other tabs and retry`}:{kind:`error`,message:`legacy slicc-fs IDB delete failed`}}function Xy(){return`slicc-fs-cleanup — delete the legacy slicc-fs IndexedDB
|
|
719
719
|
|
|
720
720
|
Usage:
|
|
721
721
|
slicc-fs-cleanup Delete the legacy slicc-fs IDB.
|
|
@@ -932,7 +932,7 @@ Options:
|
|
|
932
932
|
--pattern <glob> File pattern to match, e.g. "*.md", "*.bsh" (required)
|
|
933
933
|
--scoop <target> Scoop name, cone name, or folder. Omit for your own cone.
|
|
934
934
|
--name <name> Human-readable name for the watcher
|
|
935
|
-
`);switch(n){case`list`:return nC(e);case`delete`:return rC(e);case`create`:return await oC(e,t.env);default:return eC(`unknown command: ${n}`)}})}function cC(e){return S(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-ZVh0R1Qb.js`);return r(t,n,e)})}function lC(e={}){return S(`go`,async(t,n)=>{let{runGoCommand:r}=await import(`./go-driver-
|
|
935
|
+
`);switch(n){case`list`:return nC(e);case`delete`:return rC(e);case`create`:return await oC(e,t.env);default:return eC(`unknown command: ${n}`)}})}function cC(e){return S(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-ZVh0R1Qb.js`);return r(t,n,e)})}function lC(e={}){return S(`go`,async(t,n)=>{let{runGoCommand:r}=await import(`./go-driver-RbD3VF67.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}function uC(){return{stdout:`usage: hear [-i file] [-l lang] [-T seconds] [-d deviceId] [--engine name]
|
|
936
936
|
hear --devices | --status | --warmup
|
|
937
937
|
|
|
938
938
|
Speech recognition: listens on the microphone until you pause, then
|
|
@@ -1237,7 +1237,7 @@ Options:
|
|
|
1237
1237
|
`,stderr:``,exitCode:0}}let a=e.routes.get(r.targetId)??[],o=a.length,s=a.filter(e=>e.pattern!==i);if(e.routes.set(r.targetId,s),s.length===0){let t=e.routeCleanup.get(r.targetId);t&&(t(),e.routeCleanup.delete(r.targetId))}return{stdout:`Removed ${o-s.length} route(s) matching "${i}"\n`,stderr:``,exitCode:0}},IT=`/.playwright`;function LT(e,t){return e?`${t.replace(/\/+$/,``)}${IT}`:IT}async function RT(e,t,n){if(!t.sessionDirsCreated.has(n)){for(let t of[n,`${n}/snapshots`,`${n}/screenshots`])try{await e.mkdir(t,{recursive:!0})}catch(e){if(!Bn(e))throw e}t.sessionDirsCreated.add(n)}}async function zT(e,t,n,r,i){try{return await e.withTab(n,async e=>{let{url:a,title:o,text:s,refToSelector:c,refToBackendNodeId:l,refToFrameId:u}=await ce(e),d={url:a,title:o,refToSelector:c,refToBackendNodeId:l,refToFrameId:u,content:s,timestamp:Date.now()};r.snapshots.set(n,d);let f=[`Page URL: ${a}`,`Page Title: ${o}`,``,s].join(`
|
|
1238
1238
|
`),p=`${i}/snapshots/page-${Rn(new Date)}.yml`;return await t.writeFile(p,f),p})}catch{return null}}async function BT(e,t,n,r){await RT(e,t,n);let i=new Date().toISOString(),a=`playwright-cli ${r.command}${r.args.length?` `+r.args.join(` `):``}`,o=r.result.exitCode===0?r.result.stdout.trim()||`OK`:`Error: ${r.result.stderr.trim()}`,s=[`### ${a}`,`- **Time**: ${i}`];if(r.tabUrl||r.targetId){let e=r.tabUrl?`${r.tabUrl}${r.targetId?` (targetId: ${r.targetId})`:``}`:`targetId: ${r.targetId}`;s.push(`- **Tab**: ${e}`)}s.push(`- **Result**: ${o}`),r.snapshotPath&&s.push(``,`[Snapshot](${r.snapshotPath})`),s.push(`---`,``);let c=s.join(`
|
|
1239
1239
|
`)+`
|
|
1240
|
-
`,l=`${n}/session.md`,u=``;try{let t=await e.readFile(l);u=typeof t==`string`?t:new TextDecoder().decode(t)}catch{}await e.writeFile(l,u+c)}function VT(){return import(`./snapshot-features-
|
|
1240
|
+
`,l=`${n}/session.md`,u=``;try{let t=await e.readFile(l);u=typeof t==`string`?t:new TextDecoder().decode(t)}catch{}await e.writeFile(l,u+c)}function VT(){return import(`./snapshot-features-BOJJbUaa.js`)}async function HT(e,t,n,r){let i=await e.getAccessibilityTreeForFrame(r.frameId),a=new Map,o=new Map,s=new Map,c=se(i,a,o,{value:0},``,`f1`);for(let e of a.keys())s.set(e,r.frameId);let l=c.join(`
|
|
1241
1241
|
`);return t.snapshots.set(n,{url:r.url,title:r.name,refToSelector:a,refToBackendNodeId:o,refToFrameId:s,content:l,timestamp:Date.now()}),l}async function UT(e,t){await e.send(`DOM.enable`),await e.send(`Runtime.enable`);let n=(await e.send(`DOM.resolveNode`,{backendNodeId:t})).object;if(n?.objectId)return(await e.send(`Runtime.callFunctionOn`,{objectId:n.objectId,functionDeclaration:`function() {
|
|
1242
1242
|
this.scrollIntoView({ block: 'center' });
|
|
1243
1243
|
const r = this.getBoundingClientRect();
|
|
@@ -1315,7 +1315,7 @@ Options:
|
|
|
1315
1315
|
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1316
1316
|
return el.files.length;
|
|
1317
1317
|
})()`,r=await t.send(`Runtime.evaluate`,{expression:n,returnByValue:!0,awaitPromise:!1},e);if(r.exceptionDetails){let e=r.exceptionDetails.exception?.description??r.exceptionDetails.text??`File upload failed`;throw Error(e)}});let p=d.map(e=>e.split(`/`).pop()??e).join(`, `);return{stdout:`Uploaded ${d.length} file(s): ${p}\n`,stderr:``,exitCode:0}}],[`state-save`,eE],[`state-load`,tE],[`console`,jC],[`requests`,bT],[`request`,xT],[`request-headers`,ST],[`request-body`,CT],[`response-headers`,wT],[`response-body`,TT],[`mousemove`,Cw],[`mousedown`,ww],[`mouseup`,Tw],[`mousewheel`,Ew],[`drop`,Ow],[`route`,NT],[`route-list`,PT],[`unroute`,FT],[`generate-locator`,VC],[`highlight`,HC]]);function wE(){let e=(Un.string??[]).map(e=>`--${e}`),t=new Set(Un.boolean??[]);for(let[e,n]of Object.entries(Un.alias??{})){let r=[e,...Array.isArray(n)?n:[n]];if(r.some(e=>t.has(e)))for(let e of r)t.add(e)}return{value:e,bool:[...[...t].map(e=>`--${e}`),`--help`,`-h`,`--no-iframes`]}}function TE(e){return e.map(e=>e===`--no-iframes`||e.startsWith(`--no-iframes=`)?e.replace(`--no-iframes`,`--_noiframes`):e)}function EE(e){return{...e,bool:[...e.bool??[],`--_noiframes`],value:[...e.value??[],`--_noiframes`]}}const DE=2e3;function OE(e,t){if(typeof e.getTabLockStats!=`function`)return;let n=e.getTabLockStats();return t?{totalWaitMs:n.totalWaitMs,tabWaitMs:e.getTabLockStats(t).tabWaitMs}:{totalWaitMs:n.totalWaitMs}}function kE(e,t,n,r){if(!t||typeof e.getTabLockStats!=`function`)return r;let i=e.getTabLockStats(),a=i.totalWaitMs-t.totalWaitMs;if(a<DE)return r;let o=(a/1e3).toFixed(1),s=n&&t.tabWaitMs!==void 0?e.getTabLockStats(n).tabWaitMs-t.tabWaitMs:0,c=`note: browser bridge contended — lock waits totaled ${o}s while this command ran, ${s>=DE?`${(s/1e3).toFixed(1)}s of it waiting on this tab (--tab=${n})`:`all of it waiting on the bridge, not on this tab`} (queue depth ${i.queueDepth}). Commands on the same tab serialize; commands on different tabs run in parallel — stagger callers on THIS tab, or give each caller its own tab.
|
|
1318
|
-
`;return{...r,stderr:r.stderr+c}}async function AE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await Wn(e,t.tab,n):null)??r}\n`,exitCode:1}}function jE(e,t,n){return{stdout:``,stderr:`${e} ${t}: ${n===void 0?`aborted: the caller stopped waiting for it`:n instanceof Error?n.message:String(n)}\n`,exitCode:130}}async function ME(e,t,n){let r=CE.get(t);if(!r)return{stdout:``,stderr:`Unknown command: ${t}\nRun "playwright-cli help" for usage.\n`,exitCode:1};let{signal:i}=n;try{let a=await r(n);return i?.aborted?jE(e,t,void 0):a}catch(r){return i?.aborted?jE(e,t,r):await AE(n.browser,n.flags,r)}}async function NE(e,t,n,r){let i=C(TE(n),EE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=Hn(n))}catch(n){return{answer:{stdout:``,stderr:`${e} ${t}: ${n instanceof Error?n.message:String(n)}\n`,exitCode:1}}}if(a.help===`true`||a.h===`true`){let{formatSubcommandHelp:n}=await import(`./help-
|
|
1318
|
+
`;return{...r,stderr:r.stderr+c}}async function AE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await Wn(e,t.tab,n):null)??r}\n`,exitCode:1}}function jE(e,t,n){return{stdout:``,stderr:`${e} ${t}: ${n===void 0?`aborted: the caller stopped waiting for it`:n instanceof Error?n.message:String(n)}\n`,exitCode:130}}async function ME(e,t,n){let r=CE.get(t);if(!r)return{stdout:``,stderr:`Unknown command: ${t}\nRun "playwright-cli help" for usage.\n`,exitCode:1};let{signal:i}=n;try{let a=await r(n);return i?.aborted?jE(e,t,void 0):a}catch(r){return i?.aborted?jE(e,t,r):await AE(n.browser,n.flags,r)}}async function NE(e,t,n,r){let i=C(TE(n),EE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=Hn(n))}catch(n){return{answer:{stdout:``,stderr:`${e} ${t}: ${n instanceof Error?n.message:String(n)}\n`,exitCode:1}}}if(a.help===`true`||a.h===`true`){let{formatSubcommandHelp:n}=await import(`./help-CltkLxU8.js`);return{answer:{stdout:n(e,t),stderr:``,exitCode:0}}}let o=null;try{let{validateSubcommandArgs:r}=await import(`./validate-args-BcxRh84E.js`);o=r(e,t,n,i.positionals)}catch{o=null}return o?{answer:{stdout:``,stderr:o,exitCode:1}}:{positional:i.positionals,flags:a}}function PE(e,t,n,r={}){let i=t?zn(t,n):null,a=wE();return S(e,async(o,s)=>{if(o.length===0||o[0]===`help`||o[0]===`--help`||o[0]===`-h`){let{formatHelp:t}=await import(`./help-CltkLxU8.js`);return{stdout:t(e)+`
|
|
1319
1319
|
`,stderr:``,exitCode:0}}let c=o[0],l=o.slice(1),u=await NE(e,c,l,a);if(`answer`in u)return u.answer;let{positional:d,flags:f}=u;if(!t||!i)return{stdout:``,stderr:`${e}: browser APIs are unavailable in this environment\n`,exitCode:1};let p=f.tab??null,m=OE(t,p),h=aa(s.env),g=LT(r.isScoop?.()??!1,h),_=await ME(e,c,{browser:t,fs:n,state:i,positional:d,flags:f,scratchDir:h,sessionRoot:g,onTab:(e,n)=>t.withTab(e,n,{signal:s.signal}),signal:s.signal}),v=f.tab??null,ee=null;Xn.has(c)&&_.exitCode===0&&v&&(ee=await zT(t,n,v,i,g));try{await BT(n,i,g,{command:c,args:l,result:_,snapshotPath:ee,targetId:v})}catch{}return kE(t,m,p,_)})}const FE=new Map([[`File operations`,[`ls`,`cat`,`head`,`tail`,`wc`,`touch`,`mkdir`,`rm`,`cp`,`mv`,`ln`,`chmod`,`stat`,`readlink`,`file`,`rmdir`,`rsync`]],[`Text processing`,[`grep`,`sed`,`awk`,`sort`,`uniq`,`cut`,`tr`,`tee`,`diff`,`patch`,`column`,`comm`,`egrep`,`fgrep`,`expand`,`unexpand`,`fold`,`join`,`nl`,`od`,`paste`,`rev`,`split`,`strings`,`tac`]],[`Search`,[`find`,`rg`]],[`Navigation & paths`,[`pwd`,`basename`,`dirname`,`tree`,`du`,`cd`]],[`Archives`,[`zip`,`unzip`,`pdftk`,`pdf`,`gunzip`,`gzip`,`zcat`]],[`Media`,[`convert`,`magick`,`pdftoppm`,`pdftocairo`,`pdftotext`,`ffmpeg`,`ffprobe`,`screencapture`]],[`Audio`,[`say`,`hear`,`afplay`,`chime`]],[`Environment & shell`,`echo.printf.env.printenv.export.alias.unalias.history.clear.true.false.bash.sh.commands.which.uname.man.host.oauth-token.secret.nuke.models.local-llm.cost.hostname.whoami.id.help.sleep.time.timeout.oauth-domain`.split(`.`)],[`Data processing`,[`xargs`,`jq`,`base64`,`date`,`expr`,`seq`]],[`Hashes`,[`md5sum`,`sha1sum`,`sha256sum`]],[`Network`,[`curl`,`curlwright`,`wget`,`dig`,`websocat`,`html-to-markdown`]],[`Version control`,[`git`]],[`Languages`,[`node`,`jsh`,`python`,`python3`,`pyodide`,`sqlite3`]],[`Virtualization`,[`v86`,`computer`]],[`Build tools`,[`tsc`,`tst`,`esbuild`,`biome`]],[`Packages`,[`ipk`,`hf`,`npm`,`i`,`ipx`,`npx`]],[`Skills`,[`skill`,`upskill`]],[`Browser & UI`,[`serve`,`open`,`imgcat`,...Jn,`sprinkle`]],[`Clipboard`,[`pbcopy`,`pbpaste`,`xclip`,`xsel`]],[`Filesystem`,[`mount`,`umount`,`fswatch`]],[`Scoops & agents`,[`agent`,`gelatiere`,`mcp`,`webhook`,`crontask`]],[`Process`,[`ps`,`kill`,`jshd`,`meminfo`,`uptime`]],[`Shell builtins (limited)`,[...h_]]]);function IE(e,t=[],n=[]){let r=[],i=new Set(e);for(let e of t)i.delete(e);for(let e of n)i.delete(e);r.push(`Available commands:
|
|
1320
1320
|
`);let a=[];for(let[e,t]of FE){let n=t.filter(e=>i.has(e));if(n.length>0){r.push(` ${e}:`),r.push(` ${n.join(`, `)}\n`);for(let e of n)i.delete(e)}}for(let e of i)a.push(e);return a.length>0&&(r.push(` Other:`),r.push(` ${a.sort().join(`, `)}\n`)),t.length>0&&(r.push(` User scripts (.jsh):`),r.push(` ${t.sort().join(`, `)}\n`)),n.length>0&&(r.push(` Workflows:`),r.push(` ${n.sort().join(`, `)}\n`)),r.push(`Use '<command> --help' for details on a specific command.`),r.join(`
|
|
1321
1321
|
`)+`
|
|
@@ -1419,7 +1419,7 @@ Options:
|
|
|
1419
1419
|
`,exitCode:1};let i=[];for(let e of r.positionals){let t=n.fs.resolvePath(n.cwd,e);if(!(await n.fs.stat(t)).isFile)return{stdout:``,stderr:`imgcat: not a file: ${e}\n`,exitCode:1};let r=Te(t);if(!we(r))return{stdout:``,stderr:`imgcat: unsupported media type: ${e}\n`,exitCode:1};let a=await n.fs.readFileBuffer(t),o=new Uint8Array(a.byteLength);o.set(a),i.push({path:t,mimeType:r,bytes:o})}try{return await e.onMediaPreview(i),{stdout:``,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`imgcat: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}const UD=new Set([`run`,`run-script`]),WD=new Set([`test`,`start`,`stop`,`restart`]),GD=new Set([` `,` `,`
|
|
1420
1420
|
`,`;`,`|`,`&`,`(`,`)`,`{`,`}`,`<`,`>`]),KD=new Set([`;`,`|`,`&`,`(`,`)`,`{`,`
|
|
1421
1421
|
`]),qD=/^[A-Za-z_][A-Za-z0-9_]*=/,JD=/^[@A-Za-z0-9._-]+$/,YD=new Set([`if`,`then`,`else`,`elif`,`fi`,`for`,`while`,`until`,`do`,`done`,`case`,`in`,`esac`,`function`,`time`,`!`]),XD=new Set([`if`,`then`,`else`,`elif`,`while`,`until`,`do`,`time`,`!`]),ZD=new Set([`ipx`,`npx`]);function QD(e){return`'${e.replace(/'/g,`'\\''`)}'`}async function $D(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}function*eO(e){let t=b(e);for(;yield t,t!==`/`;)t=Ne(t).dir}function tO(e){if(typeof e!=`object`||!e)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function nO(e){return typeof e==`string`?e:void 0}async function rO(e,t){for(let n of eO(t)){let t=x(n,`package.json`);if(!await e.exists(t))continue;let r;try{r=JSON.parse(await $D(e,t))}catch(e){throw Error(`${t} is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}return{dir:n,name:nO(r.name),version:nO(r.version),scripts:tO(r.scripts)}}return null}function iO(e,t){let n=t,r=``;for(;n<e.length;){let t=e[n];if(r!==``){t===`\\`&&r===`"`?n++:t===r&&(r=``),n++;continue}if(t===`'`||t===`"`){r=t,n++;continue}if(t===`\\`){n+=2;continue}if(GD.has(t))break;n++}return{start:t,end:n,text:e.slice(t,n)}}function aO(e){let t=[],n=0,r=!0;for(;n<e.length;){let i=e[n];if(i===` `||i===` `){n++;continue}if(KD.has(i)){r=!0,n++;continue}let a=iO(e,n);if(a.end===a.start){n++;continue}if(r&&!qD.test(a.text)){if(XD.has(a.text)){n=a.end;continue}t.push(a),r=!1}n=a.end}return t}function oO(e,t){return!JD.test(e)||YD.has(e)||ZD.has(e)?!1:!t.isRegistered(e)}async function sO(e,t){let n=aO(e).filter(e=>oO(e.text,t));if(n.length===0)return e;let r=[];for(let e of n)await t.hasLocalBin(e.text)&&r.push(e);if(r.length===0)return e;let i=e;for(let e of[...r].reverse())i=`${i.slice(0,e.start)}ipx ${i.slice(e.start)}`;return i}function cO(e){let t=[];for(let n of eO(e))t.push(x(n,`node_modules`,`.bin`));return t}function lO(e,t,n,r){let i=r.env.get(`PATH`)??``,a={PATH:[...cO(e.dir),i].filter(e=>e!==``).join(`:`),npm_lifecycle_event:t,npm_lifecycle_script:n};return e.name!==void 0&&(a.npm_package_name=e.name),e.version!==void 0&&(a.npm_package_version=e.version),a}function uO(e){return e.name===void 0?e.dir:e.version===void 0?e.name:`${e.name}@${e.version}`}function dO(e,t){let n=Object.entries(t.scripts);if(n.length===0)return`${e}: no scripts defined in ${x(t.dir,`package.json`)}\n`;let r=[`Scripts available in ${uO(t)} via \`${e} run\`:`];for(let[e,t]of n)r.push(` ${e}`),r.push(` ${t}`);return`${r.join(`
|
|
1422
|
-
`)}\n`}function fO(e,t){return t===`--silent`||t===`-s`?(e.silent=!0,!0):t===`--if-present`&&(e.ifPresent=!0,!0)}function pO(e){let t={silent:!1,ifPresent:!1},n=[],r,i=!1;for(let a of e){if(i){n.push(a);continue}if(a===`--`){i=!0;continue}fO(t,a)||(r===void 0?r=a:n.push(a))}return{flags:t,script:r,extraArgs:n}}function mO(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}function hO(e,t,n,r){let i=r.length>0?` ${r.map(QD).join(` `)}`:``,a=[],o=e.scripts[`pre${t}`];o!==void 0&&a.push({event:`pre${t}`,body:o}),a.push({event:t,body:`${n}${i}`});let s=e.scripts[`post${t}`];return s!==void 0&&a.push({event:`post${t}`,body:s}),a}async function gO(e,t,n,r){if(n===`start`&&await r.exists(x(t.dir,`server.js`)))return`node server.js`;if(n===`restart`)return`${e} stop --if-present && ${e} start`}function _O(e,t,n){let r=new Set(n.getRegisteredCommands?.()??[]);return{isRegistered:e=>r.has(e),hasLocalBin:async n=>{for(let r of cO(t.dir))if(await e.exists(x(r,n)))return!0;return!1}}}async function vO(e,t,n,r,i,a){let o=i.exec;if(!o)return mO(e,`run requires shell exec support, which this context does not provide`);let s=_O(a.fs,t,i),c=uO(t),l=``,u=``;for(let a of n){r.silent||(l+=`\n> ${c} ${a.event}\n> ${a.body}\n\n`);let n=await o(await sO(a.body,s),{cwd:t.dir,env:lO(t,a.event,a.body,i),stdin:bi(i.stdin),stdinKind:`bytes`});if(l+=n.stdout,u+=n.stderr,n.exitCode!==0)return u+=`${e}: script '${a.event}' exited with code ${n.exitCode}\n`,{stdout:l,stderr:u,exitCode:n.exitCode}}return{stdout:l,stderr:u,exitCode:0}}async function yO(e,t,n,r){let i;try{i=await rO(r.fs,n.cwd)}catch(t){return mO(e,t instanceof Error?t.message:String(t))}if(!i)return mO(e,`no package.json found in ${n.cwd} or any parent directory — nothing to run`);let{flags:a,script:o,extraArgs:s}=pO(t);if(o===void 0)return{stdout:dO(e,i),stderr:``,exitCode:0};let c=i.scripts[o]??await gO(e,i,o,r.fs)??void 0;if(c===void 0){if(a.ifPresent)return{stdout:``,stderr:``,exitCode:0};let t=Object.keys(i.scripts);return mO(e,`missing script: ${o}${t.length>0?` (available: ${t.join(`, `)})`:` (${x(i.dir,`package.json`)} defines no scripts)`}`)}return vO(e,i,hO(i,o,c,s),a,n,r)}const bO=()=>import(`./installer-
|
|
1422
|
+
`)}\n`}function fO(e,t){return t===`--silent`||t===`-s`?(e.silent=!0,!0):t===`--if-present`&&(e.ifPresent=!0,!0)}function pO(e){let t={silent:!1,ifPresent:!1},n=[],r,i=!1;for(let a of e){if(i){n.push(a);continue}if(a===`--`){i=!0;continue}fO(t,a)||(r===void 0?r=a:n.push(a))}return{flags:t,script:r,extraArgs:n}}function mO(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}function hO(e,t,n,r){let i=r.length>0?` ${r.map(QD).join(` `)}`:``,a=[],o=e.scripts[`pre${t}`];o!==void 0&&a.push({event:`pre${t}`,body:o}),a.push({event:t,body:`${n}${i}`});let s=e.scripts[`post${t}`];return s!==void 0&&a.push({event:`post${t}`,body:s}),a}async function gO(e,t,n,r){if(n===`start`&&await r.exists(x(t.dir,`server.js`)))return`node server.js`;if(n===`restart`)return`${e} stop --if-present && ${e} start`}function _O(e,t,n){let r=new Set(n.getRegisteredCommands?.()??[]);return{isRegistered:e=>r.has(e),hasLocalBin:async n=>{for(let r of cO(t.dir))if(await e.exists(x(r,n)))return!0;return!1}}}async function vO(e,t,n,r,i,a){let o=i.exec;if(!o)return mO(e,`run requires shell exec support, which this context does not provide`);let s=_O(a.fs,t,i),c=uO(t),l=``,u=``;for(let a of n){r.silent||(l+=`\n> ${c} ${a.event}\n> ${a.body}\n\n`);let n=await o(await sO(a.body,s),{cwd:t.dir,env:lO(t,a.event,a.body,i),stdin:bi(i.stdin),stdinKind:`bytes`});if(l+=n.stdout,u+=n.stderr,n.exitCode!==0)return u+=`${e}: script '${a.event}' exited with code ${n.exitCode}\n`,{stdout:l,stderr:u,exitCode:n.exitCode}}return{stdout:l,stderr:u,exitCode:0}}async function yO(e,t,n,r){let i;try{i=await rO(r.fs,n.cwd)}catch(t){return mO(e,t instanceof Error?t.message:String(t))}if(!i)return mO(e,`no package.json found in ${n.cwd} or any parent directory — nothing to run`);let{flags:a,script:o,extraArgs:s}=pO(t);if(o===void 0)return{stdout:dO(e,i),stderr:``,exitCode:0};let c=i.scripts[o]??await gO(e,i,o,r.fs)??void 0;if(c===void 0){if(a.ifPresent)return{stdout:``,stderr:``,exitCode:0};let t=Object.keys(i.scripts);return mO(e,`missing script: ${o}${t.length>0?` (available: ${t.join(`, `)})`:` (${x(i.dir,`package.json`)} defines no scripts)`}`)}return vO(e,i,hO(i,o,c,s),a,n,r)}const bO=()=>import(`./installer-CqJH2NWX.js`),xO=new Set([`install`,`i`,`add`]),SO=new Set([`uninstall`,`remove`,`rm`,`un`]),CO=new Set([`list`,`ls`]),wO=new Set([`-g`,`--global`,`--location=global`]),TO=[`-g`,`--global`,`-D`,`--save-dev`];function EO(e){return`${e} - install packages from the npm registry into node_modules
|
|
1423
1423
|
and run package.json scripts; also install conda/emscripten-forge
|
|
1424
1424
|
packages via '${e} mamba'
|
|
1425
1425
|
|
|
@@ -1495,7 +1495,7 @@ manifest without rewriting it. With -g, packages go to /shared/lib/node_modules
|
|
|
1495
1495
|
and deps are recorded in /shared/lib/package.json. Existing fields are
|
|
1496
1496
|
preserved. Idempotent: re-installing an already-satisfied package is a clean
|
|
1497
1497
|
no-op.
|
|
1498
|
-
`}function DO(e){let t=C(e,{bool:TO,value:[`--location`]});if(`error`in t)return t;let n=t.values.get(`--location`);return n!==void 0&&n!==`global`?{error:`unknown flag: --location=${n}`}:{global:t.bools.has(`-g`)||t.bools.has(`--global`)||n===`global`,saveDev:t.bools.has(`-D`)||t.bools.has(`--save-dev`),specs:t.positionals}}function OO(e){let t=!1,n=[];for(let r of e){if(wO.has(r)){t=!0;continue}r.startsWith(`-`)||n.push(r)}return{global:t,specs:n}}function kO(e){return w(e)}function AO(e){return e instanceof Error?e.message:String(e)}async function jO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function MO(e,t){let n=e===`i`;return S(e,async(r,i)=>{if(n)return kO(r)?{stdout:EO(e),stderr:``,exitCode:0}:PO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-
|
|
1498
|
+
`}function DO(e){let t=C(e,{bool:TO,value:[`--location`]});if(`error`in t)return t;let n=t.values.get(`--location`);return n!==void 0&&n!==`global`?{error:`unknown flag: --location=${n}`}:{global:t.bools.has(`-g`)||t.bools.has(`--global`)||n===`global`,saveDev:t.bools.has(`-D`)||t.bools.has(`--save-dev`),specs:t.positionals}}function OO(e){let t=!1,n=[];for(let r of e){if(wO.has(r)){t=!0;continue}r.startsWith(`-`)||n.push(r)}return{global:t,specs:n}}function kO(e){return w(e)}function AO(e){return e instanceof Error?e.message:String(e)}async function jO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function MO(e,t){let n=e===`i`;return S(e,async(r,i)=>{if(n)return kO(r)?{stdout:EO(e),stderr:``,exitCode:0}:PO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-3_fPiukj.js`);return n(e,r.slice(1),i,t)}if(kO(r))return{stdout:EO(e),stderr:``,exitCode:0};if(r.length===0)return{stdout:EO(e),stderr:`${e}: missing subcommand\n`,exitCode:1};let a=r[0],o=r.slice(1);return xO.has(a)?PO(e,o,i,t):SO.has(a)?IO(e,o,i,t):CO.has(a)?LO(e,o,i,t):a===`root`?RO(e,o,i,t):UD.has(a)?yO(e,o,i,{fs:t.fs}):WD.has(a)?yO(e,r,i,{fs:t.fs}):{stdout:``,stderr:`${e}: unknown subcommand '${a}' (supported: install, uninstall, list, root, run, mamba)\n`,exitCode:1}})}async function NO(e,t,n){let{installFromManifest:r,ManifestNotFoundError:i}=await bO(),a;try{a=await r({fs:n.fs,fetch:n.fetch,cwd:t.cwd})}catch(t){return t instanceof i?{stdout:``,stderr:`${e}: ${t.message}\n`,exitCode:1}:{stdout:``,stderr:`${e}: install failed: ${AO(t)}\n`,exitCode:1}}if(a.empty&&a.errors.length===0)return{stdout:`${e}: nothing to install (package.json declares no dependencies)\n`,stderr:``,exitCode:0};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),s=[...(a.notes??[]).map(t=>`${e}: ${t}`),...a.errors.map(t=>`${e}: failed to install ${t.spec}: ${AO(t.error)}`)];return{stdout:o.length>0?`${o.join(`
|
|
1499
1499
|
`)}\n`:``,stderr:s.length>0?`${s.join(`
|
|
1500
1500
|
`)}\n`:``,exitCode:a.errors.length===0?0:1}}async function PO(e,t,n,r){let i=DO(t);if(`error`in i)return{stdout:``,stderr:`${e}: ${i.error}\n`,exitCode:1};let{global:a,saveDev:o,specs:s}=i;if(a&&s.length===0)return{stdout:``,stderr:`${e}: global install requires at least one package name\n`,exitCode:1};if(s.length===0)return NO(e,n,r);let{installPackages:c}=await bO(),l;try{l=await c(s,{fs:r.fs,fetch:r.fetch,cwd:n.cwd,global:a,saveDev:o})}catch(t){return{stdout:``,stderr:`${e}: install failed: ${AO(t)}\n`,exitCode:1}}let u=l.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),d=[...(l.notes??[]).map(t=>`${e}: ${t}`),...l.errors.map(t=>`${e}: failed to install ${t.spec}: ${AO(t.error)}`)];return a&&l.results.length>0&&await jO(r),{stdout:u.length>0?`${u.join(`
|
|
1501
1501
|
`)}\n`:``,stderr:d.length>0?`${d.join(`
|
|
@@ -1516,8 +1516,8 @@ Options:
|
|
|
1516
1516
|
--force Install a package even when a SLICC built-in shadows it
|
|
1517
1517
|
--global Resolve only from the shared global prefix (/shared/lib/node_modules)
|
|
1518
1518
|
-h, --help Show this help message
|
|
1519
|
-
`}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 sr;return}let n=b(e);for(;yield x(n,`node_modules`),n!==`/`;)n=Ne(n).dir;yield sr}async function uk(e,t,n,r=!1){for(let i of lk(t,r)){let t=x(i,`.bin`,n);if(!await sk(e,t))continue;let r=await ok(e,t),a=ik.exec(r),o=Ne(t).dir;return{binFilePath:a?x(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=x(i,n),r=x(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:x(t,s),argvName:x(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,x(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-
|
|
1520
|
-
`)}\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 ${sr}`);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=ui(await ok(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await ci(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function Sk(e={}){return S(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-
|
|
1519
|
+
`}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 sr;return}let n=b(e);for(;yield x(n,`node_modules`),n!==`/`;)n=Ne(n).dir;yield sr}async function uk(e,t,n,r=!1){for(let i of lk(t,r)){let t=x(i,`.bin`,n);if(!await sk(e,t))continue;let r=await ok(e,t),a=ik.exec(r),o=Ne(t).dir;return{binFilePath:a?x(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=x(i,n),r=x(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:x(t,s),argvName:x(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,x(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-CqJH2NWX.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(`
|
|
1520
|
+
`)}\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 ${sr}`);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=ui(await ok(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await ci(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function Sk(e={}){return S(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-DdV5_2MK.js`);return r(t,n,e)})}const Ck=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function wk(e={}){return S(`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
|
|
1521
1521
|
`,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(`
|
|
1522
1522
|
`)}\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
|
|
1523
1523
|
`,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
|
|
@@ -1590,7 +1590,7 @@ Common base URLs:
|
|
|
1590
1590
|
`)+`
|
|
1591
1591
|
`,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(`
|
|
1592
1592
|
`)+`
|
|
1593
|
-
`,stderr:``,exitCode:0}}function iA(){return S(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-
|
|
1593
|
+
`,stderr:``,exitCode:0}}function iA(){return S(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-_i7awS4-.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-DVdX5889.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.
|
|
1594
1594
|
`,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>
|
|
1595
1595
|
|
|
1596
1596
|
Fetches documentation for a given topic from sliccy.com.
|
|
@@ -1609,7 +1609,7 @@ Notes:
|
|
|
1609
1609
|
Document-Isolation-Policy). Embedded floats cannot be isolated and
|
|
1610
1610
|
report why instead.
|
|
1611
1611
|
- The browser randomizes measurement timing — expect a short delay.
|
|
1612
|
-
`,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 S(`memory`,async t=>{let{runMemory:n}=await import(`./run-
|
|
1612
|
+
`,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 S(`memory`,async t=>{let{runMemory:n}=await import(`./run-Dx_PcgX_.js`);return n(t,e)})}function hA(){return S(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-dAJe7sKp.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(`
|
|
1613
1613
|
`)?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
|
|
1614
1614
|
|
|
1615
1615
|
Usage: models [options]
|
|
@@ -1624,7 +1624,7 @@ Options:
|
|
|
1624
1624
|
-h, --help Show this help message
|
|
1625
1625
|
`}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=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(`
|
|
1626
1626
|
`)+`
|
|
1627
|
-
`}function LA(e){let t=C(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(w(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-
|
|
1627
|
+
`}function LA(e){let t=C(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(w(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-_i7awS4-.js`).then(e=>e.t);if(r.getAccounts().length===0)return yA(`No provider accounts configured. Run the provider settings to add one.
|
|
1628
1628
|
`);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)+`
|
|
1629
1629
|
`,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
|
|
1630
1630
|
`),f.push(BA(o,a,s,c)),{stdout:f.join(`
|
|
@@ -1682,7 +1682,7 @@ Examples:
|
|
|
1682
1682
|
`)}\n`,stderr:``,exitCode:0}}async function fj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
|
|
1683
1683
|
`,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>
|
|
1684
1684
|
`,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>
|
|
1685
|
-
`,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 S(`oauth-domain`,async e=>{if(e.length===0||w(e))return{stdout:lj(),stderr:``,exitCode:0};let t=C(e);if(`error`in t)return uj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-
|
|
1685
|
+
`,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 S(`oauth-domain`,async e=>{if(e.length===0||w(e))return{stdout:lj(),stderr:``,exitCode:0};let t=C(e);if(`error`in t)return uj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-_i7awS4-.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 S(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-D26_LV3G.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...]
|
|
1686
1686
|
|
|
1687
1687
|
VFS paths are served in a new browser tab via the preview service worker.
|
|
1688
1688
|
URLs (http/https/etc.) are opened directly in a new tab.
|
|
@@ -1708,7 +1708,7 @@ Examples:
|
|
|
1708
1708
|
`);let i=!1;try{i=(await t.fs.stat(e)).isDirectory}catch{}let a=await _r(t.fs,i?e:Tr(e)),o=qr(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(!yr(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
|
|
1709
1709
|
`);if(yr(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 S(`open`,async(t,n)=>{if(t.length===0||w(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:y(),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(`
|
|
1710
1710
|
`)+`
|
|
1711
|
-
`,stderr:``,exitCode:0}})}function Bj(){return S(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-
|
|
1711
|
+
`,stderr:``,exitCode:0}})}function Bj(){return S(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-CbG5L__f.js`);return n(e,t)})}function Vj(e=`pdftk`){return S(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BEs473Sp.js`);return r(e,t,n)})}function Hj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
|
|
1712
1712
|
|
|
1713
1713
|
Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
|
|
1714
1714
|
is zero-padded to the digit width of the last page (out-1.png for a 9-page
|
|
@@ -1768,7 +1768,7 @@ Examples:
|
|
|
1768
1768
|
plugin list
|
|
1769
1769
|
plugin info my-plugin
|
|
1770
1770
|
plugin remove my-plugin
|
|
1771
|
-
`}function aM(e={}){return S(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return nM(iM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await fM(i,a,e);case`list`:case`ls`:return await gM(i,e);case`info`:return await _M(i,e);case`validate`:return await vM(i,a,e,aa(n?.env));case`remove`:case`rm`:case`delete`:return await yM(i,e);default:return K(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return K(`plugin ${r}: ${e instanceof Error?e.message:String(e)}`)}})}async function oM(e){if(e.fs)return e.fs;let{VirtualFS:t}=await import(`./fs-
|
|
1771
|
+
`}function aM(e={}){return S(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return nM(iM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await fM(i,a,e);case`list`:case`ls`:return await gM(i,e);case`info`:return await _M(i,e);case`validate`:return await vM(i,a,e,aa(n?.env));case`remove`:case`rm`:case`delete`:return await yM(i,e);default:return K(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return K(`plugin ${r}: ${e instanceof Error?e.message:String(e)}`)}})}async function oM(e){if(e.fs)return e.fs;let{VirtualFS:t}=await import(`./fs-BCL8Htu-.js`).then(e=>e.t),{GLOBAL_FS_DB_NAME:n}=await import(`./global-db-DJXlpNui.js`).then(e=>e.n);return t.create({dbName:n})}async function sM(e,t,n){let r=bM(t,e);if(await n.exists(r))return{kind:`local`,root:r};let{parseGitHubRef:i}=await import(`./github-install-Cs4wWfEZ.js`).then(e=>e.t),a=i(e);if(a){let e=`${a.owner}/${a.repo}${a.branch?`@${a.branch}`:``}${a.path?`/${a.path}`:``}`;return{kind:`github`,ref:{...a,display:e}}}return{kind:`error`,message:`${r} does not exist and "${e}" is not a GitHub reference (owner/repo[@branch] or https://github.com/owner/repo[/tree/branch[/dir]])`}}function cM(e){let t=e.replace(/[^A-Za-z0-9._-]+/g,`-`);return/^\.+$/.test(t)?t.replace(/\./g,`_`):t}function lM(e){let t=[e.owner,e.repo,...e.path?[e.path]:[]];return`${tM}/${t.map(cM).join(`--`)}`}async function uM(e,t,n,r){let{fetchRepoZip:i,stripZipPrefix:a,writeZipFilesToDir:o}=await import(`./github-zip-Byubjm5A.js`).then(e=>e.i),s=await i(e.owner,e.repo,r,e.branch);if(s.status===`error`)return`failed to download ${e.display}: ${s.message}`;let c=a(s.files),l=e.path?e.path.replace(/^\/|\/$/g,``)+`/`:``;if(!c[`${l}plugin.json`])return`no plugin.json found at ${e.display} — not an Agent Plugins package`;try{await n.rm(t,{recursive:!0})}catch{}return await n.mkdir(t,{recursive:!0}),(await o(c,l,t,n,!1)).length===0?`no files found at ${e.display}`:null}async function dM(e,t){try{await e.rm(t,{recursive:!0})}catch{}}async function fM(e,t,n){if(w(e))return nM(`usage: plugin install <path|repo>
|
|
1772
1772
|
|
|
1773
1773
|
Loads the Agent Plugins package at <path>, or downloads it from a GitHub
|
|
1774
1774
|
reference (owner/repo, owner/repo@branch, or
|
|
@@ -1779,19 +1779,19 @@ mcp.json. On success the plugin is recorded in
|
|
|
1779
1779
|
/workspace/.plugins/plugins.json — its skills then surface through the
|
|
1780
1780
|
standard skills discovery, and each supported streamable-http MCP server
|
|
1781
1781
|
is registered in the MCP store as "<plugin>:<server>".
|
|
1782
|
-
`);let r=rM(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return K(`plugin install: expected <path|repo>`);let i=await oM(n),a=await sM(r.positionals[0],t,i);if(a.kind===`error`)return K(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return K(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=lM(a.ref),s=a.ref.display;let e=await uM(a.ref,o,i,n.fetch);if(e)return K(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-D4Fuki1u.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await dM(i,o),K(`plugin install: plugin at ${s??o} was rejected:\n${xM(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-
|
|
1782
|
+
`);let r=rM(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return K(`plugin install: expected <path|repo>`);let i=await oM(n),a=await sM(r.positionals[0],t,i);if(a.kind===`error`)return K(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return K(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=lM(a.ref),s=a.ref.display;let e=await uM(a.ref,o,i,n.fetch);if(e)return K(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-D4Fuki1u.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await dM(i,o),K(`plugin install: plugin at ${s??o} was rejected:\n${xM(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-C5SHHbCz.js`),m=await f(d,n.fs);if(m&&m.root!==o)return a.kind===`github`&&await dM(i,o),K(`plugin install: a plugin named "${d}" is already installed from ${m.root} (remove it first)`);let h=await hM(u,n),g=await mM(d,m?.mcpServerNames,h.registered,n);return await p(d,{root:o,version:u.manifest.version,description:u.manifest.description,installedAt:new Date().toISOString(),mcpServerNames:h.registered,...s?{source:s}:{}},n.fs),nM(pM(u,h,g,s??o,l.diagnostics))}function pM(e,t,n,r,i){let a=e.manifest.name,o=t.registered,s=e.mcp.servers.filter(e=>e.status!==`supported`),c=[`Installed agent plugin "${a}"${e.manifest.version?` v${e.manifest.version}`:``} from ${r}`,` skills: ${e.skills.length}${e.skills.length>0?` (${e.skills.map(e=>e.name).join(`, `)})`:``}`,` mcp: ${o.length} registered${o.length>0?` (${o.join(`, `)})`:``}${s.length>0?`, ${s.length} skipped`:``}${n>0?`, ${n} removed from previous install`:``}`];return t.conflicts.length>0&&c.push(` warning: not bridged — MCP server name(s) already in use and not owned by this plugin: ${t.conflicts.join(`, `)} (remove them with \`mcp remove\` first)`),i.length>0&&c.push(`Diagnostics:`,xM(i)),c.join(`
|
|
1783
1783
|
`)+`
|
|
1784
|
-
`}async function mM(e,t,n,r){let i=(t??[]).filter(e=>!n.includes(e));if(i.length===0)return 0;let{deleteServer:a,getServer:o}=await import(`./store-
|
|
1785
|
-
`);let n=rM(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-
|
|
1784
|
+
`}async function mM(e,t,n,r){let i=(t??[]).filter(e=>!n.includes(e));if(i.length===0)return 0;let{deleteServer:a,getServer:o}=await import(`./store-DdbW7p6y.js`).then(e=>e.r),s=0;for(let t of i)(await o(t,r.fs))?.pluginOrigin===e&&await a(t,r.fs)&&(s+=1);return s}async function hM(e,t){let n=e.mcp.servers.filter(e=>e.status===`supported`);if(n.length===0)return{registered:[],conflicts:[]};let{getServer:r,setServer:i}=await import(`./store-DdbW7p6y.js`).then(e=>e.r),{McpClient:a}=await import(`./client-DWx5wn8j.js`),o=[],s=[];for(let c of n){let n=c.config,l=`${e.manifest.name}:${c.name}`,u=await r(l,t.fs);if(u&&u.pluginOrigin!==e.manifest.name){s.push(l);continue}let d=[];try{let e=new a({url:n.url,headers:n.headers});await e.initialize(),d=await e.toolsList()}catch{}await i(l,{url:n.url,...n.headers?{headers:n.headers}:{},tools:d,addedAt:new Date().toISOString(),pluginOrigin:e.manifest.name},t.fs),o.push(l)}return{registered:o,conflicts:s}}async function gM(e,t){if(w(e))return nM(`usage: plugin list
|
|
1785
|
+
`);let n=rM(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-C5SHHbCz.js`),i=await r(t.fs),a=Object.keys(i).sort();if(a.length===0)return nM("No agent plugins installed. Use `plugin install <path>`.\n");let o=[[`NAME`,`VERSION`,`ROOT`,`MCP`]];for(let e of a){let t=i[e];o.push([e,t.version??`-`,t.root,String(t.mcpServerNames?.length??0)])}let s=o[0].map((e,t)=>Math.max(...o.map(e=>e[t].length)));return nM(o.map(e=>e.map((e,t)=>e.padEnd(s[t])).join(` `)).join(`
|
|
1786
1786
|
`)+`
|
|
1787
1787
|
`)}async function _M(e,t){if(w(e))return nM(`usage: plugin info <name>
|
|
1788
|
-
`);let n=rM(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-
|
|
1788
|
+
`);let n=rM(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-C5SHHbCz.js`),a=await i(r,t.fs);if(!a)return K(`plugin info: no installed plugin named "${r}"`);let o=await oM(t),{loadPluginFromDirectory:s}=await import(`./loader-D4Fuki1u.js`),c=await s(o,a.root);if(!c.ok)return K(`plugin info: plugin at ${a.root} no longer loads:\n${xM(c.diagnostics)}`);let{plugin:l}=c,u=l.manifest,d=[`${u.name}${u.version?` v${u.version}`:``}`,...u.description?[` ${u.description}`]:[],` root: ${l.root}`,...u.license?[` license: ${u.license}`]:[],...u.homepage?[` home: ${u.homepage}`]:[],``,`Skills (${l.skills.length}):`,...l.skills.map(e=>` ${e.name} ${e.description}`),``,`MCP servers (${l.mcp.servers.length}):`,...l.mcp.servers.map(e=>e.status===`supported`?` ${e.name} ${e.config.type} ${e.config.url}`:` ${e.name} [skipped: ${e.reason}]`)];return c.diagnostics.length>0&&d.push(``,`Diagnostics:`,xM(c.diagnostics)),nM(d.join(`
|
|
1789
1789
|
`)+`
|
|
1790
1790
|
`)}async function vM(e,t,n,r){if(w(e))return nM(`usage: plugin validate <path|repo>
|
|
1791
1791
|
`);let i=rM(`validate`,e);if(!(`ok`in i))return i;if(i.positionals.length<1)return K(`plugin validate: expected <path|repo>`);let a=await oM(n),o=await sM(i.positionals[0],t,a);if(o.kind===`error`)return K(`plugin validate: ${o.message}`);let s,c=null;if(o.kind===`github`){if(!n.fetch)return K(`plugin validate: GitHub sources are unavailable (no network fetch configured)`);c=`${r}/.plugin-validate/${lM(o.ref).split(`/`).pop()}`;let e=await uM(o.ref,c,a,n.fetch);if(e)return K(`plugin validate: ${e}`);s=c}else s=o.root;let{loadPluginFromDirectory:l}=await import(`./loader-D4Fuki1u.js`),u;try{u=await l(a,s)}finally{c&&await dM(a,c)}if(!u.ok)return{stdout:``,stderr:`plugin validate: REJECTED\n${xM(u.diagnostics)}\n`,exitCode:1};let{plugin:d}=u,f=d.mcp.servers.filter(e=>e.status===`supported`).length,p=[`plugin validate: OK — "${d.manifest.name}"${d.manifest.version?` v${d.manifest.version}`:``}`,` skills: ${d.skills.length}`,` mcp servers: ${f} supported, ${d.mcp.servers.length-f} skipped (mcp.json ${d.mcp.status})`];return u.diagnostics.length>0&&p.push(`Diagnostics:`,xM(u.diagnostics)),nM(p.join(`
|
|
1792
1792
|
`)+`
|
|
1793
1793
|
`)}async function yM(e,t){if(w(e))return nM(`usage: plugin remove <name>
|
|
1794
|
-
`);let n=rM(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-
|
|
1794
|
+
`);let n=rM(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-C5SHHbCz.js`),o=await i(r,t.fs);if(!o)return K(`plugin remove: no installed plugin named "${r}"`);let s=0;if(o.mcpServerNames&&o.mcpServerNames.length>0){let{deleteServer:e,getServer:n}=await import(`./store-DdbW7p6y.js`).then(e=>e.r);for(let i of o.mcpServerNames)(await n(i,t.fs))?.pluginOrigin===r&&await e(i,t.fs)&&(s+=1)}await a(r,t.fs);let c=o.root.startsWith(`${tM}/`);return c&&await dM(await oM(t),o.root),nM([`Removed agent plugin "${r}"`,` registry: removed`,` mcp servers: ${s} removed`,c?` files: removed (${o.root})`:` files: left in place (${o.root})`].join(`
|
|
1795
1795
|
`)+`
|
|
1796
1796
|
`)}function bM(e,t){let n=t.startsWith(`/`)?t:`${e.replace(/\/$/,``)}/${t}`,r=[];for(let e of n.split(`/`))e!==``&&e!==`.`&&(e===`..`?r.pop():r.push(e));return`/${r.join(`/`)}`}function xM(e){return e.map(e=>` ${e.level===`error`?`error`:`warn `} [${e.component}] ${e.message}`).join(`
|
|
1797
1797
|
`)}const SM=[`pid`,`ppid`,`kind`,`stat`,`start`,`scoop`,`command`],CM=[`pid`,`ppid`,`stat`,`start`,`scoop`,`command`],wM={running:`R`,pending:`S`,exited:`Z`,killed:`K`},TM=[`-a`,`-A`,`-e`,`--all`,`-T`,`--tree`],EM=[`-o`,`--columns`];function DM(e={}){return S(`ps`,async t=>{if(w(t,{valueFlags:EM}))return VM();let n=e.processManager??OM();if(!n)return{stdout:``,stderr:`ps: no process manager available in this runtime
|
|
@@ -2003,7 +2003,7 @@ Limits and lifetime:
|
|
|
2003
2003
|
`,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
|
|
2004
2004
|
`,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)
|
|
2005
2005
|
`:``,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 S(`serve`,(n,r)=>WP(n,r,e,t))}const KP=`usage: session export [--id <id>] [--output <path>]
|
|
2006
|
-
`;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||kt(r)!==a.sha256)throw new Na(`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 bs().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 Na?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function ZP(){return S(`session`,async(e,t)=>{if(e[0]===`export`&&!w(e))return XP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-
|
|
2006
|
+
`;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||kt(r)!==a.sha256)throw new Na(`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 bs().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 Na?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function ZP(){return S(`session`,async(e,t)=>{if(e[0]===`export`&&!w(e))return XP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-CPUaYr48.js`);return n(e,t,KP)})}function QP(){return S(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-cvQKad0O.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]
|
|
2007
2007
|
|
|
2008
2008
|
list [--runtime <id>] List sprinkles + an instance line per runtime
|
|
2009
2009
|
open <name> Open a sprinkle by name
|
|
@@ -3153,7 +3153,7 @@ or pass -bios / -vgabios with explicit VFS paths.`,IR={"-n":LR,"-name":LR,"--nam
|
|
|
3153
3153
|
`)}\n`)}function iz(e,t){return`prefer: computer ${e} -c ${t}\n`}async function az(e,t,n,r){let i=UR(t);if(WR(i))return i;let[{runComputer:a},{getComputerRegistry:o,installComputerRegistry:s},c]=await Promise.all([import(`./run-aUbSngAa.js`).then(e=>e.t),import(`./registry-DfuJBCKY.js`),import(`./v86-DKE8ZbX9.js`)]),l=c.v86ComputerId(t),u=o()??s(null);return u.get(l)||c.registerV86Computer(i,u),oz(await a([`-c`,l,...n],e,{registry:u}),r,l)}function oz(e,t,n){let r=iz(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 sz(e,t){let{name:n,rest:r}=HR(e);if(r.length===0){let e=UR(n);return WR(e)?e:Q(`type: no text supplied`)}return az(t,n,[`type`,`--`,...r],`type`)}async function cz(e,t){let{name:n,rest:r}=HR(e);if(r.length===0){let e=UR(n);return WR(e)?e:Q(`key: no chord supplied`)}return az(t,n,[`key`,...r],`key`)}const lz=[`left`,`middle`,`right`];async function uz(e,t){let{name:n,rest:r}=HR(e),i=UR(n);if(WR(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?az(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>`):az(t,n,[`--native`,`mousemove`,e,i,`--relative`],`mousemove`)}if(o===`click`){let e=r[1]??`left`;if(!lz.includes(e))return Q(`mouse: unknown button '${r[1]}'`);let i=[`click`,e];return r.includes(`--double`)&&i.push(`--repeat`,`2`),az(t,n,i,`click`)}return Q(`mouse: expected move <dx> <dy>, click [button], or --to <x>,<y>`)}async function dz(e,t){let{name:n,rest:r}=HR(e);return az(t,n,[`screenshot`,...r],`screenshot`)}async function fz(e,t){let{name:n}=HR(e);return az(t,n,[`text`],`text`)}function pz(e){let{name:t}=HR(e);return $(`v86 serve is retired.\nUse: computer watch -c v86:${t}\nLive frames go to the overlay, lightbox, and bash rows.\n`)}function mz(e){let{name:t,rest:n}=HR(e),r=UR(t);if(WR(r))return r;let i=n.indexOf(`--send`);if(i!==-1){let e=n.slice(i+1).join(` `).replace(/\\n/gu,`
|
|
3154
3154
|
`);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(`
|
|
3155
3155
|
`).slice(-Math.max(1,e)).join(`
|
|
3156
|
-
`)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function hz(e,t){let{name:n,rest:r}=HR(e),i=UR(n);if(WR(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 gz(e,t){let{name:n,rest:r}=HR(e),i=UR(n);if(WR(i))return i;let a=t.processManager??qR();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await nz(i,a),$(`VM '${n}' stopped\n`))}function _z(e={}){return S(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-
|
|
3156
|
+
`)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function hz(e,t){let{name:n,rest:r}=HR(e),i=UR(n);if(WR(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 gz(e,t){let{name:n,rest:r}=HR(e),i=UR(n);if(WR(i))return i;let a=t.processManager??qR();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await nz(i,a),$(`VM '${n}' stopped\n`))}function _z(e={}){return S(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-HzYAVLeI.js`);return r(t,n,{processConfig:e.buildProcessConfig?.(n.env),terminal:e.terminal,gate:e.gate,commands:e.commands,gitIdentity:e.gitIdentity})})}const vz=[`--name`,`--filter`,`--scoop`],yz={state:`inactive`,session:null};function bz(){return{stdout:`usage: webhook <command> [options]
|
|
3157
3157
|
|
|
3158
3158
|
Commands:
|
|
3159
3159
|
create [--scoop <name>] [--name <name>] [--filter <code>] Create a new webhook endpoint
|
|
@@ -3236,7 +3236,7 @@ EXAMPLES:
|
|
|
3236
3236
|
`:``}function rB(e,t,n){e.quiet||t.push(`websocat: ${n}`)}function iB(e,t){e.verbose<1||(e.customHeaders.length>0&&rB(e,t,`-H/--header is accepted for parity but browsers do not allow setting WebSocket request headers; only --protocol is honored`),e.pingInterval!==void 0&&rB(e,t,`--ping-interval has no effect in browsers (no ping API exposed)`),e.insecure&&rB(e,t,`-k/--insecure has no effect in browsers`))}function aB(e,t){try{let n=t.protocol?new e(t.url,t.protocol):new e(t.url);return n.binaryType=`arraybuffer`,{ws:n}}catch(e){return{error:`websocat: connect failed: ${e instanceof Error?e.message:String(e)}\n`}}}function oB(e,t,n,r){if(n.outLines.length<Qz){n.outLines.push(r);return}n.droppedForOverflow===0&&rB(e,t,`output buffer reached ${Qz} messages; dropping further inbound messages — use -1, --max-messages, or pipe to a file with a different tool for long-running streams`),n.droppedForOverflow+=1}function sB(e,n,r){let{bytes:i,isBinary:a}=Zz(r);return i.length>e.bufferSize&&(rB(e,n,`inbound message of ${i.length} bytes exceeds --buffer-size ${e.bufferSize}; truncating`),i=i.slice(0,e.bufferSize)),a&&e.base64?t(i):Xz(i)}function cB(e,t){return e.maxMessages!==void 0&&t>=e.maxMessages||e.oneMessage}function lB(e,t,n){try{n===void 0?e.close(t):e.close(t,n)}catch{}}function uB(e,t){setTimeout(()=>{lB(t,e.closeStatus??1e3,e.closeReason)},0)}function dB(e,t,n){let r=Jz(n,t.nullTerminated),i=1,a=0,o=t.oneMessage?r.slice(0,1):r;for(let n of o){let r=n;t.jsonrpc&&(r=Yz(n,i,t.jsonrpcOmit),i+=1),t.binary?e.send(new TextEncoder().encode(r).buffer):e.send(r),a+=1}return a}function fB(e,t,n){!t.oneMessage&&!t.noClose&&(t.exitOnEof||n===0)&&uB(t,e)}async function pB(e,t,n){let r=[];iB(e,r);let i=e.nullTerminated?`\0`:`
|
|
3237
3237
|
`,a=aB(n,e);if(`error`in a)return{stdout:``,stderr:a.error,exitCode:1};let{ws:o}=a,s={outLines:[],droppedForOverflow:0,received:0,finishing:!1},c=!1,l=$z(),u=eB(),d=0,f=!1,p=setTimeout(()=>{f=!0,lB(o,1e3),c||l.reject(Error(`connect timeout`))},e.connTimeoutMs),m=()=>{if(e.noClose){u.settle(d);return}lB(o,e.closeStatus??1e3,e.closeReason)};o.onopen=()=>{clearTimeout(p),c=!0,l.resolve()},o.onmessage=t=>{if(!s.finishing){if(!e.unidirectional){let n=sB(e,r,t.data);oB(e,r,s,n)}s.received+=1,cB(e,s.received)&&(s.finishing=!0,m())}},o.onerror=()=>{f||(rB(e,r,`websocket error`),d=1,c||l.reject(Error(`connect failed`)))},o.onclose=t=>{if(clearTimeout(p),f){u.settle(124);return}e.verbose>=1&&rB(e,r,`closed code=${t.code} reason=${JSON.stringify(t.reason||``)}`),d===0&&t.code!==1e3&&t.code!==1005&&t.code!==1001&&(d=1),c||l.reject(Error(`connect closed (code ${t.code})`)),u.settle(d)};try{await l.promise}catch(e){clearTimeout(p);let t=e instanceof Error?e.message:String(e);return{stdout:tB(s.outLines,i),stderr:nB(r.concat([`websocat: ${t}`])),exitCode:t===`connect timeout`?124:1}}e.unidirectionalReverse?!e.noClose&&e.exitOnEof&&!e.oneMessage&&uB(e,o):fB(o,e,dB(o,e,t));let h=await u.promise;return s.droppedForOverflow>0&&rB(e,r,`dropped ${s.droppedForOverflow} inbound message(s) due to output buffer cap`),{stdout:tB(s.outLines,i),stderr:nB(r),exitCode:h}}function mB(e){return{stdout:``,stderr:e,exitCode:2}}function hB(e){return e.WebSocketCtor??(typeof WebSocket<`u`?WebSocket:void 0)}async function gB(e,t,n={}){let r=qz(e);if(r.showHelp)return Pz();if(r.error)return mB(r.error);if(!r.url)return mB(`websocat: missing ws:// or wss:// URL (use --help for usage)
|
|
3238
3238
|
`);if(!/^wss?:\/\//i.test(r.url))return mB(`websocat: URL must start with ws:// or wss://, got '${r.url}'\n`);let i=hB(n);return i?pB(r,t.stdin,i):{stdout:``,stderr:`websocat: no WebSocket implementation available in this runtime
|
|
3239
|
-
`,exitCode:1}}function _B(){return S(`websocat`,async(e,t)=>gB(e,{stdin:P(t.stdin)}))}function vB(){return S(`__wf_progress`,async()=>({stdout:``,stderr:``,exitCode:0}))}const yB={commands:new Map,collisions:[]};async function bB(e,t){let n=lr(t);return e.scriptCatalog?e.scriptCatalog.getJshIndex(n):e.fs?fr(e.fs,n):yB}async function xB(e){return e.scriptCatalog?e.scriptCatalog.getWorkflowCommands():e.fs?Ci(e.fs):new Map}async function SB(e){return e.scriptCatalog?e.scriptCatalog.getWasmCommands():new Map}function CB(e,t){return`${e.glue} (
|
|
3239
|
+
`,exitCode:1}}function _B(){return S(`websocat`,async(e,t)=>gB(e,{stdin:P(t.stdin)}))}function vB(){return S(`__wf_progress`,async()=>({stdout:``,stderr:``,exitCode:0}))}const yB={commands:new Map,collisions:[]};async function bB(e,t){let n=lr(t);return e.scriptCatalog?e.scriptCatalog.getJshIndex(n):e.fs?fr(e.fs,n):yB}async function xB(e){return e.scriptCatalog?e.scriptCatalog.getWorkflowCommands():e.fs?Ci(e.fs):new Map}async function SB(e){return e.scriptCatalog?e.scriptCatalog.getWasmCommands():new Map}function CB(e,t){let n=e.script?`script`:`wasm`;return`${e.glue} (${n}, ${e.pkg}${t?`, ${t}`:``})`}function wB(e,{jshPath:t,collision:n,wasm:r,wf:i}){let a=[`/usr/bin/${e}`];if((t||r||i)&&a.push(` (shadowed by built-in ${e})`),r&&a.push(` (shadowed ${CB(r)})`),t){let e=n?[t,...n.shadowedPaths]:[t];for(let t of e)a.push(` (shadowed ${t})`)}return a}function TB(e,{collision:t,wasm:n,wf:r}){let i=[e];for(let e of t?.shadowedPaths??[])i.push(` (shadowed ${e})`);return n&&i.push(` ${CB(n,`shadowed by .jsh`)}`),r&&i.push(` ${r.path} (workflow, shadowed by .jsh)`),i}function EB(e,t,n,r,i){let{jshPath:a,wasm:o,wf:s}=t;if(n.has(e))return{lines:wB(e,t),found:!0};if(a)return{lines:TB(a,t),found:!0};if(o){let e=[CB(o)];return s&&e.push(` ${s.path} (workflow, shadowed by wasm)`),{lines:e,found:!0}}return s?{lines:[`${s.path} (workflow)`],found:!0}:r.has(e)&&!i.has(e)?{lines:[`/usr/bin/${e}`],found:!0}:{lines:[],found:!1}}function DB(e={}){let t=e.scriptCatalog!==void 0||e.fs!==void 0?e:typeof e.walk==`function`&&typeof e.exists==`function`?{fs:e}:{};return S(`which`,async(e,n)=>{if(w(e))return{stdout:`which - locate a command
|
|
3240
3240
|
|
|
3241
3241
|
Usage: which <command> [command...]
|
|
3242
3242
|
|
|
@@ -3409,5 +3409,5 @@ pass --wait to block and print the full result.`,zB=new Set([`list`,`status`,`st
|
|
|
3409
3409
|
`,stderr:``,exitCode:0};let n;try{n=dV(e)}catch(e){return $B(e.message)}let r=n.positional[0],i=n.positional[1],a=!r||r===`-`,o;try{o=await pV(t,r,a)}catch{return $B(`${r}: No such file or directory`)}if(n.revert){let e=nV(o),r=n.plain?sV(e):cV(e);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),r),{stdout:``,stderr:``,exitCode:0}):{stdout:nV(r),stderr:``,exitCode:0}}let{data:s,base:c}=hV(n,o),l=mV(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 _V(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=br(t,o),s=n?`${n}/${o}`:o;a+=await _V(e,i,s,r)}return a}function vV(){return{stdout:`usage: zip [-r] <archive.zip> <path> [path...]
|
|
3410
3410
|
`,stderr:``,exitCode:0}}function yV(){return S(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return vV();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
|
|
3411
3411
|
`,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(/^\.\//,``))||xr(r);if(i.isDirectory&&!n)return{stdout:``,stderr:`zip: ${e} is a directory (use -r)\n`,exitCode:1};s+=await _V(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
|
|
3412
|
-
`,exitCode:1};let c=jt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function bV(e){let t;return S(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-BBC5wuuf.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function xV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function SV(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}),Ob(`di`,{fs:t,fetch:n}),Ob(`uv`,{fs:t,fetch:n}),KL({fs:t,fetch:n})]}function CV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>tN(e,t))}function wV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function TV(e={}){let t=[LE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),re(),NF(),QP(),GP(e.browserAPI,e.fs),zj(e.browserAPI),Uy(e.browserAPI),HD(e),yV(),SL(),mI(e.fs?{fs:e.fs}:{}),BF(),qF(),WF(),Rv(),_z(wV(e)),lC(wV(e)),gV(),DF(`sqlite3`),DF(`sqllite`),jI(),ZI(),Wx(),bv(),nj({buildProcessConfig:e.buildProcessConfig}),nj({buildProcessConfig:e.buildProcessConfig},`jsh`),...CV(e),...SV(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(),Mz(e.webhook),_B(),Hy(e.crontask),bV(e),aM({fs:e.fs,fetch:e.fetch}),sC(),vF(),Bj(),Vj(`pdftk`),Vj(`pdf`),xv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),xv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Zj(`pdftoppm`),Zj(`pdftocairo`),Qj(`pdftotext`),Ey(`convert`),Ey(`magick`),DB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),tL(),_L(),RD(),zD(),vL(),hA(),aN(),sA(),hx(),_j(),gj(),iA(),gP(xV(e)),jm(e.gitCredential),vN({fs:e.fs}),WN(),Fv(),Iv(),Lv(`xclip`),Lv(`xsel`),UN(),wC(),Kg(),qg(),HA(e.fs),ct(),sj(),p_({getParentJid:e.getParentJid}),Cx(),DM({processManager:e.processManager}),sR({processManager:e.processManager}),wk({processManager:e.processManager}),Sk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...g_(),pA(),Xk(),MR(),bD(),TS(),JR({processManager:e.processManager}),Vv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),IS(),Ov({registry:e.cherryRuntimeRegistry}),Qy(),ib({fs:e.fs}),ab({fs:e.fs}),FF(e.sudoCommand),WB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),vB(),ZP()];return e.fs&&(eM(),t.push(...Jn.map(t=>PE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let EV=null;function DV(e){EV=e}function OV(e){EV?.(e)}var kV=Ht();const AV=Reflect.get(nt,`DefenseInDepthBox`);function jV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function MV(e,t){if(typeof e!=`string`)return e;let n=jV(t);if(n===`binary`||n===`latin1`){let t=_e(e);if(t)return t}return kV.Buffer.from(e,n)}function NV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}var PV=class{vfs;registeredCommandsFn=null;listingStats=new Map;listingStatsMax;listingStatsTtlMs;constructor(e,t){this.vfs=e,this.listingStatsMax=Math.max(1,t?.listingStatsMax??2e4),this.listingStatsTtlMs=t?.listingStatsTtlMs??1e3,this.updateMetadataBatch=this.updateMetadataBatch.bind(this),this.symlinkBatch=this.symlinkBatch.bind(this)}get listingStatsSize(){return this.listingStats.size}primeListingStats(e,t){let n=Date.now();if(t.length>this.listingStatsMax){this.listingStats.clear();return}this.sweepExpiredListingStats(n),this.listingStats.size+t.length>this.listingStatsMax&&this.listingStats.clear();let r=e===`/`?`/`:`${e}/`;for(let e of t){let t=Ve(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}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=NV(e);if(t===`/usr`||t===`/usr/bin`)return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date(0)};if(t.startsWith(`/usr/bin/`)){let e=t.slice(9);if(e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:493,size:0,mtime:new Date(0)}}return null}canWrite(e){let t=this.vfs;return typeof t.canWrite!=`function`||t.canWrite(e)}listMountPoints(){let e=this.vfs;return typeof e.listMountPoints==`function`?e.listMountPoints():[]}trusted(e){let t=AV?.runTrustedAsync;return t?t(e):Promise.resolve().then(e)}async readFile(e,t){return this.trusted(async()=>{let n=b(e),r=await this.vfs.readFile(n,{encoding:`binary`}),i=r instanceof Uint8Array?r:new TextEncoder().encode(r),a=jV(t),o=kV.Buffer.from(i.buffer,i.byteOffset,i.byteLength).toString(a);return a!==`hex`&&a!==`base64`&&m(o,i),o})}async readFileBuffer(e){return this.trusted(async()=>{let t=b(e),n=await this.vfs.readFile(t,{encoding:`binary`});return n instanceof Uint8Array?n:new TextEncoder().encode(n)})}async readFileBytes(e){let t=await this.readFileBuffer(e);return kV.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString(`latin1`)}async getNativeFile(e){return this.trusted(()=>this.vfs.getNativeFile(b(e)))}async readFileRange(e,t,n){return this.trusted(()=>this.vfs.readFileRange(b(e),t,n))}async writeFile(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=b(e);await this.vfs.writeFile(r,MV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(b(e),MV(t,n)))}async exists(e){return this.trusted(async()=>{let t=b(e);return this.virtualUsrStat(t)?!0:this.vfs.exists(t)})}async stat(e){return this.trusted(async()=>{let t=b(e),n=this.virtualUsrStat(t);if(n)return n;let r=this.vfs.statSync(t);if(r)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};let i=this.primedStats(t)??await this.vfs.stat(t);return{isFile:i.type===`file`,isDirectory:i.type===`directory`,isSymbolicLink:!!i.isSymlink,mode:i.mode??(i.type===`directory`?493:420),size:i.size,mtime:new Date(i.mtime),identity:i.identity,dev:i.dev,ino:i.identity===void 0?void 0:i.ino}})}async lstat(e){return this.trusted(async()=>{let t=b(e),n=this.virtualUsrStat(t);if(n)return n;let r=this.vfs.lstatSync(t);if(r)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};let i=this.primedStats(t)??await this.vfs.lstat(t);return{isFile:i.type===`file`,isDirectory:i.type===`directory`,isSymbolicLink:i.type===`symlink`,mode:i.mode??(i.type===`directory`?493:i.type===`symlink`?511:420),size:i.size,mtime:new Date(i.mtime),identity:i.identity,dev:i.dev,ino:i.identity===void 0?void 0:i.ino}})}async mkdir(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.mkdir(b(e),t)})}async readdir(e){return this.trusted(async()=>{let t=b(e);if(t===`/usr`)return[`bin`];if(NV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return n.map(e=>e.name);let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),r.map(e=>e.name)})}async readdirWithFileTypes(e){return this.trusted(async()=>{let t=b(e);if(t===`/usr`)return[{name:`bin`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}];if(NV(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 this.mapFastEntriesToDirents(n);let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),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(b(e),t)})}async cp(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=b(e),i=b(t);if((await this.vfs.stat(r)).type===`directory`){if(!n?.recursive)throw new He(`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=x(e,r.name),i=x(t,r.name);r.type===`directory`?await this.cpDir(n,i):await this.vfs.copyFile(n,i)}}async mv(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rename(b(e),b(t))})}async rename(e,t){return this.mv(e,t)}resolvePath(e,t){return t.startsWith(`/`)?b(t):b(x(e,t))}getAllPaths(){return[]}async chmod(e,t){return this.dropListingStats(),this.trusted(()=>this.vfs.chmod(b(e),t))}async updateMetadataBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.updateMetadataBatch(e.map(e=>({...e,path:b(e.path)}))))}async symlinkBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.symlinkBatch(e.map(e=>({target:e.target,path:b(e.path)}))))}async symlink(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.symlink(e,b(t))})}async link(e,t){throw Error(`Hard links not supported in VirtualFS`)}async readlink(e){return this.trusted(async()=>this.vfs.readlink(b(e)))}async realpath(e){return this.trusted(async()=>this.vfs.realpath(b(e)))}async utimes(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.utimes(b(e),t,n))}invalidatePaths(e){this.dropListingStats();let t=this.vfs;t.invalidatePaths&&t.invalidatePaths(e)}async forgetSidecarConsistency(){await this.vfs.forgetSidecarConsistency?.()}};function FV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?FV(e.getUnderlyingFS?.()):null}async function IV(e){let t=ge(`github`);if(t){if(e?.force){await t.onSilentRenew?.();return}await t.getValidAccessToken?.()}}function LV(){let e=ge(`github`);if(!e)return Sm;let t=typeof localStorage>`u`?[]:l(localStorage).github;return[...e.oauthTokenDomains??Sm,...t??[]]}const RV=e(`almost-bash-shell`),zV=`__SLICC_RUN_PID`,BV=`__SLICC_OUTPUT_TEE__`;function VV(e){let t=e?.get(zV);if(t===void 0)return;let n=Number.parseInt(t,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function HV(e){if(!(zV in e)&&!(BV in e)&&!(`__SLICC_SUDO_REASON`in e)&&!(`__SLICC_PIPESTATUS`in e)&&!(`__SLICC_PIPESTATUS_EX`in e))return{...e};let{[zV]:t,[BV]:n,[am]:r,[Pt]:i,[It]:a,...o}=e;return o}function UV(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 WV=class e{options;bash;vfsAdapter;gitCommands;mountCommands;lastEnv;cwd;umask=18;builtinCommandNames;staticBuiltinNames;allowedCommands;scriptCatalog;initialJshSync=null;ownsScriptCatalog;registeredJshCommands=new Map;registeredWorkflowCommands=new Set;registeredWasmCommands=new Set;jshSyncInflight=null;jshSyncDirty=!1;pendingCommandGrants=[];pendingSudoBypasses=new Map;pendingEnvWrites=new Map;activeShellPid;progress;activeRunSignal;commandAbort=new AbortController;scriptRun=null;scriptRunsActive=0;registryNames=new Set;outputTees=new Map;nextOutputTeeId=0;resolveJshProcessConfig=e=>this.buildJshProcessConfig(VV(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:gp,PATH:ur,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return TV({onMediaPreview:async e=>this.renderMediaPreview(e),getJshCommands:()=>this.getJshCommandNames(),getWorkflowCommands:()=>this.getWorkflowCommandNames(),syncScriptCommands:()=>this.syncJshCommands(),getStaticBuiltins:()=>[...this.staticBuiltinNames],getScriptRegisteredNames:()=>[...this.registeredJshCommands.keys(),...this.registeredWorkflowCommands,...this.registeredWasmCommands],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.pendingCommandGrants.push(e)},suppressNextGate:e=>this.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:LV},gitIdentity:()=>this.gitCommands.identity(),mcpConnectionManager:e.mcpConnectionManager})}constructor(t){this.options=t,this.vfsAdapter=new PV(t.fs),this.progress=new bp({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t);let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new cp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:IV}),this.mountCommands=new Fs({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:Im});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=FV(i)??FV(a);this.scriptCatalog=t.scriptCatalog??new Ti({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||cr(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=g({progress:Tp(this.progress)}),l=_({progress:Tp(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),Ah(t.fs),Dg(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...it(),...rt()],p=this.allowedCommands?f.filter(e=>this.isCommandAllowed(e)):void 0;if(this.bash=new at({fs:this.vfsAdapter,cwd:n,env:{},fetch:c,commands:p,customCommands:d,sleep:Kp(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:up(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(Wm),this.allowedCommands!==null){let e=this.bash;for(let t of rt())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??[...it(),...rt()];this.builtinCommandNames=new Set([...h,...m]),this.staticBuiltinNames=new Set(this.builtinCommandNames),this.vfsAdapter.setRegisteredCommandsFn(()=>[...this.builtinCommandNames]),this.lastEnv={...r},this.cwd=n,this.startInitialJshSync()}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[...(await this.getFilteredJshCommands()).keys()]}async syncJshCommands(){return this.jshSyncInflight===null?(this.jshSyncInflight=this.doSyncJshCommands(),this.jshSyncInflight):(this.jshSyncDirty=!0,this.jshSyncInflight)}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 ai(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`)}currentScanRoots(){return dr(this.lastEnv.PATH)}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 _p(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=vp(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){RV.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(OV(e.trim().split(/\s+/)[0]||`unknown`),v(),await this.waitForInitialJshSync(t),await this.usesGnuBash())return this.runOnGnuBash(e,t,n,r,i,a);let o=sm(e),s={env:{...this.lastEnv,...n===void 0?{}:{[zV]:String(n)},...i===void 0?{}:{[BV]:i},...o?{[am]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=UV([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(Lt(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.flushPendingCommandGrants(),d=Mt(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=HV(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.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-BISPom3l.js`);return Ft(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()}async usesGnuBash(){return!this.options.gnuBash||this.lastEnv.SLICC_SHELL===`just-bash`||typeof SharedArrayBuffer!=`function`?!1:(await this.scriptCatalog.getWasmCommands()).has(`bash`)}async runOnGnuBash(e,t,n,r,i,a){let{runWasmCommand:o,withoutRealmDefaults:s}=await import(`./run-C-gx42zq.js`),c=sm(e),l={...this.lastEnv,...n===void 0?{}:{[zV]:String(n)},...c?{[am]:c}:{}},u=i===void 0?void 0:this.outputTees.get(i),d=await hp(e,{env:l,run:(e,i,a)=>o(e,this.wasmContext(i,t,r),{processConfig:this.buildJshProcessConfig(n),gate:this.gateNativeCommand,onOutput:u,fds:a,commands:()=>this.scriptCatalog.getWasmCommands(),gitIdentity:()=>this.gitCommands.identity()})}),f=this.lastEnv.PATH;return d.state&&(this.cwd=d.state.cwd,this.lastEnv=pp(s(d.state.env,l),[zV,am,BV])),this.lastEnv.PATH!==f&&await this.syncJshCommands().catch(()=>void 0),await this.flushPendingCommandGrants(),this.applyPendingEnvWrites(),{stdout:d.stdout,stderr:d.stderr,exitCode:d.exitCode,env:{...this.lastEnv},...a&&d.state?{pipeStatus:d.state.pipeStatus}:{}}}wasmContext(e,t,n){return{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(e)),exportedEnv:e,stdin:n,signal:t,exec:(e,t)=>this.bash.exec(e,{...t,umask:this.umask})}}gateNativeCommand=async(e,t,n)=>{if(this.allowedCommands!==null&&!this.isCommandAllowed(e))return{stderr:`bash: ${e}: command not found\n`,exitCode:127};if(!this.isTransparentGatingEnabled()||xm.has(e))return null;let r=await this.gateCommandDispatch(e,t,n[am]);return r?{stderr:r.stderr,exitCode:r.exitCode}:null};isTransparentGatingEnabled(){let e=this.options.sudo;return!!e&&e.transparentGating!==!1}wrapCommandForDispatch(e){let t=this.wrapCommandForSudo(e),n=e.name===`timeout`?Xp(t,this.progress):Qp(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(BV),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await em(()=>n.execute(e,t),t.signal);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(BV);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=Vp(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Up(t,this.progress,Hp(e)),this.scriptRun}endScriptRun(e){this.scriptRunsActive=Math.max(0,this.scriptRunsActive-1),e&&(e.end(),this.scriptRun===e&&(this.scriptRun=null))}wrapCommandForSudo(e){if(!this.isTransparentGatingEnabled()||xm.has(e.name))return e;let t=(t,n)=>this.gateCommandDispatch(e.name,t,n);return{...e,async execute(n,r){return await t(n,r.env?.get(am))||e.execute(n,r)}}}async gateCommandDispatch(e,t,n){let r=this.options.sudo;if(!r)return null;let i=nm(e,t);if(this.consumeSudoBypass(i))return null;let a=r.getPolicy();if(!a)return null;let o=await im(i,{policy:a,broker:r.broker,persistGrant:async e=>{this.pendingCommandGrants.push(e)},defaultDisposition:r.defaultDisposition,...n?{reason:n}:{}});return o.allowed?null:{stdout:``,stderr:`${o.message}\n`,exitCode:o.exitCode??77}}registerSudoBypass(e){let t=e.trim();t&&this.pendingSudoBypasses.set(t,(this.pendingSudoBypasses.get(t)??0)+1)}consumeSudoBypass(e){let t=this.pendingSudoBypasses.get(e);return t?(t===1?this.pendingSudoBypasses.delete(e):this.pendingSudoBypasses.set(e,t-1),!0):!1}async flushPendingCommandGrants(){if(this.pendingCommandGrants.length===0)return;let e=this.pendingCommandGrants;this.pendingCommandGrants=[];for(let t of e)try{await this.persistCommandGrant(t)}catch{}}async persistCommandGrant(e){let t=this.options.sudo?.persistCommandGrant;if(t){await t(e);return}let n=ut(e);if(!n)return;let r=`${ft}/granted`,i=this.options.fs,a=``;try{await i.exists(r)&&(a=await i.readFile(r))}catch(e){if(!(e instanceof He&&e.code===`ENOENT`))throw e}let o=a&&!a.endsWith(`
|
|
3413
|
-
`)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(xm.get(e)??e)}async doSyncJshCommands(){try{let e=await this.scriptCatalog.getJshIndex(this.currentScanRoots()),t=e.commands;for(let t of e.collisions)RV.warn(`jsh command '${t.name}' is provided by more than one skill; using ${t.winnerPath} (${t.reason}), shadowed ${t.shadowedPaths.join(`, `)}`);let n=await this.getFilteredWorkflowCommands(),r=await this.scriptCatalog.getWasmCommands();for(let[e,n]of t)this.isCommandAllowed(e)&&(this.builtinCommandNames.has(e)&&!this.registeredJshCommands.has(e)||this.registeredJshCommands.get(e)!==n&&(this.bash.registerCommand(this.wrapCommandForDispatch(this.makeScriptCommand(e))),this.registeredJshCommands.set(e,n),this.builtinCommandNames.add(e)));let i=[...r.keys()].filter(e=>this.isCommandAllowed(e));this.registerLateScriptNames(i,this.registeredWasmCommands),this.registerLateScriptNames(n.keys(),this.registeredWorkflowCommands)}finally{this.jshSyncInflight=null,this.jshSyncDirty&&(this.jshSyncDirty=!1,this.syncJshCommands().catch(()=>void 0))}}registerLateScriptNames(e,t){let n=[this.registeredJshCommands,this.registeredWasmCommands,this.registeredWorkflowCommands];for(let r of e)if(!t.has(r)){if(n.some(e=>e!==t&&e.has(r))){t.add(r);continue}this.builtinCommandNames.has(r)||(this.bash.registerCommand(this.wrapCommandForDispatch(this.makeScriptCommand(r))),t.add(r),this.builtinCommandNames.add(r))}}makeScriptCommand(e){let t=this.scriptCatalog,n=this.options.jshDiscoveryFs??this.options.fs,r=e,i=async(e,i)=>{let a=i.exec??((e,t)=>this.bash.exec(e,{env:t?.env??Object.fromEntries(i.env),cwd:t?.cwd??i.cwd,args:t?.args,...t?.env===void 0?{}:{replaceEnv:!0}})),o=(await t.getJshCommands(this.currentScanRoots())).get(r);if(o){let t;try{let e=await n.readFile(o,{encoding:`utf-8`});t=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${o}'\n`,exitCode:127}}return ci(t,[`node`,o,...e],{fs:i.fs,cwd:i.cwd,env:i.env,stdin:i.stdin,exec:a},this.buildJshProcessConfig(VV(i.env)))}let s=(await t.getWasmCommands()).get(r);if(s){let{runWasmCommand:n}=await import(`./run-
|
|
3412
|
+
`,exitCode:1};let c=jt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function bV(e){let t;return S(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-BZ4YBir6.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function xV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function SV(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}),Ob(`di`,{fs:t,fetch:n}),Ob(`uv`,{fs:t,fetch:n}),KL({fs:t,fetch:n})]}function CV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>tN(e,t))}function wV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function TV(e={}){let t=[LE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),re(),NF(),QP(),GP(e.browserAPI,e.fs),zj(e.browserAPI),Uy(e.browserAPI),HD(e),yV(),SL(),mI(e.fs?{fs:e.fs}:{}),BF(),qF(),WF(),Rv(),_z(wV(e)),lC(wV(e)),gV(),DF(`sqlite3`),DF(`sqllite`),jI(),ZI(),Wx(),bv(),nj({buildProcessConfig:e.buildProcessConfig}),nj({buildProcessConfig:e.buildProcessConfig},`jsh`),...CV(e),...SV(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(),Mz(e.webhook),_B(),Hy(e.crontask),bV(e),aM({fs:e.fs,fetch:e.fetch}),sC(),vF(),Bj(),Vj(`pdftk`),Vj(`pdf`),xv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),xv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Zj(`pdftoppm`),Zj(`pdftocairo`),Qj(`pdftotext`),Ey(`convert`),Ey(`magick`),DB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),tL(),_L(),RD(),zD(),vL(),hA(),aN(),sA(),hx(),_j(),gj(),iA(),gP(xV(e)),jm(e.gitCredential),vN({fs:e.fs}),WN(),Fv(),Iv(),Lv(`xclip`),Lv(`xsel`),UN(),wC(),Kg(),qg(),HA(e.fs),ct(),sj(),p_({getParentJid:e.getParentJid}),Cx(),DM({processManager:e.processManager}),sR({processManager:e.processManager}),wk({processManager:e.processManager}),Sk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...g_(),pA(),Xk(),MR(),bD(),TS(),JR({processManager:e.processManager}),Vv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),IS(),Ov({registry:e.cherryRuntimeRegistry}),Qy(),ib({fs:e.fs}),ab({fs:e.fs}),FF(e.sudoCommand),WB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),vB(),ZP()];return e.fs&&(eM(),t.push(...Jn.map(t=>PE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let EV=null;function DV(e){EV=e}function OV(e){EV?.(e)}var kV=Ht();const AV=Reflect.get(nt,`DefenseInDepthBox`);function jV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function MV(e,t){if(typeof e!=`string`)return e;let n=jV(t);if(n===`binary`||n===`latin1`){let t=_e(e);if(t)return t}return kV.Buffer.from(e,n)}function NV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}var PV=class{vfs;registeredCommandsFn=null;listingStats=new Map;listingStatsMax;listingStatsTtlMs;constructor(e,t){this.vfs=e,this.listingStatsMax=Math.max(1,t?.listingStatsMax??2e4),this.listingStatsTtlMs=t?.listingStatsTtlMs??1e3,this.updateMetadataBatch=this.updateMetadataBatch.bind(this),this.symlinkBatch=this.symlinkBatch.bind(this)}get listingStatsSize(){return this.listingStats.size}primeListingStats(e,t){let n=Date.now();if(t.length>this.listingStatsMax){this.listingStats.clear();return}this.sweepExpiredListingStats(n),this.listingStats.size+t.length>this.listingStatsMax&&this.listingStats.clear();let r=e===`/`?`/`:`${e}/`;for(let e of t){let t=Ve(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}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=NV(e);if(t===`/usr`||t===`/usr/bin`)return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date(0)};if(t.startsWith(`/usr/bin/`)){let e=t.slice(9);if(e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:493,size:0,mtime:new Date(0)}}return null}canWrite(e){let t=this.vfs;return typeof t.canWrite!=`function`||t.canWrite(e)}listMountPoints(){let e=this.vfs;return typeof e.listMountPoints==`function`?e.listMountPoints():[]}trusted(e){let t=AV?.runTrustedAsync;return t?t(e):Promise.resolve().then(e)}async readFile(e,t){return this.trusted(async()=>{let n=b(e),r=await this.vfs.readFile(n,{encoding:`binary`}),i=r instanceof Uint8Array?r:new TextEncoder().encode(r),a=jV(t),o=kV.Buffer.from(i.buffer,i.byteOffset,i.byteLength).toString(a);return a!==`hex`&&a!==`base64`&&m(o,i),o})}async readFileBuffer(e){return this.trusted(async()=>{let t=b(e),n=await this.vfs.readFile(t,{encoding:`binary`});return n instanceof Uint8Array?n:new TextEncoder().encode(n)})}async readFileBytes(e){let t=await this.readFileBuffer(e);return kV.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString(`latin1`)}async getNativeFile(e){return this.trusted(()=>this.vfs.getNativeFile(b(e)))}async readFileRange(e,t,n){return this.trusted(()=>this.vfs.readFileRange(b(e),t,n))}async writeFile(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=b(e);await this.vfs.writeFile(r,MV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(b(e),MV(t,n)))}async exists(e){return this.trusted(async()=>{let t=b(e);return this.virtualUsrStat(t)?!0:this.vfs.exists(t)})}async stat(e){return this.trusted(async()=>{let t=b(e),n=this.virtualUsrStat(t);if(n)return n;let r=this.vfs.statSync(t);if(r)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};let i=this.primedStats(t)??await this.vfs.stat(t);return{isFile:i.type===`file`,isDirectory:i.type===`directory`,isSymbolicLink:!!i.isSymlink,mode:i.mode??(i.type===`directory`?493:420),size:i.size,mtime:new Date(i.mtime),identity:i.identity,dev:i.dev,ino:i.identity===void 0?void 0:i.ino}})}async lstat(e){return this.trusted(async()=>{let t=b(e),n=this.virtualUsrStat(t);if(n)return n;let r=this.vfs.lstatSync(t);if(r)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};let i=this.primedStats(t)??await this.vfs.lstat(t);return{isFile:i.type===`file`,isDirectory:i.type===`directory`,isSymbolicLink:i.type===`symlink`,mode:i.mode??(i.type===`directory`?493:i.type===`symlink`?511:420),size:i.size,mtime:new Date(i.mtime),identity:i.identity,dev:i.dev,ino:i.identity===void 0?void 0:i.ino}})}async mkdir(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.mkdir(b(e),t)})}async readdir(e){return this.trusted(async()=>{let t=b(e);if(t===`/usr`)return[`bin`];if(NV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return n.map(e=>e.name);let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),r.map(e=>e.name)})}async readdirWithFileTypes(e){return this.trusted(async()=>{let t=b(e);if(t===`/usr`)return[{name:`bin`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}];if(NV(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 this.mapFastEntriesToDirents(n);let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),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(b(e),t)})}async cp(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=b(e),i=b(t);if((await this.vfs.stat(r)).type===`directory`){if(!n?.recursive)throw new He(`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=x(e,r.name),i=x(t,r.name);r.type===`directory`?await this.cpDir(n,i):await this.vfs.copyFile(n,i)}}async mv(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rename(b(e),b(t))})}async rename(e,t){return this.mv(e,t)}resolvePath(e,t){return t.startsWith(`/`)?b(t):b(x(e,t))}getAllPaths(){return[]}async chmod(e,t){return this.dropListingStats(),this.trusted(()=>this.vfs.chmod(b(e),t))}async updateMetadataBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.updateMetadataBatch(e.map(e=>({...e,path:b(e.path)}))))}async symlinkBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.symlinkBatch(e.map(e=>({target:e.target,path:b(e.path)}))))}async symlink(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.symlink(e,b(t))})}async link(e,t){throw Error(`Hard links not supported in VirtualFS`)}async readlink(e){return this.trusted(async()=>this.vfs.readlink(b(e)))}async realpath(e){return this.trusted(async()=>this.vfs.realpath(b(e)))}async utimes(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.utimes(b(e),t,n))}invalidatePaths(e){this.dropListingStats();let t=this.vfs;t.invalidatePaths&&t.invalidatePaths(e)}async forgetSidecarConsistency(){await this.vfs.forgetSidecarConsistency?.()}};function FV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?FV(e.getUnderlyingFS?.()):null}async function IV(e){let t=ge(`github`);if(t){if(e?.force){await t.onSilentRenew?.();return}await t.getValidAccessToken?.()}}function LV(){let e=ge(`github`);if(!e)return Sm;let t=typeof localStorage>`u`?[]:l(localStorage).github;return[...e.oauthTokenDomains??Sm,...t??[]]}const RV=e(`almost-bash-shell`),zV=`__SLICC_RUN_PID`,BV=`__SLICC_OUTPUT_TEE__`;function VV(e){let t=e?.get(zV);if(t===void 0)return;let n=Number.parseInt(t,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function HV(e){if(!(zV in e)&&!(BV in e)&&!(`__SLICC_SUDO_REASON`in e)&&!(`__SLICC_PIPESTATUS`in e)&&!(`__SLICC_PIPESTATUS_EX`in e))return{...e};let{[zV]:t,[BV]:n,[am]:r,[Pt]:i,[It]:a,...o}=e;return o}function UV(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 WV=class e{options;bash;vfsAdapter;gitCommands;mountCommands;lastEnv;cwd;umask=18;builtinCommandNames;staticBuiltinNames;allowedCommands;scriptCatalog;initialJshSync=null;ownsScriptCatalog;registeredJshCommands=new Map;registeredWorkflowCommands=new Set;registeredWasmCommands=new Set;jshSyncInflight=null;jshSyncDirty=!1;pendingCommandGrants=[];pendingSudoBypasses=new Map;pendingEnvWrites=new Map;activeShellPid;progress;activeRunSignal;commandAbort=new AbortController;scriptRun=null;scriptRunsActive=0;registryNames=new Set;outputTees=new Map;nextOutputTeeId=0;resolveJshProcessConfig=e=>this.buildJshProcessConfig(VV(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:gp,PATH:ur,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return TV({onMediaPreview:async e=>this.renderMediaPreview(e),getJshCommands:()=>this.getJshCommandNames(),getWorkflowCommands:()=>this.getWorkflowCommandNames(),syncScriptCommands:()=>this.syncJshCommands(),getStaticBuiltins:()=>[...this.staticBuiltinNames],getScriptRegisteredNames:()=>[...this.registeredJshCommands.keys(),...this.registeredWorkflowCommands,...this.registeredWasmCommands],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.pendingCommandGrants.push(e)},suppressNextGate:e=>this.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:LV},gitIdentity:()=>this.gitCommands.identity(),mcpConnectionManager:e.mcpConnectionManager})}constructor(t){this.options=t,this.vfsAdapter=new PV(t.fs),this.progress=new bp({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t);let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new cp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:IV}),this.mountCommands=new Fs({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:Im});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=FV(i)??FV(a);this.scriptCatalog=t.scriptCatalog??new Ti({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||cr(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=g({progress:Tp(this.progress)}),l=_({progress:Tp(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),Ah(t.fs),Dg(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...it(),...rt()],p=this.allowedCommands?f.filter(e=>this.isCommandAllowed(e)):void 0;if(this.bash=new at({fs:this.vfsAdapter,cwd:n,env:{},fetch:c,commands:p,customCommands:d,sleep:Kp(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:up(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(Wm),this.allowedCommands!==null){let e=this.bash;for(let t of rt())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??[...it(),...rt()];this.builtinCommandNames=new Set([...h,...m]),this.staticBuiltinNames=new Set(this.builtinCommandNames),this.vfsAdapter.setRegisteredCommandsFn(()=>[...this.builtinCommandNames]),this.lastEnv={...r},this.cwd=n,this.startInitialJshSync()}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[...(await this.getFilteredJshCommands()).keys()]}async syncJshCommands(){return this.jshSyncInflight===null?(this.jshSyncInflight=this.doSyncJshCommands(),this.jshSyncInflight):(this.jshSyncDirty=!0,this.jshSyncInflight)}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 ai(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`)}currentScanRoots(){return dr(this.lastEnv.PATH)}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 _p(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=vp(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){RV.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(OV(e.trim().split(/\s+/)[0]||`unknown`),v(),await this.waitForInitialJshSync(t),await this.usesGnuBash())return this.runOnGnuBash(e,t,n,r,i,a);let o=sm(e),s={env:{...this.lastEnv,...n===void 0?{}:{[zV]:String(n)},...i===void 0?{}:{[BV]:i},...o?{[am]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=UV([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(Lt(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.flushPendingCommandGrants(),d=Mt(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=HV(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.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-BISPom3l.js`);return Ft(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()}async usesGnuBash(){return!this.options.gnuBash||this.lastEnv.SLICC_SHELL===`just-bash`||typeof SharedArrayBuffer!=`function`?!1:(await this.scriptCatalog.getWasmCommands()).has(`bash`)}async runOnGnuBash(e,t,n,r,i,a){let{runWasmCommand:o,withoutRealmDefaults:s}=await import(`./run-HzYAVLeI.js`),c=sm(e),l={...this.lastEnv,...n===void 0?{}:{[zV]:String(n)},...c?{[am]:c}:{}},u=i===void 0?void 0:this.outputTees.get(i),d=await hp(e,{env:l,run:(e,i,a)=>o(e,this.wasmContext(i,t,r),{processConfig:this.buildJshProcessConfig(n),gate:this.gateNativeCommand,onOutput:u,fds:a,commands:()=>this.scriptCatalog.getWasmCommands(),gitIdentity:()=>this.gitCommands.identity()})}),f=this.lastEnv.PATH;return d.state&&(this.cwd=d.state.cwd,this.lastEnv=pp(s(d.state.env,l),[zV,am,BV])),this.lastEnv.PATH!==f&&await this.syncJshCommands().catch(()=>void 0),await this.flushPendingCommandGrants(),this.applyPendingEnvWrites(),{stdout:d.stdout,stderr:d.stderr,exitCode:d.exitCode,env:{...this.lastEnv},...a&&d.state?{pipeStatus:d.state.pipeStatus}:{}}}wasmContext(e,t,n){return{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(e)),exportedEnv:e,stdin:n,signal:t,exec:(e,t)=>this.bash.exec(e,{...t,umask:this.umask})}}gateNativeCommand=async(e,t,n)=>{if(this.allowedCommands!==null&&!this.isCommandAllowed(e))return{stderr:`bash: ${e}: command not found\n`,exitCode:127};if(!this.isTransparentGatingEnabled()||xm.has(e))return null;let r=await this.gateCommandDispatch(e,t,n[am]);return r?{stderr:r.stderr,exitCode:r.exitCode}:null};isTransparentGatingEnabled(){let e=this.options.sudo;return!!e&&e.transparentGating!==!1}wrapCommandForDispatch(e){let t=this.wrapCommandForSudo(e),n=e.name===`timeout`?Xp(t,this.progress):Qp(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(BV),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await em(()=>n.execute(e,t),t.signal);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(BV);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=Vp(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Up(t,this.progress,Hp(e)),this.scriptRun}endScriptRun(e){this.scriptRunsActive=Math.max(0,this.scriptRunsActive-1),e&&(e.end(),this.scriptRun===e&&(this.scriptRun=null))}wrapCommandForSudo(e){if(!this.isTransparentGatingEnabled()||xm.has(e.name))return e;let t=(t,n)=>this.gateCommandDispatch(e.name,t,n);return{...e,async execute(n,r){return await t(n,r.env?.get(am))||e.execute(n,r)}}}async gateCommandDispatch(e,t,n){let r=this.options.sudo;if(!r)return null;let i=nm(e,t);if(this.consumeSudoBypass(i))return null;let a=r.getPolicy();if(!a)return null;let o=await im(i,{policy:a,broker:r.broker,persistGrant:async e=>{this.pendingCommandGrants.push(e)},defaultDisposition:r.defaultDisposition,...n?{reason:n}:{}});return o.allowed?null:{stdout:``,stderr:`${o.message}\n`,exitCode:o.exitCode??77}}registerSudoBypass(e){let t=e.trim();t&&this.pendingSudoBypasses.set(t,(this.pendingSudoBypasses.get(t)??0)+1)}consumeSudoBypass(e){let t=this.pendingSudoBypasses.get(e);return t?(t===1?this.pendingSudoBypasses.delete(e):this.pendingSudoBypasses.set(e,t-1),!0):!1}async flushPendingCommandGrants(){if(this.pendingCommandGrants.length===0)return;let e=this.pendingCommandGrants;this.pendingCommandGrants=[];for(let t of e)try{await this.persistCommandGrant(t)}catch{}}async persistCommandGrant(e){let t=this.options.sudo?.persistCommandGrant;if(t){await t(e);return}let n=ut(e);if(!n)return;let r=`${ft}/granted`,i=this.options.fs,a=``;try{await i.exists(r)&&(a=await i.readFile(r))}catch(e){if(!(e instanceof He&&e.code===`ENOENT`))throw e}let o=a&&!a.endsWith(`
|
|
3413
|
+
`)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(xm.get(e)??e)}async doSyncJshCommands(){try{let e=await this.scriptCatalog.getJshIndex(this.currentScanRoots()),t=e.commands;for(let t of e.collisions)RV.warn(`jsh command '${t.name}' is provided by more than one skill; using ${t.winnerPath} (${t.reason}), shadowed ${t.shadowedPaths.join(`, `)}`);let n=await this.getFilteredWorkflowCommands(),r=await this.scriptCatalog.getWasmCommands();for(let[e,n]of t)this.isCommandAllowed(e)&&(this.builtinCommandNames.has(e)&&!this.registeredJshCommands.has(e)||this.registeredJshCommands.get(e)!==n&&(this.bash.registerCommand(this.wrapCommandForDispatch(this.makeScriptCommand(e))),this.registeredJshCommands.set(e,n),this.builtinCommandNames.add(e)));let i=[...r.keys()].filter(e=>this.isCommandAllowed(e));this.registerLateScriptNames(i,this.registeredWasmCommands),this.registerLateScriptNames(n.keys(),this.registeredWorkflowCommands)}finally{this.jshSyncInflight=null,this.jshSyncDirty&&(this.jshSyncDirty=!1,this.syncJshCommands().catch(()=>void 0))}}registerLateScriptNames(e,t){let n=[this.registeredJshCommands,this.registeredWasmCommands,this.registeredWorkflowCommands];for(let r of e)if(!t.has(r)){if(n.some(e=>e!==t&&e.has(r))){t.add(r);continue}this.builtinCommandNames.has(r)||(this.bash.registerCommand(this.wrapCommandForDispatch(this.makeScriptCommand(r))),t.add(r),this.builtinCommandNames.add(r))}}makeScriptCommand(e){let t=this.scriptCatalog,n=this.options.jshDiscoveryFs??this.options.fs,r=e,i=async(e,i)=>{let a=i.exec??((e,t)=>this.bash.exec(e,{env:t?.env??Object.fromEntries(i.env),cwd:t?.cwd??i.cwd,args:t?.args,...t?.env===void 0?{}:{replaceEnv:!0}})),o=(await t.getJshCommands(this.currentScanRoots())).get(r);if(o){let t;try{let e=await n.readFile(o,{encoding:`utf-8`});t=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${o}'\n`,exitCode:127}}return ci(t,[`node`,o,...e],{fs:i.fs,cwd:i.cwd,env:i.env,stdin:i.stdin,exec:a},this.buildJshProcessConfig(VV(i.env)))}let s=(await t.getWasmCommands()).get(r);if(s){let{runWasmCommand:n}=await import(`./run-HzYAVLeI.js`);return n(s.script?[r,...e]:[`--argv0`,s.argv0,`--module`,s.wasm,s.glue,...e],i,{processConfig:this.buildJshProcessConfig(VV(i.env)),gate:this.gateNativeCommand,defaults:s.env,commands:()=>t.getWasmCommands(),gitIdentity:()=>this.gitCommands.identity()})}let c=(await t.getWorkflowCommands()).get(r);if(c){let t=wi(c.path,e);return a(t[0],{args:t.slice(1),cwd:i.cwd})}return{stdout:``,stderr:`${r}: command no longer exists\n`,exitCode:127}};return{name:e,trusted:!0,async execute(e,t){try{return await i(e,t)}catch(e){let t=e instanceof Error?e.message:String(e);return{stdout:``,stderr:`${r}: ${t}\n`,exitCode:1}}}}}createGitCustomCommand(){let e=this.gitCommands;return S(`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 S(`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 S(`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 getFilteredJshCommands(){let e=await this.scriptCatalog.getJshCommands(this.currentScanRoots()),t=new Map;for(let[n,r]of e)this.builtinCommandNames.has(n)||this.isCommandAllowed(n)&&t.set(n,r);return t}async getFilteredWorkflowCommands(){let e=await this.scriptCatalog.getWorkflowCommands(),t=new Map;for(let[n,r]of e)this.isCommandAllowed(n)&&t.set(n,r);return t}async getWorkflowCommandNames(){return[...(await this.getFilteredWorkflowCommands()).keys()]}async tryJshFallback(e,t){let n=e.trim(),r=n.indexOf(` `),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1).trim():``,o=(await this.getFilteredJshCommands()).get(i);if(!o)return null;let s=a?yp(a):[],c=this.options.jshDiscoveryFs??this.options.fs,l;try{let e=await c.readFile(o,{encoding:`utf-8`});l=typeof e==`string`?e:new TextDecoder().decode(e)}catch{return{stdout:``,stderr:`jsh: cannot read script '${o}'\n`,exitCode:127,env:this.lastEnv}}let u=[`node`,o,...s],d=await ci(l,u,{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(t));return{stdout:d.stdout,stderr:d.stderr,exitCode:d.exitCode,env:this.lastEnv}}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{Na as _,PB as a,Ca as b,Es as c,hs as d,ps as f,ka as g,Ro as h,AB as i,ys as l,qo as m,PV as n,OB as o,Jo as p,DV as r,gp as s,WV as t,gs as u,Ma as v,Mo as y};
|