sliccy 6.173.2 → 6.173.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +182 -181
- package/dist/ui/assets/{account-store-DkCw0bWM.js → account-store-CuBy1FG0.js} +1 -1
- package/dist/ui/assets/{account-store-4k9IUmk7.js → account-store-R2TQ8zwQ.js} +1 -1
- package/dist/ui/assets/{adobe-DHU1Fb0F.js → adobe-Cf2MsrGa.js} +1 -1
- package/dist/ui/assets/{adobe-BbP-Vnpw.js → adobe-Ki3YvmN6.js} +1 -1
- package/dist/ui/assets/{agent-panels-DsmU_IkC.js → agent-panels-D_229BEu.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-Ijx68emR.js → almost-bash-shell-headless-DZz4WL2S.js} +30 -30
- package/dist/ui/assets/{apply-layout-Dvj6HbU2.js → apply-layout-CeImH4Bl.js} +1 -1
- package/dist/ui/assets/{apps-BAduDa72.js → apps-CNPx3KfR.js} +1 -1
- package/dist/ui/assets/{azure-openai-DyMQeZHE.js → azure-openai-B7Cja9Yk.js} +1 -1
- package/dist/ui/assets/{azure-openai-DeXqIIPZ.js → azure-openai-C-u1XNix.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-DRTKdm-T.js → backend-hostfs-BKMp2JUS.js} +1 -1
- package/dist/ui/assets/{cdp-BXJuSYNc.js → cdp-CI2EqSBn.js} +1 -1
- package/dist/ui/assets/{cerebras-nQKYN8JV.js → cerebras-DNn3XtbR.js} +1 -1
- package/dist/ui/assets/{cerebras-sB_xLT16.js → cerebras-n6IaTJmB.js} +1 -1
- package/dist/ui/assets/{composer-speech-D66bpqkf.js → composer-speech-KF-1MV65.js} +1 -1
- package/dist/ui/assets/{connect-surface-BVs2icQM.js → connect-surface-yMJCYVKF.js} +1 -1
- package/dist/ui/assets/{directed-approval-DraCPcvg.js → directed-approval-GsbJxVpV.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-Ej2tXMnO.js → ensure-speech-assets-AMKv34W8.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-Bm9FP0xd.js → frozen-archive-writer-Ba2rJGyG.js} +1 -1
- package/dist/ui/assets/{fs-YUdF6cLl.js → fs-9OcORTu3.js} +2 -2
- package/dist/ui/assets/{fs-CQMAQAxQ.js → fs-CTQO1m5q.js} +1 -1
- package/dist/ui/assets/{gelatiere-store-D9Z-7kVR.js → gelatiere-store-vZMdA_vO.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-ArKrgi6G.js → gelatiere-unit-cNWC87QD.js} +1 -1
- package/dist/ui/assets/{github-EZmHZIwn.js → github-DRKDMQJL.js} +1 -1
- package/dist/ui/assets/{github-auth-BihnA4qe.js → github-auth-C3FvgS7w.js} +1 -1
- package/dist/ui/assets/{github-copilot-CKAsR-g4.js → github-copilot-CM0Cfdn_.js} +1 -1
- package/dist/ui/assets/{github-copilot-BbLxbL7k.js → github-copilot-DNbsxJ6H.js} +1 -1
- package/dist/ui/assets/{github-install-DTQdHpGs.js → github-install-2qEU8XsC.js} +1 -1
- package/dist/ui/assets/{github-B7vUYtc9.js → github-r6Zk2Tcv.js} +2 -2
- package/dist/ui/assets/{github-zip-Ct2tllOn.js → github-zip-DAh-EMD1.js} +1 -1
- package/dist/ui/assets/{hear-CURm4j-1.js → hear-Cl7F59vQ.js} +1 -1
- package/dist/ui/assets/{help-Bjz_VoE4.js → help-BmBXowoR.js} +1 -1
- package/dist/ui/assets/{installer-BvUI5SgV.js → installer-D3IXpUYH.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-B1RWXJiW.js → js-realm-worker-B5u17RNS.js} +1 -1
- package/dist/ui/assets/{jsh-executor-Cilk248m.js → jsh-executor-Jgo6qLbg.js} +2 -2
- package/dist/ui/assets/{kernel-worker-DVosTEfk.js → kernel-worker-BuXnCRO7.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-D_tyNKtQ.js → lick-ws-bridge-BYACp6xa.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-DzNcL2nk.js → lick-ws-bridge-ClgXvVOw.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-BvlykXYG.js → live-session-snapshot-DKkK_NW0.js} +1 -1
- package/dist/ui/assets/{local-llm-CnfnDBQO.js → local-llm-7GIJskO1.js} +1 -1
- package/dist/ui/assets/{local-llm-BeALjb4v.js → local-llm-BxOBQJB_.js} +1 -1
- package/dist/ui/assets/{main-Cb0XbEti.js → main-AUZMzMCG.js} +3 -3
- package/dist/ui/assets/{main-cherry-BxWM5CDl.js → main-cherry-CeZshaye.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-tqHuLkR5.js → memory-curation-seam-4tTERgVz.js} +1 -1
- package/dist/ui/assets/{memory-health-6_RNd2YD.js → memory-health-r17oW_pI.js} +1 -1
- package/dist/ui/assets/memory-v2-flag-DjjJhF1z.js +1 -0
- package/dist/ui/assets/{memory-write-execute-D_2dJsFl.js → memory-write-execute-BFbBBB5e.js} +1 -1
- package/dist/ui/assets/{mount-CdHDLFap.js → mount-Bw5JOkeu.js} +3 -3
- package/dist/ui/assets/{mount-CWRIDLnw.js → mount-ClZ1aHPk.js} +1 -1
- package/dist/ui/assets/{new-session-YYnEc0rh.js → new-session-C-XUASfz.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-BvQ7H4Fc.js → oauth-bootstrap-C_CBS2FD.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-Bhki4A6y.js → onboarding-orchestrator-B9llE3S3.js} +1 -1
- package/dist/ui/assets/{openai-codex-Sw3fc7RC.js → openai-codex-FXrtSSz7.js} +1 -1
- package/dist/ui/assets/{openai-codex-ByEQctz7.js → openai-codex-y1fzTq6U.js} +1 -1
- package/dist/ui/assets/{openrouter-CQIZBRup.js → openrouter-BD1Hc4cX.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CccA7qJ1.js → openrouter-free-C1G6wemT.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CFBsj1-f.js → openrouter-free-DIOPVqci.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-nOZHXdpV.js → openrouter-oauth-DYjECjbt.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Ch7Nrw0n.js → openrouter-oauth-DdyB4JIq.js} +1 -1
- package/dist/ui/assets/{openrouter-p1zOn6Go.js → openrouter-z_QQICiC.js} +1 -1
- package/dist/ui/assets/{opfs-mount-CCCFB1lu.js → opfs-mount-DgDgTG6u.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-CgxPU2xR.js +2 -0
- package/dist/ui/assets/{panelize-shell-CnkbfDJk.js → panelize-shell-DkOXxyxM.js} +2 -2
- package/dist/ui/assets/{pi-edit-execution-DbUFiKM7.js → pi-edit-execution-CwmjQWdq.js} +1 -1
- package/dist/ui/assets/{provider-D4B-h8kd.js → provider-DRZ0Hu89.js} +2 -2
- package/dist/ui/assets/{provider-D1B3J3RN.js → provider-Yb1Ih_uN.js} +1 -1
- package/dist/ui/assets/{provider-settings-p5t61kGH.js → provider-settings-KZrYwGND.js} +1 -1
- package/dist/ui/assets/provider-store-access-CQ5vfl7F.js +1 -0
- package/dist/ui/assets/provider-store-access-pA7W4ObT.js +1 -0
- package/dist/ui/assets/{providers-CDax3A6k.js → providers-4K3zQNcH.js} +1 -1
- package/dist/ui/assets/{providers-DnT1iDuH.js → providers-DBXvwv80.js} +2 -2
- package/dist/ui/assets/{quick-llm-BFOKPe7I.js → quick-llm-D4NvsLET.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-XfKjjRud.js → realm-inprocess-CfSOskOF.js} +1 -1
- package/dist/ui/assets/{recovery-screen-B1UAsFy_.js → recovery-screen-CFiZ1YgC.js} +1 -1
- package/dist/ui/assets/remote-terminal-view-KsMjkDGL.js +6 -0
- package/dist/ui/assets/{restore-D5t2KAmQ.js → restore-DrCB7SZ5.js} +1 -1
- package/dist/ui/assets/{run-CgxlL76m.js → run-BnzqoORL.js} +2 -2
- package/dist/ui/assets/{run-DcotndwI.js → run-BqNi3jTi.js} +1 -1
- package/dist/ui/assets/{run-CoCwk-OB.js → run-D6l0dn9A.js} +2 -2
- package/dist/ui/assets/{run-BZQBfxdX.js → run-DCZI4eQD.js} +1 -1
- package/dist/ui/assets/{run-D3nmKvU-.js → run-DGNerlsW.js} +2 -2
- package/dist/ui/assets/{run-B_wetOk2.js → run-DuL5R9qu.js} +2 -2
- package/dist/ui/assets/{session-command-memory-BQQMMPLh.js → session-command-memory-Cny8NMA4.js} +2 -2
- package/dist/ui/assets/{session-jsonl-BCu9CtLe.js → session-jsonl-BNoAvdoR.js} +1 -1
- package/dist/ui/assets/{session-jsonl-9JUEWu0l.js → session-jsonl-C6yz8LBK.js} +1 -1
- package/dist/ui/assets/{session-search-index-C5wImrW6.js → session-search-index-CEXxrOPk.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-DflqLl_H.js → setup-feature-flags-remote-C0d6MehF.js} +1 -1
- package/dist/ui/assets/{signed-fetch-B9-3iveg.js → signed-fetch-BDxFIE_K.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-BocjKSJh.js → silent-renew-backoff-DlNv8IBZ.js} +1 -1
- package/dist/ui/assets/slicc-version-D4sOoWeK.js +1 -0
- package/dist/ui/assets/{snapshot-m2h-QDIi.js → snapshot-DSlXQnSB.js} +1 -1
- package/dist/ui/assets/{snapshot-features-R0MTipyR.js → snapshot-features-BicvatgR.js} +1 -1
- package/dist/ui/assets/{soundscape-kWM_hjnI.js → soundscape-Do0XBT2G.js} +1 -1
- package/dist/ui/assets/{speak-BzdoLFEj.js → speak-BzRyR31N.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-DrIzSOf2.js → sprinkle-manager-DJQlLs3a.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-D4YXEHTI.js → sprinkle-renderer-Q7sdKFHj.js} +1 -1
- package/dist/ui/assets/{state-Cr6DXj7q.js → state-Bw2C2vRx.js} +1 -1
- package/dist/ui/assets/{store-BK__rpca.js → store-DMF2xtTm.js} +1 -1
- package/dist/ui/assets/{store-BleFnPxU.js → store-iwOTg5EN.js} +1 -1
- package/dist/ui/assets/{sudo-HyFTbuY2.js → sudo-p2vavApA.js} +1 -1
- package/dist/ui/assets/{supervisor-D1_al9b2.js → supervisor-CbAt3-Rk.js} +1 -1
- package/dist/ui/assets/{sync-dialog-H6lHzzvI.js → sync-dialog-HWXR3F5O.js} +1 -1
- package/dist/ui/assets/{transformers-env-BVlqqoT4.js → transformers-env-D027UR_-.js} +1 -1
- package/dist/ui/assets/{tray-leader-CkymiaHT.js → tray-leader-CmfI_Viv.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-rNjZV4uN.js → tray-leave-runtime-CXZ1NfKU.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-CBsbTsua.js → tray-sidecar-CNNzT2aX.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-B7lVgKlf.js → upgrade-detection-DXVzJjmG.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-DeS03OSw.js → upskill-lick-skip-DzUf40Jq.js} +1 -1
- package/dist/ui/assets/{voice-reply-B1l9_Xo1.js → voice-reply-U4YiMVYG.js} +1 -1
- package/dist/ui/assets/{wc-attach-DhqcQmNK.js → wc-attach-DDFGbX3K.js} +2 -2
- package/dist/ui/assets/{wc-browser-CN_DJa1b.js → wc-browser-CT4Q9ygP.js} +1 -1
- package/dist/ui/assets/{wc-computers-BeLXdfFY.js → wc-computers-CV4c1txB.js} +1 -1
- package/dist/ui/assets/{wc-detached-BvbOJyLu.js → wc-detached-D9IRy9N1.js} +1 -1
- package/dist/ui/assets/{wc-extension-CEPLNli4.js → wc-extension-BBNDRV5I.js} +2 -2
- package/dist/ui/assets/{wc-follower-CX4Y7-cK.js → wc-follower-B05_9dgX.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-Dnp2tACF.js → wc-follower-oauth-Bq88aJQb.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-B8nCJB4g.js → wc-gelatiere-DIF6qa_Y.js} +1 -1
- package/dist/ui/assets/wc-live-8V3Dgahq.js +427 -0
- package/dist/ui/assets/{wc-nav-tNldXZAt.js → wc-nav-BJu8zTe6.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-B2H4AYp_.js → wc-onboarding-B1S9UU_d.js} +2 -2
- package/dist/ui/assets/{wc-permissions-CCA-0PP4.js → wc-permissions-BETEzRSV.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-VBMLxjxW.js → wc-placeholder-D0rpz3qw.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-D7dksNvu.js → wc-secret-request-DfWFHtrs.js} +1 -1
- package/dist/ui/assets/{wc-settings-BgqSJsTh.js → wc-settings-BwYsutUi.js} +3 -3
- package/dist/ui/assets/{wc-shell-DoXzfb-g.js → wc-shell-GgRX7gs9.js} +266 -238
- package/dist/ui/assets/{wc-shortcut-config-vhhAdCG-.js → wc-shortcut-config-CHCeKyQ3.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-Dzc2DnW1.js → wc-sprinkles-Cq-tpoxc.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-B662ne2t.js → wc-transcript-export-VQemk5fq.js} +2 -2
- package/dist/ui/assets/{wc-tray-Bo_zfGS7.js → wc-tray-BHXaNSba.js} +4 -4
- package/dist/ui/assets/welcome-detection-BWTlcUwd.js +1 -0
- package/dist/ui/assets/{whisper-session-D3PnODck.js → whisper-session-DG1DqQPR.js} +2 -2
- package/dist/ui/assets/{xai-grok-DcOcvq-e.js → xai-grok-Cd6nn6KT.js} +1 -1
- package/dist/ui/assets/{xai-grok-CWLMOzDS.js → xai-grok-DimecpnS.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/memory-v2-flag-BkIdgq2C.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-DNUkvoq3.js +0 -2
- package/dist/ui/assets/provider-store-access-C6lEZNGz.js +0 -1
- package/dist/ui/assets/provider-store-access-C9TCwJrp.js +0 -1
- package/dist/ui/assets/remote-terminal-view-CA-SfvvZ.js +0 -6
- package/dist/ui/assets/slicc-version-BPqTXAzA.js +0 -1
- package/dist/ui/assets/wc-live-CRMScpU8.js +0 -427
- package/dist/ui/assets/welcome-detection-BDANwOZO.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./path-utils-DNJG-zQf.js";import{t as r}from"./types-D8gIX-W-.js";import"./fs-
|
|
1
|
+
import{a as e,n as t,t as n}from"./path-utils-DNJG-zQf.js";import{t as r}from"./types-D8gIX-W-.js";import"./fs-CTQO1m5q.js";import{t as i}from"./kernel-worker-BuXnCRO7.js";let a;function o(){return a??=import(`./edit-BnFODSzt.js`).then(({createEditTool:e})=>e()),a}function s(e){return{ok:!0,value:e}}function c(e){return{ok:!1,error:e}}var l=class extends Error{code;path;constructor(e,t,n,r){super(t,r===void 0?void 0:{cause:r}),this.code=e,this.path=n,this.name=`FileError`}},u=class extends Error{code=`shell_unavailable`;constructor(e){super(e),this.name=`ExecutionError`}};function d(e){if(!(e instanceof r))return`unknown`;switch(e.code){case`ENOENT`:return`not_found`;case`EACCES`:return`permission_denied`;case`ENOTDIR`:return`not_directory`;case`EISDIR`:return`is_directory`;case`EINVAL`:case`ELOOP`:return`invalid`;default:return`unknown`}}function f(e,t){if(e instanceof l)return e;let n=e instanceof Error?e:Error(String(e));return new l(d(e),n.message,t,n)}function p(e,t){return e?.aborted?c(new l(`aborted`,`aborted`,t)):null}var m=class{fs;cwd;constructor(e,t){this.fs=e,this.cwd=t}async absolutePath(e,r){return p(r,e)||s(t(e.startsWith(`/`)?e:n(this.cwd,e)))}async canonicalPath(e,t){let n=await this.absolutePath(e,t);if(!n.ok)return n;try{return s(await this.fs.realpath(n.value))}catch(e){return c(f(e,n.value))}}async fileInfo(t,n){let r=await this.absolutePath(t,n);if(!r.ok)return r;try{let t=await this.fs.lstat(r.value);return s({name:e(r.value).base,path:r.value,kind:t.type,size:t.size,mtimeMs:t.mtime})}catch(e){return c(f(e,r.value))}}async readTextFile(e,t){let n=await this.absolutePath(e,t);if(!n.ok)return n;try{let e=await this.fs.readTextFile(n.value);return p(t,n.value)??s(e)}catch(e){return c(f(e,n.value))}}async writeFile(e,t,n){let r=await this.absolutePath(e,n);if(!r.ok)return r;try{if(await this.fs.writeFile(r.value,t),typeof t==`string`){let e=await i(this.fs,r.value,t);if(e)return c(new l(`unknown`,e,r.value))}return p(n,r.value)??s(void 0)}catch(e){return c(f(e,r.value))}}unsupported(e,t){return c(new l(`not_supported`,`${e} is unavailable to the edit tool`,t))}async joinPath(e){return s(n(...e))}async readTextLines(e,t){let n=await this.readTextFile(e,t?.abortSignal);if(!n.ok)return n;let r=n.value.split(/\r?\n/);return s(t?.maxLines===void 0?r:r.slice(0,t.maxLines))}async readBinaryFile(e){return this.unsupported(`readBinaryFile`,e)}async appendFile(e){return this.unsupported(`appendFile`,e)}async renameFile(e){return this.unsupported(`renameFile`,e)}async listDir(e){return this.unsupported(`listDir`,e)}async exists(e){return this.unsupported(`exists`,e)}async createDir(e){return this.unsupported(`createDir`,e)}async remove(e){return this.unsupported(`remove`,e)}async createTempDir(){return this.unsupported(`createTempDir`)}async createTempFile(){return this.unsupported(`createTempFile`)}async exec(){return c(new u(`Shell is unavailable to the edit tool`))}async cleanup(){}};const h=new WeakMap;function g(e,t){let n=h.get(e);n||h.set(e,n=new Map);let r=n.get(t);return r||n.set(t,r=new m(e,t)),r}async function _(e,t,n,r){return{content:(await(await o()).execute(`slicc-edit`,n,r,void 0,{env:g(e,t)})).content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
2
2
|
`)}}export{_ as executePiEdit};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fs-
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{G as n,f as r,w as i}from"./account-store-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fs-9OcORTu3.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/path-utils-DNJG-zQf.js","assets/bounded-walk-BjxKWNqp.js","assets/types-D8gIX-W-.js","assets/virtual-device-paths-D45tpPP6.js","assets/same-file-identity-DuEcSmPX.js","assets/mount-table-store-dY2IfQ5S.js","assets/proxied-fetch-CnCvBaGV.js","assets/base64-ELzoYfwP.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/oauth-service-WTeDvR5m.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{G as n,f as r,w as i}from"./account-store-CuBy1FG0.js";import{n as a}from"./float-topology-CyZCUfkj.js";import{i as o}from"./providers-DBXvwv80.js";import{t as s}from"./global-db-CbuLl-zx.js";import{n as c,r as l,t as u}from"./pkce-hGf_TEnP.js";import{t as d}from"./types-D8gIX-W-.js";var f=t(`mcp-store`),p=`/workspace/.mcp/servers.json`,m=1,h=null,g=null;async function _(){return h||=await e(()=>import(`./fs-9OcORTu3.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),h}async function v(e){if(e)return e;if(g&&g.dbName===`slicc-fs-global`)return g.instance;let{VirtualFS:t}=await _(),n=await t.create({dbName:s});return g={instance:n,dbName:s},n}function y(){return{version:m,servers:{}}}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x(e){if(!b(e))return null;let t={...e};return typeof t.url==`string`?(delete t.sessionId,t):null}function S(e){if(!b(e))return y();let t=e,n=typeof t.version==`number`?t.version:m,r={};if(b(t.servers))for(let[e,n]of Object.entries(t.servers)){let t=x(n);t&&(r[e]=t)}return{version:n,servers:r}}async function C(e){try{let t=await(await v(e)).readFile(p,{encoding:`utf-8`});try{return S(JSON.parse(t))}catch(e){return f.warn(`servers.json is not valid JSON; treating as empty`,{error:e instanceof Error?e.message:String(e)}),y()}}catch(e){if(e instanceof d&&e.code===`ENOENT`)return y();throw e}}async function w(e){return(await C(e)).servers}async function T(){let e=await w(),t=[];for(let[n,r]of Object.entries(e))!r?.url||!r.auth?.clientId||t.push({name:n,serverUrl:r.url,auth:r.auth});return t}var E=t(`mcp-oauth`);function D(e,t){let{discoveryPath:n,prmUrl:r,prmReason:i,asmUrl:a,asmReason:o}=t;if(!e)throw Error(n===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${r}): ${i}. ASM fallback (${a}): ${o}.`:`ASM fetch failed: ${o} (${a})`);if(!(e.authorization_endpoint&&e.token_endpoint))throw Error(n===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${r}): ${i}. ASM fallback (${a}) is missing required endpoints (authorization_endpoint, token_endpoint).`:`ASM at ${a} is missing required endpoints`)}async function O(e,t,n){let r=new URL(e).origin,i=t??`${r}/.well-known/oauth-protected-resource`,a=null,o=null;E.debug(`Fetching PRM`,{prmUrl:i});try{let e=await n(i,{headers:{Accept:`application/json`}});if(!e.ok)o=`${e.status} ${e.statusText}`;else{let t=await e.json();!t.authorization_servers||t.authorization_servers.length===0?o=`lists no authorization_servers`:a=t}}catch(e){o=e instanceof Error?e.message:String(e)}let s,c,l;a?.authorization_servers&&a.authorization_servers.length>0?(s=a.authorization_servers[0].replace(/\/+$/,``),c=`${s}/.well-known/oauth-authorization-server`,l=`prm`,E.debug(`Discovery via PRM`,{prmUrl:i,asmUrl:c})):(s=r,c=`${r}/.well-known/oauth-authorization-server`,l=`asm-origin-fallback`,E.debug(`PRM unavailable; falling back to ASM at server origin`,{prmUrl:i,prmReason:o,asmUrl:c}));let u=null,d=null;E.debug(`Fetching ASM`,{asmUrl:c});try{let e=await n(c,{headers:{Accept:`application/json`}});e.ok?u=await e.json():d=`${e.status} ${e.statusText}`}catch(e){d=e instanceof Error?e.message:String(e)}return D(u,{discoveryPath:l,prmUrl:i,prmReason:o,asmUrl:c,asmReason:d}),{issuer:u.issuer||s,authorizationEndpoint:u.authorization_endpoint,tokenEndpoint:u.token_endpoint,registrationEndpoint:u.registration_endpoint,supportedScopes:u.scopes_supported??a?.scopes_supported,codeChallengeMethods:u.code_challenge_methods_supported,grantTypes:u.grant_types_supported,discoveryPath:l}}function k(e){return!e||e.length===0||e.includes(`S256`)?`S256`:e.includes(`plain`)?`plain`:`S256`}async function A(e){let t=c();return e===`plain`?{codeVerifier:t,codeChallenge:t,method:e}:{codeVerifier:t,codeChallenge:await u(t),method:e}}function j(e){try{let t=new URL(e);return{code:t.searchParams.get(`code`),state:t.searchParams.get(`state`)}}catch{return{code:null,state:null}}}async function M(e){let t=await A(k(e.asMetadata.codeChallengeMethods)),n=l(),r=new URLSearchParams({response_type:`code`,client_id:e.clientId,redirect_uri:e.redirectUri,code_challenge:t.codeChallenge,code_challenge_method:t.method,state:n});e.scope&&r.set(`scope`,e.scope);let i=`${e.asMetadata.authorizationEndpoint}?${r.toString()}`,a=await e.launcher(i);if(!a)throw Error(`MCP OAuth flow cancelled or timed out`);let{code:o,state:s}=j(a);if(!o)throw Error("MCP OAuth redirect missing `code` parameter");if(s!==n)throw Error(`MCP OAuth state mismatch — possible CSRF`);return P({tokenEndpoint:e.asMetadata.tokenEndpoint,clientId:e.clientId,code:o,codeVerifier:t.codeVerifier,redirectUri:e.redirectUri,fetchImpl:e.fetchImpl})}function N(e){if(e.error||!e.access_token)throw Error(`Token endpoint error: ${e.error??`no_access_token`}${e.error_description?` — ${e.error_description}`:``}`);return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:e.expires_in?Date.now()+e.expires_in*1e3:void 0,scope:e.scope,tokenType:e.token_type}}async function P(e){let t=new URLSearchParams({grant_type:`authorization_code`,code:e.code,redirect_uri:e.redirectUri,client_id:e.clientId,code_verifier:e.codeVerifier}).toString(),n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token exchange failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return N(r)}async function F(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:e.clientId});e.scope&&t.set(`scope`,e.scope);let n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t.toString()}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token refresh failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return N(r)}var I=`/auth/mcp-callback`;async function L(t){if(t===`extension-direct`){let e=chrome;return e.identity?.getRedirectURL?.(`mcp-callback`)??`https://${e.runtime?.id??``}.chromiumapp.org/mcp-callback`}if(t===`node-rest`){let{getLocalApiBaseUrl:t}=await e(async()=>{let{getLocalApiBaseUrl:e}=await import(`./proxied-fetch-CnCvBaGV.js`).then(e=>e.i);return{getLocalApiBaseUrl:e}},__vite__mapDeps([10,1,2,11,12,13,14])),n=t();if(n)return`${n}/auth/callback`}let{getOAuthPageOrigin:n}=await e(async()=>{let{getOAuthPageOrigin:e}=await import(`./oauth-service-WTeDvR5m.js`);return{getOAuthPageOrigin:e}},__vite__mapDeps([15,2,10,1,11,12,13,14,16,17])),{origin:r}=await n();return`${r}${t===`extension-delegate`?I:`/auth/callback`}`}var R=t(`mcp-provider`),z=`mcp:`;function B(){return typeof globalThis<`u`&&globalThis.indexedDB!==void 0}function V(e){return`${z}${e}`}var H=new Map,U=new Set;async function W(t){if(t)return t;let{createProxiedFetch:n}=await e(async()=>{let{createProxiedFetch:e}=await import(`./proxied-fetch-CnCvBaGV.js`).then(e=>e.i);return{createProxiedFetch:e}},__vite__mapDeps([10,1,2,11,12,13,14])),r=n();return async(e,t)=>{let n=await r(e,{method:t?.method,headers:t?.headers,body:t?.body}),i=new TextDecoder().decode(n.body);return{ok:n.status>=200&&n.status<300,status:n.status,statusText:n.statusText,text:async()=>i,json:async()=>JSON.parse(i),headers:{get:e=>n.headers[e.toLowerCase()]??null}}}}async function G(e){let t=H.get(V(e.name));if(t)return t;let n=await W(e.fetchImpl),r=await O(e.serverUrl,void 0,n);return H.set(V(e.name),r),r}function K(e){let t=V(e.name),o=(()=>{try{return new URL(e.serverUrl).host}catch{return``}})();return{id:t,name:`MCP: ${e.name}`,description:`MCP server at ${e.serverUrl}`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:o?[o]:[],getModelIds:()=>[],onOAuthLogin:async(r,i)=>{let o=e.launcher??r,s=await W(e.fetchImpl),c=await M({asMetadata:await G(e),clientId:e.auth.clientId,scope:e.auth.scope,redirectUri:e.auth.redirectUri??await L(a()),launcher:o,fetchImpl:s});await n({providerId:t,accessToken:c.accessToken,refreshToken:c.refreshToken,tokenExpiresAt:c.expiresAt,scopes:c.scope}),i()},onSilentRenew:async()=>{if(!i(t))return null;let a=r().find(e=>e.providerId===t),o=a?.refreshToken;if(!o)return R.info(`No refresh token for MCP provider, skipping silent renewal`,{id:t}),null;try{let r=await G(e),i=r.grantTypes??[];if(i.length>0&&!i.includes(`refresh_token`))return R.info(`AS does not advertise refresh_token grant; skipping silent renewal`,{id:t}),null;let s=await W(e.fetchImpl),c=await F({tokenEndpoint:r.tokenEndpoint,clientId:e.auth.clientId,refreshToken:o,scope:e.auth.scope,fetchImpl:s});return await n({providerId:t,accessToken:c.accessToken,refreshToken:c.refreshToken??o,tokenExpiresAt:c.expiresAt,scopes:c.scope??a.scopes}),c.accessToken}catch(e){return R.warn(`MCP silent renewal failed`,{id:t,error:e instanceof Error?e.message:String(e)}),null}}}}function q(e){let t=V(e.name);if(U.has(t))return;let n=K(e);o(n),U.add(t),R.debug(`Registered MCP provider`,{id:t})}async function J(){if(!B())return[];let{readMcpAuthEntries:t}=await e(async()=>{let{readMcpAuthEntries:e}=await import(`./provider-store-access-CQ5vfl7F.js`);return{readMcpAuthEntries:e}},[]),n=await t(),r=[];for(let e of n)q({name:e.name,serverUrl:e.serverUrl,auth:e.auth}),r.push(V(e.name));return r}export{J as ensureAllMcpProvidersRegistered,T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{i as t,s as n,t as r}from"./providers-
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{i as t,s as n,t as r}from"./providers-4K3zQNcH.js";import{_ as i,l as a,r as o}from"./account-store-R2TQ8zwQ.js";import{a as s}from"./core-w0-0FXns.js";import{t as c}from"./redirect-uri-D2aDPCyB.js";import{discoverAuth as l,refreshAccessToken as u,runAuthFlow as d}from"./oauth-DR6XMm1M.js";import{n as f}from"./store-iwOTg5EN.js";const p=e(`mcp-provider`);function m(){return typeof globalThis<`u`&&globalThis.indexedDB!==void 0}function h(e){return`mcp:${e}`}const g=new Map,_=new Set;async function v(e){if(e)return e;let{createProxiedFetch:t}=await import(`./proxied-fetch-CPL8wJM2.js`).then(e=>e.i),n=t();return async(e,t)=>{let r=await n(e,{method:t?.method,headers:t?.headers,body:t?.body}),i=new TextDecoder().decode(r.body);return{ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,text:async()=>i,json:async()=>JSON.parse(i),headers:{get:e=>r.headers[e.toLowerCase()]??null}}}}async function y(e){let t=g.get(h(e.name));if(t)return t;let n=await v(e.fetchImpl),r=await l(e.serverUrl,void 0,n);return g.set(h(e.name),r),r}function b(e){let t=h(e.name),n=(()=>{try{return new URL(e.serverUrl).host}catch{return``}})();return{id:t,name:`MCP: ${e.name}`,description:`MCP server at ${e.serverUrl}`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:n?[n]:[],getModelIds:()=>[],onOAuthLogin:async(n,r)=>{let a=e.launcher??n,o=await v(e.fetchImpl),l=await y(e),u=await d({asMetadata:l,clientId:e.auth.clientId,scope:e.auth.scope,redirectUri:e.auth.redirectUri??await c(s()),launcher:a,fetchImpl:o});await i({providerId:t,accessToken:u.accessToken,refreshToken:u.refreshToken,tokenExpiresAt:u.expiresAt,scopes:u.scope}),r()},onSilentRenew:async()=>{if(!a(t))return null;let n=o().find(e=>e.providerId===t),r=n?.refreshToken;if(!r)return p.info(`No refresh token for MCP provider, skipping silent renewal`,{id:t}),null;try{let a=await y(e),o=a.grantTypes??[];if(o.length>0&&!o.includes(`refresh_token`))return p.info(`AS does not advertise refresh_token grant; skipping silent renewal`,{id:t}),null;let s=await v(e.fetchImpl),c=await u({tokenEndpoint:a.tokenEndpoint,clientId:e.auth.clientId,refreshToken:r,scope:e.auth.scope,fetchImpl:s});return await i({providerId:t,accessToken:c.accessToken,refreshToken:c.refreshToken??r,tokenExpiresAt:c.expiresAt,scopes:c.scope??n.scopes}),c.accessToken}catch(e){return p.warn(`MCP silent renewal failed`,{id:t,error:e instanceof Error?e.message:String(e)}),null}}}}function x(e){let n=h(e.name);if(_.has(n))return;let r=b(e);t(r),_.add(n),p.debug(`Registered MCP provider`,{id:n})}async function S(e,t={}){let n=h(e);if(_.has(n)&&r(n))return!0;if(!m())return!1;let i=await f(e);return i?(x({name:e,serverUrl:i.serverUrl,auth:i.auth,...t}),!0):!1}async function C(){if(!m())return[];let{readMcpAuthEntries:e}=await import(`./provider-store-access-pA7W4ObT.js`),t=await e(),n=[];for(let e of t)x({name:e.name,serverUrl:e.serverUrl,auth:e.auth}),n.push(h(e.name));return n}function w(e){let t=h(e);return _.delete(t),g.delete(t),n(t)}export{C as ensureAllMcpProvidersRegistered,S as ensureMcpProviderRegistered,x as registerMcpProvider,w as removeMcpProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import"./account-store-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import"./account-store-R2TQ8zwQ.js";import"./core-w0-0FXns.js";import"./tray-runtime-config-dyxCfUex.js";var n=e({copyTextToClipboard:()=>r});async function r(e){if(!e)return!1;if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed; opacity:0; pointer-events:none; left:-9999px;`,document.body.appendChild(t),t.select();let n=document.execCommand?.(`copy`)??!1;return document.body.removeChild(t),n}catch{return!1}}t(`provider-settings`);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./provider-DRZ0Hu89.js";export{e as readMcpAuthEntries};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./store-iwOTg5EN.js";import"./provider-Yb1Ih_uN.js";export{e as readMcpAuthEntries};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";var t={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},n=e({allProviderConfigs:()=>u,getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>l,shouldIncludeProvider:()=>i,unregisterProviderConfig:()=>m});const r=Object.assign({"/packages/dev-tools/providers.build.json":t})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function i(e){let{include:t,exclude:n}=r;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}const a=Object.assign({"./built-in/azure-ai-foundry.ts":()=>import(`./azure-ai-foundry-CzkPLAhp.js`),"./built-in/azure-openai.ts":()=>import(`./azure-openai-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";var t={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},n=e({allProviderConfigs:()=>u,getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>l,shouldIncludeProvider:()=>i,unregisterProviderConfig:()=>m});const r=Object.assign({"/packages/dev-tools/providers.build.json":t})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function i(e){let{include:t,exclude:n}=r;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}const a=Object.assign({"./built-in/azure-ai-foundry.ts":()=>import(`./azure-ai-foundry-CzkPLAhp.js`),"./built-in/azure-openai.ts":()=>import(`./azure-openai-B7Cja9Yk.js`),"./built-in/bedrock-camp-compat.ts":()=>import(`./bedrock-camp-compat-99DjWBHV.js`).then(e=>e.n),"./built-in/bedrock-camp.ts":()=>import(`./bedrock-camp-DmVFQWfL.js`),"./built-in/local-llm.ts":()=>import(`./local-llm-BxOBQJB_.js`).then(e=>e.n)}),o=Object.assign({"/packages/webapp/providers/adobe.ts":()=>import(`./adobe-Cf2MsrGa.js`),"/packages/webapp/providers/cerebras.ts":()=>import(`./cerebras-DNn3XtbR.js`),"/packages/webapp/providers/github-copilot.ts":()=>import(`./github-copilot-DNbsxJ6H.js`),"/packages/webapp/providers/github.ts":()=>import(`./github-DRKDMQJL.js`),"/packages/webapp/providers/openai-codex.ts":()=>import(`./openai-codex-y1fzTq6U.js`),"/packages/webapp/providers/openrouter-free.ts":()=>import(`./openrouter-free-C1G6wemT.js`),"/packages/webapp/providers/openrouter-models.ts":()=>import(`./openrouter-models-DyyLIGVe.js`),"/packages/webapp/providers/openrouter-oauth.ts":()=>import(`./openrouter-oauth-DYjECjbt.js`),"/packages/webapp/providers/openrouter.ts":()=>import(`./openrouter-z_QQICiC.js`),"/packages/webapp/providers/xai-grok-errors.ts":()=>import(`./xai-grok-errors-ByEMMSoz.js`),"/packages/webapp/providers/xai-grok.ts":()=>import(`./xai-grok-DimecpnS.js`)}),s=new Map;let c=null;function l(){return c===null&&(c=(async()=>{let e=await Promise.all(Object.values(a).map(e=>e()));for(let t of e)t.config&&i(t.config.id)&&(s.set(t.config.id,t.config),t.register?.());let t=await Promise.all(Object.values(o).map(e=>e()));for(let e of t)e.config&&(s.set(e.config.id,e.config),e.register?.())})()),c}const u=s;function d(e){return s.get(e)}function f(){return[...s.keys()]}function p(e){s.set(e.id,e)}function m(e){return s.delete(e)}export{l as a,p as i,f as n,i as o,n as r,m as s,d as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-
|
|
2
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";var n={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},r=e({getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>u,shouldIncludeProvider:()=>a}),i=Object.assign({"/packages/dev-tools/providers.build.json":n})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function a(e){let{include:t,exclude:n}=i;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}var o=Object.assign({"./built-in/azure-ai-foundry.ts":()=>t(()=>import(`./azure-ai-foundry-Bo0FAJyX.js`),[]),"./built-in/azure-openai.ts":()=>t(()=>import(`./azure-openai-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-C-u1XNix.js","assets/diagnostics-DN_idNHx.js","assets/models-BSkXF4T6.js","assets/preload-helper-Czpn1I53.js","assets/compat-qQM4gjF_.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/openrouter.models-B-zmcypy.js","assets/account-store-CuBy1FG0.js","assets/core-DWdpOAZd.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/proxied-fetch-CnCvBaGV.js","assets/base64-ELzoYfwP.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-BrobAGSV.js","assets/float-topology-CyZCUfkj.js","assets/secrets-bridge-client-BJqZCK6Q.js","assets/port-bridge-client-CZFX4fUT.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/claude-model-version-DZmbk9E2.js","assets/transform-messages-BsQjTIEJ.js","assets/bedrock-camp-D-jmLdEX.js","assets/temperature-support-Dd00cuZX.js","assets/local-llm-7GIJskO1.js","assets/legacy-api-aliases-DtQJ5I7w.js","assets/adobe-Ki3YvmN6.js","assets/main-AUZMzMCG.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/bridge-protocol-06nbmp2X.js","assets/telemetry-CKoAhRMv.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/silent-renew-backoff-DlNv8IBZ.js","assets/provider-budget-LCzMPlKv.js","assets/oauth-service-WTeDvR5m.js","assets/permissions-surface-registry-CilCRwhh.js","assets/llm-session-id-bZQs6gBN.js","assets/cerebras-n6IaTJmB.js","assets/github-copilot-CM0Cfdn_.js","assets/github-r6Zk2Tcv.js","assets/global-db-CbuLl-zx.js","assets/openai-codex-FXrtSSz7.js","assets/pkce-hGf_TEnP.js","assets/openrouter-free-DIOPVqci.js","assets/openrouter-models-Cfi7qjq5.js","assets/openrouter-oauth-DdyB4JIq.js","assets/openrouter-BD1Hc4cX.js","assets/xai-grok-Cd6nn6KT.js","assets/xai-grok-errors-bnlIBeu-.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";var n={include:[`*`],exclude:[`amazon-bedrock`,`xai`]},r=e({getRegisteredProviderConfig:()=>d,getRegisteredProviderIds:()=>f,registerProviderConfig:()=>p,registerProviders:()=>u,shouldIncludeProvider:()=>a}),i=Object.assign({"/packages/dev-tools/providers.build.json":n})[`/packages/dev-tools/providers.build.json`]??{include:[`*`],exclude:[]};function a(e){let{include:t,exclude:n}=i;return n.includes(`*`)||n.includes(e)?!1:!!(t.includes(`*`)||t.includes(e))}var o=Object.assign({"./built-in/azure-ai-foundry.ts":()=>t(()=>import(`./azure-ai-foundry-Bo0FAJyX.js`),[]),"./built-in/azure-openai.ts":()=>t(()=>import(`./azure-openai-C-u1XNix.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])),"./built-in/bedrock-camp-compat.ts":()=>t(()=>import(`./bedrock-camp-compat-BeCSBUrZ.js`).then(e=>e.n),__vite__mapDeps([25,7])),"./built-in/bedrock-camp.ts":()=>t(()=>import(`./bedrock-camp-D-jmLdEX.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,26,27,29])),"./built-in/local-llm.ts":()=>t(()=>import(`./local-llm-7GIJskO1.js`),__vite__mapDeps([30,1,4,2,3,5,6,7,8,31,12,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))}),s=Object.assign({"/packages/webapp/providers/adobe.ts":()=>t(()=>import(`./adobe-Ki3YvmN6.js`),__vite__mapDeps([32,1,3,4,2,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,39,40,41,42,29,43])),"/packages/webapp/providers/cerebras.ts":()=>t(()=>import(`./cerebras-n6IaTJmB.js`),__vite__mapDeps([44,1,4,2,3,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])),"/packages/webapp/providers/github-copilot.ts":()=>t(()=>import(`./github-copilot-CM0Cfdn_.js`),__vite__mapDeps([45,1,3,4,2,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38])),"/packages/webapp/providers/github.ts":()=>t(()=>import(`./github-r6Zk2Tcv.js`),__vite__mapDeps([46,3,13,7,14,15,16,17,9,10,4,2,1,5,6,8,11,12,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,39,41,42,47])),"/packages/webapp/providers/openai-codex.ts":()=>t(()=>import(`./openai-codex-FXrtSSz7.js`),__vite__mapDeps([48,1,4,2,3,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,49])),"/packages/webapp/providers/openrouter-free.ts":()=>t(()=>import(`./openrouter-free-DIOPVqci.js`),__vite__mapDeps([50,1,4,2,3,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,51,52,49])),"/packages/webapp/providers/openrouter-models.ts":()=>t(()=>import(`./openrouter-models-Cfi7qjq5.js`),__vite__mapDeps([51,8])),"/packages/webapp/providers/openrouter-oauth.ts":()=>t(()=>import(`./openrouter-oauth-DdyB4JIq.js`),__vite__mapDeps([52,9,7,10,4,2,1,3,5,6,8,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,49])),"/packages/webapp/providers/openrouter.ts":()=>t(()=>import(`./openrouter-BD1Hc4cX.js`),__vite__mapDeps([53,4,2,1,3,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,51,52,49])),"/packages/webapp/providers/xai-grok-errors.ts":()=>t(()=>import(`./xai-grok-errors-bnlIBeu-.js`),[]),"/packages/webapp/providers/xai-grok.ts":()=>t(()=>import(`./xai-grok-Cd6nn6KT.js`),__vite__mapDeps([54,1,4,2,3,5,6,7,8,31,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,33,34,35,36,37,38,49,55]))}),c=new Map,l=null;function u(){return l===null&&(l=(async()=>{let e=await Promise.all(Object.values(o).map(e=>e()));for(let t of e)t.config&&a(t.config.id)&&(c.set(t.config.id,t.config),t.register?.());let t=await Promise.all(Object.values(s).map(e=>e()));for(let e of t)e.config&&(c.set(e.config.id,e.config),e.register?.())})()),l}function d(e){return c.get(e)}function f(){return[...c.keys()]}function p(e){c.set(e.id,e)}export{u as a,p as i,f as n,a as o,r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-qQM4gjF_.js";import{t as n}from"./logger-DDBAeTLF.js";import{E as r,O as i,g as a,k as o}from"./account-store-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-qQM4gjF_.js";import{t as n}from"./logger-DDBAeTLF.js";import{E as r,O as i,g as a,k as o}from"./account-store-CuBy1FG0.js";import{t as s}from"./llm-session-id-bZQs6gBN.js";import{i as c,t as l}from"./icons-BMNa26vG.js";var u=e({lucideIconNames:()=>h,pickLucideIcon:()=>g,quickLabel:()=>f}),d=n(`quick-llm`);async function f(e){let n=a();if(!n)return d.debug(`No API key for active provider — skipping`),null;let r=o(),s=i(),c;if(c=e.modelId?b(r,e.modelId)??b(r,s):_(r,s),!c)return d.debug(`No model available for provider`,{providerId:r}),null;let l={role:`user`,content:e.prompt,timestamp:Date.now()},u={};c.provider===`adobe`&&(u[`X-Session-Id`]=S());try{let r=(await t(c,{systemPrompt:e.system,messages:[l]},{apiKey:n,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(u).length>0?u:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return r.length>0?r:null}catch(e){return d.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}var p=null;function m(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Za-z])(\d)/g,`$1-$2`).toLowerCase()}function h(){return p||=Object.keys(c).map(m).sort(),p}async function g(e){let t=h(),n=await(e.labelFn??f)({system:`You pick ONE icon for a UI element. Respond with exactly one icon name from the provided list — lowercase, no quotes, no punctuation, nothing else.`,prompt:`Pick the single most fitting icon for: ${e.subject}\n\nValid icon names:\n${t.join(` `)}`,maxTokens:16,temperature:.2,signal:e.signal});if(!n)return null;let r=n.trim().toLowerCase().replace(/[^a-z0-9-]/g,``);return l(r)?r:null}function _(e,t){let n=r(e);if(n.length===0)return;let i=n.find(e=>e.id===t)??n[0],a=y(i.id),o=n.filter(e=>v(e,i,a));return o.length===0?i:(o.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),o[0])}function v(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 y(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 b(e,t){return r(e).find(e=>e.id===t)}var x=`ui-quick-llm`;function S(){return s(x)}export{u as n,f as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./__vite-browser-external-5eBdwsFd.js";import{r as n,t as r}from"./multipart-form-data-DopbgwRR.js";import{n as i}from"./slicc-version-BPqTXAzA.js";import{t as a}from"./buffer-polyfill-BccMjOKj.js";import{t as o}from"./buffer-B5d1xHaH.js";import{F as s,I as c,N as l,P as u}from"./shared-C_68vn79.js";import{I as d,M as f,R as p,T as m,_ as h,c as g,g as _,i as v,j as y,l as b,n as x,r as S,s as C,w}from"./sync-sab-wire-CC30v4TL.js";import{t as T}from"./tmpdir-env-ate4iNcK.js";import{t as E}from"./realm-browser-fetch-V3uggGbM.js";function D(e){if(!e||e===`/`)return`/`;e.startsWith(`/`)||(e=`/`+e);let t=e.split(`/`),n=[];for(let e of t)e!==``&&e!==`.`&&(e===`..`?n.pop():n.push(e));return`/`+n.join(`/`)}function O(e){let t=D(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function k(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function A(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ee(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var te=class{tree=new Map;initialPaths=new Set;initialContent=new Map;initialKind=new Map;mkdtempCounter=0;tombstones=new Set;removedDirs=new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=new Map,this.tombstones=new Set,this.removedDirs=new Set,this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map,this.tree.set(`/`,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=D(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=O(D(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=O(e)}}wasUsed(){return this.touched}applySnapshot(e){this.loadSnapshot(e)}applySnapshotPreservingMutations(e){let t=this.getMutations();this.loadSnapshot(e);for(let e of t.deleted){if(this.tree.get(e)?.isDirectory){let t=e===`/`?`/`:e+`/`;for(let n of Array.from(this.tree.keys()))n!==e&&n.startsWith(t)&&this.tree.delete(n)}this.tree.delete(e)}for(let e of t.created)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink,symlinkTarget:e.symlinkTarget});for(let e of t.modified)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:!1})}invalidate(){this.loadSnapshot({entries:[]})}resetBaseline(){this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map;for(let[e,t]of this.tree.entries())this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}entryKind(e){return e.isSymbolicLink?`symlink`:e.isDirectory?`directory`:`file`}resolveEntry(e,t=!1){let n=D(e),r=n.split(`/`).filter(Boolean),i=[],a=new Set,o=0;if(r.length===0){let e=this.tree.get(`/`);return e?{path:`/`,entry:e}:void 0}for(;r.length>0;){let e=r.shift(),s=`/${[...i,e].join(`/`)}`,c=this.tree.get(s);if(!c)return;let l=r.length===0;if(c.isSymbolicLink&&!(t&&l)){if(a.has(s)||o++===40)throw Object.assign(Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...D(e.startsWith(`/`)?e:`${O(s)}/${e}`).split(`/`).filter(Boolean),...r],i=[];continue}if(!l&&!c.isDirectory)return;if(i.push(e),l)return{path:s,entry:c}}}ensureParentDirs(e){let t=O(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(D(e))?.partial===!0}commitWrite(e,t){this.writeFile(e,t);let n=D(e);for(this.initialContent.set(n,t);n!==`/`;){let e=this.tree.get(n);e&&(this.initialPaths.add(n),this.initialKind.set(n,this.entryKind(e))),n=O(n)}}readFile(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw k(t);if(n.truncated)throw A(t);return n.content}writeFile(e,t){this.touched=!0;let n=D(e);this.ensureParentDirs(n),this.tree.set(n,{content:t,isDirectory:!1}),this.tombstones.delete(n),this.removedDirs.delete(n)}exists(e){this.touched=!0;let t=D(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n)throw k(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t,!0);if(!n)throw k(t);return this.toStat(n.entry)}toStat(e){return{isFile:!e.isDirectory&&!e.isSymbolicLink,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink===!0,size:e.isDirectory?0:e.size??e.content.byteLength}}readdir(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw k(t);let r=n.path===`/`?`/`:n.path+`/`,i=new Set;for(let e of this.tree.keys()){if(e===t||e===`/`||!e.startsWith(r))continue;let n=e.slice(r.length).split(`/`)[0];n&&i.add(n)}return Array.from(i)}mkdir(e,t,n=!1){this.touched=!0;let r=D(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=O(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw k(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r)throw k(n);if(r.isDirectory&&!r.isSymbolicLink){let e=n===`/`?`/`:n+`/`,r=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));if(r.length>0&&!t)throw Object.assign(Error(`ENOTEMPTY: directory not empty, '${n}'`),{code:`ENOTEMPTY`});for(let e of r)this.tree.delete(e),this.tombstones.add(e);t&&this.removedDirs.add(n)}this.tree.delete(n),this.tombstones.add(n)}copyFile(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r||r.isDirectory)throw k(n);if(r.truncated)throw A(n);let i=D(t);this.ensureParentDirs(i),this.tree.set(i,{content:r.content.slice(),isDirectory:!1}),this.tombstones.delete(i),this.removedDirs.delete(i)}rename(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r)throw k(n);let i=D(t);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,t=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n);for(let e of t){let t=this.tree.get(e),r=i+e.slice(n.length);this.tree.set(r,t),this.tree.delete(e)}this.tombstones.add(n),this.removedDirs.add(n),this.tombstones.delete(i),this.removedDirs.delete(i);return}this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n),this.tombstones.add(n),this.tombstones.delete(i),this.removedDirs.delete(i)}unlink(e){this.touched=!0;let t=D(e),n=this.tree.get(t);if(!n)throw k(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(Error(`EISDIR: illegal operation on a directory, unlink '${t}'`),{code:`EISDIR`});this.tree.delete(t),this.tombstones.add(t)}markRemoved(e,t=!1){this.touched=!0;let n=D(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=D(e);if(this.tombstones.has(t))return!0;for(let e of this.removedDirs)if(t===e||t.startsWith(`${e}/`))return!0;return!1}mkdtemp(e){this.touched=!0;for(let t=0;t<100;t++){let t=`_${String(this.mkdtempCounter).padStart(6,`0`)}`;this.mkdtempCounter++;let n=D(e+t);if(!this.tree.has(n))return this.mkdir(n,!0),n}throw Error(`mkdtemp: failed to create unique directory after 100 attempts`)}getMutations(){let e=[],t=[],n=[];for(let[r,i]of this.tree.entries()){if(r===`/`)continue;if(!this.initialPaths.has(r)){e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}let a=this.initialKind.get(r);if(a!==void 0&&a!==this.entryKind(i)){n.push(r),e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}if(!i.isDirectory&&!i.isSymbolicLink){let e=this.initialContent.get(r);e&&!ee(e,i.content)&&t.push({path:r,content:i.content})}}for(let e of this.initialPaths)e!==`/`&&(this.tree.has(e)||n.push(e));return{created:e,modified:t,deleted:n}}};function ne(){return globalThis.Buffer}function re(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ie(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function ae(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function oe(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function se(e){if(e===0||e===`/dev/stdin`)return 0;if(e===1||e===`/dev/stdout`)return 1;if(e===2||e===`/dev/stderr`)return 2}function ce(e,t){let n=se(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw ae(t,e);return!1}function le(e,t,n){let r=se(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw ae(n,t)}function ue(e){return typeof e==`string`?e:ie(xe(e))}function de(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ne();return n?n.from(e):e}function fe(e){return typeof e==`string`?e:e?.encoding}function pe(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function me(e,t){if(!t)return;let n={readFile:e.readFile,readFileBinary:e.readFileBinary,writeFile:e.writeFile,writeFileBinary:e.writeFileBinary,appendFile:e.appendFile,access:e.access,exists:e.exists,stat:e.stat};e.readFile=async(e,r)=>{if(!ce(e,`read`))return n.readFile(e,r);let i=fe(r);if(i===null||i===`buffer`){let e=ne(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ce(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ue(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ie(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=le(t,e,`append`);if(!i)return n.appendFile(e,r);i(ue(r))},e.access=async e=>{if(!oe(e))return n.access(e)},e.exists=async e=>oe(e)||n.exists(e),e.stat=async e=>oe(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function he(e,t,n){function r(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e instanceof ArrayBuffer?new Uint8Array(e):new TextEncoder().encode(typeof e==`string`?e:String(e))}async function i(t,n){let r=typeof n==`string`?n:n?.encoding;if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ne();return r?r.from(n instanceof Uint8Array?n:new Uint8Array(n)):n}return e.call(`vfs`,`readFile`,[t])}async function a(t,n){return typeof n==`string`?e.call(`vfs`,`writeFile`,[t,n]):e.call(`vfs`,`writeFileBinary`,[t,r(n)])}async function o(t,n){if(typeof n==`string`){await e.call(`vfs`,`appendFile`,[t,n]);return}await e.call(`vfs`,`appendFile`,[t,r(n)])}async function s(t,n,r){let i=await e.call(`vfs`,`stat`,[t]);if(i.isFile){let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]);return}if(!i.isDirectory||!r?.recursive)throw Error(`cp: '${t}' is a directory (use {recursive: true})`);await l(n);let a=await e.call(`vfs`,`readDir`,[t]);for(let e of a)await s(`${t}/${e}`,`${n}/${e}`,r)}async function c(t,n){if(n?.force&&!await e.call(`vfs`,`exists`,[t]))return!0;if((await e.call(`vfs`,`stat`,[t])).isFile)return e.call(`vfs`,`rm`,[t]);if(!n?.recursive)throw Error(`rm: '${t}' is a directory (use {recursive: true})`);let r=await e.call(`vfs`,`readDir`,[t]);for(let e of r)await c(`${t}/${e}`,n);return e.call(`vfs`,`rm`,[t])}async function l(t){await e.call(`vfs`,`mkdir`,[t])}async function u(t){for(let n=0;n<5;n++){let n=`${t}${Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}`;if(!await e.call(`vfs`,`exists`,[n]))return await e.call(`vfs`,`mkdir`,[n]),n}throw Error(`mkdtemp: failed to create unique directory after 5 attempts`)}async function d(t,n){try{await e.call(`vfs`,`rename`,[t,n])}catch{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]),await e.call(`vfs`,`rm`,[t])}}async function f(t){if(!await e.call(`vfs`,`exists`,[t]))throw Object.assign(Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let p={readFile:i,readFileBinary:t=>e.call(`vfs`,`readFileBinary`,[t]),writeFile:a,writeFileBinary:(t,n)=>e.call(`vfs`,`writeFileBinary`,[t,n]),appendFile:o,cp:s,rm:c,readDir:t=>e.call(`vfs`,`readDir`,[t]),readdir:t=>e.call(`vfs`,`readDir`,[t]),exists:t=>e.call(`vfs`,`exists`,[t]),stat:t=>e.call(`vfs`,`stat`,[t]),mkdir:(t,n)=>e.call(`vfs`,`mkdir`,[t]),mkdtemp:u,rename:d,access:f,unlink:t=>e.call(`vfs`,`rm`,[t]),rmdir:t=>e.call(`vfs`,`rm`,[t]),copyFile:async(t,n)=>{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r])},fetchToFile:async(n,r)=>{let i=await t(n);if(!i.ok)throw Error(`fetch ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());return await e.call(`vfs`,`writeFileBinary`,[r,a]),a.byteLength},promises:null};return me(p,n),p.promises=p,p}function j(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function ge(e,t,n,r={},i){let a=r.recursive===!0;try{return r.requireFile?e.unlink(n):e.rm(n,a),i?.(n),!0}catch(e){if(e?.code!==`ENOENT`)throw e}let o=t;if(!o?.rm||e.isTombstoned(n))return!1;try{if(!o.exists(n))return!1}catch{return!1}return o.rm(n),e.markRemoved(n,a),!0}function _e(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>ge(t,n,e,r,l);return{rmSync(e,t){let n=r(e);if(!(t?.force&&!i(n))&&!u(n,{recursive:t?.recursive===!0})&&!t?.force)throw j(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw j(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw j(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw j(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i);try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw j(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw j(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw j(`ENOENT`,a,`rename`)}}}function ve(e,t){if(!t)return;let n={readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,existsSync:e.existsSync,accessSync:e.accessSync,statSync:e.statSync,lstatSync:e.lstatSync};e.readFileSync=(e,r)=>ce(e,`read`)?de(t.readStdinBytes(),fe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=le(t,e,`write`);i?i(ue(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=le(t,e,`append`);i?i(ue(r)):n.appendFileSync(e,r)},e.existsSync=e=>oe(e)||n.existsSync(e),e.accessSync=e=>{oe(e)||n.accessSync(e)},e.statSync=e=>oe(e)?pe():n.statSync(e),e.lstatSync=e=>oe(e)?pe():n.lstatSync(e)}function ye(e,t,n,r){let i=t=>e===`/`?`/${t}`:`${e}/${t}`,a=new Set(n);for(let e of t)a.add(e);for(let e of a)r(i(e))&&a.delete(e);return[...a]}function be(e,t,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ye(n,i,t.readdir(n),r)}catch(e){if(e?.code===`ENOENT`)return i;throw e}}catch(e){let i=e?.code;if(!t||r(n)||i!==`ENOENT`)throw e;return ye(n,[],t.readdir(n),r)}}function xe(e){if(typeof e==`string`)return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new TextEncoder().encode(String(e))}function Se(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ce(e,t,n,r,i){function a(e){return D(e.startsWith(`/`)?e:t+(t.endsWith(`/`)?``:`/`)+e)}function o(t){try{return e.readFile(t)}catch(r){let i=r?.code;if(n&&!e.isTombstoned(t)&&(i===`ENOENT`||i===`ENOSYNC`))return n.readFile(t);throw r}}let s=(t,r)=>Se(e,n,i,t,r);function c(t){if(e.exists(t))return!0;if(!n||e.isTombstoned(t))return!1;try{return n.exists(t)}catch{return!1}}function l(t){try{return e.stat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.stat(t)}}function u(t){try{return e.lstat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.lstat(t)}}let d=e=>({isFile:()=>e.isFile,isDirectory:()=>e.isDirectory,isSymbolicLink:()=>e.isSymbolicLink===!0,isCharacterDevice:()=>!1,size:e.size}),f=(e,t)=>e===`/`?`/${t}`:`${e}/${t}`;function p(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of be(e,n,t))p(f(t,i),f(r,i))}let m={..._e({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return de(o(a(e)),fe(t))},writeFileSync(e,t){s(a(e),xe(t))},appendFileSync(e,t){let n=a(e),r=new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=xe(t),c=new Uint8Array(r.byteLength+i.byteLength);c.set(r),c.set(i,r.byteLength),s(n,c)},truncateSync(e,t=0){let n=a(e),r=o(n),i=new Uint8Array(t);i.set(r.subarray(0,Math.min(t,r.byteLength))),s(n,i)},existsSync(e){return c(a(e))},accessSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`access`)},mkdirSync(t,n){e.mkdir(a(t),n?.recursive)},statSync:e=>d(l(a(e))),lstatSync:e=>d(u(a(e))),realpathSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`realpath`);return t},readdirSync(t){return be(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},chmodSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`chmod`)},mkdtempSync(t){return e.mkdtemp(a(t))}};return ve(m,r),m}function we(e){let t=e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},n=(e,t,n)=>t===void 0?`${e(`Error:`)} ${n}\n`:t===``?`${e(n)}\n`:`${e(`${t}:`)} ${n}\n`,r=(t,n)=>t===void 0?`${e.color.yellow(`Warning:`)} ${n}\n`:t===``?`${e.color.yellow(n)}\n`:`${e.color.yellow(`${t}:`)} ${n}\n`;return{die(r,i){let a=typeof i==`number`?i:i?.exitCode??1,o=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0,s=t(r);throw e.writeStderr(n(e.color.red,o,s)),e.exit(a),Error(`unreachable`)},out(t){if(typeof t==`string`){e.writeStdout(t.endsWith(`
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./__vite-browser-external-5eBdwsFd.js";import{r as n,t as r}from"./multipart-form-data-DopbgwRR.js";import{n as i}from"./slicc-version-D4sOoWeK.js";import{t as a}from"./buffer-polyfill-BccMjOKj.js";import{t as o}from"./buffer-B5d1xHaH.js";import{F as s,I as c,N as l,P as u}from"./shared-C_68vn79.js";import{I as d,M as f,R as p,T as m,_ as h,c as g,g as _,i as v,j as y,l as b,n as x,r as S,s as C,w}from"./sync-sab-wire-CC30v4TL.js";import{t as T}from"./tmpdir-env-ate4iNcK.js";import{t as E}from"./realm-browser-fetch-V3uggGbM.js";function D(e){if(!e||e===`/`)return`/`;e.startsWith(`/`)||(e=`/`+e);let t=e.split(`/`),n=[];for(let e of t)e!==``&&e!==`.`&&(e===`..`?n.pop():n.push(e));return`/`+n.join(`/`)}function O(e){let t=D(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function k(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function A(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ee(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var te=class{tree=new Map;initialPaths=new Set;initialContent=new Map;initialKind=new Map;mkdtempCounter=0;tombstones=new Set;removedDirs=new Set;touched=!1;constructor(e){this.loadSnapshot(e)}loadSnapshot(e){this.tree=new Map,this.tombstones=new Set,this.removedDirs=new Set,this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map,this.tree.set(`/`,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(`/`),this.initialKind.set(`/`,`directory`);for(let t of e.entries){let e=D(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size}),this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}for(let t of e.entries){let e=O(D(t.path));for(;e!==`/`&&!this.tree.has(e);)this.tree.set(e,{content:new Uint8Array,isDirectory:!0}),this.initialPaths.add(e),this.initialKind.set(e,`directory`),e=O(e)}}wasUsed(){return this.touched}applySnapshot(e){this.loadSnapshot(e)}applySnapshotPreservingMutations(e){let t=this.getMutations();this.loadSnapshot(e);for(let e of t.deleted){if(this.tree.get(e)?.isDirectory){let t=e===`/`?`/`:e+`/`;for(let n of Array.from(this.tree.keys()))n!==e&&n.startsWith(t)&&this.tree.delete(n)}this.tree.delete(e)}for(let e of t.created)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink,symlinkTarget:e.symlinkTarget});for(let e of t.modified)this.ensureParentDirs(e.path),this.tree.set(e.path,{content:e.content,isDirectory:!1})}invalidate(){this.loadSnapshot({entries:[]})}resetBaseline(){this.initialPaths=new Set,this.initialContent=new Map,this.initialKind=new Map;for(let[e,t]of this.tree.entries())this.initialPaths.add(e),this.initialKind.set(e,this.entryKind(t)),!t.isDirectory&&!t.isSymbolicLink&&this.initialContent.set(e,t.content)}entryKind(e){return e.isSymbolicLink?`symlink`:e.isDirectory?`directory`:`file`}resolveEntry(e,t=!1){let n=D(e),r=n.split(`/`).filter(Boolean),i=[],a=new Set,o=0;if(r.length===0){let e=this.tree.get(`/`);return e?{path:`/`,entry:e}:void 0}for(;r.length>0;){let e=r.shift(),s=`/${[...i,e].join(`/`)}`,c=this.tree.get(s);if(!c)return;let l=r.length===0;if(c.isSymbolicLink&&!(t&&l)){if(a.has(s)||o++===40)throw Object.assign(Error(`ELOOP: too many symbolic links, '${n}'`),{code:`ELOOP`});a.add(s);let e=c.symlinkTarget??``;r=[...D(e.startsWith(`/`)?e:`${O(s)}/${e}`).split(`/`).filter(Boolean),...r],i=[];continue}if(!l&&!c.isDirectory)return;if(i.push(e),l)return{path:s,entry:c}}}ensureParentDirs(e){let t=O(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(D(e))?.partial===!0}commitWrite(e,t){this.writeFile(e,t);let n=D(e);for(this.initialContent.set(n,t);n!==`/`;){let e=this.tree.get(n);e&&(this.initialPaths.add(n),this.initialKind.set(n,this.entryKind(e))),n=O(n)}}readFile(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw k(t);if(n.truncated)throw A(t);return n.content}writeFile(e,t){this.touched=!0;let n=D(e);this.ensureParentDirs(n),this.tree.set(n,{content:t,isDirectory:!1}),this.tombstones.delete(n),this.removedDirs.delete(n)}exists(e){this.touched=!0;let t=D(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n)throw k(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t,!0);if(!n)throw k(t);return this.toStat(n.entry)}toStat(e){return{isFile:!e.isDirectory&&!e.isSymbolicLink,isDirectory:e.isDirectory,isSymbolicLink:e.isSymbolicLink===!0,size:e.isDirectory?0:e.size??e.content.byteLength}}readdir(e){this.touched=!0;let t=D(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw k(t);let r=n.path===`/`?`/`:n.path+`/`,i=new Set;for(let e of this.tree.keys()){if(e===t||e===`/`||!e.startsWith(r))continue;let n=e.slice(r.length).split(`/`)[0];n&&i.add(n)}return Array.from(i)}mkdir(e,t,n=!1){this.touched=!0;let r=D(e);if(this.tree.has(r)){if(this.tree.get(r).isDirectory)return;throw Object.assign(Error(`EEXIST: file already exists, '${r}'`),{code:`EEXIST`})}let i=O(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw k(r);this.mkdir(i,!0,n)}this.tree.set(r,{content:new Uint8Array,isDirectory:!0,...n?{partial:!0}:{}}),this.tombstones.delete(r),this.removedDirs.delete(r)}rm(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r)throw k(n);if(r.isDirectory&&!r.isSymbolicLink){let e=n===`/`?`/`:n+`/`,r=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));if(r.length>0&&!t)throw Object.assign(Error(`ENOTEMPTY: directory not empty, '${n}'`),{code:`ENOTEMPTY`});for(let e of r)this.tree.delete(e),this.tombstones.add(e);t&&this.removedDirs.add(n)}this.tree.delete(n),this.tombstones.add(n)}copyFile(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r||r.isDirectory)throw k(n);if(r.truncated)throw A(n);let i=D(t);this.ensureParentDirs(i),this.tree.set(i,{content:r.content.slice(),isDirectory:!1}),this.tombstones.delete(i),this.removedDirs.delete(i)}rename(e,t){this.touched=!0;let n=D(e),r=this.tree.get(n);if(!r)throw k(n);let i=D(t);if(r.isDirectory){let e=n===`/`?`/`:n+`/`,t=Array.from(this.tree.keys()).filter(t=>t!==n&&t.startsWith(e));this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n);for(let e of t){let t=this.tree.get(e),r=i+e.slice(n.length);this.tree.set(r,t),this.tree.delete(e)}this.tombstones.add(n),this.removedDirs.add(n),this.tombstones.delete(i),this.removedDirs.delete(i);return}this.ensureParentDirs(i),this.tree.set(i,r),this.tree.delete(n),this.tombstones.add(n),this.tombstones.delete(i),this.removedDirs.delete(i)}unlink(e){this.touched=!0;let t=D(e),n=this.tree.get(t);if(!n)throw k(t);if(n.isDirectory&&!n.isSymbolicLink)throw Object.assign(Error(`EISDIR: illegal operation on a directory, unlink '${t}'`),{code:`EISDIR`});this.tree.delete(t),this.tombstones.add(t)}markRemoved(e,t=!1){this.touched=!0;let n=D(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=D(e);if(this.tombstones.has(t))return!0;for(let e of this.removedDirs)if(t===e||t.startsWith(`${e}/`))return!0;return!1}mkdtemp(e){this.touched=!0;for(let t=0;t<100;t++){let t=`_${String(this.mkdtempCounter).padStart(6,`0`)}`;this.mkdtempCounter++;let n=D(e+t);if(!this.tree.has(n))return this.mkdir(n,!0),n}throw Error(`mkdtemp: failed to create unique directory after 100 attempts`)}getMutations(){let e=[],t=[],n=[];for(let[r,i]of this.tree.entries()){if(r===`/`)continue;if(!this.initialPaths.has(r)){e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}let a=this.initialKind.get(r);if(a!==void 0&&a!==this.entryKind(i)){n.push(r),e.push({path:r,content:i.content,isDirectory:i.isDirectory,isSymbolicLink:i.isSymbolicLink,symlinkTarget:i.symlinkTarget});continue}if(!i.isDirectory&&!i.isSymbolicLink){let e=this.initialContent.get(r);e&&!ee(e,i.content)&&t.push({path:r,content:i.content})}}for(let e of this.initialPaths)e!==`/`&&(this.tree.has(e)||n.push(e));return{created:e,modified:t,deleted:n}}};function ne(){return globalThis.Buffer}function re(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function ie(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function ae(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function oe(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function se(e){if(e===0||e===`/dev/stdin`)return 0;if(e===1||e===`/dev/stdout`)return 1;if(e===2||e===`/dev/stderr`)return 2}function ce(e,t){let n=se(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw ae(t,e);return!1}function le(e,t,n){let r=se(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw ae(n,t)}function ue(e){return typeof e==`string`?e:ie(xe(e))}function de(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ne();return n?n.from(e):e}function fe(e){return typeof e==`string`?e:e?.encoding}function pe(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function me(e,t){if(!t)return;let n={readFile:e.readFile,readFileBinary:e.readFileBinary,writeFile:e.writeFile,writeFileBinary:e.writeFileBinary,appendFile:e.appendFile,access:e.access,exists:e.exists,stat:e.stat};e.readFile=async(e,r)=>{if(!ce(e,`read`))return n.readFile(e,r);let i=fe(r);if(i===null||i===`buffer`){let e=ne(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>ce(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ue(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=le(t,e,`write`);return i?(i(ie(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=le(t,e,`append`);if(!i)return n.appendFile(e,r);i(ue(r))},e.access=async e=>{if(!oe(e))return n.access(e)},e.exists=async e=>oe(e)||n.exists(e),e.stat=async e=>oe(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function he(e,t,n){function r(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e instanceof ArrayBuffer?new Uint8Array(e):new TextEncoder().encode(typeof e==`string`?e:String(e))}async function i(t,n){let r=typeof n==`string`?n:n?.encoding;if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ne();return r?r.from(n instanceof Uint8Array?n:new Uint8Array(n)):n}return e.call(`vfs`,`readFile`,[t])}async function a(t,n){return typeof n==`string`?e.call(`vfs`,`writeFile`,[t,n]):e.call(`vfs`,`writeFileBinary`,[t,r(n)])}async function o(t,n){if(typeof n==`string`){await e.call(`vfs`,`appendFile`,[t,n]);return}await e.call(`vfs`,`appendFile`,[t,r(n)])}async function s(t,n,r){let i=await e.call(`vfs`,`stat`,[t]);if(i.isFile){let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]);return}if(!i.isDirectory||!r?.recursive)throw Error(`cp: '${t}' is a directory (use {recursive: true})`);await l(n);let a=await e.call(`vfs`,`readDir`,[t]);for(let e of a)await s(`${t}/${e}`,`${n}/${e}`,r)}async function c(t,n){if(n?.force&&!await e.call(`vfs`,`exists`,[t]))return!0;if((await e.call(`vfs`,`stat`,[t])).isFile)return e.call(`vfs`,`rm`,[t]);if(!n?.recursive)throw Error(`rm: '${t}' is a directory (use {recursive: true})`);let r=await e.call(`vfs`,`readDir`,[t]);for(let e of r)await c(`${t}/${e}`,n);return e.call(`vfs`,`rm`,[t])}async function l(t){await e.call(`vfs`,`mkdir`,[t])}async function u(t){for(let n=0;n<5;n++){let n=`${t}${Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,6)}`;if(!await e.call(`vfs`,`exists`,[n]))return await e.call(`vfs`,`mkdir`,[n]),n}throw Error(`mkdtemp: failed to create unique directory after 5 attempts`)}async function d(t,n){try{await e.call(`vfs`,`rename`,[t,n])}catch{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r]),await e.call(`vfs`,`rm`,[t])}}async function f(t){if(!await e.call(`vfs`,`exists`,[t]))throw Object.assign(Error(`ENOENT: no such file or directory, access '${t}'`),{code:`ENOENT`})}let p={readFile:i,readFileBinary:t=>e.call(`vfs`,`readFileBinary`,[t]),writeFile:a,writeFileBinary:(t,n)=>e.call(`vfs`,`writeFileBinary`,[t,n]),appendFile:o,cp:s,rm:c,readDir:t=>e.call(`vfs`,`readDir`,[t]),readdir:t=>e.call(`vfs`,`readDir`,[t]),exists:t=>e.call(`vfs`,`exists`,[t]),stat:t=>e.call(`vfs`,`stat`,[t]),mkdir:(t,n)=>e.call(`vfs`,`mkdir`,[t]),mkdtemp:u,rename:d,access:f,unlink:t=>e.call(`vfs`,`rm`,[t]),rmdir:t=>e.call(`vfs`,`rm`,[t]),copyFile:async(t,n)=>{let r=await e.call(`vfs`,`readFileBinary`,[t]);await e.call(`vfs`,`writeFileBinary`,[n,r])},fetchToFile:async(n,r)=>{let i=await t(n);if(!i.ok)throw Error(`fetch ${i.status} ${i.statusText}`);let a=new Uint8Array(await i.arrayBuffer());return await e.call(`vfs`,`writeFileBinary`,[r,a]),a.byteLength},promises:null};return me(p,n),p.promises=p,p}function j(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function ge(e,t,n,r={},i){let a=r.recursive===!0;try{return r.requireFile?e.unlink(n):e.rm(n,a),i?.(n),!0}catch(e){if(e?.code!==`ENOENT`)throw e}let o=t;if(!o?.rm||e.isTombstoned(n))return!1;try{if(!o.exists(n))return!1}catch{return!1}return o.rm(n),e.markRemoved(n,a),!0}function _e(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>ge(t,n,e,r,l);return{rmSync(e,t){let n=r(e);if(!(t?.force&&!i(n))&&!u(n,{recursive:t?.recursive===!0})&&!t?.force)throw j(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw j(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw j(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw j(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i);try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw j(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw j(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw j(`ENOENT`,a,`rename`)}}}function ve(e,t){if(!t)return;let n={readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,existsSync:e.existsSync,accessSync:e.accessSync,statSync:e.statSync,lstatSync:e.lstatSync};e.readFileSync=(e,r)=>ce(e,`read`)?de(t.readStdinBytes(),fe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=le(t,e,`write`);i?i(ue(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=le(t,e,`append`);i?i(ue(r)):n.appendFileSync(e,r)},e.existsSync=e=>oe(e)||n.existsSync(e),e.accessSync=e=>{oe(e)||n.accessSync(e)},e.statSync=e=>oe(e)?pe():n.statSync(e),e.lstatSync=e=>oe(e)?pe():n.lstatSync(e)}function ye(e,t,n,r){let i=t=>e===`/`?`/${t}`:`${e}/${t}`,a=new Set(n);for(let e of t)a.add(e);for(let e of a)r(i(e))&&a.delete(e);return[...a]}function be(e,t,n){let r=t=>e.isTombstoned(t);try{let i=e.readdir(n);if(!t||!e.isPartial(n)||r(n))return i;try{return ye(n,i,t.readdir(n),r)}catch(e){if(e?.code===`ENOENT`)return i;throw e}}catch(e){let i=e?.code;if(!t||r(n)||i!==`ENOENT`)throw e;return ye(n,[],t.readdir(n),r)}}function xe(e){if(typeof e==`string`)return new TextEncoder().encode(e);if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return new TextEncoder().encode(String(e))}function Se(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ce(e,t,n,r,i){function a(e){return D(e.startsWith(`/`)?e:t+(t.endsWith(`/`)?``:`/`)+e)}function o(t){try{return e.readFile(t)}catch(r){let i=r?.code;if(n&&!e.isTombstoned(t)&&(i===`ENOENT`||i===`ENOSYNC`))return n.readFile(t);throw r}}let s=(t,r)=>Se(e,n,i,t,r);function c(t){if(e.exists(t))return!0;if(!n||e.isTombstoned(t))return!1;try{return n.exists(t)}catch{return!1}}function l(t){try{return e.stat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.stat(t)}}function u(t){try{return e.lstat(t)}catch(r){let i=r?.code;if(!n||e.isTombstoned(t)||i!==`ENOENT`)throw r;return n.lstat(t)}}let d=e=>({isFile:()=>e.isFile,isDirectory:()=>e.isDirectory,isSymbolicLink:()=>e.isSymbolicLink===!0,isCharacterDevice:()=>!1,size:e.size}),f=(e,t)=>e===`/`?`/${t}`:`${e}/${t}`;function p(t,r){if(!l(t).isDirectory){s(r,o(t));return}e.mkdir(r,!0);for(let i of be(e,n,t))p(f(t,i),f(r,i))}let m={..._e({syncFs:e,bridge:n,persistDelete:i?.delete,resolve:a,existsResolved:c,statResolved:l,lstatResolved:u,readBytes:o,writeThrough:s}),readFileSync(e,t){return de(o(a(e)),fe(t))},writeFileSync(e,t){s(a(e),xe(t))},appendFileSync(e,t){let n=a(e),r=new Uint8Array;try{r=o(n)}catch(e){if(e?.code!==`ENOENT`)throw e}let i=xe(t),c=new Uint8Array(r.byteLength+i.byteLength);c.set(r),c.set(i,r.byteLength),s(n,c)},truncateSync(e,t=0){let n=a(e),r=o(n),i=new Uint8Array(t);i.set(r.subarray(0,Math.min(t,r.byteLength))),s(n,i)},existsSync(e){return c(a(e))},accessSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`access`)},mkdirSync(t,n){e.mkdir(a(t),n?.recursive)},statSync:e=>d(l(a(e))),lstatSync:e=>d(u(a(e))),realpathSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`realpath`);return t},readdirSync(t){return be(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},chmodSync(e){let t=a(e);if(!c(t))throw j(`ENOENT`,t,`chmod`)},mkdtempSync(t){return e.mkdtemp(a(t))}};return ve(m,r),m}function we(e){let t=e=>{if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},n=(e,t,n)=>t===void 0?`${e(`Error:`)} ${n}\n`:t===``?`${e(n)}\n`:`${e(`${t}:`)} ${n}\n`,r=(t,n)=>t===void 0?`${e.color.yellow(`Warning:`)} ${n}\n`:t===``?`${e.color.yellow(n)}\n`:`${e.color.yellow(`${t}:`)} ${n}\n`;return{die(r,i){let a=typeof i==`number`?i:i?.exitCode??1,o=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0,s=t(r);throw e.writeStderr(n(e.color.red,o,s)),e.exit(a),Error(`unreachable`)},out(t){if(typeof t==`string`){e.writeStdout(t.endsWith(`
|
|
2
2
|
`)?t:`${t}\n`);return}try{e.writeStdout(`${JSON.stringify(t,null,2)}\n`)}catch{e.writeStdout(`${String(t)}\n`)}},warn(n,i){let a=typeof i==`object`&&i&&`prefix`in i?i.prefix:void 0;e.writeStderr(r(a,t(n)))},help(t){throw e.writeStdout(t.endsWith(`
|
|
3
3
|
`)?t:`${t}\n`),e.exit(0),Error(`unreachable`)}}}const M={reset:`\x1B[0m`,green:`\x1B[32m`,red:`\x1B[31m`,yellow:`\x1B[33m`,gray:`\x1B[90m`,bold:`\x1B[1m`,cyan:`\x1B[36m`,dim:`\x1B[2m`};function Te(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${M.reset}`:String(n);return{enabled:t,green:n(M.green),red:n(M.red),yellow:n(M.yellow),gray:n(M.gray),bold:n(M.bold),cyan:n(M.cyan),dim:n(M.dim)}}const Ee=/\u001b\[[0-9;]*m/g;function De(e){return e.replace(Ee,``)}function Oe(e){return De(e).length}function ke(e,t){let n=String(e??``);return t<=0?``:Oe(n)<=t?n:t<=1?n.slice(0,t):`${De(n).slice(0,t-1)}…`}function Ae(e,t){let n=String(e??``),r=Oe(n);return r===t?n:r>t?ke(n,t):n+` `.repeat(t-r)}function je(e,t){if(!e.length)return``;let n=Math.max(...e.map(e=>e.length)),r=[];for(let i=0;i<n;i++)if(t&&t[i]!==void 0)r[i]=t[i];else{let t=0;for(let n of e){let e=i<n.length?String(n[i]??``):``;t=Math.max(t,Oe(e))}r[i]=t}return e.map(e=>r.map((t,n)=>Ae(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
|
|
4
4
|
`)}function Me(e){return e instanceof Date?e:new Date(e)}function Ne(e){return e<10?`0${e}`:String(e)}function Pe(e,t=`short`){let n=Me(e);if(Number.isNaN(n.getTime()))return String(e);if(t===`iso`)return n.toISOString();if(t===`locale`)return new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(n);if(t===`human`){let e=Date.now()-n.getTime(),t=Math.abs(e);if(t<6e4)return e>=0?`just now`:`in a moment`;let r=(t,n)=>e>=0?`${t} ${n}${t===1?``:`s`} ago`:`in ${t} ${n}${t===1?``:`s`}`;return t<36e5?r(Math.round(t/6e4),`minute`):t<864e5?r(Math.round(t/36e5),`hour`):t<26298e5?r(Math.round(t/864e5),`day`):t<315576e5?r(Math.round(t/26298e5),`month`):r(Math.round(t/315576e5),`year`)}return`${n.getFullYear()}-${Ne(n.getMonth()+1)}-${Ne(n.getDate())}`}const Fe={trunc:ke,col:Ae,table:je,date:Pe};var N=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${Ie(e.actual)} ${e.operator||`!=`} ${Ie(e.expected)}`),this.name=`AssertionError`,this.actual=e.actual,this.expected=e.expected,this.operator=e.operator||``,this.generatedMessage=t,this.code=`ERR_ASSERTION`}};function Ie(e){if(typeof e==`string`)return JSON.stringify(e);if(e==null)return String(e);if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function P(e,t){return e instanceof Error?e:typeof e==`string`?new N({message:e}):t()}function Le(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ze(e[i],t[i],n,r))return!1;return!0}function Re(e,t,n,r){let i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(let a of i)if(!Object.prototype.hasOwnProperty.call(t,a)||!ze(Reflect.get(e,a),Reflect.get(t,a),n,r))return!1;return!0}function ze(e,t,n,r){if((n?Object.is(e,t):e===t)||!n&&e==t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return!1;let i=e,a=t;return n&&Object.getPrototypeOf(i)!==Object.getPrototypeOf(a)?!1:r.get(i)===a||(r.set(i,a),Array.isArray(e)===Array.isArray(t)?Array.isArray(e)&&Array.isArray(t)?Le(e,t,n,r):Re(i,a,n,r):!1)}function Be(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function Ve(e,t){for(let[n,r]of Object.entries(t)){let t=Reflect.get(e,n);if(r instanceof RegExp){if(typeof t!=`string`||!r.test(t))return!1}else if(t!==r)return!1}return!0}function He(e,t){if(t===void 0)return!0;if(t instanceof RegExp){let n=e instanceof Error?e.message:String(e);return t.test(n)}return typeof t==`function`?Be(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:Ve(e,t):!1}function Ue(e){let t=(e,t)=>{if(!e)throw P(t,()=>new N({message:`The expression evaluated to a falsy value`,actual:e,expected:!0,operator:`==`}))},n=((e,n)=>t(e,n)),r=(e,t,n)=>{if(!Object.is(e,t))throw P(n,()=>new N({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw P(i,()=>new N({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw P(n,()=>new N({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw P(r,()=>new N({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!ze(e,t,!0,new WeakMap))throw P(n,()=>new N({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!ze(t,n,!1,new WeakMap))throw P(r,()=>new N({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(ze(e,t,!0,new WeakMap))throw P(n,()=>new N({actual:e,expected:t,operator:`notDeepStrictEqual`}))};return n.ok=t,n.equal=i,n.notEqual=o,n.strictEqual=r,n.notStrictEqual=a,n.deepEqual=c,n.deepStrictEqual=s,n.notDeepEqual=(t,n,r)=>{if(e){l(t,n,r);return}if(ze(t,n,!1,new WeakMap))throw P(r,()=>new N({actual:t,expected:n,operator:`notDeepEqual`}))},n.notDeepStrictEqual=l,n.throws=(e,t,n)=>{let r,i=!1;try{e()}catch(e){r=e,i=!0}if(!i)throw P(typeof t==`string`?t:n,()=>new N({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!He(r,t))throw P(n,()=>new N({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw P(t,()=>new N({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw P(e,()=>new N({message:`Failed`,operator:`fail`}))},n.AssertionError=N,n}const We=Ue(!0);We.strict=We;const Ge=Ue(!1);Ge.strict=We;function Ke(e,t){let n=globalThis.Buffer;if(!n)throw Error(`crypto.createHash: Buffer is unavailable in this environment`);return t?n.from(e,t):n.from(e)}var qe=class{_events=new Map;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}addListener(e,t){return this.on(e,t)}off(e,t){let n=this._events.get(e);if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&this._events.delete(e)}return this}removeListener(e,t){return this.off(e,t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}removeAllListeners(e){return e===void 0?this._events.clear():this._events.delete(e),this}listenerCount(e){return this._events.get(e)?.length??0}listeners(e){return[...this._events.get(e)??[]]}};const Je=Object.assign(qe,{EventEmitter:qe,default:qe});var Ye=class{_events=new Map;closeScheduled=!1;writable=!0;readable=!0;on(e,t){let n=this._events.get(e);return n?n.push(t):this._events.set(e,[t]),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this._events.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._events.get(e);if(!n||n.length===0)return!1;for(let e of[...n])e(...t);return!0}pipe(e){return this.on(`data`,t=>e.write(t)),this.once(`end`,()=>e.end()),e}closeOnDestroy(){return this.closeScheduled?this:(this.closeScheduled=!0,queueMicrotask(()=>this.emit(`close`)),this)}removeListener(e,t){return this.off(e,t)}removeAllListeners(){return this._events.clear(),this}},Xe=class extends Ye{read(){return null}destroy(){return this.closeOnDestroy()}},Ze=class extends Ye{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this.closeOnDestroy()}},Qe=class extends Ye{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this.closeOnDestroy()}};const $e={Readable:Xe,Writable:Ze,Transform:Qe,PassThrough:class extends Qe{},Stream:Ye},et=Symbol.for(`nodejs.util.inspect.custom`),tt=Symbol.for(`nodejs.util.promisify.custom`);function nt(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function rt(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return nt(e);if(t===`number`)return Object.is(e,-0)?`-0`:String(e);if(t===`bigint`)return`${String(e)}n`;if(t===`boolean`||t===`undefined`)return String(e);if(t===`symbol`)return e.toString();if(t===`function`){let t=e.name;return t?`[Function: ${t}]`:`[Function (anonymous)]`}return null}function it(e){return e instanceof RegExp?e.toString():e instanceof Date?Number.isNaN(e.getTime())?`Invalid Date`:e.toISOString():e instanceof Error?e.stack||`${e.name}: ${e.message}`:null}function at(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>ot(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${ot(e,t+1,n)} => ${ot(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>ot(e,t+1,n));return`Set(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}let r=Object.keys(e),i=e.constructor?e.constructor.name:``,a=i&&i!==`Object`?`${i} `:``;return r.length===0?`${a}{}`:`${a}{ ${r.map(r=>`${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(r)?r:nt(r)}: ${ot(e[r],t+1,n)}`).join(`, `)} }`}function ot(e,t,n){let r=rt(e);if(r!==null)return r;let i=e,a=it(i);if(a!==null)return a;let o=i[et];if(typeof o==`function`)try{return String(o.call(i,n.maxDepth,n.opts))}catch{}if(n.seen.has(e))return`[Circular *1]`;if(n.maxDepth!==null&&t>n.maxDepth)return Array.isArray(e)?`[Array]`:`[Object]`;n.seen.add(e);try{return at(i,t,n)}finally{n.seen.delete(e)}}function st(e,t={}){let n=t.depth===void 0?2:t.depth;return ot(e,0,{seen:new Set,maxDepth:n,opts:t})}function ct(e,t,n,r){if(e===`%%`)return`%`;if(n.i>=t.length)return e;let i=t[n.i];switch(e){case`%s`:return n.i++,typeof i==`string`?i:typeof i==`bigint`?`${String(i)}n`:i==null||typeof i==`number`||typeof i==`boolean`?String(i):st(i,{depth:r.depth===void 0?2:r.depth});case`%d`:return n.i++,typeof i==`bigint`?`${String(i)}n`:Number.isNaN(Number(i))?`NaN`:String(Number(i));case`%i`:return n.i++,typeof i==`bigint`?`${String(i)}n`:String(Number.parseInt(i,10));case`%f`:return n.i++,String(typeof i==`bigint`?i:Number.parseFloat(i));case`%j`:n.i++;try{return JSON.stringify(i)??`undefined`}catch{return`[Circular]`}case`%o`:return n.i++,st(i,{depth:4});case`%O`:return n.i++,st(i,{depth:null});case`%c`:return n.i++,``;default:return e}}function lt(e,...t){let n=t[0];if(typeof n!=`string`)return t.map(e=>typeof e==`string`?e:st(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>ct(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:st(e)}`}return i}function ut(...e){return lt({},...e)}function dt(e,t){if(e==null)throw TypeError(`The constructor to "inherits" must not be null or undefined`);if(t==null)throw TypeError(`The super constructor to "inherits" must not be null or undefined`);if(t.prototype===void 0)throw TypeError(`The super constructor to "inherits" must have a prototype`);e.super_=t,Object.setPrototypeOf(e.prototype,t.prototype)}function ft(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[tt];if(t){if(typeof t!=`function`)throw TypeError(`The [util.promisify.custom] property must be of type function`);return t}function n(...t){return new Promise((n,r)=>{e.call(this,...t,(e,...t)=>{if(e){r(e);return}n(t.length>1?t:t[0])})})}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),n}function pt(e){return function(t,n,r){if(typeof t!=`function`)throw TypeError(`The "fn" argument must be of type function`);let i=!1;function a(...a){return i||(i=!0,e(r?`[${r}] DeprecationWarning: ${n}`:`DeprecationWarning: ${n}`)),new.target?Reflect.construct(t,a,new.target):t.apply(this,a)}return Object.setPrototypeOf(a,Object.getPrototypeOf(t)),t.prototype&&(a.prototype=t.prototype),a}}const mt=st;mt.custom=et;const ht=ft;ht.custom=tt;function gt(e){return{format:ut,formatWithOptions:lt,inspect:mt,inherits:dt,promisify:ht,deprecate:pt(e)}}const _t=gt(()=>{});let vt=1;function yt(e){if(typeof e==`string`)return e;if(ArrayBuffer.isView(e)){let t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}return e==null?``:String(e)}function bt(e,t,n){return Object.assign(TypeError(`The "${e}" argument must be of type ${t}. Received ${n===null?`null`:Array.isArray(n)?`array`:typeof n}`),{code:`ERR_INVALID_ARG_TYPE`})}function xt(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw bt(`options.env`,`object`,e);let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r!=`string`)throw bt(`options.env[${n}]`,`string`,r);t[n]=r}return t}function St(e){if(e!==void 0){if(typeof e!=`string`)throw bt(`options.cwd`,`string`,e);return e}}function Ct(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?Ke(e):Ke(e).toString(t)}function wt(e,t){if(e.length===0)return Ct(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function Tt(e,t,n){t.length>0&&e.emit(`data`,Ct(t,n)),e.readable=!1,e.emit(`end`)}function Et(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(yt(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(yt(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var Dt=class extends qe{stdout;stderr;stdin;pid;exitCode=null;signalCode=null;killed=!1;spawnfile;spawnargs;handle;constructor(e,t,n,r){super(),this.handle=e,this.pid=vt++,this.spawnfile=n,this.spawnargs=r,this.stdout=new Xe,this.stderr=new Xe,this.stdin=Et(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){Tt(this.stdout,e.stdout,t),Tt(this.stderr,e.stderr,t),this.exitCode=e.exitCode;let n=this.killed?null:e.exitCode,r=this.killed?this.signalCode:null;this.emit(`exit`,n,r),this.emit(`close`,n,r)}kill(e=`SIGTERM`){return this.killed=!0,this.signalCode=e,this.handle.kill(e).catch(()=>{}),!0}};function Ot(e){let t=(t,n,r)=>{if(!e)throw Error(`child_process.${t} is not available in this browser realm (no synchronous bridge — the page has no controlling Service Worker). Use the async form instead: await promisify(${t.replace(/Sync$/,``)})(…).`);return e.run(n,r)},n=e=>{let t=St(e.cwd),n=xt(e.env);return{...e.input===void 0?{}:{input:yt(e.input)},...e.timeout===void 0?{}:{timeout:e.timeout},...t===void 0?{}:{cwd:t},...n===void 0?{}:{env:n}}},r=(e,r,i,a)=>{let o=a.encoding===void 0?`buffer`:a.encoding,s=t(e,r,n(a)),c=Ct(s.stdout,o),l=Ct(s.stderr,o);if(s.exitCode===0)return c;throw Object.assign(Error(`Command failed: ${i}\n${s.stderr}`),{status:s.exitCode,signal:null,stdout:c,stderr:l,output:[null,c,l],pid:vt++})},i=(e,t)=>({args:Array.isArray(e)?e:[],options:(Array.isArray(e)?t:e)??{}});return{execSync:(e,t={})=>r(`execSync`,e,e,t),execFileSync:(e,t,n)=>{let{args:a,options:o}=i(t,n),s=[e,...a];return r(`execFileSync`,s,s.join(` `),o)},spawnSync:(e,r,a)=>{let{args:o,options:s}=i(r,a),c=s.encoding===void 0?`buffer`:s.encoding,l=vt++,u=s.shell?`${e}${o.length?` ${o.join(` `)}`:``}`:[e,...o],d;try{d=t(`spawnSync`,u,n(s))}catch(e){if(e instanceof TypeError)throw e;let t=Ct(``,c);return{pid:l,status:null,signal:null,stdout:t,stderr:t,output:[null,t,t],error:e instanceof Error?e:Error(String(e))}}let f=Ct(d.stdout,c),p=Ct(d.stderr,c);return{pid:l,status:d.exitCode,signal:null,stdout:f,stderr:p,output:[null,f,p]}}}}function kt(e,t){let n=(t,n,r,i,a)=>{let o=St(n.cwd),s=xt(n.env),c={...o===void 0?{}:{cwd:o},...s===void 0?{}:{env:s}},l=e.start(t,c),u=new Dt(l,r,i,a);return n.input!==void 0&&u.stdin.write(yt(n.input)),queueMicrotask(()=>l.stdin.end()),u},r=(e,t,n,r)=>{if(typeof r!=`function`)return;let i=[],a=[];e.stdout.on(`data`,e=>i.push(e)),e.stderr.on(`data`,e=>a.push(e)),e.once(`error`,e=>r(e,wt(i,t),wt(a,t))),e.once(`close`,(o,s)=>{let c=wt(i,t),l=wt(a,t);if(o===0){r(null,c,l);return}r(Object.assign(Error(`Command failed: ${n}\n${yt(l)}`),{code:o===null?void 0:o,killed:e.killed,signal:s??null,cmd:n}),c,l)})},i=(e,t,i)=>{let a=typeof t==`function`?t:i,o=t&&typeof t==`object`?t:{},s=o.encoding===void 0?`utf8`:o.encoding,c=n(e,o,s,e,[]);return r(c,s,e,a),c},a=(e,t,i,a)=>{let o=[],s={},c;Array.isArray(t)?(o=t,typeof i==`function`?c=i:(s=i??{},c=typeof a==`function`?a:void 0)):typeof t==`function`?c=t:t&&typeof t==`object`&&(s=t,c=typeof i==`function`?i:void 0);let l=s.encoding===void 0?`utf8`:s.encoding,u=[e,...o],d=n(u,s,l,e,o);return r(d,l,u.join(` `),c),d},o=(e,t,r)=>{let i=[],a={};Array.isArray(t)?(i=t,a=r??{}):t&&typeof t==`object`&&(a=t);let o=a.encoding===void 0?`buffer`:a.encoding,s=a.shell?`${e}${i.length?` ${i.join(` `)}`:``}`:[e,...i];return n(s,a,o,e,i)},s=(e,t)=>new Promise((n,r)=>{i(e,t,(e,t,i)=>{if(e){r(Object.assign(e,{stdout:t,stderr:i}));return}n({stdout:t,stderr:i})})}),c=(e,t,n)=>new Promise((r,i)=>{a(e,Array.isArray(t)?t:[],Array.isArray(t)?n:t,(e,t,n)=>{if(e){i(Object.assign(e,{stdout:t,stderr:n}));return}r({stdout:t,stderr:n})})}),l=e=>()=>{throw Error(`child_process.${e} is not available in the browser realm`)},u=Ot(t),d=(e,t)=>{Object.defineProperty(e,tt,{value:t,enumerable:!1,configurable:!0})};return d(i,s),d(a,c),{exec:i,execFile:a,spawn:o,execSync:u.execSync,spawnSync:u.spawnSync,execFileSync:u.execFileSync,fork:l(`fork`),ChildProcess:Dt}}function At(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var jt={exports:{}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./main-
|
|
1
|
+
import{l as e}from"./main-AUZMzMCG.js";async function t(){try{let e=await navigator.serviceWorker?.getRegistrations?.();e&&await Promise.all(e.map(e=>e.unregister().catch(()=>!1)))}catch{}try{let e=await indexedDB.databases();await Promise.all(e.filter(e=>!!e.name).map(e=>new Promise(t=>{let n=indexedDB.deleteDatabase(e.name);n.onsuccess=()=>t(),n.onerror=()=>t(),n.onblocked=()=>t()})))}catch{}try{let e=navigator.storage;if(typeof e?.getDirectory==`function`){let t=await e.getDirectory(),n=[];for await(let e of t.keys())n.push(e);await Promise.all(n.map(e=>t.removeEntry(e,{recursive:!0}).catch(()=>{})))}}catch{}}function n(n,r,i={}){if(n.dataset.recoveryBusy===`1`)return;let a=i.wipe??t,o=i.reload??(()=>location.reload()),s=r instanceof Error?r.message:String(r),c=i.verdict===`browser-wedged`,l=document.createElement(`div`);l.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let u=document.createElement(`h1`);u.style.color=`var(--s2-negative, #e34850)`,u.textContent=c?`Your browser needs a restart`:`Failed to start`;let d=document.createElement(`p`);d.style.color=`var(--s2-content-tertiary, #717171)`,d.textContent=s;let f=document.createElement(`div`);f.style.cssText=`display:flex;gap:0.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.5rem;`;let p=document.createElement(`button`);p.type=`button`,p.textContent=`Reset local data & reload`,p.dataset.variant=c?`demoted`:`destructive`,p.style.cssText=c?`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-content-tertiary, #717171);background:transparent;color:inherit;border-radius:4px;`:`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-negative, #e34850);background:var(--s2-negative, #e34850);color:#fff;border-radius:4px;`;let m=document.createElement(`button`);if(m.type=`button`,m.textContent=`Reload`,m.style.cssText=c?`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-accent, #0265dc);background:var(--s2-accent, #0265dc);color:#fff;border-radius:4px;`:`padding:0.5rem 1rem;cursor:pointer;border:1px solid var(--s2-content-tertiary, #717171);background:transparent;color:inherit;border-radius:4px;`,p.addEventListener(`click`,()=>{p.disabled=!0,m.disabled=!0,p.textContent=`Resetting…`,n.dataset.recoveryBusy=`1`,(async()=>{try{await a()}catch{}for(let t of e)try{localStorage.removeItem(t)}catch{}o()})()}),m.addEventListener(`click`,()=>{o()}),c){let e=document.createElement(`p`);e.style.cssText=`max-width:34rem;margin:1rem auto 0;`,e.textContent=`This browser has stopped starting web workers — a browser process issue, not a problem with your data. Quit the browser completely, reopen it, and come back. Your local data is intact; resetting it will not fix this.`,l.append(u,d,e),f.append(m,p)}else l.append(u,d),f.append(p,m);for(l.append(f);n.firstChild;)n.removeChild(n.firstChild);n.appendChild(l)}export{n as renderBootRecoveryScreen};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/readline-BOCWRKSR.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/xterm-B5LH8GIb.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";import{ft as n,pt as r}from"./wc-shell-GgRX7gs9.js";import"./tool-ui-eSQ1g2I1.js";import{t as i}from"./permissions-surface-registry-CilCRwhh.js";import{storePendingHandle as a}from"./mount-picker-popup--ijSfN8u.js";import{r as o,t as s}from"./hid-device-registry-B2R-0rNt.js";import"./browser-DGwroBSO.js";import{a as c,n as l}from"./serial-port-registry-CCqklAEr.js";import{a as u,t as d}from"./usb-device-registry--JwKRTYp.js";import"./usb-operations-v1mGAdRY.js";import{t as f}from"./terminal-session-client-ADzaWGFd.js";function p(e,t){let n=[],r=new Map,i=new Set;for(let a=0;a<e.length;a++){let o=e[a];o.startsWith(`-`)?t.has(o)?r.set(o,e[++a]??``):i.add(o):n.push(o)}return{positionals:n,flags:r,bools:i}}new TextDecoder(`utf-8`,{fatal:!1}),new TextEncoder;var m=new Set([`--vid`,`--pid`,`--baud`,`--data-bits`,`--stop-bits`,`--parity`,`--flow-control`,`--buffer-size`,`--bytes`,`--until`,`--timeout-ms`,`--dtr`,`--rts`,`--break`,`--__resolved`]);function h(e){return p(e,m)}function g(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function _(e){let t={};return e.has(`--vid`)&&(t.usbVendorId=g(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.usbProductId=g(e.get(`--pid`),`pid`)),Object.keys(t).length>0?[t]:[]}`${l}${l}`;var v=new Set([`--port`,`--baud`,`--vid`,`--pid`]),y=115200;function b(e){return p(e,v)}`${y}`;var x=new Set([`--vid`,`--pid`,`--usage-page`,`--usage`,`--__resolved`,`--timeout`]);function S(e){return p(e,x)}function C(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function w(e){let t={};return e.has(`--vid`)&&(t.vendorId=C(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=C(e.get(`--pid`),`pid`)),e.has(`--usage-page`)&&(t.usagePage=C(e.get(`--usage-page`),`usage-page`)),e.has(`--usage`)&&(t.usage=C(e.get(`--usage`),`usage`)),Object.keys(t).length>0?[t]:[]}`${s}`;var T=new Set([`--vid`,`--pid`,`--class`,`--subclass`,`--protocol`,`--serial`,`--request-type`,`--recipient`,`--request`,`--value`,`--index`,`--__resolved`]);function E(e){return p(e,T)}function D(e,t){let n=/^0x/i.test(e)?parseInt(e,16):parseInt(e,10);if(!Number.isFinite(n)||Number.isNaN(n))throw Error(`invalid ${t}: '${e}'`);return n}function O(e){let t={};return e.has(`--vid`)&&(t.vendorId=D(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=D(e.get(`--pid`),`pid`)),e.has(`--class`)&&(t.classCode=D(e.get(`--class`),`class`)),e.has(`--subclass`)&&(t.subclassCode=D(e.get(`--subclass`),`subclass`)),e.has(`--protocol`)&&(t.protocolCode=D(e.get(`--protocol`),`protocol`)),e.has(`--serial`)&&(t.serialNumber=e.get(`--serial`)),Object.keys(t).length>0?[t]:[]}`${d}`;function k(e){let{border:t,...r}=n(e);return r}var A=`\x1B[34m/\x1B[0m \x1B[90m$\x1B[0m `,j=class{options;client;terminal=null;fitAddon=null;terminalHost=null;previewHost=null;previewUrls=[];hasPreview=!1;previewStateListener=null;resizeObserver=null;unwatchTheme=null;mountRoot=null;readline=null;disposed=!1;abortPromptLoop=null;programmaticResolve=null;isExecuting=!1;suppressOutput=!1;tabBusy=!1;constructor(e){this.options=e;let t=e.sid??`panel-terminal-${Date.now()}`;this.client=new f({client:e.client,sid:t,onEvent:e=>this.handleEvent(e)})}async mount(n){let{Terminal:i}=await t(async()=>{let{Terminal:e}=await import(`./xterm-C3BHN0de.js`);return{Terminal:e}},[]),{FitAddon:a}=await t(async()=>{let{FitAddon:e}=await import(`./addon-fit-DIOBYJe3.js`);return{FitAddon:e}},[]),{Readline:o}=await t(async()=>{let{Readline:t}=await import(`./readline-BOCWRKSR.js`).then(t=>e(t.default,1));return{Readline:t}},__vite__mapDeps([0,1]));await t(()=>Promise.resolve({}),__vite__mapDeps([2])),this.mountRoot=n,this.terminal=new i({cursorBlink:!0,fontSize:11,fontFamily:`'Source Code Pro', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace`,theme:k(n),convertEol:!0}),this.unwatchTheme?.(),this.unwatchTheme=r(n,()=>{this.terminal&&(this.terminal.options.theme=k(this.mountRoot))}),this.fitAddon=new a,this.terminal.loadAddon(this.fitAddon),n.replaceChildren(),this.terminalHost=document.createElement(`div`),this.terminalHost.className=`terminal-panel__terminal-host`,n.appendChild(this.terminalHost),this.previewHost=document.createElement(`div`),this.previewHost.className=`terminal-panel__preview`,n.appendChild(this.previewHost),this.terminal.open(this.terminalHost),this.fitAddon.fit(),this.resizeObserver=new ResizeObserver(()=>this.refit()),this.resizeObserver.observe(this.terminalHost),this.readline=new o,this.neutralizeReadlineHistoryPersistence(),this.terminal.loadAddon(this.readline),this.readline.setCtrlCHandler(()=>this.signalInterruptDuringExec()),this.setupInput(),this.terminal.writeln(`\x1B[1mslicc\x1B[0m \x1B[90mshell (kernel)\x1B[0m`),this.terminal.writeln(`\x1B[90mType "help" for available commands.\x1B[0m
|
|
3
|
+
`),await this.client.open({cwd:this.options.cwd,env:this.options.env}),this.runPromptLoop()}refit(){this.fitAddon?.fit()}clearTerminal(){this.terminal?.clear()}async executeCommandInTerminal(e){let t=e.trim();if(!t)return{stdout:``,stderr:``,exitCode:0};if(!this.terminal||!this.readline)return this.client.exec(t);if(this.isExecuting||this.programmaticResolve||this.readline.getLine().length>0)return{stdout:``,stderr:`terminal is busy; finish current input first
|
|
4
|
+
`,exitCode:1};let n=new Promise(e=>{this.programmaticResolve=e});return this.readline.updateLine(t),this.terminal.input(`\r`),n}setPreviewStateListener(e){this.previewStateListener=e,e?.(this.hasPreview)}dispose(){this.disposed=!0,this.abortPromptLoop?.(Error(`terminal disposed`)),this.abortPromptLoop=null,this.clearMediaPreview(),this.unwatchTheme?.(),this.unwatchTheme=null,this.mountRoot=null,this.resizeObserver?.disconnect(),this.resizeObserver=null,this.terminal?.dispose(),this.terminal=null,this.readline=null,this.fitAddon=null,this.terminalHost=null,this.previewHost=null,this.client.close(),this.client.dispose()}renderMediaPreview(e){if(!this.previewHost)return;let t=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0)),n=URL.createObjectURL(new Blob([t],{type:e.mediaType}));this.previewUrls.push(n);let r=document.createElement(`div`);r.className=`terminal-panel__preview-item`;let i=document.createElement(`div`);i.className=`terminal-panel__preview-label`;let a=e.path.split(`/`).pop()??e.path;if(i.textContent=`${a} · ${e.mediaType}`,r.appendChild(i),e.mediaType.startsWith(`video/`)){let e=document.createElement(`video`);e.className=`terminal-panel__preview-media`,e.controls=!0,e.autoplay=!0,e.loop=!0,e.muted=!0,e.playsInline=!0,e.src=n,e.addEventListener(`loadedmetadata`,()=>this.refit(),{once:!0}),r.appendChild(e)}else{let e=document.createElement(`img`);e.className=`terminal-panel__preview-media`,e.alt=a,e.src=n,e.addEventListener(`load`,()=>this.refit(),{once:!0}),r.appendChild(e)}this.previewHost.appendChild(r),this.previewHost.classList.add(`terminal-panel__preview--visible`),this.hasPreview=!0,this.previewStateListener?.(!0)}clearMediaPreview(){for(let e of this.previewUrls)URL.revokeObjectURL(e);this.previewUrls=[],this.previewHost&&(this.previewHost.replaceChildren(),this.previewHost.classList.remove(`terminal-panel__preview--visible`)),this.hasPreview=!1,this.previewStateListener?.(!1)}async runPromptLoop(){for(;!this.disposed&&this.readline&&this.terminal;){let e;try{e=await this.readNextLine()}catch{break}finally{this.abortPromptLoop=null}let t=this.programmaticResolve!==null,n=await this.processLine(e,t);this.programmaticResolve&&=(this.programmaticResolve(n),null)}}readNextLine(){let e=this.terminal,t=this.readline;if(!e||!t)return Promise.reject(Error(`terminal not mounted`));let n=new Promise((e,t)=>{this.abortPromptLoop=t}),r=new Promise((n,r)=>{e.write(``,()=>{e.buffer.active.cursorX>0&&e.write(`\x1B[7m%\x1B[0m\r
|
|
5
|
+
`),t.read(A).then(n,r)})});return Promise.race([r,n])}async processLine(e,t=!1){let n=e.trim();return!n||!t&&await this.tryRunPicker(n)?{stdout:``,stderr:``,exitCode:0}:this.runRemote(n)}async tryRunPicker(e){let t=M(e);if(t)return await this.runRemoteWithLocalPicker(e,t),!0;let n=z(e);if(n)return await this.runRemoteWithUsbPicker(n),!0;let r=B(e);if(r)return await this.runRemoteWithHidPicker(r),!0;let i=H(e);if(i)return await this.runRemoteWithSerialPicker(i),!0;let a=U(e);if(a)return await this.runRemoteWithEsptoolPicker(e,a),!0;let o=R(e);return o?(await this.runRemoteWithScreenShare(o.name),!0):!1}setupInput(){this.terminal&&(this.terminal.onData(e=>{e===` `&&this.handleTab()}),this.terminal.attachCustomKeyEventHandler(e=>!(e.type===`keydown`&&e.key===`Enter`&&this.tabBusy)))}signalInterruptDuringExec(){this.isExecuting&&(this.terminal?.writeln(`^C`),this.client.signal(`SIGINT`))}neutralizeReadlineHistoryPersistence(){let e=this.readline.history;e&&(e.entries=[],e.cursor=-1,e.saveToLocalStorage=()=>void 0,e.restoreFromLocalStorage=()=>void 0)}reanchorReadline(){if(!this.terminal||!this.readline)return;let e=this.readline.state;e&&(e.getTty().anchorRow=this.terminal.buffer.active.cursorY,e.refresh())}async handleTab(){if(!(!this.terminal||!this.readline)&&!(this.isExecuting||this.tabBusy)){this.tabBusy=!0,this.isExecuting=!0;try{let{currentWord:e,isFirstWord:t,compgenCmd:n}=G(this.readline.getLine());this.suppressOutput=!0;let r=``;try{r=(await this.client.exec(n)).stdout}finally{this.suppressOutput=!1}let i=r.split(`
|
|
6
|
+
`).filter(Boolean);if(i.length===0)return;if(i.length===1){let n=i[0],r=n.slice(e.length);r&&this.terminal.input(r);let a=` `;if(!t){this.suppressOutput=!0;try{(await this.client.exec(K(n))).stdout.trim()===n&&(a=`/`)}finally{this.suppressOutput=!1}}this.terminal.input(a);return}let a=q(i).slice(e.length);if(a){this.terminal.input(a);return}this.readline.println(``),this.readline.println(i.map(e=>e.split(`/`).pop()??e).join(` `)),this.reanchorReadline()}catch(e){console.warn(`[RemoteTerminal] Tab completion failed:`,e instanceof Error?e.message:String(e))}finally{this.tabBusy=!1,this.isExecuting=!1}}}async requestPermission(e,t){let n=i();if(!n)return{ok:!1,reason:`unavailable`,message:`permission surface not mounted`};let r={current:null},a=t=>{let n=t.detail;n.kind===e&&(r.current=n)};n.addEventListener(`slicc-permission-deny`,a);try{let i=await n.request(e,t);if(i)return{ok:!0,grant:i};let a=r.current;return{ok:!1,reason:a?.reason??`error`,...a?.message?{message:a.message}:{}}}finally{n.removeEventListener(`slicc-permission-deny`,a)}}writePickerDenial(e,t,n){if(this.terminal){if(t.reason===`cancelled`){this.terminal.writeln(`${e}: cancelled`);return}if(t.reason===`unavailable`){this.terminal.writeln(`${e}: ${n}`);return}this.terminal.writeln(`${e}: ${t.message??`unknown error`}`)}}async runRemoteWithUsbPicker(e){this.isExecuting=!0;try{let t=await this.requestPermission(`usb`,{filters:e});if(!t.ok){this.writePickerDenial(`usb`,t,`WebUSB is not available in this browser`);return}let n=t.grant,r=u().register(n.device);await this.client.exec(`usb request --__resolved ${r}`)}finally{this.isExecuting=!1}}async runRemoteWithHidPicker(e){this.isExecuting=!0;try{let t=await this.requestPermission(`hid`,{filters:e});if(!t.ok){this.writePickerDenial(`hid`,t,`WebHID is not available in this browser`);return}let n=t.grant,r=o(),i=n.devices.map(e=>r.register(e)),a=V(e[0]);await this.client.exec(`hid request --__resolved ${i.join(`,`)}${a}`)}finally{this.isExecuting=!1}}async runRemoteWithSerialPicker(e){this.isExecuting=!0;try{let t=await this.requestPermission(`serial`,e.length?{filters:e}:void 0);if(!t.ok){this.writePickerDenial(`serial`,t,`Web Serial is not available in this browser`);return}let n=t.grant,r=c().register(n.port);await this.client.exec(`serial request --__resolved ${r}`)}finally{this.isExecuting=!1}}async runRemoteWithEsptoolPicker(e,t){this.isExecuting=!0;try{let n=await this.requestPermission(`serial`,t.length?{filters:t}:void 0);if(!n.ok){this.writePickerDenial(`esptool`,n,`Web Serial is not available in this browser`);return}let r=n.grant,i=c().register(r.port);await this.client.exec(`${e.trim()} --port ${i}`)}finally{this.isExecuting=!1}}async runRemoteWithScreenShare(e){this.isExecuting=!0;try{let n=await this.requestPermission(`screenshare`,{constraints:{video:!0}});if(!n.ok){this.writePickerDenial(`computer`,n,`screen capture is not available in this browser`);return}let r=n.grant,{adoptDisplayStream:i,displaySessions:a}=await t(async()=>{let{adoptDisplayStream:e,displaySessions:t}=await import(`./screencapture-media-CM5E2g6c.js`);return{adoptDisplayStream:e,displaySessions:t}},[]),o=await i(r.stream);if(!o.handle){this.terminal?.writeln(`computer: screen share produced no handle`);return}await L(e=>this.client.exec(e),e=>{a.stop(e)},o.handle,e)}finally{this.isExecuting=!1}}async runRemoteWithLocalPicker(e,t){this.isExecuting=!0;try{let n=await this.requestPermission(`filesystem`);if(!n.ok){this.writePickerDenial(`mount`,n,`File System Access API not available`);return}let r=n.grant;try{await a(N(t),r.handle)}catch(e){let t=e instanceof Error?e.message:String(e);this.terminal?.writeln(`mount: failed to stash handle: ${t}`);return}await this.client.exec(e)}finally{this.isExecuting=!1}}async runRemote(e){this.isExecuting=!0,this.clearMediaPreview();try{return await this.client.exec(e)}finally{this.isExecuting=!1}}handleEvent(e){if(this.terminal)switch(e.type){case`terminal-output`:if(this.suppressOutput)return;e.stream===`stderr`?this.terminal.write(`\x1b[31m${e.data}\x1b[0m`):this.terminal.write(e.data);return;case`terminal-exit`:return;case`terminal-cleared`:this.terminal.clear();return;case`terminal-status`:e.state===`error`&&this.terminal.writeln(`\x1b[31mterminal session error: ${e.error??`unknown`}\x1b[0m`);return;case`terminal-media-preview`:this.renderMediaPreview(e);return}}};function M(e){let t=e.trim();if(!t.startsWith(`mount`))return null;let n=t.split(/\s+/);if(n[0]!==`mount`||n.includes(`--source`)||n.includes(`--help`)||n.includes(`-h`)||n.includes(`--list`)||n.includes(`-l`)||n.includes(`--json`))return null;let r=n.slice(1).find(e=>!e.startsWith(`-`));return!r||[`list`,`unmount`,`refresh`,`recover`,`info`].includes(r)||!r.startsWith(`/`)?null:r}function N(e){return`pendingMount:term:${e}`}function P(e){let t=[],n=``,r=null,i=!1;for(let a of e.trim()){if(i){n+=a,i=!1;continue}if(r===`"`&&a===`\\`){i=!0;continue}if(r){a===r?r=null:n+=a;continue}if(a===`\\`){i=!0;continue}if(a===`"`||a===`'`){r=a;continue}if(/\s/.test(a)){n.length>0&&(t.push(n),n=``);continue}n+=a}return n.length>0&&t.push(n),t}function F(e){return e===``?`''`:/^[A-Za-z0-9_./:=@%+-]+$/.test(e)?e:e.includes(`"`)&&!e.includes(`'`)?`'${e}'`:`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function I(e,t){let n=[`computer`,`add`,`screen`,`--__resolved`,e];return t!==void 0&&n.push(`-n`,t),n.map(F).join(` `)}async function L(e,t,n,r){try{let i=await e(I(n,r));return i.exitCode!==0&&t(n),i}catch(e){throw t(n),e}}function R(e){let t=P(e);if(t[0]!==`computer`||t[1]!==`add`||t[2]!==`screen`||t.includes(`--__resolved`)||t.includes(`--help`)||t.includes(`-h`))return null;let n=t.findIndex(e=>e===`-n`||e===`--name`),r=n===-1?void 0:t[n+1];return r?{name:r}:{}}function z(e){let t=e.trim().split(/\s+/);if(t[0]!==`usb`||t[1]!==`request`||t.includes(`--__resolved`)||t.includes(`--help`)||t.includes(`-h`))return null;let{flags:n}=E(t.slice(2));return O(n)}function B(e){let t=e.trim().split(/\s+/);if(t[0]!==`hid`||t[1]!==`request`||t.includes(`--__resolved`)||t.includes(`--help`)||t.includes(`-h`))return null;let{flags:n}=S(t.slice(2));return w(n)}function V(e){if(!e)return``;let t=[];return e.usagePage!==void 0&&t.push(`--usage-page 0x${e.usagePage.toString(16)}`),e.usage!==void 0&&t.push(`--usage 0x${e.usage.toString(16)}`),t.length>0?` ${t.join(` `)}`:``}function H(e){let t=e.trim().split(/\s+/);if(t[0]!==`serial`||t[1]!==`request`||t.includes(`--__resolved`)||t.includes(`--help`)||t.includes(`-h`))return null;let{flags:n}=h(t.slice(2));return _(n)}function U(e){let t=e.trim().split(/\s+/);if(t[0]!==`esptool`||t.includes(`--port`)||t.includes(`--help`)||t.includes(`-h`))return null;let{positionals:n,flags:r}=b(t.slice(1));return n.length===0?null:_(r)}function W(e){return e.length===0?`''`:`'${e.replace(/'/g,`'\\''`)}'`}function G(e){let t=e.split(/\s+/),n=t[t.length-1]??``,r=t.length<=1||t.length===2&&t[0]===``,i=W(n);return{currentWord:n,isFirstWord:r,compgenCmd:r?`compgen -A command -- ${i}`:`compgen -f -- ${i}`}}function K(e){return`compgen -d -- ${W(e)}`}function q(e){if(e.length===0)return``;let t=e[0];for(let n of e){for(;t.length>0&&!n.startsWith(t);)t=t.slice(0,-1);if(t.length===0)break}return t}export{j as RemoteTerminalView,N as localMountIdbKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t,t as n}from"./almost-bash-shell-headless-
|
|
1
|
+
import{c as e,n as t,t as n}from"./almost-bash-shell-headless-DZz4WL2S.js";import{n as r}from"./browser-DG5MjvHF.js";import{c as i}from"./sudoers-BdBYQPUn.js";import{r as a}from"./sudo-fs-C6r_MIIY.js";import{n as o}from"./jsh-discovery-CnvNKojr.js";import{o as s}from"./just-bash-compat-B-SPHuh_.js";import{n as c,r as l}from"./supervisor-CbAt3-Rk.js";function u(t,n){return new Map(Object.entries({HOME:e,PATH:o,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:t.cwd,...n,...t.env}))}function d(e,t,n,i){let a=u(t,i);return r({fs:e,cwd:t.cwd,env:a,stdin:s(``),exec:(e,r)=>n.exec(e,{env:r?.env??Object.fromEntries(a),cwd:r?.cwd??t.cwd,args:r?.args,...r?.env===void 0?{}:{replaceEnv:!0}})})}const f={requestApproval:async()=>({decision:`deny`})};async function p(e){let r=h(e.fs,e.sudo),i=new t(r),a=new n({fs:r,cwd:`/workspace`,processManager:e.processManager,processOwner:{kind:`jshd`}}),o={exec:(e,t)=>a.getBash().exec(e,{env:t?.env??a.getEnv(),cwd:t?.cwd??`/workspace`,args:t?.args,...t?.env===void 0?{}:{replaceEnv:!0}})},s=c({fs:e.fs,processManager:e.processManager,lickManager:e.lickManager,...e.realmFactory?{realmFactory:e.realmFactory}:{},buildContext:e=>m(i,e,o)}),u=(await l(e.fs)).filter(e=>e.enabled);if(u.length===0)return[];let d=[];for(let e of u)try{await s.start(e),d.push(e.name)}catch{}return d}function m(e,t,n){return d(e,t,n)}function h(e,t){return a(e,{broker:t?.broker??f,getPolicy:t?.getPolicy??i,defaultDisposition:`allow`})}export{p as restoreEnabledJshdUnits};
|
|
@@ -42,7 +42,7 @@ Examples:
|
|
|
42
42
|
gelatiere suggest "$TMPDIR/candidates.json" && gelatiere deliver
|
|
43
43
|
gelatiere dismiss skill-github
|
|
44
44
|
gelatiere use-cases --limit 3 --json
|
|
45
|
-
`,i=[`--scoop`],a=[`--limit`],o=[...i,...a];function s(e){return{stdout:e,stderr:``,exitCode:0}}function c(e){return{stdout:``,stderr:`gelatiere: ${e}\n`,exitCode:1}}const l=`kernel host has not booted yet — try again in a moment`;function u(){let e=globalThis.__slicc_gelatiere;return e&&typeof e.roots==`function`?e:null}function d(){return import(`./gelatiere-store-
|
|
45
|
+
`,i=[`--scoop`],a=[`--limit`],o=[...i,...a];function s(e){return{stdout:e,stderr:``,exitCode:0}}function c(e){return{stdout:``,stderr:`gelatiere: ${e}\n`,exitCode:1}}const l=`kernel host has not booted yet — try again in a moment`;function u(){let e=globalThis.__slicc_gelatiere;return e&&typeof e.roots==`function`?e:null}function d(){return import(`./gelatiere-store-vZMdA_vO.js`)}async function f(t,n){let r=e(t,{bool:[`--reset`]});if(`error`in r)return c(r.error);let i=u();if(!i)return c(l);let a=await(await d()).loadGelatiereConfig(n),o=``;if(r.bools.has(`--reset`)){let e=await i.unregisterOwned();o=e.length?`Dropped ${e.length} gelatiere unit(s): ${e.join(`, `)}\n`:``}let f;try{f=await i.ensureUnit(a.allowedCommands)}catch(e){return c(e instanceof Error?e.message:String(e))}let m=await i.ensureNightly(a.nightly);return s(o+`${f.created?`Created`:`Found`} the gelatiere (${f.jid}, folder ${f.folder})\n`+p(f.allowList)+`${m.created?`Registered`:`Found`} nightly pass: cron "${m.cron}" (${m.id})\nSuggestions render in the suggestions card; \`gelatiere run\` asks for a pass now.
|
|
46
46
|
`)}function p(e){return e===`updated`?`Updated its command allow-list from GELATIERE.md
|
|
47
47
|
`:e===`deferred`?`Left its command allow-list alone: the gelatiere is mid-pass and applying it would
|
|
48
48
|
cancel the pass — run \`gelatiere init\` again once it is idle
|
|
@@ -50,5 +50,5 @@ cancel the pass — run \`gelatiere init\` again once it is idle
|
|
|
50
50
|
`),s(l)}async function g(t,n){let r=e(t,{value:i,bool:[`--force`]});if(`error`in r)return c(r.error);let a=u();if(!a)return c(l);let o=await d(),f=await o.readGelatiereSuggestions(n),p=o.openSuggestions(f),m=await o.readGelatiereState(n);if(o.suggestionsSince(f,m.lastDeliveredAt).length===0&&!r.bools.has(`--force`))return s(`Nothing new since the last delivery; no lick sent (use --force to resend).
|
|
51
51
|
`);let h=a.roots();if(h.length===0)return c(`no cone is running to deliver to`);let g=r.values.get(`--scoop`),v=g?h.find(e=>e.folder===g||e.name===g||e.jid===g):void 0;if(g&&!v)return c(`unknown delivery target "${g}" (cones: ${h.map(e=>e.folder).join(`, `)})`);let y=await _(a,h,v?[v]:h,{since:m.lastDeliveredAt,open:p,force:r.bools.has(`--force`),alias:g});g||await o.writeGelatiereState(n,{...m,lastDeliveredAt:new Date().toISOString()});let b=g?` (targeted; the delivery watermark is unchanged)`:``;return y.length===0?s(`Nothing addressed to ${g??`any running cone`}; no lick sent${b}\n`):s(`Delivered to ${y.length} cone(s): ${y.join(`, `)}${b}\n`)}async function _(e,t,n,r){let i=await d(),a=new Set(t.map(e=>e.folder)),o=t[0].folder,s=[];for(let t of n){let n=i.suggestionsForCone(r.open,t.folder,o,a),c=n.filter(e=>i.isNewSince(e,r.since,t.folder));if(c.length===0&&!(r.force&&n.length>0))continue;let l=r.alias??t.folder;e.lick(l,i.buildGelatiereLickBody(c,n)),s.push(`${l} (${c.length} new, ${n.length} open)`)}return s}async function v(t,n){let r=e(t,{bool:[`--all`,`--json`]});if(`error`in r)return c(r.error);let i=await d(),a=await i.readGelatiereSuggestions(n),o=r.bools.has(`--all`)?a:i.openSuggestions(a);if(r.bools.has(`--json`))return s(`${JSON.stringify(o,null,2)}\n`);if(o.length===0)return s(a.length===0?"No suggestions yet. `gelatiere run` asks for a pass now.\n":"No open suggestions (every one has been taken or dismissed; `--all` lists them).\n");let l=``;for(let e of o){let t=e.dismissedAt?` (dismissed)`:e.takenAt?` (taken)`:``;l+=`${e.id} [${e.kind}]${t}\n ${e.title}\n`,e.install&&(l+=` install: ${e.install}\n`),e.prompt&&(l+=` try: ${e.prompt}\n`)}return s(l)}async function y(e,t){let n=e[0];return n?await(await d()).dismissGelatiereSuggestion(t,n)?s(`Dismissed ${n}.\n`):c(`no open suggestion with id "${n}"`):c("dismiss requires a suggestion id (see `gelatiere list`)")}const b=`https://www.sliccy.com`,x=512e3,S=/^[a-z0-9][a-z0-9-]*$/;async function C(e,t){let n=await fetch(`${b}${e}`,{signal:AbortSignal.timeout(15e3)});if(!n.ok)throw Error(`${e}: HTTP ${n.status}`);let r=await n.text();return r.length>t?r.slice(0,t):r}async function w(){try{let e=await C(`/skills/catalog.json`,x);return s(e.endsWith(`
|
|
52
52
|
`)?e:`${e}\n`)}catch(e){return c(`catalog fetch failed: ${e instanceof Error?e.message:String(e)}`)}}async function T(){try{let e=[...(await C(`/sitemap.xml`,x)).matchAll(/<loc>[^<]*\/man\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]).sort();return e.length===0?c(`no man pages found in the sitemap`):s(`${[...new Set(e)].join(` `)}\n`)}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}}async function E(e){let t=e[0];if(!t)return c(`man requires a command name: gelatiere man <command>`);if(!S.test(t))return c(`not a command name: "${t}"`);try{let e=await C(`/man/${t}.plain.html`,16e3);return s(e.endsWith(`
|
|
53
|
-
`)?e:`${e}\n`)}catch(e){return c(`man fetch failed: ${e instanceof Error?e.message:String(e)}`)}}function D(e,t,n){let r=e=>{let t=n.match(RegExp(`<meta[^>]+name=["']${e}["'][^>]+content=(["'])((?:(?!\\1).)*)\\1`,`i`));return t?k(t[2]).trim():``},i=n.match(/<title[^>]*>([^<]*)<\/title>/i);return{slug:e,url:t,title:i?k(i[1]).trim():A(e),description:r(`description`),skills:r(`slicc-upskill`).split(`,`).map(e=>e.trim()).filter(Boolean)}}const O={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,"#x27":`'`};function k(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g,(e,t)=>{let n=O[t.toLowerCase()];if(n)return n;let r=t.match(/^#(x?)([0-9a-fA-F]+)$/i);if(!r)return e;let i=Number.parseInt(r[2],r[1]?16:10);return Number.isFinite(i)?String.fromCodePoint(i):e})}function A(e){let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function j(e,t){return e<=0?0:Math.floor(t/864e5)%e}function M(e,t,n){if(t>=e.length)return[...e];let r=j(e.length,n);return Array.from({length:t},(t,n)=>e[(r+n)%e.length])}async function N(e,t){let n=Array(e.length),r=0,i=async()=>{for(;r<e.length;){let i=r++;n[i]=await t(e[i])}};return await Promise.all(Array.from({length:Math.min(4,e.length)},()=>i())),n}async function P(t){let n=e(t,{value:a,bool:[`--json`]});if(`error`in n)return c(n.error);let r=n.values.get(`--limit`),i=r===void 0?12:Number(r);if(!Number.isInteger(i)||i<=0)return c(`--limit must be a positive whole number, not "${r}"`);let o;try{let e=await C(`/sitemap.xml`,x);o=[...new Set([...e.matchAll(/<loc>[^<]*\/use-cases\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]))].sort()}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}if(o.length===0)return c(`no use cases found in the sitemap`);let l=await N(M(o,Math.min(i,12),Date.now()),async e=>{let t=`${b}/use-cases/${e}`;try{return D(e,t,await C(`/use-cases/${e}`,24e3))}catch{return{slug:e,url:t,title:A(e),description:``,skills:[]}}});if(n.bools.has(`--json`))return s(`${JSON.stringify(l,null,2)}\n`);let u=``;for(let e of l)u+=`${e.slug}\t${e.title}\n ${e.url}\n`,e.description&&(u+=` ${e.description}\n`),e.skills.length&&(u+=` skills: ${e.skills.join(` `)}\n`);return s(u)}async function F(e){let t=await d(),n=u(),r=n?.unit(),i=await t.loadGelatiereConfig(e),a=await t.readGelatiereState(e),o=await t.readGelatiereSuggestions(e),c=``,{isMemoryV2Enabled:l}=await import(`./memory-v2-flag-
|
|
53
|
+
`)?e:`${e}\n`)}catch(e){return c(`man fetch failed: ${e instanceof Error?e.message:String(e)}`)}}function D(e,t,n){let r=e=>{let t=n.match(RegExp(`<meta[^>]+name=["']${e}["'][^>]+content=(["'])((?:(?!\\1).)*)\\1`,`i`));return t?k(t[2]).trim():``},i=n.match(/<title[^>]*>([^<]*)<\/title>/i);return{slug:e,url:t,title:i?k(i[1]).trim():A(e),description:r(`description`),skills:r(`slicc-upskill`).split(`,`).map(e=>e.trim()).filter(Boolean)}}const O={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,"#x27":`'`};function k(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-z]+);/g,(e,t)=>{let n=O[t.toLowerCase()];if(n)return n;let r=t.match(/^#(x?)([0-9a-fA-F]+)$/i);if(!r)return e;let i=Number.parseInt(r[2],r[1]?16:10);return Number.isFinite(i)?String.fromCodePoint(i):e})}function A(e){let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function j(e,t){return e<=0?0:Math.floor(t/864e5)%e}function M(e,t,n){if(t>=e.length)return[...e];let r=j(e.length,n);return Array.from({length:t},(t,n)=>e[(r+n)%e.length])}async function N(e,t){let n=Array(e.length),r=0,i=async()=>{for(;r<e.length;){let i=r++;n[i]=await t(e[i])}};return await Promise.all(Array.from({length:Math.min(4,e.length)},()=>i())),n}async function P(t){let n=e(t,{value:a,bool:[`--json`]});if(`error`in n)return c(n.error);let r=n.values.get(`--limit`),i=r===void 0?12:Number(r);if(!Number.isInteger(i)||i<=0)return c(`--limit must be a positive whole number, not "${r}"`);let o;try{let e=await C(`/sitemap.xml`,x);o=[...new Set([...e.matchAll(/<loc>[^<]*\/use-cases\/([a-z0-9-]+)(?:\.html)?<\/loc>/g)].map(e=>e[1]))].sort()}catch(e){return c(`sitemap fetch failed: ${e instanceof Error?e.message:String(e)}`)}if(o.length===0)return c(`no use cases found in the sitemap`);let l=await N(M(o,Math.min(i,12),Date.now()),async e=>{let t=`${b}/use-cases/${e}`;try{return D(e,t,await C(`/use-cases/${e}`,24e3))}catch{return{slug:e,url:t,title:A(e),description:``,skills:[]}}});if(n.bools.has(`--json`))return s(`${JSON.stringify(l,null,2)}\n`);let u=``;for(let e of l)u+=`${e.slug}\t${e.title}\n ${e.url}\n`,e.description&&(u+=` ${e.description}\n`),e.skills.length&&(u+=` skills: ${e.skills.join(` `)}\n`);return s(u)}async function F(e){let t=await d(),n=u(),r=n?.unit(),i=await t.loadGelatiereConfig(e),a=await t.readGelatiereState(e),o=await t.readGelatiereSuggestions(e),c=``,{isMemoryV2Enabled:l}=await import(`./memory-v2-flag-DjjJhF1z.js`);l()||(c+=`Memory v2: OFF — the nightly is unscheduled and session ends do not trigger passes
|
|
54
54
|
`),c+=`Unit: ${r?`${r.jid} (folder ${r.folder})`:"not created — run `gelatiere init`"}\n`;let f=n?.nightly();return c+=`Nightly: ${f?`registered, cron "${f.cron}" (${f.id})`:`not registered — run \`gelatiere init\` (cron "${i.nightly}")`}\n`,c+=`Interval: ${i.intervalHours}h between session-end passes\n`,c+=I(i.allowedCommands,n?.unitAllowedCommands(),t),c+=`Passes: ${a.passes}\n`,c+=`Last pass: ${a.lastPassAt??`never`}\n`,c+=`Last trigger: ${a.lastTriggeredAt??`never`}\n`,c+=`Last delivery: ${a.lastDeliveredAt??`never`}\n`,c+=`Suggestions: ${t.openSuggestions(o).length} open, ${t.takenSuggestions(o).length} taken, ${o.length} total\n`,s(c)}function I(e,t,n){let r=e=>{let t=e.filter(e=>!n.GELATIERE_BASE_ALLOWED_COMMANDS.includes(e));return t.length?` (+${t.join(`, `)} from GELATIERE.md)`:``};return t?t.length===e.length&&t.every((t,n)=>t===e[n])?`Commands: ${t.length} allowed without approval${r(t)}\n`:`Commands: ${t.length} in force${r(t)}; GELATIERE.md asks for ${e.length}${r(e)} — run \`gelatiere init\`\n`:`Commands: ${e.length} configured${r(e)}, pending — run \`gelatiere init\`\n`}async function L(e,n,i){let a=e[0];if(!a||t(e,{valueFlags:o}))return s(r);let l=e.slice(1);switch(a){case`init`:return f(l,i.fs);case`run`:return m(n.env);case`suggest`:return h(l,i.fs);case`deliver`:return g(l,i.fs);case`list`:return v(l,i.fs);case`dismiss`:return y(l,i.fs);case`status`:return F(i.fs);case`catalog`:return w();case`commands`:return T();case`man`:return E(l);case`use-cases`:return P(l);default:return c(`unknown command: ${a}\n${r}`)}}export{L as runGelatiere};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./slicc-version-
|
|
1
|
+
import{n as e}from"./slicc-version-D4sOoWeK.js";import{a as t}from"./just-bash-compat-B-SPHuh_.js";const n=`/dev/null`;function r(e){return e.oldName===n}function i(e){return e.newName===n}function a(e){let t=e.indexOf(` `);return(t===-1?e.replace(/\s+\d{4}-\d\d-\d\d[ T].*$/,``):e.slice(0,t)).trimEnd()}const o=/^@@+ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function s(e){let t=o.exec(e);return t?{oldStart:Number(t[1]),oldCount:t[2]===void 0?1:Number(t[2]),newStart:Number(t[3]),newCount:t[4]===void 0?1:Number(t[4])}:null}function c(e,t){return{...e,oldLines:[],newLines:[],oldSeen:0,newSeen:0,changeSeen:!1,leadingContext:0,trailingContext:0,lastSide:null,oldNoNewlineAtEof:!1,newNoNewlineAtEof:!1,raw:[t]}}function l(e){return{oldStart:e.oldStart,newStart:e.newStart,oldLines:e.oldLines,newLines:e.newLines,leadingContext:e.leadingContext,trailingContext:e.trailingContext,oldNoNewlineAtEof:e.oldNoNewlineAtEof,newNoNewlineAtEof:e.newNoNewlineAtEof,raw:e.raw}}function u(e){return e.oldSeen>=e.oldCount&&e.newSeen>=e.newCount}function d(e,t){e.oldLines.push(t),e.newLines.push(t),e.oldSeen++,e.newSeen++,e.lastSide=`both`,e.changeSeen?e.trailingContext++:e.leadingContext++}function f(e,t,n){t===`old`?(e.oldLines.push(n),e.oldSeen++):(e.newLines.push(n),e.newSeen++),e.lastSide=t,e.changeSeen=!0,e.trailingContext=0}function p(e,t){if(t.startsWith(`\\`))return(e.lastSide===`old`||e.lastSide===`both`)&&(e.oldNoNewlineAtEof=!0),(e.lastSide===`new`||e.lastSide===`both`)&&(e.newNoNewlineAtEof=!0),e.raw.push(t),!0;if(t===``)return d(e,``),e.raw.push(` `),!0;let n=t.slice(1);switch(t[0]){case` `:d(e,n);break;case`-`:f(e,`old`,n);break;case`+`:f(e,`new`,n);break;default:return!1}return e.raw.push(t),!0}function m(e){e.hunk&&e.current&&e.current.hunks.push(l(e.hunk)),e.hunk=null,e.complete=!1}function h(e,t){let n=e.hunk;if(!n)return!1;if(e.complete){let r=t.startsWith(`\\`);return r&&p(n,t),m(e),r}return p(n,t)?(u(n)&&(e.complete=!0),!0):(m(e),!1)}function g(e){let t={files:[],current:null,hunk:null,complete:!1,pendingOld:null};for(let n of e.split(`
|
|
2
2
|
`)){if(h(t,n))continue;if(n.startsWith(`--- `)){t.pendingOld=a(n.slice(4));continue}if(n.startsWith(`+++ `)&&t.pendingOld!==null){t.current={oldName:t.pendingOld,newName:a(n.slice(4)),hunks:[]},t.files.push(t.current),t.pendingOld=null;continue}t.pendingOld=null;let e=s(n);e&&t.current&&(t.hunk=c(e,n))}return m(t),t.files.filter(e=>e.hunks.length>0)}function _(e){return{oldName:e.newName,newName:e.oldName,hunks:e.hunks.map(e=>({oldStart:e.newStart,newStart:e.oldStart,oldLines:e.newLines,newLines:e.oldLines,leadingContext:e.leadingContext,trailingContext:e.trailingContext,oldNoNewlineAtEof:e.newNoNewlineAtEof,newNoNewlineAtEof:e.oldNoNewlineAtEof,raw:v(e)}))}}function v(e){return e.raw.map((t,n)=>n===0?`@@ -${e.newStart},${e.newLines.length} +${e.oldStart},${e.oldLines.length} @@`:t.startsWith(`-`)?`+${t.slice(1)}`:t.startsWith(`+`)?`-${t.slice(1)}`:t)}function y(e){if(e===``)return{lines:[],newlineAtEof:!0};let t=e.endsWith(`
|
|
3
3
|
`),n=e.split(`
|
|
4
4
|
`);return t&&n.pop(),{lines:n,newlineAtEof:t}}function b(e){return e.lines.length===0?``:e.lines.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./subcommand-flags-BZi7j78Q.js";import{r as t,t as n}from"./subcommand-help-CgO7wRS5.js";import{i as r,o as i}from"./jsh-discovery-CnvNKojr.js";import{a,i as o,r as s,s as c,t as l}from"./supervisor-
|
|
1
|
+
import{t as e}from"./subcommand-flags-BZi7j78Q.js";import{r as t,t as n}from"./subcommand-help-CgO7wRS5.js";import{i as r,o as i}from"./jsh-discovery-CnvNKojr.js";import{a,i as o,r as s,s as c,t as l}from"./supervisor-CbAt3-Rk.js";const u=`usage: jshd <command> [options]
|
|
2
2
|
|
|
3
3
|
Durable background jsh units: one realm worker each, restored on reload
|
|
4
4
|
when --enable is set. Keep-alive follows the realm (pending timers and
|
|
@@ -34,7 +34,7 @@ Notes:
|
|
|
34
34
|
`)+`
|
|
35
35
|
`)}async function A(e,t,n,r){let i=t[0];if(!i)return Y(`missing unit name`);let o=L(n);if(o)return o;let s=P(n,r);if(!s)return Y(`kernel host has not booted yet — try again in a moment`);if(e===`stop`)return await s.stop(i)?J(`jshd: stopped '${i}'\n`):await a(n.fs,i)?J(`jshd: unit '${i}' is not running\n`):Y(`unknown unit '${i}'`);if(e===`restart`){let e=await s.restart(i);return e?J(`jshd: restarted '${i}' (pid ${e.pid})\n`):Y(`unknown unit '${i}'`)}return!await a(n.fs,i)&&!s.status(i)?Y(`unknown unit '${i}'`):(await s.rm(i),J(`jshd: removed '${i}'\n`))}async function j(t,n,r){let i=e(t,{value:T,bool:[`-f`,`--follow`]});if(`error`in i)return Y(i.error);let a=i.positionals[0];if(!a)return Y(`missing unit name`);let s=i.bools.has(`-f`)||i.bools.has(`--follow`),c=i.values.get(`-n`)??i.values.get(`--lines`),l=c===void 0?void 0:Number.parseInt(c,10);if(c!==void 0&&(!Number.isFinite(l)||l<0))return Y(`-n must be a non-negative integer`);let u=await o(n.fs,a),d=l===void 0?u:H(u,l);if(!s)return J(d.endsWith(`
|
|
36
36
|
`)||d.length===0?d:`${d}\n`);let f=W(n),p=G(n);return f?U({ctx:n,name:a,displayed:d,seen:u.length,signal:f,sink:p}):(p?.(d),J(p?``:d.endsWith(`
|
|
37
|
-
`)||d.length===0?d:`${d}\n`))}async function M(e,t,n,r){let i=e[0];if(!i)return Y(`missing unit name`);let a=L(t);if(a)return a;let o=P(t,n);return(o?await o.setEnabled(i,r):await N(t,i,r))?J(`jshd: ${r?`enabled`:`disabled`} '${i}'\n`):Y(`unknown unit '${i}'`)}async function N(e,t,n){let r=await a(e.fs,t);if(!r)return null;let i={...r,enabled:n},{writeUnitRecord:o}=await import(`./supervisor-
|
|
37
|
+
`)||d.length===0?d:`${d}\n`))}async function M(e,t,n,r){let i=e[0];if(!i)return Y(`missing unit name`);let a=L(t);if(a)return a;let o=P(t,n);return(o?await o.setEnabled(i,r):await N(t,i,r))?J(`jshd: ${r?`enabled`:`disabled`} '${i}'\n`):Y(`unknown unit '${i}'`)}async function N(e,t,n){let r=await a(e.fs,t);if(!r)return null;let i={...r,enabled:n},{writeUnitRecord:o}=await import(`./supervisor-CbAt3-Rk.js`).then(e=>e.o);return await o(e.fs,i),i}function P(e,t){let n=l();if(n)return n;let r=t.processManager??K();if(!r)return null;let i=q();return l({fs:e.fs,processManager:r,...i?{lickManager:i}:{},...t.realmFactory?{realmFactory:t.realmFactory}:{},buildContext:t=>F(e,t)})}function F(e,t){let n=new Map(e.env);for(let[e,r]of Object.entries(t.env))n.set(e,r);return{...e,cwd:t.cwd,env:n}}function I(e){if(typeof e!=`object`||!e)return!1;let t=e.canWrite;return typeof t==`function`&&!t.call(e,`/workspace/.jshd`)}function L(e){return I(e.fs)?Y(`not available inside a restricted scoop`):null}function R(e,t,n){let r=new Map(t.map(e=>[e.name,e]));return[...new Set([...e.map(e=>e.name),...r.keys()])].sort().map(t=>r.get(t)||z(e.find(e=>e.name===t),n))}function z(e,t){return{name:e.name,pid:null,state:`stopped`,restarts:0,uptimeMs:null,enabled:e.enabled,restart:e.restart,argv:e.argv,cwd:e.cwd,durable:t,lastExitCode:null}}function B(e){let t=e.pid===null?`-`:String(e.pid),n=V(e.uptimeMs);return[e.name.padEnd(15),t.padEnd(7),e.state.padEnd(9),String(e.restarts).padEnd(9),n.padEnd(6),String(e.enabled).padEnd(8),String(e.durable)].join(` `)}function V(e){if(e===null)return`-`;let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`}function H(e,t){if(t===0)return``;let n=e.split(`
|
|
38
38
|
`);return n[n.length-1]===``&&n.pop(),`${n.slice(-t).join(`
|
|
39
39
|
`)}${e.endsWith(`
|
|
40
40
|
`)?`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./base64-BPBW1Gzr.js";import{m as t}from"./state-Cr6DXj7q.js";import{t as n}from"./realm-browser-fetch-V3uggGbM.js";const r=new TextEncoder;function i(e){return typeof e==`object`&&!!e&&`exitCode`in e}async function a(e,t){try{return await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}catch{return{message:`curlwright: cannot read ${t}`,exitCode:26}}}function o(e){let t=new Uint8Array(e.length),n=0;for(let r of e)r!==10&&r!==13&&(t[n++]=r);return t.subarray(0,n)}async function s(e,t){let n=t.indexOf(`=`),o=t.indexOf(`@`),s=o!==-1&&(n===-1||o<n),c=s?o:n,l=c===-1?``:t.slice(0,c),u=c===-1?t:t.slice(c+1),d=u;if(s){let t=await a(e,u);if(i(t))return t;d=new TextDecoder().decode(t)}let f=encodeURIComponent(d);return r.encode(l===``?f:`${l}=${f}`)}async function c(e,t){if(t.kind===`urlencode`)return s(e,t.value);if(t.kind===`raw`||!t.value.startsWith(`@`))return r.encode(t.value);let n=await a(e,t.value.slice(1));return i(n)||t.kind===`binary`?n:o(n)}function l(e){let t=Math.max(0,e.length-1),n=e.reduce((e,t)=>e+t.length,0)+t,r=new Uint8Array(n),i=0;return e.forEach((e,t)=>{t>0&&(r[i++]=38),r.set(e,i),i+=e.length}),r}function u(e){let t=e.split(`;`);return{value:t[0],options:t.slice(1)}}function d(e,t){for(let n of e){let e=n.trim();if(e.startsWith(`${t}=`))return e.slice(t.length+1)}return null}function f(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}async function p(e,t,n){let r=n.value.indexOf(`=`);if(r===-1)return{message:`curlwright: -F requires name=content (got "${n.value}")`,exitCode:2};let o=n.value.slice(0,r),s=n.value.slice(r+1);if(n.literal||s[0]!==`@`&&s[0]!==`<`)return t.append(o,s),null;let{value:c,options:l}=u(s.slice(1)),p=await a(e,c);if(i(p))return p;if(s[0]===`<`)return t.append(o,new TextDecoder().decode(p)),null;let m=d(l,`type`)??`application/octet-stream`,h=d(l,`filename`)??f(c);return t.append(o,new Blob([p],{type:m}),h),null}async function m(e,t,n){if(t.length>0&&n.length>0)return{message:`curlwright: -F cannot be combined with -d`,exitCode:2};if(n.length>0){let t=new FormData;for(let r of n){let n=await p(e,t,r);if(n)return n}return{bytes:null,form:t,contentType:null,accept:null}}if(t.length===0)return{bytes:null,form:null,contentType:null,accept:null};let r=[];for(let n of t){let t=await c(e,n);if(i(t))return t;r.push(t)}let a=t.some(e=>e.kind===`json`);return{bytes:l(r),form:null,contentType:a?`application/json`:`application/x-www-form-urlencoded`,accept:a?`application/json`:null}}const h=new Set([`request`,`header`,`data`,`data-raw`,`data-binary`,`data-ascii`,`data-urlencode`,`json`,`form`,`form-string`,`output`,`dump-header`,`write-out`,`max-time`,`user`,`referer`,`range`,`url`,`tab`,`frame`]),g=new Set([`silent`,`show-error`,`include`,`head`,`verbose`,`fail`,`location`,`remote-name`,`get`,`no-credentials`,`help`]),_={X:`request`,H:`header`,d:`data`,F:`form`,o:`output`,D:`dump-header`,w:`write-out`,m:`max-time`,u:`user`,e:`referer`,r:`range`},v={s:`silent`,S:`show-error`,i:`include`,I:`head`,v:`verbose`,f:`fail`,L:`location`,O:`remote-name`,G:`get`,h:`help`},y={cert:`client certificates are the browser profile's to present, not the shell's`,"cert-type":`client certificates are the browser profile's to present, not the shell's`,key:`client certificates are the browser profile's to present, not the shell's`,cacert:`the browser decides which roots to trust`,capath:`the browser decides which roots to trust`,insecure:`the browser enforces TLS verification; a page cannot opt out`,proxy:`proxying is configured on the browser, not per request`,"proxy-user":`proxying is configured on the browser, not per request`,interface:`a page cannot choose an outgoing interface`,"unix-socket":`a page cannot dial a unix socket`,resolve:`a page cannot override DNS resolution`,compressed:`always on — the browser negotiates encoding itself`,cookie:"the tab's own cookies are already sent; set one with `playwright-cli cookie-set`","cookie-jar":"cookies live in the browser profile; read them with `playwright-cli cookies`","limit-rate":`a page cannot throttle a fetch`,"continue-at":"a page fetch cannot resume; use `-H 'Range: bytes=N-'`","connect-timeout":"a page fetch cannot time the connect phase alone; use `--max-time`","http1.1":`the browser negotiates the HTTP version`,http2:`the browser negotiates the HTTP version`,http3:`the browser negotiates the HTTP version`,"no-buffer":`responses are read whole, never streamed to stdout`,"trace-ascii":"no wire trace exists; use `playwright-cli network-requests`",trace:"no wire trace exists; use `playwright-cli network-requests`","user-agent":`User-Agent is a forbidden header name for fetch(); the tab sets it`},b={k:`insecure`,x:`proxy`,b:`cookie`,c:`cookie-jar`,E:`cert`,C:`continue-at`,N:`no-buffer`,A:`user-agent`};function ee(){return{url:null,requestMethod:null,headers:[],data:[],form:[],get:!1,output:null,remoteName:!1,include:!1,head:!1,dumpHeader:null,writeOut:null,silent:!1,showError:!1,verbose:!1,failOnError:!1,maxTimeSeconds:null,credentials:`include`,tab:null,frame:null,user:null,referer:null,range:null,help:!1}}function x(e,t){return{message:`curlwright: option ${e} is not supported in a page context — ${y[t]}`,exitCode:2}}function S(e){return{message:`curlwright: unknown option ${e}\nRun 'curlwright --help' for the supported flags.`,exitCode:2}}function C(e){let t=e.indexOf(`:`);if(t===-1)return e.endsWith(`;`)?{name:e.slice(0,-1).trim(),value:``,unset:!1}:{name:e.trim(),value:``,unset:!1};let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();return{name:n,value:r,unset:r===``}}function w(e,t,n,r){switch(t){case`request`:return e.requestMethod=n,null;case`header`:return e.headers.push(C(n??``)),null;case`data`:case`data-ascii`:return e.data.push({kind:`ascii`,value:n??``}),null;case`data-raw`:return e.data.push({kind:`raw`,value:n??``}),null;case`data-binary`:return e.data.push({kind:`binary`,value:n??``}),null;case`data-urlencode`:return e.data.push({kind:`urlencode`,value:n??``}),null;case`json`:return e.data.push({kind:`json`,value:n??``}),null;case`form`:return e.form.push({value:n??``,literal:!1}),null;case`form-string`:return e.form.push({value:n??``,literal:!0}),null;case`output`:return e.output=n,null;case`dump-header`:return e.dumpHeader=n,null;case`write-out`:return e.writeOut=n,null;case`max-time`:return T(e,n,r);case`user`:return e.user=n,null;case`referer`:return e.referer=n,null;case`range`:return e.range=n,null;case`url`:return e.url=n,null;case`tab`:return e.tab=n,null;case`frame`:return e.frame=n,null;default:return E(e,t,r)}}function T(e,t,n){let r=Number(t);return!Number.isFinite(r)||r<=0?{message:`curlwright: ${n} expects a positive number of seconds`,exitCode:2}:(e.maxTimeSeconds=r,null)}function E(e,t,n){switch(t){case`silent`:return e.silent=!0,null;case`show-error`:return e.showError=!0,null;case`include`:return e.include=!0,null;case`head`:return e.head=!0,null;case`verbose`:return e.verbose=!0,null;case`fail`:return e.failOnError=!0,null;case`location`:return null;case`remote-name`:return e.remoteName=!0,null;case`get`:return e.get=!0,null;case`no-credentials`:return e.credentials=`omit`,null;case`help`:return e.help=!0,null;default:return S(n)}}function te(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i===-1?r.slice(2):r.slice(2,i)).trim(),o=i===-1?null:r.slice(i+1);if(a in y)return x(`--${a}`,a);if(h.has(a)){let r=o??t[n+1];return r===void 0?{message:`curlwright: option --${a} requires a value`,exitCode:2}:w(e,a,r,`--${a}`)??{next:o===null?n+2:n+1}}return g.has(a)?w(e,a,null,`--${a}`)??{next:n+1}:S(`--${a}`)}function ne(e,t,n){let r=t[n];for(let i=1;i<r.length;i++){let a=r[i];if(a in b)return x(`-${a}`,b[a]);if(a in _){let o=r.slice(i+1),s=o===``?t[n+1]:o;return s===void 0?{message:`curlwright: option -${a} requires a value`,exitCode:2}:w(e,_[a],s,`-${a}`)??{next:o===``?n+2:n+1}}if(!(a in v))return S(`-${a}`);let o=w(e,v[a],null,`-${a}`);if(o)return o}return{next:n+1}}function re(e,t){return e.url!==null&&e.url!==t?{message:`curlwright: only one URL is supported (got "${e.url}" and "${t}")`,exitCode:2}:(e.url=t,null)}function ie(e){let t=ee(),n=0,r=!1;for(;n<e.length;){let i=e[n];if(!r&&i===`--`){r=!0,n++;continue}if(!r&&i.startsWith(`--`)){let r=te(t,e,n);if(`message`in r)return r;n=r.next;continue}if(!r&&i.startsWith(`-`)&&i.length>1){let r=ne(t,e,n);if(`message`in r)return r;n=r.next;continue}let a=re(t,i);if(a)return a;n++}return t}function ae(e){return`message`in e}const D={"accept-charset":`the browser sets it`,"accept-encoding":`the browser negotiates encoding`,connection:`the browser owns the connection`,"content-length":`derived from the body`,cookie:"the tab's cookies are sent already; set one with `playwright-cli cookie-set`",cookie2:`the tab's cookies are sent already`,date:`the browser sets it`,dnt:`the browser sets it`,expect:`a page fetch cannot send it`,host:`derived from the URL`,"keep-alive":`the browser owns the connection`,origin:`the tab's own origin is sent automatically`,referer:`use -e/--referer, which sets the fetch referrer`,te:`the browser owns transfer encoding`,trailer:`the browser owns transfer encoding`,"transfer-encoding":`the browser owns transfer encoding`,upgrade:`the browser owns the connection`,via:`the browser sets it`};function oe(e){let t=e.toLowerCase();return t in D?D[t]:t.startsWith(`proxy-`)?`proxying is configured on the browser`:t.startsWith(`sec-`)?`Sec- headers are reserved for the browser`:null}function se(e){for(let t of e){let e=oe(t.name);if(e)return{message:`curlwright: header "${t.name}" cannot be set from a page — ${e}`,exitCode:2}}return null}function O(e,t){let n=t.toLowerCase();return Object.keys(e).some(e=>e.toLowerCase()===n)}function k(e){let t={},n=new Set;for(let r of e.headers)if(r.name!==``){if(r.unset){n.add(r.name.toLowerCase());continue}t[r.name]=r.value}return{headers:t,suppressed:n}}function A(e,t,n){return!O(e,n)&&!t.has(n)}function j(e){return/^[a-zA-Z]+=/.test(e)?e:`bytes=${e}`}function M(e,t,n,r){n.user!==null&&A(e,t,`authorization`)&&(e.Authorization=`Basic ${btoa(n.user)}`),n.range!==null&&A(e,t,`range`)&&(e.Range=j(n.range)),r.contentType&&A(e,t,`content-type`)&&(e[`Content-Type`]=r.contentType),r.accept&&A(e,t,`accept`)&&(e.Accept=r.accept)}function N(e,t){if(t===``)return e;let[n,r]=P(e);return`${n}${n.includes(`?`)?`&`:`?`}${t}${r}`}function P(e){let t=e.indexOf(`#`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function F(e,t){return e.requestMethod?e.requestMethod:e.head?`HEAD`:t?`POST`:`GET`}function I(e,t,n){let r=e.toUpperCase();return!t||r!==`GET`&&r!==`HEAD`?null:{message:`curlwright: ${n.requestMethod?`-X ${n.requestMethod}`:`-I`} cannot carry a request body — a page fetch rejects a ${r} with one. Drop the data, or use -G to send it as a query string.`,exitCode:2}}function L(e,t){if(e.url===null)return{message:`curlwright: no URL specified`,exitCode:2};let{headers:n,suppressed:r}=k(e),i=e.get&&t.bytes!==null,a=i?{...t,bytes:null,contentType:null}:t;M(n,r,e,a);let o=i?N(e.url,new TextDecoder().decode(t.bytes??new Uint8Array)):e.url,s=a.bytes!==null||a.form!==null,c=F(e,s),l=I(c,s,e);if(l)return l;let u={method:c,headers:n,credentials:e.credentials,responseType:`binary`};return a.form?u.body=a.form:a.bytes&&(u.body=a.bytes),e.referer!==null&&(u.referrer=e.referer),e.maxTimeSeconds!==null&&(u.timeoutMs=e.maxTimeSeconds*1e3),{url:o,method:c,fetchOptions:u,uploadSize:a.bytes?.length??0}}function R(e){let t=e.fetchOptions.headers??{},n=[`> ${e.method} ${e.url}`];for(let[e,r]of Object.entries(t))n.push(`> ${e}: ${r}`);return n.push(`> `),`${n.join(`
|
|
1
|
+
import{t as e}from"./base64-BPBW1Gzr.js";import{m as t}from"./state-Bw2C2vRx.js";import{t as n}from"./realm-browser-fetch-V3uggGbM.js";const r=new TextEncoder;function i(e){return typeof e==`object`&&!!e&&`exitCode`in e}async function a(e,t){try{return await e.fs.readFileBuffer(e.fs.resolvePath(e.cwd,t))}catch{return{message:`curlwright: cannot read ${t}`,exitCode:26}}}function o(e){let t=new Uint8Array(e.length),n=0;for(let r of e)r!==10&&r!==13&&(t[n++]=r);return t.subarray(0,n)}async function s(e,t){let n=t.indexOf(`=`),o=t.indexOf(`@`),s=o!==-1&&(n===-1||o<n),c=s?o:n,l=c===-1?``:t.slice(0,c),u=c===-1?t:t.slice(c+1),d=u;if(s){let t=await a(e,u);if(i(t))return t;d=new TextDecoder().decode(t)}let f=encodeURIComponent(d);return r.encode(l===``?f:`${l}=${f}`)}async function c(e,t){if(t.kind===`urlencode`)return s(e,t.value);if(t.kind===`raw`||!t.value.startsWith(`@`))return r.encode(t.value);let n=await a(e,t.value.slice(1));return i(n)||t.kind===`binary`?n:o(n)}function l(e){let t=Math.max(0,e.length-1),n=e.reduce((e,t)=>e+t.length,0)+t,r=new Uint8Array(n),i=0;return e.forEach((e,t)=>{t>0&&(r[i++]=38),r.set(e,i),i+=e.length}),r}function u(e){let t=e.split(`;`);return{value:t[0],options:t.slice(1)}}function d(e,t){for(let n of e){let e=n.trim();if(e.startsWith(`${t}=`))return e.slice(t.length+1)}return null}function f(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}async function p(e,t,n){let r=n.value.indexOf(`=`);if(r===-1)return{message:`curlwright: -F requires name=content (got "${n.value}")`,exitCode:2};let o=n.value.slice(0,r),s=n.value.slice(r+1);if(n.literal||s[0]!==`@`&&s[0]!==`<`)return t.append(o,s),null;let{value:c,options:l}=u(s.slice(1)),p=await a(e,c);if(i(p))return p;if(s[0]===`<`)return t.append(o,new TextDecoder().decode(p)),null;let m=d(l,`type`)??`application/octet-stream`,h=d(l,`filename`)??f(c);return t.append(o,new Blob([p],{type:m}),h),null}async function m(e,t,n){if(t.length>0&&n.length>0)return{message:`curlwright: -F cannot be combined with -d`,exitCode:2};if(n.length>0){let t=new FormData;for(let r of n){let n=await p(e,t,r);if(n)return n}return{bytes:null,form:t,contentType:null,accept:null}}if(t.length===0)return{bytes:null,form:null,contentType:null,accept:null};let r=[];for(let n of t){let t=await c(e,n);if(i(t))return t;r.push(t)}let a=t.some(e=>e.kind===`json`);return{bytes:l(r),form:null,contentType:a?`application/json`:`application/x-www-form-urlencoded`,accept:a?`application/json`:null}}const h=new Set([`request`,`header`,`data`,`data-raw`,`data-binary`,`data-ascii`,`data-urlencode`,`json`,`form`,`form-string`,`output`,`dump-header`,`write-out`,`max-time`,`user`,`referer`,`range`,`url`,`tab`,`frame`]),g=new Set([`silent`,`show-error`,`include`,`head`,`verbose`,`fail`,`location`,`remote-name`,`get`,`no-credentials`,`help`]),_={X:`request`,H:`header`,d:`data`,F:`form`,o:`output`,D:`dump-header`,w:`write-out`,m:`max-time`,u:`user`,e:`referer`,r:`range`},v={s:`silent`,S:`show-error`,i:`include`,I:`head`,v:`verbose`,f:`fail`,L:`location`,O:`remote-name`,G:`get`,h:`help`},y={cert:`client certificates are the browser profile's to present, not the shell's`,"cert-type":`client certificates are the browser profile's to present, not the shell's`,key:`client certificates are the browser profile's to present, not the shell's`,cacert:`the browser decides which roots to trust`,capath:`the browser decides which roots to trust`,insecure:`the browser enforces TLS verification; a page cannot opt out`,proxy:`proxying is configured on the browser, not per request`,"proxy-user":`proxying is configured on the browser, not per request`,interface:`a page cannot choose an outgoing interface`,"unix-socket":`a page cannot dial a unix socket`,resolve:`a page cannot override DNS resolution`,compressed:`always on — the browser negotiates encoding itself`,cookie:"the tab's own cookies are already sent; set one with `playwright-cli cookie-set`","cookie-jar":"cookies live in the browser profile; read them with `playwright-cli cookies`","limit-rate":`a page cannot throttle a fetch`,"continue-at":"a page fetch cannot resume; use `-H 'Range: bytes=N-'`","connect-timeout":"a page fetch cannot time the connect phase alone; use `--max-time`","http1.1":`the browser negotiates the HTTP version`,http2:`the browser negotiates the HTTP version`,http3:`the browser negotiates the HTTP version`,"no-buffer":`responses are read whole, never streamed to stdout`,"trace-ascii":"no wire trace exists; use `playwright-cli network-requests`",trace:"no wire trace exists; use `playwright-cli network-requests`","user-agent":`User-Agent is a forbidden header name for fetch(); the tab sets it`},b={k:`insecure`,x:`proxy`,b:`cookie`,c:`cookie-jar`,E:`cert`,C:`continue-at`,N:`no-buffer`,A:`user-agent`};function ee(){return{url:null,requestMethod:null,headers:[],data:[],form:[],get:!1,output:null,remoteName:!1,include:!1,head:!1,dumpHeader:null,writeOut:null,silent:!1,showError:!1,verbose:!1,failOnError:!1,maxTimeSeconds:null,credentials:`include`,tab:null,frame:null,user:null,referer:null,range:null,help:!1}}function x(e,t){return{message:`curlwright: option ${e} is not supported in a page context — ${y[t]}`,exitCode:2}}function S(e){return{message:`curlwright: unknown option ${e}\nRun 'curlwright --help' for the supported flags.`,exitCode:2}}function C(e){let t=e.indexOf(`:`);if(t===-1)return e.endsWith(`;`)?{name:e.slice(0,-1).trim(),value:``,unset:!1}:{name:e.trim(),value:``,unset:!1};let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();return{name:n,value:r,unset:r===``}}function w(e,t,n,r){switch(t){case`request`:return e.requestMethod=n,null;case`header`:return e.headers.push(C(n??``)),null;case`data`:case`data-ascii`:return e.data.push({kind:`ascii`,value:n??``}),null;case`data-raw`:return e.data.push({kind:`raw`,value:n??``}),null;case`data-binary`:return e.data.push({kind:`binary`,value:n??``}),null;case`data-urlencode`:return e.data.push({kind:`urlencode`,value:n??``}),null;case`json`:return e.data.push({kind:`json`,value:n??``}),null;case`form`:return e.form.push({value:n??``,literal:!1}),null;case`form-string`:return e.form.push({value:n??``,literal:!0}),null;case`output`:return e.output=n,null;case`dump-header`:return e.dumpHeader=n,null;case`write-out`:return e.writeOut=n,null;case`max-time`:return T(e,n,r);case`user`:return e.user=n,null;case`referer`:return e.referer=n,null;case`range`:return e.range=n,null;case`url`:return e.url=n,null;case`tab`:return e.tab=n,null;case`frame`:return e.frame=n,null;default:return E(e,t,r)}}function T(e,t,n){let r=Number(t);return!Number.isFinite(r)||r<=0?{message:`curlwright: ${n} expects a positive number of seconds`,exitCode:2}:(e.maxTimeSeconds=r,null)}function E(e,t,n){switch(t){case`silent`:return e.silent=!0,null;case`show-error`:return e.showError=!0,null;case`include`:return e.include=!0,null;case`head`:return e.head=!0,null;case`verbose`:return e.verbose=!0,null;case`fail`:return e.failOnError=!0,null;case`location`:return null;case`remote-name`:return e.remoteName=!0,null;case`get`:return e.get=!0,null;case`no-credentials`:return e.credentials=`omit`,null;case`help`:return e.help=!0,null;default:return S(n)}}function te(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i===-1?r.slice(2):r.slice(2,i)).trim(),o=i===-1?null:r.slice(i+1);if(a in y)return x(`--${a}`,a);if(h.has(a)){let r=o??t[n+1];return r===void 0?{message:`curlwright: option --${a} requires a value`,exitCode:2}:w(e,a,r,`--${a}`)??{next:o===null?n+2:n+1}}return g.has(a)?w(e,a,null,`--${a}`)??{next:n+1}:S(`--${a}`)}function ne(e,t,n){let r=t[n];for(let i=1;i<r.length;i++){let a=r[i];if(a in b)return x(`-${a}`,b[a]);if(a in _){let o=r.slice(i+1),s=o===``?t[n+1]:o;return s===void 0?{message:`curlwright: option -${a} requires a value`,exitCode:2}:w(e,_[a],s,`-${a}`)??{next:o===``?n+2:n+1}}if(!(a in v))return S(`-${a}`);let o=w(e,v[a],null,`-${a}`);if(o)return o}return{next:n+1}}function re(e,t){return e.url!==null&&e.url!==t?{message:`curlwright: only one URL is supported (got "${e.url}" and "${t}")`,exitCode:2}:(e.url=t,null)}function ie(e){let t=ee(),n=0,r=!1;for(;n<e.length;){let i=e[n];if(!r&&i===`--`){r=!0,n++;continue}if(!r&&i.startsWith(`--`)){let r=te(t,e,n);if(`message`in r)return r;n=r.next;continue}if(!r&&i.startsWith(`-`)&&i.length>1){let r=ne(t,e,n);if(`message`in r)return r;n=r.next;continue}let a=re(t,i);if(a)return a;n++}return t}function ae(e){return`message`in e}const D={"accept-charset":`the browser sets it`,"accept-encoding":`the browser negotiates encoding`,connection:`the browser owns the connection`,"content-length":`derived from the body`,cookie:"the tab's cookies are sent already; set one with `playwright-cli cookie-set`",cookie2:`the tab's cookies are sent already`,date:`the browser sets it`,dnt:`the browser sets it`,expect:`a page fetch cannot send it`,host:`derived from the URL`,"keep-alive":`the browser owns the connection`,origin:`the tab's own origin is sent automatically`,referer:`use -e/--referer, which sets the fetch referrer`,te:`the browser owns transfer encoding`,trailer:`the browser owns transfer encoding`,"transfer-encoding":`the browser owns transfer encoding`,upgrade:`the browser owns the connection`,via:`the browser sets it`};function oe(e){let t=e.toLowerCase();return t in D?D[t]:t.startsWith(`proxy-`)?`proxying is configured on the browser`:t.startsWith(`sec-`)?`Sec- headers are reserved for the browser`:null}function se(e){for(let t of e){let e=oe(t.name);if(e)return{message:`curlwright: header "${t.name}" cannot be set from a page — ${e}`,exitCode:2}}return null}function O(e,t){let n=t.toLowerCase();return Object.keys(e).some(e=>e.toLowerCase()===n)}function k(e){let t={},n=new Set;for(let r of e.headers)if(r.name!==``){if(r.unset){n.add(r.name.toLowerCase());continue}t[r.name]=r.value}return{headers:t,suppressed:n}}function A(e,t,n){return!O(e,n)&&!t.has(n)}function j(e){return/^[a-zA-Z]+=/.test(e)?e:`bytes=${e}`}function M(e,t,n,r){n.user!==null&&A(e,t,`authorization`)&&(e.Authorization=`Basic ${btoa(n.user)}`),n.range!==null&&A(e,t,`range`)&&(e.Range=j(n.range)),r.contentType&&A(e,t,`content-type`)&&(e[`Content-Type`]=r.contentType),r.accept&&A(e,t,`accept`)&&(e.Accept=r.accept)}function N(e,t){if(t===``)return e;let[n,r]=P(e);return`${n}${n.includes(`?`)?`&`:`?`}${t}${r}`}function P(e){let t=e.indexOf(`#`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function F(e,t){return e.requestMethod?e.requestMethod:e.head?`HEAD`:t?`POST`:`GET`}function I(e,t,n){let r=e.toUpperCase();return!t||r!==`GET`&&r!==`HEAD`?null:{message:`curlwright: ${n.requestMethod?`-X ${n.requestMethod}`:`-I`} cannot carry a request body — a page fetch rejects a ${r} with one. Drop the data, or use -G to send it as a query string.`,exitCode:2}}function L(e,t){if(e.url===null)return{message:`curlwright: no URL specified`,exitCode:2};let{headers:n,suppressed:r}=k(e),i=e.get&&t.bytes!==null,a=i?{...t,bytes:null,contentType:null}:t;M(n,r,e,a);let o=i?N(e.url,new TextDecoder().decode(t.bytes??new Uint8Array)):e.url,s=a.bytes!==null||a.form!==null,c=F(e,s),l=I(c,s,e);if(l)return l;let u={method:c,headers:n,credentials:e.credentials,responseType:`binary`};return a.form?u.body=a.form:a.bytes&&(u.body=a.bytes),e.referer!==null&&(u.referrer=e.referer),e.maxTimeSeconds!==null&&(u.timeoutMs=e.maxTimeSeconds*1e3),{url:o,method:c,fetchOptions:u,uploadSize:a.bytes?.length??0}}function R(e){let t=e.fetchOptions.headers??{},n=[`> ${e.method} ${e.url}`];for(let[e,r]of Object.entries(t))n.push(`> ${e}: ${r}`);return n.push(`> `),`${n.join(`
|
|
2
2
|
`)}\n`}function z(e,t){let n=[`< ${e}`];for(let[e,r]of Object.entries(t))n.push(`< ${e}: ${r}`);return n.push(`< `),`${n.join(`
|
|
3
3
|
`)}\n`}function B(t,n){return typeof t==`string`?n===`base64`?e(t):new TextEncoder().encode(t):new Uint8Array}function V(e,t){return t?`HTTP/1.1 ${e} ${t}`:`HTTP/1.1 ${e}`}function H(e,t,n){let r=[V(e,t)];for(let[e,t]of Object.entries(n))r.push(`${e}: ${t}`);return`${r.join(`\r
|
|
4
4
|
`)}\r\n\r\n`}function U(e){if(e.includes(0))return!0;try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e),!1}catch{return!0}}function W(e){let t;try{t=new URL(e).pathname}catch{t=e.split(`?`)[0]}return t.replace(/\/+$/,``).split(`/`).pop()||null}function G(e,t,n){return new TextEncoder().encode(H(e,t,n)).length}function K(e){try{return new URL(e).origin}catch{return null}}function q(e){return e.map(e=>` --tab=${e.targetId} ${e.url}`).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./record-ChU1ND2B.js";import{t,u as n}from"./descriptor-S4Jug1iP.js";import{t as r}from"./subcommand-flags-BZi7j78Q.js";import{t as i}from"./subcommand-help-CgO7wRS5.js";import{a,r as o,t as s}from"./memory-budget-Bcf7Eolo.js";import{o as c}from"./kernel-worker-
|
|
1
|
+
import{t as e}from"./record-ChU1ND2B.js";import{t,u as n}from"./descriptor-S4Jug1iP.js";import{t as r}from"./subcommand-flags-BZi7j78Q.js";import{t as i}from"./subcommand-help-CgO7wRS5.js";import{a,r as o,t as s}from"./memory-budget-Bcf7Eolo.js";import{o as c}from"./kernel-worker-BuXnCRO7.js";const l=`usage: memory <command> [options]
|
|
2
2
|
|
|
3
3
|
Durable cone memory: one file per cone, rewritten by the memory-curator
|
|
4
4
|
scoop after a chat freezes. This command inspects that system and pokes it.
|
|
@@ -38,7 +38,7 @@ Examples:
|
|
|
38
38
|
memory log --limit 5
|
|
39
39
|
memory curate --archive 2026-09-11T08-30-00Z-fix-build.md
|
|
40
40
|
memory dream --all
|
|
41
|
-
`,u=[`--cone`,`--archive`,`--limit`];function d(e){return{stdout:e,stderr:``,exitCode:0}}function f(e){return{stdout:``,stderr:`memory: ${e}\n`,exitCode:1}}function p(){let e=globalThis.__slicc_memory;return e&&typeof e.curate==`function`&&typeof e.dream==`function`?e:null}async function m(){let{isMemoryV2Enabled:e}=await import(`./memory-v2-flag-
|
|
41
|
+
`,u=[`--cone`,`--archive`,`--limit`];function d(e){return{stdout:e,stderr:``,exitCode:0}}function f(e){return{stdout:``,stderr:`memory: ${e}\n`,exitCode:1}}function p(){let e=globalThis.__slicc_memory;return e&&typeof e.curate==`function`&&typeof e.dream==`function`?e:null}async function m(){let{isMemoryV2Enabled:e}=await import(`./memory-v2-flag-DjjJhF1z.js`);return!e()}async function h(e,t){try{let n=await e.readFile(t,{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}catch{return null}}async function g(n){let r=[e];try{let e=await n.readDir(t);for(let t of e)t.type===`directory`&&r.push(t.name)}catch{}return r}function _(e){return n({parentJid:null,folder:e}).memoryPath}async function v(e,t){let n=await g(e);return n.includes(t)?{folder:t}:{error:`unknown cone "${t}" (cones: ${n.join(`, `)})`}}function y(e){return e.memoryFailed===void 0?e.memoryPending?`pending`:e.memoryCuratedAt===void 0?e.memorySkipped?`skipped`:`none`:`curated`:`failed`}async function b(e,t){let n=r(e,{value:[`--cone`]});if(`error`in n)return f(n.error);let i=await v(t,n.values.get(`--cone`)??`cone`);if(`error`in i)return f(i.error);let a=_(i.folder),o=await h(t,a);return o===null?f(`no memory file at ${a}`):d(o.endsWith(`
|
|
42
42
|
`)||o===``?o:`${o}\n`)}const x=`/sessions/.curation/health.json`;async function S(e){let t=await h(e,x);if(t===null)return null;try{let e=JSON.parse(t);return typeof e.at!=`string`||!Array.isArray(e.failures)?null:{at:e.at,failures:e.failures.map(String)}}catch{return null}}async function C(e){let t=await c(e),n=[];for(let t of await g(e)){let r=_(t),i=await h(e,r);n.push({folder:t,path:r,chars:i===null?null:i.length})}let r={curated:0,failed:0,pending:0,skipped:0,none:0},i=new Map;for(let e of t){let t=y(e);if(r[t]++,t===`curated`){let t=e.cone??`cone`;i.set(t,(i.get(t)??0)+1)}}let l=[];r.failed>0&&l.push(`${r.failed} archive(s) whose last curation attempt failed — see \`memory log\``);for(let t of s)await h(e,t)!==null&&l.push(`${t} is no longer read — memory instructions live in ${o}; carry any customization over, then delete it`);for(let e of n){let t=i.get(e.folder)??0;t===0||(e.chars??0)>0||l.push(e.folder===`cone`?`${t} archive(s) report successful curation but the primary memory file is missing or empty`:`${t} archive(s) from cone "${e.folder}" report successful curation but its memory file (${e.path}) is missing or empty`)}return{memoryV2:!await m(),sessions:t.length,budgetChars:a(t.length),cones:n,curation:r,checks:l,scheduledCheck:await S(e)}}async function w(e,t){let n=r(e,{bool:[`--json`,`--check`]});if(`error`in n)return f(n.error);let i=await C(t),a=n.bools.has(`--check`)&&i.checks.length>0;if(n.bools.has(`--json`))return{stdout:`${JSON.stringify(i,null,2)}\n`,stderr:``,exitCode:+!!a};let o=`Memory v2: ${i.memoryV2?`ON`:`OFF — curation surfaces beyond the freezer pass are disabled`}\n`;o+=`Sessions: ${i.sessions} archived (memory budget ${i.budgetChars} chars)\n`,o+=`Memory files:
|
|
43
43
|
`;for(let e of i.cones){let t=e.chars===null?`missing`:`${e.chars} chars`;o+=` ${e.folder.padEnd(14)}${e.path} (${t})\n`}let{curated:s,failed:c,pending:l,skipped:u,none:d}=i.curation;if(o+=`Curation: ${s} curated, ${c} failed, ${l} pending, ${u} skipped, ${d} unmarked\n`,i.checks.length>0){o+=`Health:
|
|
44
44
|
`;for(let e of i.checks)o+=` FAIL ${e}\n`}else o+=`Health: ok
|