sliccy 6.240.2 → 6.240.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/ui/.vite/manifest.json +203 -203
  2. package/dist/ui/assets/{account-store-DkttH-BP.js → account-store-BY7L2nue.js} +1 -1
  3. package/dist/ui/assets/{account-store-BZBj_ntG.js → account-store-BZTlSap7.js} +1 -1
  4. package/dist/ui/assets/{adobe-ByBtC69J.js → adobe-CDStXNdn.js} +1 -1
  5. package/dist/ui/assets/{adobe-CVqQJ2x-.js → adobe-CMMbs-uB.js} +1 -1
  6. package/dist/ui/assets/{agent-panels-BVpX6zQ5.js → agent-panels-BoMV6jtA.js} +1 -1
  7. package/dist/ui/assets/{almost-bash-shell-headless-HOeKQtgA.js → almost-bash-shell-headless--cwLwrzv.js} +15 -15
  8. package/dist/ui/assets/{apply-layout-C_O6ndKr.js → apply-layout-BtjslV7Z.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-DiqKGUYo.js → azure-openai--A3VPQCt.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-Z4aqtv7E.js → azure-openai-C9E5PjlB.js} +1 -1
  11. package/dist/ui/assets/{cdp-D0OuKYd5.js → cdp-B6c3Uk2f.js} +1 -1
  12. package/dist/ui/assets/{cerebras-UwtUgOV6.js → cerebras-CLDfgkgy.js} +1 -1
  13. package/dist/ui/assets/{cerebras-6-gk1Jha.js → cerebras-DXBssPNt.js} +1 -1
  14. package/dist/ui/assets/{composer-speech-QgsQ1IqW.js → composer-speech-CCWWTz70.js} +1 -1
  15. package/dist/ui/assets/{connect-surface-COrO1h1v.js → connect-surface-CKPv2fJZ.js} +1 -1
  16. package/dist/ui/assets/{directed-approval-iMn6w3M8.js → directed-approval-WdzT5Jb8.js} +1 -1
  17. package/dist/ui/assets/{emscripten-vfs-hook-_WoXADPd.js → emscripten-vfs-hook-Bjqk301Y.js} +1 -1
  18. package/dist/ui/assets/{frozen-archive-writer-BhgsVjoX.js → frozen-archive-writer-BJkhyap1.js} +1 -1
  19. package/dist/ui/assets/{frozen-archive-writer-CBS7YWrT.js → frozen-archive-writer-Ds5upuER.js} +1 -1
  20. package/dist/ui/assets/{frozen-session-delete-B1-ipujg.js → frozen-session-delete-CJoYh-8I.js} +1 -1
  21. package/dist/ui/assets/{frozen-session-identity-EbIVZuRz.js → frozen-session-identity-BLUbhsFI.js} +1 -1
  22. package/dist/ui/assets/{frozen-session-identity-CTAIleP4.js → frozen-session-identity-HGxlRDB-.js} +1 -1
  23. package/dist/ui/assets/{gelatiere-unit-BE-OCtHt.js → gelatiere-unit-Dm-nEuug.js} +1 -1
  24. package/dist/ui/assets/{github-Dhh_Kein.js → github-B9kp64Og.js} +1 -1
  25. package/dist/ui/assets/{github-C1OAynaV.js → github-B9zmCrJs.js} +1 -1
  26. package/dist/ui/assets/{github-copilot-BECMsi8_.js → github-copilot-CYUjFE56.js} +1 -1
  27. package/dist/ui/assets/{github-copilot-Hlw3Z0TU.js → github-copilot-DzY0_cZO.js} +1 -1
  28. package/dist/ui/assets/{go-driver-Bl_pd-vs.js → go-driver-kLCdKKCl.js} +1 -1
  29. package/dist/ui/assets/{hear-B0sL5R-Z.js → hear-BbTDqjkN.js} +1 -1
  30. package/dist/ui/assets/{js-realm-worker-lw4jlVws.js → js-realm-worker-CCSqHLiq.js} +2 -2
  31. package/dist/ui/assets/{jsh-executor-DZkflzRL.js → jsh-executor-CKGuA572.js} +2 -2
  32. package/dist/ui/assets/{kernel-worker-yDR9ykP9.js → kernel-worker-DAOlZAnY.js} +8 -8
  33. package/dist/ui/assets/{lick-ws-bridge-awVQ4bod.js → lick-ws-bridge-DNmnSlAZ.js} +1 -1
  34. package/dist/ui/assets/{lick-ws-bridge-D_7Sju9n.js → lick-ws-bridge-DpLDuGHA.js} +1 -1
  35. package/dist/ui/assets/{live-session-curation-XtShh6w8.js → live-session-curation-CZkIr6Zu.js} +1 -1
  36. package/dist/ui/assets/{live-session-curation-KCnMJq1h.js → live-session-curation-Das-8xnF.js} +1 -1
  37. package/dist/ui/assets/{live-session-snapshot-Cl5CEBKO.js → live-session-snapshot-D8lEUK7J.js} +1 -1
  38. package/dist/ui/assets/{local-llm-BuO74RMi.js → local-llm-BblvgE13.js} +1 -1
  39. package/dist/ui/assets/{local-llm-gJaQCXGv.js → local-llm-PTZ0UPXw.js} +1 -1
  40. package/dist/ui/assets/{main-CvCAlghs.js → main-BfPkUEOn.js} +3 -3
  41. package/dist/ui/assets/{main-cherry-C829SF3P.js → main-cherry-Wxt6L3-r.js} +1 -1
  42. package/dist/ui/assets/{mcp-command-DMHz7PmL.js → mcp-command-PQ40GO9Q.js} +9 -9
  43. package/dist/ui/assets/{memory-curation-seam-epGReJuG.js → memory-curation-seam-ZfZvKgO0.js} +1 -1
  44. package/dist/ui/assets/{memory-health-BYR_Y-0X.js → memory-health-DeU8Hnvy.js} +1 -1
  45. package/dist/ui/assets/{memory-write-execute-DT_htd19.js → memory-write-execute--18W6rIW.js} +1 -1
  46. package/dist/ui/assets/{merge-folded-cost-into-frozen-DimTAP8-.js → merge-folded-cost-into-frozen-C5WK2ebU.js} +1 -1
  47. package/dist/ui/assets/{new-session-D3NIubwl.js → new-session-Bu1vMo6m.js} +2 -2
  48. package/dist/ui/assets/{oauth-bootstrap-dt8ZYlvi.js → oauth-bootstrap-BXI2tTwP.js} +2 -2
  49. package/dist/ui/assets/{onboarding-orchestrator-DB4uV5QM.js → onboarding-orchestrator-qYm2EcAa.js} +1 -1
  50. package/dist/ui/assets/{openai-codex-Cl-z58Kf.js → openai-codex-BRVnsck1.js} +1 -1
  51. package/dist/ui/assets/{openai-codex-CR-4SKAR.js → openai-codex-DoTDnY8l.js} +1 -1
  52. package/dist/ui/assets/{openrouter-D79_Vd4c.js → openrouter-CU8FE73y.js} +1 -1
  53. package/dist/ui/assets/{openrouter-BNdMnkix.js → openrouter-DH09mvh8.js} +1 -1
  54. package/dist/ui/assets/{openrouter-free-CQa1CoO4.js → openrouter-free-CjLo7d0B.js} +1 -1
  55. package/dist/ui/assets/{openrouter-free-C1-Bj_Xx.js → openrouter-free-D_agjxS6.js} +1 -1
  56. package/dist/ui/assets/{openrouter-oauth-DOazjMTa.js → openrouter-oauth-DUMp8wVc.js} +1 -1
  57. package/dist/ui/assets/{openrouter-oauth-D_I7eEtl.js → openrouter-oauth-Dol2vy8U.js} +1 -1
  58. package/dist/ui/assets/{panel-rpc-handlers-BzU1tjGq.js → panel-rpc-handlers-X7STMHDZ.js} +2 -2
  59. package/dist/ui/assets/{panelize-shell-B0pTufSe.js → panelize-shell-CTy7L9dn.js} +1 -1
  60. package/dist/ui/assets/{pi-edit-execution-CvC4g6ge.js → pi-edit-execution-Cp7-4v_G.js} +1 -1
  61. package/dist/ui/assets/{process-worker-B_jMhtwi.js → process-worker-BEpsdjWG.js} +3 -3
  62. package/dist/ui/assets/{provider-BVtwgFuj.js → provider-5SIxaKAM.js} +1 -1
  63. package/dist/ui/assets/{provider-D5HnoEAQ.js → provider-BRMONplS.js} +1 -1
  64. package/dist/ui/assets/{provider-settings-Eedtvqyh.js → provider-settings-C_d-VmMI.js} +1 -1
  65. package/dist/ui/assets/provider-store-access-BxrLqbL-.js +1 -0
  66. package/dist/ui/assets/provider-store-access-CMvAMxdZ.js +1 -0
  67. package/dist/ui/assets/{providers-CR6zPkBA.js → providers-4px4FkTT.js} +2 -2
  68. package/dist/ui/assets/{providers-CxXqdsb8.js → providers-qFtC1ctt.js} +1 -1
  69. package/dist/ui/assets/{quick-llm-OcogX5yH.js → quick-llm-CS7I0EM1.js} +1 -1
  70. package/dist/ui/assets/{realm-inprocess-D4P5wFOE.js → realm-inprocess-CTrnIcCf.js} +2 -2
  71. package/dist/ui/assets/{realm-unhandled-rejections-BcTVMNp-.js → realm-unhandled-rejections-BcViM2bI.js} +1 -1
  72. package/dist/ui/assets/{realm-unhandled-rejections-CKtowxzG.js → realm-unhandled-rejections-COEEZ6Qq.js} +1 -1
  73. package/dist/ui/assets/{recovery-screen-BGirKYu_.js → recovery-screen-pbSIuH95.js} +1 -1
  74. package/dist/ui/assets/{remote-terminal-view-qc6RzQpT.js → remote-terminal-view-CVoVWZ5L.js} +2 -2
  75. package/dist/ui/assets/{restore-BRsw6f-s.js → restore-BGLSgFtU.js} +1 -1
  76. package/dist/ui/assets/{run-CjVzDP7D.js → run-CJkwGvdL.js} +2 -2
  77. package/dist/ui/assets/{run-Co30Tf9M.js → run-Ce53JaVM.js} +1 -1
  78. package/dist/ui/assets/{run-DW65sPip.js → run-CoyHWJnc.js} +1 -1
  79. package/dist/ui/assets/{run-BpasEHV5.js → run-D05bZRs7.js} +2 -2
  80. package/dist/ui/assets/{run-D4C2w6Ix.js → run-Dm4ILho2.js} +1 -1
  81. package/dist/ui/assets/{session-command-memory-XnFNRIFA.js → session-command-memory-B2ZvAv75.js} +2 -2
  82. package/dist/ui/assets/{session-jsonl-DO6bKeXA.js → session-jsonl-BWGPVYtm.js} +1 -1
  83. package/dist/ui/assets/{session-jsonl-CrcMW8fx.js → session-jsonl-BjUfDnwt.js} +1 -1
  84. package/dist/ui/assets/{session-search-index-CeQkxdD7.js → session-search-index-CL6tNMTB.js} +1 -1
  85. package/dist/ui/assets/{setup-feature-flags-remote-BSbLoDdK.js → setup-feature-flags-remote-DRQOEp2l.js} +1 -1
  86. package/dist/ui/assets/{setup-model-catalog-DKaFLDA2.js → setup-model-catalog-BsYsset4.js} +1 -1
  87. package/dist/ui/assets/{silent-renew-backoff-JpXc1wkl.js → silent-renew-backoff-BwjA995I.js} +1 -1
  88. package/dist/ui/assets/slicc-version-VBKLWgCV.js +1 -0
  89. package/dist/ui/assets/{soundscape-CD-xcN6Z.js → soundscape-BN6WrF-3.js} +1 -1
  90. package/dist/ui/assets/{speak-DgoChm2i.js → speak-NYtqNJE_.js} +1 -1
  91. package/dist/ui/assets/{sprinkle-manager-CDJc_08W.js → sprinkle-manager-vf160MeS.js} +1 -1
  92. package/dist/ui/assets/{sprinkle-renderer-Dur1ZNnK.js → sprinkle-renderer-xgwRm1L_.js} +1 -1
  93. package/dist/ui/assets/{sudo-DO4cHGWe.js → sudo-4nzJfcYs.js} +1 -1
  94. package/dist/ui/assets/{supervisor-DsxjOzXp.js → supervisor-VGZUDK1b.js} +1 -1
  95. package/dist/ui/assets/{sync-dialog-Ca6pboEO.js → sync-dialog-DSMgqf4e.js} +1 -1
  96. package/dist/ui/assets/{transformers-env-lnsOWAhF.js → transformers-env-WpdAi-iZ.js} +1 -1
  97. package/dist/ui/assets/{tray-leader-IzNrTl6C.js → tray-leader-Fwsq8jgB.js} +1 -1
  98. package/dist/ui/assets/{tray-leave-runtime-C1DwCeQz.js → tray-leave-runtime-CO-5OLYh.js} +1 -1
  99. package/dist/ui/assets/{tray-sidecar-DyqniZfp.js → tray-sidecar-6AQW4IED.js} +1 -1
  100. package/dist/ui/assets/{upgrade-detection-GSR1EuFa.js → upgrade-detection-qeeIUkGI.js} +1 -1
  101. package/dist/ui/assets/{voice-reply-BaAuLq60.js → voice-reply-zEE1QNSL.js} +1 -1
  102. package/dist/ui/assets/{wasi-runtime-BBxEcrtW.js → wasi-runtime-CAjhlQs6.js} +1 -1
  103. package/dist/ui/assets/{wc-attach-sJ3NMqHQ.js → wc-attach-DNWpvdXi.js} +2 -2
  104. package/dist/ui/assets/{wc-browser-u5uzxk-d.js → wc-browser-ClKGIaQ7.js} +1 -1
  105. package/dist/ui/assets/{wc-computers-BX1yCXPi.js → wc-computers-C0KbAS_B.js} +1 -1
  106. package/dist/ui/assets/{wc-detached-U-XIb2f6.js → wc-detached-Cat9npj6.js} +1 -1
  107. package/dist/ui/assets/{wc-extension-BgC75srq.js → wc-extension-C9b9Kr17.js} +2 -2
  108. package/dist/ui/assets/{wc-follower-C6KuLED-.js → wc-follower-ByQ459Ju.js} +3 -3
  109. package/dist/ui/assets/{wc-follower-oauth-DsNONUfK.js → wc-follower-oauth-CIG1Y8xe.js} +1 -1
  110. package/dist/ui/assets/{wc-gelatiere-C1LMmmP-.js → wc-gelatiere-CgcmOl-z.js} +1 -1
  111. package/dist/ui/assets/{wc-live-BvTlZWIq.js → wc-live-DU_tPZwB.js} +5 -5
  112. package/dist/ui/assets/{wc-nav-DAZqGqhf.js → wc-nav-ZVKwKdQi.js} +2 -2
  113. package/dist/ui/assets/{wc-onboarding-Cf7ATuAZ.js → wc-onboarding-Dz26nM1q.js} +2 -2
  114. package/dist/ui/assets/{wc-permissions-BfNzwBXu.js → wc-permissions-BztxeBpv.js} +2 -2
  115. package/dist/ui/assets/{wc-placeholder-73ZpUgXT.js → wc-placeholder-6j__HLJV.js} +3 -3
  116. package/dist/ui/assets/{wc-secret-request-BztOdnag.js → wc-secret-request-Dise-yBJ.js} +1 -1
  117. package/dist/ui/assets/{wc-settings-ClXzlz1S.js → wc-settings-DB1l5qip.js} +3 -3
  118. package/dist/ui/assets/{wc-shell-BBeNiS8R.js → wc-shell-xh75VEiE.js} +3 -3
  119. package/dist/ui/assets/{wc-shortcut-config-DNDBw_BA.js → wc-shortcut-config-Cg6dfcMA.js} +1 -1
  120. package/dist/ui/assets/{wc-sprinkles-ClXMSwxA.js → wc-sprinkles-3tAqIJ4S.js} +2 -2
  121. package/dist/ui/assets/{wc-transcript-export-APmcHVyY.js → wc-transcript-export-CxVHtvhC.js} +2 -2
  122. package/dist/ui/assets/{wc-tray-B9Wksuuv.js → wc-tray-BO7Dceka.js} +4 -4
  123. package/dist/ui/assets/welcome-detection-RBbaP7o4.js +1 -0
  124. package/dist/ui/assets/{whisper-session-Bd6DyWgL.js → whisper-session-DmUd1lKW.js} +2 -2
  125. package/dist/ui/assets/{xai-grok-ummZtHNw.js → xai-grok-Ch8-vKVa.js} +1 -1
  126. package/dist/ui/assets/{xai-grok-CKLvBVjv.js → xai-grok-DfZkFyCS.js} +1 -1
  127. package/dist/ui/index.html +3 -3
  128. package/dist/ui/packages/webapp/index.html +3 -3
  129. package/package.json +1 -1
  130. package/dist/ui/assets/provider-store-access-Cb_QGFws.js +0 -1
  131. package/dist/ui/assets/provider-store-access-DpnMfiJL.js +0 -1
  132. package/dist/ui/assets/slicc-version-BfDpFkW3.js +0 -1
  133. package/dist/ui/assets/welcome-detection-CjuV_cig.js +0 -1
