sliccy 6.258.2 → 6.258.3
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 +187 -187
- package/dist/ui/assets/{account-store-CcZuCy3S.js → account-store-C_paLZbO.js} +1 -1
- package/dist/ui/assets/{account-store-BGnbKLs5.js → account-store-DBI0nzc0.js} +1 -1
- package/dist/ui/assets/{adobe-B5vP9OGp.js → adobe-CtTYLaZW.js} +1 -1
- package/dist/ui/assets/{adobe-C-ScLUGu.js → adobe-DD39fgdL.js} +1 -1
- package/dist/ui/assets/{agent-panels-DCTo6Wss.js → agent-panels-DjmGIqzw.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-CHa5Ul-3.js → almost-bash-shell-headless-C3BA0mOB.js} +11 -11
- package/dist/ui/assets/{apply-layout-DTLpbNxu.js → apply-layout-BoM7RCx_.js} +1 -1
- package/dist/ui/assets/{azure-openai-BMILhYX9.js → azure-openai-Tx6f6iqW.js} +1 -1
- package/dist/ui/assets/{azure-openai-BAct6ZA6.js → azure-openai-VkVUK36J.js} +1 -1
- package/dist/ui/assets/{cdp-BzAZVurf.js → cdp-D_q-QSGk.js} +3 -3
- package/dist/ui/assets/{cerebras-CNgD7lp_.js → cerebras-CkPu38zB.js} +1 -1
- package/dist/ui/assets/{cerebras-Dz-h_wl1.js → cerebras-DyqNWS1Y.js} +1 -1
- package/dist/ui/assets/{composer-speech-OESQv3sI.js → composer-speech-CYwtwCje.js} +1 -1
- package/dist/ui/assets/{connect-surface-8DlvxEca.js → connect-surface-DTTcqrqr.js} +1 -1
- package/dist/ui/assets/{directed-approval-DLMjxdBs.js → directed-approval-B49UrvyM.js} +1 -1
- package/dist/ui/assets/{emscripten-vfs-hook-C4qGX7bQ.js → emscripten-vfs-hook-DBp8M7TD.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-D55Jt3H8.js → frozen-archive-writer-DqHD_YmZ.js} +1 -1
- package/dist/ui/assets/{frozen-session-delete-BGggKcjU.js → frozen-session-delete-KzN8ices.js} +1 -1
- package/dist/ui/assets/{frozen-session-identity-BZSTAeu4.js → frozen-session-identity-CpQXS7g6.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-CUOJrgej.js → gelatiere-unit-DITQHeHY.js} +1 -1
- package/dist/ui/assets/{github-CkJtSiU7.js → github-BydhzVYu.js} +1 -1
- package/dist/ui/assets/{github-B811MuHC.js → github-YsOgetru.js} +1 -1
- package/dist/ui/assets/{github-copilot-HCrqTnGC.js → github-copilot-6bjXCTWu.js} +1 -1
- package/dist/ui/assets/{github-copilot-oFv9l7dG.js → github-copilot-B2WXNDEB.js} +1 -1
- package/dist/ui/assets/{hear-C8k48Jl2.js → hear-CH8KDdI1.js} +1 -1
- package/dist/ui/assets/{hidden-page-input-BxTN-_nx.js → hidden-page-input-B6OeTz4m.js} +1 -1
- package/dist/ui/assets/{hidden-page-input-CIKwo-BX.js → hidden-page-input-ky8ARI7S.js} +1 -1
- package/dist/ui/assets/icons-D6GFYoq8.js +1 -0
- package/dist/ui/assets/{js-realm-worker-BYcES1dO.js → js-realm-worker-zWtASICH.js} +2 -2
- package/dist/ui/assets/{jsh-executor-iplislRW.js → jsh-executor-BFtcAmYD.js} +3 -3
- package/dist/ui/assets/{kernel-worker-B2Z-nUYg.js → kernel-worker-CQSCu-DJ.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-LzLHO4a3.js → lick-ws-bridge-C-l3DXyO.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-D0FS6u9I.js → lick-ws-bridge-DYfZMcvK.js} +1 -1
- package/dist/ui/assets/{live-session-curation-C6xwCNY7.js → live-session-curation-BEAg25rv.js} +1 -1
- package/dist/ui/assets/{live-session-curation-Bi9mZH0h.js → live-session-curation-Dhhs7QlT.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-Dbnvkv8x.js → live-session-snapshot-C7nimfFx.js} +1 -1
- package/dist/ui/assets/{local-llm-CM0Cay8_.js → local-llm-CGBnh0wM.js} +1 -1
- package/dist/ui/assets/{local-llm-DGZvPJuu.js → local-llm-Vl2BOfZm.js} +1 -1
- package/dist/ui/assets/{main-cherry-zhX2VFst.js → main-cherry-D-SI0U36.js} +1 -1
- package/dist/ui/assets/{main-CXxw-s8f.js → main-wzhS5mRN.js} +3 -3
- package/dist/ui/assets/{mcp-command-DMlFGT3U.js → mcp-command-BQJ4_jV8.js} +10 -10
- package/dist/ui/assets/{memory-curation-seam-BP-IrsfK.js → memory-curation-seam-Db49FU74.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-DvUX-zG7.js → memory-write-execute-DlkqWZXl.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-Bsq0Ib6e.js → merge-folded-cost-into-frozen-DyNXepNr.js} +1 -1
- package/dist/ui/assets/{new-session-BdRMCsns.js → new-session-CmL8PbzG.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-CO11SJzF.js → oauth-bootstrap-DhcltYHp.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-2GUITkQb.js → onboarding-orchestrator-CThbUGkB.js} +1 -1
- package/dist/ui/assets/{openai-codex-YR4JQ9us.js → openai-codex-CpshQqm7.js} +1 -1
- package/dist/ui/assets/{openai-codex-BUcn4LtY.js → openai-codex-ls2687pR.js} +1 -1
- package/dist/ui/assets/{openrouter-B0gFLpAT.js → openrouter-CBiyheJ_.js} +1 -1
- package/dist/ui/assets/{openrouter-vQ5g0p4t.js → openrouter-Cu_E8CTA.js} +1 -1
- package/dist/ui/assets/{openrouter-free-DmDUncOh.js → openrouter-free-B-bVBqWr.js} +1 -1
- package/dist/ui/assets/{openrouter-free-Cc8rClvB.js → openrouter-free-CFSSzsQU.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Dn1ozKpc.js → openrouter-oauth-3drVeK6q.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CoX3NZkY.js → openrouter-oauth-qjXhxGMR.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-hilOlK5V.js → panel-rpc-handlers-CpZsLCMh.js} +2 -2
- package/dist/ui/assets/{panelize-shell-fCwzGqHl.js → panelize-shell-CWA9I5sS.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-C-JEQc-C.js → pi-edit-execution-D_07Tci_.js} +1 -1
- package/dist/ui/assets/{provider-Bc01vHZ3.js → provider-1CjFyZrg.js} +1 -1
- package/dist/ui/assets/{provider-BeWCtDQ3.js → provider-n-ILaT_Z.js} +1 -1
- package/dist/ui/assets/{provider-settings-tlJjbAeQ.js → provider-settings-BLyUyRbG.js} +1 -1
- package/dist/ui/assets/{provider-store-access-3wJOZlG7.js → provider-store-access-BRHezPh9.js} +1 -1
- package/dist/ui/assets/provider-store-access-dTNv7H6i.js +1 -0
- package/dist/ui/assets/{providers-CoJHYmNe.js → providers-D0aIIw0K.js} +2 -2
- package/dist/ui/assets/{providers-eqicsvB_.js → providers-W70_rGr6.js} +1 -1
- package/dist/ui/assets/{quick-llm-DCAllSWQ.js → quick-llm-DQ2k9zcH.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-BMUE_Hz8.js → realm-inprocess-DkBYQoZI.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-DSDIrg3R.js → realm-unhandled-rejections-7UQvNn6F.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-WM41Cfg1.js → realm-unhandled-rejections-DtmZtfRZ.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-BZVNE8DR.js → remote-terminal-view-DO3pcSbR.js} +2 -2
- package/dist/ui/assets/{restore-DvM96Ugu.js → restore-C-7bMrwQ.js} +1 -1
- package/dist/ui/assets/{run-CkQK8Cwr.js → run-B02kd4AK.js} +2 -2
- package/dist/ui/assets/{run-BEXxnwAI.js → run-B8DsB9Ty.js} +1 -1
- package/dist/ui/assets/{run-BbvDS1e5.js → run-W2c-4Sjb.js} +2 -2
- package/dist/ui/assets/{serve-command-C3Zt9caR.js → serve-command-BsloFCAg.js} +2 -2
- package/dist/ui/assets/{serve-runtime-C_dCDB4D.js → serve-runtime-BcJZmfAx.js} +1 -1
- package/dist/ui/assets/{session-command-memory-CdfHPOdQ.js → session-command-memory-p5Ibxq6r.js} +2 -2
- package/dist/ui/assets/{session-jsonl-b01SiQZt.js → session-jsonl-CFabyPcC.js} +1 -1
- package/dist/ui/assets/{session-search-index-DepHWoDZ.js → session-search-index-YpVC5dSz.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-B9_vJ1H1.js → setup-feature-flags-remote-4ZPW9ITJ.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-UPQ6ml4Q.js → setup-model-catalog-CBF1_MxP.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-BXEMMYRE.js → silent-renew-backoff-DW5doGwq.js} +1 -1
- package/dist/ui/assets/slicc-version-6uONjwzD.js +1 -0
- package/dist/ui/assets/{soundscape-DKnzoFxU.js → soundscape-CglNBAbI.js} +1 -1
- package/dist/ui/assets/{speak-D6vwVL_J.js → speak-DFl2DOUW.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-CaVy2uo1.js → sprinkle-manager-BL24_9Vk.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-CITuWHTA.js → sprinkle-renderer-DK3ZmBir.js} +1 -1
- package/dist/ui/assets/{sudo-BDm3xajX.js → sudo-f9mujWin.js} +1 -1
- package/dist/ui/assets/{supervisor-VtWuadhb.js → supervisor-DhfzpeKp.js} +1 -1
- package/dist/ui/assets/{sync-dialog-D5Q0cjUF.js → sync-dialog-BfPVjA6Y.js} +1 -1
- package/dist/ui/assets/{transformers-env-C84-8fvZ.js → transformers-env-C5nHG9EG.js} +1 -1
- package/dist/ui/assets/{tray-leader-qu__mEKK.js → tray-leader-DSOywNXE.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-LO4iGTOm.js → tray-leave-runtime-CSrC7PTT.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-CELqvXC4.js → tray-sidecar-CdHEC1Ke.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-CnccPiBn.js → upgrade-detection-DyjZsQ0o.js} +1 -1
- package/dist/ui/assets/{upgrade-to-seven-D4NzsKJF.js → upgrade-to-seven-lOabpLJO.js} +1 -1
- package/dist/ui/assets/{voice-reply-xfIZyhOh.js → voice-reply-BmXU0Qbj.js} +1 -1
- package/dist/ui/assets/{wc-attach-C9Mhe62k.js → wc-attach-BQVHqDID.js} +2 -2
- package/dist/ui/assets/{wc-browser-CI0bwE3K.js → wc-browser-DGIaoUJO.js} +1 -1
- package/dist/ui/assets/{wc-computers-bYGXyaiq.js → wc-computers-BRxQ6Rgt.js} +1 -1
- package/dist/ui/assets/{wc-detached-B3277WZK.js → wc-detached-g8MICUl4.js} +1 -1
- package/dist/ui/assets/{wc-extension-CjaGm930.js → wc-extension-iDlSw55z.js} +2 -2
- package/dist/ui/assets/{wc-follower-hANP0Y9v.js → wc-follower-B_xC0eW9.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-OGX9YuNF.js → wc-follower-oauth-Dg4W1KlK.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-BsrB8674.js → wc-gelatiere-yHA4Tegw.js} +1 -1
- package/dist/ui/assets/{wc-live-Rl9zyNOw.js → wc-live-9I2L9dTq.js} +5 -5
- package/dist/ui/assets/{wc-nav-C8FqqkCL.js → wc-nav-DAxXL8wY.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-BAabu9Xs.js → wc-onboarding-DoH45os2.js} +2 -2
- package/dist/ui/assets/{wc-permissions-COHuDzpW.js → wc-permissions-DrObWIFm.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-cMjLeeOU.js → wc-placeholder-cYrwxMcg.js} +2 -2
- package/dist/ui/assets/{wc-profile-export-PPqX9elC.js → wc-profile-export-CrCI9T6k.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-DQakJ4iC.js → wc-secret-request-atMWuXPV.js} +1 -1
- package/dist/ui/assets/{wc-settings-meDi3yxj.js → wc-settings-BDvGwHu2.js} +3 -3
- package/dist/ui/assets/{wc-shell-Cty8D-1f.js → wc-shell-DmhTp1-0.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-CdEMzluj.js → wc-shortcut-config-fwXnttsw.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-kL-04xzI.js → wc-sprinkles-BUHnq7sX.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-nBVzrgCd.js → wc-transcript-export-azHVnFyW.js} +2 -2
- package/dist/ui/assets/{wc-tray-Bb8ILz7k.js → wc-tray-BQ4gj0nU.js} +4 -4
- package/dist/ui/assets/{welcome-detection-DaonMeSW.js → welcome-detection-hlFW_78p.js} +1 -1
- package/dist/ui/assets/{whisper-session-LfAksMkB.js → whisper-session-CM7xH2iz.js} +2 -2
- package/dist/ui/assets/{xai-grok-CxDGtG_E.js → xai-grok-DEmv_KzO.js} +1 -1
- package/dist/ui/assets/{xai-grok-BXudiU7L.js → xai-grok-UDYG0WfS.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/lucide-icons.js +240 -223
- 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 +1 -1
- package/dist/ui/assets/icons-D4XASin-.js +0 -1
- package/dist/ui/assets/provider-store-access-CFbI4daT.js +0 -1
- package/dist/ui/assets/slicc-version-CiMJbWqF.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-CcZuCy3S.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-BchrtNkI.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-eqicsvB_.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-T_lAyEsT.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-CiMJbWqF.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-BUs1VYn5.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-BP0N1c4w.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-CZVx93O7.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-iplislRW.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-DXrnHuCT.js";import{i as Gi,t as Ki}from"./github-auth-DubiihCt.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-B5P9cdQn.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-CM0Cay8_.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-C_paLZbO.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-BchrtNkI.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-W70_rGr6.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-T_lAyEsT.js";import{a as ct}from"./tray-leader-status-BPM2zVsj.js";import{n as lt,t as ut}from"./slicc-version-6uONjwzD.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-BUs1VYn5.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-BP0N1c4w.js";import{a as ir,i as ar,r as or,t as sr}from"./git-config-CZVx93O7.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-BFtcAmYD.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-DXrnHuCT.js";import{i as Gi,t as Ki}from"./github-auth-DubiihCt.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-B5P9cdQn.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-CGBnh0wM.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 "*".
|
|
@@ -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-CQSCu-DJ.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-CQSCu-DJ.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-CQSCu-DJ.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
|
|
|
@@ -1432,7 +1432,7 @@ Options:
|
|
|
1432
1432
|
--global Resolve only from the shared global prefix (/shared/lib/node_modules)
|
|
1433
1433
|
-h, --help Show this help message
|
|
1434
1434
|
`}async function rk(e,t){let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)}async function ik(e,t){try{return(await e.stat(t)).type===`file`}catch{return!1}}async function ak(e,t){try{return(await e.stat(t)).type===`directory`}catch{return!1}}function*ok(e,t=!1){if(t){yield vr;return}let n=x(e);for(;yield S(n,`node_modules`),n!==`/`;)n=Ge(n).dir;yield vr}async function sk(e,t,n,r=!1){for(let i of ok(t,r)){let t=S(i,`.bin`,n);if(!await ik(e,t))continue;let r=await rk(e,t),a=tk.exec(r),o=Ge(t).dir;return{binFilePath:a?S(o,a[1]):t,argvName:t}}return null}function ck(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t!==-1)return e.slice(t+1)}return e}function lk(e,t){if(typeof e==`string`)return{binName:ck(t),binPath:e};if(typeof e!=`object`||!e)return null;let n=[t,ck(t)];for(let t of n){let n=Object.getOwnPropertyDescriptor(e,t)?.value;if(typeof n==`string`)return{binName:t,binPath:n}}let r=Object.entries(e).filter(e=>typeof e[1]==`string`);if(r.length===1){let[e,t]=r[0];return{binName:e,binPath:t}}return null}async function uk(e,t,n,r=!1){for(let i of ok(t,r)){let t=S(i,n),r=S(t,`package.json`);if(!await ik(e,r))continue;let a;try{a=JSON.parse(await rk(e,r))}catch{return null}let o=lk(a.bin,n);if(!o)return null;let s=o.binPath.replace(/^\.\//,``);return{binFilePath:S(t,s),argvName:S(i,`.bin`,o.binName)}}return null}async function dk(e,t,n,r=!1){return await sk(e,t,n,r)??await uk(e,t,n,r)}async function fk(e,t,n){for(let r of ok(t))if(await ik(e,S(r,n,`package.json`)))return!0;return!1}function pk(e){return e instanceof Error?e.message:String(e)}function mk(e,t){return{stdout:``,stderr:`${e}: ${t}\n`,exitCode:1}}async function hk(e,t,n,r){try{let{installPackages:i}=await import(`./installer-BJen8y2q.js`),a=await i([t],{fs:r.fs,fetch:r.fetch,cwd:n.cwd});if(a.errors.length>0)return{error:mk(e,`failed to install '${t}': ${pk(a.errors[0].error)}`)};let o=a.results.map(t=>`${e}: installed ${t.name}@${t.version}`);return{progress:o.length>0?`${o.join(`
|
|
1435
|
-
`)}\n`:``}}catch(n){return{error:mk(e,`failed to install '${t}': ${pk(n)}`)}}}async function gk(e,t,n,r){return await ik(r,n)?null:await ak(r,n)?mk(e,`bin target '${n}' is a directory, not a file`):mk(e,`bin file '${n}' for '${t}' does not exist`)}async function _k(e,t,n,r,i,a){if(await fk(a.fs,i.cwd,t))return{error:mk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:QO(t);if(o)return{error:{stdout:``,stderr:ek(e,t,n,o),exitCode:1}};let s=await hk(e,t,i,a);if(`error`in s)return s;let c=await dk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:mk(e,`package '${t}' was installed but does not expose an executable bin`)}}function vk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:nk(e),stderr:``,exitCode:+(n.length===0)};let i=n[0]===`--force`,a=i?n.slice(1):n,o=a[0]===`--global`;o&&(a=a.slice(1));let s=a;if(s.length===0)return{stdout:nk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await dk(t.fs,r.cwd,c,o)}catch(t){return mk(e,pk(t))}let d=``;if(!u){if(o)return mk(e,`no global bin '${c}' found in ${vr}`);let n=await _k(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await gk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Si(await rk(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 yk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-
|
|
1435
|
+
`)}\n`:``}}catch(n){return{error:mk(e,`failed to install '${t}': ${pk(n)}`)}}}async function gk(e,t,n,r){return await ik(r,n)?null:await ak(r,n)?mk(e,`bin target '${n}' is a directory, not a file`):mk(e,`bin file '${n}' for '${t}' does not exist`)}async function _k(e,t,n,r,i,a){if(await fk(a.fs,i.cwd,t))return{error:mk(e,`package '${t}' does not expose an executable bin`)};let o=r?void 0:QO(t);if(o)return{error:{stdout:``,stderr:ek(e,t,n,o),exitCode:1}};let s=await hk(e,t,i,a);if(`error`in s)return s;let c=await dk(a.fs,i.cwd,t);return c?{resolved:c,installProgress:s.progress}:{error:mk(e,`package '${t}' was installed but does not expose an executable bin`)}}function vk(e,t){return{name:e,trusted:!0,async execute(n,r){if(n.length===0||n[0]===`--help`||n[0]===`-h`)return{stdout:nk(e),stderr:``,exitCode:+(n.length===0)};let i=n[0]===`--force`,a=i?n.slice(1):n,o=a[0]===`--global`;o&&(a=a.slice(1));let s=a;if(s.length===0)return{stdout:nk(e),stderr:``,exitCode:1};let c=s[0],l=s.slice(1),u;try{u=await dk(t.fs,r.cwd,c,o)}catch(t){return mk(e,pk(t))}let d=``;if(!u){if(o)return mk(e,`no global bin '${c}' found in ${vr}`);let n=await _k(e,c,l,i,r,t);if(`error`in n)return n.error;u=n.resolved,d=n.installProgress}let f=await gk(e,c,u.binFilePath,t.fs);if(f)return f;let p=Si(await rk(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 yk(e={}){return C(`jshd`,async(t,n)=>{let{runJshd:r}=await import(`./run-B02kd4AK.js`);return r(t,n,e)})}const bk=/* @__PURE__ */ new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]);function xk(e={}){return C(`kill`,async t=>{if(t.length===0||t.includes(`--help`)||t.includes(`-h`))return Dk();let n=e.processManager??Sk();if(!n)return{stdout:``,stderr:`kill: no process manager available in this runtime
|
|
1436
1436
|
`,exitCode:1};let r=Ck(t);if(!r.ok)return{stdout:``,stderr:r.stderr,exitCode:r.exitCode};let{allDelivered:i,errors:a}=wk(n,r.pids,r.signal);return{stdout:``,stderr:a.length?`${a.join(`
|
|
1437
1437
|
`)}\n`:``,exitCode:+!i}})}function Sk(){let e=globalThis.__slicc_pm;return e instanceof Object&&typeof e.signal==`function`?e:null}function Ck(e){let t=`SIGTERM`,n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i===`-s`||i===`--signal`){let n=e[++r];if(!n)return{ok:!1,stderr:`kill: -s requires a signal name
|
|
1438
1438
|
`,exitCode:2};let i=Tk(n);if(i instanceof Error)return{ok:!1,stderr:`kill: ${i.message}\n`,exitCode:2};t=i;continue}if(i.startsWith(`-`)){let e=Ek(i);if(e instanceof Error)return{ok:!1,stderr:`kill: ${e.message}\n`,exitCode:2};t=e;continue}let a=Number.parseInt(i,10);if(!Number.isFinite(a)||String(a)!==i)return{ok:!1,stderr:`kill: invalid pid '${i}'\n`,exitCode:2};n.push(a)}return n.length===0?{ok:!1,stderr:`kill: no pids supplied
|
|
@@ -1505,7 +1505,7 @@ Common base URLs:
|
|
|
1505
1505
|
`)+`
|
|
1506
1506
|
`,stderr:``,exitCode:0}}function eA(e,t){let n=t.models.length;return{stdout:[`✓ ${e} (${Xk(t.runtime,!1)})`,` Saved ${n} model${n===1?``:`s`} to Settings:`,...Zk(t.models)].join(`
|
|
1507
1507
|
`)+`
|
|
1508
|
-
`,stderr:``,exitCode:0}}function tA(){return C(Jk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Yk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-
|
|
1508
|
+
`,stderr:``,exitCode:0}}function tA(){return C(Jk,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:Yk(),stderr:``,exitCode:0};let{getApiKeyForProvider:t,getRawApiKeyForProvider:n,getBaseUrlForProvider:r,addAccount:i}=await import(`./account-store-C_paLZbO.js`).then(e=>e.t),{verifyConnection:a}=await import(`./local-llm-CGBnh0wM.js`).then(e=>e.n),o=e[0]??`status`;if(o!==`status`&&o!==`discover`)return{stdout:``,stderr:`Unknown subcommand: ${o}. See \`local-llm --help\`.\n`,exitCode:2};let s=r(Jk);if(!s)return{stdout:``,stderr:`Local LLM is not configured. Open Settings → Providers → Local LLM and set a base URL.
|
|
1509
1509
|
`,exitCode:1};let c=await a(s,t(Jk)??void 0);if(!c.ok)return Qk(s,c);if(o===`discover`){let e=n(Jk)??``;return i(Jk,e,s,c.models.join(`, `)),eA(s,c)}return $k(s,c)})}function nA(){return{stdout:`usage: man <topic>
|
|
1510
1510
|
|
|
1511
1511
|
Fetches documentation for a given topic from sliccy.com.
|
|
@@ -1539,7 +1539,7 @@ Options:
|
|
|
1539
1539
|
-h, --help Show this help message
|
|
1540
1540
|
`}function TA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`.replace(`.0M`,`M`):e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function EA(e){return`$${e.toFixed(2)}`}const DA=/\b(embedding|embed|tts|whisper|dall-e|image-gen|audio|vision-preview)\b/i;function OA(e){let t=`${e.id} ${e.name??``}`;return!DA.test(t)}function kA(e){let t=e.match(/^(claude-(?:opus|sonnet|haiku))/);if(t)return t[1];let n=e.match(/^(gpt-\d+)(?:\.\d+)?(-[a-z][-a-z]*)?$/);if(n)return n[1]+(n[2]??``);let r=e.match(/^gemini-[\d.]+-(.+)$/);if(r)return`gemini-${r[1]}`;let i=e.match(/^gemini-(\d+)-(.+)$/);if(i)return`gemini-${i[2]}`;let a=e.match(/^grok-[\d.]+-([\w-]+)$/);if(a)return`grok-${a[1]}`;if(e.match(/^(grok)-[\d.]+$/))return`grok`;let o=e.match(/^(o\d+(?:-[a-z]+)?)(?:-\d.*)?$/);if(o)return o[1]}function AA(e){let t=e.toLowerCase();return t=t.replace(/-\d{8}$/,``),t=t.replace(/-\d{4}$/,``),t=t.replace(/-(preview|latest)$/,``),kA(t)??t.replace(/-[\d.]+$/,``)}function jA(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=AA(n.id);(!t.has(e)||n.selected)&&t.set(e,n)}return[...t.values()]}function MA(e,t,n,r,i){let a=i?CA(e.id,i):void 0,o={id:e.id,name:e.name,provider:t,cost:e.cost??{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:e.contextWindow??0,maxTokens:e.maxTokens??0,reasoning:!!e.reasoning,input:e.input??[`text`],selected:e.id===n&&t===r};return a?.intelligence_index!=null&&(o.intelligence=a.intelligence_index),a?.coding_index!=null&&(o.codingScore=a.coding_index),a?.speed_tps!=null&&(o.speed=a.speed_tps),o}function NA(e,t,n,r){let i=[];i.push(`Models for "${e}" (${t}):\n`);for(let e of n){let t=e.selected?` ► `:` `,n=e.id.padEnd(30),r=`${EA(e.cost.input)} / ${EA(e.cost.output)}`,a=`${TA(e.contextWindow)} ctx`,o=e.intelligence==null?``:`IQ:${e.intelligence}`,s=e.speed==null?``:`${Math.round(e.speed)} t/s`,c=e.reasoning?`reasoning`:``,l=o||s?`${o.padEnd(6)} ${s.padEnd(8)}`:``;i.push(`${t}${n} ${r.padEnd(16)} ${a.padEnd(10)} ${l} ${c}`)}return i.push(`\n ${n.length} model${n.length===1?``:`s`} available.`),r&&i.push(` Intelligence data: artificialanalysis.ai`),i.join(`
|
|
1541
1541
|
`)+`
|
|
1542
|
-
`}function PA(e){let t=w(e,{bool:mA,value:hA});return`error`in t?t:{jsonMode:t.bools.has(`--json`),allMode:t.bools.has(`--all`),allVersions:t.bools.has(`--all-versions`),forceRefresh:t.bools.has(`--refresh`),noBenchmarks:t.bools.has(`--no-benchmarks`),explicitProvider:t.values.get(`--provider`)}}function FA(e,t,n){if(t.explicitProvider){let n=e.getAvailableProviders();return n.includes(t.explicitProvider)?[t.explicitProvider]:{error:`Unknown provider: ${t.explicitProvider}. Available: ${n.join(`, `)}\n`}}return t.allMode?[...new Set(e.getAccounts().map(e=>e.providerId))]:[n]}function IA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(OA);if(o.length===0)return[];let s=o.map(e=>MA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=jA(s)),s}function LA(e,t,n,r){let i=`${e}:${t}`,a=`${n}:${r}`;return i===a?`Currently using: ${i}\n`:`Currently using: ${i} (selected ${a} — resolved to a different model)\n`}async function RA(e,t){if(T(e,{valueFlags:hA}))return{stdout:wA(),stderr:``,exitCode:0};let n=PA(e);if(`error`in n)return gA(`models: ${n.error}`);let r=await import(`./account-store-
|
|
1542
|
+
`}function PA(e){let t=w(e,{bool:mA,value:hA});return`error`in t?t:{jsonMode:t.bools.has(`--json`),allMode:t.bools.has(`--all`),allVersions:t.bools.has(`--all-versions`),forceRefresh:t.bools.has(`--refresh`),noBenchmarks:t.bools.has(`--no-benchmarks`),explicitProvider:t.values.get(`--provider`)}}function FA(e,t,n){if(t.explicitProvider){let n=e.getAvailableProviders();return n.includes(t.explicitProvider)?[t.explicitProvider]:{error:`Unknown provider: ${t.explicitProvider}. Available: ${n.join(`, `)}\n`}}return t.allMode?[...new Set(e.getAccounts().map(e=>e.providerId))]:[n]}function IA(e,t,n,r,i,a){let o=e.getProviderModels(t).filter(OA);if(o.length===0)return[];let s=o.map(e=>MA(e,t,n,r,i)).sort((e,t)=>t.cost.input-e.cost.input);return a||(s=jA(s)),s}function LA(e,t,n,r){let i=`${e}:${t}`,a=`${n}:${r}`;return i===a?`Currently using: ${i}\n`:`Currently using: ${i} (selected ${a} — resolved to a different model)\n`}async function RA(e,t){if(T(e,{valueFlags:hA}))return{stdout:wA(),stderr:``,exitCode:0};let n=PA(e);if(`error`in n)return gA(`models: ${n.error}`);let r=await import(`./account-store-C_paLZbO.js`).then(e=>e.t);if(r.getAccounts().length===0)return gA(`No provider accounts configured. Run the provider settings to add one.
|
|
1543
1543
|
`);let i=r.resolveCurrentModel(),a=i.id,o=i.provider,s=r.getSelectedProvider(),c=r.getSelectedModelId(),l;if(!n.noBenchmarks){let e=await xA(t,n.forceRefresh);e.length>0&&(l=e)}let u=FA(r,n,s);if(`error`in u)return gA(u.error);let d=[],f=[];for(let e of u){let t=IA(r,e,a,o,l,n.allVersions);if(t.length===0){if(!n.allMode)return gA(`No models available for provider ${e}.\n`)}else if(d.push(...t),!n.jsonMode){let n=r.getProviderConfig(e);f.push(NA(n.name,e,t,!!l))}}return n.jsonMode?{stdout:JSON.stringify(d,null,2)+`
|
|
1544
1544
|
`,stderr:``,exitCode:0}:(n.allVersions||f.push(`Showing latest versions only. Use --all-versions to see all.
|
|
1545
1545
|
`),f.push(LA(o,a,s,c)),{stdout:f.join(`
|
|
@@ -1597,7 +1597,7 @@ Examples:
|
|
|
1597
1597
|
`)}\n`,stderr:``,exitCode:0}}async function lj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain add: requires <providerId> and <domain>
|
|
1598
1598
|
`,exitCode:1};let r=e.getExtraOAuthDomains(t),i=n.toLowerCase();return r.some(e=>e.toLowerCase()===i)?{stdout:`(${n} already in ${t} extras)\n`,stderr:``,exitCode:0}:(await e.setExtraOAuthDomainsAsync(t,[...r,n]),{stdout:`Added ${n} to ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0})}async function uj(e,t,n){if(!t||!n)return{stdout:``,stderr:`oauth-domain remove: requires <providerId> and <domain>
|
|
1599
1599
|
`,exitCode:1};let r=e.getExtraOAuthDomains(t),i=n.toLowerCase(),a=r.filter(e=>e.toLowerCase()!==i);return a.length===r.length?{stdout:`(${n} not found in ${t} extras)\n`,stderr:``,exitCode:0}:(await e.setExtraOAuthDomainsAsync(t,a),{stdout:`Removed ${n} from ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0})}async function dj(e,t){return t?(await e.setExtraOAuthDomainsAsync(t,[]),{stdout:`Cleared extra domains for ${t}. Reload the page to apply.\n`,stderr:``,exitCode:0}):{stdout:``,stderr:`oauth-domain clear: requires <providerId>
|
|
1600
|
-
`,exitCode:1}}async function fj(e,t,n,r){switch(t){case`list`:return cj(e,n);case`add`:return lj(e,n,r);case`remove`:return uj(e,n,r);case`clear`:return dj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${oj()}`,exitCode:1}}}function pj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:oj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return sj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-
|
|
1600
|
+
`,exitCode:1}}async function fj(e,t,n,r){switch(t){case`list`:return cj(e,n);case`add`:return lj(e,n,r);case`remove`:return uj(e,n,r);case`clear`:return dj(e,n);default:return{stdout:``,stderr:`oauth-domain: unknown subcommand "${t}"\n${oj()}`,exitCode:1}}}function pj(){return C(`oauth-domain`,async e=>{if(e.length===0||T(e))return{stdout:oj(),stderr:``,exitCode:0};let t=w(e);if(`error`in t)return sj(t.error);let[n,r,i]=t.positionals,a=await import(`./account-store-C_paLZbO.js`).then(e=>e.t);try{return await fj(a,n,r,i)}catch(e){return sj(e instanceof Error?e.message:String(e))}})}function mj(){return C(`oauth-token`,async(e,t)=>{let{runOAuthToken:n}=await import(`./run-W2c-4Sjb.js`);return n(e,t)})}const hj=[`--download`,`-d`,`--view`,`-v`],gj=[`--size`],_j={low:256,medium:768,high:1536};function vj(){return{stdout:`usage: open [--download|-d] [--view|-v [--size <spec>]] <url|path> [url|path...]
|
|
1601
1601
|
|
|
1602
1602
|
VFS paths are served in a new browser tab via the preview service worker.
|
|
1603
1603
|
URLs (http/https/etc.) are opened directly in a new tab.
|
|
@@ -1623,7 +1623,7 @@ Examples:
|
|
|
1623
1623
|
`);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 Dj(`opened ${e} → ${o}${Oj(s)}`)}async function Fj(e,t,n,r){if(!Ar(e)&&e.endsWith(`.shtml`)&&t.fs)return Aj(e,t,r.sprinkleManager,r.canOpenWindow,r.openExternal);if(!n.view&&!r.canOpenWindow)return G(`open: browser APIs are unavailable in this environment
|
|
1624
1624
|
`);if(Ar(e))return jj(e,r.canOpenWindow,r.openExternal);let i=t.fs.resolvePath(t.cwd,e);return n.view?Mj(e,i,t,n.sizeSpec):n.download?Nj(e,i,t,r.hasDom):Pj(i,t,r.canOpenWindow,r.openExternal)}function Ij(e){return C(`open`,async(t,n)=>{if(t.length===0||T(t,{valueFlags:gj}))return vj();let r=Ej(t);if(`error`in r)return{stdout:``,stderr:`${r.error}\n`,exitCode:1};let{download:i,view:a,sizeSpec:o,targets:s}=r;if(s.length===0)return vj();let c=globalThis.__slicc_sprinkleManager,l=typeof window<`u`&&typeof document<`u`,u=l?null:b(),d={canOpenWindow:!!e||l||!!u,hasDom:l,sprinkleManager:c,openExternal:kj(e,l,u)},f=[];for(let e of s){let t=await Fj(e,n,{view:a,download:i,sizeSpec:o},d);if(!t.ok)return t.result;f.push(t.message)}return{stdout:f.join(`
|
|
1625
1625
|
`)+`
|
|
1626
|
-
`,stderr:``,exitCode:0}})}function Lj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-
|
|
1626
|
+
`,stderr:``,exitCode:0}})}function Lj(){return C(`patch`,async(e,t)=>{let{runPatch:n}=await import(`./run-B8DsB9Ty.js`);return n(e,t)})}function Rj(e=`pdftk`){return C(e,async(t,n)=>{let{runPdftk:r}=await import(`./run-qNIe8UVD.js`);return r(e,t,n)})}function zj(){return{stdout:`usage: pdftoppm [options] <input.pdf> [output-prefix]
|
|
1627
1627
|
|
|
1628
1628
|
Rasterize PDF pages to images. Writes <prefix>-<n>.<ext> per page, where <n>
|
|
1629
1629
|
is zero-padded to the digit width of the last page (out-1.png for a 9-page
|
|
@@ -1918,7 +1918,7 @@ Limits and lifetime:
|
|
|
1918
1918
|
`,exitCode:1};if(e.ttlMs!==void 0&&e.maxTabs!==void 0)return{stdout:``,stderr:`serve: --ttl cannot be combined with --max-tabs
|
|
1919
1919
|
`,exitCode:1}}async function BP(e,t,n){if(e.ttlMs!==void 0){if(!t)throw Error(`persistent snapshot filesystem unavailable`);return MP(t,n)}}async function VP(e,t,n,r){if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return gP();let i=SP(e);if(i.error)return{stdout:``,stderr:i.error,exitCode:1};let a=await RP(i);if(a)return a;if(!i.directory)return gP();let o=zP(i);if(o)return o;let s=await CP(i.directory,i.entry,t.fs,t.cwd);if(wP(s))return s;let{fullDirectory:c,entryPath:l}=s,u;try{u=await BP(i,r,c)}catch(e){return{stdout:``,stderr:`serve: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}let d=i.project?`serve: --project is obsolete; ignored (root-absolute paths work natively under unified preview)
|
|
1920
1920
|
`:``,f=await IP(!i.noBridge&&i.bridge,d);return f.ok?LP(i,c,l,f.webhookId,d,u,n):f.result}function HP(e,t){return C(`serve`,(n,r)=>VP(n,r,e,t))}const UP=`usage: session export [--id <id>] [--output <path>]
|
|
1921
|
-
`;function WP(e){if(e.includes(`\0`))return{ok:!1,reason:`path must not contain NUL bytes`};if(e.includes(`\\`))return{ok:!1,reason:`path must not contain backslashes`};let t=e.split(`/`);for(let e of t)if(e===`..`)return{ok:!1,reason:`path must not contain ".."/traversal segments`};return{ok:!0}}function GP(e){let t=null,n=null,r=e.slice(1);for(let e=0;e<r.length;e++){let i=r[e];if(i===`--id`){if(t!==null)return{ok:!1,stderr:`session export: duplicate flag --id\n${UP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${UP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${UP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${UP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${UP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${UP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function KP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||It(r)!==a.sha256)throw new Ha(`transfer-corrupt`);return r}async function qP(e,t){let n=GP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=WP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${UP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Ds().export(a,{}),n=await KP(e),r=i??`/workspace/${e.filename}`;return await t.fs.writeFile(r,n),{stdout:`exported ${r}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`session export: ${e instanceof Ha?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function JP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return qP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-
|
|
1921
|
+
`;function WP(e){if(e.includes(`\0`))return{ok:!1,reason:`path must not contain NUL bytes`};if(e.includes(`\\`))return{ok:!1,reason:`path must not contain backslashes`};let t=e.split(`/`);for(let e of t)if(e===`..`)return{ok:!1,reason:`path must not contain ".."/traversal segments`};return{ok:!0}}function GP(e){let t=null,n=null,r=e.slice(1);for(let e=0;e<r.length;e++){let i=r[e];if(i===`--id`){if(t!==null)return{ok:!1,stderr:`session export: duplicate flag --id\n${UP}`};let n=r[e+1];if(!n||n.startsWith(`-`))return{ok:!1,stderr:`session export: --id requires a value\n${UP}`};t=n,e++}else if(i===`--output`){if(n!==null)return{ok:!1,stderr:`session export: duplicate flag --output\n${UP}`};let t=r[e+1];if(!t||t.startsWith(`-`))return{ok:!1,stderr:`session export: --output requires a path\n${UP}`};n=t,e++}else if(i.startsWith(`-`))return{ok:!1,stderr:`session export: unknown flag ${i}\n${UP}`};else return{ok:!1,stderr:`session export: unexpected argument ${JSON.stringify(i)}\n${UP}`}}return{ok:!0,args:{sessionId:t,outputPath:n}}}async function KP(e){let t=[],n=0;for await(let r of e.chunks)t.push(r),n+=r.byteLength;let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=await e.completion;if(a.byteLength!==n||It(r)!==a.sha256)throw new Ha(`transfer-corrupt`);return r}async function qP(e,t){let n=GP(e);if(!n.ok)return{stdout:``,stderr:n.stderr,exitCode:1};let{sessionId:r,outputPath:i}=n.args;if(i!==null){let e=WP(i);if(!e.ok)return{stdout:``,stderr:`session export: --output ${e.reason}\n${UP}`,exitCode:1}}let a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r};try{let e=await Ds().export(a,{}),n=await KP(e),r=i??`/workspace/${e.filename}`;return await t.fs.writeFile(r,n),{stdout:`exported ${r}\n`,stderr:``,exitCode:0}}catch(e){return{stdout:``,stderr:`session export: ${e instanceof Ha?e.code:e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}function JP(){return C(`session`,async(e,t)=>{if(e[0]===`export`&&!T(e))return qP(e,t);let{dispatchSessionMemoryAware:n}=await import(`./session-command-memory-p5Ibxq6r.js`);return n(e,t,UP)})}function YP(){return C(`slicc`,async(e,t)=>{let{runSlicc:n}=await import(`./run-CDSVO_JK.js`);return await n(e,t)})}const XP=`leader`;function ZP(){try{let e=globalThis.localStorage?.getItem(`slicc.leaderSprinkleInstances`);if(e)return JSON.parse(e)}catch{}return[]}function QP(e){return+!!e.leader+e.followers.length}function $P(){return{stdout:`usage: sprinkle <subcommand> [args]
|
|
1922
1922
|
|
|
1923
1923
|
list [--runtime <id>] List sprinkles + an instance line per runtime
|
|
1924
1924
|
open <name> Open a sprinkle by name
|
|
@@ -3330,6 +3330,6 @@ pass --wait to block and print the full result.`,zB=/* @__PURE__ */ new Set([`li
|
|
|
3330
3330
|
`,stderr:``,exitCode:0};let n;try{n=dV(e)}catch(e){return $B(e.message)}let r=n.positional[0],i=n.positional[1],a=!r||r===`-`,o;try{o=await pV(t,r,a)}catch{return $B(`${r}: No such file or directory`)}if(n.revert){let e=nV(o),r=n.plain?sV(e):cV(e);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),r),{stdout:``,stderr:``,exitCode:0}):{stdout:nV(r),stderr:``,exitCode:0}}let{data:s,base:c}=hV(n,o),l=mV(n,s,c,r,a);return i?(await t.fs.writeFile(t.fs.resolvePath(t.cwd,i),l),{stdout:``,stderr:``,exitCode:0}):{stdout:l,stderr:``,exitCode:0}})}async function _V(e,t,n,r){if((await e.fs.stat(t)).isFile)return r[n]=await e.fs.readFileBuffer(t),1;let i=await e.fs.readdir(t),a=0;for(let o of i){let i=jr(t,o),s=n?`${n}/${o}`:o;a+=await _V(e,i,s,r)}return a}function vV(){return{stdout:`usage: zip [-r] <archive.zip> <path> [path...]
|
|
3331
3331
|
`,stderr:``,exitCode:0}}function yV(){return C(`zip`,async(e,t)=>{if(e.length===0||e.includes(`--help`)||e.includes(`-h`))return vV();let n=!1,r=[];for(let t of e)if(t===`-r`)n=!0;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
|
|
3332
3332
|
`,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 _V(t,r,a,o)}if(s===0)return{stdout:``,stderr:`zip: nothing to do
|
|
3333
|
-
`,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function bV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-
|
|
3333
|
+
`,exitCode:1};let c=Rt(o);return await t.fs.writeFile(i,c),{stdout:`created ${i} (${s} file(s))\n`,stderr:``,exitCode:0}})}function bV(e){let t;return C(`mcp`,async(n,r)=>{if(!t){let{createMcpCommand:n}=await import(`./mcp-command-BQJ4_jV8.js`);t=n({fs:e.fs,scriptCatalog:e.scriptCatalog,connectionManager:e.mcpConnectionManager})}return t.execute(n,r)})}function xV(e){return{setEnv:e.setEnv,unsetEnv:e.unsetEnv,broker:e.sudoCommand?.broker}}function SV(e){let{fs:t,fetch:n}=e;if(!t||!n)return[];let r={fs:t,fetch:n,scriptCatalog:e.scriptCatalog,syncScriptCommands:e.syncScriptCommands};return[kO(`ipk`,r),kO(`npm`,r),kO(`i`,r),vk(`ipx`,{fs:t,fetch:n}),vk(`npx`,{fs:t,fetch:n}),Sb(`di`,{fs:t,fetch:n}),Sb(`uv`,{fs:t,fetch:n}),KL({fs:t,fetch:n})]}function CV(e){let t={buildProcessConfig:e.buildProcessConfig};return[`python3`,`python`,`pyodide`].map(e=>QM(e,t))}function wV(e){let t=e.scriptCatalog;return{buildProcessConfig:e.buildProcessConfig,terminal:e.terminal,gate:e.gateNativeCommand,commands:t&&(()=>t.getWasmCommands()),gitIdentity:e.gitIdentity}}function TV(){return[JP(),PS()]}function EV(e={}){let t=[PE({getJshCommands:e.getJshCommands,getWorkflowCommands:e.getWorkflowCommands}),oe(),AF(),YP(),HP(e.browserAPI,e.fs),Ij(e.browserAPI),Ly(e.browserAPI),zD(e),yV(),SL(),mI(e.fs?{fs:e.fs}:{}),LF(),WF(),VF(),Mv(),_z(wV(e)),sC(wV(e)),gV(),wF(`sqlite3`),wF(`sqllite`),jI(),ZI(),Rx(),mv(),$A({buildProcessConfig:e.buildProcessConfig}),$A({buildProcessConfig:e.buildProcessConfig},`jsh`),...CV(e),...SV(e),...e.fs?[oC({fs:e.fs})]:[],...e.fs?[dA({fs:e.fs})]:[],...e.fetch?[GE({fetch:e.fetch,streamFetch:e.streamFetch})]:[],FS(),IS(),JS(),Mz(e.webhook),_B(),Iy(e.crontask),bV(e),nM({fs:e.fs,fetch:e.fetch}),aC(),hF(),Lj(),Rj(`pdftk`),Rj(`pdf`),hv(`biscotto`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),hv(`biscotti`,{getParentJid:e.getParentJid,isScoop:e.isScoop}),Jj(`pdftoppm`),Jj(`pdftocairo`),Yj(`pdftotext`),by(`convert`),by(`magick`),DB({fs:e.fs,scriptCatalog:e.scriptCatalog,getStaticBuiltins:e.getStaticBuiltins,getScriptRegisteredNames:e.getScriptRegisteredNames}),tL(),_L(),FD(),ID(),vL(),fA(),nN(),iA(),lx(),mj(),pj(),tA(),pP(xV(e)),Jp(e.gitCredential),hN({fs:e.fs}),VN(),kv(),Av(),jv(`xclip`),jv(`xsel`),BN(),CC(),a_(),o_(),zA(e.fs),_t(),ij(),s_({getParentJid:e.getParentJid}),_x(),wM({processManager:e.processManager}),sR({processManager:e.processManager}),xk({processManager:e.processManager}),yk({processManager:e.processManager,scriptCatalog:e.scriptCatalog}),...l_(),uA(),qk(),MR(),_D(),yS(),JR({processManager:e.processManager}),Fv({processManager:e.processManager,browser:e.browserAPI,sudoBroker:e.sudoCommand?.broker}),AS(),Sv({registry:e.cherryRuntimeRegistry}),Ky(),Qy({fs:e.fs}),$y({fs:e.fs}),MF(e.sudoCommand),WB({getParentJid:e.getParentJid,syncScriptCommands:e.syncScriptCommands}),vB(),...TV()];return e.fs&&(Zj(),t.push(...$n.map(t=>jE(t,e.browserAPI,e.fs,{isScoop:e.isScoop})))),t}let DV=null;function OV(e){DV=e}function kV(e){DV?.(e)}var AV=Yt();const jV={user:`user`,home:gr},MV=/* @__PURE__ */ new Set([`root`,`nobody`,`nogroup`]),NV=/^[A-Za-z_][A-Za-z0-9_.-]*$/;function PV(e){return{user:NV.test(e.user)&&!MV.has(e.user)?e.user:jV.user,home:e.home.startsWith(`/`)&&!/[:\n]/.test(e.home)?e.home:jV.home}}function FV(e,t){let{user:n,home:r}=PV(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(`
|
|
3334
3334
|
`);if(e===`/etc/group`)return[`root:x:0:`,`${n}:x:1000:`,`nogroup:x:65534:`,``].join(`
|
|
3335
3335
|
`)}function IV(e,t=jV){let n=FV(e,t);return n===void 0?void 0:new TextEncoder().encode(n)}function LV(e){return e===`/etc`?[`group`,`passwd`]:[]}function RV(e){return e?.code===`ENOENT`}const zV=Reflect.get(ft,`DefenseInDepthBox`);function BV(e){return(typeof e==`string`?e:e?.encoding)??`utf8`}function VV(e,t){if(typeof e!=`string`)return e;let n=BV(t);if(n===`binary`||n===`latin1`){let t=Oe(e);if(t)return t}return AV.Buffer.from(e,n)}function HV(e){return e===`/bin`?`/usr/bin`:e.startsWith(`/bin/`)?`/usr${e}`:e}function UV(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 WV(e,t){let n=LV(e).filter(e=>!t.includes(e));return n.length?[...t,...n].sort():t}function GV(e,t){let n=LV(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 KV=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 IV(e,this.identityFn?.()??jV)}isVirtualBinCommand(e){return e.length>0&&!e.includes(`/`)&&this.getVirtualBinCommands().includes(e)}getVirtualBinCommands(){return this.registeredCommandsFn?.()??[]}virtualUsrStat(e){let t=HV(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:UV(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=zV?.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=BV(t),a=AV.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=HV(e);if(t.startsWith(`/usr/bin/`)&&this.isVirtualBinCommand(t.slice(9)))return UV(t.slice(9));let n;try{n=await this.vfs.readFile(e,{encoding:`binary`})}catch(t){let n=this.identityFile(e);if(n&&RV(t))return n;throw t}return n instanceof Uint8Array?n:new TextEncoder().encode(n)}identityStat(e,t){let n=this.identityFile(e);if(n&&RV(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 AV.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,VV(t,n))})}async appendFile(e,t,n){return this.dropListingStats(),this.trusted(()=>this.vfs.appendFile(x(e),VV(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(HV(t)===`/usr/bin`)return this.getVirtualBinCommands().slice().sort();let n=this.vfs.readDirSync(t);if(n!==null)return WV(t,n.map(e=>e.name));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),WV(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(HV(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 GV(t,this.mapFastEntriesToDirents(n));let r=await this.vfs.readDir(t,{includeStats:!0});return this.primeListingStats(t,r),GV(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||!RV(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 LV(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 qV(e){return e&&typeof e.getWatcher==`function`?e.getWatcher?.()??null:e&&typeof e.getUnderlyingFS==`function`?qV(e.getUnderlyingFS?.()):null}const JV=e(`almost-bash-shell`);function YV(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 XV(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 ZV=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 EV({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 KV(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=qV(i)??qV(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){JV.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(kV(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=XV([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=YV(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 _,PB as a,Es as c,bs as d,rs as f,Ha as g,Ra as h,AB as i,Cs as l,qo as m,KV as n,OB as o,ns as p,OV as r,Ns as s,ZV as t,Ss as u,Vo as v,Ma as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./dock-tree-spec-D-vXUz3b.js";import{CHAT_SURFACE_ID as n}from"./wc-sprinkles-
|
|
1
|
+
import{n as e,t}from"./dock-tree-spec-D-vXUz3b.js";import{CHAT_SURFACE_ID as n}from"./wc-sprinkles-BUHnq7sX.js";function r(r,i){switch(i.kind){case`set`:r.applyLayout(i.tree);break;case`reset`:{let n=e(t);n&&r.applyLayout(n.tree);break}case`chat`:r.moveSurfaceToZone(n,i.zone);break;case`open`:r.placeSurface(i.zone,i.surfaceId);break;case`close`:r.removeSurface(i.surfaceId);break;case`move`:r.moveSurfaceToZone(i.surfaceId,i.zone);break;case`size`:r.setSurfaceSize(i.surfaceId,i.size)}}export{r as applyLayout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,F as t,v as n}from"./core-eNeHeyA9.js";import{b as r,g as i}from"./account-store-
|
|
1
|
+
import{$ as e,F as t,v as n}from"./core-eNeHeyA9.js";import{b as r,g as i}from"./account-store-DBI0nzc0.js";import{r as a,t as o}from"./transform-messages-Blr84OWf.js";import{n as s,t as c}from"./pi-transcript-context-D1WTGdHV.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}},ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e),S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,O,Oe,ke,Ae=65536,je=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),O.set(this,void 0),Oe.set(this,void 0),l(this,T,new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,O,0,`f`),l(this,Oe,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,Oe,`f`)&&(l(this,Oe,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,ke).call(this,t);let n=[],r;for(;(r=Me(u(this,T,`f`),u(this,O,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,Oe,!0,`f`)),l(this,O,u(this,E,`f`),`f`)}if(l(this,O,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,O,0,`f`),u(this,T,`f`).length>Ae&&l(this,T,new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>Ae){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=Ae||u(this,T,`f`).length>e*4){let t=e<=Ae?Math.min(Math.max(e*2,256),Ae):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,O,e,`f`)}}return n}flush(){return l(this,Oe,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,Oe=new WeakMap,De=new WeakSet,ke=function(e){if(u(this,D,`f`)+e.length>u(this,T,`f`).length){let t=u(this,D,`f`)-u(this,E,`f`);if(u(this,E,`f`)>=u(this,T,`f`).length/2&&t+e.length<=u(this,T,`f`).length)u(this,T,`f`).copyWithin(0,u(this,E,`f`),u(this,D,`f`));else{let n=Math.max(u(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,r,`f`)}l(this,O,u(this,O,`f`)-u(this,E,`f`),`f`),l(this,D,t,`f`),l(this,E,0,`f`)}u(this,T,`f`).set(e,u(this,D,`f`)),l(this,D,u(this,D,`f`)+e.length,`f`)},je.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),je.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Me(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Ne(e){for(let t=0;t<e.length-1;t++){let n=Pe(e,t);if(n>0){let r=t+n,i=Pe(e,r);if(i>0)return r+i}}return-1}function Pe(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}var Fe={off:0,error:200,warn:300,info:400,debug:500},Ie=(e,t,n)=>{if(e){if(he(Fe,e))return e;k(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Fe))}`)}};function Le(){}function Re(e,t,n){return!t||Fe[e]>Fe[n]?Le:t[e].bind(t)}var ze={error:Le,warn:Le,info:Le,debug:Le},Be=new WeakMap;function k(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return ze;let r=Be.get(t);if(r&&r[0]===n)return r[1];let i={error:Re(`error`,t,n),warn:Re(`warn`,t,n),info:Re(`info`,t,n),debug:Re(`debug`,t,n)};return Be.set(t,[n,i]),i}var Ve=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),He,Ue=class e{constructor(e,t,n){He.set(this,void 0),this.iterator=e,this.controller=t,l(this,He,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?k(r):console;async function*s(){if(a)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of We(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new h(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new h(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||f(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new je,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||f(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(He=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,u(this,He,`f`)),new e(()=>i(n),this.controller,u(this,He,`f`))]}toReadableStream(){let e;return be({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*We(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new m(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new m(`Attempted to iterate over a response with no body`);let n=new qe,r=new je,i=Se(e.body);for await(let e of Ke(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}var Ge=3;async function*Ke(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=Ne(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-Ge)}r>n&&(yield t.slice(n,r))}var qe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t}from"./account-store-
|
|
1
|
+
import{c as e,o as t}from"./account-store-C_paLZbO.js";import{a as n}from"./diagnostics-B-5VkVir.js";import{t as r}from"./models-DyC6ZV6Q.js";import{a as i}from"./compat-DHy2gvsm.js";import{n as a,t as o}from"./pi-transcript-context-CqzDeqHB.js";import{r as s,t as c}from"./transform-messages-CoKbHK9j.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=/* @__PURE__ */ new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e);let S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,Oe,ke,Ae;const je=65536;var Me=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),l(this,T,/* @__PURE__ */ new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),l(this,ke,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,ke,`f`)&&(l(this,ke,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,Ae).call(this,t);let n=[],r;for(;(r=Ne(u(this,T,`f`),u(this,Oe,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,ke,!0,`f`)),l(this,Oe,u(this,E,`f`),`f`)}if(l(this,Oe,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),u(this,T,`f`).length>je&&l(this,T,/* @__PURE__ */ new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>je){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=je||u(this,T,`f`).length>e*4){let t=e<=je?Math.min(Math.max(e*2,256),je):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,Oe,e,`f`)}}return n}flush(){return l(this,ke,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=/* @__PURE__ */ new WeakMap,E=/* @__PURE__ */ new WeakMap,D=/* @__PURE__ */ new WeakMap,Oe=/* @__PURE__ */ new WeakMap,ke=/* @__PURE__ */ new WeakMap,De=/* @__PURE__ */ new WeakSet,Ae=function(e){if(u(this,D,`f`)+e.length>u(this,T,`f`).length){let t=u(this,D,`f`)-u(this,E,`f`);if(u(this,E,`f`)>=u(this,T,`f`).length/2&&t+e.length<=u(this,T,`f`).length)u(this,T,`f`).copyWithin(0,u(this,E,`f`),u(this,D,`f`));else{let n=Math.max(u(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,r,`f`)}l(this,Oe,u(this,Oe,`f`)-u(this,E,`f`),`f`),l(this,D,t,`f`),l(this,E,0,`f`)}u(this,T,`f`).set(e,u(this,D,`f`)),l(this,D,u(this,D,`f`)+e.length,`f`)},Me.NEWLINE_CHARS=/* @__PURE__ */ new Set([`
|
|
3
3
|
`,`\r`]),Me.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ne(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Pe(e){for(let t=0;t<e.length-1;t++){let n=Fe(e,t);if(n>0){let r=t+n,i=Fe(e,r);if(i>0)return r+i}}return-1}function Fe(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}const Ie={off:0,error:200,warn:300,info:400,debug:500},Le=(e,t,n)=>{if(e){if(he(Ie,e))return e;O(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ie))}`)}};function Re(){}function ze(e,t,n){return!t||Ie[e]>Ie[n]?Re:t[e].bind(t)}const Be={error:Re,warn:Re,info:Re,debug:Re};let Ve=/* @__PURE__ */ new WeakMap;function O(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Be;let r=Ve.get(t);if(r&&r[0]===n)return r[1];let i={error:ze(`error`,t,n),warn:ze(`warn`,t,n),info:ze(`info`,t,n),debug:ze(`debug`,t,n)};return Ve.set(t,[n,i]),i}const He=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Ue,We=class e{constructor(e,t,n){Ue.set(this,void 0),this.iterator=e,this.controller=t,l(this,Ue,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?O(r):console;async function*s(){if(a)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of Ge(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new h(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new h(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||f(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new Me,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||f(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ue=/* @__PURE__ */ new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,u(this,Ue,`f`)),new e(()=>i(n),this.controller,u(this,Ue,`f`))]}toReadableStream(){let e;return be({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*Ge(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new m(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new m(`Attempted to iterate over a response with no body`);let n=new qe,r=new Me,i=Se(e.body);for await(let e of Ke(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ke(e){let t=/* @__PURE__ */ new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=Pe(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-3)}r>n&&(yield t.slice(n,r))}var qe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|