sliccy 6.203.2 → 6.204.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-HGW8p_Gm.js → account-store-BISDLeF-.js} +1 -1
- package/dist/ui/assets/{account-store-Ckr93vrT.js → account-store-BonG4PL9.js} +1 -1
- package/dist/ui/assets/{adobe-K0pawRrR.js → adobe-DDiKvhx4.js} +1 -1
- package/dist/ui/assets/{adobe-CRoK1UUH.js → adobe-DX1QPmJb.js} +1 -1
- package/dist/ui/assets/{agent-panels-W_qCuU89.js → agent-panels-C1PaERXz.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-BVLelv9_.js → almost-bash-shell-headless-qgXRFbfS.js} +33 -33
- package/dist/ui/assets/{apply-layout-C_MWJTEc.js → apply-layout-Lyxzflzl.js} +1 -1
- package/dist/ui/assets/{apps-BV3qh1Xv.js → apps-POm194Op.js} +1 -1
- package/dist/ui/assets/{azure-openai-B2MOWr6H.js → azure-openai-CHvqjC7c.js} +1 -1
- package/dist/ui/assets/{azure-openai-CmzM246w.js → azure-openai-CxtrzuKW.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-V12rNK3N.js → backend-hostfs-DOgWFpRx.js} +1 -1
- package/dist/ui/assets/{cdp-kHYwsfXY.js → cdp-DMj_11Zs.js} +1 -1
- package/dist/ui/assets/{cerebras-BnSGOZlZ.js → cerebras-DI9-J1Rz.js} +1 -1
- package/dist/ui/assets/{cerebras-DdQTNaja.js → cerebras-pRUgh4OW.js} +1 -1
- package/dist/ui/assets/{composer-speech-CParoFER.js → composer-speech-XKA4tlpP.js} +1 -1
- package/dist/ui/assets/{connect-surface-B6gwuFE5.js → connect-surface-CJEeMmvT.js} +1 -1
- package/dist/ui/assets/{directed-approval-CpLPsRpu.js → directed-approval-C0PhNmHB.js} +1 -1
- package/dist/ui/assets/{emscripten-vfs-hook-Boll1SdT.js → emscripten-vfs-hook-BYFEfY2W.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-SWXzZ--z.js → ensure-speech-assets-By0KBEH3.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-BitG_c4T.js → frozen-archive-writer-Becb_hbF.js} +1 -1
- package/dist/ui/assets/{fs-CFKrLJHf.js → fs-B7SM0TGT.js} +1 -1
- package/dist/ui/assets/{fs-BCsH_3rY.js → fs-L7bkD02z.js} +2 -2
- package/dist/ui/assets/{gelatiere-store-hsjqGmGi.js → gelatiere-store-DLQGnhyu.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-DraZBew5.js → gelatiere-unit-DTwk3aKZ.js} +1 -1
- package/dist/ui/assets/{github-CzbB9Uah.js → github-B_tzG7pA.js} +2 -2
- package/dist/ui/assets/{github-DFa3iFAX.js → github-BkwQU5W6.js} +1 -1
- package/dist/ui/assets/{github-auth-DrnKzxZZ.js → github-auth-0B5LNEJC.js} +1 -1
- package/dist/ui/assets/{github-copilot-CBVnHsdQ.js → github-copilot-301yXO95.js} +1 -1
- package/dist/ui/assets/{github-copilot-DcTdFt3i.js → github-copilot-H6VUbgi-.js} +1 -1
- package/dist/ui/assets/{github-install-Cd6syyBf.js → github-install-6SNwPAr4.js} +1 -1
- package/dist/ui/assets/{github-zip-DskcBoh2.js → github-zip-DXxPmRaa.js} +1 -1
- package/dist/ui/assets/{hear-Dux4OsjD.js → hear-Da4uNhBZ.js} +1 -1
- package/dist/ui/assets/{help-CnERc5T1.js → help-BGytxBWI.js} +1 -1
- package/dist/ui/assets/{installer-B3nVVS6-.js → installer-BjkRNx-O.js} +1 -1
- package/dist/ui/assets/{ipk-mamba-mVsAKL21.js → ipk-mamba-COcmduaL.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-DBmEtv0k.js → js-realm-worker-Db5JohjH.js} +2 -2
- package/dist/ui/assets/{jsh-executor-DUDUxBvJ.js → jsh-executor--Yat_f0W.js} +2 -2
- package/dist/ui/assets/{kernel-worker-CN69rnZG.js → kernel-worker-BLPHh493.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-Da39Smyv.js → lick-ws-bridge-BXxNBJYU.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-B0InMC8Z.js → lick-ws-bridge-DIQrseWW.js} +1 -1
- package/dist/ui/assets/{live-session-curation-BIqIx0m8.js → live-session-curation-CP8LfkC-.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-BpL-0LSc.js → live-session-snapshot-VRrnkaqO.js} +1 -1
- package/dist/ui/assets/{local-llm-COFRXxVN.js → local-llm-BRxW_8zf.js} +1 -1
- package/dist/ui/assets/{local-llm-DMpJ2CEo.js → local-llm-DxCIhoY-.js} +1 -1
- package/dist/ui/assets/{main-CdbPSBe0.js → main-CdFF0gDY.js} +3 -3
- package/dist/ui/assets/{main-cherry-BZNKBS64.js → main-cherry-Dw7H3Ze7.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-BZfTB-xj.js → memory-curation-seam-RjJ2Fxmh.js} +1 -1
- package/dist/ui/assets/{memory-health-CV6Pih7i.js → memory-health-CDJCtbZS.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-BnZvvvjC.js → memory-write-execute-DRiaSzUQ.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-t3zkafLQ.js → merge-folded-cost-into-frozen-BvMpHgjI.js} +1 -1
- package/dist/ui/assets/{mount-CMErehEU.js → mount-BJVKGZ_7.js} +1 -1
- package/dist/ui/assets/{mount-eRgWkp5k.js → mount-TMgbNbdJ.js} +3 -3
- package/dist/ui/assets/{new-session-CkcYKzZr.js → new-session-CAcrBKU6.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-DpPklXi6.js → oauth-bootstrap-BFVEJjp4.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-gPmTutJo.js → onboarding-orchestrator-B0UotRBX.js} +1 -1
- package/dist/ui/assets/{openai-codex-B8v50Svz.js → openai-codex-BWwjr351.js} +1 -1
- package/dist/ui/assets/{openai-codex-DlDGna5_.js → openai-codex-CoB7M44B.js} +1 -1
- package/dist/ui/assets/{openrouter-ZhMTg6zr.js → openrouter-BftH5-Bs.js} +1 -1
- package/dist/ui/assets/{openrouter-1xtwqOVq.js → openrouter-Ck6fAw_B.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CFARCQwv.js → openrouter-free-BWWhIk93.js} +1 -1
- package/dist/ui/assets/{openrouter-free-PzLhalnD.js → openrouter-free-BfwCAW8v.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CXVleGE4.js → openrouter-oauth-BF8uPL8I.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CEMbIAX7.js → openrouter-oauth-Uci6OsMV.js} +1 -1
- package/dist/ui/assets/{opfs-mount-DBwFhBGQ.js → opfs-mount-BZqzIy78.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-CssTGsvn.js → panel-rpc-handlers-C_3Tb-Vw.js} +2 -2
- package/dist/ui/assets/{panelize-shell-DVLilBxh.js → panelize-shell-D43XbfEx.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-uvLIX_Ai.js → pi-edit-execution-DB63yaO6.js} +1 -1
- package/dist/ui/assets/{process-worker-HxJrkhU7.js → process-worker-DDc_hgEs.js} +3 -3
- package/dist/ui/assets/{provider-CP_LJwJs.js → provider-COSFeLif.js} +2 -2
- package/dist/ui/assets/{provider-DkVl86ly.js → provider-WZR9m-XW.js} +1 -1
- package/dist/ui/assets/{provider-settings-BWMrYTQz.js → provider-settings-tcW8P7PU.js} +1 -1
- package/dist/ui/assets/provider-store-access-Bye-3FZe.js +1 -0
- package/dist/ui/assets/provider-store-access-DZgu46c9.js +1 -0
- package/dist/ui/assets/{providers-CQMZ7t66.js → providers-BiGfsdTe.js} +2 -2
- package/dist/ui/assets/{providers-Cf5Htw-U.js → providers-D-U73j9B.js} +1 -1
- package/dist/ui/assets/{quick-llm-DE2GvAnN.js → quick-llm-JqfVEOjN.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-D83UW9d-.js → realm-inprocess-D439rtYo.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-DCmYgbjn.js → realm-unhandled-rejections-DWTrWTWN.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-p38FMl-T.js → realm-unhandled-rejections-DYW63AxK.js} +1 -1
- package/dist/ui/assets/{recovery-screen-DtBhGrl5.js → recovery-screen-CFSXqoGO.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-D1BNHazg.js → remote-terminal-view-CfE02qd4.js} +2 -2
- package/dist/ui/assets/{restore-D9IIoDiA.js → restore-B0eqFKU3.js} +1 -1
- package/dist/ui/assets/{run-BB0XJv3f.js → run-BMFPkQSc.js} +2 -2
- package/dist/ui/assets/{run-DhCM_-DZ.js → run-Bkv4relh.js} +1 -1
- package/dist/ui/assets/{run-SIf4I7Q6.js → run-CAeNGt84.js} +1 -1
- package/dist/ui/assets/{run-DAAHi5vP.js → run-Cgi7Sb4F.js} +1 -1
- package/dist/ui/assets/run-D_1DaJXR.js +4 -0
- package/dist/ui/assets/{run-BJNulD7A.js → run-Ddg-X7KW.js} +2 -2
- package/dist/ui/assets/{run-Bqnf1Cdy.js → run-yrywpFIm.js} +1 -1
- package/dist/ui/assets/{session-command-memory-QozWyQvx.js → session-command-memory-BnEwnFRh.js} +2 -2
- package/dist/ui/assets/{session-jsonl-DRwHOGpT.js → session-jsonl-B0CfvtbC.js} +1 -1
- package/dist/ui/assets/{session-jsonl-D5PzFT5b.js → session-jsonl-CFz-GmKk.js} +1 -1
- package/dist/ui/assets/{session-search-index-6DhtCkCf.js → session-search-index-CLEy4QEf.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-BYu1rIF_.js → setup-feature-flags-remote-WIaMFFUe.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-Dxvw_5q0.js → setup-model-catalog-BTndiXCf.js} +1 -1
- package/dist/ui/assets/{signed-fetch-Qj3nRtnI.js → signed-fetch-8d7FuaZ_.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-DsREO3j9.js → silent-renew-backoff-BcJ1scX1.js} +1 -1
- package/dist/ui/assets/slicc-version-_lAQTRgR.js +1 -0
- package/dist/ui/assets/{snapshot-features-BCK9Imrv.js → snapshot-features-DJwZ3fVO.js} +1 -1
- package/dist/ui/assets/{snapshot-DnbILwky.js → snapshot-r1tiyWpP.js} +1 -1
- package/dist/ui/assets/{soundscape-B358Dt9e.js → soundscape-C1U2Sl50.js} +1 -1
- package/dist/ui/assets/{speak-Bo3aKbrD.js → speak-DpJEqrkd.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-7LXuXasA.js → sprinkle-manager-DFiwYOIU.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-CU_JfBSq.js → sprinkle-renderer-8t_4Gaie.js} +1 -1
- package/dist/ui/assets/{state-rKgnMaSb.js → state-DY4OICYa.js} +1 -1
- package/dist/ui/assets/{store-DBXEQFqZ.js → store-D3vhlDka.js} +1 -1
- package/dist/ui/assets/{store-BMTk8QVa.js → store-uxQy1IMe.js} +1 -1
- package/dist/ui/assets/{sudo-B-Pm_Bnj.js → sudo-NXMw8ObG.js} +1 -1
- package/dist/ui/assets/{supervisor-DhZJH2cL.js → supervisor-DeKpKs06.js} +1 -1
- package/dist/ui/assets/{sync-dialog-DkgkVlkn.js → sync-dialog-CCvgrlkp.js} +1 -1
- package/dist/ui/assets/{transformers-env-rpxnIWDG.js → transformers-env-CtIqMCGj.js} +1 -1
- package/dist/ui/assets/{tray-leader-DymCPRfM.js → tray-leader-DP_iWqyx.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-D01BmoyG.js → tray-leave-runtime-CX6RFIlO.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-1N4ecoU0.js → tray-sidecar-BI6BCLxV.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-D28x8Bra.js → upgrade-detection-CH0AUAxl.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-7__195zM.js → upskill-lick-skip-BitSDEIQ.js} +1 -1
- package/dist/ui/assets/{voice-reply-NjB3SSJJ.js → voice-reply-9z2U_0-N.js} +1 -1
- package/dist/ui/assets/{wc-attach-CWX4iYzw.js → wc-attach-DBuIUvEJ.js} +2 -2
- package/dist/ui/assets/{wc-browser-Ce7h3334.js → wc-browser-Cs2VTn7S.js} +1 -1
- package/dist/ui/assets/{wc-computers-BwKndmef.js → wc-computers-KlZdw-99.js} +1 -1
- package/dist/ui/assets/{wc-detached-30u7rePq.js → wc-detached-CkxFCnde.js} +1 -1
- package/dist/ui/assets/{wc-extension-CAPhtP2a.js → wc-extension-BKOMbVho.js} +2 -2
- package/dist/ui/assets/{wc-follower-D5j-A7Ix.js → wc-follower-DDtlwv1W.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-qeotlWSI.js → wc-follower-oauth-DKQcBwUl.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-4CwycDyL.js → wc-gelatiere-DG4nLvqZ.js} +1 -1
- package/dist/ui/assets/{wc-live-mY1x8C54.js → wc-live-nyi2w7gQ.js} +5 -5
- package/dist/ui/assets/{wc-nav-Cw9yrsaO.js → wc-nav-Cc5F6pDF.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-CEGW3hb5.js → wc-onboarding-Chw11l57.js} +2 -2
- package/dist/ui/assets/{wc-permissions-BmxmJkbj.js → wc-permissions-CAPPQzj7.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-BJGe-e5H.js → wc-placeholder-DJ-cO5xJ.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-VI6gOUw8.js → wc-secret-request-CGljoPus.js} +1 -1
- package/dist/ui/assets/{wc-settings-BpVfU7V0.js → wc-settings-Dp0HE8N2.js} +3 -3
- package/dist/ui/assets/{wc-shell-DOXgGrMg.js → wc-shell-D4ubHYIr.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-DUS-IyYG.js → wc-shortcut-config-jttgjvtI.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-hACYRDUD.js → wc-sprinkles-BTm-nd0i.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-DUEZuxEg.js → wc-transcript-export-EvuaFROn.js} +2 -2
- package/dist/ui/assets/{wc-tray-Djy3O6Pk.js → wc-tray-qCfdVTsv.js} +4 -4
- package/dist/ui/assets/welcome-detection-CO79EFXj.js +1 -0
- package/dist/ui/assets/{whisper-session-Bx2TskIV.js → whisper-session-DGIXi2nd.js} +2 -2
- package/dist/ui/assets/{xai-grok-B_-F_tKS.js → xai-grok-Rw_oETuh.js} +1 -1
- package/dist/ui/assets/{xai-grok-BtkLvzBV.js → xai-grok-mqJPt1gd.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/provider-store-access-DBKNTOVo.js +0 -1
- package/dist/ui/assets/provider-store-access-Udi8-SSj.js +0 -1
- package/dist/ui/assets/run-wPcLj39e.js +0 -4
- package/dist/ui/assets/slicc-version-C6BuKZ8E.js +0 -1
- package/dist/ui/assets/welcome-detection-DeDfFn6p.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{d as l,f as u,i as d,u as f}from"./account-store-Ckr93vrT.js";import{n as p,o as m,r as h,s as g,u as _}from"./proxied-fetch-DXaTHROw.js";import{t as v}from"./runtime-env-DadgceZk.js";import{t as ee}from"./slugify-BYJ6QVAt.js";import{n as te,t as ne}from"./host-command-guuPK7VN.js";import{a as re,i as ie,n as ae,r as oe,t as se}from"./snapshot-DnbILwky.js";import{i as ce,r as y}from"./panel-rpc-DW7W4w6_.js";import{a as le,c as ue,n as de,o as fe,s as pe,t as me}from"./feature-flags-QlgHaQc1.js";import{t as he}from"./providers-Cf5Htw-U.js";import{r as ge}from"./binary-cache-bSOhqXB1.js";import{i as _e,n as ve,r as ye}from"./fetch-body-CuwTaJC_.js";import{s as be,t as xe}from"./api-endpoint-D8lUKmPu.js";import{t as Se}from"./compat-uEPf6-XW.js";import{a as Ce,i as we}from"./core-VO3EvqHP.js";import{n as Te,t as Ee}from"./mime-types-D7IV6i7k.js";import{t as De}from"./secrets-bridge-client-BiJrSKN9.js";import{a as Oe,i as ke,n as Ae,r as je}from"./tool-ui-DRnUkp2g.js";import{a as Me,i as Ne,n as b,t as x}from"./path-utils-DNJG-zQf.js";import{n as Pe,r as Fe,t as Ie}from"./merge-file-core-VJlzucJY.js";import{r as Le}from"./workspace-mode-D0kUKBVS.js";import{n as Re,t as ze}from"./thinking-level-5x0UAu9N.js";import{n as Be,t as Ve}from"./types-D8gIX-W-.js";import{i as He}from"./mount-index-CQfmUPuZ.js";import{a as Ue,i as We,n as Ge,o as Ke,s as qe,t as Je}from"./signed-fetch-Qj3nRtnI.js";import{o as Ye}from"./mount-table-store-DrF_Ifaz.js";import{t as Xe}from"./remote-cache-UwMD8EkX.js";import{n as Ze}from"./fs-CFKrLJHf.js";import{a as Qe}from"./tray-leader-status-CpkFr6n7.js";import{n as $e,t as et}from"./slicc-version-C6BuKZ8E.js";import{a as tt,i as nt,o as rt,r as S,t as it}from"./browser-CezNe0PF.js";import{t as C}from"./subcommand-flags-BZi7j78Q.js";import{n as at,r as ot,t as w}from"./subcommand-help-CgO7wRS5.js";import{n as st}from"./cost-command-D0tJNxsl.js";import{d as ct,g as lt,i as ut,n as dt,o as ft}from"./sudoers-BdBYQPUn.js";import{n as pt,r as mt,t as ht}from"./approval-timeout-BQ29Z0gf.js";import{a as gt,c as _t,i as vt,l as yt,n as bt,o as xt,r as St,t as Ct}from"./types-BfwydWt7.js";import{n as T,t as wt}from"./boundary-Cp9c_bPu.js";import"./rest-paths-Dia19u9P.js";import{t as Tt}from"./html-B_Hg2WOy.js";import{n as Et}from"./llm-session-id-BZyXP_j2.js";import{t as Dt}from"./src-CUSndb9K.js";import{i as Ot,o as kt}from"./browser-DuyhpHbR.js";import{i as At,r as jt,t as Mt}from"./mount-picker-popup-BMils9JY.js";import{t as Nt}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Pt,B as E,C as Ft,D,E as It,F as Lt,G as Rt,H as O,I as k,J as zt,K as Bt,L as Vt,M as Ht,N as Ut,O as Wt,P as Gt,R as Kt,S as qt,T as Jt,U as Yt,V as Xt,W as Zt,Y as Qt,_ as $t,a as en,b as tn,c as nn,d as rn,f as an,g as on,h as sn,i as cn,j as ln,k as un,l as dn,m as fn,n as pn,o as mn,p as A,q as hn,r as gn,s as _n,t as vn,u as yn,v as bn,w as xn,x as Sn,y as Cn,z as wn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{S as Tn,_ as En,a as Dn,b as On,c as kn,d as An,f as jn,g as Mn,h as Nn,i as Pn,l as Fn,n as In,o as Ln,p as Rn,r as zn,s as Bn,t as Vn,u as Hn,v as j,x as M,y as Un}from"./state-rKgnMaSb.js";import{a as Wn,i as Gn,r as Kn,t as qn}from"./git-config-Bdgu8kD2.js";import{i as Jn,r as Yn}from"./global-prefix-DqCuANmV.js";import{t as Xn}from"./wasm-programs-h3UCRQyB.js";import{a as Zn,n as Qn,o as $n,r as er,s as tr}from"./jsh-discovery-CnvNKojr.js";import{C as nr,a as rr,b as ir,c as ar,d as or,f as sr,h as cr,i as lr,l as ur,m as dr,n as fr,o as pr,p as mr,r as hr,s as gr,t as N,u as _r,v as vr,y as yr}from"./shared-Bi8EHIOr.js";import{_ as br,a as xr,b as Sr,d as Cr,f as wr,g as Tr,h as Er,i as Dr,l as Or,m as kr,p as Ar,r as jr,s as Mr,u as Nr,v as Pr,x as Fr,y as Ir}from"./require-guards-BWQHXQHI.js";import{_ as Lr,a as Rr,b as zr,c as Br,d as Vr,f as Hr,g as Ur,h as Wr,l as Gr,m as Kr,n as qr,p as Jr,s as Yr,t as Xr,u as Zr,v as Qr,x as $r,y as ei}from"./jsh-executor-DUDUxBvJ.js";import{n as ti,t as ni}from"./esbuild-wasm-BqY5rzxc.js";import{n as ri}from"./wasm-compiler-Ct7QZURL.js";import{a as ii,o as ai,s as oi,t as si}from"./usb-device-registry-DFzxaOky.js";import{a as P,i as ci,r as li,t as ui}from"./just-bash-compat-B-SPHuh_.js";import{i as di,r as fi,t as pi}from"./script-catalog-ByM8lrb_.js";import{a as mi,c as hi,o as gi,s as _i,t as vi}from"./types-Dzr0qYl3.js";import{a as yi,c as bi,d as xi,f as Si,n as Ci,r as wi,u as Ti}from"./github-zip-DskcBoh2.js";import{i as Ei,t as Di}from"./github-auth-DrnKzxZZ.js";import{a as Oi,i as ki,o as Ai,r as ji,t as Mi}from"./provenance-DdmsQ3Nr.js";import{a as Ni,c as Pi,i as Fi,n as Ii,o as Li,r as Ri,s as zi}from"./github-install-Cd6syyBf.js";import{n as Bi,t as Vi}from"./magick-wasm-DjyHtD1t.js";import{i as Hi,n as Ui,r as Wi,t as Gi}from"./pdf-raster-BWk6ezTX.js";import{n as Ki}from"./lick-target-env-8JxfVcIV.js";import{t as qi}from"./tmpdir-env-ate4iNcK.js";import{n as Ji,t as Yi}from"./hf-defaults-BwJdGLgk.js";import{a as Xi,i as Zi,n as Qi,o as $i,r as ea,t as ta}from"./installer-B3nVVS6-.js";import{i as na,n as ra,r as ia,t as aa}from"./tar-BWIPCxI2.js";import{t as oa}from"./ffmpeg-wasm-NIvl0oHG.js";import{t as sa}from"./local-llm-COFRXxVN.js";import{t as ca}from"./client-CwxmlQM-.js";import{t as la}from"./redirect-uri-CBCnYKsl.js";import{a as ua,c as da,i as fa,o as pa,r as ma,s as ha}from"./v86-vm-DCm7zA2r.js";import{n as ga,r as _a}from"./lick-urls-CgPiVwD-.js";let va=null;function ya(e){va=e!==null&&Number.isFinite(e)&&e>0?e:null}function ba(){if(va!==null)return va;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const xa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Sa(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=xa.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 Ca(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 wa(e,t){return e.some(e=>Ca(e,t))}const Ta=`slicc-transcript`,Ea=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Da=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 Oa(e){return Da.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var ka=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Aa=new Set(Ea),ja=/^[0-9a-fA-F]{64}$/,Ma=/^\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 Na(e){return typeof e==`string`&&ja.test(e)}function Pa(e){return Ma.test(e)&&Number.isFinite(Date.parse(e))}function Fa(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 Ia(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Fa(n,t)}:{ok:!0}}function La(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 Ra(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 za(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ia(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ra(e,t):n}function Ba(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 Va(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 Ha(e,t){let n=Ba(e,t);if(!n.ok)return n;let r=e.cost;return F(r)?Va(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function Ua(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`?Pa(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 Wa(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 Ga(e,t){let n=e.usage;return n===void 0?{ok:!0}:F(n)?Ha(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function Ka(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ia(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=Wa(e,t);if(!n.ok)return n}let r=Ua(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=La(i,za,`${t}.content`);return a.ok?Ga(e,t):a}function qa(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=Ia(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?La(r,Ka,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function Ja(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 Ya(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`}:Na(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 Xa=[`attachment-file-missing`,`attachment-association-unavailable`];function Za(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ia(e.missingReason,Xa,`${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 Qa(e,t){return e.present?Ya(e,t):Za(e,t)}function $a(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ja(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=Ia(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?Qa(e,t):r}function eo(e,t){let n=Ia(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 to(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=Ia(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return F(r)?eo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function no(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 ro(e,t){return typeof e!=`string`||!Aa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function io(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 ao(e){if(!F(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ia(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?La(e.missing,ro,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function oo(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=Ia(e.state,[`active`,`frozen`],`session.state`);return t.ok?ao(e.completeness):t}function so(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)?La(n,to,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function co(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=La(t,qa,`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=La(r,no,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?La(a,$a,`attachments`):{ok:!1,error:`attachments must be an array`}}function lo(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 uo(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 fo(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 po(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 fo(e))t.add(n)}return t}function mo(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 ho(e){return mo(e,po(e))}function go(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 _o(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=go(e,t);if(!r.ok)return r}}return{ok:!0}}function vo(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return _o(e,n)}function yo(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 bo(e,t){let n=yo(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 xo(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(fo(e)))}return t}function So(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 Co(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return So(e,n,xo(t))}function wo(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 To(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=wo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Eo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=lo(t);if(!o.ok)return o;let s=uo(t);if(!s.ok)return s;let c=ho(t);if(!c.ok)return c;let l=vo(t,n);if(!l.ok)return l;let u=bo(n,t);if(!u.ok)return u;let d=Co(r,t);return d.ok?To(a,n):d}function Do(e){let t=co(e);return t.ok?Eo(e):t}function Oo(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=io(e.export);if(!t.ok)return t;let n=oo(e.session);if(!n.ok)return n;let r=so(e.privacy);return r.ok?Do(e):r}async function ko(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:Ke});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:Ao(a),sourceUrl:a}}function Ao(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const jo=`slicc-sprinkle-routes`;function Mo(){try{let e=localStorage.getItem(jo);return e?JSON.parse(e):{}}catch{return{}}}function No(e){try{localStorage.setItem(jo,JSON.stringify(e))}catch{}}function Po(e){return Mo()[e]}function Fo(e,t){let n=Mo();n[e]=t,No(n)}function Io(e){let t=Mo();delete t[e],No(t)}function Lo(){return Mo()}function Ro(e,t,n){return _t(t,n,`${e} adapter does not implement ${t}.${n}`)}function zo(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(Ro(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Bo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:zo(t,`browser`,bt,e.browser),network:zo(t,`network`,gt,e.network),secrets:zo(t,`secrets`,xt,e.secrets),devices:zo(t,`devices`,St,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:zo(t,`mounts`,vt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:zo(t,`approvals`,Ct,e.approvals)}}function Vo(e={}){return Bo({adapter:`connect`,pageGestures:e.pageGestures})}function Ho(e){let t=wt(()=>import(`./extension-ops-CF2mLDRW.js`).then(t=>t.createExtensionOps(e)));return Bo({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 Uo(e={}){let t=wt(()=>import(`./rest-ops-CLliBy-9.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Bo({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 Wo(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return Uo({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Ho({adapter:e,pageGestures:n});case`connect`:return Vo({pageGestures:n})}}const Go=e(`quick-llm`);async function Ko(e){let t=d();if(!t)return Go.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?Xo(n,e.modelId)??Xo(n,r):qo(n,r),!i)return Go.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`]=Zo());try{let n=(await Se(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 Go.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function qo(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=Yo(r.id),a=n.filter(e=>Jo(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function Jo(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 Yo(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 Xo(e,t){return f(e).find(e=>e.id===t)}function Zo(){return Et(`ui-quick-llm`)}const Qo=e(`sudo-suggest`),$o=[`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{d as l,f as u,i as d,u as f}from"./account-store-BonG4PL9.js";import{n as p,o as m,r as h,s as g,u as _}from"./proxied-fetch-DXaTHROw.js";import{t as v}from"./runtime-env-DadgceZk.js";import{t as ee}from"./slugify-BYJ6QVAt.js";import{n as te,t as ne}from"./host-command-guuPK7VN.js";import{a as re,i as ie,n as ae,r as oe,t as se}from"./snapshot-r1tiyWpP.js";import{i as ce,r as y}from"./panel-rpc-DW7W4w6_.js";import{a as le,c as ue,n as de,o as fe,s as pe,t as me}from"./feature-flags-QlgHaQc1.js";import{t as he}from"./providers-D-U73j9B.js";import{r as ge}from"./binary-cache-bSOhqXB1.js";import{i as _e,n as ve,r as ye}from"./fetch-body-CuwTaJC_.js";import{s as be,t as xe}from"./api-endpoint-D8lUKmPu.js";import{t as Se}from"./compat-uEPf6-XW.js";import{a as Ce,i as we}from"./core-VO3EvqHP.js";import{n as Te,t as Ee}from"./mime-types-D7IV6i7k.js";import{t as De}from"./secrets-bridge-client-BiJrSKN9.js";import{a as Oe,i as ke,n as Ae,r as je}from"./tool-ui-DRnUkp2g.js";import{a as Me,i as Ne,n as b,t as x}from"./path-utils-DNJG-zQf.js";import{n as Pe,r as Fe,t as Ie}from"./merge-file-core-VJlzucJY.js";import{r as Le}from"./workspace-mode-D0kUKBVS.js";import{n as Re,t as ze}from"./thinking-level-5x0UAu9N.js";import{n as Be,t as Ve}from"./types-D8gIX-W-.js";import{i as He}from"./mount-index-CQfmUPuZ.js";import{a as Ue,i as We,n as Ge,o as Ke,s as qe,t as Je}from"./signed-fetch-8d7FuaZ_.js";import{o as Ye}from"./mount-table-store-DrF_Ifaz.js";import{t as Xe}from"./remote-cache-UwMD8EkX.js";import{n as Ze}from"./fs-B7SM0TGT.js";import{a as Qe}from"./tray-leader-status-CpkFr6n7.js";import{n as $e,t as et}from"./slicc-version-_lAQTRgR.js";import{a as tt,i as nt,o as rt,r as S,t as it}from"./browser-CezNe0PF.js";import{t as C}from"./subcommand-flags-BZi7j78Q.js";import{n as at,r as ot,t as w}from"./subcommand-help-CgO7wRS5.js";import{n as st}from"./cost-command-D0tJNxsl.js";import{d as ct,g as lt,i as ut,n as dt,o as ft}from"./sudoers-BdBYQPUn.js";import{n as pt,r as mt,t as ht}from"./approval-timeout-BQ29Z0gf.js";import{a as gt,c as _t,i as vt,l as yt,n as bt,o as xt,r as St,t as Ct}from"./types-BfwydWt7.js";import{n as T,t as wt}from"./boundary-Cp9c_bPu.js";import"./rest-paths-Dia19u9P.js";import{t as Tt}from"./html-B_Hg2WOy.js";import{n as Et}from"./llm-session-id-BZyXP_j2.js";import{t as Dt}from"./src-CUSndb9K.js";import{i as Ot,o as kt}from"./browser-DuyhpHbR.js";import{i as At,r as jt,t as Mt}from"./mount-picker-popup-BMils9JY.js";import{t as Nt}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{A as Pt,B as E,C as Ft,D,E as It,F as Lt,G as Rt,H as O,I as k,J as zt,K as Bt,L as Vt,M as Ht,N as Ut,O as Wt,P as Gt,R as Kt,S as qt,T as Jt,U as Yt,V as Xt,W as Zt,Y as Qt,_ as $t,a as en,b as tn,c as nn,d as rn,f as an,g as on,h as sn,i as cn,j as ln,k as un,l as dn,m as fn,n as pn,o as mn,p as A,q as hn,r as gn,s as _n,t as vn,u as yn,v as bn,w as xn,x as Sn,y as Cn,z as wn}from"./isomorphic-git-r9mnHMnp.js";import"./global-db-DJXlpNui.js";import{S as Tn,_ as En,a as Dn,b as On,c as kn,d as An,f as jn,g as Mn,h as Nn,i as Pn,l as Fn,n as In,o as Ln,p as Rn,r as zn,s as Bn,t as Vn,u as Hn,v as j,x as M,y as Un}from"./state-DY4OICYa.js";import{a as Wn,i as Gn,r as Kn,t as qn}from"./git-config-Bdgu8kD2.js";import{i as Jn,r as Yn}from"./global-prefix-DqCuANmV.js";import{t as Xn}from"./wasm-programs-h3UCRQyB.js";import{a as Zn,n as Qn,o as $n,r as er,s as tr}from"./jsh-discovery-CnvNKojr.js";import{C as nr,a as rr,b as ir,c as ar,d as or,f as sr,h as cr,i as lr,l as ur,m as dr,n as fr,o as pr,p as mr,r as hr,s as gr,t as N,u as _r,v as vr,y as yr}from"./shared-Bi8EHIOr.js";import{_ as br,a as xr,b as Sr,d as Cr,f as wr,g as Tr,h as Er,i as Dr,l as Or,m as kr,p as Ar,r as jr,s as Mr,u as Nr,v as Pr,x as Fr,y as Ir}from"./require-guards-BWQHXQHI.js";import{_ as Lr,a as Rr,b as zr,c as Br,d as Vr,f as Hr,g as Ur,h as Wr,l as Gr,m as Kr,n as qr,p as Jr,s as Yr,t as Xr,u as Zr,v as Qr,x as $r,y as ei}from"./jsh-executor--Yat_f0W.js";import{n as ti,t as ni}from"./esbuild-wasm-BqY5rzxc.js";import{n as ri}from"./wasm-compiler-Ct7QZURL.js";import{a as ii,o as ai,s as oi,t as si}from"./usb-device-registry-DFzxaOky.js";import{a as P,i as ci,r as li,t as ui}from"./just-bash-compat-B-SPHuh_.js";import{i as di,r as fi,t as pi}from"./script-catalog-ByM8lrb_.js";import{a as mi,c as hi,o as gi,s as _i,t as vi}from"./types-Dzr0qYl3.js";import{a as yi,c as bi,d as xi,f as Si,n as Ci,r as wi,u as Ti}from"./github-zip-DXxPmRaa.js";import{i as Ei,t as Di}from"./github-auth-0B5LNEJC.js";import{a as Oi,i as ki,o as Ai,r as ji,t as Mi}from"./provenance-DdmsQ3Nr.js";import{a as Ni,c as Pi,i as Fi,n as Ii,o as Li,r as Ri,s as zi}from"./github-install-6SNwPAr4.js";import{n as Bi,t as Vi}from"./magick-wasm-DjyHtD1t.js";import{i as Hi,n as Ui,r as Wi,t as Gi}from"./pdf-raster-BWk6ezTX.js";import{n as Ki}from"./lick-target-env-8JxfVcIV.js";import{t as qi}from"./tmpdir-env-ate4iNcK.js";import{n as Ji,t as Yi}from"./hf-defaults-BwJdGLgk.js";import{a as Xi,i as Zi,n as Qi,o as $i,r as ea,t as ta}from"./installer-BjkRNx-O.js";import{i as na,n as ra,r as ia,t as aa}from"./tar-BWIPCxI2.js";import{t as oa}from"./ffmpeg-wasm-NIvl0oHG.js";import{t as sa}from"./local-llm-BRxW_8zf.js";import{t as ca}from"./client-CwxmlQM-.js";import{t as la}from"./redirect-uri-CBCnYKsl.js";import{a as ua,c as da,i as fa,o as pa,r as ma,s as ha}from"./v86-vm-DCm7zA2r.js";import{n as ga,r as _a}from"./lick-urls-CgPiVwD-.js";let va=null;function ya(e){va=e!==null&&Number.isFinite(e)&&e>0?e:null}function ba(){if(va!==null)return va;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const xa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Sa(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=xa.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 Ca(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 wa(e,t){return e.some(e=>Ca(e,t))}const Ta=`slicc-transcript`,Ea=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Da=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 Oa(e){return Da.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var ka=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Aa=new Set(Ea),ja=/^[0-9a-fA-F]{64}$/,Ma=/^\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 Na(e){return typeof e==`string`&&ja.test(e)}function Pa(e){return Ma.test(e)&&Number.isFinite(Date.parse(e))}function Fa(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 Ia(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Fa(n,t)}:{ok:!0}}function La(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 Ra(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 za(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ia(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Ra(e,t):n}function Ba(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 Va(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 Ha(e,t){let n=Ba(e,t);if(!n.ok)return n;let r=e.cost;return F(r)?Va(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function Ua(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`?Pa(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 Wa(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 Ga(e,t){let n=e.usage;return n===void 0?{ok:!0}:F(n)?Ha(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function Ka(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ia(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=Wa(e,t);if(!n.ok)return n}let r=Ua(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=La(i,za,`${t}.content`);return a.ok?Ga(e,t):a}function qa(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=Ia(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?La(r,Ka,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function Ja(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 Ya(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`}:Na(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 Xa=[`attachment-file-missing`,`attachment-association-unavailable`];function Za(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ia(e.missingReason,Xa,`${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 Qa(e,t){return e.present?Ya(e,t):Za(e,t)}function $a(e,t){if(!F(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ja(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=Ia(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?Qa(e,t):r}function eo(e,t){let n=Ia(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 to(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=Ia(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return F(r)?eo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function no(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 ro(e,t){return typeof e!=`string`||!Aa.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function io(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 ao(e){if(!F(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ia(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?La(e.missing,ro,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function oo(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=Ia(e.state,[`active`,`frozen`],`session.state`);return t.ok?ao(e.completeness):t}function so(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)?La(n,to,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function co(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=La(t,qa,`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=La(r,no,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?La(a,$a,`attachments`):{ok:!1,error:`attachments must be an array`}}function lo(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 uo(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 fo(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 po(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 fo(e))t.add(n)}return t}function mo(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 ho(e){return mo(e,po(e))}function go(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 _o(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=go(e,t);if(!r.ok)return r}}return{ok:!0}}function vo(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return _o(e,n)}function yo(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 bo(e,t){let n=yo(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 xo(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(fo(e)))}return t}function So(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 Co(e,t){let n=new Set;for(let e of t)F(e)&&typeof e.id==`string`&&n.add(e.id);return So(e,n,xo(t))}function wo(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 To(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=wo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function Eo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=lo(t);if(!o.ok)return o;let s=uo(t);if(!s.ok)return s;let c=ho(t);if(!c.ok)return c;let l=vo(t,n);if(!l.ok)return l;let u=bo(n,t);if(!u.ok)return u;let d=Co(r,t);return d.ok?To(a,n):d}function Do(e){let t=co(e);return t.ok?Eo(e):t}function Oo(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=io(e.export);if(!t.ok)return t;let n=oo(e.session);if(!n.ok)return n;let r=so(e.privacy);return r.ok?Do(e):r}async function ko(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:Ke});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:Ao(a),sourceUrl:a}}function Ao(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const jo=`slicc-sprinkle-routes`;function Mo(){try{let e=localStorage.getItem(jo);return e?JSON.parse(e):{}}catch{return{}}}function No(e){try{localStorage.setItem(jo,JSON.stringify(e))}catch{}}function Po(e){return Mo()[e]}function Fo(e,t){let n=Mo();n[e]=t,No(n)}function Io(e){let t=Mo();delete t[e],No(t)}function Lo(){return Mo()}function Ro(e,t,n){return _t(t,n,`${e} adapter does not implement ${t}.${n}`)}function zo(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(Ro(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function Bo(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:zo(t,`browser`,bt,e.browser),network:zo(t,`network`,gt,e.network),secrets:zo(t,`secrets`,xt,e.secrets),devices:zo(t,`devices`,St,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:zo(t,`mounts`,vt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:zo(t,`approvals`,Ct,e.approvals)}}function Vo(e={}){return Bo({adapter:`connect`,pageGestures:e.pageGestures})}function Ho(e){let t=wt(()=>import(`./extension-ops-CF2mLDRW.js`).then(t=>t.createExtensionOps(e)));return Bo({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 Uo(e={}){let t=wt(()=>import(`./rest-ops-CLliBy-9.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return Bo({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 Wo(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return Uo({pageGestures:n});case`extension-direct`:case`extension-delegate`:return Ho({adapter:e,pageGestures:n});case`connect`:return Vo({pageGestures:n})}}const Go=e(`quick-llm`);async function Ko(e){let t=d();if(!t)return Go.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?Xo(n,e.modelId)??Xo(n,r):qo(n,r),!i)return Go.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`]=Zo());try{let n=(await Se(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 Go.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function qo(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=Yo(r.id),a=n.filter(e=>Jo(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function Jo(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 Yo(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 Xo(e,t){return f(e).find(e=>e.id===t)}function Zo(){return Et(`ui-quick-llm`)}const Qo=e(`sudo-suggest`),$o=[`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
|
`),es=[`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 ts(e,t){if(e.suggestedPattern&&e.suggestedPattern.trim().length>0)return e.suggestedPattern.trim();let n=e.detail.trim(),r=e.kind===`command`?$o:es,i=null;try{i=await Ko({prompt:n,system:r,maxTokens:40,temperature:0,signal:t})}catch(e){Qo.debug(`suggestPattern: quickLabel threw`,{error:e instanceof Error?e.message:String(e)}),i=null}return ns(i)||n}function ns(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 rs=e(`sudo:capability-gesture`);function is(e,t={}){let n=t.suggest??ts;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 rs.warn(`sudo approval aborted before prompting — denying`,{detail:t.detail}),{decision:`deny`};if(!e)return rs.warn(`no CapabilityBroker injected for the sudo gesture hop — denying (composition bug, never a guessed transport)`,{detail:t.detail}),{decision:`deny`};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?yt(o.value,a):(rs.warn(`capability broker approvals.request failed — denying`,{message:o.message}),{decision:`deny`})}}}const as=e(`sudo:tray-first`);function os(e,t={}){let n=t.suggest??ts,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{decision:`deny`};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){as.debug?.(`panel-RPC client lookup threw — using native broker`,{error:e instanceof Error?e.message:String(e)})}if(c)try{let e=await c.call(`sudo-request`,{request:s,mode:`tray-first`},{timeoutMs:r});if(e?.handled!==!1)return ss(e?.decision,o)}catch(e){as.warn(`tray-first sudo probe failed — using native broker`,{error:e instanceof Error?e.message:String(e)})}return e.requestApproval(s,a)}}}function ss(e,t){if(!e||typeof e!=`object`)return{decision:`deny`};let n=e,r=n.attestation===`biometric`||n.attestation===`passcode`||n.attestation===`none`?n.attestation:void 0;return n.decision===`allow`?{decision:`allow`,...r?{attestation:r}:{}}:n.decision===`always`?{decision:`always`,pattern:typeof n.pattern==`string`&&n.pattern.trim().length>0?n.pattern.trim():t,...r?{attestation:r}:{}}:{decision:`deny`}}function cs(e,t){return{requestApproval(n){return t.enqueueSudoRequest(e,n)}}}function ls(){return`lick-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var us=class{pending=new Map;timeoutMs;newId;setTimer;clearTimer;onAutoSettle;constructor(e={}){this.timeoutMs=e.timeoutMs??3e5,this.newId=e.newId??ls,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(pt(`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`}),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`}),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 ds(e){return mt(fs(e))}function fs(e){let t=is(e);return e?.adapter===`extension-direct`||e?.adapter===`extension-delegate`?t:os(t)}let ps=null;function ms(e){return ps=e,()=>{ps===e&&(ps=null)}}function hs(){if(!ps)throw new ka(`session-not-found`);return ps}const gs=`focus`,_s={type:`leaf`,surfaceId:`chat`};function vs(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 ys={focus:{name:`focus`,tree:vs({left:_s},{left:3,middle:1})}};function bs(e){return ys[e]??null}const xs=`progress`;function Ss(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}async function Cs(){try{let e=await jt();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 Mt(e.idbKey);if(!t)throw Error(`mount: no directory handle found in storage`);return await At(t),t}throw Error(`mount: unexpected popup result`)}catch(e){throw Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}async function ws(){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)}`)}}function Ts(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 Es(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 Ds=new Set([`--source`,`--profile`,`--backend`,`--max-body-mb`]);function Os(e){for(let t=0;t<e.length;t++){let n=e[t];if(n===`--`)return!1;if(n===`--help`||n===`-h`)return!0;Ds.has(n)&&t++}return!1}function ks(e){return`aem://${e.org}/${e.name}${e.path?`/${e.path}`:``}`}var As=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=Ts(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=Oe();if(!n){let n=await js(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;if(n){let t=this.options.acquireLocalMountViaToolUI;if(!t)throw Error(`mount: tool UI not available in this runtime`);r=await t(n,e)}else r=v()?await Cs():await ws();let i=He.fromHandle(r,{mountId:Ye()});return await this.options.fs.mount(e,i,{env:t}),{stdout:`Mounted '${i.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=Ye(),i=new Xe({mountId:r,ttlMs:3e4}),a=new We({source:t.source,profile:n,cache:i,maxBodyBytes:t.maxBodyMb?t.maxBodyMb*1024*1024:void 0,mountId:r,signedFetch:this.signedFetchS3??Ge(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??Je(),i=Es(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 ko(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=Ye(),c=new Xe({mountId:s,ttlMs:3e4}),l={source:a===`aem`?ks(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 qe(l):new Ue(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(Os(e))return n===`umount`?this.umountHelp():this.help();let r=Ts(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
|
|
@@ -279,7 +279,7 @@ Examples:
|
|
|
279
279
|
skill list
|
|
280
280
|
skill info bluebubbles
|
|
281
281
|
skill read bluebubbles
|
|
282
|
-
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-
|
|
282
|
+
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-BLPHh493.js`).then(e=>e.r);try{switch(r){case`list`:return oh(t,e,i,n.env.get(`PATH`));case`info`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: info requires a skill name
|
|
283
283
|
`,exitCode:1};let r=await i.getSkillInfo(e,n);return r?{stdout:ih(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
|
|
284
284
|
`,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+`
|
|
285
285
|
`,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 ch=[{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=>Fi(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 lh(e){let t={skills:[],dryRun:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n],i=ch.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 uh(e,t){return!e||!t||e.byteLength!==t.byteLength?!1:e.every((e,n)=>e===t[n])}async function dh(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 dh(e,t);return xi(n)?i?{status:`kept-local`,write:!1}:{status:`added`,write:!0}:i?uh(i,r)?{status:`unchanged`,write:!1}:{status:`updated`,write:!0}:{status:`added`,write:!0}}async function ph(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 Si(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 mh(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 Di(t),d=await ki(s,c,o.ref,u,!0,l||void 0);if(d&&r.sha===d&&await hh(e,n,r))return{...o,to:d,outcome:`current`,changes:[]};let f=await gh(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 ph(e,`${mi}/${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 xh(e,{changes:h,writes:g,removals:_}),await Ai(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 hh(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 gh(e,t,n,r,i,a,o){let s=await wi(e,t,a,i??`main`);if(s.status===`ok`){let i=yi(s.files),a=n||_h(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:bh(i,a),path:a}}try{return{files:yh(vh(await Ci(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 _h(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])=>bi(e)))}function yh(e){return new Map([...e].sort(([e],[t])=>e.localeCompare(t)))}function bh(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);bi(e)&&r.set(e,i)}return yh(r)}async function xh(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 Sh(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 $m(o,s,t);if(!c.ok)return{...a,outcome:`error`,error:c.error};let l=`${mi}/${n}/SKILL.md`,u=await dh(e,l),d=new TextEncoder().encode(c.content),f=u!==void 0&&Zm(new TextDecoder().decode(u))===Zm(c.content);if(uh(u,d)||f)return{...a,changes:[{path:`SKILL.md`,status:`unchanged`}]};let p=u?`updated`:`added`;return i||(await e.mkdir(`${mi}/${n}`,{recursive:!0}),await e.writeFile(l,d),await Ai(e,n,{...r,files:[`SKILL.md`]})),{...a,outcome:`updated`,changes:[{path:`SKILL.md`,status:p}]}}function Ch(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 wh(e,t,n,r){let i=Fi(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 Th(e,t,n){if(t.length===0){let t=await Oi(e);return{targets:t.provenanced,missing:[],skipped:t.unattributed}}let r=[],i=[];for(let a of t){let t=await ji(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?wh(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 Eh(e){return e.reason===`not-installed`?`upskill: no skill named "${e.name}" is installed — check \`upskill list\`
|
|
@@ -290,7 +290,7 @@ Examples:
|
|
|
290
290
|
`}function kh(e,t,n,r,i){let a=t?`Skill update (dry run — nothing written):
|
|
291
291
|
`:`Skill update:
|
|
292
292
|
`;for(let n of e)a+=Ch(n,t);if(i.length>0&&(a+=Oh(i)),!n&&r&&e.length>0){let n=i.length>0?`all ${Dh(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 Ah(e,t,n){let{targets:r,missing:i,skipped:a}=await Th(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 Sh(e,t,i.name,i.provenance,n.dryRun):await mh(e,t,i.name,i.provenance,n.branch,n.dryRun));return{results:o,skipped:a,missing:i}}async function jh(e,t,n){let r=lh(e);if(r.error)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{results:i,missing:a,skipped:o}=await Ah(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`:kh([],r.dryRun,!1,!0,o),stderr:``,exitCode:0}:{stdout:``,stderr:a.length?a.map(Eh).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 Pi();let l=a.map(Eh).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:kh(i,r.dryRun,c,u,o),stderr:l,exitCode:+!u}}function Mh(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 Nh(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 Ph(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}${Nh(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(`
|
|
293
|
-
`)}\n`}async function Fh(e,t,n){let r=await(await import(`./kernel-worker-
|
|
293
|
+
`)}\n`}async function Fh(e,t,n){let r=await(await import(`./kernel-worker-BLPHh493.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await er(e,Zn(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${th()}`,stderr:``,exitCode:0}:{...tr(`upskill`,rh(r,`Discoverable local skills`),i,{builtinNames:new Set(rt())}),exitCode:0}}async function Ih(e,t,n){let{results:r,skipped:i}=await Ah(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:Ph(r,i),stderr:c,exitCode:+!s}}async function Lh(e,t,n,r){let i=Mh(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?Ih(t,n,i.json):Fh(t,i.json,r)}async function Rh(e,t){let n=`${hi}/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(Ei(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=_e(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=Ni(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 zh(e,t){let n=`${hi}/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: ${Ei(e,n)}`}}if(r.status!==200)return{error:`Tessl search failed (HTTP ${r.status})`};let i=_e(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=Ni(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 Bh=[{label:`Tessl`,host:new URL(hi).host,fetch:Rh},{label:`browse.sh`,host:new URL(vi).host,fetch:Gm}];function Vh(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 Hh(e,t,n=1){let r=await Promise.allSettled(Bh.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Vh(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Bh[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+=`
|
|
294
294
|
`}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:
|
|
295
295
|
`,p+=` From Tessl: upskill <owner/repo> --skill <name>
|
|
296
296
|
`,p+=` From browse.sh: upskill browse:<hostname>/<task>
|
|
@@ -313,7 +313,7 @@ Examples:
|
|
|
313
313
|
`,{stdout:s,stderr:``,exitCode:0}}function Yh(e){return!e||e.startsWith(`-`)?{stdout:``,stderr:`upskill: --branch requires a value
|
|
314
314
|
`,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
|
|
315
315
|
`,exitCode:1}}function Xh(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
|
|
316
|
-
`,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=Yh(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 Zh(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-
|
|
316
|
+
`,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=Yh(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 Zh(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-BLPHh493.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 ji(n,t),a=i?Mi(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:ih(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+`
|
|
317
317
|
`,stderr:``,exitCode:0}}async function Qh(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 Li(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 $h(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 Ii(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 eg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0;for(let d of e){let e=await Ii(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 tg(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 ng(e,t,n,r){let{owner:i,repo:a}=e,o=t.branch??e.branch,s=t.subPath??e.path,c=await Di(r),l=await Ri(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:tg(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:tg(l.skills,i,a)+`\nTo install specific skills: upskill ${t.sourceRef} --skill <name>\nTo install all: upskill ${t.sourceRef} --all\n`,stderr:``,exitCode:0};let d=u.length,f=Date.now(),p=``,m=``,h=0;if(d>1){let e=await wi(i,a,r,o);if(e.status===`ok`){let r=await ki(i,a,o,c,!0,s),l=await Qh(u,i,a,yi(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 $h(u,i,a,c,n,t.force,o,f);({output:p,errors:m,successCount:h}=e)}}else({output:p,errors:m,successCount:h}=await eg(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 Pi()),{stdout:p,stderr:m,exitCode:+!!m}}async function rg(e,t,n,r,i){switch(e[0]){case`tabs`:return qh(t,n,r,e.includes(`--json`));case`recommendations`:return Jh(t,n,e.includes(`--install`));case`update`:case`upgrade`:return jh(e.slice(1),t,n);case`list`:return Lh(e.slice(1),t,n,i);case`info`:case`read`:return Zh(e[0],e[1],t);case`search`:return ag(e,n);default:return null}}function ig(e,t,n){return S(`upskill`,async(r,i)=>{if(r.length===0||r.includes(`--help`)||r.includes(`-h`))return ah();let a=await rg(r,e,t,n,i.env.get(`PATH`));if(a)return a;let o=Xh(r);if(o.earlyReturn)return o.earlyReturn;if(!o.sourceRef)return ah();if(o.sourceRef.startsWith(`tessl:`))return og(o.sourceRef,o.force,e,t);let s=Jm(o.sourceRef);if(s)return eh(s.hostname,s.task,e,t,o.force);let c=Fi(o.sourceRef);return c?ng(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 ag(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?Hh(a,t,i):ah()}async function og(e,t,n,r){let i=e.slice(6);if(!i)return{stdout:``,stderr:`upskill: tessl: requires a skill name
|
|
318
318
|
`,exitCode:1};let a=await zh(i,r);if(`error`in a)return{stdout:``,stderr:`upskill: ${a.error}\n`,exitCode:1};let o=await Di(r);return Ii(a.owner,a.repo,a.skillPath,a.skillName,n,o,t,r)}function sg(){return{stdout:`usage: afplay [-v volume] [-r rate] <file>
|
|
319
319
|
|
|
@@ -707,7 +707,7 @@ Examples:
|
|
|
707
707
|
`;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+=`
|
|
708
708
|
`;return t}async function _y(e,t){let n=C(e.slice(1),{});if(`error`in n)return my(n.error);if(!t()){let e=await sy();if(!e)return uy(`list`);let t=await e.listCronTasks();return t.length===0?{stdout:`No active cron tasks
|
|
709
709
|
`,stderr:``,exitCode:0}:{stdout:gy(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
|
|
710
|
-
`,stderr:``,exitCode:0}:{stdout:gy(a),stderr:``,exitCode:0}}async function vy(e,t){let n=e[0],r=C(e.slice(1),{});if(`error`in r)return my(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 sy();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}:uy(`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 yy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return S(`crontask`,async(e,n)=>{let r=e[0];if(!r||w(e,{valueFlags:py}))return dy();try{switch(r){case`create`:return await hy(e,n.env,t);case`list`:return await _y(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 by(e){return S(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-
|
|
710
|
+
`,stderr:``,exitCode:0}:{stdout:gy(a),stderr:``,exitCode:0}}async function vy(e,t){let n=e[0],r=C(e.slice(1),{});if(`error`in r)return my(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 sy();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}:uy(`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 yy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return S(`crontask`,async(e,n)=>{let r=e[0];if(!r||w(e,{valueFlags:py}))return dy();try{switch(r){case`create`:return await hy(e,n.env,t);case`list`:return await _y(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 by(e){return S(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-Cgi7Sb4F.js`);return r(e,t,n)})}function xy(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 Sy(e){return xy(e,{si:!1})}const Cy=`slicc-fs`;async function wy(){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===Cy)}catch{return!0}}async function Ty(){let e=globalThis.indexedDB;return e?new Promise(t=>{let n;try{n=e.deleteDatabase(Cy)}catch{t(`error`);return}n.onsuccess=()=>t(`deleted`),n.onerror=()=>t(`error`),n.onblocked=()=>t(`blocked`)}):`error`}async function Ey(){if(!await wy())return{kind:`absent`,message:`legacy slicc-fs IDB not present — nothing to clean`};let e=await Ty();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 Dy(){return`slicc-fs-cleanup — delete the legacy slicc-fs IndexedDB
|
|
711
711
|
|
|
712
712
|
Usage:
|
|
713
713
|
slicc-fs-cleanup Delete the legacy slicc-fs IDB.
|
|
@@ -924,7 +924,7 @@ Options:
|
|
|
924
924
|
--pattern <glob> File pattern to match, e.g. "*.md", "*.bsh" (required)
|
|
925
925
|
--scoop <target> Scoop name, cone name, or folder. Omit for your own cone.
|
|
926
926
|
--name <name> Human-readable name for the watcher
|
|
927
|
-
`);switch(n){case`list`:return NS(e);case`delete`:return PS(e);case`create`:return await LS(e,t.env);default:return jS(`unknown command: ${n}`)}})}function zS(e){return S(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-
|
|
927
|
+
`);switch(n){case`list`:return NS(e);case`delete`:return PS(e);case`create`:return await LS(e,t.env);default:return jS(`unknown command: ${n}`)}})}function zS(e){return S(`gelatiere`,async(t,n)=>{let{runGelatiere:r}=await import(`./run-CAeNGt84.js`);return r(t,n,e)})}function BS(e){return typeof e.stdoutIsTTY!=`boolean`||e.stdoutIsTTY}function VS(e,t){return typeof e.stdinIsTTY==`boolean`?e.stdinIsTTY:t===void 0?ci(e.stdin).length===0:t===0}function HS(){return{stdout:`usage: hear [-i file] [-l lang] [-T seconds] [-d deviceId] [--engine name]
|
|
928
928
|
hear --devices | --status | --warmup
|
|
929
929
|
|
|
930
930
|
Speech recognition: listens on the microphone until you pause, then
|
|
@@ -1209,7 +1209,7 @@ Options:
|
|
|
1209
1209
|
`,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}},mT=`/.playwright`;function hT(e,t){return e?`${t.replace(/\/+$/,``)}${mT}`:mT}async function gT(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(!jn(e))throw e}t.sessionDirsCreated.add(n)}}async function _T(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 se(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(`
|
|
1210
1210
|
`),p=`${i}/snapshots/page-${kn(new Date)}.yml`;return await t.writeFile(p,f),p})}catch{return null}}async function vT(e,t,n,r){await gT(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(`
|
|
1211
1211
|
`)+`
|
|
1212
|
-
`,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 yT(){return import(`./snapshot-features-
|
|
1212
|
+
`,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 yT(){return import(`./snapshot-features-DJwZ3fVO.js`)}async function bT(e,t,n,r){let i=await e.getAccessibilityTreeForFrame(r.frameId),a=new Map,o=new Map,s=new Map,c=oe(i,a,o,{value:0},``,`f1`);for(let e of a.keys())s.set(e,r.frameId);let l=c.join(`
|
|
1213
1213
|
`);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 xT(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() {
|
|
1214
1214
|
this.scrollIntoView({ block: 'center' });
|
|
1215
1215
|
const r = this.getBoundingClientRect();
|
|
@@ -1287,7 +1287,7 @@ Options:
|
|
|
1287
1287
|
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1288
1288
|
return el.files.length;
|
|
1289
1289
|
})()`,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`,MT],[`state-load`,NT],[`console`,uC],[`requests`,Qw],[`request`,$w],[`request-headers`,eT],[`request-body`,tT],[`response-headers`,nT],[`response-body`,rT],[`mousemove`,nw],[`mousedown`,rw],[`mouseup`,iw],[`mousewheel`,aw],[`drop`,ow],[`route`,dT],[`route-list`,fT],[`unroute`,pT],[`generate-locator`,bC],[`highlight`,xC]]);function nE(){let e=(Pn.string??[]).map(e=>`--${e}`),t=new Set(Pn.boolean??[]);for(let[e,n]of Object.entries(Pn.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 rE(e){return e.map(e=>e===`--no-iframes`||e.startsWith(`--no-iframes=`)?e.replace(`--no-iframes`,`--_noiframes`):e)}function iE(e){return{...e,bool:[...e.bool??[],`--_noiframes`],value:[...e.value??[],`--_noiframes`]}}const aE=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 sE(e,t,n,r){if(!t||typeof e.getTabLockStats!=`function`)return r;let i=e.getTabLockStats(),a=i.totalWaitMs-t.totalWaitMs;if(a<aE)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>=aE?`${(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.
|
|
1290
|
-
`;return{...r,stderr:r.stderr+c}}async function cE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await Fn(e,t.tab,n):null)??r}\n`,exitCode:1}}function lE(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 uE(e,t,n){let r=tE.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?lE(e,t,void 0):a}catch(r){return i?.aborted?lE(e,t,r):await cE(n.browser,n.flags,r)}}async function dE(e,t,n,r){let i=C(rE(n),iE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=Nn(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-
|
|
1290
|
+
`;return{...r,stderr:r.stderr+c}}async function cE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await Fn(e,t.tab,n):null)??r}\n`,exitCode:1}}function lE(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 uE(e,t,n){let r=tE.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?lE(e,t,void 0):a}catch(r){return i?.aborted?lE(e,t,r):await cE(n.browser,n.flags,r)}}async function dE(e,t,n,r){let i=C(rE(n),iE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=Nn(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-BGytxBWI.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 fE(e,t,n,r={}){let i=t?An(t,n):null,a=nE();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-BGytxBWI.js`);return{stdout:t(e)+`
|
|
1291
1291
|
`,stderr:``,exitCode:0}}let c=o[0],l=o.slice(1),u=await dE(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=qi(s.env),g=hT(r.isScoop?.()??!1,h),_=await uE(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;Vn.has(c)&&_.exitCode===0&&v&&(ee=await _T(t,n,v,i,g));try{await vT(n,i,g,{command:c,args:l,result:_,snapshotPath:ee,targetId:v})}catch{}return sE(t,m,p,_)})}const pE=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`,`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`,...zn,`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)`,[...Kg]]]);function mE(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:
|
|
1292
1292
|
`);let a=[];for(let[e,t]of pE){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(`
|
|
1293
1293
|
`)+`
|
|
@@ -1467,7 +1467,7 @@ manifest without rewriting it. With -g, packages go to /shared/lib/node_modules
|
|
|
1467
1467
|
and deps are recorded in /shared/lib/package.json. Existing fields are
|
|
1468
1468
|
preserved. Idempotent: re-installing an already-satisfied package is a clean
|
|
1469
1469
|
no-op.
|
|
1470
|
-
`}function iO(e){let t=C(e,{bool:nO,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 aO(e){let t=!1,n=[];for(let r of e){if(tO.has(r)){t=!0;continue}r.startsWith(`-`)||n.push(r)}return{global:t,specs:n}}function oO(e){return w(e)}function sO(e){return e instanceof Error?e.message:String(e)}async function cO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function lO(e,t){let n=e===`i`;return S(e,async(r,i)=>{if(n)return oO(r)?{stdout:rO(e),stderr:``,exitCode:0}:dO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-
|
|
1470
|
+
`}function iO(e){let t=C(e,{bool:nO,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 aO(e){let t=!1,n=[];for(let r of e){if(tO.has(r)){t=!0;continue}r.startsWith(`-`)||n.push(r)}return{global:t,specs:n}}function oO(e){return w(e)}function sO(e){return e instanceof Error?e.message:String(e)}async function cO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function lO(e,t){let n=e===`i`;return S(e,async(r,i)=>{if(n)return oO(r)?{stdout:rO(e),stderr:``,exitCode:0}:dO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-COcmduaL.js`);return n(e,r.slice(1),i,t)}if(oO(r))return{stdout:rO(e),stderr:``,exitCode:0};if(r.length===0)return{stdout:rO(e),stderr:`${e}: missing subcommand\n`,exitCode:1};let a=r[0],o=r.slice(1);return QD.has(a)?dO(e,o,i,t):$D.has(a)?pO(e,o,i,t):eO.has(a)?mO(e,o,i,t):a===`root`?hO(e,o,i,t):xD.has(a)?ZD(e,o,i,{fs:t.fs}):SD.has(a)?ZD(e,r,i,{fs:t.fs}):{stdout:``,stderr:`${e}: unknown subcommand '${a}' (supported: install, uninstall, list, root, run, mamba)\n`,exitCode:1}})}async function uO(e,t,n){let r;try{r=await Qi({fs:n.fs,fetch:n.fetch,cwd:t.cwd})}catch(t){return t instanceof ta?{stdout:``,stderr:`${e}: ${t.message}\n`,exitCode:1}:{stdout:``,stderr:`${e}: install failed: ${sO(t)}\n`,exitCode:1}}if(r.empty&&r.errors.length===0)return{stdout:`${e}: nothing to install (package.json declares no dependencies)\n`,stderr:``,exitCode:0};let i=r.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),a=r.errors.map(t=>`${e}: failed to install ${t.spec}: ${sO(t.error)}`);return{stdout:i.length>0?`${i.join(`
|
|
1471
1471
|
`)}\n`:``,stderr:a.length>0?`${a.join(`
|
|
1472
1472
|
`)}\n`:``,exitCode:r.errors.length===0?0:1}}async function dO(e,t,n,r){let i=iO(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 uO(e,n,r);let c;try{c=await ea(s,{fs:r.fs,fetch:r.fetch,cwd:n.cwd,global:a,saveDev:o})}catch(t){return{stdout:``,stderr:`${e}: install failed: ${sO(t)}\n`,exitCode:1}}let l=c.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),u=c.errors.map(t=>`${e}: failed to install ${t.spec}: ${sO(t.error)}`);return a&&c.results.length>0&&await cO(r),{stdout:l.length>0?`${l.join(`
|
|
1473
1473
|
`)}\n`:``,stderr:u.length>0?`${u.join(`
|
|
@@ -1489,7 +1489,7 @@ Options:
|
|
|
1489
1489
|
--global Resolve only from the shared global prefix (/shared/lib/node_modules)
|
|
1490
1490
|
-h, --help Show this help message
|
|
1491
1491
|
`}async function LO(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function RO(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function zO(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*BO(e,t=!1){if(t){yield Yn;return}let n=b(e);for(;yield x(n,`node_modules`),n!==`/`;)n=Me(n).dir;yield Yn}async function VO(e,t,n,r=!1){for(let i of BO(t,r)){let t=x(i,`.bin`,n);if(!await RO(e,t))continue;let r=await LO(e,t),a=FO.exec(r),o=Me(t).dir;return{binFilePath:a?x(o,a[1]):t,argvName:t}}return null}function HO(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function UO(e,t){if(typeof e==`string`)return{binName:HO(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,HO(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 WO(e,t,n,r=!1){for(let i of BO(t,r)){let t=x(i,n),r=x(t,`package.json`);if(!await RO(e,r))continue;let a;try{a=JSON.parse(await LO(e,r))}catch{return null}let o=UO(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 GO(e,t,n,r=!1){return await VO(e,t,n,r)??await WO(e,t,n,r)}async function KO(e,t,n){for(let r of BO(t))if(await RO(e,x(r,n,`package.json`)))return!0;return!1}function qO(e){return e instanceof Error?e.message:String(e)}function JO(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function YO(e,t,n,r){try{let i=await ea([t],{fs:r.fs,fetch:r.fetch,cwd:n.cwd});if(i.errors.length>0)return{error:JO(e,`failed to install '${t}': ${qO(i.errors[0].error)}`)};let a=i.results.map(t=>`${e}: installed ${t.name}@${t.version}`);return{progress:a.length>0?`${a.join(`
|
|
1492
|
-
`)}\n`:``}}catch(n){return{error:JO(e,`failed to install '${t}': ${qO(n)}`)}}}async function XO(e,t,n,r){return await RO(r,n)?null:await zO(r,n)?JO(e,`bin target '${n}' is a directory, not a file`):JO(e,`bin file '${n}' for '${t}' does not exist`)}async function ZO(e,t,n,r,i,a){if(await KO(a.fs,i.cwd,t))return{error:JO(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:MO(t);if(o)return{error:{stdout:``,stderr:PO(e,t,n,o),exitCode:1}};let s=await YO(e,t,i,a);if(`error`in s)return s;let c=await GO(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:JO(e,`package '${t}' was installed but does not expose an executable bin`)}}function QO(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:IO(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:IO(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await GO(t.fs,r.cwd,c,o)}catch(t){return JO(e,qO(t))}let d=``;if(!u){if(o)return JO(e,`no global bin '${c}' found in ${Yn}`);let n=await ZO(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await XO(e,c,u.binFilePath,t.fs);if(f)return f;let p=Qr(await LO(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await Xr(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function $O(e={}){return S(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-
|
|
1492
|
+
`)}\n`:``}}catch(n){return{error:JO(e,`failed to install '${t}': ${qO(n)}`)}}}async function XO(e,t,n,r){return await RO(r,n)?null:await zO(r,n)?JO(e,`bin target '${n}' is a directory, not a file`):JO(e,`bin file '${n}' for '${t}' does not exist`)}async function ZO(e,t,n,r,i,a){if(await KO(a.fs,i.cwd,t))return{error:JO(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:MO(t);if(o)return{error:{stdout:``,stderr:PO(e,t,n,o),exitCode:1}};let s=await YO(e,t,i,a);if(`error`in s)return s;let c=await GO(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:JO(e,`package '${t}' was installed but does not expose an executable bin`)}}function QO(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:IO(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:IO(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await GO(t.fs,r.cwd,c,o)}catch(t){return JO(e,qO(t))}let d=``;if(!u){if(o)return JO(e,`no global bin '${c}' found in ${Yn}`);let n=await ZO(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await XO(e,c,u.binFilePath,t.fs);if(f)return f;let p=Qr(await LO(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await Xr(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function $O(e={}){return S(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-Ddg-X7KW.js`);return r(t,n,e)})}const ek=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function tk(e={}){return S(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return sk();let n=e.processManager??nk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
|
|
1493
1493
|
`,exitCode:1};let r=rk(t);if(!r.ok)return{stdout:``,stderr:r.stderr,exitCode:r.exitCode};let{allDelivered:i,errors:a}=ik(n,r.pids,r.signal);return{stdout:``,stderr:a.length?`${a.join(`
|
|
1494
1494
|
`)}\n`:``,exitCode:+!i}})}function nk(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function rk(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
|
|
1495
1495
|
`,exitCode:2};let i=ak(n);if(i instanceof Error)return{ok:!1,stderr:`kill: ${i.message}\n`,exitCode:2};t=i;continue}if(i.startsWith(`-`)){let e=ok(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
|
|
@@ -1562,7 +1562,7 @@ Common base URLs:
|
|
|
1562
1562
|
`)+`
|
|
1563
1563
|
`,stderr:``,exitCode:0}}function Pk(e,t){let n=t.models.length;return{stdout:[`✓ ${e} (${Ak(t.runtime,!1)})`,` Saved ${n} model${n===1?``:`s`} to Settings:`,...jk(t.models)].join(`
|
|
1564
1564
|
`)+`
|
|
1565
|
-
`,stderr:``,exitCode:0}}function Fk(){return S(Ok,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:kk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-
|
|
1565
|
+
`,stderr:``,exitCode:0}}function Fk(){return S(Ok,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:kk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-BonG4PL9.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-BRxW_8zf.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(Ok);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
|
|
1566
1566
|
`,exitCode:1};let c=await a(s,t(Ok)??void 0);if(!c.ok)return Mk(s,c);if(o===`discover`){let e=n(Ok)??``;return i(Ok,e,s,c.models.join(`, `)),Pk(s,c)}return Nk(s,c)})}function Ik(){return{stdout:`usage: man <topic>
|
|
1567
1567
|
|
|
1568
1568
|
Fetches documentation for a given topic from sliccy.com.
|
|
@@ -1600,20 +1600,20 @@ authorization-code flow, stores the access token, and retries.
|
|
|
1600
1600
|
On success, the server is persisted to /workspace/.mcp/servers.json and
|
|
1601
1601
|
an alias shim is written to /workspace/.mcp/aliases/<name>.jsh so the
|
|
1602
1602
|
short name resolves on the PATH.
|
|
1603
|
-
`);let n=C(e,{});if(`error`in n)return Hk(n.error);if(n.positionals.length<2)return G(`mcp add: expected <url> <name>`);let[r,i]=n.positionals;if(!/^https?:\/\//i.test(r))return G(`mcp add: invalid URL "${r}" (must start with http:// or https://)`);if(!/^[A-Za-z][A-Za-z0-9_-]*$/.test(i))return G(`mcp add: invalid name "${i}" (letters, digits, _ and - only; must start with a letter)`);let{getServer:a,setServer:o}=await import(`./store-
|
|
1603
|
+
`);let n=C(e,{});if(`error`in n)return Hk(n.error);if(n.positionals.length<2)return G(`mcp add: expected <url> <name>`);let[r,i]=n.positionals;if(!/^https?:\/\//i.test(r))return G(`mcp add: invalid URL "${r}" (must start with http:// or https://)`);if(!/^[A-Za-z][A-Za-z0-9_-]*$/.test(i))return G(`mcp add: invalid name "${i}" (letters, digits, _ and - only; must start with a letter)`);let{getServer:a,setServer:o}=await import(`./store-D3vhlDka.js`).then(e=>e.r);if(await a(i,t.fs))return G(`mcp add: a server named "${i}" already exists`);let{McpClient:s,McpAuthRequiredError:c}=await import(`./client-CwxmlQM-.js`).then(e=>e.n),l=new s({url:r,fetchImpl:t.fetchImpl}),u;try{await l.initialize()}catch(e){if(!(e instanceof c))throw e;u=await Kk(r,i,e.resourceMetadataUrl,t),l=new s({url:r,fetchImpl:t.fetchImpl,getAuthHeader:()=>xA(i)}),await l.initialize()}let d=await l.toolsList(),f=await l.appsList(),p=new Date().toISOString();await o(i,{url:r,protocolVersion:l.getNegotiatedProtocolVersion(),tools:d,apps:f,addedAt:p,lastRefreshedAt:p,...u?{auth:u}:{}},t.fs),await EA(i,t);let m=await kA(i,f,t);if(u){let{registerMcpProvider:e}=await import(`./provider-WZR9m-XW.js`);e({name:i,serverUrl:r,auth:u})}return W([`Added MCP server "${i}" → ${r}`,` tools: ${d.length}, apps: ${f.length} (${m} sprinkle${m===1?``:`s`})`,` alias: ${Vk}/${i}.jsh`,u?` auth: oauth (provider mcp:${i})`:` auth: none`].join(`
|
|
1604
1604
|
`)+`
|
|
1605
|
-
`)}async function Kk(e,t,n,r){let{discoverAuth:i,dynamicRegister:a,runAuthFlow:o}=await import(`./oauth-D20BEoY6.js`),{saveOAuthAccount:s}=await import(`./account-store-
|
|
1606
|
-
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let{ensureAllMcpProvidersRegistered:r}=await import(`./provider-
|
|
1605
|
+
`)}async function Kk(e,t,n,r){let{discoverAuth:i,dynamicRegister:a,runAuthFlow:o}=await import(`./oauth-D20BEoY6.js`),{saveOAuthAccount:s}=await import(`./account-store-BonG4PL9.js`).then(e=>e.t),c=await CA(r.oauthFetchImpl),l=r.oauthLauncher??await SA(),u=await i(e,n,c);Bk.debug(`MCP OAuth discovery succeeded`,{name:t,serverUrl:e,discoveryPath:u.discoveryPath,issuer:u.issuer});let d=await la(Ce()),f=await a(u,d,c),p=u.supportedScopes&&u.supportedScopes.length>0?u.supportedScopes.join(` `):void 0,m=await o({asMetadata:u,clientId:f.clientId,scope:p,redirectUri:d,launcher:l,fetchImpl:c}),h=`mcp:${t}`;return await s({providerId:h,accessToken:m.accessToken,refreshToken:m.refreshToken,tokenExpiresAt:m.expiresAt,scopes:m.scope}),{providerId:h,authorizationServer:u.issuer,clientId:f.clientId,redirectUri:d,scope:m.scope??p,registrationClientUri:f.registrationClientUri}}async function qk(e,t){if(w(e))return W(`usage: mcp list
|
|
1606
|
+
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let{ensureAllMcpProvidersRegistered:r}=await import(`./provider-WZR9m-XW.js`);await r();let{listServers:i}=await import(`./store-D3vhlDka.js`).then(e=>e.r),a=await i(t.fs),o=Object.keys(a).sort();if(o.length===0)return W("No MCP servers configured. Use `mcp add <url> <name>`.\n");let s=[[`NAME`,`URL`,`AUTH`,`TOOLS`,`APPS`,`ADDED`]];for(let e of o){let t=a[e];s.push([e,t.url,t.auth?`yes`:`no`,String(t.tools?.length??0),String(t.apps?.length??0),t.addedAt?t.addedAt.slice(0,10):`-`])}return W(Jk(s))}function Jk(e){let t=e[0].map((t,n)=>e.reduce((e,t)=>Math.max(e,(t[n]??``).length),0));return e.map(e=>e.map((e,n)=>e.padEnd(t[n])).join(` `).trimEnd()).join(`
|
|
1607
1607
|
`)+`
|
|
1608
1608
|
`}async function Yk(e,t){if(w(e))return W(`usage: mcp search <query>
|
|
1609
1609
|
|
|
1610
1610
|
Case-insensitive substring search across the cached tools of every
|
|
1611
1611
|
registered MCP server. Matches tool name OR description and prints a
|
|
1612
1612
|
table of (server, tool, description, match-field) rows.
|
|
1613
|
-
`);let n=C(e,{});if(`error`in n)return Hk(n.error);if(n.positionals.length===0)return G(`mcp search: expected <query>`);let r=n.positionals[0],i=r.toLowerCase(),{ensureAllMcpProvidersRegistered:a}=await import(`./provider-
|
|
1614
|
-
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp delete: expected <name>`);let{ensureMcpProviderRegistered:i,removeMcpProvider:a}=await import(`./provider-
|
|
1613
|
+
`);let n=C(e,{});if(`error`in n)return Hk(n.error);if(n.positionals.length===0)return G(`mcp search: expected <query>`);let r=n.positionals[0],i=r.toLowerCase(),{ensureAllMcpProvidersRegistered:a}=await import(`./provider-WZR9m-XW.js`);await a();let{listServers:o}=await import(`./store-D3vhlDka.js`).then(e=>e.r),s=await o(t.fs),c=Object.keys(s).sort();if(c.length===0)return W("No MCP servers configured. Use `mcp add <url> <name>`.\n");let l=[];for(let e of c){let t=s[e].tools??[];for(let n of t){let t=n.description??``,r=n.name.toLowerCase().includes(i),a=t.toLowerCase().includes(i);if(!r&&!a)continue;let o=r&&a?`name+description`:r?`name`:`description`;l.push({server:e,tool:n.name,description:t,match:o})}}if(l.length===0)return W(`No tools matched "${r}".\n`);l.sort((e,t)=>e.server===t.server?e.tool.localeCompare(t.tool):e.server.localeCompare(t.server));let u=[[`SERVER`,`TOOL`,`DESCRIPTION`,`MATCH`]];for(let e of l)u.push([e.server,e.tool,Xk(e.description),e.match]);return W(Jk(u))}function Xk(e){if(!e)return``;let t=e.replace(/\s+/g,` `).trim();return t.length<=60?t:t.slice(0,59)+`…`}async function Zk(e,t){if(e.length===0||w(e))return e.length===0?G(`mcp delete: expected <name>`):W(`usage: mcp delete <name>
|
|
1614
|
+
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp delete: expected <name>`);let{ensureMcpProviderRegistered:i,removeMcpProvider:a}=await import(`./provider-WZR9m-XW.js`);await i(r);let{deleteServer:o}=await import(`./store-D3vhlDka.js`).then(e=>e.r),s=await o(r,t.fs);await DA(r,t),await OA(r,t);let c=`mcp:${r}`,l=!1;try{let{removeAccount:e,getAccounts:t}=await import(`./account-store-BonG4PL9.js`).then(e=>e.t);t().some(e=>e.providerId===c)&&(await e(c),l=!0)}catch(e){Bk.warn(`mcp delete: OAuth removal failed`,{providerId:c,error:e instanceof Error?e.message:String(e)})}let u=a(r);return!s&&!l&&!u?G(`mcp delete: no server, alias, or account found for "${r}"`):W([`Removed MCP server "${r}"`,` servers.json: ${s?`removed`:`not present`}`,` alias: cleaned`,` sprinkles: cleaned`,` oauth: ${l?`removed`:`not present`}`,` provider: ${u?`unregistered`:`not registered`}`].join(`
|
|
1615
1615
|
`)+`
|
|
1616
|
-
`)}async function Qk(e,t){if(e.length===0)return G(`mcp invoke: expected <name>`);if(w(e.slice(0,1)))return W(tA());let n=C([e[0]],{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp invoke: expected <name>`);let i=e.slice(1),{ensureMcpProviderRegistered:a}=await import(`./provider-
|
|
1616
|
+
`)}async function Qk(e,t){if(e.length===0)return G(`mcp invoke: expected <name>`);if(w(e.slice(0,1)))return W(tA());let n=C([e[0]],{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp invoke: expected <name>`);let i=e.slice(1),{ensureMcpProviderRegistered:a}=await import(`./provider-WZR9m-XW.js`);await a(r);let{getServer:o}=await import(`./store-D3vhlDka.js`).then(e=>e.r),s=await o(r,t.fs);if(!s)return G(`mcp invoke: unknown server "${r}" (run \`mcp add <url> ${r}\` first)`);let c=s.tools??[];if(i.length===0||w(i.slice(0,1)))return W(nA(r,s,c));let l=C([i[0]],{});if(`error`in l)return Hk(l.error);let u=l.positionals[0];if(!u)return G(`mcp invoke: expected <tool>`);let d=c.find(e=>e.name===u);if(!d)return G(`mcp invoke: unknown tool "${u}" on "${r}" (run \`${r}\` to list tools)`);let{timeoutMs:f,remaining:p,warnings:m}=$k(i.slice(1));if(w(p))return W(iA(r,d));let h=aA(p,d.inputSchema);if(!h.ok)return G(`mcp invoke: ${h.error}`);let{McpClient:g}=await import(`./client-CwxmlQM-.js`).then(e=>e.n),_=new g({url:s.url,fetchImpl:t.fetchImpl,headers:s.headers,getAuthHeader:s.auth?()=>xA(r):void 0,...f===void 0?{}:{timeoutMs:f}});await _.initialize();let v=_A(await _.toolsCall(u,h.value));return m.length>0&&(v.stderr=m.map(e=>`${e}\n`).join(``)+v.stderr),v}function $k(e){let t=[],n=[],r,i=0;for(;i<e.length;){let a=e[i];if(a.startsWith(`--timeout=`)){let e=eA(a.slice(10));e.ok?r=e.value:n.push(e.error),i+=1;continue}if(a===`--timeout`){let t=e[i+1];if(t===void 0||t.startsWith(`--`)){n.push(`mcp invoke: --timeout requires a value (got ${t===void 0?`nothing`:`"${t}"`}); using default.`),i+=1;continue}let a=eA(t);a.ok?r=a.value:n.push(a.error),i+=2;continue}t.push(a),i+=1}return{timeoutMs:r,remaining:t,warnings:n}}function eA(e){if(!/^-?\d+$/.test(e))return{ok:!1,error:`mcp invoke: invalid --timeout value "${e}" (expected positive integer seconds); using default.`};let t=Number(e);return!Number.isFinite(t)||t<1?{ok:!1,error:`mcp invoke: invalid --timeout value "${e}" (must be >= 1 second); using default.`}:{ok:!0,value:t*1e3}}function tA(){return`usage: mcp invoke <name> [tool] [--timeout <seconds>] [--flag value …]
|
|
1617
1617
|
|
|
1618
1618
|
mcp invoke <name> List tools on <name>.
|
|
1619
1619
|
mcp invoke <name> <tool> --help Show flags for <tool>.
|
|
@@ -1646,7 +1646,7 @@ Arguments are coerced according to the tool's JSON Schema:
|
|
|
1646
1646
|
|
|
1647
1647
|
Re-fetches the tool catalog and \`apps/list\` for <name>. Does NOT refresh
|
|
1648
1648
|
OAuth tokens — for OAuth token refresh use \`mcp auth <name>\`.
|
|
1649
|
-
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp refresh: expected <name>`);let{ensureMcpProviderRegistered:i}=await import(`./provider-
|
|
1649
|
+
`);let n=C(e,{});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp refresh: expected <name>`);let{ensureMcpProviderRegistered:i}=await import(`./provider-WZR9m-XW.js`);await i(r);let{getServer:a,setServer:o}=await import(`./store-D3vhlDka.js`).then(e=>e.r),s=await a(r,t.fs);if(!s)return G(`mcp refresh: unknown server "${r}"`);let{McpClient:c,McpAuthRequiredError:l}=await import(`./client-CwxmlQM-.js`).then(e=>e.n),u=new c({url:s.url,fetchImpl:t.fetchImpl,headers:s.headers,getAuthHeader:s.auth?()=>xA(r):void 0});try{await u.initialize()}catch(e){if(e instanceof l)return G(`mcp refresh: server "${r}" returned 401 — token may have expired. Run \`mcp auth ${r}\` to re-authenticate.`);throw e}let d=await u.toolsList(),f=await u.appsList();await o(r,{...s,protocolVersion:u.getNegotiatedProtocolVersion(),tools:d,apps:f,lastRefreshedAt:new Date().toISOString()},t.fs);let p=await kA(r,f,t);return W(`Refreshed "${r}" — tools: ${d.length}, apps: ${f.length} (${p} sprinkle${p===1?``:`s`})\n`)}async function yA(e,t){if(w(e))return W(`usage: mcp auth <name> [--silent | --interactive]
|
|
1650
1650
|
|
|
1651
1651
|
Re-authenticate an existing MCP server. By default, attempts a silent
|
|
1652
1652
|
token renewal using the persisted refresh_token; if that returns no
|
|
@@ -1658,7 +1658,7 @@ Options:
|
|
|
1658
1658
|
-i, --interactive Skip silent renewal and open the OAuth popup
|
|
1659
1659
|
directly. Use after revoking a refresh token or
|
|
1660
1660
|
when the AS no longer accepts the cached one.
|
|
1661
|
-
`);let n=C(e,{bool:zk});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp auth: expected <name>`);let i=n.bools.has(`--silent`)||n.bools.has(`-s`),a=n.bools.has(`--interactive`)||n.bools.has(`-i`);if(i&&a)return G(`mcp auth: --silent and --interactive are mutually exclusive`);let{ensureMcpProviderRegistered:o}=await import(`./provider-
|
|
1661
|
+
`);let n=C(e,{bool:zk});if(`error`in n)return Hk(n.error);let r=n.positionals[0];if(!r)return G(`mcp auth: expected <name>`);let i=n.bools.has(`--silent`)||n.bools.has(`-s`),a=n.bools.has(`--interactive`)||n.bools.has(`-i`);if(i&&a)return G(`mcp auth: --silent and --interactive are mutually exclusive`);let{ensureMcpProviderRegistered:o}=await import(`./provider-WZR9m-XW.js`),s=await o(r,{fetchImpl:t.oauthFetchImpl,launcher:t.oauthLauncher}),{getServer:c}=await import(`./store-D3vhlDka.js`).then(e=>e.r),l=await c(r,t.fs);if(!l)return G(`mcp auth: unknown server "${r}" (run \`mcp list\` to see configured servers)`);if(!l.auth)return G(`mcp auth: server "${r}" does not use OAuth`);if(!s)return G(`mcp auth: failed to register provider for "${r}"`);let u=`mcp:${r}`,{getRegisteredProviderConfig:d}=await import(`./providers-D-U73j9B.js`).then(e=>e.r),f=d(u);if(!f)return G(`mcp auth: provider "${u}" is not registered`);if(a)return await bA(r,f,t);if(!f.onSilentRenew)return i?G(`mcp auth: provider "${u}" does not support silent renewal; retry without --silent`):await bA(r,f,t);let p=null;try{p=await f.onSilentRenew()}catch(e){let t=e instanceof Error?e.message:String(e);if(i)return G(`mcp auth: silent renewal for "${r}" failed (${t}); retry without --silent to run the interactive flow`);Bk.debug(`mcp auth: silent renewal threw, falling back to interactive`,{name:r,error:t})}return p?W(`Re-authenticated "${r}" via silent renewal (provider ${u})\n`):i?G(`mcp auth: silent renewal for "${r}" returned no token; retry without --silent to run the interactive flow`):await bA(r,f,t)}async function bA(e,t,n){if(!t.onOAuthLogin)return G(`mcp auth: provider "${t.id}" does not support interactive OAuth login`);let r=n.oauthLauncher??await SA(),i=!1;return await t.onOAuthLogin(r,()=>{i=!0}),i?W(`Re-authenticated "${e}" via interactive login (provider ${t.id})\n`):G(`mcp auth: interactive login for "${e}" did not complete`)}async function xA(e){let t=`mcp:${e}`,{getOAuthAccountInfo:n}=await import(`./account-store-BonG4PL9.js`).then(e=>e.t),r=n(t);if(!r)return null;if(r.expired){try{let{getRegisteredProviderConfig:e}=await import(`./providers-D-U73j9B.js`).then(e=>e.r),n=await e(t)?.onSilentRenew?.();if(n)return`Bearer ${n}`}catch(e){Bk.debug(`silent renewal threw`,{providerId:t,error:e instanceof Error?e.message:String(e)})}return null}return`Bearer ${r.token}`}async function SA(){let{createOAuthLauncher:e}=await import(`./oauth-service-DP3Rx6V_.js`);return e()}async function CA(e){if(e)return e;let{createProxiedFetch:t}=await import(`./proxied-fetch-DXaTHROw.js`).then(e=>e.a),n=t();return async(e,t)=>{let r=await n(e,{method:t?.method,headers:t?.headers,body:t?.body}),i=new TextDecoder().decode(r.body);return{ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,text:async()=>i,json:async()=>JSON.parse(i),headers:{get:e=>r.headers[e.toLowerCase()]??null}}}}async function wA(e){if(e)return e;let{VirtualFS:t}=await import(`./fs-B7SM0TGT.js`).then(e=>e.t),{GLOBAL_FS_DB_NAME:n}=await import(`./global-db-DJXlpNui.js`).then(e=>e.n);return await t.create({dbName:n})}function TA(e){return`// MCP alias for "${e}" — forwards args to \`mcp invoke ${e}\`.
|
|
1662
1662
|
// Auto-generated by \`mcp add ${e}\`; do not edit by hand.
|
|
1663
1663
|
const { promisify } = require('util');
|
|
1664
1664
|
const { exec } = require('child_process');
|
|
@@ -1687,7 +1687,7 @@ try {
|
|
|
1687
1687
|
if (stdout) process.stdout.write(stdout);
|
|
1688
1688
|
if (stderr) process.stderr.write(stderr);
|
|
1689
1689
|
process.exit(exitCode);
|
|
1690
|
-
`}async function EA(e,t){let n=await wA(t.fs);await n.mkdir(Vk,{recursive:!0}),await n.writeFile(`${Vk}/${e}.jsh`,TA(e)),t.scriptCatalog?.invalidateJsh()}async function DA(e,t){let n=await wA(t.fs),r=`${Vk}/${e}.jsh`;try{await n.exists(r)&&await n.rm(r)}catch(e){Bk.debug(`alias removal failed`,{path:r,error:e instanceof Error?e.message:String(e)})}t.scriptCatalog?.invalidateJsh()}async function OA(e,t){let{removeAppSprinkles:n}=await import(`./apps-
|
|
1690
|
+
`}async function EA(e,t){let n=await wA(t.fs);await n.mkdir(Vk,{recursive:!0}),await n.writeFile(`${Vk}/${e}.jsh`,TA(e)),t.scriptCatalog?.invalidateJsh()}async function DA(e,t){let n=await wA(t.fs),r=`${Vk}/${e}.jsh`;try{await n.exists(r)&&await n.rm(r)}catch(e){Bk.debug(`alias removal failed`,{path:r,error:e instanceof Error?e.message:String(e)})}t.scriptCatalog?.invalidateJsh()}async function OA(e,t){let{removeAppSprinkles:n}=await import(`./apps-POm194Op.js`);await n(e,t.fs)}async function kA(e,t,n){try{let{materializeAppSprinkles:r}=await import(`./apps-POm194Op.js`);return(await r(e,t,n.fs)).length}catch(t){return Bk.warn(`mcp: failed to materialize app sprinkles`,{name:e,error:t instanceof Error?t.message:String(t)}),0}}function AA(e){return{stdout:``,stderr:`meminfo: ${e}\n`,exitCode:1}}function jA(e){return e.attribution.length===0?`(shared)`:e.attribution.map(e=>{let t=e.container?.src??e.container?.id??e.url??`?`;return e.scope?`${e.scope} ${t}`:t}).join(`, `)}function MA(){let e=globalThis.performance,t=e?.measureUserAgentSpecificMemory;return t?t.bind(e):null}function NA(e){if(e[0]===`--help`||e[0]===`-h`||e[0]===`help`)return{help:!0};let t=!1;for(let n of e){if(n!==`--json`)return{error:`unknown option '${n}' — see \`meminfo --help\``};t=!0}return{help:!1,json:t}}function PA(e){let t=[`total: ${Sy(e.bytes)}`],n=[...e.breakdown].filter(e=>e.bytes>0).sort((e,t)=>t.bytes-e.bytes);if(n.length>0){t.push(``,`BYTES TYPES ATTRIBUTION`);for(let e of n)t.push(`${Sy(e.bytes).padEnd(10)} ${e.types.join(`,`).padEnd(20)} ${jA(e)}`)}return`${t.join(`
|
|
1691
1691
|
`)}\n`}function FA(e={}){return S(`meminfo`,async t=>{let n=NA(t);if(`error`in n)return AA(n.error);if(n.help)return{stdout:`meminfo - agent-cluster memory diagnostics
|
|
1692
1692
|
|
|
1693
1693
|
Usage:
|
|
@@ -1699,7 +1699,7 @@ Notes:
|
|
|
1699
1699
|
Document-Isolation-Policy). Embedded floats cannot be isolated and
|
|
1700
1700
|
report why instead.
|
|
1701
1701
|
- The browser randomizes measurement timing — expect a short delay.
|
|
1702
|
-
`,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??MA();if(!r&&!e.measure)return AA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return AA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return AA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:PA(a),stderr:``,exitCode:0}})}function IA(e){return S(`memory`,async t=>{let{runMemory:n}=await import(`./run-
|
|
1702
|
+
`,stderr:``,exitCode:0};let r=e.isIsolated?e.isIsolated():globalThis.crossOriginIsolated===!0,i=e.measure??MA();if(!r&&!e.measure)return AA(`memory measurement requires a cross-origin-isolated runtime (Document-Isolation-Policy) — this runtime is not isolated`);if(!i)return AA(`performance.measureUserAgentSpecificMemory is not available in this browser`);let a;try{a=await i()}catch(e){return AA(e instanceof Error?e.message:String(e))}return n.json?{stdout:`${JSON.stringify(a,null,2)}\n`,stderr:``,exitCode:0}:{stdout:PA(a),stderr:``,exitCode:0}})}function IA(e){return S(`memory`,async t=>{let{runMemory:n}=await import(`./run-yrywpFIm.js`);return n(t,e)})}function LA(){return S(`mktemp`,async(e,t)=>{let{runMktemp:n}=await import(`./run-dAJe7sKp.js`);return n(e,t)})}const RA=`/.cache/artificial-analysis.json`,zA=[`--all`,`--all-versions`,`--json`,`--refresh`,`--no-benchmarks`,`--help`,`-h`],BA=[`--provider`];function VA(e){return{stdout:``,stderr:e.endsWith(`
|
|
1703
1703
|
`)?e:`${e}\n`,exitCode:1}}async function HA(e){try{let t=await e.readFile(RA),n=JSON.parse(t);if(Date.now()-n.fetchedAt<864e5)return n.models}catch{}return null}function UA(){try{return localStorage.getItem(`aa_api_key`)}catch{return null}}function WA(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 GA(e,t){let n={fetchedAt:Date.now(),models:t};try{await e.mkdir(`/.cache`,{recursive:!0}),await e.writeFile(RA,JSON.stringify(n))}catch{}}async function KA(e,t=!1){if(e&&!t){let t=await HA(e);if(t)return t}let n={Accept:`application/json`},r=UA();r&&(n[`x-api-key`]=r);let i=p(),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=WA(Array.isArray(s)?s:s.data??s.models??[]);return e&&c.length>0&&await GA(e,c),c}function qA(e){return e.toLowerCase().replace(/\./g,`-`).replace(/-\d{8}$/,``).replace(/-\d{4}$/,``)}function JA(e,t){let n=e.toLowerCase(),r=t.find(e=>e.slug===n);if(r)return r;let i=qA(e),a=t.find(e=>qA(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 YA(){return`models - list available LLM models
|
|
1704
1704
|
|
|
1705
1705
|
Usage: models [options]
|
|
@@ -1714,7 +1714,7 @@ Options:
|
|
|
1714
1714
|
-h, --help Show this help message
|
|
1715
1715
|
`}function XA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`.replace(`.0M`,`M`):e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function ZA(e){return`$${e.toFixed(2)}`}const QA=/\b(embedding|embed|tts|whisper|dall-e|image-gen|audio|vision-preview)\b/i;function $A(e){let t=`${e.id} ${e.name??``}`;return!QA.test(t)}function ej(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 tj(e){let t=e.toLowerCase();return t=t.replace(/-\d{8}$/,``),t=t.replace(/-\d{4}$/,``),t=t.replace(/-(preview|latest)$/,``),ej(t)??t.replace(/-[\d.]+$/,``)}function nj(e){let t=new Map;for(let n of e){let e=tj(n.id);(!t.has(e)||n.selected)&&t.set(e,n)}return[...t.values()]}function rj(e,t,n,r,i){let a=i?JA(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 ij(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=`${ZA(e.cost.input)} / ${ZA(e.cost.output)}`,a=`${XA(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(`
|
|
1716
1716
|
`)+`
|
|
1717
|
-
`}function aj(e){let t=C(e,{bool:zA,value:BA});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 oj(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 sj(e,t,n,r,i,a){let o=e.getProviderModels(t).filter($A);if(o.length===0)return[];let s=o.map(e=>rj(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=nj(s)),s}function cj(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 lj(e,t){if(w(e,{valueFlags:BA}))return{stdout:YA(),stderr:``,exitCode:0};let n=aj(e);if(`error`in n)return VA(`models: ${n.error}`);let r=await import(`./account-store-
|
|
1717
|
+
`}function aj(e){let t=C(e,{bool:zA,value:BA});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 oj(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 sj(e,t,n,r,i,a){let o=e.getProviderModels(t).filter($A);if(o.length===0)return[];let s=o.map(e=>rj(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=nj(s)),s}function cj(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 lj(e,t){if(w(e,{valueFlags:BA}))return{stdout:YA(),stderr:``,exitCode:0};let n=aj(e);if(`error`in n)return VA(`models: ${n.error}`);let r=await import(`./account-store-BonG4PL9.js`).then(e=>e.t);if(r.getAccounts().length===0)return VA(`No provider accounts configured. Run the provider settings to add one.
|
|
1718
1718
|
`);let i=r.resolveCurrentModel(),a=i.id,o=i.provider,s=r.getSelectedProvider(),c=r.getSelectedModelId(),l;if(!n.noBenchmarks){let e=await KA(t,n.forceRefresh);e.length>0&&(l=e)}let u=oj(r,n,s);if(`error`in u)return VA(u.error);let d=[],f=[];for(let e of u){let t=sj(r,e,a,o,l,n.allVersions);if(t.length===0){if(!n.allMode)return VA(`No models available for provider ${e}.\n`);continue}if(d.push(...t),!n.jsonMode){let n=r.getProviderConfig(e);f.push(ij(n.name,e,t,!!l))}}return n.jsonMode?{stdout:JSON.stringify(d,null,2)+`
|
|
1719
1719
|
`,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
|
|
1720
1720
|
`),f.push(cj(o,a,s,c)),{stdout:f.join(`
|
|
@@ -1772,7 +1772,7 @@ Examples:
|
|
|
1772
1772
|
`)}\n`,stderr:``,exitCode:0}}async function Pj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
|
|
1773
1773
|
`,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 Fj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain remove: requires <providerId> and <domain>
|
|
1774
1774
|
`,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 Ij(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>
|
|
1775
|
-
`,exitCode:1}}async function Lj(e,t,n,r){switch(t){case`list`:return Nj(e,n);case`add`:return Pj(e,n,r);case`remove`:return Fj(e,n,r);case`clear`:return Ij(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${jj()}`,exitCode:1}}}function Rj(){return S(`oauth-domain`,async e=>{if(e.length===0||w(e))return{stdout:jj(),stderr:``,exitCode:0};let t=C(e);if(`error`in t)return Mj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-
|
|
1775
|
+
`,exitCode:1}}async function Lj(e,t,n,r){switch(t){case`list`:return Nj(e,n);case`add`:return Pj(e,n,r);case`remove`:return Fj(e,n,r);case`clear`:return Ij(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${jj()}`,exitCode:1}}}function Rj(){return S(`oauth-domain`,async e=>{if(e.length===0||w(e))return{stdout:jj(),stderr:``,exitCode:0};let t=C(e);if(`error`in t)return Mj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-BonG4PL9.js`).then(e=>e.t);try{return await Lj(a,n,r,i)}catch(e){return Mj(e instanceof Error?e.message:String(e))}})}function zj(){return S(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-BMFPkQSc.js`);return n(e,t)})}const Bj=[`--download`,`-d`,`--view`,`-v`],Vj=[`--size`],Hj={low:256,medium:768,high:1536};function Uj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
|
|
1776
1776
|
|
|
1777
1777
|
VFS paths are served in a new browser tab via the preview service worker.
|
|
1778
1778
|
URLs (http/https/etc.) are opened directly in a new tab.
|
|
@@ -1798,7 +1798,7 @@ Examples:
|
|
|
1798
1798
|
`);let i=!1;try{i=(await t.fs.stat(e)).isDirectory}catch{}let a=await ar(t.fs,i?e:pr(e)),o=Fr(e,a),s;try{s=await r(o)}catch(e){return K(`${e instanceof Error?e.message:String(e)}\n`)}return Qj(`opened ${e} → ${o}${$j(s)}`)}async function oM(e,t,n,r){if(!sr(e)&&e.endsWith(`.shtml`)&&t.fs)return tM(e,t,r.sprinkleManager,r.canOpenWindow,r.openExternal);if(!n.view&&!r.canOpenWindow)return K(`open: browser APIs are unavailable in this environment
|
|
1799
1799
|
`);if(sr(e))return nM(e,r.canOpenWindow,r.openExternal);let i=t.fs.resolvePath(t.cwd,e);return n.view?rM(e,i,t,n.sizeSpec):n.download?iM(e,i,t,r.hasDom):aM(i,t,r.canOpenWindow,r.openExternal)}function sM(e){return S(`open`,async(t,n)=>{if(t.length===0||w(t,{valueFlags:Vj}))return Uj();let r=Zj(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 Uj();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:eM(e,l,u)},f=[];for(let e of s){let t=await oM(e,n,{view:a,download:i,sizeSpec:o},d);if(!t.ok)return t.result;f.push(t.message)}return{stdout:f.join(`
|
|
1800
1800
|
`)+`
|
|
1801
|
-
`,stderr:``,exitCode:0}})}function cM(){return S(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-
|
|
1801
|
+
`,stderr:``,exitCode:0}})}function cM(){return S(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-Bkv4relh.js`);return n(e,t)})}function lM(e=`pdftk`){return S(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-BEs473Sp.js`);return r(e,t,n)})}function uM(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
|
|
1802
1802
|
|
|
1803
1803
|
Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
|
|
1804
1804
|
is zero-padded to the digit width of the last page (out-1.png for a 9-page
|
|
@@ -1858,7 +1858,7 @@ Examples:
|
|
|
1858
1858
|
plugin list
|
|
1859
1859
|
plugin info my-plugin
|
|
1860
1860
|
plugin remove my-plugin
|
|
1861
|
-
`}function DM(e={}){return S(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return wM(EM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await PM(i,a,e);case`list`:case`ls`:return await RM(i,e);case`info`:return await zM(i,e);case`validate`:return await BM(i,a,e,qi(n?.env));case`remove`:case`rm`:case`delete`:return await VM(i,e);default:return q(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return q(`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-
|
|
1861
|
+
`}function DM(e={}){return S(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return wM(EM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await PM(i,a,e);case`list`:case`ls`:return await RM(i,e);case`info`:return await zM(i,e);case`validate`:return await BM(i,a,e,qi(n?.env));case`remove`:case`rm`:case`delete`:return await VM(i,e);default:return q(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return q(`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-B7SM0TGT.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 kM(e,t,n){let r=HM(t,e);if(await n.exists(r))return{kind:`local`,root:r};let{parseGitHubRef:i}=await import(`./github-install-6SNwPAr4.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 AM(e){let t=e.replace(/[^A-Za-z0-9._-]+/g,`-`);return/^\.+$/.test(t)?t.replace(/\./g,`_`):t}function jM(e){let t=[e.owner,e.repo,...e.path?[e.path]:[]];return`${CM}/${t.map(AM).join(`--`)}`}async function MM(e,t,n,r){let{fetchRepoZip:i,stripZipPrefix:a,writeZipFilesToDir:o}=await import(`./github-zip-DXxPmRaa.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 NM(e,t){try{await e.rm(t,{recursive:!0})}catch{}}async function PM(e,t,n){if(w(e))return wM(`usage: plugin install <path|repo>
|
|
1862
1862
|
|
|
1863
1863
|
Loads the Agent Plugins package at <path>, or downloads it from a GitHub
|
|
1864
1864
|
reference (owner/repo, owner/repo@branch, or
|
|
@@ -1869,19 +1869,19 @@ mcp.json. On success the plugin is recorded in
|
|
|
1869
1869
|
/workspace/.plugins/plugins.json — its skills then surface through the
|
|
1870
1870
|
standard skills discovery, and each supported streamable-http MCP server
|
|
1871
1871
|
is registered in the MCP store as "<plugin>:<server>".
|
|
1872
|
-
`);let r=TM(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return q(`plugin install: expected <path|repo>`);let i=await OM(n),a=await kM(r.positionals[0],t,i);if(a.kind===`error`)return q(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return q(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=jM(a.ref),s=a.ref.display;let e=await MM(a.ref,o,i,n.fetch);if(e)return q(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-Dw-TPPKt.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await NM(i,o),q(`plugin install: plugin at ${s??o} was rejected:\n${UM(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-
|
|
1872
|
+
`);let r=TM(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return q(`plugin install: expected <path|repo>`);let i=await OM(n),a=await kM(r.positionals[0],t,i);if(a.kind===`error`)return q(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return q(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=jM(a.ref),s=a.ref.display;let e=await MM(a.ref,o,i,n.fetch);if(e)return q(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-Dw-TPPKt.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await NM(i,o),q(`plugin install: plugin at ${s??o} was rejected:\n${UM(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-uxQy1IMe.js`),m=await f(d,n.fs);if(m&&m.root!==o)return a.kind===`github`&&await NM(i,o),q(`plugin install: a plugin named "${d}" is already installed from ${m.root} (remove it first)`);let h=await LM(u,n),g=await IM(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),wM(FM(u,h,g,s??o,l.diagnostics))}function FM(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:`,UM(i)),c.join(`
|
|
1873
1873
|
`)+`
|
|
1874
|
-
`}async function IM(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-
|
|
1875
|
-
`);let n=TM(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-
|
|
1874
|
+
`}async function IM(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-D3vhlDka.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 LM(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-D3vhlDka.js`).then(e=>e.r),{McpClient:a}=await import(`./client-CwxmlQM-.js`).then(e=>e.n),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 RM(e,t){if(w(e))return wM(`usage: plugin list
|
|
1875
|
+
`);let n=TM(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-uxQy1IMe.js`),i=await r(t.fs),a=Object.keys(i).sort();if(a.length===0)return wM("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 wM(o.map(e=>e.map((e,t)=>e.padEnd(s[t])).join(` `)).join(`
|
|
1876
1876
|
`)+`
|
|
1877
1877
|
`)}async function zM(e,t){if(w(e))return wM(`usage: plugin info <name>
|
|
1878
|
-
`);let n=TM(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return q(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-
|
|
1878
|
+
`);let n=TM(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return q(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-uxQy1IMe.js`),a=await i(r,t.fs);if(!a)return q(`plugin info: no installed plugin named "${r}"`);let o=await OM(t),{loadPluginFromDirectory:s}=await import(`./loader-Dw-TPPKt.js`),c=await s(o,a.root);if(!c.ok)return q(`plugin info: plugin at ${a.root} no longer loads:\n${UM(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:`,UM(c.diagnostics)),wM(d.join(`
|
|
1879
1879
|
`)+`
|
|
1880
1880
|
`)}async function BM(e,t,n,r){if(w(e))return wM(`usage: plugin validate <path|repo>
|
|
1881
1881
|
`);let i=TM(`validate`,e);if(!(`ok`in i))return i;if(i.positionals.length<1)return q(`plugin validate: expected <path|repo>`);let a=await OM(n),o=await kM(i.positionals[0],t,a);if(o.kind===`error`)return q(`plugin validate: ${o.message}`);let s,c=null;if(o.kind===`github`){if(!n.fetch)return q(`plugin validate: GitHub sources are unavailable (no network fetch configured)`);c=`${r}/.plugin-validate/${jM(o.ref).split(`/`).pop()}`;let e=await MM(o.ref,c,a,n.fetch);if(e)return q(`plugin validate: ${e}`);s=c}else s=o.root;let{loadPluginFromDirectory:l}=await import(`./loader-Dw-TPPKt.js`),u;try{u=await l(a,s)}finally{c&&await NM(a,c)}if(!u.ok)return{stdout:``,stderr:`plugin validate: REJECTED\n${UM(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:`,UM(u.diagnostics)),wM(p.join(`
|
|
1882
1882
|
`)+`
|
|
1883
1883
|
`)}async function VM(e,t){if(w(e))return wM(`usage: plugin remove <name>
|
|
1884
|
-
`);let n=TM(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return q(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-
|
|
1884
|
+
`);let n=TM(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return q(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-uxQy1IMe.js`),o=await i(r,t.fs);if(!o)return q(`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-D3vhlDka.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(`${CM}/`);return c&&await NM(await OM(t),o.root),wM([`Removed agent plugin "${r}"`,` registry: removed`,` mcp servers: ${s} removed`,c?` files: removed (${o.root})`:` files: left in place (${o.root})`].join(`
|
|
1885
1885
|
`)+`
|
|
1886
1886
|
`)}function HM(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 UM(e){return e.map(e=>` ${e.level===`error`?`error`:`warn `} [${e.component}] ${e.message}`).join(`
|
|
1887
1887
|
`)}const WM=[`pid`,`ppid`,`kind`,`stat`,`start`,`scoop`,`command`],GM=[`pid`,`ppid`,`stat`,`start`,`scoop`,`command`],KM={running:`R`,pending:`S`,exited:`Z`,killed:`K`},qM=[`-a`,`-A`,`-e`,`--all`,`-T`,`--tree`],JM=[`-o`,`--columns`];function YM(e={}){return S(`ps`,async t=>{if(w(t,{valueFlags:JM}))return lN();let n=e.processManager??XM();if(!n)return{stdout:``,stderr:`ps: no process manager available in this runtime
|
|
@@ -2088,7 +2088,7 @@ Limits and lifetime:
|
|
|
2088
2088
|
`,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
|
|
2089
2089
|
`,exitCode:1}}async function SF(e,t,n){if(e.ttlMs!==void 0){if(!t)throw Error(`persistent snapshot filesystem unavailable`);return mF(t,n)}}async function CF(e,t,n,r){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return QP();let i=iF(e);if(i.error)return{stdout:``,stderr:i.error,exitCode:1};let a=await bF(i);if(a)return a;if(!i.directory)return QP();let o=xF(i);if(o)return o;let s=await aF(i.directory,i.entry,t.fs,t.cwd);if(oF(s))return s;let{fullDirectory:c,entryPath:l}=s,u;try{u=await SF(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)
|
|
2090
2090
|
`:``,f=await vF(!i.noBridge&&i.bridge,d);return f.ok?yF(i,c,l,f.webhookId,d,u,n):f.result}function wF(e,t){return S(`serve`,(n,r)=>CF(n,r,e,t))}const TF=`usage: session export [--id <id>] [--output <path>]
|
|
2091
|
-
`;function EF(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 DF(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${TF}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${TF}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${TF}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${TF}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${TF}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${TF}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function OF(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||Dt(r)!==a.sha256)throw new ka(`transfer-corrupt`);return r}async function kF(e,t){let n=DF(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=EF(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${TF}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await hs().export(a,{}),n=await OF(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 ka?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function AF(){return S(`session`,async(e,t)=>{if(e[0]===`export`&&!w(e))return kF(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-
|
|
2091
|
+
`;function EF(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 DF(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${TF}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${TF}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${TF}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${TF}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${TF}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${TF}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function OF(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||Dt(r)!==a.sha256)throw new ka(`transfer-corrupt`);return r}async function kF(e,t){let n=DF(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=EF(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${TF}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await hs().export(a,{}),n=await OF(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 ka?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function AF(){return S(`session`,async(e,t)=>{if(e[0]===`export`&&!w(e))return kF(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-BnEwnFRh.js`);return n(e,t,TF)})}function jF(){return S(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-cvQKad0O.js`);return await n(e,t)})}const MF=`leader`;function NF(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function PF(e){return+!!e.leader+e.followers.length}function FF(){return{stdout:`usage: sprinkle <subcommand> [args]
|
|
2092
2092
|
|
|
2093
2093
|
list [--runtime <id>] List sprinkles + an instance line per runtime
|
|
2094
2094
|
open <name> Open a sprinkle by name
|
|
@@ -3238,7 +3238,7 @@ or pass -bios / -vgabios with explicit VFS paths.`,hz={"-n":gz,"-name":gz,"--nam
|
|
|
3238
3238
|
`)}\n`)}function Lz(e,t){return`prefer: computer ${e} -c ${t}\n`}async function Rz(e,t,n,r){let i=Sz(t);if(Cz(i))return i;let[{runComputer:a},{getComputerRegistry:o,installComputerRegistry:s},c]=await Promise.all([import(`./run-DVX00_wa.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),zz(await a([`-c`,l,...n],e,{registry:u}),r,l)}function zz(e,t,n){let r=Lz(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 Bz(e,t){let{name:n,rest:r}=xz(e);if(r.length===0){let e=Sz(n);return Cz(e)?e:Q(`type: no text supplied`)}return Rz(t,n,[`type`,`--`,...r],`type`)}async function Vz(e,t){let{name:n,rest:r}=xz(e);if(r.length===0){let e=Sz(n);return Cz(e)?e:Q(`key: no chord supplied`)}return Rz(t,n,[`key`,...r],`key`)}const Hz=[`left`,`middle`,`right`];async function Uz(e,t){let{name:n,rest:r}=xz(e),i=Sz(n);if(Cz(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?Rz(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>`):Rz(t,n,[`--native`,`mousemove`,e,i,`--relative`],`mousemove`)}if(o===`click`){let e=r[1]??`left`;if(!Hz.includes(e))return Q(`mouse: unknown button '${r[1]}'`);let i=[`click`,e];return r.includes(`--double`)&&i.push(`--repeat`,`2`),Rz(t,n,i,`click`)}return Q(`mouse: expected move <dx> <dy>, click [button], or --to <x>,<y>`)}async function Wz(e,t){let{name:n,rest:r}=xz(e);return Rz(t,n,[`screenshot`,...r],`screenshot`)}async function Gz(e,t){let{name:n}=xz(e);return Rz(t,n,[`text`],`text`)}function Kz(e){let{name:t}=xz(e);return $(`v86 serve is retired.\nUse: computer watch -c v86:${t}\nLive frames go to the overlay, lightbox, and bash rows.\n`)}function qz(e){let{name:t,rest:n}=xz(e),r=Sz(t);if(Cz(r))return r;let i=n.indexOf(`--send`);if(i!==-1){let e=n.slice(i+1).join(` `).replace(/\\n/gu,`
|
|
3239
3239
|
`);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(`
|
|
3240
3240
|
`).slice(-Math.max(1,e)).join(`
|
|
3241
|
-
`)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function Jz(e,t){let{name:n,rest:r}=xz(e),i=Sz(n);if(Cz(i))return i;let[a,o]=r;if(a!==`save`&&a!==`load`||!o)return Q(`state: expected save|load <file>`);let s=t.fs.resolvePath(t.cwd,o);if(a===`save`){let e=await i.emulator.save_state();return await t.fs.writeFile(s,new Uint8Array(e)),$(`${s} (${e.byteLength} bytes)\n`)}if(!await t.fs.exists(s))return Q(`state: no such file: ${o}`);let c=await t.fs.readFileBuffer(s),l=new ArrayBuffer(c.byteLength);return new Uint8Array(l).set(c),await i.emulator.restore_state(l),$()}async function Yz(e,t){let{name:n,rest:r}=xz(e),i=Sz(n);if(Cz(i))return i;let a=t.processManager??Ez();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await Fz(i,a),$(`VM '${n}' stopped\n`))}function Xz(e={}){return S(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-
|
|
3241
|
+
`)}\n`)}return $(r.serial.buffer?`${r.serial.buffer}\n`:``)}async function Jz(e,t){let{name:n,rest:r}=xz(e),i=Sz(n);if(Cz(i))return i;let[a,o]=r;if(a!==`save`&&a!==`load`||!o)return Q(`state: expected save|load <file>`);let s=t.fs.resolvePath(t.cwd,o);if(a===`save`){let e=await i.emulator.save_state();return await t.fs.writeFile(s,new Uint8Array(e)),$(`${s} (${e.byteLength} bytes)\n`)}if(!await t.fs.exists(s))return Q(`state: no such file: ${o}`);let c=await t.fs.readFileBuffer(s),l=new ArrayBuffer(c.byteLength);return new Uint8Array(l).set(c),await i.emulator.restore_state(l),$()}async function Yz(e,t){let{name:n,rest:r}=xz(e),i=Sz(n);if(Cz(i))return i;let a=t.processManager??Ez();return r.includes(`--force`)&&a&&i.pid!==null?(a.signal(i.pid,`SIGKILL`),$(`VM '${n}' killed\n`)):(await Fz(i,a),$(`VM '${n}' stopped\n`))}function Xz(e={}){return S(`wasm`,async(t,n)=>{let{runWasmCommand:r}=await import(`./run-D_1DaJXR.js`);return r(t,n,e.buildProcessConfig?.(n.env))})}const Zz=[`--name`,`--filter`,`--scoop`],Qz={state:`inactive`,session:null};function $z(){return{stdout:`usage: webhook <command> [options]
|
|
3242
3242
|
|
|
3243
3243
|
Commands:
|
|
3244
3244
|
create [--scoop <name>] [--name <name>] [--filter <code>] Create a new webhook endpoint
|
|
@@ -3495,4 +3495,4 @@ pass --wait to block and print the full result.`,vV=new Set([`list`,`status`,`st
|
|
|
3495
3495
|
`,stderr:``,exitCode:0}}function QV(){return S(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return ZV();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
|
|
3496
3496
|
`,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(/^\.\//,``))||lr(r);if(i.isDirectory&&!n)return{stdout:``,stderr:`zip: ${e} is a directory (use -r)\n`,exitCode:1};s+=await XV(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
|
|
3497
3497
|
`,exitCode:1};let c=kt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function $V(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function eH(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[lO(`ipk`,r),lO(`npm`,r),lO(`i`,r),QO(`ipx`,{fs:t,fetch:n}),QO(`npx`,{fs:t,fetch:n}),ab(`di`,{fs:t,fetch:n}),ab(`uv`,{fs:t,fetch:n}),TR({fs:t,fetch:n})]}function tH(e={}){let t=[hE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),ne(),fI(),jF(),wF(e.browserAPI,e.fs),sM(e.browserAPI),by(e.browserAPI),bD(e),QV(),tR(),qI(e.fs?{fs:e.fs}:{}),yI(),EI(),CI(),hv(),Xz({buildProcessConfig:e.buildProcessConfig}),YV(),oI(`sqlite3`),oI(`sqllite`),uL(),AL(),xx(),Z_(),wj({buildProcessConfig:e.buildProcessConfig}),wj({buildProcessConfig:e.buildProcessConfig},`jsh`),CN(`python3`,{buildProcessConfig:e.buildProcessConfig}),CN(`python`,{buildProcessConfig:e.buildProcessConfig}),...eH(e),...e.fs?[zS({fs:e.fs})]:[],...e.fs?[IA({fs:e.fs})]:[],...e.fetch?[EE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],mS(),hS(),DS(),dB(e.webhook),XB(),yy(e.crontask),Wk({fs:e.fs,scriptCatalog:e.scriptCatalog}),DM({fs:e.fs,fetch:e.fetch}),RS(),ZF(),cM(),lM(`pdftk`),lM(`pdf`),Q_(`biscotto`),Q_(`biscotti`),yM(`pdftoppm`),yM(`pdftocairo`),bM(`pdftotext`),ry(`convert`),ry(`magick`),oV({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),PL(),XL(),gD(),_D(),ZL(),LA(),DN(),Rk(),Kb(),zj(),Rj(),Fk(),YP($V(e)),BN({fs:e.fs}),pP(),fv(),pv(),mv(`xclip`),mv(`xsel`),fP(),rC(),Cg(),wg(),uj(e.fs),st(),kj(),Wg({getParentJid:e.getParentJid}),ex(),YM({processManager:e.processManager}),BR({processManager:e.processManager}),tk({processManager:e.processManager}),$O({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...qg(),FA(),Dk(),dz(),QE(),nS(),Dz({processManager:e.processManager}),vv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),pS(),av({registry:e.cherryRuntimeRegistry}),ky(),Fy({fs:e.fs}),Iy({fs:e.fs}),mI(e.sudoCommand),CV({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),ZB(),AF()];return e.fs&&(SM(),t.push(...zn.map(t=>fE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let nH=null;function rH(e){nH=e}function iH(e){nH?.(e)}var aH=Nt();const oH=Reflect.get(tt,`DefenseInDepthBox`);function sH(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function cH(e,t){if(typeof e!=`string`)return e;let n=sH(t);if(n===`binary`||n===`latin1`){let t=ge(e);if(t)return t}return aH.Buffer.from(e,n)}function lH(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}var uH=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=Be(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=lH(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=oH?.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=sH(t),o=aH.Buffer.from(i.buffer,i.byteOffset,i.byteLength).toString(a);return a!==`hex`&&a!==`base64`&&g(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 aH.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,cH(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(b(e),cH(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(lH(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(lH(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 Ve(`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 dH(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?dH(e.getUnderlyingFS?.()):null}async function fH(e){let t=he(`github`);if(t){if(e?.force){await t.onSilentRenew?.();return}await t.getValidAccessToken?.()}}const pH=e(`almost-bash-shell`),mH=`__SLICC_RUN_PID`,hH=`__SLICC_OUTPUT_TEE__`;function gH(e){let t=e?.get(mH);if(t===void 0)return;let n=Number.parseInt(t,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function _H(e){if(!(mH in e)&&!(hH in e)&&!(`__SLICC_SUDO_REASON`in e)&&!(`__SLICC_PIPESTATUS`in e)&&!(`__SLICC_PIPESTATUS_EX`in e))return{...e};let{[mH]:t,[hH]:n,[om]:r,[up]:i,[dp]:a,...o}=e;return o}function vH(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 yH=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(gH(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:op,PATH:Qn,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return tH({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,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]}})}constructor(t){this.options=t,this.vfsAdapter=new uH(t.fs),this.progress=new Sp({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t);let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new rp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:fH}),this.mountCommands=new As({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:pm});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=dH(i)??dH(a);this.scriptCatalog=t.scriptCatalog??new pi({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||Xn(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=p({progress:Dp(this.progress)}),l=h({progress:Dp(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),sh(t.fs),ig(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...rt(),...nt()],m=this.allowedCommands?f.filter(e=>this.isCommandAllowed(e)):void 0;if(this.bash=new it({fs:this.vfsAdapter,cwd:n,env:{},fetch:c,commands:m,customCommands:d,sleep:Jp(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:ap(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(xm),this.allowedCommands!==null){let e=this.bash;for(let t of nt())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 g=d.map(e=>e.name),_=m??[...rt(),...nt()];this.builtinCommandNames=new Set([..._,...g]),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 qr(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 $n(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 sp(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=cp(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){pH.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){iH(e.trim().split(/\s+/)[0]||`unknown`),m(),await this.waitForInitialJshSync(t);let o=cm(e),s={env:{...this.lastEnv,...n===void 0?{}:{[mH]:String(n)},...i===void 0?{}:{[hH]:i},...o?{[om]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=vH([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(gp(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.flushPendingCommandGrants(),d=_p(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=_H(d.env)),d.env&&this.lastEnv.PATH!==c&&await this.syncJshCommands().catch(()=>void 0),this.pendingEnvWrites.size>0){for(let[e,t]of this.pendingEnvWrites)t===null?delete this.lastEnv[e]:this.lastEnv[e]=t;this.pendingEnvWrites.clear()}if(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 vp(await e(d,this.cwd,this.vfsAdapter),d.pipeStatus)}return d}isTransparentGatingEnabled(){let e=this.options.sudo;return!!e&&e.transparentGating!==!1}wrapCommandForDispatch(e){let t=this.wrapCommandForSudo(e),n=e.name===`timeout`?Qp(t,this.progress):em(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(hH),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await n.execute(e,t);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(hH);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=Up(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Gp(t,this.progress,Wp(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())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(om))||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=lt(e);if(!n)return;let r=`${dt}/granted`,i=this.options.fs,a=``;try{await i.exists(r)&&(a=await i.readFile(r))}catch(e){if(!(e instanceof Ve&&e.code===`ENOENT`))throw e}let o=a&&!a.endsWith(`
|
|
3498
|
-
`)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(e)}async doSyncJshCommands(){try{let e=await this.scriptCatalog.getJshIndex(this.currentScanRoots()),t=e.commands;for(let t of e.collisions)pH.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 Xr(t,[`node`,o,...e],{fs:i.fs,cwd:i.cwd,env:i.env,stdin:i.stdin,exec:a},this.buildJshProcessConfig(gH(i.env)))}let s=(await t.getWasmCommands()).get(r);if(s){let{runWasmCommand:t}=await import(`./run-
|
|
3498
|
+
`)?`${a}\n`:a;await i.writeFile(r,`${o}NOPASSWD Cmnd ${n}\n`)}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(e)}async doSyncJshCommands(){try{let e=await this.scriptCatalog.getJshIndex(this.currentScanRoots()),t=e.commands;for(let t of e.collisions)pH.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 Xr(t,[`node`,o,...e],{fs:i.fs,cwd:i.cwd,env:i.env,stdin:i.stdin,exec:a},this.buildJshProcessConfig(gH(i.env)))}let s=(await t.getWasmCommands()).get(r);if(s){let{runWasmCommand:t}=await import(`./run-D_1DaJXR.js`);return t([`--argv0`,s.argv0,`--module`,s.wasm,s.glue,...e],i,this.buildJshProcessConfig(gH(i.env)))}let c=(await t.getWorkflowCommands()).get(r);if(c){let t=fi(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?lp(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 Xr(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{ya as C,Oo as S,Uo as _,pV as a,ka as b,xp as c,xs as d,ms as f,Wo as g,cs as h,lV as i,op as l,us as m,uH as n,sV as o,ds as p,rH as r,am as s,yH as t,Ss as u,Po as v,Oa as x,Ta as y};
|