@@ -0,0 +1 @@
1
+ import{t as e}from"./provider-BRMONplS.js";export{e as readMcpAuthEntries};
@@ -0,0 +1 @@
1
+ import{t as e}from"./store-tvt1tIjf.js";import"./provider-5SIxaKAM.js";export{e as readMcpAuthEntries};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-Z4aqtv7E.js","assets/diagnostics-Cag7MsZI.js","assets/models-Xc0Gclrk.js","assets/preload-helper-Czpn1I53.js","assets/compat-BAGLwgqY.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/openrouter.models-DHpsqCCC.js","assets/account-store-BZBj_ntG.js","assets/core-BFRZk2b-.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/utf16-clip-CGL7omVm.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-4VBgrEIu.js","assets/base64-ELzoYfwP.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-hMRoGGjt.js","assets/float-topology-C_iRKPQK.js","assets/secrets-bridge-client-D734Xx8G.js","assets/port-bridge-client-B-gpiOVR.js","assets/panel-rpc-accessor-B4BfPLSo.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/stored-accounts-ChNHYF68.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/transform-messages-k2mfzJwY.js","assets/pi-transcript-context-miZCMig3.js","assets/bedrock-camp-CWYBPsp_.js","assets/temperature-support-DhoZT6gU.js","assets/local-llm-gJaQCXGv.js","assets/legacy-api-aliases-BjgG1CsY.js","assets/adobe-ByBtC69J.js","assets/main-CvCAlghs.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/bridge-protocol-C52CnDIj.js","assets/telemetry-B0sKnLBU.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/silent-renew-backoff-JpXc1wkl.js","assets/provider-budget-LCzMPlKv.js","assets/oauth-service-GpUOM3Aw.js","assets/permissions-surface-registry-CilCRwhh.js","assets/llm-session-id-bZQs6gBN.js","assets/cerebras-6-gk1Jha.js","assets/github-copilot-BECMsi8_.js","assets/github-Dhh_Kein.js","assets/global-db-CbuLl-zx.js","assets/bridge-token-required-DMk2va9k.js","assets/openai-codex-CR-4SKAR.js","assets/pkce-hGf_TEnP.js","assets/openrouter-free-CQa1CoO4.js","assets/openrouter-models-DawLtPaY.js","assets/openrouter-oauth-DOazjMTa.js","assets/openrouter-BNdMnkix.js","assets/xai-grok-CKLvBVjv.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-Z4aqtv7E.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,28,29,30,31,32,33])),"./built-in/bedrock-camp-compat.ts":()=>t(()=>import(`./bedrock-camp-compat-B1oHsbyo.js`).then(e=>e.o),__vite__mapDeps([29,8])),"./built-in/bedrock-camp-extra-models.ts":()=>t(()=>import(`./bedrock-camp-extra-models-BYrxX19D.js`).then(e=>e.n),__vite__mapDeps([30,8,29])),"./built-in/bedrock-camp.ts":()=>t(()=>import(`./bedrock-camp-CWYBPsp_.js`),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,29,31,32,33,35])),"./built-in/local-llm.ts":()=>t(()=>import(`./local-llm-gJaQCXGv.js`),__vite__mapDeps([36,1,4,2,3,5,6,7,8,9,37,13,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33]))}),s=Object.assign({"/packages/webapp/providers/adobe.ts":()=>t(()=>import(`./adobe-ByBtC69J.js`),__vite__mapDeps([38,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44,45,46,47,48,33,35,49])),"/packages/webapp/providers/cerebras.ts":()=>t(()=>import(`./cerebras-6-gk1Jha.js`),__vite__mapDeps([50,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33])),"/packages/webapp/providers/github-copilot.ts":()=>t(()=>import(`./github-copilot-BECMsi8_.js`),__vite__mapDeps([51,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44])),"/packages/webapp/providers/github.ts":()=>t(()=>import(`./github-Dhh_Kein.js`),__vite__mapDeps([52,3,10,11,8,4,2,1,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,45,47,48,53,54])),"/packages/webapp/providers/openai-codex.ts":()=>t(()=>import(`./openai-codex-CR-4SKAR.js`),__vite__mapDeps([55,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,54,56])),"/packages/webapp/providers/openrouter-free.ts":()=>t(()=>import(`./openrouter-free-CQa1CoO4.js`),__vite__mapDeps([57,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,58,59,56])),"/packages/webapp/providers/openrouter-models.ts":()=>t(()=>import(`./openrouter-models-DawLtPaY.js`),__vite__mapDeps([58,9])),"/packages/webapp/providers/openrouter-oauth.ts":()=>t(()=>import(`./openrouter-oauth-DOazjMTa.js`),__vite__mapDeps([59,10,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,56])),"/packages/webapp/providers/openrouter.ts":()=>t(()=>import(`./openrouter-BNdMnkix.js`),__vite__mapDeps([60,4,2,1,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,58,59,56])),"/packages/webapp/providers/xai-grok-errors.ts":()=>t(()=>import(`./xai-grok-errors-bnlIBeu-.js`),[]),"/packages/webapp/providers/xai-grok.ts":()=>t(()=>import(`./xai-grok-CKLvBVjv.js`),__vite__mapDeps([61,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44,33,54,56,62]))}),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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/azure-openai-C9E5PjlB.js","assets/diagnostics-Cag7MsZI.js","assets/models-Xc0Gclrk.js","assets/preload-helper-Czpn1I53.js","assets/compat-BAGLwgqY.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/openrouter.models-DHpsqCCC.js","assets/account-store-BZTlSap7.js","assets/core-BFRZk2b-.js","assets/libesm-BypnjKEL.js","assets/logger-DDBAeTLF.js","assets/utf16-clip-CGL7omVm.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-4VBgrEIu.js","assets/base64-ELzoYfwP.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-hMRoGGjt.js","assets/float-topology-C_iRKPQK.js","assets/secrets-bridge-client-D734Xx8G.js","assets/port-bridge-client-B-gpiOVR.js","assets/panel-rpc-accessor-B4BfPLSo.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/stored-accounts-ChNHYF68.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/transform-messages-k2mfzJwY.js","assets/pi-transcript-context-miZCMig3.js","assets/bedrock-camp-CWYBPsp_.js","assets/temperature-support-DhoZT6gU.js","assets/local-llm-PTZ0UPXw.js","assets/legacy-api-aliases-BjgG1CsY.js","assets/adobe-CDStXNdn.js","assets/main-BfPkUEOn.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/bridge-protocol-C52CnDIj.js","assets/telemetry-B0sKnLBU.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/silent-renew-backoff-BwjA995I.js","assets/provider-budget-LCzMPlKv.js","assets/oauth-service-GpUOM3Aw.js","assets/permissions-surface-registry-CilCRwhh.js","assets/llm-session-id-bZQs6gBN.js","assets/cerebras-DXBssPNt.js","assets/github-copilot-CYUjFE56.js","assets/github-B9kp64Og.js","assets/global-db-CbuLl-zx.js","assets/bridge-token-required-DMk2va9k.js","assets/openai-codex-DoTDnY8l.js","assets/pkce-hGf_TEnP.js","assets/openrouter-free-CjLo7d0B.js","assets/openrouter-models-DawLtPaY.js","assets/openrouter-oauth-DUMp8wVc.js","assets/openrouter-DH09mvh8.js","assets/xai-grok-DfZkFyCS.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-C9E5PjlB.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,28,29,30,31,32,33])),"./built-in/bedrock-camp-compat.ts":()=>t(()=>import(`./bedrock-camp-compat-B1oHsbyo.js`).then(e=>e.o),__vite__mapDeps([29,8])),"./built-in/bedrock-camp-extra-models.ts":()=>t(()=>import(`./bedrock-camp-extra-models-BYrxX19D.js`).then(e=>e.n),__vite__mapDeps([30,8,29])),"./built-in/bedrock-camp.ts":()=>t(()=>import(`./bedrock-camp-CWYBPsp_.js`),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,29,31,32,33,35])),"./built-in/local-llm.ts":()=>t(()=>import(`./local-llm-PTZ0UPXw.js`),__vite__mapDeps([36,1,4,2,3,5,6,7,8,9,37,13,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33]))}),s=Object.assign({"/packages/webapp/providers/adobe.ts":()=>t(()=>import(`./adobe-CDStXNdn.js`),__vite__mapDeps([38,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44,45,46,47,48,33,35,49])),"/packages/webapp/providers/cerebras.ts":()=>t(()=>import(`./cerebras-DXBssPNt.js`),__vite__mapDeps([50,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33])),"/packages/webapp/providers/github-copilot.ts":()=>t(()=>import(`./github-copilot-CYUjFE56.js`),__vite__mapDeps([51,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44])),"/packages/webapp/providers/github.ts":()=>t(()=>import(`./github-B9kp64Og.js`),__vite__mapDeps([52,3,10,11,8,4,2,1,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,45,47,48,53,54])),"/packages/webapp/providers/openai-codex.ts":()=>t(()=>import(`./openai-codex-DoTDnY8l.js`),__vite__mapDeps([55,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,54,56])),"/packages/webapp/providers/openrouter-free.ts":()=>t(()=>import(`./openrouter-free-CjLo7d0B.js`),__vite__mapDeps([57,1,4,2,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,58,59,56])),"/packages/webapp/providers/openrouter-models.ts":()=>t(()=>import(`./openrouter-models-DawLtPaY.js`),__vite__mapDeps([58,9])),"/packages/webapp/providers/openrouter-oauth.ts":()=>t(()=>import(`./openrouter-oauth-DUMp8wVc.js`),__vite__mapDeps([59,10,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,56])),"/packages/webapp/providers/openrouter.ts":()=>t(()=>import(`./openrouter-DH09mvh8.js`),__vite__mapDeps([60,4,2,1,3,5,6,7,8,9,37,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,39,40,41,42,43,44,33,58,59,56])),"/packages/webapp/providers/xai-grok-errors.ts":()=>t(()=>import(`./xai-grok-errors-bnlIBeu-.js`),[]),"/packages/webapp/providers/xai-grok.ts":()=>t(()=>import(`./xai-grok-DfZkFyCS.js`),__vite__mapDeps([61,11,8,4,2,1,3,5,6,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,37,10,28,29,30,31,39,40,41,42,43,44,33,54,56,62]))}),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";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-DiqKGUYo.js`),"./built-in/bedrock-camp-compat.ts":()=>import(`./bedrock-camp-compat-ByR2ly4i.js`).then(e=>e.o),"./built-in/bedrock-camp-extra-models.ts":()=>import(`./bedrock-camp-extra-models-DIuCBjcJ.js`).then(e=>e.n),"./built-in/bedrock-camp.ts":()=>import(`./bedrock-camp-CBP41h6t.js`),"./built-in/local-llm.ts":()=>import(`./local-llm-BuO74RMi.js`).then(e=>e.n)}),o=Object.assign({"/packages/webapp/providers/adobe.ts":()=>import(`./adobe-CVqQJ2x-.js`),"/packages/webapp/providers/cerebras.ts":()=>import(`./cerebras-UwtUgOV6.js`),"/packages/webapp/providers/github-copilot.ts":()=>import(`./github-copilot-Hlw3Z0TU.js`),"/packages/webapp/providers/github.ts":()=>import(`./github-C1OAynaV.js`),"/packages/webapp/providers/openai-codex.ts":()=>import(`./openai-codex-Cl-z58Kf.js`),"/packages/webapp/providers/openrouter-free.ts":()=>import(`./openrouter-free-C1-Bj_Xx.js`),"/packages/webapp/providers/openrouter-models.ts":()=>import(`./openrouter-models-RwlwKz0P.js`),"/packages/webapp/providers/openrouter-oauth.ts":()=>import(`./openrouter-oauth-D_I7eEtl.js`),"/packages/webapp/providers/openrouter.ts":()=>import(`./openrouter-D79_Vd4c.js`),"/packages/webapp/providers/xai-grok-errors.ts":()=>import(`./xai-grok-errors-ByEMMSoz.js`),"/packages/webapp/providers/xai-grok.ts":()=>import(`./xai-grok-ummZtHNw.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
+ 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--A3VPQCt.js`),"./built-in/bedrock-camp-compat.ts":()=>import(`./bedrock-camp-compat-ByR2ly4i.js`).then(e=>e.o),"./built-in/bedrock-camp-extra-models.ts":()=>import(`./bedrock-camp-extra-models-DIuCBjcJ.js`).then(e=>e.n),"./built-in/bedrock-camp.ts":()=>import(`./bedrock-camp-CBP41h6t.js`),"./built-in/local-llm.ts":()=>import(`./local-llm-BblvgE13.js`).then(e=>e.n)}),o=Object.assign({"/packages/webapp/providers/adobe.ts":()=>import(`./adobe-CMMbs-uB.js`),"/packages/webapp/providers/cerebras.ts":()=>import(`./cerebras-CLDfgkgy.js`),"/packages/webapp/providers/github-copilot.ts":()=>import(`./github-copilot-DzY0_cZO.js`),"/packages/webapp/providers/github.ts":()=>import(`./github-B9zmCrJs.js`),"/packages/webapp/providers/openai-codex.ts":()=>import(`./openai-codex-BRVnsck1.js`),"/packages/webapp/providers/openrouter-free.ts":()=>import(`./openrouter-free-D_agjxS6.js`),"/packages/webapp/providers/openrouter-models.ts":()=>import(`./openrouter-models-RwlwKz0P.js`),"/packages/webapp/providers/openrouter-oauth.ts":()=>import(`./openrouter-oauth-Dol2vy8U.js`),"/packages/webapp/providers/openrouter.ts":()=>import(`./openrouter-CU8FE73y.js`),"/packages/webapp/providers/xai-grok-errors.ts":()=>import(`./xai-grok-errors-ByEMMSoz.js`),"/packages/webapp/providers/xai-grok.ts":()=>import(`./xai-grok-Ch8-vKVa.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 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-BAGLwgqY.js";import{t as n}from"./logger-DDBAeTLF.js";import{n as r}from"./utf16-clip-CGL7omVm.js";import{D as i,O as a,T as o,m as s}from"./account-store-BZBj_ntG.js";import{t as c}from"./llm-session-id-bZQs6gBN.js";import{i as l,t as u}from"./icons-BJTFywJo.js";var d=e({lucideIconNames:()=>g,pickLucideIcon:()=>_,quickLabel:()=>p}),f=n(`quick-llm`);async function p(e){let n=s();if(!n)return f.debug(`No API key for active provider — skipping`),null;let o=a(),c=i(),l;if(l=e.modelId?x(o,e.modelId)??x(o,c):v(o,c),!l)return f.debug(`No model available for provider`,{providerId:o}),null;let u=r(e.prompt),d=e.system===void 0?void 0:r(e.system),p={role:`user`,content:u,timestamp:Date.now()},m={};l.provider===`adobe`&&(m[`X-Session-Id`]=C());try{let r=(await t(l,{systemPrompt:d,messages:[p]},{apiKey:n,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(m).length>0?m:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return r.length>0?r:null}catch(e){return f.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}var m=null;function h(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 g(){return m||=Object.keys(l).map(h).sort(),m}async function _(e){let t=g(),n=await(e.labelFn??p)({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 u(r)?r:null}function v(e,t){let n=o(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=b(r.id),a=n.filter(e=>y(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function y(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 b(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 x(e,t){return o(e).find(e=>e.id===t)}var S=`ui-quick-llm`;function C(){return c(S)}export{d as n,p as t};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./compat-BAGLwgqY.js";import{t as n}from"./logger-DDBAeTLF.js";import{n as r}from"./utf16-clip-CGL7omVm.js";import{D as i,O as a,T as o,m as s}from"./account-store-BZTlSap7.js";import{t as c}from"./llm-session-id-bZQs6gBN.js";import{i as l,t as u}from"./icons-BJTFywJo.js";var d=e({lucideIconNames:()=>g,pickLucideIcon:()=>_,quickLabel:()=>p}),f=n(`quick-llm`);async function p(e){let n=s();if(!n)return f.debug(`No API key for active provider — skipping`),null;let o=a(),c=i(),l;if(l=e.modelId?x(o,e.modelId)??x(o,c):v(o,c),!l)return f.debug(`No model available for provider`,{providerId:o}),null;let u=r(e.prompt),d=e.system===void 0?void 0:r(e.system),p={role:`user`,content:u,timestamp:Date.now()},m={};l.provider===`adobe`&&(m[`X-Session-Id`]=C());try{let r=(await t(l,{systemPrompt:d,messages:[p]},{apiKey:n,maxTokens:e.maxTokens??60,temperature:e.temperature??.3,signal:e.signal,headers:Object.keys(m).length>0?m:void 0})).content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim();return r.length>0?r:null}catch(e){return f.debug(`Quick label call failed`,{error:e instanceof Error?e.message:String(e)}),null}}var m=null;function h(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 g(){return m||=Object.keys(l).map(h).sort(),m}async function _(e){let t=g(),n=await(e.labelFn??p)({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 u(r)?r:null}function v(e,t){let n=o(e);if(n.length===0)return;let r=n.find(e=>e.id===t)??n[0],i=b(r.id),a=n.filter(e=>y(e,r,i));return a.length===0?r:(a.sort((e,t)=>(e.cost?.input??0)-(t.cost?.input??0)),a[0])}function y(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 b(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 x(e,t){return o(e).find(e=>e.id===t)}var S=`ui-quick-llm`;function C(){return c(S)}export{d as n,p 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-BfDpFkW3.js";import{t as a}from"./src-CUSndb9K.js";import{t as o}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{i as s,n as c,r as l,t as u}from"./node-builtins-CDetdLPH.js";import{c as d,n as f,o as p,t as m}from"./require-guards-dUdxJmkR.js";import{t as h}from"./tmpdir-env-ate4iNcK.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./realm-sync-transport-Ble3Euu9.js";import{t as S}from"./realm-browser-fetch-V3uggGbM.js";function C(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function w(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const T={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:C,pathToFileURL:w};function E(e,t){return Object.assign(TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function D(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function O(e,t=`path`){if(typeof e==`string`)return e;if(D(e)){if(e.protocol!==`file:`)throw Object.assign(TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return T.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw E(t,e)}function ee(e,t){let n=[...t];switch(e){case`path`:n[0]=O(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=O(n[0]));break;case`pair`:n[0]=O(n[0],`src`),n[1]=O(n[1],`dest`);break;case`second`:n[1]=O(n[1])}return n}function te(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];!a||typeof o!=`function`||(r[i]=((...t)=>{let r;try{r=ee(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function k(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const ne=new Set([`stat`,`lstat`]);function re(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function ie(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function ae(e,t){return ne.has(e)?k(t):t}function oe(e,t,n,r){let i=e===`readFile`?re(r):r;return t.apply(n,i)}function se(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return ae(n,await oe(n,r,e,t))}catch(e){throw ie(e)}}:r);return t}function ce(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(oe(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,ae(e,t)),t=>r(e!==`exists`&&ie(t)))})}function le(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function ue(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function de(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function fe(){return{readSync:e=>{throw le(`read`,e)},writeSync:e=>{throw le(`write`,e)}}}function pe(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw le(`read`,n);let o=ue(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw le(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=ue(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(de(c)),c.length}}}function A(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 me(e){let t=A(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function j(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function he(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ge(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 _e=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=A(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),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=me(A(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=me(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=A(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=[...A(e.startsWith(`/`)?e:`${me(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=me(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(A(e))?.partial===!0}hasPartialWithin(e){let t=A(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=A(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=me(n)}}readFile(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw j(t);if(n.truncated)throw he(t);return n.content}writeFile(e,t){this.touched=!0;let n=A(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=A(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n)throw j(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t,!0);if(!n)throw j(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=A(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw j(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=A(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=me(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw j(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=A(e),r=this.tree.get(n);if(!r)throw j(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=A(e),r=this.tree.get(n);if(!r||r.isDirectory)throw j(n);if(r.truncated)throw he(n);let i=A(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=A(e),r=this.tree.get(n);if(!r)throw j(n);let i=A(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=A(e),n=this.tree.get(t);if(!n)throw j(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=A(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=A(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=A(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&&!ge(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 ve(){return globalThis.Buffer}function ye(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function be(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function xe(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function Se(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function Ce(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 we(e,t){let n=Ce(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw xe(t,e);return!1}function Te(e,t,n){let r=Ce(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw xe(n,t)}function Ee(e){return typeof e==`string`?e:be(We(e))}function De(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ve();return n?n.from(e):e}function Oe(e){return e===null?null:typeof e==`string`?e:e?.encoding}function ke(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function Ae(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(!we(e,`read`))return n.readFile(e,r);let i=Oe(r);if(i===null||i===`buffer`){let e=ve(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>we(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(Ee(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(be(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=Te(t,e,`append`);if(!i)return n.appendFile(e,r);i(Ee(r))},e.access=async e=>{if(!Se(e))return n.access(e)},e.exists=async e=>Se(e)||n.exists(e),e.stat=async e=>Se(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function je(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=Oe(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ve();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 Ae(p,n),te(p,Me,{promises:!0}),p.promises=se(p),ce(p),p}const Me={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},Ne={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function M(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Pe(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 Fe(e,t,n){let r=t;if(!(!r?.rename||!r.rmdir||!r.rm||!e.hasPartialWithin(n)))return r}function Ie(e,t,n){y(e,t);try{n()}finally{e.invalidate()}}function Le(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:Fe(t,n,e);return i?(Ie(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Pe(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 M(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw M(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw M(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw M(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=Fe(t,n,a);if(d){Ie(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw M(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw M(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw M(`ENOENT`,a,`rename`)}}}function Re(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)=>we(e,`read`)?De(t.readStdinBytes(),Oe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=Te(t,e,`write`);i?i(Ee(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=Te(t,e,`append`);i?i(Ee(r)):n.appendFileSync(e,r)},e.existsSync=e=>Se(e)||n.existsSync(e),e.accessSync=e=>{Se(e)||n.accessSync(e)},e.statSync=e=>Se(e)?ke():n.statSync(e),e.lstatSync=e=>Se(e)?ke():n.lstatSync(e),Object.assign(e,pe(t))}function ze(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){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Ve(e,t,n,r,i){let a=e?.utimes;if(!(!e||typeof a!=`function`||t.isTombstoned(n)))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function He(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw M(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Be(a,`atime`),c=Be(o,`mtime`),l=e(i);if(!t(l))throw M(`ENOENT`,l,`utime`);Ve(n,r,l,s,c)}}}function Ue(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 ze(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 ze(n,[],t.readdir(n),r)}}function We(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 Ge(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ke(e,t,n,r,i){function a(e){return A(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)=>Ge(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 Ue(e,n,t))p(f(t,i),f(r,i))}let m={...Le({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)),Oe(t))},writeFileSync(e,t){s(a(e),We(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=We(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 M(`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 M(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Ue(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},...He(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},h=Object.assign(m,fe());Re(h,r),te(h,Ne);let g=h.existsSync;return h.existsSync=e=>{try{return g(e)}catch{return!1}},h}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});function Ye(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-VBKLWgCV.js";import{t as a}from"./src-CUSndb9K.js";import{t as o}from"./buffer-B5d1xHaH.js";import"./buffer-polyfill-BwLbCySD.js";import{i as s,n as c,r as l,t as u}from"./node-builtins-CDetdLPH.js";import{c as d,n as f,o as p,t as m}from"./require-guards-dUdxJmkR.js";import{t as h}from"./tmpdir-env-ate4iNcK.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./realm-sync-transport-Ble3Euu9.js";import{t as S}from"./realm-browser-fetch-V3uggGbM.js";function C(e){let t=typeof e==`string`?e:e.href;if(!t.startsWith(`file:`))throw TypeError(`fileURLToPath: not a file URL`);let n=new URL(t);if(n.hostname!==``&&n.hostname!==`localhost`)throw Object.assign(TypeError(`File URL host must be "localhost" or empty on posix`),{code:`ERR_INVALID_FILE_URL_HOST`});if(/%2f/i.test(n.pathname))throw Object.assign(TypeError(`File URL path must not include encoded / characters`),{code:`ERR_INVALID_FILE_URL_PATH`});return decodeURIComponent(n.pathname)}function w(e){let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return new URL(`file://${t}`)}const T={URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams,fileURLToPath:C,pathToFileURL:w};function E(e,t){return Object.assign(TypeError(`The "${e}" argument must be of type string or an instance of Buffer or URL. Received ${t===null?`null`:typeof t}`),{code:`ERR_INVALID_ARG_TYPE`})}function D(e){return typeof e==`object`&&!!e&&typeof e.href==`string`&&typeof e.protocol==`string`}function O(e,t=`path`){if(typeof e==`string`)return e;if(D(e)){if(e.protocol!==`file:`)throw Object.assign(TypeError(`The URL must be of scheme file`),{code:`ERR_INVALID_URL_SCHEME`});return T.fileURLToPath(e.href)}if(e instanceof Uint8Array)return new TextDecoder().decode(e);throw E(t,e)}function ee(e,t){let n=[...t];switch(e){case`path`:n[0]=O(n[0]);break;case`fd`:typeof n[0]!=`number`&&(n[0]=O(n[0]));break;case`pair`:n[0]=O(n[0],`src`),n[1]=O(n[1],`dest`);break;case`second`:n[1]=O(n[1])}return n}function te(e,t,n={}){let r=e;for(let i of Object.keys(t)){let a=t[i],o=r[i];!a||typeof o!=`function`||(r[i]=((...t)=>{let r;try{r=ee(a,t)}catch(e){if(n.promises)return Promise.reject(e);throw e}return o.apply(e,r)}))}}function k(e){let t=!!e.isDirectory,n=e.mtimeMs??0;return{isFile:()=>!!e.isFile,isDirectory:()=>t,isSymbolicLink:()=>!!e.isSymbolicLink,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isFIFO:()=>!1,isSocket:()=>!1,size:e.size??0,mode:e.mode??(t?16877:33188),mtimeMs:n,mtime:new Date(n)}}const ne=new Set([`stat`,`lstat`]);function re(e){if(e.length===0)return e;if(e.length===1||e[1]===void 0)return[e[0],null];let t=e[1];return typeof t==`object`&&t&&!ArrayBuffer.isView(t)&&t.encoding===void 0?[e[0],{...t,encoding:null}]:e}function ie(e){if(e instanceof Error&&e.code===void 0){let t=/^(E[A-Z]+)\b/.exec(e.message)?.[1];t&&Object.assign(e,{code:t})}return e}function ae(e,t){return ne.has(e)?k(t):t}function oe(e,t,n,r){let i=e===`readFile`?re(r):r;return t.apply(n,i)}function se(e){let t={};for(let[n,r]of Object.entries(e))n!==`promises`&&(t[n]=typeof r==`function`?async(...t)=>{try{return ae(n,await oe(n,r,e,t))}catch(e){throw ie(e)}}:r);return t}function ce(e){let t=e;for(let[e,n]of Object.entries(t))e!==`promises`&&typeof n==`function`&&(t[e]=function(...t){let r=t[t.length-1];if(typeof r!=`function`)return n.apply(this,t);t.pop();let i;try{i=Promise.resolve(oe(e,n,this,t))}catch(e){i=Promise.reject(e)}i.then(t=>e===`exists`?r(t):r(null,ae(e,t)),t=>r(e!==`exists`&&ie(t)))})}function le(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function ue(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function de(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function fe(){return{readSync:e=>{throw le(`read`,e)},writeSync:e=>{throw le(`write`,e)}}}function pe(e){let t=0;return{readSync(n,r,i,a){if(n!==0)throw le(`read`,n);let o=ue(r),s=typeof i==`object`&&i?i:{offset:i,length:a},c=s.offset??0,l=s.length??o.length-c,u=e.readStdinBytes(),d=Math.max(0,Math.min(l,u.length-t));return o.set(u.subarray(t,t+d),c),t+=d,d},writeSync(t,n,r,i){let a=t===1?e.writeStdout:t===2?e.writeStderr:void 0;if(!a)throw le(`write`,t);if(typeof n==`string`)return a(n),new TextEncoder().encode(n).length;if(!ArrayBuffer.isView(n))throw TypeError(`writeSync: data must be a string or buffer`);let o=ue(n),s=typeof r==`number`?r:0,c=o.subarray(s,i===void 0?void 0:s+i);return a(de(c)),c.length}}}function A(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 me(e){let t=A(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function j(e){return Object.assign(Error(`ENOENT: no such file or directory, '${e}'`),{code:`ENOENT`})}function he(e){return Object.assign(Error(`ENOSYNC: file too large for sync access, '${e}' — use async readFile() instead`),{code:`ENOSYNC`})}function ge(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 _e=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=A(t.path);this.tree.set(e,{content:t.content,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink,symlinkTarget:t.symlinkTarget,truncated:t.truncated,size:t.size,...t.partial?{partial:!0}:{}}),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=me(A(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=me(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=A(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=[...A(e.startsWith(`/`)?e:`${me(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=me(e);t!==`/`&&(this.tree.has(t)||this.mkdir(t,!0,!0))}isPartial(e){return this.tree.get(A(e))?.partial===!0}hasPartialWithin(e){let t=A(e),n=t===`/`?`/`:`${t}/`;for(let[e,r]of this.tree)if(r.partial&&(e===t||e.startsWith(n)))return!0;return!1}commitWrite(e,t){this.writeFile(e,t);let n=A(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=me(n)}}readFile(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t)?.entry;if(!n||n.isDirectory)throw j(t);if(n.truncated)throw he(t);return n.content}writeFile(e,t){this.touched=!0;let n=A(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=A(e);return this.tree.has(t)}stat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t);if(!n)throw j(t);return this.toStat(n.entry)}lstat(e){this.touched=!0;let t=A(e),n=this.resolveEntry(t,!0);if(!n)throw j(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=A(e),n=this.resolveEntry(t);if(!n?.entry.isDirectory)throw j(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=A(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=me(r);if(i!==`/`&&!this.tree.has(i)){if(!t)throw j(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=A(e),r=this.tree.get(n);if(!r)throw j(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=A(e),r=this.tree.get(n);if(!r||r.isDirectory)throw j(n);if(r.truncated)throw he(n);let i=A(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=A(e),r=this.tree.get(n);if(!r)throw j(n);let i=A(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=A(e),n=this.tree.get(t);if(!n)throw j(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=A(e);this.tombstones.add(n),t&&this.removedDirs.add(n)}isTombstoned(e){let t=A(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=A(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&&!ge(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 ve(){return globalThis.Buffer}function ye(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function be(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t}function xe(e,t){return Object.assign(Error(`EBADF: bad file descriptor, ${e} ${String(t)}`),{code:`EBADF`})}function Se(e){return e===`/dev/stdin`||e===`/dev/stdout`||e===`/dev/stderr`}function Ce(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 we(e,t){let n=Ce(e);if(n===0)return!0;if(n!==void 0||typeof e==`number`)throw xe(t,e);return!1}function Te(e,t,n){let r=Ce(t);if(r===1)return e.writeStdout;if(r===2)return e.writeStderr;if(r!==void 0||typeof t==`number`)throw xe(n,t)}function Ee(e){return typeof e==`string`?e:be(We(e))}function De(e,t){if(t===`utf8`||t===`utf-8`)return new TextDecoder().decode(e);let n=ve();return n?n.from(e):e}function Oe(e){return e===null?null:typeof e==`string`?e:e?.encoding}function ke(){return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,isCharacterDevice:()=>!0,size:0}}function Ae(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(!we(e,`read`))return n.readFile(e,r);let i=Oe(r);if(i===null||i===`buffer`){let e=ve(),n=t.readStdinBytes();return e?e.from(n):n}return new TextDecoder().decode(t.readStdinBytes())},e.readFileBinary=async e=>we(e,`read`)?t.readStdinBytes():n.readFileBinary(e),e.writeFile=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(Ee(r)),!0):n.writeFile(e,r)},e.writeFileBinary=async(e,r)=>{let i=Te(t,e,`write`);return i?(i(be(r)),!0):n.writeFileBinary(e,r)},e.appendFile=async(e,r)=>{let i=Te(t,e,`append`);if(!i)return n.appendFile(e,r);i(Ee(r))},e.access=async e=>{if(!Se(e))return n.access(e)},e.exists=async e=>Se(e)||n.exists(e),e.stat=async e=>Se(e)?{isFile:!0,isDirectory:!1,size:0}:n.stat(e)}function je(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=Oe(n);if(r===null||r===`buffer`){let n=await e.call(`vfs`,`readFileBinary`,[t]),r=ve();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 Ae(p,n),te(p,Me,{promises:!0}),p.promises=se(p),ce(p),p}const Me={readFile:`fd`,readFileBinary:`fd`,writeFile:`fd`,writeFileBinary:`fd`,appendFile:`fd`,cp:`pair`,rm:`path`,readDir:`path`,readdir:`path`,exists:`path`,stat:`path`,mkdir:`path`,mkdtemp:`path`,rename:`pair`,access:`path`,unlink:`path`,rmdir:`path`,copyFile:`pair`,fetchToFile:`second`},Ne={readFileSync:`fd`,writeFileSync:`fd`,appendFileSync:`fd`,truncateSync:`path`,existsSync:`path`,accessSync:`path`,mkdirSync:`path`,statSync:`path`,lstatSync:`path`,realpathSync:`path`,readdirSync:`path`,copyFileSync:`pair`,cpSync:`pair`,chmodSync:`path`,utimesSync:`path`,mkdtempSync:`path`,rmSync:`path`,rmdirSync:`path`,unlinkSync:`path`,renameSync:`pair`};function M(e,t,n=``){return Object.assign(Error(`${e}: sync-fs, ${n?`${n} `:``}'${t}'`),{code:e})}function Pe(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 Fe(e,t,n){let r=t;if(!(!r?.rename||!r.rmdir||!r.rm||!e.hasPartialWithin(n)))return r}function Ie(e,t,n){y(e,t);try{n()}finally{e.invalidate()}}function Le(e){let{syncFs:t,bridge:n,resolve:r,existsResolved:i,lstatResolved:a,statResolved:o,readBytes:s,writeThrough:c,persistDelete:l}=e,u=(e,r)=>{let i=r?.requireFile?void 0:Fe(t,n,e);return i?(Ie(t,i,()=>r?.recursive?i.rm(e):i.rmdir(e)),!0):Pe(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 M(`ENOENT`,n,`rm`)},rmdirSync(e,t){let n=r(e);if(i(n)&&!a(n).isDirectory)throw M(`ENOTDIR`,n,`rmdir`);if(!u(n,{recursive:t?.recursive===!0}))throw M(`ENOENT`,n,`rmdir`)},unlinkSync(e){let t=r(e);if(!u(t,{requireFile:!0}))throw M(`ENOENT`,t,`unlink`)},renameSync(e,i){let a=r(e),l=r(i),d=Fe(t,n,a);if(d){Ie(t,d,()=>d.rename(a,l));return}try{t.rename(a,l);return}catch(e){if(e?.code!==`ENOENT`)throw e}if(!n||t.isTombstoned(a))throw M(`ENOENT`,a,`rename`);if(o(a).isDirectory)throw M(`EISDIR`,a,`rename`);if(c(l,s(a)),!u(a,{requireFile:!0}))throw M(`ENOENT`,a,`rename`)}}}function Re(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)=>we(e,`read`)?De(t.readStdinBytes(),Oe(r)):n.readFileSync(e,r),e.writeFileSync=(e,r)=>{let i=Te(t,e,`write`);i?i(Ee(r)):n.writeFileSync(e,r)},e.appendFileSync=(e,r)=>{let i=Te(t,e,`append`);i?i(Ee(r)):n.appendFileSync(e,r)},e.existsSync=e=>Se(e)||n.existsSync(e),e.accessSync=e=>{Se(e)||n.accessSync(e)},e.statSync=e=>Se(e)?ke():n.statSync(e),e.lstatSync=e=>Se(e)?ke():n.lstatSync(e),Object.assign(e,pe(t))}function ze(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){if(e instanceof Date)return e.getTime();if(typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e)))return Number(e)*1e3;if(typeof e==`number`){if(!Number.isFinite(e))throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`});return e<0?Date.now():e*1e3}throw Object.assign(TypeError(`The "${t}" argument must be of type number, string or Date`),{code:`ERR_INVALID_ARG_TYPE`})}function Ve(e,t,n,r,i){let a=e?.utimes;if(!(!e||typeof a!=`function`||t.isTombstoned(n)))try{a.call(e,n,r,i)}catch(e){let r=e?.code;if(r===`ENOSYS`||r===`ENOENT`&&t.exists(n))return;throw e}}function He(e,t,n,r){return{chmodSync(n){let r=e(n);if(!t(r))throw M(`ENOENT`,r,`chmod`)},utimesSync(i,a,o){let s=Be(a,`atime`),c=Be(o,`mtime`),l=e(i);if(!t(l))throw M(`ENOENT`,l,`utime`);Ve(n,r,l,s,c)}}}function Ue(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 ze(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 ze(n,[],t.readdir(n),r)}}function We(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 Ge(e,t,n,r,i){t?(t.writeFile(r,i),e.commitWrite(r,i)):(e.writeFile(r,i),n?.write?.(r,i))}function Ke(e,t,n,r,i){function a(e){return A(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)=>Ge(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 Ue(e,n,t))p(f(t,i),f(r,i))}let m={...Le({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)),Oe(t))},writeFileSync(e,t){s(a(e),We(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=We(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 M(`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 M(`ENOENT`,t,`realpath`);return t},readdirSync(t){return Ue(e,n,a(t))},copyFileSync(e,t){s(a(t),o(a(e)))},cpSync(e,t){p(a(e),a(t))},...He(a,c,n,e),mkdtempSync(t){return e.mkdtemp(a(t))}},h=Object.assign(m,fe());Re(h,r),te(h,Ne);let g=h.existsSync;return h.existsSync=e=>{try{return g(e)}catch{return!1}},h}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});function Ye(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 N={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 Xe(e){let t=e.isTTY&&!e.noColor,n=e=>n=>t?`${e}${n}${N.reset}`:String(n);return{enabled:t,green:n(N.green),red:n(N.red),yellow:n(N.yellow),gray:n(N.gray),bold:n(N.bold),cyan:n(N.cyan),dim:n(N.dim)}}const Ze=/\u001b\[[0-9;]*m/g;function Qe(e){return e.replace(Ze,``)}function $e(e){return Qe(e).length}function et(e,t){let n=String(e??``);return t<=0?``:$e(n)<=t?n:t<=1?n.slice(0,t):`${Qe(n).slice(0,t-1)}…`}function tt(e,t){let n=String(e??``),r=$e(n);return r===t?n:r>t?et(n,t):n+` `.repeat(t-r)}function nt(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,$e(e))}r[i]=t}return e.map(e=>r.map((t,n)=>tt(n<e.length?String(e[n]??``):``,t)).join(` `).replace(/\s+$/,``)).join(`
4
4
  `)}function rt(e){return e instanceof Date?e:new Date(e)}function it(e){return e<10?`0${e}`:String(e)}function at(e,t=`short`){let n=rt(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()}-${it(n.getMonth()+1)}-${it(n.getDate())}`}const ot={trunc:et,col:tt,table:nt,date:at};var P=class extends Error{actual;expected;operator;generatedMessage;code;constructor(e={}){let t=!e.message;super(e.message||`${st(e.actual)} ${e.operator||`!=`} ${st(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 st(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 F(e,t){return e instanceof Error?e:typeof e==`string`?new P({message:e}):t()}function ct(e,t,n,r){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ut(e[i],t[i],n,r))return!1;return!0}function lt(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)||!ut(Reflect.get(e,a),Reflect.get(t,a),n,r))return!1;return!0}function ut(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)?ct(e,t,n,r):lt(i,a,n,r):!1)}function dt(e,t){try{if(e instanceof t)return!0}catch{}try{return!!t(e)}catch{return!1}}function ft(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 pt(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`?dt(e,t):t&&typeof t==`object`?!e||typeof e!=`object`?!1:ft(e,t):!1}function mt(e){let t=(e,t)=>{if(!e)throw F(t,()=>new P({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 F(n,()=>new P({actual:e,expected:t,operator:`strictEqual`}))},i=(t,n,i)=>{if(e){r(t,n,i);return}if(t!=n)throw F(i,()=>new P({actual:t,expected:n,operator:`==`}))},a=(e,t,n)=>{if(Object.is(e,t))throw F(n,()=>new P({actual:e,expected:t,operator:`notStrictEqual`}))},o=(t,n,r)=>{if(e){a(t,n,r);return}if(t==n)throw F(r,()=>new P({actual:t,expected:n,operator:`!=`}))},s=(e,t,n)=>{if(!ut(e,t,!0,new WeakMap))throw F(n,()=>new P({actual:e,expected:t,operator:`deepStrictEqual`}))},c=(t,n,r)=>{if(e){s(t,n,r);return}if(!ut(t,n,!1,new WeakMap))throw F(r,()=>new P({actual:t,expected:n,operator:`deepEqual`}))},l=(e,t,n)=>{if(ut(e,t,!0,new WeakMap))throw F(n,()=>new P({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(ut(t,n,!1,new WeakMap))throw F(r,()=>new P({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 F(typeof t==`string`?t:n,()=>new P({message:`Missing expected exception`,operator:`throws`}));if(!(typeof t==`string`||t instanceof Error)&&!pt(r,t))throw F(n,()=>new P({message:`Got unwanted exception`,actual:r,operator:`throws`}))},n.doesNotThrow=(e,t)=>{try{e()}catch(e){throw F(t,()=>new P({message:`Got unwanted exception`,actual:e,operator:`doesNotThrow`}))}},n.fail=e=>{throw F(e,()=>new P({message:`Failed`,operator:`fail`}))},n.AssertionError=P,n}const ht=mt(!0);ht.strict=ht;const gt=mt(!1);gt.strict=ht;function _t(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 vt=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}},yt=class extends vt{read(){return null}destroy(){return this.closeOnDestroy()}},bt=class extends vt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}destroy(){return this.closeOnDestroy()}},xt=class extends vt{write(e,t,n){return n&&queueMicrotask(n),!0}end(e){return e&&queueMicrotask(e),this}read(){return null}destroy(){return this.closeOnDestroy()}};const St={Readable:yt,Writable:bt,Transform:xt,PassThrough:class extends xt{},Stream:vt};function Ct(e,t){return Object.assign(TypeError(t),{code:e})}const wt=e=>e.startsWith(`--`)&&e.length>2,Tt=e=>/^-[^-]/.test(e);function Et(e,t,n){let r=[];for(let i=1;i<e.length;i++)if(t[n(e[i])]?.type!==`string`||i===e.length-1)r.push(`-${e[i]}`);else{r.push(`-${e.slice(i)}`);break}return r}function Dt(e,t,n){let r=[],i=[...e],a=-1,o=0,s=(e,t,n,r)=>({kind:`option`,name:e,rawName:t,index:a,value:n,inlineValue:r}),c=e=>t[e]?.type===`string`;for(;i.length>0;){let e=i.shift(),l=i[0];if(o>0?o--:a++,e===`--`){r.push({kind:`option-terminator`,index:a});for(let e of i)r.push({kind:`positional`,index:++a,value:e});break}if(Tt(e)&&e.length===2){let t=n(e[1]);c(t)&&l!==void 0?(i.shift(),r.push(s(t,e,l,!1)),a++):r.push(s(t,e,void 0,void 0));continue}if(Tt(e)){let a=n(e[1]);if(c(a))r.push(s(a,`-${e[1]}`,e.slice(2),!0));else{let r=Et(e,t,n);i.unshift(...r),o=r.length}continue}if(wt(e)){let t=e.indexOf(`=`);if(t!==-1){r.push(s(e.slice(2,t),e.slice(0,t),e.slice(t+1),!0));continue}let n=e.slice(2);c(n)&&l!==void 0?(i.shift(),r.push(s(n,e,l,!1)),a++):r.push(s(n,e,void 0,void 0));continue}r.push({kind:`positional`,index:a,value:e})}return r}function Ot(e,t){let n=t?.short?`'-${t.short}, --${e.name}'`:`'--${e.name}'`;if(!t)throw Ct(`ERR_PARSE_ARGS_UNKNOWN_OPTION`,`Unknown option '${e.rawName}'${e.rawName.startsWith(`--`)?``:`. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- "-"'`}`);if(t.type===`string`&&typeof e.value!=`string`)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n.replace(/'$/,` <value>'`)} argument missing`);if(t.type===`boolean`&&e.value!==void 0)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option ${n} does not take an argument`);let r=e.value!==void 0&&e.value.length>1&&e.value[0]===`-`;if(t.type===`string`&&e.inlineValue===!1&&r)throw Ct(`ERR_PARSE_ARGS_INVALID_OPTION_VALUE`,`Option '${e.rawName}' argument is ambiguous.\nDid you forget to specify the option argument for '${e.rawName}'?\nTo specify an option argument starting with a dash use '${e.rawName.startsWith(`--`)?`${e.rawName}=-XYZ`:`--${e.name}=-XYZ' or '${e.rawName}-XYZ`}'.`)}function kt(e,t,n,r){if(!r){e[t]=n;return}let i=e[t];e[t]=Array.isArray(i)?[...i,n]:[n]}function At(e,t,n){let r=e.slice(3);return n&&e.startsWith(`no-`)?{name:r,negated:!0}:{name:e,negated:!1}}function jt(e,t,n,r,i){let{name:a,negated:o}=At(t.name,n,i);t.name=a;let s=n[a];r&&Ot(t,o&&s?.type!==`boolean`?void 0:s),kt(e,a,o?!1:t.value??!0,s?.multiple===!0)}function Mt(e={},t=()=>[]){let n=e.args??t(),r=e.options??{},i=e.strict??!0,a=e.allowPositionals??!i,o=e.allowNegative??!1,s=e=>Object.keys(r).find(t=>r[t].short===e)??e,c=Object.create(null),l=[],u=Dt(n,r,s);for(let e of u){if(e.kind===`positional`){if(i&&!a)throw Ct(`ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL`,`Unexpected argument '${e.value}'. This command does not take positional arguments`);l.push(e.value);continue}e.kind===`option`&&jt(c,e,r,i,o)}for(let[e,t]of Object.entries(r))t.default!==void 0&&c[e]===void 0&&(c[e]=t.default);return e.tokens?{values:c,positionals:l,tokens:u}:{values:c,positionals:l}}const Nt=Symbol.for(`nodejs.util.inspect.custom`),Pt=Symbol.for(`nodejs.util.promisify.custom`);function Ft(e){return`'${e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`)}'`}function It(e){if(e===null)return`null`;let t=typeof e;if(t===`string`)return Ft(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 Lt(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 Rt(e,t,n){if(Array.isArray(e))return e.length===0?`[]`:`[ ${e.map(e=>zt(e,t+1,n)).join(`, `)} ]`;if(e instanceof Map){let r=[...e].map(([e,r])=>`${zt(e,t+1,n)} => ${zt(r,t+1,n)}`);return`Map(${e.size}) {${r.length?` ${r.join(`, `)} `:``}}`}if(e instanceof Set){let r=[...e].map(e=>zt(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:Ft(r)}: ${zt(e[r],t+1,n)}`).join(`, `)} }`}function zt(e,t,n){let r=It(e);if(r!==null)return r;let i=e,a=Lt(i);if(a!==null)return a;let o=i[Nt];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 Rt(i,t,n)}finally{n.seen.delete(e)}}function Bt(e,t={}){let n=t.depth===void 0?2:t.depth;return zt(e,0,{seen:new Set,maxDepth:n,opts:t})}function Vt(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):Bt(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++,Bt(i,{depth:4});case`%O`:return n.i++,Bt(i,{depth:null});case`%c`:return n.i++,``;default:return e}}function Ht(e,...t){let n=t[0];if(typeof n!=`string`)return t.map(e=>typeof e==`string`?e:Bt(e)).join(` `);let r={i:1},i=n.replace(/%[sdifjoOc%]/g,n=>Vt(n,t,r,e));for(;r.i<t.length;r.i++){let e=t[r.i];i+=` ${typeof e==`string`?e:Bt(e)}`}return i}function Ut(...e){return Ht({},...e)}function Wt(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 Gt(e){if(typeof e!=`function`)throw TypeError(`The "original" argument must be of type function`);let t=e[Pt];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 Kt(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 qt=Bt;qt.custom=Nt;const Jt=Gt;Jt.custom=Pt;function Yt(e,t=()=>[]){return{parseArgs:e=>Mt(e,t),format:Ut,formatWithOptions:Ht,inspect:qt,inherits:Wt,promisify:Jt,deprecate:Kt(e)}}const Xt=Yt(()=>{});let Zt=1;function Qt(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 $t(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 en(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw $t(`options.env`,`object`,e);let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r!=`string`)throw $t(`options.env[${n}]`,`string`,r);t[n]=r}return t}function tn(e){if(e!==void 0){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&typeof e.href==`string`)try{return T.fileURLToPath(e.href)}catch{throw $t(`options.cwd`,`string or an instance of URL (file:)`,e)}throw $t(`options.cwd`,`string or an instance of URL`,e)}}function nn(e,t){return t===void 0||t===`utf8`||t===`utf-8`?e:t===`buffer`||t===null?_t(e):_t(e).toString(t)}function rn(e,t){if(e.length===0)return nn(``,t);if(typeof e[0]==`string`)return e.join(``);let n=globalThis.Buffer;return n?n.concat(e):e[0]}function an(e,t,n){t.length>0&&e.emit(`data`,nn(t,n)),e.readable=!1,e.emit(`end`)}function on(e){let t=e=>{typeof e==`function`&&queueMicrotask(e)};return{writable:!0,write(n,r,i){return e.stdin.write(Qt(n)),t(typeof r==`function`?r:i),!0},end(n,r,i){n!==void 0&&typeof n!=`function`&&e.stdin.write(Qt(n)),e.stdin.end(),this.writable=!1,t(typeof n==`function`?n:typeof r==`function`?r:i)}}}var sn=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=Zt++,this.spawnfile=n,this.spawnargs=r,this.stdout=new yt,this.stderr=new yt,this.stdin=on(e),e.done.then(e=>this.finish(e,t),e=>this.emit(`error`,e instanceof Error?e:Error(String(e))))}finish(e,t){an(this.stdout,e.stdout,t),an(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 cn(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=tn(e.cwd),n=en(e.env);return{...e.input===void 0?{}:{input:Qt(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=nn(s.stdout,o),l=nn(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:Zt++})},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=Zt++,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=nn(``,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=nn(d.stdout,c),p=nn(d.stderr,c);return{pid:l,status:d.exitCode,signal:null,stdout:f,stderr:p,output:[null,f,p]}}}}function ln(e,t){let n=(t,n,r,i,a)=>{let o=tn(n.cwd),s=en(n.env),c={...o===void 0?{}:{cwd:o},...s===void 0?{}:{env:s}},l=e.start(t,c),u=new sn(l,r,i,a);return n.input!==void 0&&u.stdin.write(Qt(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,rn(i,t),rn(a,t))),e.once(`close`,(o,s)=>{let c=rn(i,t),l=rn(a,t);if(o===0){r(null,c,l);return}r(Object.assign(Error(`Command failed: ${n}\n${Qt(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=cn(t),d=(e,t)=>{Object.defineProperty(e,Pt,{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:sn}}function un(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var dn={exports:{}};
@@ -32,4 +32,4 @@ for (var __vm_i = 0; __vm_i < __vm_fns.length; __vm_i++) {
32
32
  `)){if(a.startsWith(`agent-session: `)){let e=a.slice(15),t=e.lastIndexOf(` `),i=t===-1?``:e.slice(0,t),o=t===-1?``:e.slice(t+1);if(i&&(o===`created`||o===`resumed`)){n=i,r=o;continue}}else if(a.startsWith(`agent-usage: `))try{let e=JSON.parse(a.slice(13));if(e&&typeof e.input==`number`&&typeof e.cost==`number`){i=e;continue}}catch{}a!==``&&t.push(a)}return{stderr:t.join(`
33
33
  `),sessionId:n,sessionStatus:r,usage:i}}function Xs(e,t){let n=t.cwd,r=async(t,r)=>{let i=r??{};if(i.resume===!0&&(i.session===void 0||i.session===``))return{finalText:``,exitCode:1,stderr:`agent: resume requires a session id`};let a=await e.spawn(Js(t,i,n)),o=typeof a.exitCode==`number`?a.exitCode:0,s=String(a.stdout??``).replace(/\n+$/,``),c=Ys(String(a.stderr??``).replace(/\n+$/,``));return{finalText:s,exitCode:o,stderr:c.stderr,...c.sessionId?{sessionId:c.sessionId,sessionStatus:c.sessionStatus}:{},...c.usage?{usage:c.usage}:{}}},i=(async(e,t)=>{let n=t??{},i=await r(e,n);if(i.exitCode!==0)throw Error(`agent: exited with code ${i.exitCode}${i.stderr?`: ${i.stderr}`:``}`);let a=i.finalText;if(n.schema)try{a=JSON.parse(i.finalText)}catch{throw Error(`agent: schema response was not valid JSON (exit ${i.exitCode}): ${i.finalText.slice(0,200)}`)}if(n.session!==void 0||n.resume===!0||n.envelope===!0){let e={output:a};return i.sessionId&&(e.sessionId=i.sessionId,e.sessionStatus=i.sessionStatus),i.usage&&(e.usage=i.usage),e}return a});return i.spawn=r,i}function $(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`&&typeof e.targetId==`string`)return e.targetId;throw TypeError(`browser: expected a tab handle or targetId string`)}function Zs(e){function t(t){return{...t,async update(n){let r={};return n.urlMatch!==void 0&&(r.urlMatch=n.urlMatch===null?null:n.urlMatch instanceof RegExp?n.urlMatch.source:n.urlMatch),n.filter!==void 0&&(r.filter=n.filter),e.call(`browser`,`wsUpdate`,[t.id,r])},async close(){return e.call(`browser`,`wsClose`,[t.id])}}}return{on(n,r={}){let i=$(n),a=r.urlMatch===void 0?void 0:r.urlMatch instanceof RegExp?r.urlMatch.source:r.urlMatch,o,s={filter(e){if(typeof e==`function`||typeof e==`string`)throw TypeError(`browser.websocket: filter must be a declarative JSON object, not a function or string`);return o=e,s},async forward(n){return t(await e.call(`browser`,`wsObserve`,[{targetId:i,urlMatch:a,filter:o,forward:n}]))}};return s},async list(){return e.call(`browser`,`wsList`,[])}}}async function Qs(e,t){if(!e&&!(t instanceof Request))return;let n=t instanceof Request?t:null,r=(e?.method??n?.method??`GET`).toUpperCase(),i={};if(e?.headers){if(e.headers instanceof Headers)e.headers.forEach((e,t)=>{i[t]=e});else if(Array.isArray(e.headers))for(let[t,n]of e.headers)i[t]=n;else Object.assign(i,e.headers)}else n&&n.headers.forEach((e,t)=>{i[t]=e});let a,o;if(r!==`GET`&&r!==`HEAD`&&e?.body!==void 0&&e?.body!==null&&e?.body!==``){let t=await $s(e.body);a=t.body,o=t.defaultContentType}return o&&!Object.keys(i).some(e=>e.toLowerCase()===`content-type`)&&(i[`Content-Type`]=o),{method:r,headers:i,body:a}}async function $s(e){if(typeof e==`string`)return{body:e};if(e instanceof URLSearchParams)return{body:e.toString(),defaultContentType:`application/x-www-form-urlencoded;charset=UTF-8`};if(e instanceof Blob)return{body:new Uint8Array(await e.arrayBuffer()),defaultContentType:e.type||`application/octet-stream`};if(e instanceof ArrayBuffer)return{body:new Uint8Array(e).slice(),defaultContentType:`application/octet-stream`};if(ArrayBuffer.isView(e))return{body:new Uint8Array(e.buffer,e.byteOffset,e.byteLength).slice(),defaultContentType:`application/octet-stream`};if(n(e)){let t=await r(e);return{body:t.bytes,defaultContentType:t.contentType}}throw typeof ReadableStream<`u`&&e instanceof ReadableStream?Error(`node fetch shim: ReadableStream request bodies are not supported (collect into a Uint8Array or string before calling fetch)`):Error(`node fetch shim: unsupported request body type (${Object.prototype.toString.call(e)}); use a string, Uint8Array, ArrayBuffer, Blob, FormData, or URLSearchParams`)}function ec(e){return{findTab:t=>e.call(`browser`,`findTab`,[nc(t)]),ensureTab:(t,n={})=>e.call(`browser`,`ensureTab`,[t,rc(n)]),openWindow:(t,n={})=>e.call(`browser`,`openWindow`,[t,n]),windowBounds:t=>e.call(`browser`,`windowBounds`,[$(t)]),setWindowBounds:(t,n)=>e.call(`browser`,`setWindowBounds`,[$(t),n]),eval:(t,n)=>e.call(`browser`,`eval`,[$(t),tc(n,!1)]),evalAsync:(t,n)=>e.call(`browser`,`evalAsync`,[$(t),tc(n,!0)]),cookie:(t,n)=>e.call(`browser`,`cookie`,[$(t),n]),localStorage:(t,n)=>e.call(`browser`,`localStorage`,[$(t),n]),fetch:(t,n,r={})=>S(n,r).then(n=>e.call(`browser`,`evalAsync`,[$(t),n])),websocket:Zs(e)}}function tc(e,t){if(typeof e==`function`)return`(${e.toString()})()`;if(typeof e==`string`)return e;throw TypeError(`browser.eval/evalAsync: source must be a function or string`)}function nc(e){let t={};return e.domain!==void 0&&(t.domain=e.domain),e.urlMatch!==void 0&&(t.urlMatch=e.urlMatch instanceof RegExp?e.urlMatch.source:e.urlMatch),t}function rc(e){return e.matchUrl===void 0?{}:{matchUrl:e.matchUrl instanceof RegExp?e.matchUrl.source:e.matchUrl}}function ic(e){return{register(t){let n=null,r=e.onEvent(`computer-call`,r=>{let i=r;i.id===t.id&&oc(e,t,i,{getStop:()=>n,setStop:e=>{n=e}})}),i=ac(t);return e.call(`computer`,`register`,[i]).catch(()=>{}),()=>{n?.(),n=null,r(),e.call(`computer`,`unregister`,[t.id]).catch(()=>{})}}}}function ac(e){return{id:e.id,kind:`jsh`,title:e.title??e.id,size:e.size??null,state:`live`,capabilities:e.capabilities,pid:null,...e.softKeys?{softKeys:e.softKeys}:{}}}async function oc(e,t,n,r){let i;try{i=await sc(e,t,n,r)}catch(e){i={error:e instanceof Error?e.message:String(e)}}try{await e.call(`computer`,`reply`,[n.requestId,i])}catch{}}async function sc(e,t,n,r){switch(n.op){case`screenshot`:return t.screenshot(n.args[0]??{format:`jpeg`});case`text`:return t.text?t.text():null;case`input`:return await t.input(n.args[0]??[]),{ok:!0};case`exec`:if(!t.exec)throw Error(`exec is not supported`);return t.exec(String(n.args[0]??``));case`subscribe`:return cc(e,t,Number(n.args[0])||2,Number(n.args[1])||void 0,r);case`unsubscribe`:return r.getStop()?.(),r.setStop(null),{ok:!0};default:{let e=n.op;throw Error(`unknown computer op '${String(e)}'`)}}}function cc(e,t,n,r,i){if(i.getStop()?.(),!t.subscribe)throw Error(`subscribe is not supported`);let a=t.subscribe(n,n=>{e.call(`computer`,`frame`,[t.id,n]).catch(()=>{})},r);return i.setStop(()=>{try{a()}catch{}}),{ok:!0}}function lc(e){return e===`SIGKILL`?137:e===`SIGINT`?130:143}function uc(e,t,n,r){let i=async()=>{if(!t?.wasUsed())return;let n=t.getMutations();if(n.created.length||n.modified.length||n.deleted.length)try{await e.call(`vfs`,`flushWrites`,[n])}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[realm-exec] pre-exec sync-fs flush failed (will retry at exit): ${t}`);return}t.resetBaseline()},a=async(i=!1)=>{if(t?.wasUsed())try{let r=await e.call(`vfs`,`snapshot`,[n]);i?t.applySnapshotPreservingMutations(r):t.applySnapshot(r)}catch(e){let t=e instanceof Error?e.message:String(e);r?.(`[sync-fs] re-snapshot after exec failed: ${t}\n`)}},o=async t=>{await i();try{return await e.call(`exec`,`run`,[t])}finally{await a()}},s=async t=>{await i();try{return await e.call(`exec`,`spawn`,[t])}finally{await a()}},c=1,l=Object.assign(o,{spawn:s,start:(t,n)=>{let r=c++,o=[],s=!1,l=!1,u=!1,d,f,p=new Promise((e,t)=>{d=e,f=t}),m=()=>{if(s||u||l)return;l=!0;let c=o.length>0?o.join(``):n?.stdin,p={};c!==void 0&&(p.stdin=c),n?.stdinKind!==void 0&&(p.stdinKind=n.stdinKind),n?.args!==void 0&&(p.args=n.args),n?.cwd!==void 0&&(p.cwd=n.cwd),n?.env!==void 0&&(p.env=n.env),(async()=>{try{if(await i(),u){await a(!0);return}s=!0;let n=await e.call(`exec`,`start`,[r,t,p]);await a(!0),d(n)}catch(e){await a(!0),f(e)}})()};return{kill:t=>s?e.call(`exec`,`kill`,[r,t]):(u=!0,d({stdout:``,stderr:``,exitCode:lc(t)}),Promise.resolve(!0)),stdin:{write:e=>{!s&&!u&&o.push(e)},end:()=>m()},done:p}}});return l.exec=l,l}const dc=new Set([204,205,304]),fc=new Set([`content-encoding`,`transfer-encoding`,`content-length`]);function pc(e,t){let n=mc(e.body),r=hc(e.headers),i=dc.has(e.status)||n.byteLength===0,a=new Response(i?null:n,{status:e.status,statusText:e.statusText,headers:r});try{Object.defineProperty(a,"url",{value:e.url||t,writable:!1,configurable:!0,enumerable:!1})}catch{}return _c(a,n),a}function mc(e){return e.byteLength===0?new Uint8Array:e.slice()}function hc(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(!fc.has(n.toLowerCase()))try{t.set(n,r)}catch{}return t}const gc=Symbol(`slicc.realmBufferedBody`);function _c(e,t){if(gc in e)return;Object.defineProperty(e,gc,{value:!0,configurable:!0});let n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),`bodyUsed`),r=!1,i=()=>{if(r)throw TypeError(`Failed to read response body: body already used`);return r=!0,vc(e),t},a=async()=>new TextDecoder().decode(i()),o=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);Object.defineProperties(e,{bodyUsed:{configurable:!0,enumerable:!1,get(){return r?!0:n?.get?!!n.get.call(e):!1}},text:{value:a,configurable:!0},json:{value:async()=>JSON.parse(await a()),configurable:!0},arrayBuffer:{value:async()=>o(i()),configurable:!0},blob:{value:async()=>new Blob([o(i())]),configurable:!0},bytes:{value:async()=>i(),configurable:!0}})}function vc(e){try{let t=e.body;t&&!t.locked&&t.getReader()}catch{}}function yc(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);throw TypeError(`expected an ArrayBuffer or typed array`)}function bc(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function xc(e){return e==null?[]:Array.isArray(e)?e:[e]}function Sc(e,t){let n=t.handle,r=new Set,i=new Set,a=!1,o=null,s=e=>{let t=e;if(!t||t.handle!==n)return;let i={reportId:t.reportId,data:bc(t.bytes)};for(let e of[...r])try{e(i)}catch{}},c=()=>{a||(a=!0,o=e.onEvent?e.onEvent(`hid-input-report`,s):null,e.call(`hid`,`subscribeInputReports`,[n]).catch(()=>{a=!1,o?.(),o=null}))},l=()=>{!a||r.size>0||(a=!1,o?.(),o=null,e.call(`hid`,`unsubscribeInputReports`,[n]).catch(()=>{}))};return{...t,open:()=>e.call(`hid`,`open`,[n]),close:()=>e.call(`hid`,`close`,[n]),sendReport:(t,r)=>e.call(`hid`,`sendReport`,[n,t,yc(r)]),sendFeatureReport:(t,r)=>e.call(`hid`,`sendFeatureReport`,[n,t,yc(r)]),receiveFeatureReport:async t=>bc((await e.call(`hid`,`receiveFeatureReport`,[n,t])).bytes),addEventListener(e,t){if(e===`inputreport`)r.add(t),c();else if(e===`disconnect`)i.add(t);else throw TypeError(`hid device: unknown event type '${String(e)}'`)},removeEventListener(e,t){e===`inputreport`?(r.delete(t),l()):e===`disconnect`&&i.delete(t)},onInputReport(e){r.add(e),c()}}}function Cc(e){return{list:async()=>(await e.call(`hid`,`list`,[])).map(t=>Sc(e,t)),request:async t=>{let n=(await e.call(`hid`,`request`,[xc(t)]))[0];if(!n)throw Error(`No device selected.`);return Sc(e,n)}}}function wc(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var Tc=class{rpc;targetId;selector;index;constructor(e,t,n,r){this.rpc=e,this.targetId=t,this.selector=n,this.index=r}evalOnElement(e){let t=`(() => { const els = document.querySelectorAll(${JSON.stringify(this.selector)}); const el = els[${this.index}]; ${e} })()`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t])}async textContent(){return this.evalOnElement(`return el ? el.textContent : null;`)}async getAttribute(e){return this.evalOnElement(`return el ? el.getAttribute(${JSON.stringify(e)}) : null;`)}async isVisible(){return this.evalOnElement(`if (!el) return false; const s = getComputedStyle(el); if (s.display === 'none' || s.visibility === 'hidden' || s.opacity === '0') return false; const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0;`)}async boundingBox(){return this.evalOnElement(`if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.x, y: r.y, width: r.width, height: r.height };`)}},Ec=class{rpc;targetId;onClose;closed=!1;constructor(e,t,n){this.rpc=e,this.targetId=t,this.onClose=n}async goto(e,t){await this.rpc.call(`browser`,`navigateTab`,[this.targetId,e])}async waitForLoadState(e){await this.rpc.call(`browser`,`waitForLoadState`,[this.targetId,e??`load`])}async waitForTimeout(e){await new Promise(t=>setTimeout(t,e))}async evaluate(e,...t){let n=typeof e==`string`?e:`(${e.toString()}).apply(null, JSON.parse(${JSON.stringify(JSON.stringify(t))}))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,n])}async screenshot(e){let t={};e?.fullPage!==void 0&&(t.fullPage=e.fullPage);let n=wc(await this.rpc.call(`browser`,`screenshotTab`,[this.targetId,t]));return e?.path&&await this.rpc.call(`vfs`,`writeFileBinary`,[e.path,n]),n}async $(e){return await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`!!document.querySelector(${JSON.stringify(e)})`])?new Tc(this.rpc,this.targetId,e,0):null}async $$(e){let t=await this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.querySelectorAll(${JSON.stringify(e)}).length`]),n=[];for(let r=0;r<t;r++)n.push(new Tc(this.rpc,this.targetId,e,r));return n}async $$eval(e,t,...n){if(typeof t==`string`)return this.rpc.call(`browser`,`evalAsync`,[this.targetId,t]);let r=`(${t.toString()}).apply(null, [Array.from(document.querySelectorAll(${JSON.stringify(e)}))].concat(JSON.parse(${JSON.stringify(JSON.stringify(n))})))`;return this.rpc.call(`browser`,`evalAsync`,[this.targetId,r])}async content(){return this.rpc.call(`browser`,`evalAsync`,[this.targetId,`document.documentElement.outerHTML`])}async setViewportSize(e){await this.rpc.call(`browser`,`setViewport`,[this.targetId,e.width,e.height])}async close(){this.closed||(this.closed=!0,await this.rpc.call(`browser`,`closeTab`,[this.targetId]),this.onClose?.())}},Dc=class{rpc;openPages=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Ec(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}pages(){return[...this.openPages]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close()}},Oc=class{rpc;openPages=[];openContexts=[];constructor(e){this.rpc=e}async newPage(e){let t=await this.rpc.call(`browser`,`createTab`,[`about:blank`]);e?.viewport&&await this.rpc.call(`browser`,`setViewport`,[t,e.viewport.width,e.viewport.height]);let n=new Ec(this.rpc,t,()=>{let e=this.openPages.indexOf(n);e!==-1&&this.openPages.splice(e,1)});return this.openPages.push(n),n}async newContext(e){let t=new Dc(this.rpc);return this.openContexts.push(t),t}contexts(){return[...this.openContexts]}async close(){let e=this.openPages.splice(0,this.openPages.length);for(let t of e)await t.close();let t=this.openContexts.splice(0,this.openContexts.length);for(let e of t)await e.close()}};function kc(e){let t=async t=>new Oc(e),n=async(t,n)=>new Oc(e);return{chromium:{launch:t,connect:n,connectOverCDP:n},firefox:{launch:t,connect:n},webkit:{launch:t,connect:n}}}function Ac(e){return{...e,time:Go,fmt:ot,pool:Vo}}function jc(e,t){return e?.startsWith(`/`)?Ko(e):t}function Mc(e){return e.includes(`require`)||e.includes(`import`)||/(?:^|[;\n}])\s*export\b/.test(e)}async function Nc(e,t,n,r){return Mc(t)?e.call(`module`,`buildGraph`,[t,jc(r,n),r]):{files:[],entryMap:{},edges:{},edgeErrors:{},errors:{}}}function Pc(e){if(typeof e!=`object`||!e)return;let t=e;if(t.__esModule&&!Object.prototype.hasOwnProperty.call(t,`default`)&&Object.isExtensible(t))try{Object.defineProperty(t,"default",{value:t,enumerable:!1,configurable:!0})}catch{}}function Fc(e){return{playwright:kc(e)}}function Ic(e){let{graph:t,fsBridge:n,processShim:r,childProcess:i,nodeConsole:a,sliccyModules:o,shimmedPackages:l={},nodeReadline:u,nodeOsModule:d=Zn,nodeUtilModule:p=Xt}=e,h=new Map(t.files.map(e=>[e.path,e.cjsSource])),g=new Map(t.files.map(e=>[e.path,e.kind])),_=new Map,v=Kn({requireFrom:(e,t)=>T(e,t),resolveFrom:(e,t)=>w(e,t)}),y=In(()=>{let e=r?.cwd?.();return typeof e==`string`&&e.length>0?e:`/`}),b=e=>{if(typeof e==`string`&&e.startsWith(`sliccy:`))return{hit:!0,value:zc(e,o)};let t=e.startsWith(`node:`)?e.slice(5):e,a=Lc(t,{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:d,nodeUtilModule:p,nodePathModule:y,nodeReadline:u,nodeModule:v});if(a.hit)return a;if(m.has(t))throw f(e,t);if(c.has(t))throw Vc(e,t);return t in l?{hit:!0,value:l[t]}:{hit:!1}},x=(e,n,r)=>{let i=b(n);if(i.hit)return i.value;let a=e?.[n];if(a)return S(a);let o=r===null?t.errors[n]:t.edgeErrors?.[r]?.[n];throw o?Error(o):Rc(n)};function S(e){let n=_.get(e);if(n)return n.exports;let i=h.get(e);if(i===void 0)throw Error(`Cannot find module '${e}'`);let o={exports:{}};_.set(e,o);let s=n=>x(t.edges[e],n,e),c=[`module`,`exports`,`require`,`process`,`console`,`Buffer`,`global`],l=[o,o.exports,s,r,a,globalThis.Buffer,globalThis];return g.get(e)!==`esm`&&(c.push(`__dirname`,`__filename`),l.push(Ko(e),e)),Function(...c,i)(...l),g.get(e)===`cjs`&&Pc(o.exports),o.exports}function C(e){return h.has(e)}function w(e,n){if(s(n))return n;let r=t.edges[e]?.[n];if(r)return r;let i=Ko(e);if(Gn(n)){let e=Un(i,n,C);if(e)return e}else{let e=Wn(i,n,C);if(e)return e}let a=t.edgeErrors?.[e]?.[n];throw a?Error(a):Rc(n)}function T(e,t){let n=b(t);return n.hit?n.value:S(w(e,t))}return{require:e=>x(t.entryMap,e,null)}}function Lc(e,t){let{fsBridge:n,processShim:r,childProcess:i,nodeOsModule:a,nodeUtilModule:o,nodePathModule:s,nodeReadline:c,nodeModule:l}=t;return e===`fs`||e===`fs/promises`?{hit:!0,value:n}:e===`path`?{hit:!0,value:s}:e===`crypto`?{hit:!0,value:wn}:e===`child_process`?{hit:!0,value:i}:e===`process`?{hit:!0,value:r}:e===`buffer`?{hit:!0,value:{Buffer:globalThis.Buffer}}:e===`assert`?{hit:!0,value:gt}:e===`assert/strict`?{hit:!0,value:ht}:e===`util`?{hit:!0,value:o}:e===`events`?{hit:!0,value:Je}:e===`os`?{hit:!0,value:a}:e===`tty`?{hit:!0,value:Qn}:e===`stream`?{hit:!0,value:St}:e===`url`?{hit:!0,value:T}:e===`zlib`?{hit:!0,value:Ro}:e===`vm`?{hit:!0,value:vr}:e===`readline`&&c?{hit:!0,value:c}:e===`readline/promises`&&c?{hit:!0,value:c.promises}:e===`module`&&l?{hit:!0,value:l}:{hit:!1}}function Rc(e){if(e.startsWith(`.`)||e.startsWith(`/`)||e.startsWith(`node:`))return Error(`Cannot find module '${e}'`);let t=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0];return Error(`Cannot find module '${e}' (run: ipk install ${t})`)}function zc(e,t){let n=e.slice(7);if(n===``)throw Error(`require('sliccy:'): empty sliccy: module name`);if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`require('${e}'): unknown sliccy: module '${n}'. Known names: ${Object.keys(t).sort().join(`, `)}`);return t[n]}const Bc={http:` Use fetch() instead.`,https:` Use fetch() instead.`,crypto:` Use globalThis.crypto (Web Crypto API) instead.`};function Vc(e,t){return Error(`require('${e}'): Node built-in '${t}' is not available in the browser environment.${Bc[t]||``}`)}async function Hc(e,t,n,r){let i=Object.keys(t),a=i.map(e=>t[e]),o=Object.getPrototypeOf(async function(){}).constructor,s=new o(...i,`${r?`"use strict";
34
34
  `:``}${e}`);try{return await s(...a),0}catch(e){return e instanceof Q?e.code:(n(`${e instanceof Error?e.stack??e.message:String(e)}\n`),1)}}function Uc(e,t){let n=t.handle;return{...t,open:t=>e.call(`serial`,`open`,[n,t]),close:()=>e.call(`serial`,`close`,[n]),read:(t={})=>e.call(`serial`,`read`,[n,{maxBytes:t.maxBytes??t.bytes,until:t.until?yc(t.until):void 0,timeoutMs:t.timeoutMs}]),write:t=>e.call(`serial`,`write`,[n,yc(t)]),getSignals:()=>e.call(`serial`,`getSignals`,[n]),setSignals:t=>e.call(`serial`,`setSignals`,[n,t])}}function Wc(e){return{list:async()=>(await e.call(`serial`,`list`,[])).map(t=>Uc(e,t)),request:async t=>Uc(e,await e.call(`serial`,`request`,[xc(t)]))}}function Gc(e=globalThis,t){let n=e.setTimeout,r=e.clearTimeout,i=e.setInterval,a=e.clearInterval,o=n.bind(e),s=r.bind(e),c=i.bind(e),l=a.bind(e),u=new Set,d=new Set,f=new Set,p=!1,m=()=>{if(f.size===0)return;let e=[...f];f.clear();for(let t of e)t()},h=e=>{if(e==null)return!1;let t=u.delete(e),n=d.delete(e);return t||n},g=(e,n)=>{try{e(...n)}catch(e){if(t?.onCallbackError?.(e),!t?.onCallbackError)throw e}finally{m()}};return{get pendingCount(){return u.size+d.size},install(){p||(p=!0,e.setTimeout=((e,t,...n)=>{if(typeof e!=`function`)return o(e,t,...n);let r=o(()=>{u.delete(r),g(e,n)},t);return u.add(r),r}),e.clearTimeout=(e=>{let t=h(e);s(e),t&&m()}),e.setInterval=((e,t,...n)=>{if(typeof e!=`function`)return c(e,t,...n);let r=c(()=>{g(e,n)},t);return d.add(r),r}),e.clearInterval=(e=>{let t=h(e);l(e),t&&m()}))},restore(){p&&(p=!1,e.setTimeout=n,e.clearTimeout=r,e.setInterval=i,e.clearInterval=a)},clearPending(){for(let e of u)s(e);u.clear();for(let e of d)l(e);d.clear(),m()},tick(){return new Promise(e=>{o(e,0)})},waitForProgress(){return u.size+d.size===0?Promise.resolve():new Promise(e=>{f.add(e)})}}}function Kc(e,t){let n=t.handle,r=e=>({status:e.status,data:bc(e.bytes)}),i=new Set,a=new Set,o=!1,s=null,c=e=>{let t=e;if(!t||t.handle!==n)return;let r=t.type===`disconnect`?i:a;for(let e of[...r])try{e(t)}catch{}},l=()=>{o||(o=!0,s=e.onEvent?e.onEvent(`usb-claim-event`,c):null,e.call(`usb`,`subscribeClaimEvents`,[n]).catch(()=>{o=!1,s?.(),s=null}))},u=()=>{!o||i.size>0||a.size>0||(o=!1,s?.(),s=null,e.call(`usb`,`unsubscribeClaimEvents`,[n]).catch(()=>{}))};return{...t,open:()=>e.call(`usb`,`open`,[n]),close:t=>e.call(`usb`,`close`,t?.force?[n,{force:!0}]:[n]),reset:t=>e.call(`usb`,`reset`,t?.force?[n,{force:!0}]:[n]),clearHalt:(t,r)=>e.call(`usb`,`clearHalt`,[n,t,r]),selectConfiguration:t=>e.call(`usb`,`selectConfig`,[n,t]),claimInterface:(t,r)=>e.call(`usb`,`claim`,r?.wait?[n,t,{wait:!0}]:[n,t]),releaseInterface:t=>e.call(`usb`,`release`,[n,t]),controlTransferIn:async(t,i)=>r(await e.call(`usb`,`controlIn`,[n,t,i])),controlTransferOut:(t,r)=>e.call(`usb`,`controlOut`,[n,t,yc(r)]),transferIn:async(t,i)=>r(await e.call(`usb`,`transferIn`,[n,t,i])),transferOut:(t,r)=>e.call(`usb`,`transferOut`,[n,t,yc(r)]),addEventListener(e,t){if(e===`disconnect`)i.add(t);else if(e===`claim-lost`)a.add(t);else throw TypeError(`usb device: unknown event type '${String(e)}'`);l()},removeEventListener(e,t){e===`disconnect`?i.delete(t):e===`claim-lost`&&a.delete(t),u()}}}function qc(e){return{list:async()=>(await e.call(`usb`,`list`,[])).map(t=>Kc(e,t)),request:async t=>Kc(e,await e.call(`usb`,`request`,[xc(t)]))}}function Jc(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t<0?``:t===0?`/`:e.substring(0,t)}function Yc(e){if(!e)return e;let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e.length>0),r=n.indexOf(`scripts`);if(r<0)return e;let i=n.slice(0,r);return i.length===0?t?`/`:``:(t?`/`:``)+i.join(`/`)}function Xc(e){return/^[A-Za-z0-9_\-./:@]+$/.test(e)?e:`'`+e.replace(/'/g,`'\\''`)+`'`}function Zc(e,t){return e===``?t:e===`/`?`/${t}`:`${e}/${t}`}function Qc(e){let t=Jc(e.argv[1]??``),n=Yc(t),r=Zc(n,`references`),i=Zc(n,`assets`),a=Zc(t,`.config`);async function o(){let t;try{t=await e.fs.exists(a)}catch{return null}if(!t)return null;let n;try{n=await e.fs.readFile(a)}catch{return null}let r=typeof n==`string`?n:String(n);if(!r.trim())return null;let i;try{i=JSON.parse(r)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`skill.config(): failed to parse ${a}: ${t}`)}if(i&&typeof i==`object`&&!Array.isArray(i))return i;throw Error(`skill.config(): ${a} must contain a JSON object`)}async function s(t){let n=await o();if(t===void 0)return n;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`skill.config(updates): updates must be a plain object`);let r={...n??{},...t};return await e.fs.writeFile(a,JSON.stringify(r,null,2)+`
35
- `),r}async function c(t){if(typeof t!=`string`||!t.trim())throw TypeError(`skill.token(providerId): providerId must be a non-empty string`);let n=`oauth-token ${Xc(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const $c=65536;function el(e,t){if(!t)return e;let n=e+t;return n.length<=$c?n:n.slice(n.length-$c)}async function tl(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new _e(i)}function nl(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function rl(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-DN8XE7DM.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function il(e,t,n,r,i){let a=b(e,t),o=v(e,a);if(Object.assign(r,Ke(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&rl(o,n,e.cwd,i),e.syncFsToken)return g(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:_(a),noDefaultDeadline:!0}:{}})}function al(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:i().version,writable:!1,enumerable:!1,configurable:!1})}function ol(e,t,n){let r=Xe({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ye({writeStdout:t,writeStderr:n,exit:e=>{throw new Q(e)},color:r})}}function sl(e,t,n){return{readStdinBytes:()=>ye(e.stdin??``),writeStdout:t,writeStderr:n}}function cl(e){return{usbBridge:qc(e),serialBridge:Wc(e),hidBridge:Cc(e),computerBridge:ic(e)}}async function ll(e,t){let n=e.captureOutput!==!1,r={stdout:``,stderr:``},i=(e,i)=>{let a=typeof i==`string`?i:String(i);e===`stdout`?r.stdout=n?r.stdout+a:el(r.stdout,a):r.stderr=n?r.stderr+a:el(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=ps(a,o),c=gs(e,a,o),{colorApi:l,cliApi:u}=ol(!!e.env?.NO_COLOR,a,o),f=new d(t),p=sl(e,a,o),m=je(f,D,p),h=await tl(f,e.cwd,nl(e,o),x(e)?{timeBudgetMs:150}:void 0),g=il(e,t,h,m,p),_=uc(f,h,e.cwd,o),v=Xs(_,{cwd:e.cwd}),y=Qc({argv:e.argv,fs:m,exec:_}),b=ec(f),{usbBridge:S,serialBridge:C,hidBridge:w,computerBridge:T}=cl(f),E=Ks({fetch:D});async function D(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return pc(await f.call(`fetch`,`request`,[n,await Qs(t,e)]),n)}let O=Ac({exec:_,agent:v,skill:y,http:E,browser:b,usb:S,serial:C,hid:w,computer:T,cli:u,color:l}),ee=e.filename,te=Ko(ee),k=await Nc(f,e.code,e.cwd,ee),ne=Ic({graph:k,fsBridge:m,processShim:c.processShim,childProcess:ln(_,g),nodeConsole:s,sliccyModules:O,shimmedPackages:Fc(f),nodeReadline:ws({output:{write:a},onExit:c.recordExit}),nodeOsModule:Xn(e.env),nodeUtilModule:Yt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=k.entrySource!==void 0;await ul({entryCode:k.entrySource??e.code,isEsmEntry:ie,entryIsModule:k.entryIsModule===!0,filename:ee,dirname:te,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:D,writeStderr:o,rpc:f,syncFs:h,output:r,port:t})}async function ul(e){let t=globalThis;al(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Gc(globalThis,{onCallbackError(e){if(!(e instanceof Q))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BeoKKjy1.js`),i=r(globalThis);n.install(),i.install();let a=ms(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-CKtowxzG.js`),s=o(globalThis,{writeStderr:e.writeStderr,didExit:e.proc.getDidCallProcessExit,recordExit:e.proc.recordExit});try{let r=await dl({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,...e.entryIsModule?{}:{__dirname:e.dirname,__filename:e.filename}},writeStderr:e.writeStderr,isEsmEntry:e.isEsmEntry,rpc:e.rpc,syncFs:e.syncFs,proc:e.proc,timers:n,bodyReads:i,fatal:s.fatal});delete t.__slicc_compileWasm,delete t.__slicc_mountVfs,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{s.dispose(),n.clearPending(),n.restore(),i.restore(),a()}}async function dl(e){let t=await Hc(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await fl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await pl(e.rpc,e.timers,e.bodyReads,e.proc,e.fatal),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await fl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function fl(e,t,n){let r=t.getMutations();if(r.created.length||r.modified.length||r.deleted.length)try{await e.call(`vfs`,`flushWrites`,[r]),t.resetBaseline()}catch(e){let t=e instanceof Error?e.message:String(e);n(`[sync-fs] ERROR: flush failed — ${r.created.length+r.modified.length} write(s) + ${r.deleted.length} delete(s) were NOT persisted: ${t}\n`)}}async function pl(e,t,n,r,i){await t.tick();let a=0;for(;!r.getDidCallProcessExit()&&a<2;){let o=[];if(e.pendingCount>0&&o.push(e.waitForProgress()),t.pendingCount>0&&o.push(t.waitForProgress()),n.pendingCount>0&&o.push(n.waitForProgress()),o.length===0){a+=1,await t.tick();continue}a=0,o.push(i),await Promise.race(o),r.getDidCallProcessExit()||await t.tick()}}function ml(){let e=new Set,t=new Set;return{realmSide:{postMessage:e=>{queueMicrotask(()=>{for(let n of[...t])n({data:e})})},addEventListener:(t,n)=>{e.add(n)},removeEventListener:(t,n)=>{e.delete(n)}},hostSide:{postMessage:t=>{queueMicrotask(()=>{for(let n of[...e])n({data:t})})},addEventListener:(e,n)=>{t.add(n)},removeEventListener:(e,n)=>{t.delete(n)}}}}function hl(){return async({kind:e})=>{if(e!==`js`)throw Error(`createInProcessJsRealmFactory: only kind:js is supported`);let{realmSide:t,hostSide:n}=ml(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`js`&&ll(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}function gl(){return async({kind:e})=>{if(e!==`py`)throw Error(`createInProcessPyRealmFactory: only kind:py is supported`);let{realmSide:t,hostSide:n}=ml(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`py`&&p(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}export{hl as createInProcessJsRealmFactory,gl as createInProcessPyRealmFactory,Q as t};
35
+ `),r}async function c(t){if(typeof t!=`string`||!t.trim())throw TypeError(`skill.token(providerId): providerId must be a non-empty string`);let n=`oauth-token ${Xc(t)}`,{stdout:r,stderr:i,exitCode:a}=await e.exec(n);if(a!==0){let e=i.trim()||`oauth-token exited with code ${a}`;throw Error(`skill.token('${t}'): ${e}`)}return r.replace(/\r?\n+$/,``)}return Object.freeze({dir:t,root:n,refs:r,assets:i,config:s,token:c})}const $c=65536;function el(e,t){if(!t)return e;let n=e+t;return n.length<=$c?n:n.slice(n.length-$c)}async function tl(e,t,n,r){let i;try{i=await e.call(`vfs`,`snapshot`,r?[t,r]:[t])}catch(e){n?.(e instanceof Error?e.message:String(e)),i={entries:[]}}return new _e(i)}function nl(e,t){if(e.syncFsToken)return e=>t(`[sync-fs] snapshot failed, sync metadata will be incomplete: ${e}\n`)}function rl(e,t,n,r){globalThis.__slicc_mountVfs=async(i,a)=>{let{mountVfsIntoEmscripten:o}=await import(`./emscripten-vfs-hook-DN8XE7DM.js`);return o(i,{bridge:e,syncFs:t,cwd:n,warn:e=>r.writeStderr(`slicc: ${e}\n`)},a)}}function il(e,t,n,r,i){let a=b(e,t),o=v(e,a);if(Object.assign(r,Ke(n,e.cwd,o,i,{write:(e,n)=>{t.postMessage({type:`realm-fs-write`,path:e,bytes:n})},delete:e=>{t.postMessage({type:`realm-fs-delete`,path:e})}})),o&&rl(o,n,e.cwd,i),e.syncFsToken)return g(e.syncFsToken,{syncFs:n,...o?{fsBridge:o}:{},...a?{transport:_(a),noDefaultDeadline:!0}:{}})}function al(e=globalThis){Object.prototype.hasOwnProperty.call(e,`SLICC_VERSION`)||Object.defineProperty(e,"SLICC_VERSION",{value:i().version,writable:!1,enumerable:!1,configurable:!1})}function ol(e,t,n){let r=Xe({isTTY:!e,noColor:e});return{colorApi:r,cliApi:Ye({writeStdout:t,writeStderr:n,exit:e=>{throw new Q(e)},color:r})}}function sl(e,t,n){return{readStdinBytes:()=>ye(e.stdin??``),writeStdout:t,writeStderr:n}}function cl(e){return{usbBridge:qc(e),serialBridge:Wc(e),hidBridge:Cc(e),computerBridge:ic(e)}}async function ll(e,t){let n=e.captureOutput!==!1,r={stdout:``,stderr:``},i=(e,i)=>{let a=typeof i==`string`?i:String(i);e===`stdout`?r.stdout=n?r.stdout+a:el(r.stdout,a):r.stderr=n?r.stderr+a:el(r.stderr,a),t.postMessage({type:`realm-output`,stream:e,chunk:a})},a=e=>{i(`stdout`,e)},o=e=>{i(`stderr`,e)},s=ps(a,o),c=gs(e,a,o),{colorApi:l,cliApi:u}=ol(!!e.env?.NO_COLOR,a,o),f=new d(t),p=sl(e,a,o),m=je(f,D,p),h=await tl(f,e.cwd,nl(e,o),x(e)?{timeBudgetMs:150}:void 0),g=il(e,t,h,m,p),_=uc(f,h,e.cwd,o),v=Xs(_,{cwd:e.cwd}),y=Qc({argv:e.argv,fs:m,exec:_}),b=ec(f),{usbBridge:S,serialBridge:C,hidBridge:w,computerBridge:T}=cl(f),E=Ks({fetch:D});async function D(e,t){let n=e instanceof Request?e.url:e instanceof URL?e.toString():String(e);return pc(await f.call(`fetch`,`request`,[n,await Qs(t,e)]),n)}let O=Ac({exec:_,agent:v,skill:y,http:E,browser:b,usb:S,serial:C,hid:w,computer:T,cli:u,color:l}),ee=e.filename,te=Ko(ee),k=await Nc(f,e.code,e.cwd,ee),ne=Ic({graph:k,fsBridge:m,processShim:c.processShim,childProcess:ln(_,g),nodeConsole:s,sliccyModules:O,shimmedPackages:Fc(f),nodeReadline:ws({output:{write:a},onExit:c.recordExit}),nodeOsModule:Xn(e.env),nodeUtilModule:Yt(e=>o(`${e}\n`),()=>c.processShim.argv.slice(2))}).require,re={exports:{},filename:e.filename},ie=k.entrySource!==void 0;await ul({entryCode:k.entrySource??e.code,isEsmEntry:ie,entryIsModule:k.entryIsModule===!0,filename:ee,dirname:te,proc:c,nodeConsole:s,requireShim:ne,moduleShim:re,realmFetch:D,writeStderr:o,rpc:f,syncFs:h,output:r,port:t})}async function ul(e){let t=globalThis;al(),t.__slicc_compileWasm=t=>e.rpc.call(`wasm`,`compile`,[t]);let n=Gc(globalThis,{onCallbackError(e){if(!(e instanceof Q))throw e}}),{createBodyReadHandleTracker:r}=await import(`./realm-body-handles-BeoKKjy1.js`),i=r(globalThis);n.install(),i.install();let a=ms(globalThis,e.proc.processShim),{watchUnhandledRejections:o}=await import(`./realm-unhandled-rejections-COEEZ6Qq.js`),s=o(globalThis,{writeStderr:e.writeStderr,didExit:e.proc.getDidCallProcessExit,recordExit:e.proc.recordExit});try{let r=await dl({entryCode:e.entryCode,bridges:{process:e.proc.processShim,console:e.nodeConsole,require:e.requireShim,module:e.moduleShim,exports:e.moduleShim.exports,fetch:e.realmFetch,...e.entryIsModule?{}:{__dirname:e.dirname,__filename:e.filename}},writeStderr:e.writeStderr,isEsmEntry:e.isEsmEntry,rpc:e.rpc,syncFs:e.syncFs,proc:e.proc,timers:n,bodyReads:i,fatal:s.fatal});delete t.__slicc_compileWasm,delete t.__slicc_mountVfs,e.rpc.dispose(),e.port.postMessage({type:`realm-done`,stdout:e.output.stdout,stderr:e.output.stderr,exitCode:r})}finally{s.dispose(),n.clearPending(),n.restore(),i.restore(),a()}}async function dl(e){let t=await Hc(e.entryCode,e.bridges,e.writeStderr,e.isEsmEntry);return await fl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()?(e.timers.clearPending(),e.proc.getExitCode()):(await pl(e.rpc,e.timers,e.bodyReads,e.proc,e.fatal),e.proc.getDidCallProcessExit()&&e.timers.clearPending(),await fl(e.rpc,e.syncFs,e.writeStderr),e.proc.getDidCallProcessExit()||t===0?e.proc.getExitCode():t)}async function fl(e,t,n){let r=t.getMutations();if(r.created.length||r.modified.length||r.deleted.length)try{await e.call(`vfs`,`flushWrites`,[r]),t.resetBaseline()}catch(e){let t=e instanceof Error?e.message:String(e);n(`[sync-fs] ERROR: flush failed — ${r.created.length+r.modified.length} write(s) + ${r.deleted.length} delete(s) were NOT persisted: ${t}\n`)}}async function pl(e,t,n,r,i){await t.tick();let a=0;for(;!r.getDidCallProcessExit()&&a<2;){let o=[];if(e.pendingCount>0&&o.push(e.waitForProgress()),t.pendingCount>0&&o.push(t.waitForProgress()),n.pendingCount>0&&o.push(n.waitForProgress()),o.length===0){a+=1,await t.tick();continue}a=0,o.push(i),await Promise.race(o),r.getDidCallProcessExit()||await t.tick()}}function ml(){let e=new Set,t=new Set;return{realmSide:{postMessage:e=>{queueMicrotask(()=>{for(let n of[...t])n({data:e})})},addEventListener:(t,n)=>{e.add(n)},removeEventListener:(t,n)=>{e.delete(n)}},hostSide:{postMessage:t=>{queueMicrotask(()=>{for(let n of[...e])n({data:t})})},addEventListener:(e,n)=>{t.add(n)},removeEventListener:(e,n)=>{t.delete(n)}}}}function hl(){return async({kind:e})=>{if(e!==`js`)throw Error(`createInProcessJsRealmFactory: only kind:js is supported`);let{realmSide:t,hostSide:n}=ml(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`js`&&ll(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}function gl(){return async({kind:e})=>{if(e!==`py`)throw Error(`createInProcessPyRealmFactory: only kind:py is supported`);let{realmSide:t,hostSide:n}=ml(),r=e=>{if(e.data?.type!==`realm-init`)return;t.removeEventListener(`message`,r);let n=e.data;n.kind===`py`&&p(n,t).catch(e=>{let n={type:`realm-error`,message:e instanceof Error?e.message:String(e)};t.postMessage(n)})};return t.addEventListener(`message`,r),{controlPort:n,terminate(){t.removeEventListener(`message`,r)}}}}export{hl as createInProcessJsRealmFactory,gl as createInProcessPyRealmFactory,Q as t};
@@ -1 +1 @@
1
- import{t as e}from"./js-realm-worker-lw4jlVws.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
1
+ import{t as e}from"./js-realm-worker-CCSqHLiq.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
@@ -1 +1 @@
1
- import{t as e}from"./realm-inprocess-D4P5wFOE.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
1
+ import{t as e}from"./realm-inprocess-CTrnIcCf.js";function t(e){return e instanceof Error?`${e.stack??`${e.name}: ${e.message}`}\n`:`Uncaught ${typeof e==`string`?`'${e}'`:String(e)}\n`}function n(n,r){let i=()=>void 0,a=new Promise(e=>{i=e});if(typeof n.addEventListener!=`function`)return{fatal:a,dispose:()=>void 0};let o=n=>{let a=n.reason;n.preventDefault(),!(a instanceof e||r.didExit())&&(r.writeStderr(t(a)),r.recordExit(1),i())};return n.addEventListener(`unhandledrejection`,o),{fatal:a,dispose:()=>n.removeEventListener?.(`unhandledrejection`,o)}}export{n as watchUnhandledRejections};
@@ -1 +1 @@
1
- import{o as e}from"./api-endpoint-DuEQRZ4g.js";import{h as t}from"./main-CvCAlghs.js";async function n(){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 r(r,i,a={}){if(r.dataset.recoveryBusy===`1`)return;let o=a.wipe??n,s=a.reload??(()=>location.reload()),c=i instanceof Error?i.message:String(i),l=a.verdict===`browser-wedged`,u=e(i),d=l||u,f=document.createElement(`div`);f.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let p=document.createElement(`h1`);p.style.color=`var(--s2-negative, #e34850)`,p.textContent=l?`Your browser needs a restart`:`Failed to start`;let m=document.createElement(`p`);m.style.color=`var(--s2-content-tertiary, #717171)`,m.textContent=c;let h=document.createElement(`div`);h.style.cssText=`display:flex;gap:0.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.5rem;`;let g=document.createElement(`button`);g.type=`button`,g.textContent=`Reset local data & reload`,g.dataset.variant=d?`demoted`:`destructive`,g.style.cssText=d?`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 _=document.createElement(`button`);if(_.type=`button`,_.textContent=`Reload`,_.style.cssText=l?`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;`,g.addEventListener(`click`,()=>{g.disabled=!0,_.disabled=!0,g.textContent=`Resetting…`,r.dataset.recoveryBusy=`1`,(async()=>{try{await o()}catch{}for(let e of t)try{localStorage.removeItem(e)}catch{}s()})()}),_.addEventListener(`click`,()=>{s()}),l){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.`,f.append(p,m,e),h.append(_,g)}else f.append(p,m),h.append(g,_);for(f.append(h);r.firstChild;)r.removeChild(r.firstChild);r.appendChild(f)}export{r as renderBootRecoveryScreen};
1
+ import{o as e}from"./api-endpoint-DuEQRZ4g.js";import{h as t}from"./main-BfPkUEOn.js";async function n(){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 r(r,i,a={}){if(r.dataset.recoveryBusy===`1`)return;let o=a.wipe??n,s=a.reload??(()=>location.reload()),c=i instanceof Error?i.message:String(i),l=a.verdict===`browser-wedged`,u=e(i),d=l||u,f=document.createElement(`div`);f.style.cssText=`padding:2rem;text-align:center;font-family:system-ui;`;let p=document.createElement(`h1`);p.style.color=`var(--s2-negative, #e34850)`,p.textContent=l?`Your browser needs a restart`:`Failed to start`;let m=document.createElement(`p`);m.style.color=`var(--s2-content-tertiary, #717171)`,m.textContent=c;let h=document.createElement(`div`);h.style.cssText=`display:flex;gap:0.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.5rem;`;let g=document.createElement(`button`);g.type=`button`,g.textContent=`Reset local data & reload`,g.dataset.variant=d?`demoted`:`destructive`,g.style.cssText=d?`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 _=document.createElement(`button`);if(_.type=`button`,_.textContent=`Reload`,_.style.cssText=l?`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;`,g.addEventListener(`click`,()=>{g.disabled=!0,_.disabled=!0,g.textContent=`Resetting…`,r.dataset.recoveryBusy=`1`,(async()=>{try{await o()}catch{}for(let e of t)try{localStorage.removeItem(e)}catch{}s()})()}),_.addEventListener(`click`,()=>{s()}),l){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.`,f.append(p,m,e),h.append(_,g)}else f.append(p,m),h.append(g,_);for(f.append(h);r.firstChild;)r.removeChild(r.firstChild);r.appendChild(f)}export{r as renderBootRecoveryScreen};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-BBeNiS8R.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/mime-types-D0xZwlMO.js","assets/base64-ELzoYfwP.js","assets/bridge-protocol-C52CnDIj.js","assets/account-store-BZBj_ntG.js","assets/core-BFRZk2b-.js","assets/compat-BAGLwgqY.js","assets/models-Xc0Gclrk.js","assets/diagnostics-Cag7MsZI.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-DHpsqCCC.js","assets/libesm-BypnjKEL.js","assets/utf16-clip-CGL7omVm.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-4VBgrEIu.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-hMRoGGjt.js","assets/float-topology-C_iRKPQK.js","assets/secrets-bridge-client-D734Xx8G.js","assets/port-bridge-client-B-gpiOVR.js","assets/panel-rpc-accessor-B4BfPLSo.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-CR6zPkBA.js","assets/stored-accounts-ChNHYF68.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/same-file-identity-OexpsaSD.js","assets/telemetry-B0sKnLBU.js","assets/types-D8gIX-W-.js","assets/icons-BJTFywJo.js","assets/wc-shell-WkeczD9x.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-xh75VEiE.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/mime-types-D0xZwlMO.js","assets/base64-ELzoYfwP.js","assets/bridge-protocol-C52CnDIj.js","assets/account-store-BZTlSap7.js","assets/core-BFRZk2b-.js","assets/compat-BAGLwgqY.js","assets/models-Xc0Gclrk.js","assets/diagnostics-Cag7MsZI.js","assets/env-api-keys-BXRkymgV.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-DHpsqCCC.js","assets/libesm-BypnjKEL.js","assets/utf16-clip-CGL7omVm.js","assets/feature-flags-DvsApnS-.js","assets/proxied-fetch-4VBgrEIu.js","assets/proxy-error-BSFYY7jj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-hMRoGGjt.js","assets/float-topology-C_iRKPQK.js","assets/secrets-bridge-client-D734Xx8G.js","assets/port-bridge-client-B-gpiOVR.js","assets/panel-rpc-accessor-B4BfPLSo.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-4px4FkTT.js","assets/stored-accounts-ChNHYF68.js","assets/bedrock-camp-compat-B1oHsbyo.js","assets/bedrock-camp-extra-models-BYrxX19D.js","assets/claude-model-version-DZmbk9E2.js","assets/same-file-identity-OexpsaSD.js","assets/telemetry-B0sKnLBU.js","assets/types-D8gIX-W-.js","assets/icons-BJTFywJo.js","assets/wc-shell-WkeczD9x.css"])))=>i.map(i=>d[i]);
2
2
  import{t as e}from"./preload-helper-Czpn1I53.js";import"./tool-ui-eSQ1g2I1.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{storePendingHandle as n}from"./mount-picker-popup-qcWGbpG5.js";import{r,t as i}from"./hid-device-registry-B2R-0rNt.js";import"./browser-BhTdBqdp.js";import{a,n as o}from"./serial-port-registry-CCqklAEr.js";import{a as s,t as c}from"./usb-device-registry--JwKRTYp.js";import"./usb-operations-v1mGAdRY.js";import{t as l}from"./terminal-session-client-DmE-iBjP.js";function u(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 d=new Set([`--vid`,`--pid`,`--baud`,`--data-bits`,`--stop-bits`,`--parity`,`--flow-control`,`--buffer-size`,`--bytes`,`--until`,`--timeout-ms`,`--dtr`,`--rts`,`--break`,`--__resolved`]);function f(e){return u(e,d)}function p(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 m(e){let t={};return e.has(`--vid`)&&(t.usbVendorId=p(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.usbProductId=p(e.get(`--pid`),`pid`)),Object.keys(t).length>0?[t]:[]}`${o}${o}`;var h=new Set([`--port`,`--baud`,`--vid`,`--pid`]),g=115200;function _(e){return u(e,h)}`${g}`;var v=new Set([`--vid`,`--pid`,`--usage-page`,`--usage`,`--__resolved`,`--timeout`]);function y(e){return u(e,v)}function b(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 x(e){let t={};return e.has(`--vid`)&&(t.vendorId=b(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=b(e.get(`--pid`),`pid`)),e.has(`--usage-page`)&&(t.usagePage=b(e.get(`--usage-page`),`usage-page`)),e.has(`--usage`)&&(t.usage=b(e.get(`--usage`),`usage`)),Object.keys(t).length>0?[t]:[]}`${i}`;var S=new Set([`--vid`,`--pid`,`--class`,`--subclass`,`--protocol`,`--serial`,`--request-type`,`--recipient`,`--request`,`--value`,`--index`,`--__resolved`]);function C(e){return u(e,S)}function w(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 T(e){let t={};return e.has(`--vid`)&&(t.vendorId=w(e.get(`--vid`),`vid`)),e.has(`--pid`)&&(t.productId=w(e.get(`--pid`),`pid`)),e.has(`--class`)&&(t.classCode=w(e.get(`--class`),`class`)),e.has(`--subclass`)&&(t.subclassCode=w(e.get(`--subclass`),`subclass`)),e.has(`--protocol`)&&(t.protocolCode=w(e.get(`--protocol`),`protocol`)),e.has(`--serial`)&&(t.serialNumber=e.get(`--serial`)),Object.keys(t).length>0?[t]:[]}`${c}`;var E=`\x1B]7777;`,D=/\x1b\]7777;(\d+)\x07/g;String.raw`printf '\033]7777;%s\007' "$?"`,[`if [ -f ~/.bashrc ]; then . ~/.bashrc; fi`,`exec 98<&-`,``].join(`
3
3
  `);function O(e){let t=e.replace(/\r\n/g,`
4
4
  `),n=t.indexOf(`
@@ -6,7 +6,7 @@ import{t as e}from"./preload-helper-Czpn1I53.js";import"./tool-ui-eSQ1g2I1.js";i
6
6
  `),this.prompt=e,this.line=[],this.cursor=0,this.historyIndex=this.history.length,this.draft=``,this.anchorRow=this.display.getCursor().row,this.display.write(e),new Promise((e,t)=>{this.resolve=e,this.reject=t})}abort(e){this.reject?.(e),this.resolve=null,this.reject=null}setLine(e){this.isReading&&(this.line=[...e],this.cursor=this.line.length,this.redraw())}insert(e){if(!this.isReading||!e)return;let t=[...e.replace(/[\r\n\x1b]/g,``)];this.line.splice(this.cursor,0,...t),this.cursor+=t.length,this.redraw()}list(e){if(!this.isReading)return;let t=this.cursor;this.cursor=this.line.length,this.redraw(),this.display.write(`\r\n${e.join(` `)}\r\n`),this.anchorRow=this.display.getCursor().row,this.cursor=t,this.redraw()}accept(){if(!this.resolve)return;this.cursor=this.line.length,this.redraw();let e=this.text;this.display.write(`\r
7
7
  `),e.trim()&&this.history.at(-1)!==e&&(this.history.push(e),this.history.length>A&&this.history.shift());let t=this.resolve;this.resolve=null,this.reject=null,t(e)}cancel(){if(!this.resolve)return;this.cursor=this.line.length,this.redraw(),this.display.write(`^C\r
8
8
  `);let e=this.resolve;this.resolve=null,this.reject=null,e(``)}feed(e){if(this.isReading)switch(e){case`\r`:case`
9
- `:this.accept();return;case``:this.cancel();return;case``:case`\b`:this.cursor>0&&(this.line.splice(--this.cursor,1),this.redraw());return;case`\x1B[3~`:this.cursor<this.line.length&&(this.line.splice(this.cursor,1),this.redraw());return;case`\x1B[D`:case`\x1BOD`:this.cursor=Math.max(0,this.cursor-1),this.redraw();return;case`\x1B[C`:case`\x1BOC`:this.cursor=Math.min(this.line.length,this.cursor+1),this.redraw();return;case`\x1B[H`:case`\x1BOH`:case``:this.cursor=0,this.redraw();return;case`\x1B[F`:case`\x1BOF`:case``:this.cursor=this.line.length,this.redraw();return;case`\x1B[A`:case`\x1BOA`:this.navigate(-1);return;case`\x1B[B`:case`\x1BOB`:this.navigate(1);return;case``:this.line.splice(0,this.cursor),this.cursor=0,this.redraw();return;case`\v`:this.line.splice(this.cursor),this.redraw();return;case``:{let e=this.cursor;for(;e>0&&/\s/.test(this.line[e-1]??``);)e--;for(;e>0&&!/\s/.test(this.line[e-1]??``);)e--;this.line.splice(e,this.cursor-e),this.cursor=e,this.redraw();return}default:!e.includes(`\x1B`)&&!/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e)&&this.insert(e.replace(/[\r\n\t]+/g,` `))}}navigate(e){e<0&&this.historyIndex===0||e>0&&this.historyIndex===this.history.length||(this.historyIndex===this.history.length&&(this.draft=this.text),this.historyIndex+=e,this.line=[...this.history[this.historyIndex]??this.draft],this.cursor=this.line.length,this.redraw())}redraw(){let{row:e}=this.display.getCursor(),t=this.display.getScrollbackCount(),n=e-this.anchorRow;n>0&&this.display.write(`\x1b[${n}A`),this.display.write(`\r\x1B[0J`),this.display.write(this.prompt+this.beforeCursor),this.display.write(`\x1B7`),this.display.write(this.line.slice(this.cursor).join(``)),this.display.write(`\x1B8`),this.anchorRow=Math.max(0,this.anchorRow-(this.display.getScrollbackCount()-t))}},M=`\x1B[34m/\x1B[0m \x1B[90m$\x1B[0m `,N=class{options;client;terminal=null;terminalHost=null;previewHost=null;previewUrls=[];hasPreview=!1;previewStateListener=null;resizeObserver=null;rejectTerminalReady=null;editor=null;disposed=!1;programmaticResolve=null;isExecuting=!1;ptyMode=!1;loginShell=!1;loginSawPty=!1;marks=new k;settleSession=()=>{};sessionSettled=new Promise(e=>{this.settleSession=e});reportedSize=``;suppressOutput=!1;tabBusy=!1;pendingTabInput=[];constructor(e){this.options=e;let t=e.sid??`panel-terminal-${Date.now()}`;this.client=new l({client:e.client,sid:t,onEvent:e=>this.handleEvent(e)})}async mount(t){if(await e(()=>import(`./wc-shell-BBeNiS8R.js`).then(e=>e.N),__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,28,29,30,31,32,33,34,35,36,37,38,39])),this.disposed)return;t.replaceChildren(),this.terminalHost=document.createElement(`div`),this.terminalHost.className=`terminal-panel__terminal-host`,t.appendChild(this.terminalHost),this.previewHost=document.createElement(`div`),this.previewHost.className=`terminal-panel__preview`,t.appendChild(this.previewHost);let n=document.createElement(`slicc-terminal`);n.hideHeader=!0,n.style.width=`100%`,n.style.height=`100%`,this.terminal=n;let r=new Promise((e,t)=>{let r=()=>{n.removeEventListener(`terminal-ready`,i),n.removeEventListener(`terminal-error`,a),this.rejectTerminalReady=null},i=()=>{r(),e()},a=e=>{r(),t(e.detail)};this.rejectTerminalReady=e=>{r(),t(e)},n.addEventListener(`terminal-ready`,i),n.addEventListener(`terminal-error`,a)});n.addEventListener(`terminal-data`,e=>{this.handleTerminalData(e.detail)}),this.terminalHost.appendChild(n),await r,!this.disposed&&(n.fit(),this.editor=new j({write:e=>n.write(e),getCursor:()=>n.terminal?.bridge?.getCursor()??{row:0,col:0},getScrollbackCount:()=>n.terminal?.bridge?.getScrollbackCount()??0}),this.resizeObserver=new ResizeObserver(()=>this.refit()),this.resizeObserver.observe(this.terminalHost),await this.client.open({cwd:this.options.cwd,env:this.options.env}),this.startSession(n))}async startSession(e){let t=await this.runLoginShell();this.disposed||(t||(e.writeln(`\x1B[1mslicc\x1B[0m \x1B[90mshell (kernel)\x1B[0m`),e.writeln(`\x1B[90mType "help" for available commands.\x1B[0m`),e.writeln(``)),this.runPromptLoop(),this.settleSession())}async runLoginShell(){this.loginShell=!0,this.loginSawPty=!1;let e=await this.runRemote(`wasm --login`,{discardCapturedOutput:!0});return this.loginShell=!1,this.marks.end(),!this.loginSawPty&&e.exitCode===125?null:(this.terminal?.writeln(`\x1b[90mbash exited (${e.exitCode}); this is the slicc shell. \`wasm --login\` starts bash again.\x1b[0m`),e)}refit(){this.terminal?.fit(),this.reportSize()}reportSize(){let e=this.terminal?.terminal;if(!e)return;let t=`${e.cols}x${e.rows}`;t!==this.reportedSize&&(this.reportedSize=t,this.client.resize(e.cols,e.rows))}clearTerminal(){this.terminal?.clear()}async executeCommandInTerminal(e){let t=e.trim();if(!t)return{stdout:``,stderr:``,exitCode:0};if(this.editor&&!(this.loginShell&&this.ptyMode)&&await this.sessionSettled,this.loginShell&&this.ptyMode)return this.typeIntoLoginShell(t);if(!this.terminal||!this.editor)return this.client.exec(t);if(this.isExecuting||this.programmaticResolve||!this.editor.isReading||this.editor.text)return{stdout:``,stderr:`terminal is busy; finish current input first
9
+ `:this.accept();return;case``:this.cancel();return;case``:case`\b`:this.cursor>0&&(this.line.splice(--this.cursor,1),this.redraw());return;case`\x1B[3~`:this.cursor<this.line.length&&(this.line.splice(this.cursor,1),this.redraw());return;case`\x1B[D`:case`\x1BOD`:this.cursor=Math.max(0,this.cursor-1),this.redraw();return;case`\x1B[C`:case`\x1BOC`:this.cursor=Math.min(this.line.length,this.cursor+1),this.redraw();return;case`\x1B[H`:case`\x1BOH`:case``:this.cursor=0,this.redraw();return;case`\x1B[F`:case`\x1BOF`:case``:this.cursor=this.line.length,this.redraw();return;case`\x1B[A`:case`\x1BOA`:this.navigate(-1);return;case`\x1B[B`:case`\x1BOB`:this.navigate(1);return;case``:this.line.splice(0,this.cursor),this.cursor=0,this.redraw();return;case`\v`:this.line.splice(this.cursor),this.redraw();return;case``:{let e=this.cursor;for(;e>0&&/\s/.test(this.line[e-1]??``);)e--;for(;e>0&&!/\s/.test(this.line[e-1]??``);)e--;this.line.splice(e,this.cursor-e),this.cursor=e,this.redraw();return}default:!e.includes(`\x1B`)&&!/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/.test(e)&&this.insert(e.replace(/[\r\n\t]+/g,` `))}}navigate(e){e<0&&this.historyIndex===0||e>0&&this.historyIndex===this.history.length||(this.historyIndex===this.history.length&&(this.draft=this.text),this.historyIndex+=e,this.line=[...this.history[this.historyIndex]??this.draft],this.cursor=this.line.length,this.redraw())}redraw(){let{row:e}=this.display.getCursor(),t=this.display.getScrollbackCount(),n=e-this.anchorRow;n>0&&this.display.write(`\x1b[${n}A`),this.display.write(`\r\x1B[0J`),this.display.write(this.prompt+this.beforeCursor),this.display.write(`\x1B7`),this.display.write(this.line.slice(this.cursor).join(``)),this.display.write(`\x1B8`),this.anchorRow=Math.max(0,this.anchorRow-(this.display.getScrollbackCount()-t))}},M=`\x1B[34m/\x1B[0m \x1B[90m$\x1B[0m `,N=class{options;client;terminal=null;terminalHost=null;previewHost=null;previewUrls=[];hasPreview=!1;previewStateListener=null;resizeObserver=null;rejectTerminalReady=null;editor=null;disposed=!1;programmaticResolve=null;isExecuting=!1;ptyMode=!1;loginShell=!1;loginSawPty=!1;marks=new k;settleSession=()=>{};sessionSettled=new Promise(e=>{this.settleSession=e});reportedSize=``;suppressOutput=!1;tabBusy=!1;pendingTabInput=[];constructor(e){this.options=e;let t=e.sid??`panel-terminal-${Date.now()}`;this.client=new l({client:e.client,sid:t,onEvent:e=>this.handleEvent(e)})}async mount(t){if(await e(()=>import(`./wc-shell-xh75VEiE.js`).then(e=>e.N),__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,28,29,30,31,32,33,34,35,36,37,38,39])),this.disposed)return;t.replaceChildren(),this.terminalHost=document.createElement(`div`),this.terminalHost.className=`terminal-panel__terminal-host`,t.appendChild(this.terminalHost),this.previewHost=document.createElement(`div`),this.previewHost.className=`terminal-panel__preview`,t.appendChild(this.previewHost);let n=document.createElement(`slicc-terminal`);n.hideHeader=!0,n.style.width=`100%`,n.style.height=`100%`,this.terminal=n;let r=new Promise((e,t)=>{let r=()=>{n.removeEventListener(`terminal-ready`,i),n.removeEventListener(`terminal-error`,a),this.rejectTerminalReady=null},i=()=>{r(),e()},a=e=>{r(),t(e.detail)};this.rejectTerminalReady=e=>{r(),t(e)},n.addEventListener(`terminal-ready`,i),n.addEventListener(`terminal-error`,a)});n.addEventListener(`terminal-data`,e=>{this.handleTerminalData(e.detail)}),this.terminalHost.appendChild(n),await r,!this.disposed&&(n.fit(),this.editor=new j({write:e=>n.write(e),getCursor:()=>n.terminal?.bridge?.getCursor()??{row:0,col:0},getScrollbackCount:()=>n.terminal?.bridge?.getScrollbackCount()??0}),this.resizeObserver=new ResizeObserver(()=>this.refit()),this.resizeObserver.observe(this.terminalHost),await this.client.open({cwd:this.options.cwd,env:this.options.env}),this.startSession(n))}async startSession(e){let t=await this.runLoginShell();this.disposed||(t||(e.writeln(`\x1B[1mslicc\x1B[0m \x1B[90mshell (kernel)\x1B[0m`),e.writeln(`\x1B[90mType "help" for available commands.\x1B[0m`),e.writeln(``)),this.runPromptLoop(),this.settleSession())}async runLoginShell(){this.loginShell=!0,this.loginSawPty=!1;let e=await this.runRemote(`wasm --login`,{discardCapturedOutput:!0});return this.loginShell=!1,this.marks.end(),!this.loginSawPty&&e.exitCode===125?null:(this.terminal?.writeln(`\x1b[90mbash exited (${e.exitCode}); this is the slicc shell. \`wasm --login\` starts bash again.\x1b[0m`),e)}refit(){this.terminal?.fit(),this.reportSize()}reportSize(){let e=this.terminal?.terminal;if(!e)return;let t=`${e.cols}x${e.rows}`;t!==this.reportedSize&&(this.reportedSize=t,this.client.resize(e.cols,e.rows))}clearTerminal(){this.terminal?.clear()}async executeCommandInTerminal(e){let t=e.trim();if(!t)return{stdout:``,stderr:``,exitCode:0};if(this.editor&&!(this.loginShell&&this.ptyMode)&&await this.sessionSettled,this.loginShell&&this.ptyMode)return this.typeIntoLoginShell(t);if(!this.terminal||!this.editor)return this.client.exec(t);if(this.isExecuting||this.programmaticResolve||!this.editor.isReading||this.editor.text)return{stdout:``,stderr:`terminal is busy; finish current input first
10
10
  `,exitCode:1};let n=new Promise(e=>{this.programmaticResolve=e});return this.editor.setLine(t),this.editor.accept(),n}typeIntoLoginShell(e){if(this.marks.pending)return Promise.resolve({stdout:``,stderr:`terminal is busy
11
11
  `,exitCode:1});let t=this.marks.seen?this.marks.expect():Promise.resolve({stdout:``,stderr:``,exitCode:0});return this.client.stdin(`${e}\r`),t}setPreviewStateListener(e){this.previewStateListener=e,e?.(this.hasPreview)}dispose(){this.disposed=!0,this.settleSession(),this.rejectTerminalReady?.(Error(`terminal disposed`)),this.editor?.abort(Error(`terminal disposed`)),this.clearMediaPreview(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.terminal?.remove(),this.terminal=null,this.editor=null,this.pendingTabInput=[],this.terminalHost=null,this.previewHost=null,this.client.close(),this.client.dispose()}renderMediaPreview(e){if(!this.previewHost)return;let t=document.createElement(`div`);t.className=`terminal-panel__preview-item`;let n=document.createElement(`div`);n.className=`terminal-panel__preview-label`;let r=e.path.split(`/`).pop()??e.path;if(n.textContent=`${r} · ${e.mediaType}`,t.appendChild(n),e.mediaType===`image/png`){let n=document.createElement(`slicc-terminal`);n.hideHeader=!0,n.style.width=`100%`,n.style.height=`180px`,n.style.pointerEvents=`none`,n.setAttribute(`aria-label`,`Kitty graphics preview of ${r}`),n.addEventListener(`terminal-ready`,()=>requestAnimationFrame(()=>{let e=n.shadowRoot?.querySelector(`.host`);e&&(e.scrollTop=0),this.terminal?.focus()}),{once:!0}),t.appendChild(n);for(let t=0;t<e.data.length;t+=4096){let r=t===0,i=t+4096>=e.data.length,a=r?`a=T,f=100,t=d,m=${+!i}`:`m=${+!i}`;n.write(`\x1b_G${a};${e.data.slice(t,t+4096)}\x1b\\`)}}else if(e.mediaType.startsWith(`video/`)){let n=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0)),r=URL.createObjectURL(new Blob([n],{type:e.mediaType}));this.previewUrls.push(r);let i=document.createElement(`video`);i.className=`terminal-panel__preview-media`,i.controls=!0,i.autoplay=!0,i.loop=!0,i.muted=!0,i.playsInline=!0,i.src=r,i.addEventListener(`loadedmetadata`,()=>this.refit(),{once:!0}),t.appendChild(i)}else{let n=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0)),i=URL.createObjectURL(new Blob([n],{type:e.mediaType}));this.previewUrls.push(i);let a=document.createElement(`img`);a.className=`terminal-panel__preview-media`,a.alt=r,a.src=i,a.addEventListener(`load`,()=>this.refit(),{once:!0}),t.appendChild(a)}this.previewHost.appendChild(t),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.editor&&this.terminal;){let e;try{e=await this.readNextLine()}catch{break}let t=this.programmaticResolve!==null,n=await this.processLine(e,t);this.programmaticResolve&&=(this.programmaticResolve(n),null)}}readNextLine(){if(!this.editor)return Promise.reject(Error(`terminal not mounted`));let e=this.editor.read(M);return this.flushPendingTabInput(),e}flushPendingTabInput(){for(;this.editor?.isReading&&this.pendingTabInput.length>0;)this.editor.feed(this.pendingTabInput.shift()??``)}handleTerminalData(e){if(this.ptyMode){this.client.stdin(e);return}e===` `?this.tabBusy||this.handleTab():e===``&&this.isExecuting?this.signalInterruptDuringExec():this.tabBusy?this.pendingTabInput.push(e):this.editor?.feed(e)}async processLine(e,t=!1){let n=e.trim(),r={stdout:``,stderr:``,exitCode:0};return n?n===`wasm --login`?await this.runLoginShell()??{stdout:``,stderr:`wasm: --login: no GNU bash to log in to (install @ai-ecoverse/wasm-bash)
12
12
  `,exitCode:125}:!t&&await this.tryRunPicker(n)?r:this.runRemote(n):r}async tryRunPicker(e){let t=P(e);if(t)return await this.runRemoteWithLocalPicker(e,t),!0;let n=V(e);if(n)return await this.runRemoteWithUsbPicker(n),!0;let r=H(e);if(r)return await this.runRemoteWithHidPicker(r),!0;let i=W(e);if(i)return await this.runRemoteWithSerialPicker(i),!0;let a=G(e);if(a)return await this.runRemoteWithEsptoolPicker(e,a),!0;let o=B(e);return o?(await this.runRemoteWithScreenShare(o.name),!0):!1}signalInterruptDuringExec(){this.isExecuting&&(this.terminal?.writeln(`^C`),this.client.signal(`SIGINT`))}async handleTab(){if(!(!this.terminal||!this.editor)&&!(this.isExecuting||this.tabBusy)){this.tabBusy=!0,this.isExecuting=!0;try{let e=this.editor.beforeCursor,{currentWord:t,isFirstWord:n,compgenCmd:r}=q(e);this.suppressOutput=!0;let i=``;try{i=(await this.client.exec(r)).stdout}finally{this.suppressOutput=!1}let a=i.split(`
@@ -1 +1 @@
1
- import{n as e,s as t,t as n}from"./almost-bash-shell-headless-HOeKQtgA.js";import{n as r}from"./browser-CGX7MbCQ.js";import{c as i}from"./sudoers-BdBYQPUn.js";import{r as a}from"./sudo-fs-D88yRk1b.js";import{o}from"./just-bash-compat-B-SPHuh_.js";import{n as s}from"./jsh-discovery-CnvNKojr.js";import{n as c,r as l}from"./supervisor-DsxjOzXp.js";function u(e,n){return new Map(Object.entries({HOME:t,PATH:s,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:e.cwd,...n,...e.env}))}function d(e,t,n,i){let a=u(t,i);return r({fs:e,cwd:t.cwd,env:a,stdin:o(``),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(t){let r=h(t.fs,t.sudo),i=new e(r),a=new n({fs:r,cwd:`/workspace`,processManager:t.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:t.fs,processManager:t.processManager,lickManager:t.lickManager,...t.realmFactory?{realmFactory:t.realmFactory}:{},buildContext:e=>m(i,e,o)}),u=(await l(t.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};
1
+ import{n as e,s as t,t as n}from"./almost-bash-shell-headless--cwLwrzv.js";import{n as r}from"./browser-CGX7MbCQ.js";import{c as i}from"./sudoers-BdBYQPUn.js";import{r as a}from"./sudo-fs-D88yRk1b.js";import{o}from"./just-bash-compat-B-SPHuh_.js";import{n as s}from"./jsh-discovery-CnvNKojr.js";import{n as c,r as l}from"./supervisor-VGZUDK1b.js";function u(e,n){return new Map(Object.entries({HOME:t,PATH:s,USER:`user`,SHELL:`/bin/bash`,TMPDIR:`/tmp`,PWD:e.cwd,...n,...e.env}))}function d(e,t,n,i){let a=u(t,i);return r({fs:e,cwd:t.cwd,env:a,stdin:o(``),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(t){let r=h(t.fs,t.sudo),i=new e(r),a=new n({fs:r,cwd:`/workspace`,processManager:t.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:t.fs,processManager:t.processManager,lickManager:t.lickManager,...t.realmFactory?{realmFactory:t.realmFactory}:{},buildContext:e=>m(i,e,o)}),u=(await l(t.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};
@@ -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-DsxjOzXp.js";const u=`usage: jshd <command> [options]
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-VGZUDK1b.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-DsxjOzXp.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(`
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-VGZUDK1b.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"./record-COQlaFL1.js";import{t,u as n}from"./descriptor-CKLcFFX3.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-CFfevxz_.js";import{s as c}from"./kernel-worker-yDR9ykP9.js";const l=`usage: memory <command> [options]
1
+ import{t as e}from"./record-COQlaFL1.js";import{t,u as n}from"./descriptor-CKLcFFX3.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-CFfevxz_.js";import{s as c}from"./kernel-worker-DAOlZAnY.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.