sliccy 6.257.0 → 6.257.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +211 -211
- package/dist/ui/assets/{account-store-6UOIlkM4.js → account-store-BbkpyoOX.js} +1 -1
- package/dist/ui/assets/{account-store-C4gx7UUe.js → account-store-o3b0Y1Kn.js} +1 -1
- package/dist/ui/assets/{adobe-BtmFAfZG.js → adobe-BqIUe-4m.js} +1 -1
- package/dist/ui/assets/{adobe-tCDI30Ns.js → adobe-DpBbOIOu.js} +1 -1
- package/dist/ui/assets/{agent-panels-DAHrZ0Oc.js → agent-panels-Bhs5O-E-.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-Bzqlalms.js → almost-bash-shell-headless-CieQT6v2.js} +24 -24
- package/dist/ui/assets/{apply-layout-C2wRpdXx.js → apply-layout-qIhZmHKs.js} +1 -1
- package/dist/ui/assets/{apps-CZlx2STM.js → apps-voMnw1vM.js} +1 -1
- package/dist/ui/assets/{azure-openai-CWm_MSzw.js → azure-openai-DcsmSgJk.js} +1 -1
- package/dist/ui/assets/{azure-openai-Qdc0MSxz.js → azure-openai-jJNALQjN.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-BjlbvdxL.js → backend-hostfs-BlDEr_yS.js} +1 -1
- package/dist/ui/assets/{cdp-BXuDG-Ym.js → cdp-D4kjv1uA.js} +3 -3
- package/dist/ui/assets/{cerebras-Diao1Fcc.js → cerebras-Beug6T3f.js} +1 -1
- package/dist/ui/assets/{cerebras-B5h3CN40.js → cerebras-CJdvo-FR.js} +1 -1
- package/dist/ui/assets/{composer-speech-CL6skQbl.js → composer-speech-B1xwE65G.js} +1 -1
- package/dist/ui/assets/{connect-surface-CulHapaP.js → connect-surface-Bt4Uj0qx.js} +1 -1
- package/dist/ui/assets/{directed-approval-Slbfl263.js → directed-approval-Cilu6dgm.js} +1 -1
- package/dist/ui/assets/dist-BvKO2yY6.js +10 -0
- package/dist/ui/assets/dist-D3VDHIWw.js +5 -0
- package/dist/ui/assets/dist-ZeIXOpjd.js +18 -0
- package/dist/ui/assets/{emscripten-vfs-hook-Dzx87kgK.js → emscripten-vfs-hook-DCVVKM8B.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-CB_8VcMe.js → ensure-speech-assets-Cn7xGB98.js} +1 -1
- package/dist/ui/assets/{exporter-deps-CVRYqOJh.js → exporter-deps-BVXLDsFh.js} +2 -2
- package/dist/ui/assets/{frozen-archive-writer-BEQ-Omkf.js → frozen-archive-writer-CWKKrxgR.js} +1 -1
- package/dist/ui/assets/{frozen-session-delete-1Tk1CkLr.js → frozen-session-delete-CCmkTwe_.js} +1 -1
- package/dist/ui/assets/{frozen-session-identity-CoMv-RCx.js → frozen-session-identity-WhaNySgu.js} +1 -1
- package/dist/ui/assets/{fs-DfsZb_HM.js → fs-Bvtxo-ZQ.js} +2 -2
- package/dist/ui/assets/{fs-1AHAbMnY.js → fs-CM_0hH6U.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-D3x8PSDp.js → gelatiere-unit-Bc4Kcg0o.js} +1 -1
- package/dist/ui/assets/{git-config-COJzI6rm.js → git-config-BymaKKeY.js} +1 -1
- package/dist/ui/assets/{git-config-pO4_foJv.js → git-config-XfiNQ3bE.js} +1 -1
- package/dist/ui/assets/{github-DHxBN93a.js → github-CFEES9lB.js} +1 -1
- package/dist/ui/assets/{github-auth-DVMadrYX.js → github-auth-pGXINjeA.js} +1 -1
- package/dist/ui/assets/{github-copilot-BweEK73w.js → github-copilot-Bzl3Hn-8.js} +1 -1
- package/dist/ui/assets/{github-copilot-BQks9eaU.js → github-copilot-mIP5fmLo.js} +1 -1
- package/dist/ui/assets/{github-install-j_0TAu54.js → github-install-BSqwBQIl.js} +1 -1
- package/dist/ui/assets/{github-r9350QXz.js → github-qW-wcdT8.js} +2 -2
- package/dist/ui/assets/{github-zip-CZU7aCjk.js → github-zip-Dq6nNNvn.js} +1 -1
- package/dist/ui/assets/{hear-CVDoskp0.js → hear-_vj9ROD2.js} +1 -1
- package/dist/ui/assets/{help-Ch0qFgOj.js → help-dVqxBQgR.js} +1 -1
- package/dist/ui/assets/{hidden-page-input-CichxAVN.js → hidden-page-input-AWOd3xVz.js} +1 -1
- package/dist/ui/assets/{hidden-page-input-Df9tj2lA.js → hidden-page-input-FlT66ODj.js} +1 -1
- package/dist/ui/assets/{installer-D5P6tw-z.js → installer-BT1UlNuS.js} +1 -1
- package/dist/ui/assets/{ipk-mamba-D5dhEFKv.js → ipk-mamba-DSygFTTQ.js} +1 -1
- package/dist/ui/assets/{isomorphic-git-g3FQf8MI.js → isomorphic-git-BGSxqVda.js} +2 -2
- package/dist/ui/assets/{isomorphic-git-CNj2MdIg.js → isomorphic-git-DgW1dEnL.js} +2 -2
- package/dist/ui/assets/{js-realm-worker-Bv_RovIw.js → js-realm-worker-CaFFrMQi.js} +2 -2
- package/dist/ui/assets/{jsh-executor-D6xT_O9d.js → jsh-executor-EkakjVGa.js} +3 -3
- package/dist/ui/assets/{kernel-worker-CnoOLifm.js → kernel-worker-YV_DbHm3.js} +10 -10
- package/dist/ui/assets/{lick-ws-bridge-TGTquS7b.js → lick-ws-bridge-B9r_aNwS.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-BNWGlBAO.js → lick-ws-bridge-CFO8VQfY.js} +1 -1
- package/dist/ui/assets/{live-session-curation-Dnnr_vEh.js → live-session-curation-CXw_iOd3.js} +1 -1
- package/dist/ui/assets/{live-session-curation--blnPT21.js → live-session-curation-WUNj6ib9.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-Dpm0mhTO.js → live-session-snapshot-C5gyz7MZ.js} +1 -1
- package/dist/ui/assets/{local-llm-Cm59jmnA.js → local-llm-BqsvOs0z.js} +1 -1
- package/dist/ui/assets/{local-llm-Dps76P-l.js → local-llm-ChvYBw5c.js} +1 -1
- package/dist/ui/assets/{main-BRZWQ_fF.js → main-3uBK8_NB.js} +3 -3
- package/dist/ui/assets/{main-cherry-COllkm4b.js → main-cherry-B3f928P_.js} +1 -1
- package/dist/ui/assets/{mcp-command-lgVSWa8u.js → mcp-command-jsLeQFYW.js} +13 -13
- package/dist/ui/assets/{memory-curation-seam-DMVxYWGK.js → memory-curation-seam-Bt6fiKH1.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-QCqhLyNQ.js → memory-write-execute-FqeYXxMU.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-J1MLOf5H.js → merge-folded-cost-into-frozen-DOWUAnzX.js} +1 -1
- package/dist/ui/assets/{mount-Bo_3ce8E.js → mount-BdLR2cP4.js} +1 -1
- package/dist/ui/assets/{mv-DeUDSLZ6.js → mv-In9d6DMc.js} +1 -1
- package/dist/ui/assets/{new-session-BGDPlLqR.js → new-session-BnOmctM5.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-DTPtxKG5.js → oauth-bootstrap-BAgx9nmV.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-CgYOzTE7.js → onboarding-orchestrator-DnZKOCD5.js} +1 -1
- package/dist/ui/assets/{openai-codex-OIa1XO4u.js → openai-codex-BwyxazHQ.js} +1 -1
- package/dist/ui/assets/{openai-codex-C7wc9yhC.js → openai-codex-DJEYQVof.js} +1 -1
- package/dist/ui/assets/{openrouter-DPurFsSI.js → openrouter-BFrsqOOT.js} +1 -1
- package/dist/ui/assets/{openrouter-DbKDdmfb.js → openrouter-C_JvrQjm.js} +1 -1
- package/dist/ui/assets/{openrouter-free-Du1Gx5Mm.js → openrouter-free-CS70sKzu.js} +1 -1
- package/dist/ui/assets/{openrouter-free-BAhwm4hj.js → openrouter-free-rYzBsjIv.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-39EQMdtw.js → openrouter-oauth-CgKlrt8h.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CerMvwxd.js → openrouter-oauth-DNH0enuU.js} +1 -1
- package/dist/ui/assets/{opfs-mount-kHY-uPXf.js → opfs-mount-CR6uYda_.js} +1 -1
- package/dist/ui/assets/{opfs-mount-Bcn94wGJ.js → opfs-mount-Ca2tOqM-.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-DgZWLPZj.js → panel-rpc-handlers-B4vswgaB.js} +2 -2
- package/dist/ui/assets/{panelize-shell-B1BH1x6c.js → panelize-shell-Co9kA_e3.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-BUAMySRK.js → pi-edit-execution-DOTe0O4P.js} +1 -1
- package/dist/ui/assets/{profile-export-deps-CvQ5x2pT.js → profile-export-deps-Cv_WLSYu.js} +2 -2
- package/dist/ui/assets/{provider-CsRhfqCH.js → provider-BR2SJL70.js} +1 -1
- package/dist/ui/assets/{provider-D0mZ1UpC.js → provider-DVm2tZKQ.js} +2 -2
- package/dist/ui/assets/{provider-settings-Bq_EDnNG.js → provider-settings-BA_aC2Yw.js} +1 -1
- package/dist/ui/assets/provider-store-access-BF3rg7qp.js +1 -0
- package/dist/ui/assets/provider-store-access-BL8eKC85.js +1 -0
- package/dist/ui/assets/{providers-Dpe0MZEV.js → providers-5HxsN_Aj.js} +1 -1
- package/dist/ui/assets/{providers-3aPqBGD0.js → providers-Cn6KXqsg.js} +2 -2
- package/dist/ui/assets/{quick-llm-BYOqRtmH.js → quick-llm-DTwYnIUm.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-BXy1TifZ.js → realm-inprocess-N-5y8c_W.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-ByOyvm9y.js → realm-unhandled-rejections-BDz1pljv.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-NU2yO31S.js → realm-unhandled-rejections-BEKFOO9t.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-BnLk-1uW.js → remote-terminal-view-CFJ3bfF9.js} +2 -2
- package/dist/ui/assets/{restore-6_Poo-Ki.js → restore-BFVMHWM9.js} +1 -1
- package/dist/ui/assets/{run-BenpLlp6.js → run-CzOjMNM6.js} +2 -2
- package/dist/ui/assets/{run-Dx7Jj39I.js → run-DDkVkRRP.js} +1 -1
- package/dist/ui/assets/{run-B6KJMfqx.js → run-DnuL9c9o.js} +2 -2
- package/dist/ui/assets/{run-B_Eos1Ew.js → run-RjWMiNYV.js} +1 -1
- package/dist/ui/assets/{serve-command-CT9kFWYk.js → serve-command-CKx3wl1m.js} +2 -2
- package/dist/ui/assets/{serve-runtime-eB3045Na.js → serve-runtime-CLD-wYmQ.js} +1 -1
- package/dist/ui/assets/{session-command-memory-bg1mRomM.js → session-command-memory-DZboUSNJ.js} +2 -2
- package/dist/ui/assets/{session-jsonl-26wHRz9v.js → session-jsonl-Dimn-mW7.js} +1 -1
- package/dist/ui/assets/{session-search-index-ByCaVKdZ.js → session-search-index-Bu_BcvsJ.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-Dy9npHoD.js → setup-feature-flags-remote-B8nSuBKH.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-CGOzWRDi.js → setup-model-catalog-CzGySiX7.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-C1pxHCVb.js → silent-renew-backoff-BvaMYhQa.js} +1 -1
- package/dist/ui/assets/{skills-CLxJZ6HV.js → skills-C-KIp5M-.js} +1 -1
- package/dist/ui/assets/slicc-version-CNzyogpa.js +1 -0
- package/dist/ui/assets/{snapshot-CPtJGttd.js → snapshot-B8OJhVC-.js} +1 -1
- package/dist/ui/assets/{snapshot-features-Cc3Xu_E0.js → snapshot-features-8gj7Uhyp.js} +1 -1
- package/dist/ui/assets/{soundscape-DSeMbu_D.js → soundscape-D8XnvYtv.js} +1 -1
- package/dist/ui/assets/{speak-Cdryj2b6.js → speak-BgcRQqiO.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-CvU_I05a.js → sprinkle-manager-DUC1sKWm.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-B_KG1a1_.js → sprinkle-renderer-b-f_8hYF.js} +1 -1
- package/dist/ui/assets/{state-BTfuf1EK.js → state-Bs0W-HnZ.js} +1 -1
- package/dist/ui/assets/{store-BJWc68Je.js → store-Bfzv4LAb.js} +1 -1
- package/dist/ui/assets/{store-JWzG3fec.js → store-Dxqyn_fZ.js} +1 -1
- package/dist/ui/assets/{sudo-CO7M7tYP.js → sudo-Dcb40VcS.js} +1 -1
- package/dist/ui/assets/{supervisor-BopQBX6h.js → supervisor-eDyU_hCx.js} +1 -1
- package/dist/ui/assets/{sync-dialog-DcXgyCmN.js → sync-dialog-clPnk1u8.js} +1 -1
- package/dist/ui/assets/{transformers-env-gKiN1Jre.js → transformers-env-B6_YxKyt.js} +1 -1
- package/dist/ui/assets/{tray-leader-B90wNu55.js → tray-leader-Cyu3dqVC.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-B-8JLEAw.js → tray-leave-runtime-vTQTf2TG.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-BZZzHJPR.js → tray-sidecar-gywYf7yq.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-C6cRmPTM.js → upgrade-detection-FwwXVkM1.js} +1 -1
- package/dist/ui/assets/{upgrade-to-seven-CHnBeV1O.js → upgrade-to-seven-DzX43jKF.js} +2 -2
- package/dist/ui/assets/{upskill-lick-skip-C4sGfE7_.js → upskill-lick-skip-DV_Ga_iG.js} +1 -1
- package/dist/ui/assets/{voice-reply-I3qWXg_3.js → voice-reply-FClHnLWv.js} +1 -1
- package/dist/ui/assets/wasm-inline-7sdG80Fn.js +1 -0
- package/dist/ui/assets/{wc-attach-lnHl2TY3.js → wc-attach-BYUeE_Pb.js} +2 -2
- package/dist/ui/assets/{wc-browser-tIH4cKDy.js → wc-browser-WKQFNhQ5.js} +1 -1
- package/dist/ui/assets/{wc-computers-Bexuo190.js → wc-computers-DZQQ76Uw.js} +1 -1
- package/dist/ui/assets/{wc-detached-BX-CXB7H.js → wc-detached-Dlu9OALi.js} +1 -1
- package/dist/ui/assets/{wc-extension-CQi9SOTF.js → wc-extension-BZsYPyXV.js} +2 -2
- package/dist/ui/assets/{wc-follower-DBxTXqyl.js → wc-follower-DghmOAng.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-DQyauHOY.js → wc-follower-oauth-C-xOZP7h.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-MsiylWkE.js → wc-gelatiere-5gemwSn9.js} +1 -1
- package/dist/ui/assets/{wc-live-Dxd5TC_R.js → wc-live-C-Q8UWOX.js} +5 -5
- package/dist/ui/assets/{wc-nav-Dkp3zU5D.js → wc-nav-BewO0jEc.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-StySFFor.js → wc-onboarding-CA-droNI.js} +2 -2
- package/dist/ui/assets/{wc-permissions-D_j1X34z.js → wc-permissions-BfyVgk33.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-Z0eB15Bp.js → wc-placeholder-C6f5gy0P.js} +2 -2
- package/dist/ui/assets/{wc-profile-export-C2d7MBiQ.js → wc-profile-export-2UbX3Xt_.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-NsldeZfZ.js → wc-secret-request-B33xyduO.js} +1 -1
- package/dist/ui/assets/{wc-settings-KPM24ols.js → wc-settings-BW1IaT0i.js} +3 -3
- package/dist/ui/assets/{wc-shell-P8Zs2xgN.js → wc-shell-DimysD1f.js} +10 -5
- package/dist/ui/assets/{wc-shortcut-config-Lt-ENtOA.js → wc-shortcut-config-CO8qr7rL.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-Ulyd6DJI.js → wc-sprinkles-CGiMYIrc.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-CjUWgDS5.js → wc-transcript-export-B80xIQii.js} +2 -2
- package/dist/ui/assets/{wc-tray-nlt3cfKN.js → wc-tray-DxWHkV1h.js} +4 -4
- package/dist/ui/assets/{welcome-detection-DZw32eJV.js → welcome-detection-DOK7mItx.js} +1 -1
- package/dist/ui/assets/{whisper-session-sS59s-DF.js → whisper-session-6rHCExtj.js} +2 -2
- package/dist/ui/assets/{xai-grok-DmUQcLfp.js → xai-grok-D-TSGGET.js} +1 -1
- package/dist/ui/assets/{xai-grok-BzxU9K3e.js → xai-grok-nJsGF9nb.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/dist/ui/packages/webapp/upgrade-to-seven.html +1 -1
- package/dist/ui/upgrade-to-seven.html +1 -1
- package/package.json +2 -2
- package/dist/ui/assets/dist-CRiUr-qW.js +0 -5
- package/dist/ui/assets/dist-DkCqRzYv.js +0 -18
- package/dist/ui/assets/dist-Dz3ZPazl.js +0 -10
- package/dist/ui/assets/provider-store-access-BThfavwl.js +0 -1
- package/dist/ui/assets/provider-store-access-DSViJVUe.js +0 -1
- package/dist/ui/assets/slicc-version-q_GhPkgV.js +0 -1
- package/dist/ui/assets/wasm-inline-DSUyFn1L.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-Cx6Y120U.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-BSv2YWPV.js";import{d as l,f as u,i as d,u as f,w as p}from"./account-store-6UOIlkM4.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-CjhwqMwZ.js";import{t as ee}from"./sha256-DynDhwRL.js";import{t as te}from"./runtime-env-DadgceZk.js";import{t as ne}from"./slugify-BYJ6QVAt.js";import{i as re,n as ie,r as ae,t as oe}from"./host-command-r07SsrQD.js";import{a as se,c as ce,d as y,f as le,i as ue,l as de,m as fe,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye}from"./snapshot-CPtJGttd.js";import{n as be,t as b}from"./panel-rpc-accessor-B4BfPLSo.js";import{a as xe,c as Se,n as Ce,o as we,s as Te,t as Ee}from"./feature-flags-CoR3q8DD.js";import{t as De}from"./providers-Dpe0MZEV.js";import{r as Oe}from"./binary-cache-HVfvmwmL.js";import{i as ke,n as Ae,r as je}from"./fetch-body-CuwTaJC_.js";import{s as Me,t as Ne}from"./api-endpoint-D-Wsnvui.js";import{t as Pe}from"./compat-DHy2gvsm.js";import{t as Fe}from"./utf16-clip-Dcxt-q1C.js";import{n as Ie,t as Le}from"./mime-types-D7IV6i7k.js";import"./core-AOkBgfdI.js";import{n as Re,t as ze}from"./float-topology-CLSUOTF5.js";import{t as Be}from"./secrets-bridge-client-mDM3v5uS.js";import{a as Ve,i as He,n as Ue,r as We}from"./tool-ui-C1Q9wp0X.js";import{a as Ge,i as Ke,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as qe,r as Je,t as Ye}from"./merge-file-core-QFhaGlrZ.js";import{n as Xe,t as Ze}from"./types-D8gIX-W-.js";import{i as Qe}from"./mount-index-LvDi_MEB.js";import{a as $e,i as et,n as tt,o as nt,s as rt,t as it}from"./signed-fetch-DcYblAfC.js";import{o as at}from"./mount-table-store-BMpdbG2F.js";import{t as ot}from"./remote-cache-hcStLEnt.js";import{n as st}from"./fs-1AHAbMnY.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-q_GhPkgV.js";import{a as dt,i as C,n as ft,r as pt,t as mt}from"./browser-Brcy18LQ.js";import{t as w}from"./subcommand-flags-BRSOk05V.js";import{n as ht,r as gt,t as T}from"./subcommand-help-p8_2GpQY.js";import{n as _t}from"./cost-command-gZRzgZXM.js";import{d as vt,g as yt,i as bt,n as xt,o as St}from"./sudoers-D6zuYF9I.js";import{t as Ct}from"./sudo-refusal-DVwTXFRE.js";import{n as wt}from"./types-Dj5TU-Qg.js";import{a as Tt,c as Et,i as Dt,l as Ot,n as kt,o as At,r as jt,t as Mt}from"./types-JfhqX7lD.js";import{n as E,t as Nt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Pt}from"./html-B_Hg2WOy.js";import{n as Ft}from"./llm-session-id-BkEQhxBR.js";import{t as It}from"./src-RA_OX75a.js";import{i as Lt,o as Rt}from"./browser-DKcnER7J.js";import{a as zt,c as Bt,i as Vt,n as Ht,o as Ut,s as Wt,t as Gt}from"./pipe-status-BBrT3VeG.js";import{i as Kt,r as qt,t as Jt}from"./mount-picker-popup-DAwxk-yZ.js";import{t as Yt}from"./buffer-nxyI8h4F.js";import"./buffer-polyfill-BY2Nyxa2.js";import{A as Xt,B as D,C as Zt,D as O,E as Qt,F as $t,G as en,H as k,I as A,J as tn,K as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,Y as hn,_ as gn,a as _n,b as vn,c as yn,d as bn,f as xn,g as Sn,h as Cn,i as wn,j as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as j,q as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn,z as Bn}from"./isomorphic-git-CNj2MdIg.js";import"./global-db-BNyF6Scf.js";import{C as Vn,S as M,a as Hn,b as Un,c as Wn,d as Gn,f as Kn,g as qn,i as Jn,l as Yn,m as Xn,n as Zn,p as Qn,r as $n,s as er,t as tr,u as nr,x as rr,y as N}from"./state-BTfuf1EK.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-COJzI6rm.js";import{a as cr,i as lr,o as P,t as ur}from"./just-bash-compat-Cg70pjrK.js";import{h as dr,i as fr,r as pr}from"./stdio-tty-D0KTZ4Xe.js";import{i as mr,r as hr,t as gr}from"./home-dir-BmtQVSXa.js";import{i as _r,r as vr}from"./global-prefix-DqCuANmV.js";import{t as yr}from"./wasm-programs-DRLkwR0k.js";import{a as br,c as xr,n as Sr,r as Cr,s as wr}from"./jsh-discovery-DUWJlGSv.js";import{C as Tr,a as Er,b as Dr,c as Or,d as kr,f as Ar,h as jr,i as Mr,l as Nr,m as Pr,n as Fr,o as Ir,p as Lr,r as Rr,s as zr,t as F,u as Br,v as Vr,y as Hr}from"./shared-DZyBG2Ft.js";import{_ as Ur,a as Wr,b as Gr,d as Kr,f as qr,g as Jr,h as Yr,i as Xr,l as Zr,m as Qr,p as $r,r as ei,s as ti,u as ni,v as ri,y as ii}from"./require-guards-C_oYAtki.js";import{S as ai,_ as oi,b as si,c as ci,d as li,f as ui,g as di,h as fi,l as pi,m as mi,n as hi,o as gi,p as _i,t as vi,u as yi,v as bi,x as xi,y as Si}from"./jsh-executor-D6xT_O9d.js";import{n as Ci,t as wi}from"./esbuild-wasm-lUS0HyuM.js";import{n as Ti}from"./wasm-compiler-Ct7QZURL.js";import{a as Ei,o as Di,s as Oi,t as ki}from"./usb-device-registry-DEKs171n.js";import{i as Ai,r as ji,t as Mi}from"./script-catalog-CGzzz6br.js";import{a as Ni,c as Pi,o as Fi,s as Ii,t as Li}from"./types-CzOILwB4.js";import{a as Ri,c as zi,d as Bi,f as Vi,n as Hi,r as Ui,u as Wi}from"./github-zip-CZU7aCjk.js";import{i as Gi,t as Ki}from"./github-auth-DVMadrYX.js";import{a as qi,i as Ji,o as Yi,r as Xi,t as Zi}from"./provenance-C9CGZ8Xn.js";import{a as Qi,c as $i,i as ea,n as ta,o as na,r as ra,s as ia}from"./github-install-j_0TAu54.js";import{n as aa,t as oa}from"./magick-wasm-CCqHZGyo.js";import{i as sa,n as ca,r as la,t as ua}from"./pdf-raster-LJHwN-SN.js";import{n as da}from"./lick-target-env-8JxfVcIV.js";import{t as fa}from"./tmpdir-env-ate4iNcK.js";import{n as pa,t as ma}from"./keyboard-TcuVIW9F.js";import{n as ha,t as ga}from"./hf-defaults-BwJdGLgk.js";import{t as _a}from"./ffmpeg-wasm-Cmw6XFUi.js";import{t as va}from"./local-llm-Dps76P-l.js";import{i as ya,n as ba,r as xa,t as Sa}from"./tar-BjnO16Uf.js";import{a as Ca,c as wa,i as Ta,o as Ea,r as Da,s as Oa}from"./v86-vm-BlgIo0B_.js";import{n as ka,r as Aa}from"./lick-urls-CgPiVwD-.js";let ja=null;function Ma(e){ja=e!==null&&Number.isFinite(e)&&e>0?e:null}function Na(){if(ja!==null)return ja;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Pa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Fa(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Pa.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 Ia(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 La(e,t){return e.some(e=>Ia(e,t))}const Ra=`slicc-transcript`,za=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Ba=/* @__PURE__ */ new Set(/* @__PURE__ */ `/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Va(e){return Ba.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Ha=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Ua=new Set(za),Wa=/^[0-9a-fA-F]{64}$/,Ga=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ka(e){return typeof e==`string`&&Wa.test(e)}function qa(e){return Ga.test(e)&&Number.isFinite(Date.parse(e))}function Ja(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 Ya(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ja(n,t)}:{ok:!0}}function Xa(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 Za(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 Qa(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ya(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Za(e,t):n}function $a(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 eo(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 to(e,t){let n=$a(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?eo(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function no(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`?qa(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 ro(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 io(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?to(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function ao(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ya(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=ro(e,t);if(!n.ok)return n}let r=no(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=Xa(i,Qa,`${t}.content`);return a.ok?io(e,t):a}function oo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.name!=`string`)return{ok:!1,error:`${t}.name must be a string`};let n=Ya(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Xa(r,ao,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function so(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 co(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`}:Ka(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 lo=[`attachment-file-missing`,`attachment-association-unavailable`];function uo(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ya(e.missingReason,lo,`${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 fo(e,t){return e.present?co(e,t):uo(e,t)}function po(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=so(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=Ya(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?fo(e,t):r}function mo(e,t){let n=Ya(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 ho(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.category!=`string`)return{ok:!1,error:`${t}.category must be a string`};let n=Ya(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?mo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function go(e,t){return I(e)?typeof e.sourceConversationId==`string`?typeof e.targetConversationId==`string`?{ok:!0}:{ok:!1,error:`${t}.targetConversationId must be a string`}:{ok:!1,error:`${t}.sourceConversationId must be a string`}:{ok:!1,error:`${t} must be a non-null object`}}function _o(e,t){return typeof e!=`string`||!Ua.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function vo(e){if(!I(e))return{ok:!1,error:`export must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`export.id must be a string`};if(typeof e.generatedAt!=`string`)return{ok:!1,error:`export.generatedAt must be a string`};if(e.format!==`slicc-transcript`)return{ok:!1,error:`export.format must equal "slicc-transcript"`};let t=e.producer;return I(t)?t.application===`slicc`?typeof t.version==`string`?{ok:!0}:{ok:!1,error:`export.producer.version must be a string`}:{ok:!1,error:`export.producer.application must equal "slicc"`}:{ok:!1,error:`export.producer must be a non-null object`}}function yo(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ya(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Xa(e.missing,_o,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function bo(e){if(!I(e))return{ok:!1,error:`session must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`session.id must be a string`};if(typeof e.title!=`string`)return{ok:!1,error:`session.title must be a string`};let t=Ya(e.state,[`active`,`frozen`],`session.state`);return t.ok?yo(e.completeness):t}function xo(e){if(!I(e))return{ok:!1,error:`privacy must be a non-null object`};if(e.reasoningExcluded!==!0)return{ok:!1,error:`privacy.reasoningExcluded must be true`};let t=e.excludedReasoningBlocks;if(typeof t!=`number`)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a number`};if(!Number.isInteger(t)||t<0)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a non-negative integer`};if(e.binaryAttachments!==`included-unchanged`)return{ok:!1,error:`privacy.binaryAttachments must equal "included-unchanged"`};if(!I(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?Xa(n,ho,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function So(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Xa(t,oo,`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=Xa(r,go,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Xa(a,po,`attachments`):{ok:!1,error:`attachments must be an array`}}function Co(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let r of e){if(!I(r)||typeof r.id!=`string`)continue;if(t.has(r.id))return{ok:!1,error:`duplicate conversation id "${r.id}"`};t.add(r.id);let e=r.messages;if(Array.isArray(e)){for(let t of e)if(I(t)&&typeof t.id==`string`){if(n.has(t.id))return{ok:!1,error:`duplicate message id "${t.id}"`};n.add(t.id)}}}return{ok:!0}}function wo(e){for(let t of e){if(!I(t))continue;let e=t.messages;if(!Array.isArray(e))continue;let n=typeof t.id==`string`?t.id:`?`,r=0;for(let t of e){if(!I(t)||typeof t.sequence!=`number`)continue;let e=t.sequence;if(e<=r)return{ok:!1,error:`sequences in conversation "${n}" must be strictly increasing`};r=e}}return{ok:!0}}function To(e){let t=[];for(let n of e){if(!I(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)I(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function Eo(e){let t=/* @__PURE__ */ new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of To(e))t.add(n)}return t}function Do(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n)||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 Oo(e){return Do(e,Eo(e))}function ko(e,t){for(let n of e){if(!I(n)||n.type!==`attachment-ref`)continue;let e=n.attachmentId;if(typeof e!=`string`||!t.has(e))return{ok:!1,error:`attachment-ref references unknown attachmentId "${e}"`}}return{ok:!0}}function Ao(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=ko(e,t);if(!r.ok)return r}}return{ok:!0}}function jo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Ao(e,n)}function Mo(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=/* @__PURE__ */ new Set,r=n.messages;if(Array.isArray(r))for(let t of r)I(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function No(e,t){let n=Mo(t);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.sourceConversationId,a=r.sourceMessageId;if(typeof i!=`string`||typeof a!=`string`)continue;let o=n.get(i);if(!o)return{ok:!1,error:`attachments[${t}].sourceConversationId "${i}" does not exist`};if(!o.has(a))return{ok:!1,error:`attachments[${t}].sourceMessageId "${a}" does not exist in conversation "${i}"`}}return{ok:!0}}function Po(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(To(e)))}return t}function Fo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!I(i))continue;let a=i.sourceConversationId,o=i.targetConversationId;if(typeof a!=`string`||!t.has(a))return{ok:!1,error:`delegations[${r}].sourceConversationId "${a}" does not exist`};if(typeof o!=`string`||!t.has(o))return{ok:!1,error:`delegations[${r}].targetConversationId "${o}" does not exist`};let s=i.toolCallId;if(typeof s==`string`&&s!==``&&!n.get(a)?.has(s))return{ok:!1,error:`delegations[${r}].toolCallId "${s}" does not exist in source conversation "${a}"`}}return{ok:!0}}function Io(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Fo(e,n,Po(t))}function Lo(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 Ro(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.target;if(!I(i))continue;let a=Lo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function zo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=Co(t);if(!o.ok)return o;let s=wo(t);if(!s.ok)return s;let c=Oo(t);if(!c.ok)return c;let l=jo(t,n);if(!l.ok)return l;let u=No(n,t);if(!u.ok)return u;let d=Io(r,t);return d.ok?Ro(a,n):d}function Bo(e){let t=So(e);return t.ok?zo(e):t}function Vo(e){if(!I(e))return{ok:!1,error:`document must be a non-null object`};if(e.schemaVersion!==1)return{ok:!1,error:`schemaVersion must equal 1`};let t=vo(e.export);if(!t.ok)return t;let n=bo(e.session);if(!n.ok)return n;let r=xo(e.privacy);return r.ok?Bo(e):r}async function Ho(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:nt});if(r.status===401||r.status===403)throw Error(`not authorized to read the site config for ${e}/${t} — log in via Settings → Providers → Adobe, or pass --backend to skip the probe`);if(r.status===404)throw Error(`no site config for ${e}/${t} — check the org and site names`);if(r.status>=400)throw Error(`site config probe failed for ${e}/${t}: ${r.status}`);let i;try{i=await r.json()}catch(n){throw Error(`site config for ${e}/${t} is not JSON: ${n instanceof Error?n.message:String(n)}`)}let a=i.content?.source?.url;return{backend:Uo(a),sourceUrl:a}}function Uo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Wo=`slicc-sprinkle-routes`;function Go(){try{let e=localStorage.getItem(Wo);return e?JSON.parse(e):{}}catch{return{}}}function Ko(e){try{localStorage.setItem(Wo,JSON.stringify(e))}catch{}}function qo(e){return Go()[e]}function Jo(e,t){let n=Go();n[e]=t,Ko(n)}function Yo(e){let t=Go();delete t[e],Ko(t)}function Xo(){return Go()}function Zo(e,t,n){return Et(t,n,`${e} adapter does not implement ${t}.${n}`)}function Qo(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(Zo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function $o(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Qo(t,`browser`,kt,e.browser),network:Qo(t,`network`,Tt,e.network),secrets:Qo(t,`secrets`,At,e.secrets),devices:Qo(t,`devices`,jt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Qo(t,`mounts`,Dt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Qo(t,`approvals`,Mt,e.approvals)}}function es(e={}){return $o({adapter:`connect`,pageGestures:e.pageGestures})}function ts(e){let t=Nt(()=>import(`./extension-ops-DuqnQ5td.js`).then(t=>t.createExtensionOps(e)));return $o({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function ns(e={}){let t=Nt(()=>import(`./rest-ops-MVoUzlLZ.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return $o({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function rs(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return ns({pageGestures:n});case`extension-direct`:case`extension-delegate`:return ts({adapter:e,pageGestures:n});case`connect`:return es({pageGestures:n})}}const is=e(`quick-llm`);async function as(e){let t=d();if(!t)return is.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?ls(n,e.modelId)??ls(n,r):os(n,r),!i)return is.debug(`No model available for provider`,{providerId:n}),null;let a=Fe(e.prompt),o=e.system===void 0?void 0:Fe(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=us());try{let n=(await Pe(i,{systemPrompt:o,messages:[s]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(c).length>0?c:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return is.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function os(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=cs(r.id),a=n.filter(e=>ss(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function ss(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 cs(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 ls(e,t){return f(e).find(e=>e.id===t)}function us(){return Ft(`ui-quick-llm`)}const ds=e(`sudo-suggest`);async function fs(e,t){if(e.suggestedPattern&&e.suggestedPattern.trim().length>0)return e.suggestedPattern.trim();let n=e.detail.trim();if(e.kind===`guest-message`||e.kind===`guest-tool`)return n;let r=e.kind===`command`?`You generalize a single shell command into a minimal glob pattern for an
|
|
1
|
+
import{t as e}from"./logger-Cx6Y120U.js";import{r as t,t as n}from"./base64-BPBW1Gzr.js";import{n as r}from"./bridge-protocol-31SWTdS5.js";import{a as i,n as a,o,s,t as c}from"./handoff-link-BSv2YWPV.js";import{d as l,f as u,i as d,u as f,w as p}from"./account-store-BbkpyoOX.js";import{c as m,d as h,n as g,r as _,s as v}from"./proxied-fetch-CjhwqMwZ.js";import{t as ee}from"./sha256-DynDhwRL.js";import{t as te}from"./runtime-env-DadgceZk.js";import{t as ne}from"./slugify-BYJ6QVAt.js";import{i as re,n as ie,r as ae,t as oe}from"./host-command-r07SsrQD.js";import{a as se,c as ce,d as y,f as le,i as ue,l as de,m as fe,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye}from"./snapshot-B8OJhVC-.js";import{n as be,t as b}from"./panel-rpc-accessor-B4BfPLSo.js";import{a as xe,c as Se,n as Ce,o as we,s as Te,t as Ee}from"./feature-flags-CoR3q8DD.js";import{t as De}from"./providers-5HxsN_Aj.js";import{r as Oe}from"./binary-cache-HVfvmwmL.js";import{i as ke,n as Ae,r as je}from"./fetch-body-CuwTaJC_.js";import{s as Me,t as Ne}from"./api-endpoint-D-Wsnvui.js";import{t as Pe}from"./compat-DHy2gvsm.js";import{t as Fe}from"./utf16-clip-Dcxt-q1C.js";import{n as Ie,t as Le}from"./mime-types-D7IV6i7k.js";import"./core-AOkBgfdI.js";import{n as Re,t as ze}from"./float-topology-CLSUOTF5.js";import{t as Be}from"./secrets-bridge-client-mDM3v5uS.js";import{a as Ve,i as He,n as Ue,r as We}from"./tool-ui-C1Q9wp0X.js";import{a as Ge,i as Ke,n as x,t as S}from"./path-utils-DNJG-zQf.js";import{n as qe,r as Je,t as Ye}from"./merge-file-core-QFhaGlrZ.js";import{n as Xe,t as Ze}from"./types-D8gIX-W-.js";import{i as Qe}from"./mount-index-LvDi_MEB.js";import{a as $e,i as et,n as tt,o as nt,s as rt,t as it}from"./signed-fetch-DcYblAfC.js";import{o as at}from"./mount-table-store-BMpdbG2F.js";import{t as ot}from"./remote-cache-hcStLEnt.js";import{n as st}from"./fs-CM_0hH6U.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-CNzyogpa.js";import{a as dt,i as C,n as ft,r as pt,t as mt}from"./browser-Brcy18LQ.js";import{t as w}from"./subcommand-flags-BRSOk05V.js";import{n as ht,r as gt,t as T}from"./subcommand-help-p8_2GpQY.js";import{n as _t}from"./cost-command-gZRzgZXM.js";import{d as vt,g as yt,i as bt,n as xt,o as St}from"./sudoers-D6zuYF9I.js";import{t as Ct}from"./sudo-refusal-DVwTXFRE.js";import{n as wt}from"./types-Dj5TU-Qg.js";import{a as Tt,c as Et,i as Dt,l as Ot,n as kt,o as At,r as jt,t as Mt}from"./types-JfhqX7lD.js";import{n as E,t as Nt}from"./boundary-DjgipyWT.js";import"./rest-paths-Dia19u9P.js";import{t as Pt}from"./html-B_Hg2WOy.js";import{n as Ft}from"./llm-session-id-BkEQhxBR.js";import{t as It}from"./src-RA_OX75a.js";import{i as Lt,o as Rt}from"./browser-DKcnER7J.js";import{a as zt,c as Bt,i as Vt,n as Ht,o as Ut,s as Wt,t as Gt}from"./pipe-status-BBrT3VeG.js";import{i as Kt,r as qt,t as Jt}from"./mount-picker-popup-DAwxk-yZ.js";import{t as Yt}from"./buffer-nxyI8h4F.js";import"./buffer-polyfill-BY2Nyxa2.js";import{A as Xt,B as D,C as Zt,D as O,E as Qt,F as $t,G as en,H as k,I as A,J as tn,K as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,Y as hn,_ as gn,a as _n,b as vn,c as yn,d as bn,f as xn,g as Sn,h as Cn,i as wn,j as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as j,q as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn,z as Bn}from"./isomorphic-git-DgW1dEnL.js";import"./global-db-BNyF6Scf.js";import{C as Vn,S as M,a as Hn,b as Un,c as Wn,d as Gn,f as Kn,g as qn,i as Jn,l as Yn,m as Xn,n as Zn,p as Qn,r as $n,s as er,t as tr,u as nr,x as rr,y as N}from"./state-Bs0W-HnZ.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-BymaKKeY.js";import{a as cr,i as lr,o as P,t as ur}from"./just-bash-compat-Cg70pjrK.js";import{h as dr,i as fr,r as pr}from"./stdio-tty-D0KTZ4Xe.js";import{i as mr,r as hr,t as gr}from"./home-dir-BmtQVSXa.js";import{i as _r,r as vr}from"./global-prefix-DqCuANmV.js";import{t as yr}from"./wasm-programs-DRLkwR0k.js";import{a as br,c as xr,n as Sr,r as Cr,s as wr}from"./jsh-discovery-DUWJlGSv.js";import{C as Tr,a as Er,b as Dr,c as Or,d as kr,f as Ar,h as jr,i as Mr,l as Nr,m as Pr,n as Fr,o as Ir,p as Lr,r as Rr,s as zr,t as F,u as Br,v as Vr,y as Hr}from"./shared-DZyBG2Ft.js";import{_ as Ur,a as Wr,b as Gr,d as Kr,f as qr,g as Jr,h as Yr,i as Xr,l as Zr,m as Qr,p as $r,r as ei,s as ti,u as ni,v as ri,y as ii}from"./require-guards-C_oYAtki.js";import{S as ai,_ as oi,b as si,c as ci,d as li,f as ui,g as di,h as fi,l as pi,m as mi,n as hi,o as gi,p as _i,t as vi,u as yi,v as bi,x as xi,y as Si}from"./jsh-executor-EkakjVGa.js";import{n as Ci,t as wi}from"./esbuild-wasm-lUS0HyuM.js";import{n as Ti}from"./wasm-compiler-Ct7QZURL.js";import{a as Ei,o as Di,s as Oi,t as ki}from"./usb-device-registry-DEKs171n.js";import{i as Ai,r as ji,t as Mi}from"./script-catalog-CGzzz6br.js";import{a as Ni,c as Pi,o as Fi,s as Ii,t as Li}from"./types-CzOILwB4.js";import{a as Ri,c as zi,d as Bi,f as Vi,n as Hi,r as Ui,u as Wi}from"./github-zip-Dq6nNNvn.js";import{i as Gi,t as Ki}from"./github-auth-pGXINjeA.js";import{a as qi,i as Ji,o as Yi,r as Xi,t as Zi}from"./provenance-C9CGZ8Xn.js";import{a as Qi,c as $i,i as ea,n as ta,o as na,r as ra,s as ia}from"./github-install-BSqwBQIl.js";import{n as aa,t as oa}from"./magick-wasm-CCqHZGyo.js";import{i as sa,n as ca,r as la,t as ua}from"./pdf-raster-LJHwN-SN.js";import{n as da}from"./lick-target-env-8JxfVcIV.js";import{t as fa}from"./tmpdir-env-ate4iNcK.js";import{n as pa,t as ma}from"./keyboard-TcuVIW9F.js";import{n as ha,t as ga}from"./hf-defaults-BwJdGLgk.js";import{t as _a}from"./ffmpeg-wasm-Cmw6XFUi.js";import{t as va}from"./local-llm-ChvYBw5c.js";import{i as ya,n as ba,r as xa,t as Sa}from"./tar-BjnO16Uf.js";import{a as Ca,c as wa,i as Ta,o as Ea,r as Da,s as Oa}from"./v86-vm-BlgIo0B_.js";import{n as ka,r as Aa}from"./lick-urls-CgPiVwD-.js";let ja=null;function Ma(e){ja=e!==null&&Number.isFinite(e)&&e>0?e:null}function Na(){if(ja!==null)return ja;let e=globalThis.performance?.timeOrigin;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Date.now()}new URL(r).hostname;const Pa=/^([0-9a-f]{32})--(?:[0-9a-f]{8}-)?([0-9a-f]+)$/i;function Fa(e){let t;try{t=new URL(e.includes(`://`)?e:`https://${e}`).hostname}catch{return null}let n=Pa.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 Ia(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 La(e,t){return e.some(e=>Ia(e,t))}const Ra=`slicc-transcript`,za=[`canonical-agent-history-unavailable`,`tool-data-may-be-truncated`,`model-metadata-unavailable`,`scoop-history-unavailable`,`attachment-file-missing`,`attachment-association-unavailable`,`complete-snapshot-unavailable`],Ba=/* @__PURE__ */ new Set(/* @__PURE__ */ `/export/format./export/producer/application./session/id./session/state./session/completeness/status./session/completeness/missing/*./conversations/*/id./conversations/*/kind./conversations/*/parentConversationId./conversations/*/messages/*/id./conversations/*/messages/*/role./conversations/*/messages/*/timestamp./conversations/*/messages/*/toolCallId./conversations/*/messages/*/content/*/type./conversations/*/messages/*/content/*/id./conversations/*/messages/*/content/*/name./conversations/*/messages/*/content/*/attachmentId./delegations/*/sourceConversationId./delegations/*/targetConversationId./delegations/*/toolCallId./attachments/*/id./attachments/*/path./attachments/*/sha256./attachments/*/sourceConversationId./attachments/*/sourceMessageId./attachments/*/handling./attachments/*/missingReason`.split(`.`));function Va(e){return Ba.has(e.replace(/\/\d+(?=\/|$)/g,`/*`))}var Ha=class extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e),this.code=e,this.detail=t,this.name=`TranscriptExportError`}};const Ua=new Set(za),Wa=/^[0-9a-fA-F]{64}$/,Ga=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ka(e){return typeof e==`string`&&Wa.test(e)}function qa(e){return Ga.test(e)&&Number.isFinite(Date.parse(e))}function Ja(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 Ya(e,t,n){return typeof e!=`string`||!t.includes(e)?{ok:!1,error:Ja(n,t)}:{ok:!0}}function Xa(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 Za(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 Qa(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ya(e.type,[`text`,`tool-call`,`attachment-ref`],`${t}.type`);return n.ok?Za(e,t):n}function $a(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 eo(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 to(e,t){let n=$a(e,t);if(!n.ok)return n;let r=e.cost;return I(r)?eo(r,`${t}.cost`):{ok:!1,error:`${t}.cost must be a non-null object`}}function no(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`?qa(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 ro(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 io(e,t){let n=e.usage;return n===void 0?{ok:!0}:I(n)?to(n,`${t}.usage`):{ok:!1,error:`${t}.usage must be a non-null object`}}function ao(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=Ya(e.role,[`user`,`assistant`,`tool-result`],`${t}.role`);if(!n.ok)return n;if(e.role===`tool-result`){let n=ro(e,t);if(!n.ok)return n}let r=no(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=Xa(i,Qa,`${t}.content`);return a.ok?io(e,t):a}function oo(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.name!=`string`)return{ok:!1,error:`${t}.name must be a string`};let n=Ya(e.kind,[`cone`,`scoop`],`${t}.kind`);if(!n.ok)return n;let r=e.messages;return Array.isArray(r)?Xa(r,ao,`${t}.messages`):{ok:!1,error:`${t}.messages must be an array`}}function so(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 co(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`}:Ka(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 lo=[`attachment-file-missing`,`attachment-association-unavailable`];function uo(e,t){let n=e.path,r=e.sha256,i=e.byteLength;return n===``?r===``?i===0?Ya(e.missingReason,lo,`${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 fo(e,t){return e.present?co(e,t):uo(e,t)}function po(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};let n=so(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=Ya(e.handling,[`text-redacted`,`binary-unchanged`],`${t}.handling`);return r.ok?fo(e,t):r}function mo(e,t){let n=Ya(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 ho(e,t){if(!I(e))return{ok:!1,error:`${t} must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`${t}.id must be a string`};if(typeof e.category!=`string`)return{ok:!1,error:`${t}.category must be a string`};let n=Ya(e.detector,[`known-secret`,`credential-pattern`,`pre-obfuscated`],`${t}.detector`);if(!n.ok)return n;let r=e.target;return I(r)?mo(r,`${t}.target`):{ok:!1,error:`${t}.target must be a non-null object`}}function go(e,t){return I(e)?typeof e.sourceConversationId==`string`?typeof e.targetConversationId==`string`?{ok:!0}:{ok:!1,error:`${t}.targetConversationId must be a string`}:{ok:!1,error:`${t}.sourceConversationId must be a string`}:{ok:!1,error:`${t} must be a non-null object`}}function _o(e,t){return typeof e!=`string`||!Ua.has(e)?{ok:!1,error:`${t} is not a valid completeness reason`}:{ok:!0}}function vo(e){if(!I(e))return{ok:!1,error:`export must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`export.id must be a string`};if(typeof e.generatedAt!=`string`)return{ok:!1,error:`export.generatedAt must be a string`};if(e.format!==`slicc-transcript`)return{ok:!1,error:`export.format must equal "slicc-transcript"`};let t=e.producer;return I(t)?t.application===`slicc`?typeof t.version==`string`?{ok:!0}:{ok:!1,error:`export.producer.version must be a string`}:{ok:!1,error:`export.producer.application must equal "slicc"`}:{ok:!1,error:`export.producer must be a non-null object`}}function yo(e){if(!I(e))return{ok:!1,error:`session.completeness must be a non-null object`};let t=Ya(e.status,[`complete`,`partial`],`session.completeness.status`);return t.ok?Array.isArray(e.missing)?Xa(e.missing,_o,`session.completeness.missing`):{ok:!1,error:`session.completeness.missing must be an array`}:t}function bo(e){if(!I(e))return{ok:!1,error:`session must be a non-null object`};if(typeof e.id!=`string`)return{ok:!1,error:`session.id must be a string`};if(typeof e.title!=`string`)return{ok:!1,error:`session.title must be a string`};let t=Ya(e.state,[`active`,`frozen`],`session.state`);return t.ok?yo(e.completeness):t}function xo(e){if(!I(e))return{ok:!1,error:`privacy must be a non-null object`};if(e.reasoningExcluded!==!0)return{ok:!1,error:`privacy.reasoningExcluded must be true`};let t=e.excludedReasoningBlocks;if(typeof t!=`number`)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a number`};if(!Number.isInteger(t)||t<0)return{ok:!1,error:`privacy.excludedReasoningBlocks must be a non-negative integer`};if(e.binaryAttachments!==`included-unchanged`)return{ok:!1,error:`privacy.binaryAttachments must equal "included-unchanged"`};if(!I(e.redactionCounts))return{ok:!1,error:`privacy.redactionCounts must be a non-null object`};let n=e.redactions;return Array.isArray(n)?Xa(n,ho,`privacy.redactions`):{ok:!1,error:`privacy.redactions must be an array`}}function So(e){let t=e.conversations;if(!Array.isArray(t))return{ok:!1,error:`conversations must be an array`};let n=Xa(t,oo,`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=Xa(r,go,`delegations`);if(!i.ok)return i;let a=e.attachments;return Array.isArray(a)?Xa(a,po,`attachments`):{ok:!1,error:`attachments must be an array`}}function Co(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let r of e){if(!I(r)||typeof r.id!=`string`)continue;if(t.has(r.id))return{ok:!1,error:`duplicate conversation id "${r.id}"`};t.add(r.id);let e=r.messages;if(Array.isArray(e)){for(let t of e)if(I(t)&&typeof t.id==`string`){if(n.has(t.id))return{ok:!1,error:`duplicate message id "${t.id}"`};n.add(t.id)}}}return{ok:!0}}function wo(e){for(let t of e){if(!I(t))continue;let e=t.messages;if(!Array.isArray(e))continue;let n=typeof t.id==`string`?t.id:`?`,r=0;for(let t of e){if(!I(t)||typeof t.sequence!=`number`)continue;let e=t.sequence;if(e<=r)return{ok:!1,error:`sequences in conversation "${n}" must be strictly increasing`};r=e}}return{ok:!0}}function To(e){let t=[];for(let n of e){if(!I(n))continue;let e=n.content;if(Array.isArray(e))for(let n of e)I(n)&&n.type===`tool-call`&&typeof n.id==`string`&&t.push(n.id)}return t}function Eo(e){let t=/* @__PURE__ */ new Set;for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of To(e))t.add(n)}return t}function Do(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n)||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 Oo(e){return Do(e,Eo(e))}function ko(e,t){for(let n of e){if(!I(n)||n.type!==`attachment-ref`)continue;let e=n.attachmentId;if(typeof e!=`string`||!t.has(e))return{ok:!1,error:`attachment-ref references unknown attachmentId "${e}"`}}return{ok:!0}}function Ao(e,t){for(let n of e){if(!I(n))continue;let e=n.messages;if(Array.isArray(e))for(let n of e){if(!I(n))continue;let e=n.content;if(!Array.isArray(e))continue;let r=ko(e,t);if(!r.ok)return r}}return{ok:!0}}function jo(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Ao(e,n)}function Mo(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=/* @__PURE__ */ new Set,r=n.messages;if(Array.isArray(r))for(let t of r)I(t)&&typeof t.id==`string`&&e.add(t.id);t.set(n.id,e)}return t}function No(e,t){let n=Mo(t);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.sourceConversationId,a=r.sourceMessageId;if(typeof i!=`string`||typeof a!=`string`)continue;let o=n.get(i);if(!o)return{ok:!1,error:`attachments[${t}].sourceConversationId "${i}" does not exist`};if(!o.has(a))return{ok:!1,error:`attachments[${t}].sourceMessageId "${a}" does not exist in conversation "${i}"`}}return{ok:!0}}function Po(e){let t=/* @__PURE__ */ new Map;for(let n of e){if(!I(n)||typeof n.id!=`string`)continue;let e=Array.isArray(n.messages)?n.messages:[];t.set(n.id,new Set(To(e)))}return t}function Fo(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(!I(i))continue;let a=i.sourceConversationId,o=i.targetConversationId;if(typeof a!=`string`||!t.has(a))return{ok:!1,error:`delegations[${r}].sourceConversationId "${a}" does not exist`};if(typeof o!=`string`||!t.has(o))return{ok:!1,error:`delegations[${r}].targetConversationId "${o}" does not exist`};let s=i.toolCallId;if(typeof s==`string`&&s!==``&&!n.get(a)?.has(s))return{ok:!1,error:`delegations[${r}].toolCallId "${s}" does not exist in source conversation "${a}"`}}return{ok:!0}}function Io(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);return Fo(e,n,Po(t))}function Lo(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 Ro(e,t){let n=/* @__PURE__ */ new Set;for(let e of t)I(e)&&typeof e.id==`string`&&n.add(e.id);for(let t=0;t<e.length;t++){let r=e[t];if(!I(r))continue;let i=r.target;if(!I(i))continue;let a=Lo(i,n,`privacy.redactions[${t}].target`);if(!a.ok)return a}return{ok:!0}}function zo(e){let t=e.conversations,n=e.attachments,r=e.delegations,i=e.privacy,a=Array.isArray(i?.redactions)?i.redactions:[],o=Co(t);if(!o.ok)return o;let s=wo(t);if(!s.ok)return s;let c=Oo(t);if(!c.ok)return c;let l=jo(t,n);if(!l.ok)return l;let u=No(n,t);if(!u.ok)return u;let d=Io(r,t);return d.ok?Ro(a,n):d}function Bo(e){let t=So(e);return t.ok?zo(e):t}function Vo(e){if(!I(e))return{ok:!1,error:`document must be a non-null object`};if(e.schemaVersion!==1)return{ok:!1,error:`schemaVersion must equal 1`};let t=vo(e.export);if(!t.ok)return t;let n=bo(e.session);if(!n.ok)return n;let r=xo(e.privacy);return r.ok?Bo(e):r}async function Ho(e,t,n){let r=await n({method:`GET`,path:`/${e}/sites/${t}/config.json`,origin:nt});if(r.status===401||r.status===403)throw Error(`not authorized to read the site config for ${e}/${t} — log in via Settings → Providers → Adobe, or pass --backend to skip the probe`);if(r.status===404)throw Error(`no site config for ${e}/${t} — check the org and site names`);if(r.status>=400)throw Error(`site config probe failed for ${e}/${t}: ${r.status}`);let i;try{i=await r.json()}catch(n){throw Error(`site config for ${e}/${t} is not JSON: ${n instanceof Error?n.message:String(n)}`)}let a=i.content?.source?.url;return{backend:Uo(a),sourceUrl:a}}function Uo(e){if(!e)return`da`;let t;try{t=new URL(e).host}catch{return`da`}return t===`api.aem.live`?`aem`:`da`}const Wo=`slicc-sprinkle-routes`;function Go(){try{let e=localStorage.getItem(Wo);return e?JSON.parse(e):{}}catch{return{}}}function Ko(e){try{localStorage.setItem(Wo,JSON.stringify(e))}catch{}}function qo(e){return Go()[e]}function Jo(e,t){let n=Go();n[e]=t,Ko(n)}function Yo(e){let t=Go();delete t[e],Ko(t)}function Xo(){return Go()}function Zo(e,t,n){return Et(t,n,`${e} adapter does not implement ${t}.${n}`)}function Qo(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(Zo(e,t,n))]});return{...Object.fromEntries(a),allowlist:i,supports:e=>i.includes(e)}}function $o(e){let{adapter:t,pageGestures:n}=e,r=n??{};return{adapter:t,browser:Qo(t,`browser`,kt,e.browser),network:Qo(t,`network`,Tt,e.network),secrets:Qo(t,`secrets`,At,e.secrets),devices:Qo(t,`devices`,jt,{usbRequest:r.usbRequest,serialRequest:r.serialRequest,hidRequest:r.hidRequest,...e.devices}),mounts:Qo(t,`mounts`,Dt,{pickDirectory:r.pickDirectory,...e.mounts}),approvals:Qo(t,`approvals`,Mt,e.approvals)}}function es(e={}){return $o({adapter:`connect`,pageGestures:e.pageGestures})}function ts(e){let t=Nt(()=>import(`./extension-ops-DuqnQ5td.js`).then(t=>t.createExtensionOps(e)));return $o({adapter:e.adapter,pageGestures:e.pageGestures,network:{crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function ns(e={}){let t=Nt(()=>import(`./rest-ops-MVoUzlLZ.js`).then(t=>t.createRestOps(e)),e.controlTimeoutMs??1e4);return $o({adapter:`node-rest`,pageGestures:e.pageGestures,network:{localNodeServer:()=>Promise.resolve({ok:!0,value:{available:!0}}),crossOriginFetch:e=>E(`network`,`crossOriginFetch`,async()=>(await t()).crossOriginFetch(e))},secrets:{listMaskedEnv:()=>E(`secrets`,`listMaskedEnv`,async()=>(await t()).secrets.listMaskedEnv()),getMasked:e=>E(`secrets`,`getMasked`,async()=>(await t()).secrets.getMasked(e)),set:e=>E(`secrets`,`set`,async()=>(await t()).secrets.set(e)),delete:e=>E(`secrets`,`delete`,async()=>(await t()).secrets.delete(e))},mounts:{signRequest:e=>E(`mounts`,`signRequest`,async()=>(await t()).signRequest(e))},approvals:{request:e=>E(`approvals`,`request`,async()=>(await t()).requestApproval(e))}})}function rs(e,t={}){let{pageGestures:n}=t;switch(e){case`node-rest`:return ns({pageGestures:n});case`extension-direct`:case`extension-delegate`:return ts({adapter:e,pageGestures:n});case`connect`:return es({pageGestures:n})}}const is=e(`quick-llm`);async function as(e){let t=d();if(!t)return is.debug(`No API key for active provider — skipping`),null;let n=u(),r=l(),i;if(i=e.modelId?ls(n,e.modelId)??ls(n,r):os(n,r),!i)return is.debug(`No model available for provider`,{providerId:n}),null;let a=Fe(e.prompt),o=e.system===void 0?void 0:Fe(e.system),s={role:`user`,content:a,timestamp:Date.now()},c={};i.provider===`adobe`&&(c[`X-Session-Id`]=us());try{let n=(await Pe(i,{systemPrompt:o,messages:[s]},{apiKey:t,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(c).length>0?c:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return n.length>0?n:null}catch(e){return is.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}function os(e,t){let n=f(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=cs(r.id),a=n.filter(e=>ss(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function ss(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 cs(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 ls(e,t){return f(e).find(e=>e.id===t)}function us(){return Ft(`ui-quick-llm`)}const ds=e(`sudo-suggest`);async function fs(e,t){if(e.suggestedPattern&&e.suggestedPattern.trim().length>0)return e.suggestedPattern.trim();let n=e.detail.trim();if(e.kind===`guest-message`||e.kind===`guest-tool`)return n;let r=e.kind===`command`?`You generalize a single shell command into a minimal glob pattern for an
|
|
2
2
|
allow-list rule. Output ONLY the pattern on one line — no prose, no quotes,
|
|
3
3
|
no backticks. Keep the leading command/sub-command verbatim and replace only
|
|
4
4
|
the volatile tail (args, paths, refs) with a single trailing "*".
|
|
@@ -178,7 +178,7 @@ error: Please commit or stash them.
|
|
|
178
178
|
or: git symbolic-ref (-d | --delete) <name>`;function Sf(e){let t=Array.isArray(e)?e[e.length-1]:e;return typeof t==`boolean`?t:void 0}function Cf(e){let t={};typeof e.m==`string`&&(t.m=e.m);let n=Sf(e.delete);n!==void 0&&(t.delete=n);let r=Sf(e.d);r!==void 0&&(t.d=r);let i=Sf(e.quiet);i!==void 0&&(t.quiet=i);let a=Sf(e.q);a!==void 0&&(t.q=a);let o=Sf(e.short);o!==void 0&&(t.short=o);let s=Sf(e.recurse);return s!==void 0&&(t.recurse=s),t}function wf(){return{stdout:``,stderr:`${xf}\n`,exitCode:129}}function Tf(e){return!e.startsWith(`refs/`)||e.length===5||e.includes(`..`)||e.includes(`@{`)||e.split(`/`).some(e=>!e||e.startsWith(`.`)||e.endsWith(`.`)||e.endsWith(`.lock`))?!1:![...e].some(e=>{let t=e.charCodeAt(0);return t<=32||t===127||`~^:?*[\\`.includes(e)})}async function Ef(e,t,n){try{let r=await D({fs:e.lfs,dir:t,ref:n,depth:2});return r.startsWith(`refs/`)?{kind:`symbolic`,target:r}:{kind:`direct`}}catch{return{kind:`missing`}}}async function Df(e,t,n,r){let i=await Ef(e,t,n);if(i.kind!==`symbolic`)return{stdout:``,stderr:`fatal: ref ${n} is not a symbolic ref\n`,exitCode:i.kind===`direct`?1:128};if(!r)return i.target;let a=/* @__PURE__ */ new Set([n]),o=i.target;for(;;){if(a.has(o))return{stdout:``,stderr:`fatal: ref ${n} has a circular symbolic target\n`,exitCode:128};a.add(o);let r=await Ef(e,t,o);if(r.kind!==`symbolic`)return o;o=r.target}}function Of(e){for(let t of[`refs/heads/`,`refs/tags/`,`refs/remotes/`])if(e.startsWith(t))return e.slice(t.length);return e.startsWith(`refs/`)?e.slice(5):e}function kf(e,t){let n=/* @__PURE__ */ new Set([`m`,`delete`,`d`,`quiet`,`q`,`short`,`recurse`]),r=Object.keys(e).find(e=>!n.has(e));if(r)return{stdout:``,stderr:`error: unknown option '${r}'\n${xf}\n`,exitCode:129};if(e.m!==void 0)return{stdout:``,stderr:`fatal: option '-m' is not supported because reflogs are not persisted
|
|
179
179
|
`,exitCode:128};if(e.delete===!1||t&&(e.short!==void 0||e.recurse!==void 0))return wf()}async function Af(e,t,n,r){if(n===`HEAD`)return{stdout:``,stderr:`fatal: deleting 'HEAD' is not allowed
|
|
180
180
|
`,exitCode:128};let i=await Ef(e,t,n);return i.kind===`symbolic`?(await Cn({fs:e.lfs,dir:t,ref:n}),{stdout:``,stderr:``,exitCode:0}):{stdout:``,stderr:r?``:`fatal: Cannot delete ${n}, not a symbolic ref\n`,exitCode:i.kind===`direct`?1:128}}async function jf(e,t,n,r){return Tf(r)?(await tn({fs:e.lfs,dir:t,ref:n,value:r,force:!0,symbolic:!0}),{stdout:``,stderr:``,exitCode:0}):{stdout:``,stderr:r.startsWith(`refs/`)?`fatal: Refusing to set '${n}' to invalid ref '${r}'\n`:`fatal: Refusing to point ${n} outside of refs/\n`,exitCode:128}}async function Mf(e,t,n,r){let i=await Df(e,t,n,r.recurse!==!1);return typeof i==`string`?{stdout:`${r.short?Of(i):i}\n`,stderr:``,exitCode:0}:r.quiet&&i.exitCode===1?{...i,stderr:``}:i}async function Nf(e,t,n){let{flags:r,positionals:i}=M(n,L[`symbolic-ref`]),a=r.delete===!0,o=kf(r,a);if(o)return o;let s=r.quiet!==void 0||r.short!==void 0||r.recurse!==void 0;return a?i.length===1?Af(e,t,i[0],!!r.quiet):wf():i.length===2?s?wf():jf(e,t,i[0],i[1]):i.length===1?Mf(e,t,i[0],Cf(r)):wf()}async function Pf(e,t,n){let{flags:r,positionals:i}=M(n,L.tag),a=r,o=a.delete===!0,s=R(a,`list`),c=a.annotate===!0,l=R(a,`message`),u=a.force===!0;if(o){let n=i[0];return n?(await gn({fs:e.lfs,dir:t,ref:n}),{stdout:`Deleted tag '${n}'\n`,stderr:``,exitCode:0}):{stdout:``,stderr:`fatal: tag name required
|
|
181
|
-
`,exitCode:128}}if(s!==void 0||i.length===0){let n=await Xt({fs:e.lfs,dir:t}),r=n,i=s||void 0;if(i){let e=RegExp(`^`+i.replace(/\*/g,`.*`)+`$`);r=n.filter(t=>e.test(t))}return{stdout:r.map(e=>`${e}\n`).join(``),stderr:``,exitCode:0}}let d=i[0],f=i[1];if(c||l){let n=await e.resolveAuthor(t);await Nn({fs:e.lfs,cache:e.cache,dir:t,ref:d,message:l??d,object:f,tagger:{...n,timestamp:Math.floor(Date.now()/1e3),timezoneOffset:0},force:u})}else await fn({fs:e.lfs,dir:t,ref:d,object:f,force:u});return{stdout:``,stderr:``,exitCode:0}}function Ff(e,t){let n=e===`dir`?16877:e===`symlink`?40960:33188;if(t===void 0)return n;let r=t&4095;return n&61440|r}function If(e,t){let n=t.mtimeMs??0;return{type:e,mode:Ff(e,t.mode),size:t.size??0,ino:t.ino??0,mtimeMs:n,ctimeMs:t.ctimeMs??n,uid:t.uid??1,gid:t.gid??1,dev:1,isFile:()=>e===`file`,isDirectory:()=>e===`dir`,isSymbolicLink:()=>e===`symlink`}}function Lf(e){return{size:e.size,mtimeMs:e.mtime,ctimeMs:e.ctime,...e.ino===void 0?{}:{ino:e.ino},...e.uid===void 0?{}:{uid:e.uid},...e.gid===void 0?{}:{gid:e.gid},...e.mode===void 0?{}:{mode:e.mode}}}function Rf(e){if(typeof e==`string`)return/^utf-?8$/i.test(e);if(e&&typeof e==`object`){let t=e.encoding;if(typeof t==`string`)return/^utf-?8$/i.test(t)}return!1}function zf(e){if(!e||typeof e!=`object`)return null;let{start:t,end:n}=e;return typeof t!=`number`||typeof n!=`number`?null:{start:t,end:n}}const Bf=`/objects/pack`,Vf=/^(.*\/objects)\/([0-9a-f]{2})\/[0-9a-f]{38,}$/,Hf=/\/objects\/[0-9a-f]{2}$/;function Uf(e){return e.endsWith(Bf)||Hf.test(e)}function Wf(e){let t=Xe(e);return e.type===`directory`?t?{type:`dir`,stats:t}:{type:`dir`}:t?{type:`file`,stats:t}:void 0}function Gf(e){let t=/* @__PURE__ */ new Map;return{prime(n,r){if(r.length>e){t.clear();return}t.size+r.length>e&&t.clear();let i=x(n),a=i===`/`?`/`:`${i}/`;for(let e of r){let n=Wf(e);n?t.set(`${a}${e.name}`,n):t.delete(`${a}${e.name}`)}},get(e){let n=t.get(x(e));if(n)return If(n.type,n.stats?Lf(n.stats):{})},drop(e){t.delete(x(e))},clear(){t.clear()},size(){return t.size}}}function Kf(e,t={}){let n=t.objectCache?{packDirs:/* @__PURE__ */ new Map,fanouts:/* @__PURE__ */ new Map}:void 0,r=Gf(Math.max(0,t.statCacheMax??1e5)),i=async t=>{let n=await e.readDir(t,Uf(t)?void 0:{includeStats:!0});return r.prime(t,n),n.map(e=>e.name)},a=(e,t)=>{let n=e.fanouts.get(t);if(n!=null)return n;let r=i(t).then(e=>new Set(e));return e.fanouts.set(t,r),r},o=async e=>{if(!n)return!1;let t=Vf.exec(e);if(!t)return!1;try{return!(await a(n,t[1])).has(t[2])}catch{return!1}},s=()=>{n?.packDirs.clear(),n?.fanouts.clear()},c=async(e,t)=>(r.drop(e),await l(t)),l=async e=>{s();try{return await e()}finally{s()}};return{promises:{async readFile(t,n){if(await o(t))throw new Ze(`ENOENT`,`no such file or directory`,t);let r=zf(n);return r?await e.readFileRange(t,r.start,r.end):await e.readFile(t,Rf(n)?{encoding:`utf-8`}:{encoding:`binary`})},async writeFile(t,n,r){await c(t,()=>e.writeFile(t,n))},async unlink(t){await c(t,()=>e.rm(t))},async readdir(e){if(!n||!e.endsWith(Bf))return await i(e);let t=n.packDirs.get(e);if(t!=null)return[...await t];let r=i(e);return n.packDirs.set(e,r),[...await r]},async mkdir(t,n){let r=n??void 0;await c(t,()=>e.mkdir(t,r?.recursive===void 0?void 0:{recursive:r.recursive}))},async rmdir(t){r.clear(),await l(()=>e.rm(t))},async stat(t){let n=r.get(t);if(n)return n;let i=await e.stat(t);return If(i.type===`directory`?`dir`:`file`,Lf(i))},async lstat(t){let n=r.get(t);if(n)return n;let i=await e.lstat(t);return If(i.type===`directory`?`dir`:i.type===`symlink`?`symlink`:`file`,Lf(i))},async readlink(t){if(e.isPathUnderMount(t))throw new Ze(`EINVAL`,`symlinks not supported on mounted filesystems`,t);return e.readlink(t)},async symlink(t,n){if(e.isPathUnderMount(n))throw new Ze(`EINVAL`,`symlinks not supported on mounted filesystems`,n);await c(n,()=>e.symlink(t,n))}},clearStatCache(){r.clear()},statCacheSize(){return r.size()}}}const qf={maxEntries:5e4,maxFileBytes:1048576,maxTotalBytes:8388608},Jf=/* @__PURE__ */ new Set([`ENOENT`,`ENOTDIR`,`EISDIR`]);function Yf(e){return e.endsWith(`.pack`)||e.endsWith(`.idx`)}function Xf(e){let t=e.replace(/\/{2,}/g,`/`);return t.length>1&&t.endsWith(`/`)?t.slice(0,-1):t}function Zf(e){let t=e.lastIndexOf(`/`);return t<0?`.`:t===0?`/`:e.slice(0,t)}function Qf(e){let t=e?.code;return typeof t==`string`?t:void 0}function $f(e){return typeof e==`string`?e.length*2:e.byteLength}function ep(e,t){return`${t?`u`:`b`} ${e}`}var tp=class{limits;stats=/* @__PURE__ */ new Map;lstats=/* @__PURE__ */ new Map;dirs=/* @__PURE__ */ new Map;files=/* @__PURE__ */ new Map;fileBytes=/* @__PURE__ */ new Map;retainedBytes=0;constructor(e){this.limits=e}hasRoom(){return this.stats.size+this.lstats.size+this.dirs.size+this.files.size<this.limits.maxEntries}retainFile(e,t){let n=$f(t);return n>this.limits.maxFileBytes||this.retainedBytes+n>this.limits.maxTotalBytes?!1:(this.fileBytes.set(e,n),this.retainedBytes+=n,!0)}dropFile(e){let t=this.fileBytes.get(e);t!==void 0&&(this.fileBytes.delete(e),this.retainedBytes-=t)}forgetSelf(e){this.stats.delete(e),this.lstats.delete(e),this.dirs.delete(e);for(let t of[ep(e,!0),ep(e,!1)])this.files.delete(t),this.dropFile(t)}invalidatePath(e){let t=Xf(e);this.forgetSelf(t);let n=Zf(t);this.dirs.delete(n),this.stats.delete(n),this.lstats.delete(n)}invalidateSubtree(e){let t=Xf(e),n=`${t}/`;for(let e of[this.stats,this.lstats,this.dirs])for(let t of e.keys())t.startsWith(n)&&e.delete(t);for(let e of this.files.keys())e.slice(2).startsWith(n)&&(this.files.delete(e),this.dropFile(e));this.invalidatePath(t)}};function np(e,t,n,r){let i=e.get(t);if(i!=null)return i;let a=n();if(!r.admit())return a;e.set(t,a);let o=()=>{e.get(t)===a&&e.delete(t)};return a.then(e=>{r.keep&&!r.keep(e)&&o()},e=>{Jf.has(Qf(e)??``)||o()}),a}function rp(e,t={}){let n=new tp({...qf,...t}),r=()=>n.hasRoom(),i=async t=>(await np(n.dirs,Xf(t),()=>e.readdir(t),{admit:r})).slice(),a=async(t,i)=>{if(Yf(t))return e.readFile(t,i);let a=ep(Xf(t),Rf(i)),o=await np(n.files,a,()=>e.readFile(t,i),{admit:r,keep:e=>n.retainFile(a,e)});return typeof o==`string`?o:new Uint8Array(o)},o=(e,t)=>n=>np(e,Xf(n),()=>t(n),{admit:r}),s=async(e,t,r=!1)=>{try{return await t()}finally{r?n.invalidateSubtree(e):n.invalidatePath(e)}};return{readFile:a,readdir:i,stat:o(n.stats,t=>e.stat(t)),lstat:o(n.lstats,t=>e.lstat(t)),readlink:t=>e.readlink(t),writeFile:(t,n,r)=>s(t,()=>e.writeFile(t,n,r)),unlink:t=>s(t,()=>e.unlink(t),!0),rmdir:t=>s(t,()=>e.rmdir(t),!0),mkdir:(t,n)=>s(t,()=>e.mkdir(t,n)),symlink:(t,n)=>s(n,()=>e.symlink(t,n))}}const ip=e(`git-cache`);function ap(e){for(let t of Object.getOwnPropertySymbols(e)){if(t.description!==`PackfileCache`)continue;let n=e[t];if(n instanceof Map)return n}}function op(e){return`${e.replace(/\/+$/,``)}/.git`}var sp=class{fs;cache={};signatures=/* @__PURE__ */ new Map;inFlight=0;maxResidentPacks;constructor(e,t={}){this.fs=e,this.maxResidentPacks=Math.max(1,t.maxResidentPacks??4)}setDeepVerification(e){this.cache.skipDeepPackVerification=!e}async beforeCommand(e){this.inFlight++;let t=op(e),n=this.signatures.get(t);if(n===void 0)return;let r=await this.packSignature(t);n!==r&&this.invalidate(e),this.signatures.set(t,r)}async afterCommand(e,t={}){this.inFlight=Math.max(0,this.inFlight-1);let n=op(e);t.wrotePacks&&(this.invalidate(e),this.signatures.delete(n)),this.inFlight===0&&(await this.evictFailedPacks(),await this.trimResidentPacks()),!this.signatures.has(n)&&this.hasCachedPacks(n)&&this.signatures.set(n,await this.packSignature(n))}async evictFailedPacks(){let e=ap(this.cache);if(e)for(let[t,n]of[...e]){let r;try{r=await n}catch{e.delete(t);continue}if(!r)e.delete(t);else if(r.pack)try{await r.pack||(r.pack=null)}catch{r.pack=null}}}hasCachedPacks(e){let t=ap(this.cache);if(!t)return!1;let n=`${e}/objects/pack/`;for(let e of t.keys())if(e.startsWith(n))return!0;return!1}invalidate(e){let t=`${op(e)}/objects/pack/`,n=ap(this.cache);if(n)for(let e of[...n.keys()])e.startsWith(t)&&n.delete(e)}async residentPackCount(){return(await this.residentPacks()).length}async packSignature(e){let t=[];try{t=(await this.fs.readdir(`${e}/objects/pack`)).filter(e=>e.endsWith(`.idx`)||e.endsWith(`.pack`)).sort()}catch{}let n=`-`;try{n=String((await this.fs.lstat(`${e}/packed-refs`)).mtimeMs)}catch{}return`${t.join(`,`)}|${n}`}async residentPacks(){let e=ap(this.cache);if(!e)return[];let t=[];for(let[n,r]of e){let e;try{e=await r}catch{continue}e?.pack&&t.push({key:n,index:e,usedAt:e._lastUsedAt??0})}return t.sort((e,t)=>e.usedAt-t.usedAt),t.map(({key:e,index:t})=>({key:e,index:t}))}async trimResidentPacks(){let e=await this.residentPacks();if(e.length<=this.maxResidentPacks)return;let t=e.slice(0,e.length-this.maxResidentPacks);for(let{index:e}of t)e.pack=null;ip.debug(`unloaded packfile buffers past the resident bound`,{unloaded:t.length,resident:this.maxResidentPacks})}};const cp=e(`git-commands`),lp=/* @__PURE__ */ new Set([`clone`,`fetch`,`pull`,`push`,`ls-remote`]),up=/* @__PURE__ */ new Set([`clone`,`fetch`,`pull`]),dp=/* @__PURE__ */ new Set([`add`,`branch`,`commit`,`diff`,`init`,`log`,`ls-files`,`ls-tree`,`merge-base`,`rev-parse`,`show`,`show-ref`,`status`,`symbolic-ref`,`tag`]),fp={string:[`c`,`C`,`git-dir`,`work-tree`],boolean:[`help`,`version`,`no-pager`,`paginate`,`no-replace-objects`,`color`],alias:{h:`help`},stopEarly:!0};function pp(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).map(e=>String(e))}function mp(e,t){if(e instanceof Map){let n=e.get(t);return n&&n.length>0?n:void 0}let n=e[t];return n&&n.length>0?n:void 0}var hp=class e{options;static globalFsByDbName=/* @__PURE__ */ new Map;lfs;corsProxy;authorName;authorEmail;globalDbName;githubToken;currentEnv;currentConfigOverrides;currentStdin=``;cacheManager;constructor(e){this.options=e,this.lfs=Kf(e.fs,{statCacheMax:0}).promises,this.corsProxy=e.corsProxy,this.authorName=e.authorName??`User`,this.authorEmail=e.authorEmail??`user@example.com`,this.globalDbName=e.globalDbName??`slicc-fs-global`,this.cacheManager=new sp(this.lfs,{...e.maxResidentPacks===void 0?{}:{maxResidentPacks:e.maxResidentPacks}})}contextFor(e,t){let n=Kf(this.options.fs,{objectCache:!0}),r=dp.has(e)?rp(n.promises):n.promises,i=this.createOnAuthFailure();return{ctx:{lfs:r,fs:this.options.fs,cache:this.cacheManager.cache,corsProxy:this.corsProxy,getOnAuth:()=>this.getOnAuth(),getOnAuthFailure:()=>i,resolveAuthor:e=>this.resolveAuthor(e,r),getGlobalFs:()=>this.getGlobalFs(),setGithubToken:e=>this.setGithubToken(e),getGithubToken:()=>this.githubToken,setDefaultAuthorName:e=>{this.authorName=e},setDefaultAuthorEmail:e=>{this.authorEmail=e},getConfigOverrides:()=>this.currentConfigOverrides,stdin:this.currentStdin,useColor:t},client:n}}getOnAuth(){let e=this.resolveAuthToken();if(e)return()=>({username:`x-access-token`,password:e})}createOnAuthFailure(){if(!this.options.ensureFreshGithubToken)return;let e=!1;return async()=>{if(e)return;e=!0;try{await this.options.ensureFreshGithubToken?.({force:!0})}catch(e){cp.warn(`GitHub token force-renew after 401 failed`,{error:e instanceof Error?e.message:String(e)});return}await this.loadGithubToken();let t=this.resolveAuthToken();if(t)return{username:`x-access-token`,password:t}}}resolveAuthToken(e=this.currentEnv){if(this.githubToken)return this.githubToken;if(!e)return;let t=mp(e,`GH_TOKEN`);if(t)return t;let n=mp(e,`GITHUB_TOKEN`);if(n)return n}async githubCredential(e,t){return await this.ensureFreshGithubToken(t),await this.loadGithubToken(),this.resolveAuthToken(e)}async identity(){let e=await this.getGlobalFs();return{name:await or(e,`user.name`)??this.authorName,email:await or(e,`user.email`)??this.authorEmail}}getGlobalFs(){let t=e.globalFsByDbName.get(this.globalDbName);if(t!=null)return t;let n=st.create({dbName:this.globalDbName});return e.globalFsByDbName.set(this.globalDbName,n),n}async loadGithubToken(){try{let e=(await(await this.getGlobalFs()).readTextFile(`/workspace/.git/github-token`)).trim();this.githubToken=e||void 0}catch{this.githubToken=void 0}}async ensureFreshGithubToken(e){try{await this.options.ensureFreshGithubToken?.(e)}catch(e){cp.warn(`GitHub token freshness check failed; continuing with existing auth`,{error:e instanceof Error?e.message:String(e)})}}async setGithubToken(e){let t=e.trim(),n=await this.getGlobalFs();if(t)await n.writeFile(`/workspace/.git/github-token`,t),this.githubToken=t;else{try{await n.rm(`/workspace/.git/github-token`)}catch{}this.githubToken=void 0}}async resolveAuthor(e,t){let n=async n=>{try{return await un({fs:t,dir:e,path:n})}catch{return}},r=this.currentConfigOverrides,i=await this.getGlobalFs();return{name:r?.get(`user.name`)??await n(`user.name`)??await or(i,`user.name`)??this.authorName,email:r?.get(`user.email`)??await n(`user.email`)??await or(i,`user.email`)??this.authorEmail}}async execute(e,t,n,r,i){if(e.length===0)return this.help();let a=this.stripGlobalFlags(mc(e),t);if(a.versionRequested&&a.remainingArgs.length===0)return this.version();if(a.helpRequested||a.remainingArgs.length===0)return this.help();let o=a.effectiveCwd,[s,...c]=a.remainingArgs,l=L[s]??{},u=M(c,l),d=Object.hasOwn(l.alias??{},`h`);if(u.flags.help||u.flags.h&&!d)return this.help();this.currentEnv=n,this.currentConfigOverrides=a.configOverrides,this.currentStdin=r??``;let f=this.invocationColor(e,n,a.configOverrides,i),{ctx:p,client:m}=this.contextFor(s,f);try{return this.cacheManager.setDeepVerification(this.shouldVerifyPackfiles()),await this.cacheManager.beforeCommand(o),lp.has(s)&&await this.ensureFreshGithubToken(),await this.loadGithubToken(),await this.dispatch(s,p,o,c)}catch(e){return{stdout:``,stderr:`fatal: ${ic(e)}\n`,exitCode:128}}finally{await this.cacheManager.afterCommand(o,{wrotePacks:up.has(s)}),this.currentEnv=void 0,this.currentConfigOverrides=void 0,this.currentStdin=``,m.clearStatCache()}}async dispatch(e,t,n,r){switch(e){case`init`:return await vu(t,n,r);case`clone`:return await Jc(t,n,r);case`add`:return await Ws(t,n,r);case`status`:return await gf(t,n,r);case`commit`:return await dl(t,n,r);case`log`:return await Eu(t,n,r);case`ls-remote`:return await Yu(t,n,r);case`branch`:return await yc(t,n,r);case`checkout`:return await bc(t,n,r);case`clean`:return await zc(t,n,r);case`diff`:return await Jl(t,n,r);case`show`:return await Kd(t,n,r);case`remote`:return await Md(t,n,r);case`fetch`:return await gu(t,n,r);case`pull`:return await ud(t,n,r);case`push`:return await dd(t,n,r);case`merge`:return await id(t,n,r);case`merge-base`:return await sd(t,n,r);case`cherry-pick`:return await Lc(t,n,r);case`rebase`:return await md(t,n,r);case`revert`:return await Bd(t,n,r);case`merge-file`:return await ld(t,n,r);case`reset`:return await Nd(t,n,r);case`config`:return await wl(t,n,r);case`tag`:return await Pf(t,n,r);case`ls-files`:return await Ku(t,n,r);case`ls-tree`:return await Zu(t,n,r);case`show-ref`:return await Yd(t,n,r);case`symbolic-ref`:return await Nf(t,n,r);case`stash`:return await ef(t,n,r);case`rm`:return await Wd(t,n,r);case`mv`:{let{mv:e}=await import(`./mv-DeUDSLZ6.js`);return await e(t,n,r)}case`rev-parse`:return await zd(t,n,r);case`help`:return this.help();case`version`:return this.version();default:return{stdout:``,stderr:`git: '${e}' is not a git command. See 'git help'.\n`,exitCode:127}}}invocationColor(e,t,n,r){return _c({cliWhen:pc(e),colorUi:n?.get(`color.ui`),noColorEnv:!!(t&&mp(t,`NO_COLOR`)),stdoutIsTTY:r?.stdoutIsTTY===!0,term:t?mp(t,`TERM`):void 0})}shouldVerifyPackfiles(){let e=this.currentEnv,t=e?mp(e,`SLICC_GIT_VERIFY_PACKS`):void 0;return t===void 0?this.options.verifyPackfiles===!0:t!==`0`&&t.toLowerCase()!==`false`}stripGlobalFlags(e,t){let n=M(e,fp),r=t;for(let e of pp(n.flags.C))e!==``&&(r=e.startsWith(`/`)?e:`${r}/${e}`);let i=/* @__PURE__ */ new Map;for(let e of pp(n.flags.c)){if(e===``)continue;let t=e.indexOf(`=`);t<0?i.set(e.toLowerCase(),``):i.set(e.slice(0,t).toLowerCase(),e.slice(t+1))}return{effectiveCwd:r,remainingArgs:n.positionals,helpRequested:!!(n.flags.help||n.flags.h),versionRequested:!!n.flags.version,configOverrides:i}}version(){return{stdout:`git version 2.43.0 (isomorphic-git ${mn()})\n`,stderr:``,exitCode:0}}help(){return{stdout:`usage: git <command> [<args>]
|
|
181
|
+
`,exitCode:128}}if(s!==void 0||i.length===0){let n=await Xt({fs:e.lfs,dir:t}),r=n,i=s||void 0;if(i){let e=RegExp(`^`+i.replace(/\*/g,`.*`)+`$`);r=n.filter(t=>e.test(t))}return{stdout:r.map(e=>`${e}\n`).join(``),stderr:``,exitCode:0}}let d=i[0],f=i[1];if(c||l){let n=await e.resolveAuthor(t);await Nn({fs:e.lfs,cache:e.cache,dir:t,ref:d,message:l??d,object:f,tagger:{...n,timestamp:Math.floor(Date.now()/1e3),timezoneOffset:0},force:u})}else await fn({fs:e.lfs,dir:t,ref:d,object:f,force:u});return{stdout:``,stderr:``,exitCode:0}}function Ff(e,t){let n=e===`dir`?16877:e===`symlink`?40960:33188;if(t===void 0)return n;let r=t&4095;return n&61440|r}function If(e,t){let n=t.mtimeMs??0;return{type:e,mode:Ff(e,t.mode),size:t.size??0,ino:t.ino??0,mtimeMs:n,ctimeMs:t.ctimeMs??n,uid:t.uid??1,gid:t.gid??1,dev:1,isFile:()=>e===`file`,isDirectory:()=>e===`dir`,isSymbolicLink:()=>e===`symlink`}}function Lf(e){return{size:e.size,mtimeMs:e.mtime,ctimeMs:e.ctime,...e.ino===void 0?{}:{ino:e.ino},...e.uid===void 0?{}:{uid:e.uid},...e.gid===void 0?{}:{gid:e.gid},...e.mode===void 0?{}:{mode:e.mode}}}function Rf(e){if(typeof e==`string`)return/^utf-?8$/i.test(e);if(e&&typeof e==`object`){let t=e.encoding;if(typeof t==`string`)return/^utf-?8$/i.test(t)}return!1}function zf(e){if(!e||typeof e!=`object`)return null;let{start:t,end:n}=e;return typeof t!=`number`||typeof n!=`number`?null:{start:t,end:n}}const Bf=`/objects/pack`,Vf=/^(.*\/objects)\/([0-9a-f]{2})\/[0-9a-f]{38,}$/,Hf=/\/objects\/[0-9a-f]{2}$/;function Uf(e){return e.endsWith(Bf)||Hf.test(e)}function Wf(e){let t=Xe(e);return e.type===`directory`?t?{type:`dir`,stats:t}:{type:`dir`}:t?{type:`file`,stats:t}:void 0}function Gf(e){let t=/* @__PURE__ */ new Map;return{prime(n,r){if(r.length>e){t.clear();return}t.size+r.length>e&&t.clear();let i=x(n),a=i===`/`?`/`:`${i}/`;for(let e of r){let n=Wf(e);n?t.set(`${a}${e.name}`,n):t.delete(`${a}${e.name}`)}},get(e){let n=t.get(x(e));if(n)return If(n.type,n.stats?Lf(n.stats):{})},drop(e){t.delete(x(e))},clear(){t.clear()},size(){return t.size}}}function Kf(e,t={}){let n=t.objectCache?{packDirs:/* @__PURE__ */ new Map,fanouts:/* @__PURE__ */ new Map}:void 0,r=Gf(Math.max(0,t.statCacheMax??1e5)),i=async t=>{let n=await e.readDir(t,Uf(t)?void 0:{includeStats:!0});return r.prime(t,n),n.map(e=>e.name)},a=(e,t)=>{let n=e.fanouts.get(t);if(n!=null)return n;let r=i(t).then(e=>new Set(e));return e.fanouts.set(t,r),r},o=async e=>{if(!n)return!1;let t=Vf.exec(e);if(!t)return!1;try{return!(await a(n,t[1])).has(t[2])}catch{return!1}},s=()=>{n?.packDirs.clear(),n?.fanouts.clear()},c=async(e,t)=>(r.drop(e),await l(t)),l=async e=>{s();try{return await e()}finally{s()}};return{promises:{async readFile(t,n){if(await o(t))throw new Ze(`ENOENT`,`no such file or directory`,t);let r=zf(n);return r?await e.readFileRange(t,r.start,r.end):await e.readFile(t,Rf(n)?{encoding:`utf-8`}:{encoding:`binary`})},async writeFile(t,n,r){await c(t,()=>e.writeFile(t,n))},async unlink(t){await c(t,()=>e.rm(t))},async readdir(e){if(!n||!e.endsWith(Bf))return await i(e);let t=n.packDirs.get(e);if(t!=null)return[...await t];let r=i(e);return n.packDirs.set(e,r),[...await r]},async mkdir(t,n){let r=n??void 0;await c(t,()=>e.mkdir(t,r?.recursive===void 0?void 0:{recursive:r.recursive}))},async rmdir(t){r.clear(),await l(()=>e.rm(t))},async stat(t){let n=r.get(t);if(n)return n;let i=await e.stat(t);return If(i.type===`directory`?`dir`:`file`,Lf(i))},async lstat(t){let n=r.get(t);if(n)return n;let i=await e.lstat(t);return If(i.type===`directory`?`dir`:i.type===`symlink`?`symlink`:`file`,Lf(i))},async readlink(t){if(e.isPathUnderMount(t))throw new Ze(`EINVAL`,`symlinks not supported on mounted filesystems`,t);return e.readlink(t)},async symlink(t,n){if(e.isPathUnderMount(n))throw new Ze(`EINVAL`,`symlinks not supported on mounted filesystems`,n);await c(n,()=>e.symlink(t,n))}},clearStatCache(){r.clear()},statCacheSize(){return r.size()}}}const qf={maxEntries:5e4,maxFileBytes:1048576,maxTotalBytes:8388608},Jf=/* @__PURE__ */ new Set([`ENOENT`,`ENOTDIR`,`EISDIR`]);function Yf(e){return e.endsWith(`.pack`)||e.endsWith(`.idx`)}function Xf(e){let t=e.replace(/\/{2,}/g,`/`);return t.length>1&&t.endsWith(`/`)?t.slice(0,-1):t}function Zf(e){let t=e.lastIndexOf(`/`);return t<0?`.`:t===0?`/`:e.slice(0,t)}function Qf(e){let t=e?.code;return typeof t==`string`?t:void 0}function $f(e){return typeof e==`string`?e.length*2:e.byteLength}function ep(e,t){return`${t?`u`:`b`} ${e}`}var tp=class{limits;stats=/* @__PURE__ */ new Map;lstats=/* @__PURE__ */ new Map;dirs=/* @__PURE__ */ new Map;files=/* @__PURE__ */ new Map;fileBytes=/* @__PURE__ */ new Map;retainedBytes=0;constructor(e){this.limits=e}hasRoom(){return this.stats.size+this.lstats.size+this.dirs.size+this.files.size<this.limits.maxEntries}retainFile(e,t){let n=$f(t);return n>this.limits.maxFileBytes||this.retainedBytes+n>this.limits.maxTotalBytes?!1:(this.fileBytes.set(e,n),this.retainedBytes+=n,!0)}dropFile(e){let t=this.fileBytes.get(e);t!==void 0&&(this.fileBytes.delete(e),this.retainedBytes-=t)}forgetSelf(e){this.stats.delete(e),this.lstats.delete(e),this.dirs.delete(e);for(let t of[ep(e,!0),ep(e,!1)])this.files.delete(t),this.dropFile(t)}invalidatePath(e){let t=Xf(e);this.forgetSelf(t);let n=Zf(t);this.dirs.delete(n),this.stats.delete(n),this.lstats.delete(n)}invalidateSubtree(e){let t=Xf(e),n=`${t}/`;for(let e of[this.stats,this.lstats,this.dirs])for(let t of e.keys())t.startsWith(n)&&e.delete(t);for(let e of this.files.keys())e.slice(2).startsWith(n)&&(this.files.delete(e),this.dropFile(e));this.invalidatePath(t)}};function np(e,t,n,r){let i=e.get(t);if(i!=null)return i;let a=n();if(!r.admit())return a;e.set(t,a);let o=()=>{e.get(t)===a&&e.delete(t)};return a.then(e=>{r.keep&&!r.keep(e)&&o()},e=>{Jf.has(Qf(e)??``)||o()}),a}function rp(e,t={}){let n=new tp({...qf,...t}),r=()=>n.hasRoom(),i=async t=>(await np(n.dirs,Xf(t),()=>e.readdir(t),{admit:r})).slice(),a=async(t,i)=>{if(Yf(t))return e.readFile(t,i);let a=ep(Xf(t),Rf(i)),o=await np(n.files,a,()=>e.readFile(t,i),{admit:r,keep:e=>n.retainFile(a,e)});return typeof o==`string`?o:new Uint8Array(o)},o=(e,t)=>n=>np(e,Xf(n),()=>t(n),{admit:r}),s=async(e,t,r=!1)=>{try{return await t()}finally{r?n.invalidateSubtree(e):n.invalidatePath(e)}};return{readFile:a,readdir:i,stat:o(n.stats,t=>e.stat(t)),lstat:o(n.lstats,t=>e.lstat(t)),readlink:t=>e.readlink(t),writeFile:(t,n,r)=>s(t,()=>e.writeFile(t,n,r)),unlink:t=>s(t,()=>e.unlink(t),!0),rmdir:t=>s(t,()=>e.rmdir(t),!0),mkdir:(t,n)=>s(t,()=>e.mkdir(t,n)),symlink:(t,n)=>s(n,()=>e.symlink(t,n))}}const ip=e(`git-cache`);function ap(e){for(let t of Object.getOwnPropertySymbols(e)){if(t.description!==`PackfileCache`)continue;let n=e[t];if(n instanceof Map)return n}}function op(e){return`${e.replace(/\/+$/,``)}/.git`}var sp=class{fs;cache={};signatures=/* @__PURE__ */ new Map;inFlight=0;maxResidentPacks;constructor(e,t={}){this.fs=e,this.maxResidentPacks=Math.max(1,t.maxResidentPacks??4)}setDeepVerification(e){this.cache.skipDeepPackVerification=!e}async beforeCommand(e){this.inFlight++;let t=op(e),n=this.signatures.get(t);if(n===void 0)return;let r=await this.packSignature(t);n!==r&&this.invalidate(e),this.signatures.set(t,r)}async afterCommand(e,t={}){this.inFlight=Math.max(0,this.inFlight-1);let n=op(e);t.wrotePacks&&(this.invalidate(e),this.signatures.delete(n)),this.inFlight===0&&(await this.evictFailedPacks(),await this.trimResidentPacks()),!this.signatures.has(n)&&this.hasCachedPacks(n)&&this.signatures.set(n,await this.packSignature(n))}async evictFailedPacks(){let e=ap(this.cache);if(e)for(let[t,n]of[...e]){let r;try{r=await n}catch{e.delete(t);continue}if(!r)e.delete(t);else if(r.pack)try{await r.pack||(r.pack=null)}catch{r.pack=null}}}hasCachedPacks(e){let t=ap(this.cache);if(!t)return!1;let n=`${e}/objects/pack/`;for(let e of t.keys())if(e.startsWith(n))return!0;return!1}invalidate(e){let t=`${op(e)}/objects/pack/`,n=ap(this.cache);if(n)for(let e of[...n.keys()])e.startsWith(t)&&n.delete(e)}async residentPackCount(){return(await this.residentPacks()).length}async packSignature(e){let t=[];try{t=(await this.fs.readdir(`${e}/objects/pack`)).filter(e=>e.endsWith(`.idx`)||e.endsWith(`.pack`)).sort()}catch{}let n=`-`;try{n=String((await this.fs.lstat(`${e}/packed-refs`)).mtimeMs)}catch{}return`${t.join(`,`)}|${n}`}async residentPacks(){let e=ap(this.cache);if(!e)return[];let t=[];for(let[n,r]of e){let e;try{e=await r}catch{continue}e?.pack&&t.push({key:n,index:e,usedAt:e._lastUsedAt??0})}return t.sort((e,t)=>e.usedAt-t.usedAt),t.map(({key:e,index:t})=>({key:e,index:t}))}async trimResidentPacks(){let e=await this.residentPacks();if(e.length<=this.maxResidentPacks)return;let t=e.slice(0,e.length-this.maxResidentPacks);for(let{index:e}of t)e.pack=null;ip.debug(`unloaded packfile buffers past the resident bound`,{unloaded:t.length,resident:this.maxResidentPacks})}};const cp=e(`git-commands`),lp=/* @__PURE__ */ new Set([`clone`,`fetch`,`pull`,`push`,`ls-remote`]),up=/* @__PURE__ */ new Set([`clone`,`fetch`,`pull`]),dp=/* @__PURE__ */ new Set([`add`,`branch`,`commit`,`diff`,`init`,`log`,`ls-files`,`ls-tree`,`merge-base`,`rev-parse`,`show`,`show-ref`,`status`,`symbolic-ref`,`tag`]),fp={string:[`c`,`C`,`git-dir`,`work-tree`],boolean:[`help`,`version`,`no-pager`,`paginate`,`no-replace-objects`,`color`],alias:{h:`help`},stopEarly:!0};function pp(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).map(e=>String(e))}function mp(e,t){if(e instanceof Map){let n=e.get(t);return n&&n.length>0?n:void 0}let n=e[t];return n&&n.length>0?n:void 0}var hp=class e{options;static globalFsByDbName=/* @__PURE__ */ new Map;lfs;corsProxy;authorName;authorEmail;globalDbName;githubToken;currentEnv;currentConfigOverrides;currentStdin=``;cacheManager;constructor(e){this.options=e,this.lfs=Kf(e.fs,{statCacheMax:0}).promises,this.corsProxy=e.corsProxy,this.authorName=e.authorName??`User`,this.authorEmail=e.authorEmail??`user@example.com`,this.globalDbName=e.globalDbName??`slicc-fs-global`,this.cacheManager=new sp(this.lfs,{...e.maxResidentPacks===void 0?{}:{maxResidentPacks:e.maxResidentPacks}})}contextFor(e,t){let n=Kf(this.options.fs,{objectCache:!0}),r=dp.has(e)?rp(n.promises):n.promises,i=this.createOnAuthFailure();return{ctx:{lfs:r,fs:this.options.fs,cache:this.cacheManager.cache,corsProxy:this.corsProxy,getOnAuth:()=>this.getOnAuth(),getOnAuthFailure:()=>i,resolveAuthor:e=>this.resolveAuthor(e,r),getGlobalFs:()=>this.getGlobalFs(),setGithubToken:e=>this.setGithubToken(e),getGithubToken:()=>this.githubToken,setDefaultAuthorName:e=>{this.authorName=e},setDefaultAuthorEmail:e=>{this.authorEmail=e},getConfigOverrides:()=>this.currentConfigOverrides,stdin:this.currentStdin,useColor:t},client:n}}getOnAuth(){let e=this.resolveAuthToken();if(e)return()=>({username:`x-access-token`,password:e})}createOnAuthFailure(){if(!this.options.ensureFreshGithubToken)return;let e=!1;return async()=>{if(e)return;e=!0;try{await this.options.ensureFreshGithubToken?.({force:!0})}catch(e){cp.warn(`GitHub token force-renew after 401 failed`,{error:e instanceof Error?e.message:String(e)});return}await this.loadGithubToken();let t=this.resolveAuthToken();if(t)return{username:`x-access-token`,password:t}}}resolveAuthToken(e=this.currentEnv){if(this.githubToken)return this.githubToken;if(!e)return;let t=mp(e,`GH_TOKEN`);if(t)return t;let n=mp(e,`GITHUB_TOKEN`);if(n)return n}async githubCredential(e,t){return await this.ensureFreshGithubToken(t),await this.loadGithubToken(),this.resolveAuthToken(e)}async identity(){let e=await this.getGlobalFs();return{name:await or(e,`user.name`)??this.authorName,email:await or(e,`user.email`)??this.authorEmail}}getGlobalFs(){let t=e.globalFsByDbName.get(this.globalDbName);if(t!=null)return t;let n=st.create({dbName:this.globalDbName});return e.globalFsByDbName.set(this.globalDbName,n),n}async loadGithubToken(){try{let e=(await(await this.getGlobalFs()).readTextFile(`/workspace/.git/github-token`)).trim();this.githubToken=e||void 0}catch{this.githubToken=void 0}}async ensureFreshGithubToken(e){try{await this.options.ensureFreshGithubToken?.(e)}catch(e){cp.warn(`GitHub token freshness check failed; continuing with existing auth`,{error:e instanceof Error?e.message:String(e)})}}async setGithubToken(e){let t=e.trim(),n=await this.getGlobalFs();if(t)await n.writeFile(`/workspace/.git/github-token`,t),this.githubToken=t;else{try{await n.rm(`/workspace/.git/github-token`)}catch{}this.githubToken=void 0}}async resolveAuthor(e,t){let n=async n=>{try{return await un({fs:t,dir:e,path:n})}catch{return}},r=this.currentConfigOverrides,i=await this.getGlobalFs();return{name:r?.get(`user.name`)??await n(`user.name`)??await or(i,`user.name`)??this.authorName,email:r?.get(`user.email`)??await n(`user.email`)??await or(i,`user.email`)??this.authorEmail}}async execute(e,t,n,r,i){if(e.length===0)return this.help();let a=this.stripGlobalFlags(mc(e),t);if(a.versionRequested&&a.remainingArgs.length===0)return this.version();if(a.helpRequested||a.remainingArgs.length===0)return this.help();let o=a.effectiveCwd,[s,...c]=a.remainingArgs,l=L[s]??{},u=M(c,l),d=Object.hasOwn(l.alias??{},`h`);if(u.flags.help||u.flags.h&&!d)return this.help();this.currentEnv=n,this.currentConfigOverrides=a.configOverrides,this.currentStdin=r??``;let f=this.invocationColor(e,n,a.configOverrides,i),{ctx:p,client:m}=this.contextFor(s,f);try{return this.cacheManager.setDeepVerification(this.shouldVerifyPackfiles()),await this.cacheManager.beforeCommand(o),lp.has(s)&&await this.ensureFreshGithubToken(),await this.loadGithubToken(),await this.dispatch(s,p,o,c)}catch(e){return{stdout:``,stderr:`fatal: ${ic(e)}\n`,exitCode:128}}finally{await this.cacheManager.afterCommand(o,{wrotePacks:up.has(s)}),this.currentEnv=void 0,this.currentConfigOverrides=void 0,this.currentStdin=``,m.clearStatCache()}}async dispatch(e,t,n,r){switch(e){case`init`:return await vu(t,n,r);case`clone`:return await Jc(t,n,r);case`add`:return await Ws(t,n,r);case`status`:return await gf(t,n,r);case`commit`:return await dl(t,n,r);case`log`:return await Eu(t,n,r);case`ls-remote`:return await Yu(t,n,r);case`branch`:return await yc(t,n,r);case`checkout`:return await bc(t,n,r);case`clean`:return await zc(t,n,r);case`diff`:return await Jl(t,n,r);case`show`:return await Kd(t,n,r);case`remote`:return await Md(t,n,r);case`fetch`:return await gu(t,n,r);case`pull`:return await ud(t,n,r);case`push`:return await dd(t,n,r);case`merge`:return await id(t,n,r);case`merge-base`:return await sd(t,n,r);case`cherry-pick`:return await Lc(t,n,r);case`rebase`:return await md(t,n,r);case`revert`:return await Bd(t,n,r);case`merge-file`:return await ld(t,n,r);case`reset`:return await Nd(t,n,r);case`config`:return await wl(t,n,r);case`tag`:return await Pf(t,n,r);case`ls-files`:return await Ku(t,n,r);case`ls-tree`:return await Zu(t,n,r);case`show-ref`:return await Yd(t,n,r);case`symbolic-ref`:return await Nf(t,n,r);case`stash`:return await ef(t,n,r);case`rm`:return await Wd(t,n,r);case`mv`:{let{mv:e}=await import(`./mv-In9d6DMc.js`);return await e(t,n,r)}case`rev-parse`:return await zd(t,n,r);case`help`:return this.help();case`version`:return this.version();default:return{stdout:``,stderr:`git: '${e}' is not a git command. See 'git help'.\n`,exitCode:127}}}invocationColor(e,t,n,r){return _c({cliWhen:pc(e),colorUi:n?.get(`color.ui`),noColorEnv:!!(t&&mp(t,`NO_COLOR`)),stdoutIsTTY:r?.stdoutIsTTY===!0,term:t?mp(t,`TERM`):void 0})}shouldVerifyPackfiles(){let e=this.currentEnv,t=e?mp(e,`SLICC_GIT_VERIFY_PACKS`):void 0;return t===void 0?this.options.verifyPackfiles===!0:t!==`0`&&t.toLowerCase()!==`false`}stripGlobalFlags(e,t){let n=M(e,fp),r=t;for(let e of pp(n.flags.C))e!==``&&(r=e.startsWith(`/`)?e:`${r}/${e}`);let i=/* @__PURE__ */ new Map;for(let e of pp(n.flags.c)){if(e===``)continue;let t=e.indexOf(`=`);t<0?i.set(e.toLowerCase(),``):i.set(e.slice(0,t).toLowerCase(),e.slice(t+1))}return{effectiveCwd:r,remainingArgs:n.positionals,helpRequested:!!(n.flags.help||n.flags.h),versionRequested:!!n.flags.version,configOverrides:i}}version(){return{stdout:`git version 2.43.0 (isomorphic-git ${mn()})\n`,stderr:``,exitCode:0}}help(){return{stdout:`usage: git <command> [<args>]
|
|
182
182
|
|
|
183
183
|
Available commands:
|
|
184
184
|
init Initialize a new repository
|
|
@@ -350,7 +350,7 @@ Examples:
|
|
|
350
350
|
skill list
|
|
351
351
|
skill info bluebubbles
|
|
352
352
|
skill read bluebubbles
|
|
353
|
-
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-
|
|
353
|
+
`,stderr:``,exitCode:0};let r=t[0],i=await import(`./kernel-worker-YV_DbHm3.js`).then(e=>e.r);try{switch(r){case`list`:return Hh(t,e,i,n.env.get(`PATH`));case`info`:{let n=t[1];if(!n)return{stdout:``,stderr:`skill: info requires a skill name
|
|
354
354
|
`,exitCode:1};let r=await i.getSkillInfo(e,n);return r?{stdout:Bh(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
|
|
355
355
|
`,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+`
|
|
356
356
|
`,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 Wh=[{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=>ea(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 Gh(e){let t={skills:[],dryRun:!1,json:!1};for(let n=0;n<e.length;n++){let r=e[n],i=Wh.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 Kh(e,t){return!e||!t||e.byteLength!==t.byteLength?!1:e.every((e,n)=>e===t[n])}async function qh(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 Jh(e,t,n,r){let i=await qh(e,t);return Bi(n)?i?{status:`kept-local`,write:!1}:{status:`added`,write:!0}:i?Kh(i,r)?{status:`unchanged`,write:!1}:{status:`updated`,write:!0}:{status:`added`,write:!0}}async function Yh(e,t,n,r){let i={changes:[],writes:[],removals:[]};for(let[r,a]of n){let n=`${t}/${r}`,{status:o,write:s}=await Jh(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 Vi(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 Xh(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 Ki(t),d=await Ji(s,c,o.ref,u,!0,l||void 0);if(d&&r.sha===d&&await Zh(e,n,r))return{...o,to:d,outcome:`current`,changes:[]};let f=await Qh(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 Yh(e,`${Ni}/${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 rg(e,{changes:h,writes:g,removals:_}),await Yi(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 Zh(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 Qh(e,t,n,r,i,a,o){let s=await Ui(e,t,a,i??`main`);if(s.status===`ok`){let i=Ri(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:ng(i,a),path:a}}try{return{files:tg(eg(await Hi(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 eg(e){return new Map([...e].filter(([e])=>zi(e)))}function tg(e){return new Map([...e].sort(([e],[t])=>e.localeCompare(t)))}function ng(e,t){let n=t?`${t}/`:``,r=/* @__PURE__ */ new Map;for(let[t,i]of Object.entries(e)){if(!t.startsWith(n)||t.endsWith(`/`))continue;let e=t.slice(n.length);zi(e)&&r.set(e,i)}return tg(r)}async function rg(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 ig(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 Fh(o,s,t);if(!c.ok)return{...a,outcome:`error`,error:c.error};let l=`${Ni}/${n}/SKILL.md`,u=await qh(e,l),d=new TextEncoder().encode(c.content),f=u!==void 0&&Nh(new TextDecoder().decode(u))===Nh(c.content);if(Kh(u,d)||f)return{...a,changes:[{path:`SKILL.md`,status:`unchanged`}]};let p=u?`updated`:`added`;return i||(await e.mkdir(`${Ni}/${n}`,{recursive:!0}),await e.writeFile(l,d),await Yi(e,n,{...r,files:[`SKILL.md`]})),{...a,outcome:`updated`,changes:[{path:`SKILL.md`,status:p}]}}function ag(e,t){if(e.outcome===`error`)return` ${e.skill}: failed — ${e.error}\n`;let n=/* @__PURE__ */ new Map;for(let t of e.changes)n.set(t.status,(n.get(t.status)??0)+1);let r=e.to&&e.to!==e.from?` → ${e.to.slice(0,7)}`:``;if(e.outcome===`current`)return` ${e.skill}: already current (${e.source}${r})\n`;let i=t?`would update`:`updated`,a=` ${e.skill}: ${i} from ${e.source}${r}\n`;for(let t of e.changes)t.status!==`unchanged`&&(a+=` ${t.status.padEnd(10)} ${t.path}\n`);let o=n.get(`kept-local`)??0;return o>0&&(a+=` (${o} kept-local — dotfiles and local additions are never touched)\n`),a}function og(e,t,n,r){let i=ea(t);return i?{version:1,kind:`github`,source:`${i.owner}/${i.repo}`,skill:e,ref:r??i.branch,path:n??i.path,installed:(/* @__PURE__ */ new Date()).toISOString()}:null}async function sg(e,t,n){if(t.length===0){let t=await qi(e);return{targets:t.provenanced,missing:[],skipped:t.unattributed}}let r=[],i=[];for(let a of t){let t=await Xi(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?og(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 cg(e){return e.reason===`not-installed`?`upskill: no skill named "${e.name}" is installed — check \`upskill list\`
|
|
@@ -361,7 +361,7 @@ Examples:
|
|
|
361
361
|
`}function dg(e,t,n,r,i){let a=t?`Skill update (dry run — nothing written):
|
|
362
362
|
`:`Skill update:
|
|
363
363
|
`;for(let n of e)a+=ag(n,t);if(i.length>0&&(a+=ug(i)),!n&&r&&e.length>0){let n=i.length>0?`all ${lg(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 fg(e,t,n){let{targets:r,missing:i,skipped:a}=await sg(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 ig(e,t,i.name,i.provenance,n.dryRun):await Xh(e,t,i.name,i.provenance,n.branch,n.dryRun));return{results:o,skipped:a,missing:i}}async function pg(e,t,n){let r=Gh(e);if(r.error)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{results:i,missing:a,skipped:o}=await fg(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`:dg([],r.dryRun,!1,!0,o),stderr:``,exitCode:0}:{stdout:``,stderr:a.length?a.map(cg).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 $i();let l=a.map(cg).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:dg(i,r.dryRun,c,u,o),stderr:l,exitCode:+!u}}function mg(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 hg(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 gg(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}${hg(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(`
|
|
364
|
-
`)}\n`}async function _g(e,t,n){let r=await(await import(`./kernel-worker-
|
|
364
|
+
`)}\n`}async function _g(e,t,n){let r=await(await import(`./kernel-worker-YV_DbHm3.js`).then(e=>e.r)).discoverSkills(e),{collisions:i}=await Cr(e,br(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${Lh()}`,stderr:``,exitCode:0}:{...xr(`upskill`,zh(r,`Discoverable local skills`),i,{builtinNames:new Set(mt())}),exitCode:0}}async function vg(e,t,n){let{results:r,skipped:i}=await fg(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:gg(r,i),stderr:c,exitCode:+!s}}async function yg(e,t,n,r){let i=mg(e);return i.error?{stdout:``,stderr:`${i.error}\n`,exitCode:1}:i.outdated?vg(t,n,i.json):_g(t,i.json,r)}async function bg(e,t){let n=`${Pi}/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(Gi(e,n))}if(r.status!==200)throw Error(`Tessl returned HTTP ${r.status}`);let i=ke(r.body);if(!i.data)return[];let a=/* @__PURE__ */ new Map;for(let e of i.data){if(e.type!==`skill`)continue;let t=e.attributes,n=Qi(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 xg(e,t){let n=`${Pi}/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: ${Gi(e,n)}`}}if(r.status!==200)return{error:`Tessl search failed (HTTP ${r.status})`};let i=ke(r.body).data?.find(t=>t.type===`skill`&&t.attributes.name===e);if(!i)return{error:`skill "${e}" not found on Tessl registry`};let a=Qi(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 Sg=[{label:`Tessl`,host:new URL(Pi).host,fetch:bg},{label:`browse.sh`,host:new URL(Li).host,fetch:Dh}];function Cg(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 wg(e,t,n=1){let r=await Promise.allSettled(Sg.map(n=>n.fetch(e,t))),i=r.map(e=>e.status===`fulfilled`?e.value:[]),a=r.every(e=>e.status===`rejected`),o=Cg(i),s=``;for(let e=0;e<r.length;e++){let t=r[e];if(t.status===`rejected`){let n=Sg[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+=`
|
|
365
365
|
`}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:
|
|
366
366
|
`,p+=` From Tessl: upskill <owner/repo> --skill <name>
|
|
367
367
|
`,p+=` From browse.sh: upskill browse:<hostname>/<task>
|
|
@@ -384,7 +384,7 @@ Examples:
|
|
|
384
384
|
`,{stdout:s,stderr:``,exitCode:0}}function jg(e){return!e||e.startsWith(`-`)?{stdout:``,stderr:`upskill: --branch requires a value
|
|
385
385
|
`,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
|
|
386
386
|
`,exitCode:1}}function Mg(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
|
|
387
|
-
`,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=jg(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 Ng(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-
|
|
387
|
+
`,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=jg(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 Ng(e,t,n){if(!t)return{stdout:``,stderr:`upskill: ${e} requires a skill name\n`,exitCode:1};let r=await import(`./kernel-worker-YV_DbHm3.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 Xi(n,t),a=i?Zi(i):"Installed from: (no provenance recorded — reinstall to enable `upskill update`)\n";return{stdout:Bh(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+`
|
|
388
388
|
`,stderr:``,exitCode:0}}async function Pg(e,t,n,r,i,a,o,s){let c=``,l=``,u=0,d=e.length;for(let f=0;f<e.length;f++){let p=e[f],m=await na(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 Fg(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 ta(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 Ig(e,t,n,r,i,a,o,s){let c=``,l=``,u=0;for(let d of e){let e=await ta(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 Lg(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 Rg(e,t,n,r){let{owner:i,repo:a}=e,o=t.branch??e.branch,s=t.subPath??e.path,c=await Ki(r),l=await ra(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:Lg(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:Lg(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 Ui(i,a,r,o);if(e.status===`ok`){let r=await Ji(i,a,o,c,!0,s),l=await Pg(u,i,a,Ri(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 Fg(u,i,a,c,n,t.force,o,f);({output:p,errors:m,successCount:h}=e)}}else({output:p,errors:m,successCount:h}=await Ig(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 $i()),{stdout:p,stderr:m,exitCode:+!!m}}async function zg(e,t,n,r,i){switch(e[0]){case`tabs`:return kg(t,n,r,e.includes(`--json`));case`recommendations`:return Ag(t,n,e.includes(`--install`));case`update`:case`upgrade`:return pg(e.slice(1),t,n);case`list`:return yg(e.slice(1),t,n,i);case`info`:case`read`:return Ng(e[0],e[1],t);case`search`:return Vg(e,n);default:return null}}function Bg(e,t,n){return C(`upskill`,async(r,i)=>{if(r.length===0||r.includes(`--help`)||r.includes(`-h`))return Vh();let a=await zg(r,e,t,n,i.env.get(`PATH`));if(a)return a;let o=Mg(r);if(o.earlyReturn)return o.earlyReturn;if(!o.sourceRef)return Vh();if(o.sourceRef.startsWith(`tessl:`))return Hg(o.sourceRef,o.force,e,t);let s=Ah(o.sourceRef);if(s)return Ih(s.hostname,s.task,e,t,o.force);let c=ea(o.sourceRef);return c?Rg(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 Vg(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?wg(a,t,i):Vh()}async function Hg(e,t,n,r){let i=e.slice(6);if(!i)return{stdout:``,stderr:`upskill: tessl: requires a skill name
|
|
389
389
|
`,exitCode:1};let a=await xg(i,r);if(`error`in a)return{stdout:``,stderr:`upskill: ${a.error}\n`,exitCode:1};let o=await Ki(r);return ta(a.owner,a.repo,a.skillPath,a.skillName,n,o,t,r)}function Ug(){return{stdout:`usage: afplay [-v volume] [-r rate] <file>
|
|
390
390
|
|
|
@@ -687,7 +687,7 @@ Examples:
|
|
|
687
687
|
`;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+=`
|
|
688
688
|
`;return t}async function Ny(e,t){let n=w(e.slice(1),{});if(`error`in n)return Ay(n.error);if(!t()){let e=await Cy();if(!e)return Ey(`list`);let t=await e.listCronTasks();return t.length===0?{stdout:`No active cron tasks
|
|
689
689
|
`,stderr:``,exitCode:0}:{stdout:My(t),stderr:``,exitCode:0}}let{ok:r,data:i}=await Oy(`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
|
|
690
|
-
`,stderr:``,exitCode:0}:{stdout:My(a),stderr:``,exitCode:0}}async function Py(e,t){let n=e[0],r=w(e.slice(1),{});if(`error`in r)return Ay(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 Cy();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}:Ey(`delete`)}let{ok:a,status:o,data:s}=await Oy(`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 Fy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return C(`crontask`,async(e,n)=>{let r=e[0];if(!r||T(e,{valueFlags:ky}))return Dy();try{switch(r){case`create`:return await jy(e,n.env,t);case`list`:return await Ny(e,t);case`delete`:case`kill`:return await Py(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 Iy(e){return C(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-
|
|
690
|
+
`,stderr:``,exitCode:0}:{stdout:My(a),stderr:``,exitCode:0}}async function Py(e,t){let n=e[0],r=w(e.slice(1),{});if(`error`in r)return Ay(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 Cy();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}:Ey(`delete`)}let{ok:a,status:o,data:s}=await Oy(`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 Fy(e={}){let t=e.hasLocalNodeServer??(()=>!1);return C(`crontask`,async(e,n)=>{let r=e[0];if(!r||T(e,{valueFlags:ky}))return Dy();try{switch(r){case`create`:return await jy(e,n.env,t);case`list`:return await Ny(e,t);case`delete`:case`kill`:return await Py(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 Iy(e){return C(`curlwright`,async(t,n)=>{let{runCurlwright:r}=await import(`./run-DDkVkRRP.js`);return r(e,t,n)})}function Ly(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 Ry(e){return Ly(e,{si:!1})}const zy=`slicc-fs`;async function By(){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===zy)}catch{return!0}}async function Vy(){let e=globalThis.indexedDB;return e?new Promise(t=>{let n;try{n=e.deleteDatabase(zy)}catch{t(`error`);return}n.onsuccess=()=>t(`deleted`),n.onerror=()=>t(`error`),n.onblocked=()=>t(`blocked`)}):`error`}async function Hy(){if(!await By())return{kind:`absent`,message:`legacy slicc-fs IDB not present — nothing to clean`};let e=await Vy();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 Uy(){return`slicc-fs-cleanup — delete the legacy slicc-fs IndexedDB
|
|
691
691
|
|
|
692
692
|
Usage:
|
|
693
693
|
slicc-fs-cleanup Delete the legacy slicc-fs IDB.
|
|
@@ -1144,7 +1144,7 @@ Options:
|
|
|
1144
1144
|
`,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}},PT=`/.playwright`;function FT(e,t){return e?`${t.replace(/\/+$/,``)}${PT}`:PT}async function IT(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(!Qn(e))throw e}t.sessionDirsCreated.add(n)}}async function LT(e,t,n,r,i){try{return await e.withTab(n,async e=>{let{url:a,title:o,text:s,refs:c}=await ve(e,he(r,n)),l={url:a,title:o,refs:c,content:s,timestamp:Date.now()};r.snapshots.set(n,l);let u=[`Page URL: ${a}`,`Page Title: ${o}`,``,s].join(`
|
|
1145
1145
|
`),d=`${i}/snapshots/page-${Yn(/* @__PURE__ */ new Date)}.yml`;return await t.writeFile(d,u),d})}catch{return null}}async function RT(e,t,n,r){await IT(e,t,n);let i=(/* @__PURE__ */ 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(`
|
|
1146
1146
|
`)+`
|
|
1147
|
-
`,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 zT(){return import(`./snapshot-features-
|
|
1147
|
+
`,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 zT(){return import(`./snapshot-features-8gj7Uhyp.js`)}async function BT(e,t,n,r){let i=he(t,n),a=await e.getAccessibilityTreeForFrame(r.frameId,{refFloor:i.floor});se(i,a);let o=/* @__PURE__ */ new Map,s=me(a,o,``,ge(i,r.frameId),r.frameId).join(`
|
|
1148
1148
|
`);return t.snapshots.set(n,{url:r.url,title:r.name,refs:o,content:s,timestamp:Date.now()}),s}async function VT(e,t,n){let{objectId:r,entry:i}=await y(e,t,n);return de(i,n,`screenshot`),await pe(e,r,`function() {
|
|
1149
1149
|
this.scrollIntoView({ block: 'center' });
|
|
1150
1150
|
const r = this.getBoundingClientRect();
|
|
@@ -1216,7 +1216,7 @@ Options:
|
|
|
1216
1216
|
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1217
1217
|
return el.files.length;
|
|
1218
1218
|
})()`,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`,XT],[`state-load`,ZT],[`console`,kC],[`requests`,vT],[`request`,yT],[`request-headers`,bT],[`request-body`,xT],[`response-headers`,ST],[`response-body`,CT],[`mousemove`,Sw],[`mousedown`,Cw],[`mouseup`,ww],[`mousewheel`,Tw],[`drop`,Ew],[`route`,jT],[`route-list`,MT],[`unroute`,NT],[`generate-locator`,BC],[`highlight`,VC]]);function bE(){let e=(Jn.string??[]).map(e=>`--${e}`),t=new Set(Jn.boolean??[]);for(let[e,n]of Object.entries(Jn.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 xE(e){return e.map(e=>e===`--no-iframes`||e.startsWith(`--no-iframes=`)?e.replace(`--no-iframes`,`--_noiframes`):e)}function SE(e){return{...e,bool:[...e.bool??[],`--_noiframes`],value:[...e.value??[],`--_noiframes`]}}const CE=2e3;function wE(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 TE(e,t,n,r){if(!t||typeof e.getTabLockStats!=`function`)return r;let i=e.getTabLockStats(),a=i.totalWaitMs-t.totalWaitMs;if(a<CE)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>=CE?`${(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.
|
|
1219
|
-
`;return{...r,stderr:r.stderr+c}}async function EE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await nr(e,t.tab,n):null)??r}\n`,exitCode:1}}function DE(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 OE(e,t,n){let r=yE.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?DE(e,t,void 0):a}catch(r){return i?.aborted?DE(e,t,r):await EE(n.browser,n.flags,r)}}async function kE(e,t,n,r){let i=w(xE(n),SE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=qn(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-
|
|
1219
|
+
`;return{...r,stderr:r.stderr+c}}async function EE(e,t,n){let r=n instanceof Error?n.message:String(n);return{stdout:``,stderr:`Error: ${(t.tab?await nr(e,t.tab,n):null)??r}\n`,exitCode:1}}function DE(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 OE(e,t,n){let r=yE.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?DE(e,t,void 0):a}catch(r){return i?.aborted?DE(e,t,r):await EE(n.browser,n.flags,r)}}async function kE(e,t,n,r){let i=w(xE(n),SE(r));if(`error`in i)return{answer:{stdout:``,stderr:`${e} ${t}: ${i.error}\n`,exitCode:1}};let a;try{({flags:a}=qn(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-dVqxBQgR.js`);return{answer:{stdout:n(e,t),stderr:``,exitCode:0}}}let o=null;try{let{validateSubcommandArgs:r}=await import(`./validate-args-qrOSmbMv.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 AE(e,t,n,r={}){let i=t?Kn(t,n):null,a=bE();return C(e,async(o,s)=>{if(o.length===0||o[0]===`help`||o[0]===`--help`||o[0]===`-h`){let{formatHelp:t}=await import(`./help-dVqxBQgR.js`);return{stdout:t(e)+`
|
|
1220
1220
|
`,stderr:``,exitCode:0}}let c=o[0],l=o.slice(1),u=await kE(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=wE(t,p),h=fa(s.env),g=FT(r.isScoop?.()??!1,h),_=await OE(e,c,{browser:t,fs:n,state:i,positional:d,flags:f,scratchDir:h,sessionRoot:g,onTab:(e,n)=>t.withTab(e,async e=>{try{return await n(e)}finally{await e.releaseObjects?.().catch(()=>void 0)}},{signal:s.signal}),signal:s.signal}),v=f.tab??null,ee=null;tr.has(c)&&_.exitCode===0&&v&&(ee=await LT(t,n,v,i,g));try{await RT(n,i,g,{command:c,args:l,result:_,snapshotPath:ee,targetId:v})}catch{}return TE(t,m,p,ee&&er.has(c)?{..._,stdout:`${_.stdout}Snapshot: ${ee}\n`}:_)})}const jE=/* @__PURE__ */ 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`,/* @__PURE__ */ `echo.printf.env.printenv.export.alias.unalias.history.clear.true.false.bash.sh.commands.which.uname.man.host.oauth-token.secret.nuke.models.local-llm.cost.hostname.whoami.id.help.sleep.time.timeout.oauth-domain`.split(`.`)],[`Data processing`,[`xargs`,`jq`,`base64`,`date`,`expr`,`seq`]],[`Hashes`,[`md5sum`,`sha1sum`,`sha256sum`]],[`Network`,[`curl`,`curlwright`,`wget`,`dig`,`websocat`,`html-to-markdown`]],[`Version control`,[`git`]],[`Languages`,[`node`,`jsh`,`python`,`python3`,`pyodide`,`sqlite3`]],[`Virtualization`,[`v86`,`computer`]],[`Build tools`,[`tsc`,`tst`,`esbuild`,`biome`]],[`Packages`,[`ipk`,`hf`,`npm`,`i`,`ipx`,`npx`]],[`Skills`,[`skill`,`upskill`]],[`Browser & UI`,[`serve`,`open`,`imgcat`,...$n,`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)`,[...c_]]]);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:
|
|
1221
1221
|
`);let a=[];for(let[e,t]of jE){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(`
|
|
1222
1222
|
`)+`
|
|
@@ -1320,7 +1320,7 @@ Options:
|
|
|
1320
1320
|
`,exitCode:1};let i=[];for(let e of r.positionals){let t=n.fs.resolvePath(n.cwd,e);if(!(await n.fs.stat(t)).isFile)return{stdout:``,stderr:`imgcat: not a file: ${e}\n`,exitCode:1};let r=Le(t);if(!Ie(r))return{stdout:``,stderr:`imgcat: unsupported media type: ${e}\n`,exitCode:1};let a=await n.fs.readFileBuffer(t),o=new Uint8Array(a.byteLength);o.set(a),i.push({path:t,mimeType:r,bytes:o})}try{return await e.onMediaPreview(i),{stdout:``,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`imgcat: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}})}const zD=/* @__PURE__ */ new Set([`run`,`run-script`]),BD=/* @__PURE__ */ new Set([`test`,`start`,`stop`,`restart`]),VD=/* @__PURE__ */ new Set([` `,` `,`
|
|
1321
1321
|
`,`;`,`|`,`&`,`(`,`)`,`{`,`}`,`<`,`>`]),HD=/* @__PURE__ */ new Set([`;`,`|`,`&`,`(`,`)`,`{`,`
|
|
1322
1322
|
`]),UD=/^[A-Za-z_][A-Za-z0-9_]*=/,WD=/^[@A-Za-z0-9._-]+$/,GD=/* @__PURE__ */ new Set([`if`,`then`,`else`,`elif`,`fi`,`for`,`while`,`until`,`do`,`done`,`case`,`in`,`esac`,`function`,`time`,`!`]),KD=/* @__PURE__ */ new Set([`if`,`then`,`else`,`elif`,`while`,`until`,`do`,`time`,`!`]),qD=/* @__PURE__ */ new Set([`ipx`,`npx`]);function JD(e){return`'${e.replace(/'/g,`'\\''`)}'`}async function YD(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}function*XD(e){let t=x(e);for(;yield t,t!==`/`;)t=Ge(t).dir}function ZD(e){if(typeof e!=`object`||!e)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function QD(e){return typeof e==`string`?e:void 0}async function $D(e,t){for(let n of XD(t)){let t=S(n,`package.json`);if(!await e.exists(t))continue;let r;try{r=JSON.parse(await YD(e,t))}catch(e){throw Error(`${t} is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}return{dir:n,name:QD(r.name),version:QD(r.version),scripts:ZD(r.scripts)}}return null}function eO(e,t){let n=t,r=``;for(;n<e.length;){let t=e[n];if(r!==``)t===`\\`&&r===`"`?n++:t===r&&(r=``),n++;else if(t===`'`||t===`"`)r=t,n++;else if(t===`\\`)n+=2;else{if(VD.has(t))break;n++}}return{start:t,end:n,text:e.slice(t,n)}}function tO(e){let t=[],n=0,r=!0;for(;n<e.length;){let i=e[n];if(i===` `||i===` `){n++;continue}if(HD.has(i)){r=!0,n++;continue}let a=eO(e,n);if(a.end===a.start)n++;else{if(r&&!UD.test(a.text)){if(KD.has(a.text)){n=a.end;continue}t.push(a),r=!1}n=a.end}}return t}function nO(e,t){return!WD.test(e)||GD.has(e)||qD.has(e)?!1:!t.isRegistered(e)}async function rO(e,t){let n=tO(e).filter(e=>nO(e.text,t));if(n.length===0)return e;let r=[];for(let e of n)await t.hasLocalBin(e.text)&&r.push(e);if(r.length===0)return e;let i=e;for(let e of[...r].reverse())i=`${i.slice(0,e.start)}ipx ${i.slice(e.start)}`;return i}function iO(e){let t=[];for(let n of XD(e))t.push(S(n,`node_modules`,`.bin`));return t}function aO(e,t,n,r){let i=r.env.get(`PATH`)??``,a={PATH:[...iO(e.dir),i].filter(e=>e!==``).join(`:`),npm_lifecycle_event:t,npm_lifecycle_script:n};return e.name!==void 0&&(a.npm_package_name=e.name),e.version!==void 0&&(a.npm_package_version=e.version),a}function oO(e){return e.name===void 0?e.dir:e.version===void 0?e.name:`${e.name}@${e.version}`}function sO(e,t){let n=Object.entries(t.scripts);if(n.length===0)return`${e}: no scripts defined in ${S(t.dir,`package.json`)}\n`;let r=[`Scripts available in ${oO(t)} via \`${e} run\`:`];for(let[e,t]of n)r.push(` ${e}`),r.push(` ${t}`);return`${r.join(`
|
|
1323
|
-
`)}\n`}function cO(e,t){return t===`--silent`||t===`-s`?(e.silent=!0,!0):t===`--if-present`&&(e.ifPresent=!0,!0)}function lO(e){let t={silent:!1,ifPresent:!1},n=[],r,i=!1;for(let a of e)i?n.push(a):a===`--`?i=!0:cO(t,a)||(r===void 0?r=a:n.push(a));return{flags:t,script:r,extraArgs:n}}function uO(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}function dO(e,t,n,r){let i=r.length>0?` ${r.map(JD).join(` `)}`:``,a=[],o=e.scripts[`pre${t}`];o!==void 0&&a.push({event:`pre${t}`,body:o}),a.push({event:t,body:`${n}${i}`});let s=e.scripts[`post${t}`];return s!==void 0&&a.push({event:`post${t}`,body:s}),a}async function fO(e,t,n,r){if(n===`start`&&await r.exists(S(t.dir,`server.js`)))return`node server.js`;if(n===`restart`)return`${e} stop --if-present && ${e} start`}function pO(e,t,n){let r=new Set(n.getRegisteredCommands?.()??[]);return{isRegistered:e=>r.has(e),hasLocalBin:async n=>{for(let r of iO(t.dir))if(await e.exists(S(r,n)))return!0;return!1}}}async function mO(e,t,n,r,i,a){let o=i.exec;if(!o)return uO(e,`run requires shell exec support, which this context does not provide`);let s=pO(a.fs,t,i),c=oO(t),l=``,u=``;for(let a of n){r.silent||(l+=`\n> ${c} ${a.event}\n> ${a.body}\n\n`);let n=await o(await rO(a.body,s),{cwd:t.dir,env:aO(t,a.event,a.body,i),stdin:cr(i.stdin),stdinKind:`bytes`});if(l+=n.stdout,u+=n.stderr,n.exitCode!==0)return u+=`${e}: script '${a.event}' exited with code ${n.exitCode}\n`,{stdout:l,stderr:u,exitCode:n.exitCode}}return{stdout:l,stderr:u,exitCode:0}}async function hO(e,t,n,r){let i;try{i=await $D(r.fs,n.cwd)}catch(t){return uO(e,t instanceof Error?t.message:String(t))}if(!i)return uO(e,`no package.json found in ${n.cwd} or any parent directory — nothing to run`);let{flags:a,script:o,extraArgs:s}=lO(t);if(o===void 0)return{stdout:sO(e,i),stderr:``,exitCode:0};let c=i.scripts[o]??await fO(e,i,o,r.fs)??void 0;if(c===void 0){if(a.ifPresent)return{stdout:``,stderr:``,exitCode:0};let t=Object.keys(i.scripts);return uO(e,`missing script: ${o}${t.length>0?` (available: ${t.join(`, `)})`:` (${S(i.dir,`package.json`)} defines no scripts)`}`)}return mO(e,i,dO(i,o,c,s),a,n,r)}const gO=()=>import(`./installer-
|
|
1323
|
+
`)}\n`}function cO(e,t){return t===`--silent`||t===`-s`?(e.silent=!0,!0):t===`--if-present`&&(e.ifPresent=!0,!0)}function lO(e){let t={silent:!1,ifPresent:!1},n=[],r,i=!1;for(let a of e)i?n.push(a):a===`--`?i=!0:cO(t,a)||(r===void 0?r=a:n.push(a));return{flags:t,script:r,extraArgs:n}}function uO(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}function dO(e,t,n,r){let i=r.length>0?` ${r.map(JD).join(` `)}`:``,a=[],o=e.scripts[`pre${t}`];o!==void 0&&a.push({event:`pre${t}`,body:o}),a.push({event:t,body:`${n}${i}`});let s=e.scripts[`post${t}`];return s!==void 0&&a.push({event:`post${t}`,body:s}),a}async function fO(e,t,n,r){if(n===`start`&&await r.exists(S(t.dir,`server.js`)))return`node server.js`;if(n===`restart`)return`${e} stop --if-present && ${e} start`}function pO(e,t,n){let r=new Set(n.getRegisteredCommands?.()??[]);return{isRegistered:e=>r.has(e),hasLocalBin:async n=>{for(let r of iO(t.dir))if(await e.exists(S(r,n)))return!0;return!1}}}async function mO(e,t,n,r,i,a){let o=i.exec;if(!o)return uO(e,`run requires shell exec support, which this context does not provide`);let s=pO(a.fs,t,i),c=oO(t),l=``,u=``;for(let a of n){r.silent||(l+=`\n> ${c} ${a.event}\n> ${a.body}\n\n`);let n=await o(await rO(a.body,s),{cwd:t.dir,env:aO(t,a.event,a.body,i),stdin:cr(i.stdin),stdinKind:`bytes`});if(l+=n.stdout,u+=n.stderr,n.exitCode!==0)return u+=`${e}: script '${a.event}' exited with code ${n.exitCode}\n`,{stdout:l,stderr:u,exitCode:n.exitCode}}return{stdout:l,stderr:u,exitCode:0}}async function hO(e,t,n,r){let i;try{i=await $D(r.fs,n.cwd)}catch(t){return uO(e,t instanceof Error?t.message:String(t))}if(!i)return uO(e,`no package.json found in ${n.cwd} or any parent directory — nothing to run`);let{flags:a,script:o,extraArgs:s}=lO(t);if(o===void 0)return{stdout:sO(e,i),stderr:``,exitCode:0};let c=i.scripts[o]??await fO(e,i,o,r.fs)??void 0;if(c===void 0){if(a.ifPresent)return{stdout:``,stderr:``,exitCode:0};let t=Object.keys(i.scripts);return uO(e,`missing script: ${o}${t.length>0?` (available: ${t.join(`, `)})`:` (${S(i.dir,`package.json`)} defines no scripts)`}`)}return mO(e,i,dO(i,o,c,s),a,n,r)}const gO=()=>import(`./installer-BT1UlNuS.js`),_O=/* @__PURE__ */ new Set([`install`,`i`,`add`]),vO=/* @__PURE__ */ new Set([`uninstall`,`remove`,`rm`,`un`]),yO=/* @__PURE__ */ new Set([`list`,`ls`]),bO=/* @__PURE__ */ new Set([`-g`,`--global`,`--location=global`]),xO=[`-g`,`--global`,`-D`,`--save-dev`];function SO(e){return`${e} - install packages from the npm registry into node_modules
|
|
1324
1324
|
and run package.json scripts; also install conda/emscripten-forge
|
|
1325
1325
|
packages via '${e} mamba'
|
|
1326
1326
|
|
|
@@ -1401,7 +1401,7 @@ be pruned, so it is replaced by the best match, with an ERESOLVE "replacing
|
|
|
1401
1401
|
peer dependency" warning.
|
|
1402
1402
|
Existing fields are preserved. Idempotent: re-installing an already-satisfied package is a clean
|
|
1403
1403
|
no-op.
|
|
1404
|
-
`}function CO(e){let t=w(e,{bool:xO,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 wO(e){let t=!1,n=[];for(let r of e)bO.has(r)?t=!0:r.startsWith(`-`)||n.push(r);return{global:t,specs:n}}function TO(e){return T(e)}function EO(e){return e instanceof Error?e.message:String(e)}async function DO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function OO(e,t){let n=e===`i`;return C(e,async(r,i)=>{if(n)return TO(r)?{stdout:SO(e),stderr:``,exitCode:0}:AO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-
|
|
1404
|
+
`}function CO(e){let t=w(e,{bool:xO,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 wO(e){let t=!1,n=[];for(let r of e)bO.has(r)?t=!0:r.startsWith(`-`)||n.push(r);return{global:t,specs:n}}function TO(e){return T(e)}function EO(e){return e instanceof Error?e.message:String(e)}async function DO(e){e.scriptCatalog?.invalidateJsh(),await e.syncScriptCommands?.()}function OO(e,t){let n=e===`i`;return C(e,async(r,i)=>{if(n)return TO(r)?{stdout:SO(e),stderr:``,exitCode:0}:AO(e,r,i,t);if(r[0]===`mamba`){let{runIpkMamba:n}=await import(`./ipk-mamba-DSygFTTQ.js`);return n(e,r.slice(1),i,t)}if(TO(r))return{stdout:SO(e),stderr:``,exitCode:0};if(r.length===0)return{stdout:SO(e),stderr:`${e}: missing subcommand\n`,exitCode:1};let a=r[0],o=r.slice(1);return _O.has(a)?AO(e,o,i,t):vO.has(a)?MO(e,o,i,t):yO.has(a)?NO(e,o,i,t):a===`root`?PO(e,o,i,t):zD.has(a)?hO(e,o,i,{fs:t.fs}):BD.has(a)?hO(e,r,i,{fs:t.fs}):{stdout:``,stderr:`${e}: unknown subcommand '${a}' (supported: install, uninstall, list, root, run, mamba)\n`,exitCode:1}})}async function kO(e,t,n){let{installFromManifest:r,ManifestNotFoundError:i}=await gO(),a;try{a=await r({fs:n.fs,fetch:n.fetch,cwd:t.cwd})}catch(t){return t instanceof i?{stdout:``,stderr:`${e}: ${t.message}\n`,exitCode:1}:{stdout:``,stderr:`${e}: install failed: ${EO(t)}\n`,exitCode:1}}if(a.empty&&a.errors.length===0)return{stdout:`${e}: nothing to install (package.json declares no dependencies)\n`,stderr:``,exitCode:0};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),s=[...(a.notes??[]).map(t=>`${e}: ${t}`),...a.errors.map(t=>`${e}: failed to install ${t.spec}: ${EO(t.error)}`)];return{stdout:o.length>0?`${o.join(`
|
|
1405
1405
|
`)}\n`:``,stderr:s.length>0?`${s.join(`
|
|
1406
1406
|
`)}\n`:``,exitCode:a.errors.length===0?0:1}}async function AO(e,t,n,r){let i=CO(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 kO(e,n,r);let{installPackages:c}=await gO(),l;try{l=await c(s,{fs:r.fs,fetch:r.fetch,cwd:n.cwd,global:a,saveDev:o})}catch(t){return{stdout:``,stderr:`${e}: install failed: ${EO(t)}\n`,exitCode:1}}let u=l.results.map(t=>`${e}: installed ${t.name}@${t.version} -> ${t.installPath}`),d=[...(l.notes??[]).map(t=>`${e}: ${t}`),...l.errors.map(t=>`${e}: failed to install ${t.spec}: ${EO(t.error)}`)];return a&&l.results.length>0&&await DO(r),{stdout:u.length>0?`${u.join(`
|
|
1407
1407
|
`)}\n`:``,stderr:d.length>0?`${d.join(`
|
|
@@ -1424,8 +1424,8 @@ Options:
|
|
|
1424
1424
|
--force Install a package even when a SLICC built-in shadows it
|
|
1425
1425
|
--global Resolve only from the shared global prefix (/shared/lib/node_modules)
|
|
1426
1426
|
-h, --help Show this help message
|
|
1427
|
-
`}async function nk(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function rk(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function ik(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*ak(e,t=!1){if(t){yield vr;return}let n=x(e);for(;yield S(n,`node_modules`),n!==`/`;)n=Ge(n).dir;yield vr}async function ok(e,t,n,r=!1){for(let i of ak(t,r)){let t=S(i,`.bin`,n);if(!await rk(e,t))continue;let r=await nk(e,t),a=ek.exec(r),o=Ge(t).dir;return{binFilePath:a?S(o,a[1]):t,argvName:t}}return null}function sk(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function ck(e,t){if(typeof e==`string`)return{binName:sk(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,sk(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 lk(e,t,n,r=!1){for(let i of ak(t,r)){let t=S(i,n),r=S(t,`package.json`);if(!await rk(e,r))continue;let a;try{a=JSON.parse(await nk(e,r))}catch{return null}let o=ck(a.bin,n);if(!o)return null;let s=o.binPath.replace(/^\.\//,``);return{binFilePath:S(t,s),argvName:S(i,`.bin`,o.binName)}}return null}async function uk(e,t,n,r=!1){return await ok(e,t,n,r)??await lk(e,t,n,r)}async function dk(e,t,n){for(let r of ak(t))if(await rk(e,S(r,n,`package.json`)))return!0;return!1}function fk(e){return e instanceof Error?e.message:String(e)}function pk(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function mk(e,t,n,r){try{let{installPackages:i}=await import(`./installer-
|
|
1428
|
-
`)}\n`:``}}catch(n){return{error:pk(e,`failed to install '${t}': ${fk(n)}`)}}}async function hk(e,t,n,r){return await rk(r,n)?null:await ik(r,n)?pk(e,`bin target '${n}' is a directory, not a file`):pk(e,`bin file '${n}' for '${t}' does not exist`)}async function gk(e,t,n,r,i,a){if(await dk(a.fs,i.cwd,t))return{error:pk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:ZO(t);if(o)return{error:{stdout:``,stderr:$O(e,t,n,o),exitCode:1}};let s=await mk(e,t,i,a);if(`error`in s)return s;let c=await uk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:pk(e,`package '${t}' was installed but does not expose an executable bin`)}}function _k(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:tk(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:tk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await uk(t.fs,r.cwd,c,o)}catch(t){return pk(e,fk(t))}let d=``;if(!u){if(o)return pk(e,`no global bin '${c}' found in ${vr}`);let n=await gk(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await hk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Si(await nk(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await vi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function vk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-
|
|
1427
|
+
`}async function nk(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function rk(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function ik(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*ak(e,t=!1){if(t){yield vr;return}let n=x(e);for(;yield S(n,`node_modules`),n!==`/`;)n=Ge(n).dir;yield vr}async function ok(e,t,n,r=!1){for(let i of ak(t,r)){let t=S(i,`.bin`,n);if(!await rk(e,t))continue;let r=await nk(e,t),a=ek.exec(r),o=Ge(t).dir;return{binFilePath:a?S(o,a[1]):t,argvName:t}}return null}function sk(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function ck(e,t){if(typeof e==`string`)return{binName:sk(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,sk(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 lk(e,t,n,r=!1){for(let i of ak(t,r)){let t=S(i,n),r=S(t,`package.json`);if(!await rk(e,r))continue;let a;try{a=JSON.parse(await nk(e,r))}catch{return null}let o=ck(a.bin,n);if(!o)return null;let s=o.binPath.replace(/^\.\//,``);return{binFilePath:S(t,s),argvName:S(i,`.bin`,o.binName)}}return null}async function uk(e,t,n,r=!1){return await ok(e,t,n,r)??await lk(e,t,n,r)}async function dk(e,t,n){for(let r of ak(t))if(await rk(e,S(r,n,`package.json`)))return!0;return!1}function fk(e){return e instanceof Error?e.message:String(e)}function pk(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function mk(e,t,n,r){try{let{installPackages:i}=await import(`./installer-BT1UlNuS.js`),a=await i([t],{fs:r.fs,fetch:r.fetch,cwd:n.cwd});if(a.errors.length>0)return{error:pk(e,`failed to install '${t}': ${fk(a.errors[0].error)}`)};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version}`);return{progress:o.length>0?`${o.join(`
|
|
1428
|
+
`)}\n`:``}}catch(n){return{error:pk(e,`failed to install '${t}': ${fk(n)}`)}}}async function hk(e,t,n,r){return await rk(r,n)?null:await ik(r,n)?pk(e,`bin target '${n}' is a directory, not a file`):pk(e,`bin file '${n}' for '${t}' does not exist`)}async function gk(e,t,n,r,i,a){if(await dk(a.fs,i.cwd,t))return{error:pk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:ZO(t);if(o)return{error:{stdout:``,stderr:$O(e,t,n,o),exitCode:1}};let s=await mk(e,t,i,a);if(`error`in s)return s;let c=await uk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:pk(e,`package '${t}' was installed but does not expose an executable bin`)}}function _k(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:tk(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:tk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await uk(t.fs,r.cwd,c,o)}catch(t){return pk(e,fk(t))}let d=``;if(!u){if(o)return pk(e,`no global bin '${c}' found in ${vr}`);let n=await gk(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await hk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Si(await nk(t.fs,u.binFilePath)),m=[`node`,u.argvName,...l],h=await vi(p,m,r,void 0,{filename:u.binFilePath});return{stdout:h.stdout,stderr:d+h.stderr,exitCode:h.exitCode}}}}function vk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-CzOjMNM6.js`);return r(t,n,e)})}const yk=/* @__PURE__ */ new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function bk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Ek();let n=e.processManager??xk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
|
|
1429
1429
|
`,exitCode:1};let r=Sk(t);if(!r.ok)return{stdout:``,stderr:r.stderr,exitCode:r.exitCode};let{allDelivered:i,errors:a}=Ck(n,r.pids,r.signal);return{stdout:``,stderr:a.length?`${a.join(`
|
|
1430
1430
|
`)}\n`:``,exitCode:+!i}})}function xk(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function Sk(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
|
|
1431
1431
|
`,exitCode:2};let i=wk(n);if(i instanceof Error)return{ok:!1,stderr:`kill: ${i.message}\n`,exitCode:2};t=i;continue}if(i.startsWith(`-`)){let e=Tk(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
|
|
@@ -1498,7 +1498,7 @@ Common base URLs:
|
|
|
1498
1498
|
`)+`
|
|
1499
1499
|
`,stderr:``,exitCode:0}}function $k(e,t){let n=t.models.length;return{stdout:[`✓ ${e} (${Yk(t.runtime,!1)})`,` Saved ${n} model${n===1?``:`s`} to Settings:`,...Xk(t.models)].join(`
|
|
1500
1500
|
`)+`
|
|
1501
|
-
`,stderr:``,exitCode:0}}function eA(){return C(qk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Jk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-
|
|
1501
|
+
`,stderr:``,exitCode:0}}function eA(){return C(qk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Jk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-BbkpyoOX.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-ChvYBw5c.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(qk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
|
|
1502
1502
|
`,exitCode:1};let c=await a(s,t(qk)??void 0);if(!c.ok)return Zk(s,c);if(o===`discover`){let e=n(qk)??``;return i(qk,e,s,c.models.join(`, `)),$k(s,c)}return Qk(s,c)})}function tA(){return{stdout:`usage: man <topic>
|
|
1503
1503
|
|
|
1504
1504
|
Fetches documentation for a given topic from sliccy.com.
|
|
@@ -1532,7 +1532,7 @@ Options:
|
|
|
1532
1532
|
-h, --help Show this help message
|
|
1533
1533
|
`}function wA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`.replace(`.0M`,`M`):e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function TA(e){return`$${e.toFixed(2)}`}const EA=/\b(embedding|embed|tts|whisper|dall-e|image-gen|audio|vision-preview)\b/i;function DA(e){let t=`${e.id} ${e.name??``}`;return!EA.test(t)}function OA(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 kA(e){let t=e.toLowerCase();return t=t.replace(/-\d{8}$/,``),t=t.replace(/-\d{4}$/,``),t=t.replace(/-(preview|latest)$/,``),OA(t)??t.replace(/-[\d.]+$/,``)}function AA(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=kA(n.id);(!t.has(e)||n.selected)&&t.set(e,n)}return[...t.values()]}function jA(e,t,n,r,i){let a=i?SA(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 MA(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=`${TA(e.cost.input)} / ${TA(e.cost.output)}`,a=`${wA(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(`
|
|
1534
1534
|
`)+`
|
|
1535
|
-
`}function NA(e){let t=w(e,{bool:pA,value:mA});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 PA(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 FA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(DA);if(o.length===0)return[];let s=o.map(e=>jA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=AA(s)),s}function IA(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 LA(e,t){if(T(e,{valueFlags:mA}))return{stdout:CA(),stderr:``,exitCode:0};let n=NA(e);if(`error`in n)return hA(`models: ${n.error}`);let r=await import(`./account-store-
|
|
1535
|
+
`}function NA(e){let t=w(e,{bool:pA,value:mA});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 PA(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 FA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(DA);if(o.length===0)return[];let s=o.map(e=>jA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=AA(s)),s}function IA(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 LA(e,t){if(T(e,{valueFlags:mA}))return{stdout:CA(),stderr:``,exitCode:0};let n=NA(e);if(`error`in n)return hA(`models: ${n.error}`);let r=await import(`./account-store-BbkpyoOX.js`).then(e=>e.t);if(r.getAccounts().length===0)return hA(`No provider accounts configured. Run the provider settings to add one.
|
|
1536
1536
|
`);let i=r.resolveCurrentModel(),a=i.id,o=i.provider,s=r.getSelectedProvider(),c=r.getSelectedModelId(),l;if(!n.noBenchmarks){let e=await bA(t,n.forceRefresh);e.length>0&&(l=e)}let u=PA(r,n,s);if(`error`in u)return hA(u.error);let d=[],f=[];for(let e of u){let t=FA(r,e,a,o,l,n.allVersions);if(t.length===0){if(!n.allMode)return hA(`No models available for provider ${e}.\n`)}else if(d.push(...t),!n.jsonMode){let n=r.getProviderConfig(e);f.push(MA(n.name,e,t,!!l))}}return n.jsonMode?{stdout:JSON.stringify(d,null,2)+`
|
|
1537
1537
|
`,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
|
|
1538
1538
|
`),f.push(IA(o,a,s,c)),{stdout:f.join(`
|
|
@@ -1590,7 +1590,7 @@ Examples:
|
|
|
1590
1590
|
`)}\n`,stderr:``,exitCode:0}}async function cj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
|
|
1591
1591
|
`,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 lj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain remove: requires <providerId> and <domain>
|
|
1592
1592
|
`,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 uj(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>
|
|
1593
|
-
`,exitCode:1}}async function dj(e,t,n,r){switch(t){case`list`:return sj(e,n);case`add`:return cj(e,n,r);case`remove`:return lj(e,n,r);case`clear`:return uj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${aj()}`,exitCode:1}}}function fj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:aj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return oj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-
|
|
1593
|
+
`,exitCode:1}}async function dj(e,t,n,r){switch(t){case`list`:return sj(e,n);case`add`:return cj(e,n,r);case`remove`:return lj(e,n,r);case`clear`:return uj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${aj()}`,exitCode:1}}}function fj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:aj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return oj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-BbkpyoOX.js`).then(e=>e.t);try{return await dj(a,n,r,i)}catch(e){return oj(e instanceof Error?e.message:String(e))}})}function pj(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-DnuL9c9o.js`);return n(e,t)})}const mj=[`--download`,`-d`,`--view`,`-v`],hj=[`--size`],gj={low:256,medium:768,high:1536};function _j(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
|
|
1594
1594
|
|
|
1595
1595
|
VFS paths are served in a new browser tab via the preview service worker.
|
|
1596
1596
|
URLs (http/https/etc.) are opened directly in a new tab.
|
|
@@ -1616,7 +1616,7 @@ Examples:
|
|
|
1616
1616
|
`);let i=!1;try{i=(await t.fs.stat(e)).isDirectory}catch{}let a=await Or(t.fs,i?e:Ir(e)),o=Gr(e,a),s;try{s=await r(o)}catch(e){return G(`${e instanceof Error?e.message:String(e)}\n`)}return Ej(`opened ${e} → ${o}${Dj(s)}`)}async function Pj(e,t,n,r){if(!Ar(e)&&e.endsWith(`.shtml`)&&t.fs)return kj(e,t,r.sprinkleManager,r.canOpenWindow,r.openExternal);if(!n.view&&!r.canOpenWindow)return G(`open: browser APIs are unavailable in this environment
|
|
1617
1617
|
`);if(Ar(e))return Aj(e,r.canOpenWindow,r.openExternal);let i=t.fs.resolvePath(t.cwd,e);return n.view?jj(e,i,t,n.sizeSpec):n.download?Mj(e,i,t,r.hasDom):Nj(i,t,r.canOpenWindow,r.openExternal)}function Fj(e){return C(`open`,async(t,n)=>{if(t.length===0||T(t,{valueFlags:hj}))return _j();let r=Tj(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 _j();let c=globalThis.__slicc_sprinkleManager,l=typeof window<`u`&&typeof document<`u`,u=l?null:b(),d={canOpenWindow:!!e||l||!!u,hasDom:l,sprinkleManager:c,openExternal:Oj(e,l,u)},f=[];for(let e of s){let t=await Pj(e,n,{view:a,download:i,sizeSpec:o},d);if(!t.ok)return t.result;f.push(t.message)}return{stdout:f.join(`
|
|
1618
1618
|
`)+`
|
|
1619
|
-
`,stderr:``,exitCode:0}})}function Ij(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-
|
|
1619
|
+
`,stderr:``,exitCode:0}})}function Ij(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-RjWMiNYV.js`);return n(e,t)})}function Lj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-qNIe8UVD.js`);return r(e,t,n)})}function Rj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
|
|
1620
1620
|
|
|
1621
1621
|
Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
|
|
1622
1622
|
is zero-padded to the digit width of the last page (out-1.png for a 9-page
|
|
@@ -1676,7 +1676,7 @@ Examples:
|
|
|
1676
1676
|
plugin list
|
|
1677
1677
|
plugin info my-plugin
|
|
1678
1678
|
plugin remove my-plugin
|
|
1679
|
-
`}function tM(e={}){return C(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return Qj(eM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await cM(i,a,e);case`list`:case`ls`:return await fM(i,e);case`info`:return await pM(i,e);case`validate`:return await mM(i,a,e,fa(n?.env));case`remove`:case`rm`:case`delete`:return await hM(i,e);default:return K(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return K(`plugin ${r}: ${e instanceof Error?e.message:String(e)}`)}})}async function nM(e){if(e.fs)return e.fs;let{VirtualFS:t}=await import(`./fs-
|
|
1679
|
+
`}function tM(e={}){return C(`plugin`,async(t,n)=>{if(t.length===0||t[0]===`--help`||t[0]===`-h`)return Qj(eM());let r=t[0],i=t.slice(1),a=n?.cwd??`/`;try{switch(r){case`install`:case`add`:return await cM(i,a,e);case`list`:case`ls`:return await fM(i,e);case`info`:return await pM(i,e);case`validate`:return await mM(i,a,e,fa(n?.env));case`remove`:case`rm`:case`delete`:return await hM(i,e);default:return K(`plugin: unknown subcommand "${r}" (try \`plugin --help\`)`)}}catch(e){return K(`plugin ${r}: ${e instanceof Error?e.message:String(e)}`)}})}async function nM(e){if(e.fs)return e.fs;let{VirtualFS:t}=await import(`./fs-CM_0hH6U.js`).then(e=>e.t),{GLOBAL_FS_DB_NAME:n}=await import(`./global-db-BNyF6Scf.js`).then(e=>e.n);return t.create({dbName:n})}async function rM(e,t,n){let r=gM(t,e);if(await n.exists(r))return{kind:`local`,root:r};let{parseGitHubRef:i}=await import(`./github-install-BSqwBQIl.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 iM(e){let t=e.replace(/[^A-Za-z0-9._-]+/g,`-`);return/^\.+$/.test(t)?t.replace(/\./g,`_`):t}function aM(e){let t=[e.owner,e.repo,...e.path?[e.path]:[]];return`${Zj}/${t.map(iM).join(`--`)}`}async function oM(e,t,n,r){let{fetchRepoZip:i,stripZipPrefix:a,writeZipFilesToDir:o}=await import(`./github-zip-Dq6nNNvn.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 sM(e,t){try{await e.rm(t,{recursive:!0})}catch{}}async function cM(e,t,n){if(T(e))return Qj(`usage: plugin install <path|repo>
|
|
1680
1680
|
|
|
1681
1681
|
Loads the Agent Plugins package at <path>, or downloads it from a GitHub
|
|
1682
1682
|
reference (owner/repo, owner/repo@branch, or
|
|
@@ -1687,19 +1687,19 @@ mcp.json. On success the plugin is recorded in
|
|
|
1687
1687
|
/workspace/.plugins/plugins.json — its skills then surface through the
|
|
1688
1688
|
standard skills discovery, and each supported streamable-http MCP server
|
|
1689
1689
|
is registered in the MCP store as "<plugin>:<server>".
|
|
1690
|
-
`);let r=$j(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return K(`plugin install: expected <path|repo>`);let i=await nM(n),a=await rM(r.positionals[0],t,i);if(a.kind===`error`)return K(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return K(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=aM(a.ref),s=a.ref.display;let e=await oM(a.ref,o,i,n.fetch);if(e)return K(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-uBdBGttr.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await sM(i,o),K(`plugin install: plugin at ${s??o} was rejected:\n${_M(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-
|
|
1690
|
+
`);let r=$j(`install`,e);if(!(`ok`in r))return r;if(r.positionals.length<1)return K(`plugin install: expected <path|repo>`);let i=await nM(n),a=await rM(r.positionals[0],t,i);if(a.kind===`error`)return K(`plugin install: ${a.message}`);let o,s;if(a.kind===`github`){if(!n.fetch)return K(`plugin install: GitHub installs are unavailable (no network fetch configured)`);o=aM(a.ref),s=a.ref.display;let e=await oM(a.ref,o,i,n.fetch);if(e)return K(`plugin install: ${e}`)}else o=a.root;let{loadPluginFromDirectory:c}=await import(`./loader-uBdBGttr.js`),l=await c(i,o);if(!l.ok)return a.kind===`github`&&await sM(i,o),K(`plugin install: plugin at ${s??o} was rejected:\n${_M(l.diagnostics)}`);let{plugin:u}=l,d=u.manifest.name,{getInstalledPlugin:f,setInstalledPlugin:p}=await import(`./store-Dxqyn_fZ.js`),m=await f(d,n.fs);if(m&&m.root!==o)return a.kind===`github`&&await sM(i,o),K(`plugin install: a plugin named "${d}" is already installed from ${m.root} (remove it first)`);let h=await dM(u,n),g=await uM(d,m?.mcpServerNames,h.registered,n);return await p(d,{root:o,version:u.manifest.version,description:u.manifest.description,installedAt:(/* @__PURE__ */ new Date()).toISOString(),mcpServerNames:h.registered,...s?{source:s}:{}},n.fs),Qj(lM(u,h,g,s??o,l.diagnostics))}function lM(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:`,_M(i)),c.join(`
|
|
1691
1691
|
`)+`
|
|
1692
|
-
`}async function uM(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-
|
|
1693
|
-
`);let n=$j(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-
|
|
1692
|
+
`}async function uM(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-Bfzv4LAb.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 dM(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-Bfzv4LAb.js`).then(e=>e.r),{McpClient:a}=await import(`./client-DLJhgSVq.js`),o=[],s=[];for(let c of n){let n=c.config,l=`${e.manifest.name}:${c.name}`,u=await r(l,t.fs);if(u&&u.pluginOrigin!==e.manifest.name){s.push(l);continue}let d=[];try{let e=new a({url:n.url,headers:n.headers});await e.initialize(),d=await e.toolsList()}catch{}await i(l,{url:n.url,...n.headers?{headers:n.headers}:{},tools:d,addedAt:(/* @__PURE__ */ new Date()).toISOString(),pluginOrigin:e.manifest.name},t.fs),o.push(l)}return{registered:o,conflicts:s}}async function fM(e,t){if(T(e))return Qj(`usage: plugin list
|
|
1693
|
+
`);let n=$j(`list`,e);if(!(`ok`in n))return n;let{listInstalledPlugins:r}=await import(`./store-Dxqyn_fZ.js`),i=await r(t.fs),a=Object.keys(i).sort();if(a.length===0)return Qj("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 Qj(o.map(e=>e.map((e,t)=>e.padEnd(s[t])).join(` `)).join(`
|
|
1694
1694
|
`)+`
|
|
1695
1695
|
`)}async function pM(e,t){if(T(e))return Qj(`usage: plugin info <name>
|
|
1696
|
-
`);let n=$j(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-
|
|
1696
|
+
`);let n=$j(`info`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin info: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i}=await import(`./store-Dxqyn_fZ.js`),a=await i(r,t.fs);if(!a)return K(`plugin info: no installed plugin named "${r}"`);let o=await nM(t),{loadPluginFromDirectory:s}=await import(`./loader-uBdBGttr.js`),c=await s(o,a.root);if(!c.ok)return K(`plugin info: plugin at ${a.root} no longer loads:\n${_M(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:`,_M(c.diagnostics)),Qj(d.join(`
|
|
1697
1697
|
`)+`
|
|
1698
1698
|
`)}async function mM(e,t,n,r){if(T(e))return Qj(`usage: plugin validate <path|repo>
|
|
1699
1699
|
`);let i=$j(`validate`,e);if(!(`ok`in i))return i;if(i.positionals.length<1)return K(`plugin validate: expected <path|repo>`);let a=await nM(n),o=await rM(i.positionals[0],t,a);if(o.kind===`error`)return K(`plugin validate: ${o.message}`);let s,c=null;if(o.kind===`github`){if(!n.fetch)return K(`plugin validate: GitHub sources are unavailable (no network fetch configured)`);c=`${r}/.plugin-validate/${aM(o.ref).split(`/`).pop()}`;let e=await oM(o.ref,c,a,n.fetch);if(e)return K(`plugin validate: ${e}`);s=c}else s=o.root;let{loadPluginFromDirectory:l}=await import(`./loader-uBdBGttr.js`),u;try{u=await l(a,s)}finally{c&&await sM(a,c)}if(!u.ok)return{stdout:``,stderr:`plugin validate: REJECTED\n${_M(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:`,_M(u.diagnostics)),Qj(p.join(`
|
|
1700
1700
|
`)+`
|
|
1701
1701
|
`)}async function hM(e,t){if(T(e))return Qj(`usage: plugin remove <name>
|
|
1702
|
-
`);let n=$j(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-
|
|
1702
|
+
`);let n=$j(`remove`,e);if(!(`ok`in n))return n;if(n.positionals.length<1)return K(`plugin remove: expected <name>`);let r=n.positionals[0],{getInstalledPlugin:i,deleteInstalledPlugin:a}=await import(`./store-Dxqyn_fZ.js`),o=await i(r,t.fs);if(!o)return K(`plugin remove: no installed plugin named "${r}"`);let s=0;if(o.mcpServerNames&&o.mcpServerNames.length>0){let{deleteServer:e,getServer:n}=await import(`./store-Bfzv4LAb.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(`${Zj}/`);return c&&await sM(await nM(t),o.root),Qj([`Removed agent plugin "${r}"`,` registry: removed`,` mcp servers: ${s} removed`,c?` files: removed (${o.root})`:` files: left in place (${o.root})`].join(`
|
|
1703
1703
|
`)+`
|
|
1704
1704
|
`)}function gM(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 _M(e){return e.map(e=>` ${e.level===`error`?`error`:`warn `} [${e.component}] ${e.message}`).join(`
|
|
1705
1705
|
`)}const vM=[`pid`,`ppid`,`kind`,`stat`,`start`,`scoop`,`command`],yM=[`pid`,`ppid`,`stat`,`start`,`scoop`,`command`],bM={running:`R`,pending:`S`,exited:`Z`,killed:`K`},xM=[`-a`,`-A`,`-e`,`--all`,`-T`,`--tree`],SM=[`-o`,`--columns`];function CM(e={}){return C(`ps`,async t=>{if(T(t,{valueFlags:SM}))return LM();let n=e.processManager??wM();if(!n)return{stdout:``,stderr:`ps: no process manager available in this runtime
|
|
@@ -1911,7 +1911,7 @@ Limits and lifetime:
|
|
|
1911
1911
|
`,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
|
|
1912
1912
|
`,exitCode:1}}async function zP(e,t,n){if(e.ttlMs!==void 0){if(!t)throw Error(`persistent snapshot filesystem unavailable`);return jP(t,n)}}async function BP(e,t,n,r){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return hP();let i=xP(e);if(i.error)return{stdout:``,stderr:i.error,exitCode:1};let a=await LP(i);if(a)return a;if(!i.directory)return hP();let o=RP(i);if(o)return o;let s=await SP(i.directory,i.entry,t.fs,t.cwd);if(CP(s))return s;let{fullDirectory:c,entryPath:l}=s,u;try{u=await zP(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)
|
|
1913
1913
|
`:``,f=await FP(!i.noBridge&&i.bridge,d);return f.ok?IP(i,c,l,f.webhookId,d,u,n):f.result}function VP(e,t){return C(`serve`,(n,r)=>BP(n,r,e,t))}const HP=`usage: session export [--id <id>] [--output <path>]
|
|
1914
|
-
`;function UP(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 WP(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${HP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${HP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${HP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${HP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${HP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${HP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function GP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||It(r)!==a.sha256)throw new Ha(`transfer-corrupt`);return r}async function KP(e,t){let n=WP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=UP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${HP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Ds().export(a,{}),n=await GP(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 Ha?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function qP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return KP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-
|
|
1914
|
+
`;function UP(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 WP(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${HP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${HP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${HP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${HP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${HP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${HP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function GP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||It(r)!==a.sha256)throw new Ha(`transfer-corrupt`);return r}async function KP(e,t){let n=WP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=UP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${HP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Ds().export(a,{}),n=await GP(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 Ha?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function qP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return KP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-DZboUSNJ.js`);return n(e,t,HP)})}function JP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-CDSVO_JK.js`);return await n(e,t)})}const YP=`leader`;function XP(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function ZP(e){return+!!e.leader+e.followers.length}function QP(){return{stdout:`usage: sprinkle <subcommand> [args]
|
|
1915
1915
|
|
|
1916
1916
|
list [--runtime <id>] List sprinkles + an instance line per runtime
|
|
1917
1917
|
open <name> Open a sprinkle by name
|
|
@@ -3323,6 +3323,6 @@ pass --wait to block and print the full result.`,RB=/* @__PURE__ */ new Set([`li
|
|
|
3323
3323
|
`,stderr:``,exitCode:0};let n;try{n=uV(e)}catch(e){return QB(e.message)}let r=n.positional[0],i=n.positional[1],a=!r||r===`-`,o;try{o=await fV(t,r,a)}catch{return QB(`${r}: No such file or directory`)}if(n.revert){let e=tV(o),r=n.plain?oV(e):sV(e);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),r),{stdout:``,stderr:``,exitCode:0}):{stdout:tV(r),stderr:``,exitCode:0}}let{data:s,base:c}=mV(n,o),l=pV(n,s,c,r,a);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),l),{stdout:``,stderr:``,exitCode:0}):{stdout:l,stderr:``,exitCode:0}})}async function gV(e,t,n,r){if((await e.fs.stat(t)).isFile)return r[n]=await e.fs.readFileBuffer(t),1;let i=await e.fs.readdir(t),a=0;for(let o of i){let i=jr(t,o),s=n?`${n}/${o}`:o;a+=await gV(e,i,s,r)}return a}function _V(){return{stdout:`usage: zip [-r] <archive.zip> <path> [path...]
|
|
3324
3324
|
`,stderr:``,exitCode:0}}function vV(){return C(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return _V();let n=!1,r=[];for(let t of e)if(t===`-r`)n=!0;else{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
|
|
3325
3325
|
`,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(/^\.\//,``))||Mr(r);if(i.isDirectory&&!n)return{stdout:``,stderr:`zip: ${e} is a directory (use -r)\n`,exitCode:1};s+=await gV(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
|
|
3326
|
-
`,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function yV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-
|
|
3326
|
+
`,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function yV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-jsLeQFYW.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function bV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function xV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[OO(`ipk`,r),OO(`npm`,r),OO(`i`,r),_k(`ipx`,{fs:t,fetch:n}),_k(`npx`,{fs:t,fetch:n}),xb(`di`,{fs:t,fetch:n}),xb(`uv`,{fs:t,fetch:n}),GL({fs:t,fetch:n})]}function SV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>ZM(e,t))}function CV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function wV(){return[qP(),NS()]}function TV(e={}){let t=[NE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),kF(),JP(),VP(e.browserAPI,e.fs),Fj(e.browserAPI),Iy(e.browserAPI),RD(e),vV(),xL(),pI(e.fs?{fs:e.fs}:{}),IF(),UF(),BF(),jv(),gz(CV(e)),oC(CV(e)),hV(),CF(`sqlite3`),CF(`sqllite`),AI(),XI(),Lx(),pv(),QA({buildProcessConfig:e.buildProcessConfig}),QA({buildProcessConfig:e.buildProcessConfig},`jsh`),...SV(e),...xV(e),...e.fs?[aC({fs:e.fs})]:[],...e.fs?[uA({fs:e.fs})]:[],...e.fetch?[WE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],PS(),FS(),qS(),jz(e.webhook),gB(),Fy(e.crontask),yV(e),tM({fs:e.fs,fetch:e.fetch}),iC(),mF(),Ij(),Lj(`pdftk`),Lj(`pdf`),mv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),mv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),qj(`pdftoppm`),qj(`pdftocairo`),Jj(`pdftotext`),yy(`convert`),yy(`magick`),EB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),eL(),gL(),PD(),FD(),_L(),dA(),tN(),rA(),cx(),pj(),fj(),eA(),fP(bV(e)),Jp(e.gitCredential),mN({fs:e.fs}),BN(),Ov(),kv(),Av(`xclip`),Av(`xsel`),zN(),SC(),a_(),o_(),RA(e.fs),_t(),rj(),s_({getParentJid:e.getParentJid}),gx(),CM({processManager:e.processManager}),oR({processManager:e.processManager}),bk({processManager:e.processManager}),vk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...l_(),lA(),Kk(),jR(),gD(),vS(),qR({processManager:e.processManager}),Pv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),kS(),xv({registry:e.cherryRuntimeRegistry}),Gy(),Zy({fs:e.fs}),Qy({fs:e.fs}),jF(e.sudoCommand),UB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),_B(),...wV()];return e.fs&&(Xj(),t.push(...$n.map(t=>AE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let EV=null;function DV(e){EV=e}function OV(e){EV?.(e)}var kV=Yt();const AV={user:`user`,home:gr},jV=/* @__PURE__ */ new Set([`root`,`nobody`,`nogroup`]),MV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function NV(e){return{user:MV.test(e.user)&&!jV.has(e.user)?e.user:AV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:AV.home}}function PV(e,t){let{user:n,home:r}=NV(t);if(e===`/etc/passwd`)return[`root:x:0:0:root:/root:/bin/bash`,`${n}:x:1000:1000:SLICC user:${r}:/bin/bash`,`nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin`,``].join(`
|
|
3327
3327
|
`);if(e===`/etc/group`)return[`root:x:0:`,`${n}:x:1000:`,`nogroup:x:65534:`,``].join(`
|
|
3328
3328
|
`)}function FV(e,t=AV){let n=PV(e,t);return n===void 0?void 0:new TextEncoder().encode(n)}function IV(e){return e===`/etc`?[`group`,`passwd`]:[]}function LV(e){return e?.code===`ENOENT`}const RV=Reflect.get(ft,`DefenseInDepthBox`);function zV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function BV(e,t){if(typeof e!=`string`)return e;let n=zV(t);if(n===`binary`||n===`latin1`){let t=Oe(e);if(t)return t}return kV.Buffer.from(e,n)}function VV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}function HV(e){let t=/^[A-Za-z0-9._+-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`;return new TextEncoder().encode(`#!/bin/sh\n# SLICC command\nexec ${t} "$@"\n`)}function UV(e,t){let n=IV(e).filter(e=>!t.includes(e));return n.length?[...t,...n].sort():t}function WV(e,t){let n=IV(e).filter(e=>!t.some(t=>t.name===e));if(!n.length)return t;let r=n.map(e=>({name:e,isFile:!0,isDirectory:!1,isSymbolicLink:!1}));return[...t,...r].sort((e,t)=>e.name.localeCompare(t.name))}var GV=class{vfs;registeredCommandsFn=null;identityFn=null;listingStats=/* @__PURE__ */ new Map;listingStatsMax;listingStatsTtlMs;constructor(e,t){this.vfs=e,this.listingStatsMax=Math.max(1,t?.listingStatsMax??2e4),this.listingStatsTtlMs=t?.listingStatsTtlMs??1e3,this.updateMetadataBatch=this.updateMetadataBatch.bind(this),this.symlinkBatch=this.symlinkBatch.bind(this)}get listingStatsSize(){return this.listingStats.size}primeListingStats(e,t){let n=Date.now();if(t.length>this.listingStatsMax){this.listingStats.clear();return}this.sweepExpiredListingStats(n),this.listingStats.size+t.length>this.listingStatsMax&&this.listingStats.clear();let r=e===`/`?`/`:`${e}/`;for(let e of t){let t=Xe(e),i=`${r}${e.name}`;this.listingStats.delete(i),t&&this.listingStats.set(i,{stats:t,at:n})}}sweepExpiredListingStats(e){for(let[t,n]of this.listingStats){if(e-n.at<=this.listingStatsTtlMs)break;this.listingStats.delete(t)}}primedStats(e){let t=this.listingStats.get(e);if(t){if(Date.now()-t.at>this.listingStatsTtlMs)this.listingStats.delete(e);else return t.stats}}dropListingStats(){this.listingStats.clear()}setRegisteredCommandsFn(e){this.registeredCommandsFn=e}setIdentityFn(e){this.identityFn=e}identityFile(e){return FV(e,this.identityFn?.()??AV)}isVirtualBinCommand(e){return e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e)}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=VV(e);if(t===`/usr`||t===`/usr/bin`)return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:/* @__PURE__ */ new Date(0)};if(t.startsWith(`/usr/bin/`)){let e=t.slice(9);if(this.isVirtualBinCommand(e))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:493,size:HV(e).length,mtime:/* @__PURE__ */ new Date(0)}}return null}canWrite(e){let t=this.vfs;return typeof t.canWrite!=`function`||t.canWrite(e)}listMountPoints(){let e=this.vfs;return typeof e.listMountPoints==`function`?e.listMountPoints():[]}trusted(e){let t=RV?.runTrustedAsync;return t?t(e):Promise.resolve().then(e)}async readFile(e,t){return this.trusted(async()=>{let n=x(e),r=await this.readRaw(n),i=zV(t),a=kV.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString(i);return i!==`hex`&&i!==`base64`&&m(a,r),a})}async readFileBuffer(e){return this.trusted(()=>this.readRaw(x(e)))}async readRaw(e){let t=VV(e);if(t.startsWith(`/usr/bin/`)&&this.isVirtualBinCommand(t.slice(9)))return HV(t.slice(9));let n;try{n=await this.vfs.readFile(e,{encoding:`binary`})}catch(t){let n=this.identityFile(e);if(n&&LV(t))return n;throw t}return n instanceof Uint8Array?n:new TextEncoder().encode(n)}identityStat(e,t){let n=this.identityFile(e);if(n&&LV(t))return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,mode:420,size:n.length,mtime:/* @__PURE__ */ new Date(0)}}async readFileBytes(e){let t=await this.readFileBuffer(e);return kV.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString(`latin1`)}async getNativeFile(e){return this.trusted(()=>this.vfs.getNativeFile(x(e)))}async readFileRange(e,t,n){return this.trusted(()=>this.vfs.readFileRange(x(e),t,n))}async writeFile(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=x(e);await this.vfs.writeFile(r,BV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(x(e),BV(t,n)))}async exists(e){return this.trusted(async()=>{let t=x(e);return this.virtualUsrStat(t)?!0:await this.vfs.exists(t)||this.identityFile(t)!==void 0})}async stat(e){return this.trusted(async()=>{let t=x(e);try{return await this.statVfs(t)}catch(e){let n=this.identityStat(t,e);if(n)return n;throw e}})}async statVfs(e){let t=this.virtualUsrStat(e);if(t)return t;let n=this.vfs.statSync(e);if(n)return{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!!n.isSymlink,mode:n.mode??(n.type===`directory`?493:420),size:n.size,mtime:new Date(n.mtime),identity:n.identity,dev:n.dev,ino:n.identity===void 0?void 0:n.ino};let r=this.primedStats(e)??await this.vfs.stat(e);return{isFile:r.type===`file`,isDirectory:r.type===`directory`,isSymbolicLink:!!r.isSymlink,mode:r.mode??(r.type===`directory`?493:420),size:r.size,mtime:new Date(r.mtime),identity:r.identity,dev:r.dev,ino:r.identity===void 0?void 0:r.ino}}async lstat(e){return this.trusted(async()=>{let t=x(e);try{return await this.lstatVfs(t)}catch(e){let n=this.identityStat(t,e);if(n)return n;throw e}})}async lstatVfs(e){let t=this.virtualUsrStat(e);if(t)return t;let n=this.vfs.lstatSync(e);if(n)return{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:n.type===`symlink`,mode:n.mode??(n.type===`directory`?493:n.type===`symlink`?511:420),size:n.size,mtime:new Date(n.mtime),identity:n.identity,dev:n.dev,ino:n.identity===void 0?void 0:n.ino};let r=this.primedStats(e)??await this.vfs.lstat(e);return{isFile:r.type===`file`,isDirectory:r.type===`directory`,isSymbolicLink:r.type===`symlink`,mode:r.mode??(r.type===`directory`?493:r.type===`symlink`?511:420),size:r.size,mtime:new Date(r.mtime),identity:r.identity,dev:r.dev,ino:r.identity===void 0?void 0:r.ino}}async mkdir(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.mkdir(x(e),t)})}async readdir(e){return this.trusted(async()=>{let t=x(e);if(t===`/usr`)return[`bin`];if(VV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return UV(t,n.map(e=>e.name));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),UV(t,r.map(e=>e.name))})}async readdirWithFileTypes(e){return this.trusted(async()=>{let t=x(e);if(t===`/usr`)return[{name:`bin`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}];if(VV(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 WV(t,this.mapFastEntriesToDirents(n));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),WV(t,this.mapAsyncEntriesToDirents(r))})}mapFastEntriesToDirents(e){return e.map(e=>this.entryToDirent(e))}mapAsyncEntriesToDirents(e){return e.map(e=>this.entryToDirent(e))}entryToDirent(e){return e.type===`symlink`?{name:e.name,isFile:!1,isDirectory:!1,isSymbolicLink:!0}:{name:e.name,isFile:e.type===`file`,isDirectory:e.type===`directory`,isSymbolicLink:!1}}async rm(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rm(x(e),t)})}async cp(e,t,n){return this.dropListingStats(),this.trusted(async()=>{let r=x(e),i=x(t),a;try{a=await this.vfs.stat(r)}catch(e){let t=this.identityFile(r);if(!t||!LV(e))throw e;await this.vfs.writeFile(i,t);return}if(a.type===`directory`){if(!n?.recursive)throw new Ze(`EISDIR`,`is a directory`,r);await this.cpDir(r,i)}else await this.vfs.copyFile(r,i)})}async cpDir(e,t){await this.vfs.mkdir(t,{recursive:!0});let n=await this.vfs.readDir(e);for(let r of n){let n=S(e,r.name),i=S(t,r.name);r.type===`directory`?await this.cpDir(n,i):await this.vfs.copyFile(n,i)}let r=new Set(n.map(e=>e.name));for(let n of IV(e)){let i=r.has(n)?void 0:this.identityFile(S(e,n));i&&await this.vfs.writeFile(S(t,n),i)}}async mv(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.rename(x(e),x(t))})}async rename(e,t){return this.mv(e,t)}resolvePath(e,t){return t.startsWith(`/`)?x(t):x(S(e,t))}getAllPaths(){return[]}async chmod(e,t){return this.dropListingStats(),this.trusted(()=>this.vfs.chmod(x(e),t))}async updateMetadataBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.updateMetadataBatch(e.map(e=>({...e,path:x(e.path)}))))}async symlinkBatch(e){return this.dropListingStats(),this.trusted(()=>this.vfs.symlinkBatch(e.map(e=>({target:e.target,path:x(e.path)}))))}async symlink(e,t){return this.dropListingStats(),this.trusted(async()=>{await this.vfs.symlink(e,x(t))})}async link(e,t){throw Error(`Hard links not supported in VirtualFS`)}async readlink(e){return this.trusted(async()=>this.vfs.readlink(x(e)))}async realpath(e){return this.trusted(async()=>this.vfs.realpath(x(e)))}async utimes(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.utimes(x(e),t,n))}invalidatePaths(e){this.dropListingStats();let t=this.vfs;t.invalidatePaths&&t.invalidatePaths(e)}async forgetSidecarConsistency(){await this.vfs.forgetSidecarConsistency?.()}};function KV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?KV(e.getUnderlyingFS?.()):null}const qV=e(`almost-bash-shell`);function JV(e){if(!(`__SLICC_RUN_PID`in e)&&!(`__SLICC_OUTPUT_TEE__`in e)&&!(`__SLICC_SUDO_REASON`in e)&&!(`__SLICC_PIPESTATUS`in e)&&!(`__SLICC_PIPESTATUS_EX`in e))return{...e};let{[rm]:t,[im]:n,[Cp]:r,[Gt]:i,[Ht]:a,...o}=e;return o}function YV(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 XV=class e{options;bash;vfsAdapter;gitCommands;mountCommands;lastEnv;cwd;umask=18;builtinCommandNames;staticBuiltinNames;allowedCommands;scriptCatalog;initialJshSync=null;ownsScriptCatalog;commandGate;jshRegistry;gnuBashFallback;pendingEnvWrites=/* @__PURE__ */ new Map;activeShellPid;progress;activeRunSignal;commandAbort=new AbortController;scriptRun=null;scriptRunsActive=0;registryNames=/* @__PURE__ */ new Set;outputTees=/* @__PURE__ */ new Map;nextOutputTeeId=0;resolveJshProcessConfig=e=>this.buildJshProcessConfig(am(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:gr,PATH:Sr,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t,...e.env}}buildSupplementalCommands(e,t,n){return TV({onMediaPreview:async e=>this.renderMediaPreview(e),getJshCommands:()=>this.getJshCommandNames(),getWorkflowCommands:()=>this.getWorkflowCommandNames(),syncScriptCommands:()=>this.syncJshCommands(),getStaticBuiltins:()=>[...this.staticBuiltinNames],getScriptRegisteredNames:()=>this.jshRegistry.scriptRegisteredNames(),fs:e.fs,fetch:t,streamFetch:n,scriptCatalog:this.scriptCatalog,browserAPI:e.browserAPI,webhook:e.webhook,crontask:e.crontask,getParentJid:e.getParentJid,isScoop:e.isScoop,buildProcessConfig:this.resolveJshProcessConfig,terminal:e.terminal,gateNativeCommand:this.gateNativeCommand,processManager:e.processManager,sudoCommand:e.sudo?{broker:e.sudo.broker,persistGrant:async e=>{this.commandGate.queueGrant(e)},suppressNextGate:e=>this.commandGate.registerSudoBypass(e)}:void 0,setEnv:(e,t)=>{this.pendingEnvWrites.set(e,t),this.lastEnv[e]=t},unsetEnv:e=>{this.pendingEnvWrites.set(e,null),delete this.lastEnv[e]},gitCredential:{githubToken:(e,t)=>this.gitCommands.githubCredential(e,t),githubDomains:vp},gitIdentity:()=>this.gitCommands.identity(),mcpConnectionManager:e.mcpConnectionManager})}constructor(t){this.options=t,this.vfsAdapter=new GV(t.fs),this.progress=new um({scrubLabel:t.scrubProgressLabel}),this.allowedCommands=e.buildAllowedCommandSet(t),this.commandGate=new Yp({getSudo:()=>this.options.sudo,fs:t.fs});let n=t.cwd??`/`,r=e.buildInitialEnv(t,n);this.gitCommands=new hp({fs:t.fs,authorName:r.GIT_AUTHOR_NAME??`User`,authorEmail:r.GIT_AUTHOR_EMAIL??`user@example.com`,ensureFreshGithubToken:_p}),this.mountCommands=new Hs({fs:t.fs,isScoop:t.isScoop,acquireLocalMountViaToolUI:Ym});let i=t.jshDiscoveryFs??t.fs,a=t.bshDiscoveryFs??t.fs,o=KV(i)??KV(a);this.scriptCatalog=t.scriptCatalog??new Mi({jshFs:i,bshFs:a,watcher:o}),this.ownsScriptCatalog=!t.scriptCatalog,o&&o.watch(`/`,e=>e.endsWith(`.jsh`)||e.endsWith(`.workflow.js`)||yr(e),()=>{this.syncJshCommands().catch(()=>void 0)});let s=this.createGitCustomCommand(),c=g({progress:hm(this.progress)}),l=_({progress:hm(this.progress)}),u=this.buildSupplementalCommands(t,c,l),d=[s,this.createMountCustomCommand(),this.createUmountCustomCommand(),Uh(t.fs),Bg(t.fs,c,t.browserAPI),...u].filter(e=>this.isCommandAllowed(e.name)),f=[...mt(),...dt()],p=this.allowedCommands?f.filter(e=>this.isCommandAllowed(e)):void 0;if(this.bash=new pt({fs:this.vfsAdapter,cwd:n,env:{},fetch:c,commands:p,customCommands:d,sleep:Im(this.progress,{isAborted:()=>this.activeRunSignal?.aborted??!1}),executionLimitProfile:t.executionLimitProfile,executionLimits:Zp(t.isScoop?.()??!1,t.executionLimits)}),this.bash.registerTransformPlugin(rh),this.allowedCommands!==null){let e=this.bash;for(let t of dt())this.isCommandAllowed(t)||e.commands.delete(t)}{let e=this.bash;for(let[t,n]of e.commands)e.commands.set(t,this.wrapCommandForDispatch(n));this.registryNames=new Set(e.commands.keys())}let m=d.map(e=>e.name),h=p??[...mt(),...dt()];this.builtinCommandNames=/* @__PURE__ */ new Set([...h,...m]),this.staticBuiltinNames=new Set(this.builtinCommandNames),this.vfsAdapter.setRegisteredCommandsFn(()=>[...this.builtinCommandNames]),this.vfsAdapter.setIdentityFn(()=>({user:this.lastEnv.USER??`user`,home:this.lastEnv.HOME??`/home/user`})),this.lastEnv={...r},this.cwd=n,this.bindCollaborators(t),this.startInitialJshSync()}bindCollaborators(e){let t=this;this.jshRegistry=new lm({get bash(){return t.bash},scriptCatalog:this.scriptCatalog,discoveryFs:e.jshDiscoveryFs??e.fs,vfsAdapter:this.vfsAdapter,get cwd(){return t.cwd},get lastEnv(){return t.lastEnv},get umask(){return t.umask},builtinCommandNames:this.builtinCommandNames,isCommandAllowed:e=>this.isCommandAllowed(e),wrapCommandForDispatch:e=>this.wrapCommandForDispatch(e),path:()=>this.lastEnv.PATH,buildJshProcessConfig:e=>this.buildJshProcessConfig(e),gateNativeCommand:this.gateNativeCommand,gitIdentity:()=>this.gitCommands.identity()}),this.gnuBashFallback=new om({gnuBash:e.gnuBash===!0,get lastEnv(){return t.lastEnv},get cwd(){return t.cwd},get umask(){return t.umask},vfsAdapter:this.vfsAdapter,get bash(){return t.bash},scriptCatalog:this.scriptCatalog,outputTees:this.outputTees,gateNativeCommand:this.gateNativeCommand,buildJshProcessConfig:e=>this.buildJshProcessConfig(e),gitIdentity:()=>this.gitCommands.identity(),flushPendingCommandGrants:()=>this.commandGate.flushPendingCommandGrants(),applyPendingEnvWrites:()=>this.applyPendingEnvWrites(),syncJshCommands:()=>this.syncJshCommands(),adoptCwd:e=>{this.cwd=e},adoptEnv:e=>{this.lastEnv=e}})}getBash(){return this.bash}getCwd(){return this.cwd}getScriptCatalog(){return this.scriptCatalog}getEnv(){return{...this.lastEnv}}setMaskedEnvVar(e,t){this.pendingEnvWrites.set(e,t),this.lastEnv[e]=t}applySessionOverrides(e){e.cwd!==void 0&&(this.cwd=e.cwd,this.lastEnv.PWD=e.cwd),e.env&&Object.assign(this.lastEnv,e.env)}async getJshCommandNames(){return this.jshRegistry.getJshCommandNames()}async syncJshCommands(){return this.jshRegistry.syncJshCommands()}cancelActiveCommand(){this.commandAbort.abort(),this.commandAbort=new AbortController}async executeCommand(e,t,n,r=``,i){let a=this.activeShellPid;n!==void 0&&(this.activeShellPid=n);let o=i?.onOutput?`tee-${this.nextOutputTeeId+=1}`:void 0;o&&i?.onOutput&&this.outputTees.set(o,i.onOutput);try{let a=await this.runCommand(e,t,n,r,o,i?.capturePipeStatus);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode,...a.pipeStatus===void 0?{}:{pipeStatus:a.pipeStatus}}}finally{this.activeShellPid=a,o&&this.outputTees.delete(o)}}async executeScriptFile(e,t=[]){return hi(e,t,{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(this.lastEnv)),stdin:``,exec:(e,t)=>this.bash.exec(e,{env:t?.env??this.lastEnv,cwd:t?.cwd??this.cwd,umask:this.umask,...t?.env===void 0?{}:{replaceEnv:!0}})},this.buildJshProcessConfig())}dispose(){this.ownsScriptCatalog&&this.scriptCatalog.dispose()}async renderMediaPreview(e){throw Error(`terminal preview is unavailable in headless mode`)}startInitialJshSync(){this.initialJshSync=this.initHomeAndProfile().then(()=>this.syncJshCommands()).catch(()=>void 0).finally(()=>{this.initialJshSync=null})}async initHomeAndProfile(){let e=this.options.fs;try{let t=this.options.env?.HOME??await hr(e);this.lastEnv.HOME=t,this.options.env?.USER||(this.lastEnv.USER=mr(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){qV.warn(`HOME/profile init failed; continuing with defaults`,e)}}async waitForInitialJshSync(e){let t=this.initialJshSync;if(t===null)return;if(!e){await t;return}if(e.aborted)return;let n;try{await new Promise(r=>{n=()=>r(),e.addEventListener(`abort`,n,{once:!0}),t.then(()=>r(),()=>r())})}finally{n&&e.removeEventListener(`abort`,n)}}async runCommand(e,t,n,r=``,i,a=!1){if(OV(e.trim().split(/\s+/)[0]||`unknown`),v(),await this.waitForInitialJshSync(t),await this.gnuBashFallback.usesGnuBash())return this.gnuBashFallback.runOnGnuBash(e,t,n,r,i,a);let o=Tp(e),s={env:{...this.lastEnv,...n===void 0?{}:{[rm]:String(n)},...i===void 0?{}:{[im]:i},...o?{[Cp]:o}:{}},cwd:this.cwd,umask:this.umask,signal:t,...r===``?{}:{stdin:r,stdinKind:`bytes`}},c=this.lastEnv.PATH,l=YV([t,this.commandAbort.signal]);s.signal=l.signal,this.activeRunSignal=l.signal;let u=this.beginScriptRun(e),d;try{d=await this.bash.exec(Ut(e,a),s)}finally{l.release(),this.activeRunSignal===l.signal&&(this.activeRunSignal=void 0),this.endScriptRun(u)}if(await this.commandGate.flushPendingCommandGrants(),d=Vt(d,a),typeof d.umask==`number`&&(this.umask=d.umask),d.env&&(this.lastEnv=JV(d.env)),d.env&&this.lastEnv.PATH!==c&&await this.syncJshCommands().catch(()=>void 0),this.applyPendingEnvWrites(),d.env?.PWD&&(this.cwd=d.env.PWD),d.exitCode===127){let t=await this.jshRegistry.tryJshFallback(e,n);if(t)return this.syncJshCommands().catch(()=>void 0),t}if(d.exitCode!==0&&d.stderr.includes(`Permission denied`)){let{withShebangExecHint:e}=await import(`./shebang-exec-hint-CKRRIss9.js`).then(e=>e.n);return zt(await e(d,this.cwd,this.vfsAdapter),d.pipeStatus)}return d}applyPendingEnvWrites(){for(let[e,t]of this.pendingEnvWrites)t===null?delete this.lastEnv[e]:this.lastEnv[e]=t;this.pendingEnvWrites.clear()}gateNativeCommand=async(e,t,n)=>{if(this.allowedCommands!==null&&!this.isCommandAllowed(e))return{stderr:`bash: ${e}: command not found\n`,exitCode:127};if(!this.commandGate.isTransparentGatingEnabled()||zp.has(e))return null;let r=await this.commandGate.gateCommandDispatch(e,t,n[Cp]);return r?{stderr:r.stderr,exitCode:r.exitCode}:null};wrapCommandForDispatch(e){let t=this.commandGate.wrapCommandForSudo(e),n=e.name===`timeout`?Bm(t,this.progress):Hm(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(im),s=o?a.get(o):void 0;s&&(t.writeStdout=s);try{let r=await Wm(()=>n.execute(e,t),t.signal);return i(t.env,r),r}finally{r()}}}}teeCommandOutput(e,t){let n=e?.get(im);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=jm(this.bash.transform(e).ast,this.registryNames)}catch{t={totalSteps:null}}return this.scriptRun=new Nm(t,this.progress,Mm(e)),this.scriptRun}endScriptRun(e){this.scriptRunsActive=Math.max(0,this.scriptRunsActive-1),e&&(e.end(),this.scriptRun===e&&(this.scriptRun=null))}isCommandAllowed(e){return this.allowedCommands===null||this.allowedCommands.has(zp.get(e)??e)}createGitCustomCommand(){let e=this.gitCommands;return C(`git`,async(t,n)=>{let r=n.cwd,i=await e.execute(t,r,n.env,P(n.stdin));return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}createMountCustomCommand(){let e=this.mountCommands;return C(`mount`,async(t,n)=>{let r=n.cwd,i=await e.execute(t,r,n.env);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}createUmountCustomCommand(){let e=this.mountCommands;return C(`umount`,async(t,n)=>{let r=n.cwd,i=await e.executeUmount(t,r);return{stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode}})}async getWorkflowCommandNames(){return this.jshRegistry.getWorkflowCommandNames()}buildJshProcessConfig(e){if(this.options.processManager&&this.options.processOwner)return{processManager:this.options.processManager,owner:this.options.processOwner,getParentPid:()=>e??this.activeShellPid??this.options.getCurrentShellPid?.()}}};export{Va as _,NB as a,Es as c,bs as d,rs as f,Ha as g,Ra as h,kB as i,Cs as l,qo as m,GV as n,DB as o,ns as p,DV as r,Ns as s,XV as t,Ss as u,Vo as v,Ma as y};
|