sliccy 6.165.0 → 6.166.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/dist/node-server/_shared/computer-protocol.d.ts +108 -0
  2. package/dist/node-server/_shared/computer-protocol.d.ts.map +1 -0
  3. package/dist/node-server/_shared/computer-protocol.js +10 -0
  4. package/dist/node-server/_shared/computer-protocol.js.map +1 -0
  5. package/dist/node-server/_shared/index.d.ts +1 -0
  6. package/dist/node-server/_shared/index.d.ts.map +1 -1
  7. package/dist/node-server/_shared/index.js +1 -0
  8. package/dist/node-server/_shared/index.js.map +1 -1
  9. package/dist/ui/.vite/manifest.json +184 -174
  10. package/dist/ui/assets/{SKILL-C8DJkgFD.js → SKILL-BGEZa-y0.js} +1 -1
  11. package/dist/ui/assets/SKILL-DB5CVwyu.js +1 -0
  12. package/dist/ui/assets/SKILL-DEFDsScb.js +1 -0
  13. package/dist/ui/assets/{SKILL-0AeLgxT3.js → SKILL-DZoCcID_.js} +1 -1
  14. package/dist/ui/assets/{account-store-lzZlhljv.js → account-store-BEqmysw9.js} +1 -1
  15. package/dist/ui/assets/{account-store-CJHBoL7P.js → account-store-C35GYvum.js} +1 -1
  16. package/dist/ui/assets/{adobe-DbBJWbF9.js → adobe-BDH5oLAN.js} +1 -1
  17. package/dist/ui/assets/{adobe-DUaaJHme.js → adobe-BcTGFCnQ.js} +1 -1
  18. package/dist/ui/assets/{agent-panels-DQh4wRpa.js → agent-panels-DvqNnkLk.js} +1 -1
  19. package/dist/ui/assets/{almost-bash-shell-headless-DdfO5taA.js → almost-bash-shell-headless-DqTtE9CM.js} +506 -508
  20. package/dist/ui/assets/{apply-layout-DeIHdw5o.js → apply-layout-CjYRGs37.js} +1 -1
  21. package/dist/ui/assets/{apps-X6cH7Ngi.js → apps-dzoLZ_5W.js} +1 -1
  22. package/dist/ui/assets/{azure-openai-DS5DA5ql.js → azure-openai-BffwoCtp.js} +1 -1
  23. package/dist/ui/assets/{azure-openai-DoDPxnFq.js → azure-openai-DKGdcr4S.js} +1 -1
  24. package/dist/ui/assets/{backend-hostfs-9Xwjq8kU.js → backend-hostfs-CWIlIhve.js} +1 -1
  25. package/dist/ui/assets/bridge-protocol-31SWTdS5.js +1 -0
  26. package/dist/ui/assets/{cdp-Bi4OGeyp.js → cdp-DXT6yEL1.js} +1 -1
  27. package/dist/ui/assets/{cerebras-D9Xp_f8D.js → cerebras-BF5efkRL.js} +1 -1
  28. package/dist/ui/assets/{cerebras-BzQeaK2Z.js → cerebras-By0l7t0i.js} +1 -1
  29. package/dist/ui/assets/{composer-speech-BVpldTNH.js → composer-speech-DIEePbQC.js} +1 -1
  30. package/dist/ui/assets/{connect-surface-CyUMMhhU.js → connect-surface-DBqs7oHf.js} +1 -1
  31. package/dist/ui/assets/{directed-approval-CaEocD9T.js → directed-approval-D1lGElvD.js} +1 -1
  32. package/dist/ui/assets/{ensure-speech-assets-B9REkBI_.js → ensure-speech-assets-BJXemBO4.js} +1 -1
  33. package/dist/ui/assets/fake-computer-1f2_4vxY.js +65 -0
  34. package/dist/ui/assets/{frozen-archive-writer-BWuT2QtJ.js → frozen-archive-writer-DYPhPMg7.js} +1 -1
  35. package/dist/ui/assets/{fs-C3QG5M_q.js → fs-BapOupIM.js} +2 -2
  36. package/dist/ui/assets/{fs-CmCsE1zE.js → fs-CBH-hQcI.js} +1 -1
  37. package/dist/ui/assets/{gelatiere-store-ijXRupBc.js → gelatiere-store-C2u47uk0.js} +1 -1
  38. package/dist/ui/assets/{gelatiere-unit-BlRXo_Ch.js → gelatiere-unit-wvDEO7gH.js} +1 -1
  39. package/dist/ui/assets/{github-2vLuAY6J.js → github-Bx7_6LBm.js} +2 -2
  40. package/dist/ui/assets/{github-Zcx-gHTn.js → github-Db015Tee.js} +1 -1
  41. package/dist/ui/assets/{github-auth-87ZWWpe-.js → github-auth-DtKS6UIX.js} +1 -1
  42. package/dist/ui/assets/{github-copilot-DaHQ2cTA.js → github-copilot-CtOjxhqK.js} +1 -1
  43. package/dist/ui/assets/{github-copilot-CdwPARvl.js → github-copilot-eCfmryv6.js} +1 -1
  44. package/dist/ui/assets/{github-install-CCQJ7A9f.js → github-install-B6W4-xcc.js} +1 -1
  45. package/dist/ui/assets/{github-zip-D4jSHksq.js → github-zip-Bv1smNmy.js} +1 -1
  46. package/dist/ui/assets/{handoff-link-NCw3cxSG.js → handoff-link-B3It6xQY.js} +1 -1
  47. package/dist/ui/assets/{hear-CovWNOND.js → hear-BZHckZJM.js} +1 -1
  48. package/dist/ui/assets/{help-BmMJZSmm.js → help-BU2Hjl0P.js} +1 -1
  49. package/dist/ui/assets/host-BQ2qKD-D.js +1 -0
  50. package/dist/ui/assets/{installer-BOAaojqu.js → installer-BbtH3u7z.js} +1 -1
  51. package/dist/ui/assets/js-realm-worker-BT3mfq3w.js +50 -0
  52. package/dist/ui/assets/jsh-CrSWPG4t.js +1 -0
  53. package/dist/ui/assets/jsh-executor-BWlgcE2N.js +18 -0
  54. package/dist/ui/assets/jsh-runtime-extensions-BnLXkzqP.js +1 -0
  55. package/dist/ui/assets/{kernel-worker-CrTnmx6N.js → kernel-worker-Dseu067f.js} +38 -38
  56. package/dist/ui/assets/keys-n5_C9sHW.js +1 -0
  57. package/dist/ui/assets/{lick-ws-bridge-56mwSRdV.js → lick-ws-bridge-Cc9sToY7.js} +1 -1
  58. package/dist/ui/assets/{lick-ws-bridge-D4FyZHWP.js → lick-ws-bridge-ChigxI36.js} +1 -1
  59. package/dist/ui/assets/{live-session-snapshot-ZXxxxzvO.js → live-session-snapshot-B70raB09.js} +1 -1
  60. package/dist/ui/assets/{local-llm-B6tgSQ84.js → local-llm-Dcp5IIP-.js} +1 -1
  61. package/dist/ui/assets/{local-llm-BDbJaGUp.js → local-llm-DpSg-Oe3.js} +1 -1
  62. package/dist/ui/assets/{main-Dxem3Ydy.js → main-CfF8CFBr.js} +3 -3
  63. package/dist/ui/assets/{main-cherry-D1lfDTVL.js → main-cherry-VckJPHm5.js} +1 -1
  64. package/dist/ui/assets/{memory-curation-seam-ZGh8tSbe.js → memory-curation-seam-DUaZFZG9.js} +1 -1
  65. package/dist/ui/assets/{memory-health-CZHaK5wO.js → memory-health-D7uEvfAx.js} +1 -1
  66. package/dist/ui/assets/memory-v2-flag-BHVbti6Z.js +1 -0
  67. package/dist/ui/assets/{memory-write-execute-Csx1-nfE.js → memory-write-execute-rXtR1z76.js} +1 -1
  68. package/dist/ui/assets/{mount-DCCYSZwW.js → mount-8lU2iH4k.js} +3 -3
  69. package/dist/ui/assets/{mount-ByktCqqU.js → mount-DoM0CLGG.js} +1 -1
  70. package/dist/ui/assets/{new-session-CG_ht0Kw.js → new-session-DEhAjxP1.js} +2 -2
  71. package/dist/ui/assets/{oauth-bootstrap-CQmrSZN1.js → oauth-bootstrap-DNTgbEZF.js} +2 -2
  72. package/dist/ui/assets/{onboarding-orchestrator-DZFSsW4q.js → onboarding-orchestrator-DzPQ0pVG.js} +1 -1
  73. package/dist/ui/assets/{openai-codex-dKSgjDc_.js → openai-codex-CsAhfz0D.js} +1 -1
  74. package/dist/ui/assets/{openai-codex-ebHt4iSf.js → openai-codex-DYRKYWTe.js} +1 -1
  75. package/dist/ui/assets/{openrouter-CsPQehN8.js → openrouter-D9T6tXUF.js} +1 -1
  76. package/dist/ui/assets/{openrouter-BQhA4-TP.js → openrouter-IyZlRHg4.js} +1 -1
  77. package/dist/ui/assets/{openrouter-free-kxAwjRgT.js → openrouter-free-CPshAgQD.js} +1 -1
  78. package/dist/ui/assets/{openrouter-free-BppbTow1.js → openrouter-free-DfbYsnmf.js} +1 -1
  79. package/dist/ui/assets/{openrouter-oauth-D0vfD1T8.js → openrouter-oauth-hZg6oH0A.js} +1 -1
  80. package/dist/ui/assets/{openrouter-oauth-B3y32yAJ.js → openrouter-oauth-xKlWi_wI.js} +1 -1
  81. package/dist/ui/assets/{opfs-mount-ld8qlksz.js → opfs-mount-C9Iamj6N.js} +1 -1
  82. package/dist/ui/assets/panel-rpc-handlers-Nu-wOrG9.js +2 -0
  83. package/dist/ui/assets/{panelize-shell-BdV-wKTx.js → panelize-shell-tFElgHWF.js} +1 -1
  84. package/dist/ui/assets/{pi-edit-execution-CoRFZcs7.js → pi-edit-execution-D6vx5LyF.js} +1 -1
  85. package/dist/ui/assets/{provider-CNKZIWc1.js → provider-3--cEcAF.js} +1 -1
  86. package/dist/ui/assets/{provider-DE1pR-oR.js → provider-Z5aj7SzG.js} +2 -2
  87. package/dist/ui/assets/{provider-settings-D8qwiWrG.js → provider-settings-D9sjEfYE.js} +1 -1
  88. package/dist/ui/assets/provider-store-access-M0PvJ08M.js +1 -0
  89. package/dist/ui/assets/provider-store-access-RxIHhH6d.js +1 -0
  90. package/dist/ui/assets/{providers-InF4o-U9.js → providers-CnoKdyLc.js} +2 -2
  91. package/dist/ui/assets/{providers-CUF9nsUE.js → providers-DVvrXbtx.js} +1 -1
  92. package/dist/ui/assets/{quick-llm-CQWR6xvc.js → quick-llm-DjWE-wQw.js} +1 -1
  93. package/dist/ui/assets/realm-inprocess-D0iWBQzz.js +30 -0
  94. package/dist/ui/assets/{recovery-screen-DWMb8zIg.js → recovery-screen-Y1CSyfR-.js} +1 -1
  95. package/dist/ui/assets/registry-Bq_j-EXx.js +1 -0
  96. package/dist/ui/assets/{restore-PqiSHlx3.js → restore-DOkDX8BI.js} +1 -1
  97. package/dist/ui/assets/{run-F7Bv3Fcu.js → run-B-fA26ea.js} +1 -1
  98. package/dist/ui/assets/run-BEt0RS3J.js +52 -0
  99. package/dist/ui/assets/{run-DJQAmghw.js → run-BOc9XLhg.js} +1 -1
  100. package/dist/ui/assets/{run-Bqg_NW7f.js → run-BWJSDhS7.js} +2 -2
  101. package/dist/ui/assets/{run-Do5pAlQf.js → run-DgNh1E56.js} +2 -2
  102. package/dist/ui/assets/{run-DoD-L3x8.js → run-a67LpkRp.js} +2 -2
  103. package/dist/ui/assets/{run-w1tdYqAg.js → run-vEDh-Me-.js} +2 -2
  104. package/dist/ui/assets/{session-command-memory-BKzFoCAZ.js → session-command-memory-DB2GmPSU.js} +2 -2
  105. package/dist/ui/assets/{session-jsonl-DjDV9zx6.js → session-jsonl-DFC-2T76.js} +1 -1
  106. package/dist/ui/assets/{session-jsonl-C7a0swa5.js → session-jsonl-D_pTYppB.js} +1 -1
  107. package/dist/ui/assets/{session-search-index-CMRSS2CP.js → session-search-index-CN1zDLlx.js} +1 -1
  108. package/dist/ui/assets/{setup-feature-flags-remote-BmKhybEI.js → setup-feature-flags-remote-BVd31Z12.js} +1 -1
  109. package/dist/ui/assets/{signed-fetch-DDtJ0TE5.js → signed-fetch-BY2Mdjqe.js} +1 -1
  110. package/dist/ui/assets/{silent-renew-backoff-CBUhiIba.js → silent-renew-backoff-CKAAh6GN.js} +1 -1
  111. package/dist/ui/assets/{silent-renew-backoff-DIMz5UqB.js → silent-renew-backoff-Dmz3DJHb.js} +1 -1
  112. package/dist/ui/assets/slicc-version-BZyTvfoc.js +1 -0
  113. package/dist/ui/assets/{snapshot-features-BIG7eB0k.js → snapshot-features-DjMJkCGq.js} +1 -1
  114. package/dist/ui/assets/{snapshot-DyCo7e-C.js → snapshot-gi8tDzvN.js} +1 -1
  115. package/dist/ui/assets/{soundscape-bHynTI4A.js → soundscape-Bl3LhUk9.js} +1 -1
  116. package/dist/ui/assets/{speak-DbL0fEQT.js → speak-BY_fDou2.js} +1 -1
  117. package/dist/ui/assets/{sprinkle-manager-Bhwou11b.js → sprinkle-manager-C-NUJqPy.js} +1 -1
  118. package/dist/ui/assets/{sprinkle-renderer-CEIEQSMS.js → sprinkle-renderer-CcA6ie5u.js} +1 -1
  119. package/dist/ui/assets/{state-BdNtTsoR.js → state-z3wOHLww.js} +1 -1
  120. package/dist/ui/assets/{store-CJD-1zaX.js → store-ByUcAFUa.js} +1 -1
  121. package/dist/ui/assets/{store-BRXCCWDC.js → store-ChWzn_H8.js} +1 -1
  122. package/dist/ui/assets/{sudo-QHJEgCZR.js → sudo-DNZFIZ-H.js} +1 -1
  123. package/dist/ui/assets/{supervisor-DILjXQCB.js → supervisor-BtH2-9sE.js} +1 -1
  124. package/dist/ui/assets/{sync-dialog-8D9LiBVV.js → sync-dialog-Jqz74VkZ.js} +1 -1
  125. package/dist/ui/assets/tab-ToMhjbM4.js +1 -0
  126. package/dist/ui/assets/{transformers-env-jBVeNAIF.js → transformers-env-pq1E2H6B.js} +1 -1
  127. package/dist/ui/assets/{tray-leader-BxfP0EC1.js → tray-leader-Bas0lH9O.js} +1 -1
  128. package/dist/ui/assets/{tray-leave-runtime-1j0s9Yqq.js → tray-leave-runtime-B9aV_guA.js} +1 -1
  129. package/dist/ui/assets/tray-runtime-config-BZoJXfW0.js +1 -0
  130. package/dist/ui/assets/{tray-sidecar-BUsex5hw.js → tray-sidecar-DA8NfCV6.js} +1 -1
  131. package/dist/ui/assets/{upgrade-detection-DCwNWWGX.js → upgrade-detection-B5ym__Gu.js} +1 -1
  132. package/dist/ui/assets/{upskill-lick-skip-C9u8AmfA.js → upskill-lick-skip-CZGM2OFA.js} +1 -1
  133. package/dist/ui/assets/v86-DseFx8Yp.js +1 -0
  134. package/dist/ui/assets/v86-vm-DCm7zA2r.js +2 -0
  135. package/dist/ui/assets/{voice-reply-CgvrHu7l.js → voice-reply-CL5tDo0l.js} +1 -1
  136. package/dist/ui/assets/{wc-attach-CJV3boxa.js → wc-attach-C5yXIQNU.js} +2 -2
  137. package/dist/ui/assets/{wc-detached-BZT3Rtc5.js → wc-detached-f_qit-5b.js} +1 -1
  138. package/dist/ui/assets/{wc-extension-CZ1sQn79.js → wc-extension-DRx21-cq.js} +2 -2
  139. package/dist/ui/assets/{wc-follower-DO4HcEvu.js → wc-follower-DcKt92kM.js} +3 -3
  140. package/dist/ui/assets/{wc-follower-oauth-CEpYsbPr.js → wc-follower-oauth-BF3qXDTt.js} +1 -1
  141. package/dist/ui/assets/{wc-gelatiere-C4XI_usG.js → wc-gelatiere-qAW7lWGW.js} +1 -1
  142. package/dist/ui/assets/{wc-live-Dz2OSXcJ.js → wc-live-DOMCfDT6.js} +6 -6
  143. package/dist/ui/assets/{wc-nav-ClJyDfXq.js → wc-nav-DzPuXq_n.js} +2 -2
  144. package/dist/ui/assets/{wc-onboarding-BUUyiqjJ.js → wc-onboarding-CXM-z-7_.js} +2 -2
  145. package/dist/ui/assets/{wc-placeholder-Sji0t7ST.js → wc-placeholder-BBqbsuml.js} +3 -3
  146. package/dist/ui/assets/{wc-secret-request-IsuAxr4v.js → wc-secret-request-BSUlxVVi.js} +1 -1
  147. package/dist/ui/assets/{wc-settings-lgNdcEqb.js → wc-settings-55mC-jVS.js} +3 -3
  148. package/dist/ui/assets/{wc-shell-Cj705NBI.js → wc-shell-C71iKreG.js} +3 -3
  149. package/dist/ui/assets/{wc-shortcut-config-ByZ7W9gP.js → wc-shortcut-config-Crjq_rF1.js} +1 -1
  150. package/dist/ui/assets/{wc-sprinkles-D7Cv7m3r.js → wc-sprinkles-Caji5y7n.js} +2 -2
  151. package/dist/ui/assets/{wc-transcript-export-IV61nDvZ.js → wc-transcript-export-Dqe3SH1t.js} +2 -2
  152. package/dist/ui/assets/{wc-tray-XTl0wqt5.js → wc-tray-B7ayzT1W.js} +4 -4
  153. package/dist/ui/assets/welcome-detection-CEARSpAq.js +1 -0
  154. package/dist/ui/assets/{whisper-session-FGrrhHcr.js → whisper-session-DfILe4Yb.js} +2 -2
  155. package/dist/ui/assets/{xai-grok-BdK9whs2.js → xai-grok-CVLBrxdD.js} +1 -1
  156. package/dist/ui/assets/{xai-grok-Z7FTSyzw.js → xai-grok-Dp8n52fO.js} +1 -1
  157. package/dist/ui/index.html +3 -3
  158. package/dist/ui/packages/webapp/index.html +3 -3
  159. package/package.json +1 -1
  160. package/dist/ui/assets/SKILL-CtxHowg1.js +0 -96
  161. package/dist/ui/assets/bridge-protocol-DdqxTTSu.js +0 -1
  162. package/dist/ui/assets/js-realm-worker-Dfep1BlZ.js +0 -50
  163. package/dist/ui/assets/jsh-executor-D4Y05hfn.js +0 -18
  164. package/dist/ui/assets/jsh-runtime-extensions-Bcb8_nba.js +0 -1
  165. package/dist/ui/assets/memory-v2-flag-BkWGkfSv.js +0 -1
  166. package/dist/ui/assets/panel-rpc-handlers-DpxMB-do.js +0 -2
  167. package/dist/ui/assets/provider-store-access-BCysAaQ-.js +0 -1
  168. package/dist/ui/assets/provider-store-access-D-QWySrs.js +0 -1
  169. package/dist/ui/assets/realm-inprocess-BdTkrnDI.js +0 -30
  170. package/dist/ui/assets/slicc-version-Cu6HjDRg.js +0 -1
  171. package/dist/ui/assets/tray-runtime-config-CRZxBChd.js +0 -1
  172. package/dist/ui/assets/welcome-detection-B6Zr7LKu.js +0 -1
@@ -1,18 +0,0 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import{n as t,r as n}from"./panel-rpc-BPwAqRch.js";import{t as r}from"./content-type-_QKWY0B2.js";import"./proxied-fetch-DEK8DT-z.js";import{t as i}from"./runtime-env-DadgceZk.js";import{t as a}from"./fetch-body-CuwTaJC_.js";import{a as o}from"./path-utils-DNJG-zQf.js";import{r as s,t as c}from"./multipart-form-data-DopbgwRR.js";import"./tray-storage-keys-DbThbnIh.js";import"./tray-runtime-config-CRZxBChd.js";import{t as l}from"./process-manager-BkhAohXT.js";import{C as u,N as d,b as f,d as p,g as m,p as h,t as g,x as ee,y as _}from"./shared-C_68vn79.js";import{A as te,D as ne,O as re,a as ie,d as ae,f as oe,h as se,j as ce,o as le,p as ue,s as de,u as fe,x as pe}from"./sync-sab-wire-CC30v4TL.js";import{n as v}from"./esbuild-wasm-DS_YG2EY.js";import{t as me}from"./wasm-compiler-Ct7QZURL.js";import{a as y,i as he,n as ge,o as _e,s as ve,t as ye}from"./usb-device-registry-DFzxaOky.js";import{i as be}from"./just-bash-compat-B-SPHuh_.js";const xe=(()=>{try{return console}catch{return}})(),Se={directory:{width:320,height:120},"usb-device":{width:320,height:120},"serial-port":{width:320,height:120},"hid-device":{width:320,height:120}};function Ce(){return globalThis.chrome??null}function b(){let e=Ce();return i()&&typeof e?.windows?.create==`function`}async function x(e,t=[],n=`picker-${Date.now()}-${Math.random().toString(36).slice(2)}`,r={}){let i=Ce();if(!i?.runtime?.onMessage||!i.windows?.create)throw Error(`picker popup: chrome.windows.create not available`);let a=i.runtime.onMessage,o=i.windows.onRemoved,s=i.runtime.getURL?.bind(i.runtime),c=Se[e],l=encodeURIComponent(JSON.stringify(t??[])),u=`kind=${encodeURIComponent(e)}&requestId=${encodeURIComponent(n)}&filters=${l}`,d=s?`${s(`picker-popup.html`)}?${u}`:`picker-popup.html?${u}`;return new Promise(t=>{let s=!1,l,u,f=()=>{try{a.removeListener(m)}catch{}if(o&&h)try{o.removeListener(h)}catch{}l!==void 0&&clearTimeout(l)},p=e=>{s||(s=!0,f(),t(e))},m=t=>{if(s)return;let r=t;if(r?.source!==`picker-popup`||r.kind!==e||r.requestId!==n)return;let{source:i,kind:a,requestId:o,...c}=r;p(c)};a.addListener(m);let h=o?e=>{u!==void 0&&e===u&&p({cancelled:!0})}:void 0;o&&h&&o.addListener(h),r.timeoutMs&&r.timeoutMs>0&&(l=setTimeout(()=>p({cancelled:!0}),r.timeoutMs)),i.windows.create({url:d,type:`popup`,width:c.width,height:c.height,focused:!0}).then(e=>{if(!e?.id){p({error:`failed to open picker window`});return}u=e.id}).catch(e=>{xe?.warn?.(`picker popup window.create failed`,e),p({error:e instanceof Error?e.message:String(e)})})})}let S,C;function we(){return async({kind:e,ctx:t})=>{if(e===`py`){if(typeof Worker<`u`)return Ee();if(!C){let{createInProcessPyRealmFactory:e}=await import(`./realm-inprocess-BdTkrnDI.js`);C=e()}return C({kind:e,ctx:t})}if(typeof Worker<`u`)return Te();if(!S){let{createInProcessJsRealmFactory:e}=await import(`./realm-inprocess-BdTkrnDI.js`);S=e()}return S({kind:e,ctx:t})}}function Te(){if(typeof Worker>`u`)throw Error(`realm-factory: Worker is not available in this runtime`);return De(new Worker(new URL(`/assets/js-realm-worker-Dfep1BlZ.js`,``+import.meta.url),{type:`module`}))}function Ee(){if(typeof Worker>`u`)throw Error(`realm-factory: Worker is not available in this runtime`);return De(new Worker(new URL(`/assets/py-realm-worker-DXmzJqJi.js`,``+import.meta.url),{type:`module`}))}function De(e){let t={postMessage:(t,n)=>n?e.postMessage(t,n):e.postMessage(t),addEventListener:(t,n)=>e.addEventListener(t,n),removeEventListener:(t,n)=>e.removeEventListener(t,n)},n=!1;return{controlPort:t,isolatedThread:!0,addEventListener:(t,n,r)=>e.addEventListener(t,n,r),removeEventListener:(t,n)=>e.removeEventListener(t,n),terminate(){if(!n){n=!0;try{e.terminate()}catch{}}}}}function Oe(){if(h())return decodeURIComponent(m(`pyodide/pyodide.mjs`,`../../../../../node_modules/pyodide/`).pathname)}function ke(e){let t=e.startsWith(`/`)?e:`/${e}`;return new URL(`file://${t}`).href}function w(e){return e instanceof Error?e.message:String(e)}function Ae(e){return`${(e&&e.length>0?e:`[eval]`).replace(/\.[^./]+$/,``)}.js`}async function je(e,t,n,r){return(await(await e()).transform(t,{loader:`js`,format:`cjs`,sourcefile:Ae(n),supported:{"dynamic-import":!1},define:{"import.meta.url":JSON.stringify(r)}})).code}async function Me(e,t,n,r){return(await(await e()).transform(t,{loader:`js`,format:`cjs`,sourcefile:Ae(n),supported:{"dynamic-import":!1},...r?{define:{"import.meta.url":JSON.stringify(r)}}:{}})).code}const Ne=/\bimport\s*\.\s*meta\s*\.\s*url\b/g,Pe=/\bimport\s*\.\s*meta\b/g;function Fe(e,t){let n=JSON.stringify(t);return e.replace(Ne,n).replace(Pe,`({ url: ${n} })`)}async function T(e,t,n,r){let i=await e();return i.transpileModule(Fe(t,r),{compilerOptions:{module:i.ModuleKind.CommonJS,target:i.ScriptTarget.ES2020,esModuleInterop:!0},fileName:`${n.replace(/\.[^./]+$/,``)}.ts`}).outputText}function Ie(e={}){let{ipk:t}=e,n=e.loadEsbuild??(()=>v(t?{ipk:t}:{})),r=e.loadTypeScript??(()=>p(t));return async({source:e,path:t,kind:i})=>{if(i!==`esm`||!f(e))return e;let a=ke(t),o;try{return await je(n,e,t,a)}catch(e){o=e}try{return await T(r,e,t,a)}catch(e){throw Error(`Failed to transpile ESM module '${t}': ${w(o)}; typescript fallback: ${w(e)}`)}}}function E(e={}){let{ipk:t}=e,n=e.loadEsbuild??(()=>v(t?{ipk:t}:{})),r=e.loadTypeScript??(()=>p(t));return async({source:e,filename:t})=>{if(!f(e)&&!_(e))return e;let i=typeof t==`string`&&t.startsWith(`/`),a=i?ke(t):void 0,o=i?t:`[eval].js`,s;try{return await Me(n,e,t,a)}catch(e){s=e}try{return await T(r,e,o,a??``)}catch(e){throw Error(`Failed to transpile entry source: ${w(s)}; typescript fallback: ${w(e)}`)}}}function D(e){if(!e.startsWith(`#!`))return e;let t=e.indexOf(`
2
- `);return t===-1?``:e.slice(t+1)}function Le(e){return o(e).dir}const O=[`node`,`require`,`default`],k=[`node`,`import`,`default`],Re=/\brequire\s*\(\s*(['"`])([^'"`\s]+)\1\s*\)/g,ze=/\bimport\s*\(\s*(['"`])([^'"`\s]+)\1\s*\)/g,Be=/(?:^|[;\n}])\s*import\b[\s\S]*?\bfrom\s*(['"])([^'"]+)\1/g,Ve=/(?:^|[;\n}])\s*export\b[\s\S]*?\bfrom\s*(['"])([^'"]+)\1/g,He=/(?:^|[;\n}])\s*import\s*(['"])([^'"]+)\1/g;function Ue(e,t,n){let r=t[0].indexOf(n);return r<0?!1:e.startsWith(n,t.index+r)}function We(e){let t=ee(e),n=new Map,r=(r,i,a)=>{r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){if(!Ue(t,o,a))continue;let e=o[2];n.get(e)!==`import`&&n.set(e,i)}};return r(Re,`require`,`require`),r(ze,`import`,`import`),r(Be,`import`,`import`),r(Ve,`import`,`export`),r(He,`import`,`import`),[...n].map(([e,t])=>({specifier:e,kind:t}))}async function Ge(e,t,n,r){if(n===`json`)return`module.exports = JSON.parse(${JSON.stringify(e)});\n`;let i=D(e);if(n===`esm`){if(!r)throw Error(`Cannot load ESM module '${t}': no transpile hook configured (run: ${g} esbuild-wasm)`);return await r({source:i,path:t,kind:n})}return i}async function Ke(e){let{entrySpecifiers:t,fromDir:n,reader:r,conditions:i,transpile:a}=e,o=e.requireConditions??O,s=e.importConditions??k,c=i??o,l=new Map,d=[],f={},p={};async function m(e,t){if(l.has(e))return;let n=await r.readFile(e),i=await Ge(n,e,t,a);l.set(e,{path:e,source:n,cjsSource:i,kind:t});let c=Le(e),h={},g={};for(let{specifier:e,kind:t}of We(n)){let n;try{n=await u(e,c,r,{conditions:t===`import`?s:o})}catch(t){g[e]=t instanceof Error?t.message:String(t);continue}n.type===`file`&&(h[e]=n.path,await m(n.path,n.moduleKind))}f[e]=h,Object.keys(g).length>0&&(p[e]=g),d.push(e)}let h={};for(let e of t){let t=await u(e,n,r,{conditions:c});t.type===`file`&&(h[e]=t.path,await m(t.path,t.moduleKind))}return{files:d.map(e=>{let t=l.get(e);if(!t)throw Error(`module-loader: missing built module for '${e}'`);return t}),entryMap:h,edges:f,edgeErrors:p}}function qe(e){return!(e.startsWith(`sliccy:`)||e.startsWith(`node:`)||d.has(e)||ce.has(e))}function Je(e,t){for(let[n,r]of Object.entries(t))e[n]={...e[n]??{},...r}}async function Ye(e){let{entryCode:t,fromDir:n,entryFilename:r,reader:i,transpile:a,transpileEntry:o}=e,s=new Map,c=[],l={},u={},d={},p={};for(let{specifier:e,kind:r}of We(t))if(qe(e))try{let t=await Ke({entrySpecifiers:[e],fromDir:n,reader:i,transpile:a,conditions:r===`import`?k:O,requireConditions:O,importConditions:k});for(let e of t.files)s.has(e.path)||(s.set(e.path,e),c.push(e.path));Object.assign(l,t.entryMap),Je(u,t.edges),Je(d,t.edgeErrors)}catch(t){p[e]=t instanceof Error?t.message:String(t)}let m;o&&(f(t)||_(t))&&(m=await o({source:t,filename:r??`[eval]`,fromDir:n}));let h={files:c.map(e=>{let t=s.get(e);if(!t)throw Error(`module-loader: missing built module for '${e}'`);return{path:t.path,cjsSource:t.cjsSource,kind:t.kind}}),entryMap:l,edges:u,edgeErrors:d,errors:p};return m!==void 0&&(h.entrySource=m),h}function A(){return globalThis.navigator?.hid??null}function Xe(e){let t=e.collections?.[0];return t?`${t.usagePage??``}:${t.usage??``}`:``}function Ze(e,t){return e===t||e.vendorId===t.vendorId&&e.productId===t.productId&&(e.productName??``)===(t.productName??``)&&Xe(e)===Xe(t)&&!!e.productName}var Qe=class{byHandle=new Map;counter=0;register(e){for(let[t,n]of this.byHandle)if(Ze(n,e))return this.byHandle.set(t,e),t;let t=`hid${++this.counter}`;return this.byHandle.set(t,e),t}get(e){return this.byHandle.get(e)}remove(e){return this.byHandle.delete(e)}list(){return[...this.byHandle].map(([e,t])=>({handle:e,device:t}))}};let $e=null;function et(){return $e||=new Qe,$e}const tt=4194304;function j(e,t){let n=t.collections?.[0];return{handle:e,vendorId:t.vendorId,productId:t.productId,...t.productName?{productName:t.productName}:{},...n?.usagePage===void 0?{}:{usagePage:n.usagePage},...n?.usage===void 0?{}:{usage:n.usage},opened:t.opened}}function M(e,t){let n=e.get(t);if(!n)throw Error(`unknown hid handle '${t}'`);return n}async function N(e){e.opened||await e.open()}function P(e,t){if(e>4194304)throw Error(`${t} exceeds the ${tt}-byte (4 MiB) v1 limit`)}function F(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),t}async function nt(e,t){return(await t.getDevices()).map(t=>j(e.register(t),t))}async function rt(e,t,n){let r=await t.requestDevice({filters:n});if(r.length===0)throw Error(`No device selected.`);return r.map(t=>j(e.register(t),t))}function it(e,t){return j(t,M(e,t))}async function at(e,t){await M(e,t).open()}async function ot(e,t){await M(e,t).close()}async function st(e,t,n,r){P(r.byteLength,`send report payload`);let i=M(e,t);await N(i),await i.sendReport(n,r)}async function ct(e,t,n,r){P(r.byteLength,`send feature report payload`);let i=M(e,t);await N(i),await i.sendFeatureReport(n,r)}async function lt(e,t,n){let r=M(e,t);return await N(r),{reportId:n,bytes:F(await r.receiveFeatureReport(n))}}async function ut(e,t,n){let r=M(e,t);await N(r);let i=e=>{n({reportId:e.reportId,bytes:F(e.data)})};return r.addEventListener(`inputreport`,i),()=>r.removeEventListener(`inputreport`,i)}const I=6e4;function dt(){return b()}function ft(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout(()=>r({cancelled:!0}),I);x(`hid-device`,e??[],void 0,{timeoutMs:I}).then(e=>{let t=e;t.cancelled?r({cancelled:!0}):typeof t.error==`string`?r({error:t.error}):t.granted&&t.info?r({granted:!0,info:t.info}):r({error:`hid picker returned an unexpected response`})}).catch(e=>{r({error:e instanceof Error?e.message:`Failed to open HID picker`})})})}function L(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}var pt=class{registry;constructor(e){this.registry=e}hid(){let e=A();if(!e)throw Error(`WebHID is unavailable in this browser`);return e}list(){return nt(this.registry,this.hid())}async request(e){if(dt()){let t=await ft(e);if(`cancelled`in t)throw Error(`user cancelled the HID picker`);if(`error`in t)throw Error(t.error);let n=await this.reacquireAll(t.info);if(n.length===0)throw Error(`granted device could not be re-acquired`);return n.map(e=>j(this.registry.register(e),e))}return rt(this.registry,this.hid(),e)}async reacquireAll(e){return(await this.hid().getDevices()).filter(t=>t.vendorId===e.vendorId&&t.productId===e.productId)}info(e){return Promise.resolve(it(this.registry,e))}open(e){return at(this.registry,e)}close(e){return ot(this.registry,e)}sendReport(e,t,n){return st(this.registry,e,t,L(n))}sendFeatureReport(e,t,n){return ct(this.registry,e,t,L(n))}async receiveFeatureReport(e,t){let n=await lt(this.registry,e,t);return{reportId:n.reportId,bytes:new Uint8Array(n.bytes)}}async subscribeInputReports(e,t){return ut(this.registry,e,e=>t({reportId:e.reportId,bytes:new Uint8Array(e.bytes)}))}},mt=class e{rpc;constructor(e){this.rpc=e}static REQUEST_TIMEOUT_MS=3e5;async list(){return(await this.rpc.call(`hid-list`,void 0)).devices}async request(t){return(await this.rpc.call(`hid-request`,{filters:t},{timeoutMs:e.REQUEST_TIMEOUT_MS})).devices}async info(e){return(await this.rpc.call(`hid-device-info`,{handle:e})).device}async open(e){await this.rpc.call(`hid-open`,{handle:e})}async close(e){await this.rpc.call(`hid-close`,{handle:e})}async sendReport(e,t,n){await this.rpc.call(`hid-send-report`,{handle:e,reportId:t,bytes:L(n)})}async sendFeatureReport(e,t,n){await this.rpc.call(`hid-send-feature-report`,{handle:e,reportId:t,bytes:L(n)})}async receiveFeatureReport(e,t){let n=await this.rpc.call(`hid-receive-feature-report`,{handle:e,reportId:t});return{reportId:n.reportId,bytes:new Uint8Array(n.bytes)}}async subscribeInputReports(e,t){let n=this.rpc.onEvent(`hid-input-report`,n=>{let r=n;!r||r.handle!==e||t({reportId:r.reportId,bytes:new Uint8Array(r.bytes)})});try{await this.rpc.call(`hid-subscribe-input-reports`,{handle:e})}catch(e){throw n(),e}return async()=>{n();try{await this.rpc.call(`hid-unsubscribe-input-reports`,{handle:e})}catch{}}}};function R(e,t){return e&&A()?new pt(et()):t?new mt(t):null}function ht(e){return async function(t,n){let r=t instanceof Request?t:null,i=gt(t),a=(n?.method??r?.method??`GET`).toUpperCase(),o=vt(r?.headers,n?.headers),s=await bt(n,r,a,o);s.defaultContentType&&!yt(o,`content-type`)&&(o[`Content-Type`]=s.defaultContentType);let c=await e(i,{method:a,headers:o,body:s.body}),l=new Headers;for(let[e,t]of Object.entries(c.headers))try{l.set(e,t)}catch{}let u=c.status===204||c.status===205||c.status===304||!c.body||c.body.byteLength===0?null:c.body,d=new Response(u,{status:c.status,statusText:c.statusText,headers:l});try{Object.defineProperty(d,"url",{value:c.url||i,writable:!1,configurable:!0,enumerable:!1})}catch{}return d}}function gt(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function _t(e){if(e){if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}if(Array.isArray(e)){let t={};for(let[n,r]of e)t[n]=r;return t}return{...e}}}function vt(e,t){let n={};e&&e.forEach((e,t)=>{n[t]=e});let r=_t(t);if(r)for(let[e,t]of Object.entries(r))n[e]=t;return n}function yt(e,t){return z(e,t)!==void 0}function z(e,t){let n=t.toLowerCase(),r;for(let[t,i]of Object.entries(e))t.toLowerCase()===n&&(r=i);return r}async function bt(e,t,n,i){if(e&&`body`in e&&e.body!==void 0)return xt(e.body,n);if(t&&n!==`GET`&&n!==`HEAD`){let e=t.body!==null,n=new Uint8Array(await t.arrayBuffer()),o=z(i,`content-type`)??``,s=e&&(!o||!r(o));return{body:n.byteLength===0?void 0:s?a(n):new TextDecoder(`utf-8`).decode(n),defaultContentType:s?`application/octet-stream`:void 0}}return{}}async function xt(e,t){if(s(e)){if(t===`GET`||t===`HEAD`)return{};let n=await c(e);return{body:n.bytes,defaultContentType:n.contentType}}return{body:await St(e,t),defaultContentType:wt(e,t)}}async function St(e,t){if(e!=null&&t!==`GET`&&t!==`HEAD`){if(typeof e==`string`)return e;if(e instanceof URLSearchParams)return e.toString();if(e instanceof Uint8Array)return a(e);if(e instanceof ArrayBuffer)return new Uint8Array(e).slice();if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice()}if(typeof Blob<`u`&&e instanceof Blob)return new Uint8Array(await e.arrayBuffer());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 Ct(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof Blob<`u`&&e instanceof Blob}function wt(e,t){if(e instanceof URLSearchParams)return`application/x-www-form-urlencoded;charset=UTF-8`;if(!(t===`GET`||t===`HEAD`||!Ct(e)))return typeof Blob<`u`&&e instanceof Blob&&e.type?e.type:`application/octet-stream`}function B(){return globalThis.navigator?.serial??null}var Tt=class{byHandle=new Map;counter=0;register(e){for(let[t,n]of this.byHandle)if(n.port===e)return t;let t=`serial${++this.counter}`;return this.byHandle.set(t,{port:e,opened:!1}),t}get(e){return this.byHandle.get(e)}remove(e){return this.byHandle.delete(e)}list(){return[...this.byHandle].map(([e,t])=>({handle:e,entry:t}))}retainOnly(e){let t=[];for(let[n,r]of[...this.byHandle])e.includes(r.port)||(this.byHandle.delete(n),t.push({handle:n,entry:r}));return t}};let V=null;function H(){return V||=new Tt,V}const U=4194304;function W(e,t){let n=t.port.getInfo();return{handle:e,...n.usbVendorId===void 0?{}:{usbVendorId:n.usbVendorId},...n.usbProductId===void 0?{}:{usbProductId:n.usbProductId},opened:t.opened}}function G(e,t){let n=e.get(t);if(!n)throw Error(`unknown serial handle '${t}'`);return n}function Et(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Dt(e,t,n){if(t.length===0)return-1;outer:for(let r=Math.max(0,n);r+t.length<=e.length;r++){for(let n=0;n<t.length;n++)if(e[r+n]!==t[n])continue outer;return r}return-1}async function Ot(e){if(e.reader){try{await e.reader.cancel()}catch{}try{e.reader.releaseLock()}catch{}e.reader=void 0}if(e.pendingRead=void 0,e.leftover=void 0,e.writer){try{e.writer.releaseLock()}catch{}e.writer=void 0}}async function kt(e){if(await Ot(e),e.opened){try{await e.port.close()}catch{}e.opened=!1}}async function At(e,t){let n=await t.getPorts();for(let{entry:t}of e.retainOnly(n))await kt(t);return n.map(t=>{let n=e.register(t);return W(n,e.get(n))})}async function jt(e,t,n){let r=await t.requestPort(n.length?{filters:n}:{}),i=e.register(r);return W(i,e.get(i))}function Mt(e,t){return W(t,G(e,t))}async function Nt(e,t,n){let r=G(e,t);try{await r.port.open(n)}catch(e){throw Error(`${e instanceof Error?e.message:String(e)} (handle '${t}' may be stale after a device reset — re-run 'serial list' to pick up the current handle)`)}r.opened=!0}async function Pt(e,t){let n=G(e,t);await Ot(n);try{await n.port.close()}catch(e){if(!Ft(e))throw e}n.opened=!1}function Ft(e){let t=e instanceof Error?e.message:String(e);return/already closed|not open/i.test(t)}function It(e){if(!e.reader){if(!e.port.readable)throw Error(`serial port is not readable (is it open?)`);e.reader=e.port.readable.getReader()}return e.reader}function Lt(e){if(!e.writer){if(!e.port.writable)throw Error(`serial port is not writable (is it open?)`);e.writer=e.port.writable.getWriter()}return e.writer}async function Rt(e,t,n){let r=G(e,t),i=Math.min(n.maxBytes??4194304,U),a=n.until?.length?n.until:void 0,o=n.timeoutMs??1e3,s=Date.now()+Math.max(0,o),c=r.leftover??new Uint8Array;r.leftover=void 0;let l=0,u=()=>{if(a){let e=Dt(c,a,Math.max(0,l-(a.length-1)));if(e>=0){let t=e+a.length;return r.leftover=c.slice(t),c.slice(0,t)}}return c.length>=i?(r.leftover=c.slice(i),c.slice(0,i)):null},d=u();if(d)return d;let f=It(r);for(;Date.now()<s;){let e=s-Date.now(),t=r.pendingRead??f.read();r.pendingRead=t;let n,i=new Promise(t=>{n=setTimeout(()=>t(`__timeout`),e)}),a;try{a=await Promise.race([t,i])}finally{n&&clearTimeout(n)}if(a===`__timeout`)break;if(r.pendingRead=void 0,a.done){r.reader=void 0;break}if(a.value?.length){l=c.length,c=Et(c,a.value);let e=u();if(e)return e}}return c}async function zt(e,t,n){if(n.length>4194304)throw Error(`serial write payload exceeds the ${U}-byte (4 MiB) v1 limit`);return await Lt(G(e,t)).write(n),n.length}async function Bt(e,t){return G(e,t).port.getSignals()}async function Vt(e,t,n){await G(e,t).port.setSignals(n)}const Ht=6e4;function Ut(){return b()}function Wt(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout(()=>r({cancelled:!0}),Ht);x(`serial-port`,e??[],void 0,{timeoutMs:Ht}).then(e=>{let t=e;t.cancelled?r({cancelled:!0}):typeof t.error==`string`?r({error:t.error}):t.granted&&t.info?r({granted:!0,info:t.info}):r({error:`serial picker returned an unexpected response`})}).catch(e=>{r({error:e instanceof Error?e.message:`Failed to open serial picker`})})})}function Gt(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}var Kt=class{registry;constructor(e){this.registry=e}serial(){let e=B();if(!e)throw Error(`Web Serial is unavailable in this browser`);return e}list(){return At(this.registry,this.serial())}async request(e){if(Ut()){let t=await Wt(e);if(`cancelled`in t)throw Error(`user cancelled the serial picker`);if(`error`in t)throw Error(t.error);let n=await this.reacquire(t.info);if(!n)throw Error(`granted port could not be re-acquired`);let r=this.registry.register(n);return W(r,this.registry.get(r))}return jt(this.registry,this.serial(),e)}async reacquire(e){let t=await this.serial().getPorts(),n=t.filter(t=>{let n=t.getInfo();return!(e.usbVendorId!==void 0&&n.usbVendorId!==e.usbVendorId||e.usbProductId!==void 0&&n.usbProductId!==e.usbProductId)}),r=n.length?n:t,i=this.registry.list().map(e=>e.entry.port);return r.find(e=>!i.includes(e))??r[0]??null}info(e){return Promise.resolve(Mt(this.registry,e))}open(e,t){return Nt(this.registry,e,t)}close(e){return Pt(this.registry,e)}read(e,t){return Rt(this.registry,e,t)}write(e,t){return zt(this.registry,e,t)}getSignals(e){return Bt(this.registry,e)}setSignals(e,t){return Vt(this.registry,e,t)}},qt=class e{rpc;constructor(e){this.rpc=e}static REQUEST_TIMEOUT_MS=3e5;static READ_MARGIN_MS=3e4;async list(){return(await this.rpc.call(`serial-list`,void 0)).devices}async request(t){return(await this.rpc.call(`serial-request`,{filters:t},{timeoutMs:e.REQUEST_TIMEOUT_MS})).device}async info(e){return(await this.rpc.call(`serial-device-info`,{handle:e})).device}async open(e,t){await this.rpc.call(`serial-open`,{handle:e,options:t})}async close(e){await this.rpc.call(`serial-close`,{handle:e})}async read(t,n){let r=(n.timeoutMs??1e3)+e.READ_MARGIN_MS,i=await this.rpc.call(`serial-read`,{handle:t,maxBytes:n.maxBytes,until:n.until?Gt(n.until):void 0,timeoutMs:n.timeoutMs},{timeoutMs:r});return new Uint8Array(i.bytes)}async write(e,t){return(await this.rpc.call(`serial-write`,{handle:e,bytes:Gt(t)})).bytesWritten}async getSignals(e){return(await this.rpc.call(`serial-get-signals`,{handle:e})).signals}async setSignals(e,t){await this.rpc.call(`serial-set-signals`,{handle:e,signals:t})}};function Jt(e,t){return e&&B()?new Kt(H()):t?new qt(t):null}const Yt=e(`usb`);async function K(){return import(`./usb-claim-broker-C5dFP5bv.js`)}function q(e,t){let n=e.get(t);if(!n)throw Error(`unknown usb handle '${t}'`);return n}function J(e,t){if(e>4194304)throw Error(`${t} exceeds the ${ye}-byte (4 MiB) v1 limit`)}function Xt(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}async function Zt(e,t){return(await t.getDevices()).map(t=>y(e.register(t),t))}async function Qt(e,t,n){let r=await t.requestDevice({filters:n});return y(e.register(r),r)}function $t(e,t){return y(t,q(e,t))}async function en(e,t){await q(e,t).open()}async function tn(e,t,n){await fn(e,t,`close`,n)}async function nn(e,t,n){await q(e,t).selectConfiguration(n)}async function rn(e,t,n,r){let i=r?.owner??`usb`,a=q(e,t),o=await K(),s=await o.acquireInterfaceClaim(e,t,n,i,r?.wait??!1,r?.signal),c=()=>o.claimOwner(e,t,n),l=()=>c()===i,u=()=>o.wasGrantCancelled(e,t,n,i),d=async r=>{if(!(l()&&!u())){if(u()||!c()){if(r)try{await a.releaseInterface(n)}catch{}o.settleCancelledGrant(e,t,n,i),o.wakeInterfaceWaiter(e,t,n)}throw o.claimWaitCancelledError(t,n,i)}};try{await d(!1),await a.claimInterface(n),await d(!0)}catch(r){throw s===`acquired`&&(u()?(o.settleCancelledGrant(e,t,n,i),o.wakeInterfaceWaiter(e,t,n)):l()?o.releaseInterfaceClaim(e,t,n,i):c()||o.wakeInterfaceWaiter(e,t,n)),r}finally{o.clearPendingGrant(e,t,n,i)}}async function an(e,t){let n=await K(),r=n.takeOwnerClaims(e,t);for(let t of r){try{await e.get(t.handle)?.releaseInterface(t.interfaceNumber)}catch{}n.wakeInterfaceWaiter(e,t.handle,t.interfaceNumber)}}async function on(e,t,n,r){let i=r?.owner??`usb`,a=q(e,t),o=await K(),s=o.claimOwner(e,t,n);if(s&&s!==i)throw new he({handle:t,holder:s,op:`release`,interfaceNumber:n});await a.releaseInterface(n),o.releaseInterfaceClaim(e,t,n,i)}async function sn(e,t,n,r){J(r,`control-in length`);let i=await q(e,t).controlTransferIn(n,r);return{status:i.status??`ok`,bytes:i.data?Xt(i.data):new ArrayBuffer(0)}}async function cn(e,t,n,r){J(r.byteLength,`control-out payload`);let i=await q(e,t).controlTransferOut(n,r);return{status:i.status??`ok`,bytesWritten:i.bytesWritten}}async function ln(e,t,n,r){J(r,`transfer-in length`);let i=await q(e,t).transferIn(n,r);return{status:i.status??`ok`,bytes:i.data?Xt(i.data):new ArrayBuffer(0)}}async function un(e,t,n,r){J(r.byteLength,`transfer-out payload`);let i=await q(e,t).transferOut(n,r);return{status:i.status??`ok`,bytesWritten:i.bytesWritten}}async function dn(e,t,n){await fn(e,t,`reset`,n)}async function fn(e,t,n,r){let i=r?.owner??`usb`,a=r?.force??!1,o=q(e,t),s=await K(),c=s.listClaims(e,t);if(c.length>0){let e=c.map(e=>`${e.interfaceNumber}=${e.owner}`).join(`, `);Yt.warn(`usb ${n} ${t} with claimed interfaces (${e})${a?` [force]`:``}`)}let l=s.assertExclusive(e,t,i,a,n);n===`close`?await o.close():await o.reset(),s.displaceHandle(e,t,{reason:n,displacedBy:i,displaced:l})}async function pn(e,t,n,r){await q(e,t).clearHalt(n,r)}const mn=6e4;function hn(){return b()}function gn(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout(()=>r({cancelled:!0}),mn);x(`usb-device`,e??[],void 0,{timeoutMs:mn}).then(e=>{let t=e;t.cancelled?r({cancelled:!0}):typeof t.error==`string`?r({error:t.error}):t.granted&&t.info?r({granted:!0,info:t.info}):r({error:`usb picker returned an unexpected response`})}).catch(e=>{r({error:e instanceof Error?e.message:`Failed to open USB picker`})})})}function Y(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}var _n=class{registry;constructor(e){this.registry=e}usb(){let e=_e();if(!e)throw Error(`WebUSB is unavailable in this browser`);return e}list(){return Zt(this.registry,this.usb())}async request(e){if(hn()){let t=await gn(e);if(`cancelled`in t)throw Error(`user cancelled the USB picker`);if(`error`in t)throw Error(t.error);let n=await this.reacquire(t.info);if(!n)throw Error(`granted device could not be re-acquired`);return y(this.registry.register(n),n)}return Qt(this.registry,this.usb(),e)}async reacquire(e){return(await this.usb().getDevices()).find(t=>t.vendorId===e.vendorId&&t.productId===e.productId&&(!e.serialNumber||t.serialNumber===e.serialNumber))??null}info(e){return Promise.resolve($t(this.registry,e))}open(e){return en(this.registry,e)}close(e,t){return tn(this.registry,e,X(t))}selectConfig(e,t){return nn(this.registry,e,t)}claim(e,t,n){return rn(this.registry,e,t,X(n))}release(e,t,n){return on(this.registry,e,t,X(n))}async controlIn(e,t,n){let r=await sn(this.registry,e,t,n);return{status:r.status,bytes:new Uint8Array(r.bytes)}}controlOut(e,t,n){return cn(this.registry,e,t,Y(n))}async transferIn(e,t,n){let r=await ln(this.registry,e,t,n);return{status:r.status,bytes:new Uint8Array(r.bytes)}}transferOut(e,t,n){return un(this.registry,e,t,Y(n))}clearHalt(e,t,n){return pn(this.registry,e,t,n)}reset(e,t){return dn(this.registry,e,X(t))}subscribeClaimEvents(e){let t,n=import(`./usb-claim-broker-C5dFP5bv.js`).then(n=>{t=n.addClaimListener(this.registry,e)});return()=>{n.then(()=>t?.())}}dropOwner(e){return an(this.registry,e)}};function X(e){return{...e,owner:e?.owner??`shell`}}var vn=class e{rpc;constructor(e){this.rpc=e}static REQUEST_TIMEOUT_MS=3e5;static CLAIM_WAIT_TIMEOUT_MS=3e5;async list(){return(await this.rpc.call(`usb-list`,void 0)).devices}async request(t){return(await this.rpc.call(`usb-request`,{filters:t},{timeoutMs:e.REQUEST_TIMEOUT_MS})).device}async info(e){return(await this.rpc.call(`usb-device-info`,{handle:e})).device}async open(e){await this.rpc.call(`usb-open`,{handle:e})}async close(e,t){await this.rpc.call(`usb-close`,{handle:e,owner:t?.owner??`shell`,force:t?.force??!1})}async selectConfig(e,t){await this.rpc.call(`usb-select-configuration`,{handle:e,configurationValue:t})}async claim(t,n,r){let i=r?.owner??`shell`,a=r?.wait??!1;try{await this.rpc.call(`usb-claim-interface`,{handle:t,interfaceNumber:n,owner:i,wait:a},a?{timeoutMs:e.CLAIM_WAIT_TIMEOUT_MS}:void 0)}catch(e){throw a&&await this.rpc.call(`usb-cancel-claim-wait`,{handle:t,interfaceNumber:n,owner:i}).catch(()=>void 0),e}}async release(e,t,n){await this.rpc.call(`usb-release-interface`,{handle:e,interfaceNumber:t,owner:n?.owner??`shell`})}async controlIn(e,t,n){let r=await this.rpc.call(`usb-control-transfer-in`,{handle:e,setup:t,length:n});return{status:r.status,bytes:new Uint8Array(r.bytes)}}async controlOut(e,t,n){return this.rpc.call(`usb-control-transfer-out`,{handle:e,setup:t,bytes:Y(n)})}async transferIn(e,t,n){let r=await this.rpc.call(`usb-transfer-in`,{handle:e,endpointNumber:t,length:n});return{status:r.status,bytes:new Uint8Array(r.bytes)}}async transferOut(e,t,n){return this.rpc.call(`usb-transfer-out`,{handle:e,endpointNumber:t,bytes:Y(n)})}async clearHalt(e,t,n){await this.rpc.call(`usb-clear-halt`,{handle:e,direction:t,endpointNumber:n})}async reset(e,t){await this.rpc.call(`usb-reset`,{handle:e,owner:t?.owner??`shell`,force:t?.force??!1})}subscribeClaimEvents(e){return this.rpc.onEvent(`usb-claim-event`,t=>{e(t)})}async dropOwner(e){await this.rpc.call(`usb-drop-owner`,{owner:e})}};function yn(e,t){return e&&_e()?new _n(ve()):t?new vn(t):null}const bn=Math.max(pe,se)+5e3;function xn(e,t,n,r={}){let{header:i,window:a}=de(t),o=new Map,s=!1,c=r.dispatch??(e=>ae(e)?fe(e):ne(e));function l(e){let t=o.get(e);t&&(clearTimeout(t.timer),o.delete(e))}function u(e,t,n){let r=Math.min(a.byteLength,t.payload.byteLength-n);r>0&&a.set(t.payload.subarray(n,n+r)),Atomics.store(i,2,t.status),Atomics.store(i,3,t.payload.byteLength),Atomics.store(i,4,r),Atomics.store(i,5,n),Atomics.store(i,1,e),Atomics.store(i,0,2),Atomics.notify(i,0),n+r>=t.payload.byteLength&&l(e)}function d(e,t){if(s)return;let{status:n,payload:r}=ie(t);l(e);let i={status:n,payload:r,timer:setTimeout(()=>l(e),bn)};o.set(e,i),u(e,i,0)}let f=e=>{let t=e.data;if(!t||typeof t.id!=`number`)return;if(t.type===`sync-sab-next`){let e=o.get(t.id),n=t.offset;if(!e||typeof n!=`number`||!Number.isInteger(n)||n<0||n>e.payload.byteLength){d(t.id,{ok:!1,errno:`EIO`,message:`sync-sab: bad continuation`});return}u(t.id,e,n);return}if(t.type!==`sync-sab-req`||!t.req||typeof t.req!=`object`)return;let r=t.id,i={...t.req,token:n},a;try{a=c(i)}catch(e){d(r,{ok:!1,errno:`EIO`,message:e instanceof Error?e.message:String(e)});return}a.then(e=>d(r,e),e=>d(r,{ok:!1,errno:`EIO`,message:e instanceof Error?e.message:String(e)}))};return e.addEventListener(`message`,f),{dispose:()=>{if(!s){s=!0,e.removeEventListener(`message`,f);for(let e of[...o.keys()])l(e)}}}}const Sn=e(`realm-host`);let Cn=0;function wn(e,t,n={}){let r=new Map,i=new Map,a=`${ge}:${++Cn}`,o=n.syncFsBridgeEnabled?re({fs:t.fs,...t.exec?{exec:t.exec}:{},cwd:t.cwd}):void 0,s=!1,c=(t,n=[])=>{if(!s)try{e.postMessage(t,n)}catch{}},l={subscriptions:r,pushEvent:c},u={subscriptions:i,pushEvent:c,owner:a},d=new Map,f={spawns:d,opts:n},p=r=>{if(r.data?.type!==`realm-rpc-req`)return;let i=r.data;Tn(e,i,t,n,l,u,f)};e.addEventListener(`message`,p);let m=o&&n.syncSab?xn(e,n.syncSab,o):void 0;return e.start?.(),{syncFsToken:o,dispose:()=>{if(!s){s=!0,m?.dispose(),o&&te(o),e.removeEventListener(`message`,p);for(let{controller:e}of d.values())try{e.signal.aborted||e.abort()}catch{}d.clear();for(let e of r.values())try{Promise.resolve(e()).catch(()=>{})}catch{}r.clear();for(let e of i.values())try{Promise.resolve(e()).catch(()=>{})}catch{}i.clear();try{(n.usbBackend??On(n)).dropOwner?.(a)?.catch(()=>{})}catch{}}}}}async function Tn(e,t,n,r,i,a,o){try{let s=await En(t,n,r,i,a,o),c={type:`realm-rpc-res`,id:t.id,result:s},l=_r(s);e.postMessage(c,l)}catch(n){let r=n instanceof Error?n.message:String(n),i={type:`realm-rpc-res`,id:t.id,error:r};e.postMessage(i)}}async function En(e,t,n,r,i,a){switch(e.channel){case`vfs`:return Mn(e.op,e.args,t,n.onHostFsMutation);case`exec`:return Gn(e.op,e.args,t,a);case`fetch`:return Zn(e.op,e.args,t);case`browser`:return tr(e.op,e.args,Dn(n),n);case`usb`:return mr(e.op,e.args,On(n),i);case`serial`:return hr(e.op,e.args,kn(n));case`hid`:return gr(e.op,e.args,An(n),r);case`module`:return $n(e.op,e.args,t);case`wasm`:return er(e.op,e.args,t);default:throw Error(`realm-host: unknown channel '${e.channel}'`)}}function Dn(e){if(e.browser)return e.browser;let t=globalThis;if(t.__slicc_browser)return t.__slicc_browser;throw Error(`browser is not available in this runtime`)}function Z(e){if(e.wsSubscribers)return e.wsSubscribers;let t=globalThis;if(t.__slicc_wsSubscribers)return t.__slicc_wsSubscribers;throw Error(`browser.websocket is not available in this runtime`)}function On(e){if(e.usbBackend)return e.usbBackend;let r=yn(n(),t());if(!r)throw Error(`usb is not available in this runtime`);return r}function kn(e){if(e.serialBackend)return e.serialBackend;let r=Jt(n(),t());if(!r)throw Error(`serial is not available in this runtime`);return r}function An(e){if(e.hidBackend)return e.hidBackend;let r=R(n(),t());if(!r)throw Error(`hid is not available in this runtime`);return r}function jn(e){return[...e.deleted,...e.created.map(e=>e.path),...e.modified.map(e=>e.path)]}async function Mn(e,t,n,r){let i=typeof t[0]==`string`?t[0]:null,a=i===null?null:n.fs.resolvePath(n.cwd,i);switch(e){case`readFile`:return n.fs.readFile(a);case`readFileBinary`:return n.fs.readFileBuffer(a);case`writeFile`:return await n.fs.writeFile(a,t[1]),a&&r?.([a]),!0;case`writeFileBinary`:return await n.fs.writeFile(a,t[1]),a&&r?.([a]),!0;case`appendFile`:return await n.fs.appendFile(a,t[1]),a&&r?.([a]),!0;case`readDir`:return n.fs.readdir(a);case`exists`:return n.fs.exists(a);case`stat`:{let e=await n.fs.stat(a);return{isDirectory:e.isDirectory,isFile:e.isFile,size:e.size}}case`mkdir`:return await n.fs.mkdir(a,{recursive:!0}),!0;case`rm`:return await n.fs.rm(a,{recursive:!0}),a&&r?.([a]),!0;case`rename`:{let e=n.fs.resolvePath(n.cwd,t[1]),{renameViaFs:i}=await import(`./rename-via-fs-ckVY1Ljv.js`);return await i(n.fs,a,e),r?.(a?[a,e]:[e]),!0}case`resolvePath`:return n.fs.resolvePath(n.cwd,t[0]);case`invalidatePaths`:{let e=t[0],r=n.fs;return r.invalidatePaths&&r.invalidatePaths(e),!0}case`snapshot`:return Vn(n,typeof t[0]==`string`?t[0]:n.cwd);case`flushWrites`:{let e=t[0];return await Hn(n,e),r?.(jn(e)),!0}default:throw Error(`realm-host: unknown vfs op '${e}'`)}}const Nn=10485760;function Pn(e){return e.fileCount>=500||e.totalBytes>=Nn}function Fn(e){return e.entries.length>=2e4}async function In(e,t,n,r){r.entries.push({path:t,content:new Uint8Array,isDirectory:!0});let i;try{i=await e.fs.readdir(t)}catch{return}for(let e of i)e!==`node_modules`&&n.push(t===`/`?`/${e}`:`${t}/${e}`)}async function Ln(e,t,n,r){let i=``;try{i=await e.fs.readlink(t)}catch{return}r.entries.push({path:t,content:new Uint8Array,isDirectory:!1,isSymbolicLink:!0,symlinkTarget:i,size:n})}async function Rn(e,t,n,r,i){if(n>1048576||Pn(r)||r.totalBytes+n>Nn){r.entries.push({path:t,content:new Uint8Array,isDirectory:!1,truncated:!0,size:n});return}let a;try{a=await e.fs.readFileBuffer(t)}catch{await zn(e,t,i,r);return}r.entries.push({path:t,content:a,isDirectory:!1}),r.fileCount+=1,r.totalBytes+=a.byteLength}async function zn(e,t,n,r){let i;try{i=await e.fs.stat(t)}catch{return}if(i.isDirectory){await In(e,t,n,r);return}r.entries.push({path:t,content:new Uint8Array,isDirectory:!1,truncated:!0,size:i.size})}async function Bn(e,t,n){if(Fn(n))return;let r=[t];for(;r.length>0;){if(Fn(n))return;let t=r.pop(),i;try{i=await e.fs.lstat(t)}catch{}if(i?.isSymbolicLink){await Ln(e,t,i.size,n);continue}let a;try{a=await e.fs.stat(t)}catch{continue}a.isDirectory?await In(e,t,r,n):a.isFile&&await Rn(e,t,a.size,n,r)}}async function Vn(e,t){let n={entries:[],totalBytes:0,fileCount:0};return await Bn(e,t,n),t!==`/tmp`&&await Bn(e,`/tmp`,n),{entries:n.entries}}async function Hn(e,t){let n=[],r=async(e,t)=>{try{await t()}catch(t){n.push(`${e}: ${t instanceof Error?t.message:String(t)}`)}};for(let n of t.deleted)await r(n,()=>e.fs.rm(n,{recursive:!0}));for(let n of t.created)n.isSymbolicLink?await r(n.path,()=>e.fs.symlink(n.symlinkTarget??``,n.path)):n.isDirectory?await r(n.path,()=>e.fs.mkdir(n.path,{recursive:!0})):await r(n.path,()=>e.fs.writeFile(n.path,n.content));for(let n of t.modified)await r(n.path,()=>e.fs.writeFile(n.path,n.content));if(n.length>0)throw Error(`sync-fs flush failed for ${n.length} path(s): ${n.join(`; `)}`)}const Un=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`,`SIGSTOP`,`SIGCONT`]),Wn=new Set([`SIGINT`,`SIGTERM`,`SIGKILL`]);async function Gn(e,t,n,r){if(!n.exec)throw Error(`exec is not available in this runtime`);if(e===`run`){let e=t[0],r=await n.exec(e,{cwd:n.cwd});return{stdout:r.stdout,stderr:r.stderr,exitCode:r.exitCode}}if(e===`spawn`){let e=t[0];if(!Array.isArray(e)||e.length===0||!e.every(e=>typeof e==`string`))throw Error(`exec.spawn: argv must be a non-empty string[]`);let[r,...i]=e,a=await n.exec(r,{cwd:n.cwd,args:i});return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode}}if(e===`start`)return Yn(t,n,r);if(e===`kill`)return Xn(t,r);throw Error(`realm-host: unknown exec op '${e}'`)}function Kn(e){if(e.stdin!==void 0&&typeof e.stdin!=`string`)throw Error(`exec.start: stdin must be a string`);if(e.stdinKind!==void 0&&e.stdinKind!==`text`&&e.stdinKind!==`bytes`)throw Error(`exec.start: stdinKind must be 'text' or 'bytes'`);if(e.args!==void 0&&(!Array.isArray(e.args)||!e.args.every(e=>typeof e==`string`)))throw Error(`exec.start: args must be a string[]`);if(e.cwd!==void 0&&typeof e.cwd!=`string`)throw Error(`exec.start: cwd must be a string`);if(e.env!==void 0){if(e.env===null||typeof e.env!=`object`||Array.isArray(e.env))throw Error(`exec.start: env must be an object`);for(let[t,n]of Object.entries(e.env))if(n!==void 0&&typeof n!=`string`)throw Error(`exec.start: env[${t}] must be a string`)}}function qn(e){throw Object.assign(Error(e.message),{code:e.errno})}async function Jn(e,t){let n=await ue(e.fs,e.cwd,t.cwd);`errno`in n&&qn(n);let r=oe(t.env);return r!==void 0&&`errno`in r&&qn(r),{cwd:n.cwd,...r===void 0?{}:{env:r.env}}}async function Yn(e,t,n){let[r,i,a]=e;if(typeof r!=`number`)throw Error(`exec.start: spawnId must be a number`);if(n.spawns.has(r))throw Error(`exec.start: spawnId ${r} is already in use`);let o,s,c;if(Array.isArray(i)){if(i.length===0||!i.every(e=>typeof e==`string`))throw Error(`exec.start: argv must be a non-empty string[]`);[o,...s]=i,c=i.slice()}else if(typeof i==`string`)o=i,c=[i];else throw Error(`exec.start: command must be a string or a non-empty string[]`);let l=a??{};Kn(l);let u=await Jn(t,l),d=new AbortController,{pm:f,owner:p}=n.opts,m=0;f&&p&&(m=f.spawn({kind:`shell`,argv:c,cwd:u.cwd,owner:p,...n.opts.ppid===void 0?{}:{ppid:n.opts.ppid},adoptAbort:d}).pid),n.spawns.set(r,{controller:d,pid:m});let h;try{let e={cwd:u.cwd,signal:d.signal};return l.stdin!==void 0&&(e.stdin=l.stdin),l.stdinKind!==void 0&&(e.stdinKind=l.stdinKind),s===void 0?l.args!==void 0&&(e.args=l.args):e.args=s,u.env!==void 0&&(e.env=u.env,e.replaceEnv=!0),h=await t.exec(o,e),{stdout:h.stdout,stderr:h.stderr,exitCode:h.exitCode}}finally{if(n.spawns.delete(r),f&&m){let e=f.get(m);f.exit(m,e?.terminatedBy?null:h?.exitCode??1)}}}function Xn(e,t){let[n,r]=e,i=t.spawns.get(n);if(!i)return!1;let a=typeof r==`string`&&Un.has(r)?r:`SIGTERM`;Wn.has(a)&&!i.controller.signal.aborted&&i.controller.abort();let{pm:o}=t.opts;return o&&i.pid?o.signal(i.pid,a):!0}async function Zn(e,t,n){if(e!==`request`)throw Error(`realm-host: unknown fetch op '${e}'`);let[r,i]=t,a=await(n.fetch?ht(n.fetch):globalThis.fetch.bind(globalThis))(r,i),o={};a.headers.forEach((e,t)=>{o[t]=e});let s=new Uint8Array(await a.arrayBuffer());return{status:a.status,statusText:a.statusText,headers:o,body:s,url:a.url}}function Qn(e){let t=t=>e.fs.resolvePath(e.cwd,t);return{exists:n=>e.fs.exists(t(n)),isDirectory:async n=>{try{return(await e.fs.stat(t(n))).isDirectory}catch{return!1}},readFile:async n=>{let r=await e.fs.readFile(t(n));return typeof r==`string`?r:new TextDecoder().decode(r)}}}async function $n(e,t,n){if(e!==`buildGraph`)throw Error(`realm-host: unknown module op '${e}'`);let r=typeof t[0]==`string`?t[0]:``,i=typeof t[1]==`string`&&t[1]?t[1]:n.cwd,a=typeof t[2]==`string`?t[2]:``,o=Qn(n),s={reader:o,readBytes:e=>n.fs.readFileBuffer(e),fromDir:i};return Ye({entryCode:r,fromDir:i,entryFilename:a,reader:o,transpile:Ie({ipk:s}),transpileEntry:E({ipk:s})})}async function er(e,t,n){if(e!==`compile`)throw Error(`realm-host: unknown wasm op '${e}'`);let r=typeof t[0]==`string`?t[0]:null;if(r===null)throw Error(`realm-host: wasm.compile requires a path argument`);let i=n.fs.resolvePath(n.cwd,r);return me(e=>n.fs.readFileBuffer(e),i)}async function tr(e,t,n,r){switch(e){case`findTab`:return ir(n,t[0]??{});case`ensureTab`:{let e=t[0];return ar(n,e,t[1]??{})}case`eval`:{let e=t[0],r=t[1];return or(n,e,r,!1)}case`evalAsync`:{let e=t[0],r=t[1];return or(n,e,r,!0)}case`cookie`:{let e=t[0],r=t[1];return ur(n,e,r)}case`localStorage`:{let e=t[0],r=t[1];return dr(n,e,r)}case`wsObserve`:{let e={...t[0],scoopJid:r.scoopJid};return await Z(r).observe(e)}case`wsUpdate`:{let e=t[0],n=t[1]??{};return Z(r).update(e,n)}case`wsClose`:{let e=t[0];return Z(r).close(e)}case`wsList`:return Z(r).list();case`createTab`:{let e=t[0];return n.createPage(e)}case`closeTab`:{let e=t[0];return n.closePage(e)}case`setViewport`:{let e=t[0],r=t[1],i=t[2];return n.withTab(e,e=>e.setViewportOverride(r,i))}case`navigateTab`:{let e=t[0],r=t[1];return n.withTab(e,e=>e.navigate(r))}case`screenshotTab`:{let e=t[0],r=t[1];return n.withTab(e,async e=>(await e.bringToFront(),e.screenshot(r)))}case`waitForLoadState`:{let e=t[0],r=t[1];return lr(n,e,r)}default:throw Error(`realm-host: unknown browser op '${e}'`)}}function nr(){try{let e=globalThis.localStorage;return e?!!(e.getItem(`slicc.trayWorkerBaseUrl`)||e.getItem(`slicc.trayJoinUrl`)):!1}catch{return!1}}async function rr(e){if(typeof e.listAllTargets!=`function`)return(await e.listPages()).map(e=>({targetId:e.targetId,url:e.url,title:e.title}));let n=(await e.listAllTargets()).map(e=>({targetId:e.targetId,url:e.url,title:e.title})),r=nr()?t():null;if(r)try{let{targets:e}=await r.call(`list-remote-targets`,void 0,{timeoutMs:3e3}),t=new Set(n.map(e=>e.targetId));for(let r of e)t.has(r.targetId)||(t.add(r.targetId),n.push({targetId:r.targetId,url:r.url,title:r.title}))}catch(e){Sn.debug(`panel-rpc list-remote-targets failed`,{err:String(e)})}return n}async function ir(e,t){let n=await rr(e);if(t.domain){let e=t.domain.toLowerCase();for(let t of n){let n=fr(t.url);if(n&&n.toLowerCase()===e)return t}return null}if(t.urlMatch){let e;try{e=new RegExp(t.urlMatch)}catch(e){throw Error(`browser.findTab: invalid urlMatch regex: ${e instanceof Error?e.message:String(e)}`)}for(let t of n)if(e.test(t.url))return t;return null}throw Error("browser.findTab: query requires `domain` or `urlMatch`")}async function ar(e,t,n){let r=await rr(e);if(n.matchUrl){let e;try{e=new RegExp(n.matchUrl)}catch(e){throw Error(`browser.ensureTab: invalid matchUrl regex: ${e instanceof Error?e.message:String(e)}`)}let t=r.find(t=>e.test(t.url));if(t)return t}else{let e=pr(t);if(e){let t=r.find(t=>pr(t.url)===e);if(t)return t}}return{targetId:await e.createPage(t),url:t,title:``}}async function or(e,t,n,r){return e.withTab(t,async e=>sr(await e.evaluate(n,{awaitPromise:r,returnByValue:!0})))}function sr(e){if(typeof e!=`string`)return e;let t=cr(e);if(t===void 0)return e;if(typeof t==`object`&&t)return t;if(typeof t==`string`){let e=t.trim();if(e.length>0&&(e[0]===`{`||e[0]===`[`)){let e=cr(t);if(typeof e==`object`&&e)return e}return t}return e}function cr(e){let t=e.trim();if(t.length===0)return;let n=t[0];if(n===`{`||n===`[`||n===`"`||n===`-`||n>=`0`&&n<=`9`||t===`true`||t===`false`||t===`null`)try{return JSON.parse(t)}catch{return}}async function lr(e,t,n){if(n===`networkidle`)return e.withTab(t,async e=>{for(let t=0;t<20;t++)if(await new Promise(e=>setTimeout(e,250)),await e.evaluate(`(function(){
3
- try {
4
- var entries = performance.getEntriesByType('resource');
5
- var now = performance.now();
6
- var recentCutoffMs = 500;
7
- var busy = entries.some(function(e) {
8
- var finished = e.responseEnd || e.startTime;
9
- return (now - finished) < recentCutoffMs;
10
- });
11
- return !busy;
12
- } catch (e) {
13
- return true;
14
- }
15
- })()`,{returnByValue:!0}))return})}async function ur(e,t,n){return e.withTab(t,async e=>{let t=((await e.send(`Network.getCookies`)).cookies??[]).find(e=>e.name===n);return t&&typeof t.value==`string`?t.value:null})}async function dr(e,t,n){return e.withTab(t,async e=>{let t=await e.evaluate(`(function(){try{var v=window.localStorage.getItem(${JSON.stringify(n)});return v===null?null:String(v);}catch(e){return null;}})()`,{returnByValue:!0});return t==null?null:typeof t==`string`?t:String(t)})}function fr(e){try{return new URL(e).hostname}catch{return null}}function pr(e){try{return new URL(e).origin}catch{return null}}async function mr(e,t,n,r){switch(e){case`list`:return n.list();case`request`:return n.request(t[0]??[]);case`info`:return n.info(t[0]);case`open`:return n.open(t[0]);case`close`:return n.close(t[0],{owner:r.owner,force:!!t[1]?.force});case`reset`:return n.reset(t[0],{owner:r.owner,force:!!t[1]?.force});case`clearHalt`:return n.clearHalt(t[0],t[1],t[2]);case`selectConfig`:return n.selectConfig(t[0],t[1]);case`claim`:return n.claim(t[0],t[1],{owner:r.owner,wait:!!t[2]?.wait});case`release`:return n.release(t[0],t[1],{owner:r.owner});case`controlIn`:return n.controlIn(t[0],t[1],t[2]);case`controlOut`:return n.controlOut(t[0],t[1],t[2]);case`transferIn`:return n.transferIn(t[0],t[1],t[2]);case`transferOut`:return n.transferOut(t[0],t[1],t[2]);case`subscribeClaimEvents`:{let e=t[0];if(r.subscriptions.has(e))return!0;let i=n.subscribeClaimEvents;if(!i)return!0;let a=i(t=>{t.handle===e&&r.pushEvent({type:`realm-event`,channel:`usb-claim-event`,payload:t})});return r.subscriptions.set(e,a),!0}case`unsubscribeClaimEvents`:{let e=t[0],n=r.subscriptions.get(e);return!n||(r.subscriptions.delete(e),await n(),!0)}default:throw Error(`realm-host: unknown usb op '${e}'`)}}async function hr(e,t,n){switch(e){case`list`:return n.list();case`request`:return n.request(t[0]??[]);case`info`:return n.info(t[0]);case`open`:return n.open(t[0],t[1]);case`close`:return n.close(t[0]);case`read`:{let e=t[1]??{};return n.read(t[0],e)}case`write`:return n.write(t[0],t[1]);case`getSignals`:return n.getSignals(t[0]);case`setSignals`:return n.setSignals(t[0],t[1]);default:throw Error(`realm-host: unknown serial op '${e}'`)}}async function gr(e,t,n,r){switch(e){case`list`:return n.list();case`request`:return n.request(t[0]??[]);case`info`:return n.info(t[0]);case`open`:return n.open(t[0]);case`close`:return n.close(t[0]);case`sendReport`:return n.sendReport(t[0],t[1],t[2]);case`sendFeatureReport`:return n.sendFeatureReport(t[0],t[1],t[2]);case`receiveFeatureReport`:return n.receiveFeatureReport(t[0],t[1]);case`subscribeInputReports`:{let e=t[0];if(r.subscriptions.has(e))return!0;let i=await n.subscribeInputReports(e,t=>{let n=t.bytes instanceof Uint8Array?t.bytes:new Uint8Array(t.bytes),i={type:`realm-event`,channel:`hid-input-report`,payload:{handle:e,reportId:t.reportId,bytes:n}};r.pushEvent(i,[n.buffer])});return r.subscriptions.set(e,i),!0}case`unsubscribeInputReports`:{let e=t[0],n=r.subscriptions.get(e);return!n||(r.subscriptions.delete(e),await n(),!0)}default:throw Error(`realm-host: unknown hid op '${e}'`)}}function _r(e){if(e instanceof Uint8Array)return[e.buffer];if(e&&typeof e==`object`){let t=e;if(t.body instanceof Uint8Array)return[t.body.buffer];if(t.bytes instanceof Uint8Array)return[t.bytes.buffer]}return[]}const vr=65536;function Q(e,t){if(!t)return e;let n=e+t;return n.length<=vr?n:n.slice(n.length-vr)}const yr={SIGKILL:137,SIGINT:130,SIGTERM:143};function br(e,t){let n=Math.max(0,e)/1e3;return`--- killed after ${n<10?n.toFixed(2).replace(/(\.\d*?)0+$/,`$1`).replace(/\.$/,``):String(Math.round(n))}s (exit ${t}) ---\n`}function xr(e,t){for(let n of t)e.pendingByPath.delete(n)}function Sr(e,t,n){if(e.type===`realm-output`){let r=e;return r.stream===`stdout`?t.stdout=t.captureOutput?t.stdout+r.chunk:Q(t.stdout,r.chunk):t.stderr=t.captureOutput?t.stderr+r.chunk:Q(t.stderr,r.chunk),n?.(r.chunk,r.stream),`live`}if(e.type===`realm-fs-write`){let n=e;return t.pendingByPath.set(n.path,{op:`write`,path:n.path,bytes:n.bytes}),`live`}if(e.type===`realm-fs-delete`){let n=e;return t.pendingByPath.set(n.path,{op:`delete`,path:n.path}),`live`}return e.type===`realm-done`?`done`:e.type===`realm-error`?`error`:`live`}async function Cr(e,t,n){try{if(t.op===`write`){let n=e.fs?.writeFile?.bind(e.fs);n&&await n(t.path,t.bytes)}else{let n=e.fs?.rm?.bind(e.fs);n&&await n(t.path,{recursive:!0})}}catch(e){let r=e instanceof Error?e.message:String(e),i=t.op===`write`?`write`:`delete`;n.stderr+=`[sync-fs] ERROR: ${i} of ${t.path} was NOT persisted: ${r}\n`}}async function wr(e,t,n){for(let r of e)await Cr(t,r,n)}function Tr(e,t,n){return{type:`realm-init`,kind:e.kind,code:e.code,argv:e.realmArgv??e.argv,env:e.env,cwd:e.cwd,filename:e.filename,stdin:e.stdin,pyodideIndexURL:e.pyodideIndexURL,pyodideAssetRoot:e.pyodideAssetRoot,pyodideMountDirs:e.pyodideMountDirs,opfsMountDbName:e.opfsMountDbName,mountPoints:e.mountPoints,...t.syncFsToken===void 0?{}:{syncFsToken:t.syncFsToken},...n?{syncSab:n}:{},...e.captureOutput===!1?{captureOutput:!1}:{}}}async function Er(e){let t=e.procKind??`jsh`,n=e.pm.spawn({kind:t,argv:e.argv,cwd:e.cwd,env:e.env,owner:e.owner,ppid:e.ppid});e.onSpawn?.(n);let r;try{r=await e.realmFactory({kind:e.kind,ctx:e.ctx})}catch(t){let r=t instanceof Error?t.message:String(t);return e.pm.exit(n.pid,1),{stdout:``,stderr:`realm-runner: ${r}\n`,exitCode:1}}let i=r.isolatedThread?Dr(e.syncSabBytes):void 0,a={stdout:``,stderr:``,pendingByPath:new Map,captureOutput:e.captureOutput!==!1},o=wn(r.controlPort,e.ctx,{...e.owner.scoopJid===void 0?{}:{scoopJid:e.owner.scoopJid},pm:e.pm,owner:e.owner,ppid:n.pid,syncFsBridgeEnabled:!!e.syncFsBridgeEnabled||i!==void 0,...i?{syncSab:i}:{},onHostFsMutation:e=>xr(a,e)});return new Promise(t=>{let s=!1,c=!1,l=null,u=null,d=null,f=null,p=()=>{if(!c){c=!0,u&&r.controlPort.removeEventListener(`message`,u),r.removeEventListener&&(d&&r.removeEventListener(`error`,d),f&&r.removeEventListener(`messageerror`,f)),l?.();try{r.terminate()}catch{}}},m=(r,i)=>{p(),o.dispose(),e.pm.exit(n.pid,i),t(r)},h=(e,t)=>{s||(s=!0,Promise.resolve().then(()=>m(e,t)))},g=t=>{s||(s=!0,Promise.resolve().then(()=>{let r=[...a.pendingByPath.values()];a.pendingByPath.clear(),p(),wr(r,e.ctx,a).finally(()=>{let e=br(Date.now()-n.startedAt,t);m({stdout:a.stdout,stderr:a.stderr+e,exitCode:t},t)})}))};u=t=>{let n=t.data,r=Sr(n,a,e.onOutput);if(r===`done`){let e=t.data;h({stdout:e.stdout,stderr:e.stderr,exitCode:e.exitCode},e.exitCode)}else if(r===`error`){let e=t.data;h({stdout:a.stdout,stderr:a.stderr+e.message+`
16
- `,exitCode:1},1)}},d=e=>{let t=e.message??`realm error`;h({stdout:a.stdout,stderr:a.stderr+t+`
17
- `,exitCode:1},1)},f=()=>{h({stdout:a.stdout,stderr:a.stderr+`realm-runner: worker message could not be deserialized
18
- `,exitCode:1},1)},l=e.pm.onSignal((e,t)=>{if(e.pid!==n.pid)return;let r=yr[t];r!==void 0&&g(r)}),r.controlPort.addEventListener(`message`,u),r.addEventListener&&(r.addEventListener(`error`,d),r.addEventListener(`messageerror`,f)),r.controlPort.postMessage(Tr(e,o,i))})}function Dr(e){if(le())try{return new SharedArrayBuffer(64+(e??1048576))}catch{return}}let Or=!1;function kr(e){Or=e}function Ar(){return Or}const jr=Object.freeze({anthropic:`ANTHROPIC_API_KEY`,"ant-ling":`ANT_LING_API_KEY`,"qwen-token-plan":`QWEN_TOKEN_PLAN_API_KEY`,"qwen-token-plan-cn":`QWEN_TOKEN_PLAN_CN_API_KEY`,"qwen-token-plan-individual":`QWEN_TOKEN_PLAN_API_KEY`,openai:`OPENAI_API_KEY`,"azure-openai-responses":`AZURE_OPENAI_API_KEY`,nvidia:`NVIDIA_API_KEY`,deepseek:`DEEPSEEK_API_KEY`,google:`GEMINI_API_KEY`,"google-vertex":`GOOGLE_CLOUD_API_KEY`,groq:`GROQ_API_KEY`,cerebras:`CEREBRAS_API_KEY`,xai:`XAI_API_KEY`,radius:`RADIUS_API_KEY`,openrouter:`OPENROUTER_API_KEY`,"vercel-ai-gateway":`AI_GATEWAY_API_KEY`,zai:`ZAI_API_KEY`,"zai-coding-cn":`ZAI_CODING_CN_API_KEY`,mistral:`MISTRAL_API_KEY`,minimax:`MINIMAX_API_KEY`,"minimax-cn":`MINIMAX_CN_API_KEY`,moonshotai:`MOONSHOT_API_KEY`,"moonshotai-cn":`MOONSHOT_API_KEY`,huggingface:`HF_TOKEN`,fireworks:`FIREWORKS_API_KEY`,together:`TOGETHER_API_KEY`,baseten:`BASETEN_API_KEY`,opencode:`OPENCODE_API_KEY`,"opencode-go":`OPENCODE_API_KEY`,"kimi-coding":`KIMI_API_KEY`,"cloudflare-workers-ai":`CLOUDFLARE_API_KEY`,"cloudflare-ai-gateway":`CLOUDFLARE_API_KEY`,xiaomi:`XIAOMI_API_KEY`,"xiaomi-token-plan-cn":`XIAOMI_TOKEN_PLAN_CN_API_KEY`,"xiaomi-token-plan-ams":`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,"xiaomi-token-plan-sgp":`XIAOMI_TOKEN_PLAN_SGP_API_KEY`});function Mr(e){return jr[e]??null}function Nr(e,t){let n=Mr(e);if(!n)return{};let r=t.find(t=>t.providerId===e)?.apiKey?.trim();return r?{[n]:r}:{}}let $=null;function Pr(e){let t=$;return $=e,t}async function Fr(){if(!$)return{};try{return await $()??{}}catch{return{}}}function Ir(){return async()=>{let{getAccounts:e,getSelectedProvider:t}=await import(`./account-store-lzZlhljv.js`).then(e=>e.t);return Nr(t(),e())}}async function Lr(e,t,n,r,i={}){return await n.fs.exists(e)?Rr(await n.fs.readFile(e),[`node`,e,...t],n,r,{...i,filename:e}):{stdout:``,stderr:`jsh: cannot find script '${e}'\n`,exitCode:127}}async function Rr(e,t,n,r,i={}){let a=i.realmFactory??await zr(),o=r?.processManager??Hr()??Vr(),s=r?.owner??{kind:`system`},c=i.filename??t[1]??`<eval>`;return await Er({pm:o,realmFactory:a,owner:s,kind:`js`,code:e,argv:t,env:{...s.kind===`scoop`||s.kind===`jshd`?{}:await Fr(),...Object.fromEntries(n.env.entries())},cwd:n.cwd,filename:c,stdin:be(n.stdin),ctx:n,ppid:r?.getParentPid?.(),syncFsBridgeEnabled:Ar(),...i.onSpawn?{onSpawn:e=>i.onSpawn?.(e.pid)}:{},...i.onOutput?{onOutput:i.onOutput}:{},...i.captureOutput===!1?{captureOutput:!1}:{}})}async function zr(){if(typeof Worker<`u`||typeof document<`u`)return we();let{createInProcessJsRealmFactory:e}=await import(`./realm-inprocess-BdTkrnDI.js`);return e()}let Br=null;function Vr(){return Br||=new l,Br}function Hr(){let e=globalThis.__slicc_pm;return e&&typeof e==`object`&&typeof e.spawn==`function`&&typeof e.onSignal==`function`?e:null}export{D as _,kr as a,Oe as b,Jt as c,B as d,H as f,et as g,A as h,Pr as i,U as l,tt as m,Lr as n,Er as o,R as p,Ir as r,yn as s,Rr as t,W as u,E as v,x,we as y};
@@ -1 +0,0 @@
1
- var e="# jsh runtime extensions\n\nThis file is bundled into the agent VFS at `/workspace/skills/skill-authoring/jsh-runtime-extensions.md`. Developer-facing equivalent: `docs/shell-reference.md` (which lives outside the VFS). Keep both in sync when the runtime surface changes.\n\n## Runtime globals (Globals API)\n\nEvery `.jsh` script runs in an async wrapper with a small Node-standard surface available as bare globals. SLICC's capability bridges (exec, agent, http, browser, USB / Serial / HID, skill, color, cli, time, fmt, pool) are NOT bare globals; they are reached via the `sliccy:` virtual-module scheme below.\n\n### Node-standard bare globals\n\n| Global | Purpose |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `process` | `argv` (with `.parseFlags()`), `env`, `cwd()`, `exit(code)`, `exitCode` (deferred status: assignment does not unwind; the realm reads it after the event-loop drain, including from an async callback), `stdout.write`, `stderr.write`. `stdin` is a fully-buffered (no streaming) one-shot value with three surfaces sharing one `consumed` flag — `read()` (returns `null` when nothing was piped, Node parity), events (`on('data')`→`'end'`→`'close'`, single chunk, no real streaming — `pause()` suppresses emission until `resume()`, and `exit(N)` from a handler exits with code `N`), and async iterator. Drain via exactly one; the others then see EOF. |\n| `console` | `log`/`info`/`debug`/`dirxml`/`table`/`dir` → stdout; `warn`/`error`/`assert`/`trace` → stderr (`assert` does not throw). `group`/`groupCollapsed`/`groupEnd` indent; `time`/`timeEnd`/`timeLog` and `count`/`countReset` are labeled; `clear` is a no-op. All 19 standard methods are functions. |\n| `fetch` | Standard `fetch` routed through SLICC's proxied transport (cookies + CORS + secret masking handled). Binary bodies (`Uint8Array` / `Blob` / `FormData`) are sent as raw bytes — bytes ≥0x80 are not UTF-8-expanded. `await res.json()` / `res.text()` resolve from the already-buffered body and keep the realm alive for the rest of the continuation. Later WHATWG stream I/O (`Request`/`Response`/`Blob` body reads, `ReadableStream` `read`/`pipeTo`) also keeps the realm alive (succeed or reject — never silent exit 0). |\n| `require(p)` | Synchronous CJS `require`. Use `require('sliccy:<name>')` for capability bridges, `require('fs')` / `require('node:fs')` for the VFS bridge, `require('<pkg>')` for installed packages. |\n| `Buffer` / `globalThis` | Node-standard surface. |\n| `setTimeout` / `clearTimeout` / `setInterval` / `queueMicrotask` | Web timer surface (also reachable through `globalThis`). Outstanding timeouts and intervals keep the realm alive the way Node keeps a process alive for ref'd handles; `queueMicrotask` is not a handle. `process.exit()` cancels pending timers. |\n| `__dirname` / `__filename` | CJS scope vars — the running script's own directory and absolute path. |\n| `module` / `exports` | CJS module record (writeable; useful when a `.jsh` is treated as a library by a sibling `require('./helper.jsh')`). |\n| `process.argv.parseFlags()` | Parse `--flag=val` / `--flag val` / `-x` / positional / `--` passthrough into `{ positional, flags, subcommand, passthrough }`. |\n\n### Capability bridges — `sliccy:` virtual modules\n\nThe bespoke globals are hard-cut. Reach each capability via `require('sliccy:<name>')` (CJS) or `import ... from 'sliccy:<name>'` (ESM). `require('fs')` / `require('node:fs')` keeps returning the VFS bridge.\n\n| `require('sliccy:<name>')` | Purpose |\n| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `sliccy:exec` | Callable `exec(cmd)` plus `.spawn(argv[])`, `.start(cmdOrArgv, opts?)` (killable, buffered-stdin spawn handle) and `.exec` self-reference. Returns `{ stdout, stderr, exitCode }`. Use `const { exec } = require('sliccy:exec')` or `const exec = require('sliccy:exec')`. |\n| `sliccy:agent` | Callable `agent(prompt, opts?)` — spawns a one-shot sub-scoop, feeds it the prompt, blocks until the agent loop completes; resolves to trimmed final text (JSON-parsed when `opts.schema` is set), REJECTS on non-zero exit or schema-parse failure. `.spawn(prompt, opts?)` is the non-throwing variant → `{ finalText, exitCode, stderr }`. `opts`: `model`, `thinking`, `cwd`, `allowedCommands`, `readOnly`, `schema`. |\n| `sliccy:skill` | Frozen `{ dir, root, refs, assets, config(), config(updates), token(providerId) }`. `refs`/`assets` resolve from the skill root (parent of `scripts/` when the script lives there). Replaces ad-hoc `argv[1]` dirname math and `oauth-token` shell-outs. |\n| `sliccy:http` | `http.client({ baseUrl, token, headers, retry, timeoutMs })` builder. |\n| `sliccy:browser` | `findTab`, `ensureTab`, `eval`, `evalAsync`, `cookie`, `localStorage`, `fetch`, `websocket.on(...).filter(...).forward(...)`. |\n| `sliccy:usb` / `sliccy:serial` / `sliccy:hid` | `list()` / `request()` + device methods (`open`/`close`/`sendReport`/...). Chromium-only. |\n| `sliccy:cli` | `die(msg, opts?)`, `out(value)`, `warn(msg, opts?)`, `help(text)`. `opts` is `number` or `{ exitCode?, prefix? }`; `prefix: ''` removes the default `Error:` / `Warning:` label entirely. |\n| `sliccy:color` | ANSI helpers: `green`, `red`, `yellow`, `gray`, `bold`, `cyan`, `dim`, plus `enabled` flag (auto-disabled on non-TTY / `NO_COLOR`). |\n| `sliccy:time` | `parseDuration(spec)`, `ago(spec)`, `range(spec)`, `future(spec)`, `gmailDate(spec)`. Units: `ms s m h d w M y` (note: `m` = minutes, `M` = months). |\n| `sliccy:fmt` | `trunc(s, n)`, `col(s, width)`, `table(rows, widths?)`, `date(value, style?)`. `style`: `'short' \\| 'iso' \\| 'human' \\| 'locale'` (locale = `Intl.DateTimeFormat` medium). |\n| `sliccy:pool` | `pool(n, items, fn)` — bounded concurrency runner, results returned in input order. |\n\n`require('sliccy:<unknown>')` throws a scheme-specific error (`Unknown sliccy: module '<name>'`); empty `require('sliccy:')` throws `empty sliccy: module name`. `sliccy:` lookups never hit the registry / `node_modules` / `ipk install`.\n\n### Filesystem (VFS bridge)\n\n`require('fs')` and `require('node:fs')` return the VFS bridge (`readFile`, `writeFile`, `readFileBinary`, `writeFileBinary`, `appendFile`, `readDir`, `exists`, `stat`, `mkdir`, `rm`, `fetchToFile(url, path)`), plus the sync set (`readFileSync`, `writeFileSync`, `appendFileSync`, `existsSync`, `statSync`, …). All paths are VFS-resolved. There is no bare `fs` global. Async `appendFile` is one locked VFS RPC, so concurrent appends to the same path keep every payload. `writeFileSync` / `appendFileSync` persist at call time, and `console.log` is captured as it prints — a `timeout`/`kill` of the node realm (rc=124/137) still leaves the log file and the stdout written before the hang.\n\nStdio fds and device paths work like Node: `fs.readFileSync(0, 'utf8')` (or `'/dev/stdin'`) reads the full piped stdin without consuming `process.stdin`; `fs.writeFileSync(1, …)` / `fs.writeFileSync(2, …)` (or `/dev/stdout` / `/dev/stderr`) write to stdout/stderr; `existsSync`/`statSync` report the three stream devices as present. Unknown numeric fds and wrong-direction stream ops throw `EBADF`.\n\n### Line reading (`readline`)\n\n`require('readline')` and `require('readline/promises')` work over the buffered stdin:\n\n```javascript\nconst readline = require('readline/promises');\nconst rl = readline.createInterface({ input: process.stdin, output: process.stdout });\nfor await (const line of rl) console.log('>', line);\n// or: rl.on('line', fn) … rl.on('close', fn), or const answer = await rl.question('name? ')\n```\n\nCreating the interface drains `process.stdin` (one-shot, like Node's flowing mode); `question()` answers with the next unconsumed line (`''` at EOF).\n\n### Examples for the non-trivial globals\n\n```javascript\n// process.argv.parseFlags() — replace per-skill arg loops\nconst { positional, flags, subcommand, passthrough } = process.argv.parseFlags();\n// e.g. `mycli send --to alice --json -- --raw` →\n// positional: ['send', 'alice'], flags: { to: 'alice', json: true },\n// subcommand: 'send', passthrough: ['--raw']\n```\n\n**Two-level routing**: `parseFlags` populates `subcommand` only from the first positional. For `<cmd> <sub> [args]` CLIs, route the second level manually from `positional[1]`:\n\n```javascript\nconst { positional, flags } = process.argv.parseFlags();\nconst [cmd, sub] = positional;\nswitch (cmd) {\n case 'pr':\n if (sub === 'list') return prList(flags);\n if (sub === 'view') return prView(positional[2], flags);\n return cli.die(`unknown pr subcommand: ${sub}`);\n // …\n}\n```\n\n```javascript\n// cli + color — early-exit helpers and color (both via sliccy:)\nconst cli = require('sliccy:cli');\nconst c = require('sliccy:color');\nif (!flags.to) cli.die('--to is required'); // writes \"Error: …\" to stderr, exits 1\ncli.out({ ok: true }); // pretty-prints JSON to stdout with trailing newline\nconsole.log(c.green('✓'), c.dim('done'));\n```\n\n```javascript\n// domain-specific prefix instead of the default \"Error:\"\nconst cli = require('sliccy:cli');\nif (!flags.repo) cli.die('--repo is required', { prefix: 'gh' });\n// → \"gh: --repo is required\"\ncli.warn('rate limit at 80%', { prefix: 'gh' });\n```\n\n```javascript\n// time — duration math\nconst time = require('sliccy:time');\nconst since = time.ago('7d'); // Date 7 days ago\nconst q = `after:${time.gmailDate('7d')}`; // \"after:2026/05/22\"\n\n// fmt — ANSI-aware table\nconst fmt = require('sliccy:fmt');\nconst c = require('sliccy:color');\nconsole.log(\n fmt.table([\n ['name', 'status'],\n ['hub', c.green('up')],\n ['relay', c.red('down')],\n ])\n);\n\n// pool — bounded concurrency\nconst pool = require('sliccy:pool');\nconst results = await pool(4, urls, async (url) => (await fetch(url)).status);\n```\n\n```javascript\n// exec.spawn(argv[]) — bypass shell parsing. Use for any arg derived from\n// untrusted input: it can't be shell-interpolated.\nconst { exec } = require('sliccy:exec');\nconst userMessage = flags.message ?? 'wip';\nawait exec.spawn(['git', 'commit', '-m', userMessage]); // safe even with quotes/spaces in userMessage\n```\n\n```javascript\n// exec.start(cmdOrArgv, opts?) — killable, buffered-stdin spawn handle. Buffer\n// stdin with .write(), launch with .end(), await .done for the result, and\n// .kill(signal?) to abort. NOT interactive/streaming — just-bash is one-shot\n// buffered, so stdin is a single upfront buffer and post-launch writes drop.\nconst { exec } = require('sliccy:exec');\nconst h = exec.start(['jq', '.name']);\nh.stdin.write('{\"name\":\"slicc\"}');\nh.stdin.end();\nconst { stdout, exitCode } = await h.done;\n// h.kill('SIGTERM') fans a signal out via the exec:kill op.\n```\n\n```javascript\n// agent — spawn a one-shot sub-scoop and block on its result. The callable\n// resolves to the sub-scoop's final text; with `schema` it resolves to the\n// parsed object (rejects if the reply wasn't valid JSON) and rejects on a\n// non-zero exit. Use agent.spawn(...) when you want the raw outcome instead.\nconst agent = require('sliccy:agent');\nconst summary = await agent('Summarize /workspace/README.md in one line', {\n thinking: 'low',\n readOnly: '/workspace/',\n});\n\nconst parsed = await agent('Extract the title as {\"title\": string}', {\n schema: { type: 'object', properties: { title: { type: 'string' } } },\n});\n\nconst { finalText, exitCode, stderr } = await agent.spawn('do the thing', {\n model: 'claude-opus-4-6',\n cwd: process.env.TMPDIR ?? '/tmp',\n allowedCommands: 'git,node',\n});\n```\n\n### `require('child_process')` — Node process API over the exec bridge\n\n`require('child_process')` / `require('node:child_process')` resolves in the `.jsh` / `node` realm to a shim built on `exec.start`. `exec` / `execFile` / `spawn` map onto the one-shot just-bash exec pipeline: the returned `ChildProcess` is an `EventEmitter` that fires `'exit'` / `'close'`, and its `.stdout` / `.stderr` are Readable stubs that each emit a single `'data'` chunk then `'end'`. `exec` / `execFile` also carry a `util.promisify.custom` implementation resolving `{ stdout, stderr }`.\n\n```javascript\nconst { exec } = require('child_process');\nconst { promisify } = require('util');\nconst { stdout } = await promisify(exec)('ls -la /workspace');\n```\n\nThe **sync forms** (`execSync` / `spawnSync` / `execFileSync`) run on the blocking sync-XHR bridge and follow Node's return/throw contracts (`spawnSync` never throws on a non-zero exit). `{ cwd }` sets the child's working directory; `{ env }` **replaces** the child's environment (spread `process.env` to extend). A missing `cwd` is `ENOENT`, not a silent fallback to the parent. They need a controlling Service Worker; on a float without one they throw an error naming the async escape hatch. `fork` always throws — no long-lived process model. `.bsh` scripts (which run in the target page via CDP, not the realm) have no shell bridge at all, so `require('child_process')` there is unavailable; use `exec()` from a `.jsh` script instead.\n\n## jsh runtime extensions\n\nThe following capabilities collapse the boilerplate that 18 of 23 surveyed skills reinvented. They're available in both standalone and extension floats; each is reached through `require('sliccy:<name>')` (or the equivalent ESM `import`).\n\n### `sliccy:skill` — skill-root paths, config, tokens\n\nComputed once at boot from `argv[1]` and frozen. Replaces ad-hoc `process.argv[1].substring(0, …)` dirname math, bespoke `.config` JSON readers, and `oauth-token` shell-outs.\n\nAgent Skills layout is `<skill-root>/{SKILL.md,scripts/,references/,assets/}`. `skill.dir` is the directory containing the running script. When any path segment of that directory is `scripts` (`<skill-root>/scripts/<name>.jsh`, including helpers under `scripts/<subdir>/`), `skill.root` is the parent of that segment — the skill folder. Otherwise `skill.root` equals `skill.dir`. `skill.refs` and `skill.assets` resolve from `skill.root`. `skill.config()` still reads/writes `<dir>/.config` (typically `scripts/.config`) so `upskill` can preserve that dotfile.\n\n```typescript\nconst skill = require('sliccy:skill');\nskill.dir: string // directory containing the running script\nskill.root: string // skill folder (parent of `scripts/` when applicable)\nskill.refs: string // `<root>/references`\nskill.assets: string // `<root>/assets`\nskill.config(): Promise<Record<string, unknown> | null> // read parsed JSON from `<dir>/.config`\nskill.config(updates): Promise<Record<string, unknown>> // shallow-merge + write, returns merged\nskill.token(providerId: string): Promise<string> // shells out to `oauth-token <id>`\n```\n\n```javascript\nconst skill = require('sliccy:skill');\nconst fs = require('fs');\nconst cfg = (await skill.config()) ?? {};\nconst token = await skill.token('adobe');\nconst tmpl = await fs.readFile(`${skill.refs}/prompt.md`);\n```\n\n### `sliccy:browser` — page-context CDP bridge\n\nReplaces the `exec('playwright-cli tab-list')` shell-out + regex parse used in ~12 skills. Accepts a `TabHandle` (from `findTab` / `ensureTab`) or a bare `targetId` string. `eval` / `evalAsync` serialize functions to a string call expression so realm code can pass a closure as ergonomically as a string.\n\n```typescript\nconst browser = require('sliccy:browser');\nbrowser.findTab(opts: { domain?: string; urlMatch?: RegExp | string }): Promise<TabHandle | null>\nbrowser.ensureTab(url: string, opts?: { matchUrl?: RegExp | string }): Promise<TabHandle>\nbrowser.eval(tab, fn: Function | string): Promise<unknown> // sync expression\nbrowser.evalAsync(tab, fn: AsyncFunction): Promise<unknown> // async, returns parsed JSON\nbrowser.cookie(tab, name: string): Promise<string | null>\nbrowser.localStorage(tab, key: string): Promise<string | null>\n```\n\n```javascript\nconst browser = require('sliccy:browser');\nconst cli = require('sliccy:cli');\nconst tab = await browser.findTab({ domain: 'slack.com' });\nif (!tab) cli.die('open slack.com first');\nconst team = await browser.eval(tab, () => document.title);\nconst xoxc = await browser.localStorage(tab, 'localConfig_v2');\n```\n\n### `browser.fetch(tab, url, opts)` — page-context fetch\n\nReplaces the eval-file + base64 + double-JSON-unwrap pattern in ~9 skills. Runs inside the tab's origin, so **session cookies and same-origin headers are automatic** — don't try to forward cookies manually.\n\n```typescript\nbrowser.fetch(tab: TabHandle | string, url: string, opts?: {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | ...;\n headers?: Record<string, string>;\n body?: unknown; // object → JSON-stringified\n credentials?: 'include' | 'omit'; // defaults to 'include'\n responseType?: 'text' | 'json' | 'binary';\n timeoutMs?: number; // page-side AbortSignal.timeout()\n}): Promise<{\n ok: boolean; status: number; statusText: string;\n url: string; redirected: boolean; // final URL after redirects\n headers: Record<string, string>;\n body: unknown; bodyEncoding?: 'base64';\n}>\n```\n\nFrom the shell, `curlwright` is the same capability with curl's flags — reach for it while\nexploring an API, and for `browser.fetch` once the call is settled into a `.jsh`.\n\n```javascript\nconst browser = require('sliccy:browser');\nconst cli = require('sliccy:cli');\nconst resp = await browser.fetch(tab, '/api/conversations.list', {\n method: 'POST',\n body: { limit: 100 },\n});\nif (!resp.ok) cli.die(`slack ${resp.status}`);\nconst channels = resp.body.channels;\n```\n\n### `browser.websocket` — declarative WebSocket observer\n\nSanctioned replacement for `WebSocket.prototype.send` monkey-patches. **REQUIRED for any new WS-watch use case** — skill code MUST NOT author page-context functions that patch a third-party page's prototypes or see the inbound frame firehose.\n\n```typescript\nconst sub = await browser.websocket\n .on(tab, { urlMatch: /wss-primary\\.slack\\.com/ })\n .filter({ parseAs: 'json', where: { type: 'message', channel: 'C0899S7HV0E' } })\n .forward({ sink: 'webhook', webhookId: 'slack-watch-abc123' });\n\nawait sub.update({ filter: { where: { channel: 'C-new' } } });\nawait sub.close();\nawait browser.websocket.list();\n```\n\n**Sink set is a closed enum.** The page-side router (runtime-owned, audited once) only knows how to forward matched frames to:\n\n- `'webhook'` — resolved against the existing `webhook` registry; an unknown `webhookId` rejects at subscriber-creation time.\n- `'scoop'` — delivered via the orchestrator's scoop dispatch.\n- `'vfs'` — appended to an absolute path that must start with `/workspace/`.\n- `'log'` — telemetry only.\n\n**Discovery requires outbound `send()`.** The router patches `WebSocket.prototype.send` as a pure discovery hook — it never observes outbound frames, but a WebSocket instance is only wrapped (and its inbound `message` listener attached) the first time something calls `send()` on it. Receive-only sockets that never call `send()` are not currently captured; trigger a no-op send from the page (or wait for the page to send a heartbeat / subscription frame) before subscribing.\n\nSkills cannot supply an arbitrary URL, cannot supply page-context code (the `filter` selector is a declarative JSON object — `parseAs`, `where`, `project` — and the realm rejects functions or strings of JS at the boundary), and cannot intercept outbound `send` traffic. Subscribers owned by a scoop auto-close when the scoop is dropped.\n\n### `sliccy:http` — standard API-client builder\n\n`require('sliccy:http')` exposes `http.client({ baseUrl, token, headers, retry, timeoutMs })`. Standardizes the `build URL → merge headers → resolve auth → fetch → unwrap JSON → throw on !ok` boilerplate. `token` is **lazy** — resolved freshly per request so token rotation / refresh hooks are picked up without recreating the client. Backoff is exponential, but **`Retry-After` (when present and parseable, in seconds or HTTP date) takes precedence** — the server knows its own rate limit.\n\n```typescript\nconst http = require('sliccy:http');\nhttp.client(config: {\n baseUrl?: string;\n token?: (req?: { method: string; path: string; url: string }) => string | Promise<string | null | undefined>;\n headers?: Record<string, string>;\n retry?: { on: number[]; maxAttempts: number }; // maxAttempts is total (including first)\n timeoutMs?: number; // per-attempt timeout; aborts the fetch\n}): {\n get(path, opts?): Promise<unknown>;\n post(path, opts?): Promise<unknown>;\n put(path, opts?): Promise<unknown>;\n patch(path, opts?): Promise<unknown>;\n delete(path, opts?): Promise<unknown>;\n}\n// opts: { params?, headers?, body?, signal?: AbortSignal, raw?: boolean }\n// - body object → JSON, params → querystring\n// - signal: caller-owned abort signal (timeoutMs creates its own per-attempt signal that combines with this)\n// - raw: when true, returns { body, headers, status } instead of just body — needed for pagination (Link header) and rate-limit (X-RateLimit-*) instrumentation\n```\n\n```javascript\nconst http = require('sliccy:http');\nconst skill = require('sliccy:skill');\nconst api = http.client({\n baseUrl: 'https://graph.microsoft.com/v1.0',\n token: () => skill.token('microsoft'),\n headers: { Accept: 'application/json' },\n retry: { on: [429, 503], maxAttempts: 4 },\n});\n\nconst me = await api.get('/me');\nconst sent = await api.post('/me/sendMail', {\n body: {\n message: {/* … */},\n },\n});\n// Non-2xx throws `HttpError` with { status, statusText, url, body }.\n```\n\n```javascript\n// raw responses for pagination\nconst resp = await api.get('/users', { raw: true });\nconst link = resp.headers['link']; // e.g. '<…/users?page=2>; rel=\"next\"'\n\n// per-request abort\nconst ctl = new AbortController();\nsetTimeout(() => ctl.abort(), 5000);\nawait api.get('/slow', { signal: ctl.signal });\n\n// token with request context (e.g. different token for reads vs writes)\nconst api = http.client({\n baseUrl: 'https://api.example.com',\n token: (req) => (req?.method === 'GET' ? skill.token('read') : skill.token('write')),\n});\n```\n\n### `sliccy:hid` / `sliccy:serial` / `sliccy:usb` — native device scripting\n\n`require('sliccy:hid')` / `require('sliccy:serial')` / `require('sliccy:usb')` expose the WebHID / Web Serial / WebUSB bridges. The top-level entry points are `hid.list()` / `hid.request(filters?)` (and parity `serial.*` / `usb.*`); each device returned carries its opaque handle and methods that round-trip via panel-RPC. The handle namespace is shared with the `hid` / `serial` / `usb` shell commands — a port from `serial request` is reachable as `(await serial.list()).find(p => p.handle === 'serial1')`. Chromium-only; unavailable in the cloud / hosted-leader float. `hid.request()` still needs a user gesture (same as the shell `hid request`).\n\nHID devices expose an `EventTarget`-shaped surface so a VIA-style **request/response in one script** doesn't race: subscribe `'inputreport'` first, then `sendReport`, await the callback. The first listener lazily subscribes the kernel-side relay; the last `removeEventListener` (or realm teardown) unsubscribes — no leaked page-side listeners.\n\n```typescript\nconst hid = require('sliccy:hid');\nhid.list(): Promise<HidDevice[]>\nhid.request(filters?: HidDeviceFilter | HidDeviceFilter[]): Promise<HidDevice>\n\n// On each HidDevice (carries `handle`, `vendorId`, `productId`, `productName`, `collections`):\ndevice.open(): Promise<void>\ndevice.close(): Promise<void>\ndevice.sendReport(reportId: number, data: ArrayBuffer | ArrayBufferView): Promise<void>\ndevice.sendFeatureReport(reportId: number, data: ArrayBuffer | ArrayBufferView): Promise<void>\ndevice.receiveFeatureReport(reportId: number): Promise<DataView>\ndevice.addEventListener('inputreport', cb): void // event: { reportId, data: DataView }\ndevice.removeEventListener('inputreport', cb): void\ndevice.addEventListener('disconnect', cb): void // registers; no backend emit yet\ndevice.onInputReport(cb): void // alias for addEventListener('inputreport', cb)\n```\n\n```javascript\n// VIA-style protocol-version round-trip as a single .jsh script.\n// Subscribe BEFORE sendReport so the reply can't beat the listener.\nconst hid = require('sliccy:hid');\nconst [device] = await hid.list();\nawait device.open();\nconst reply = new Promise((resolve, reject) => {\n const t = setTimeout(() => reject(new Error('timeout')), 1000);\n device.addEventListener('inputreport', function once(e) {\n clearTimeout(t);\n device.removeEventListener('inputreport', once);\n resolve(new Uint8Array(e.data.buffer, e.data.byteOffset, e.data.byteLength));\n });\n});\nawait device.sendReport(0, new Uint8Array([0x01]));\nconst bytes = await reply;\nconsole.log([...bytes].map((b) => b.toString(16).padStart(2, '0')).join(' '));\n```\n\n`serial.*` mirrors the shell surface (`open` / `close` / `read` / `write` / `getSignals` / `setSignals` on serial ports). **`usb.*` does not** — USB device methods carry their **WebUSB** names, not the `usb` shell command's verbs:\n\n```typescript\ndevice.open(): Promise<void>\ndevice.close(opts?: { force?: boolean }): Promise<void>\ndevice.reset(opts?: { force?: boolean }): Promise<void>\ndevice.selectConfiguration(configurationValue: number): Promise<void>\ndevice.claimInterface(interfaceNumber: number, opts?: { wait?: boolean }): Promise<void>\ndevice.releaseInterface(interfaceNumber: number): Promise<void>\ndevice.addEventListener('disconnect' | 'claim-lost', cb): void\ndevice.removeEventListener('disconnect' | 'claim-lost', cb): void\ndevice.controlTransferIn(setup, length): Promise<{ status: string; data: DataView }>\ndevice.controlTransferOut(setup, data): Promise<{ status: string; bytesWritten: number }>\ndevice.transferIn(endpointNumber: number, length: number): Promise<{ status: string; data: DataView }>\ndevice.transferOut(endpointNumber: number, data): Promise<{ status: string; bytesWritten: number }>\ndevice.clearHalt(direction: 'in' | 'out', endpointNumber: number): Promise<void>\n```\n\nSo it is `claimInterface(1)`, not `claim(1)`; `controlTransferIn(...)`, not `controlIn(...)`. Note the read results resolve `{ status, data }` where `data` is a **`DataView`** — wrap it (`new Uint8Array(d.data.buffer, d.data.byteOffset, d.data.byteLength)`) before treating it as bytes.\n\n`clearHalt` recovers a single stalled bulk/interrupt endpoint. Prefer it to\n`reset()`, which re-enumerates the whole device. Handles are shared with the\n`usb` shell command and `slicc.usb`, but interface claims are exclusive: a\nsecond `claimInterface` is refused with the current holder named (or queued\nwith `{ wait: true }`). `close()` / `reset()` refuse while another consumer\nholds a claim unless `{ force: true }`, which emits `claim-lost` then\n`disconnect` so the displaced consumer is told.\n\nEach device also carries its **configuration descriptors** as plain data, so an\ninterface can be located by class/subclass/protocol without opening the device\nand re-reading the descriptor over a control transfer:\n\n```typescript\ndevice.configurations?: Array<{\n configurationValue: number;\n configurationName?: string;\n interfaces: Array<{\n interfaceNumber: number;\n claimed: boolean;\n alternates: Array<{\n alternateSetting: number;\n interfaceClass: number;\n interfaceSubclass: number;\n interfaceProtocol: number;\n interfaceName?: string;\n endpoints: Array<{\n endpointNumber: number;\n direction: 'in' | 'out';\n type: 'bulk' | 'interrupt' | 'isochronous';\n packetSize: number;\n }>;\n }>;\n }>;\n}>\n```\n\nIt is **optional** — absent when the platform does not expose the tree — so\nbranch on it. Endpoints reported with a direction or type outside the vocabulary\nabove are omitted rather than passed through, so matching on those fields is\nsafe.\n\n`serial.*` still has no `EventTarget` shape — that transport is explicit-poll.\n\nFor ESP32 / ESP8266 work, drive `esptool` through `require('sliccy:exec')` (there is no bare `exec` global). Beyond the existing `chip_id` / `read_mac` / `erase_flash` / `write_flash` verbs, the read/inspect set is now `flash_id`, `read_reg <addr>`, `read_flash <addr> <size> <outfile>`, `erase_region <addr> <size>`, and `run`. Pass `--port <handle>` to reuse a port from `serial request` so no second picker fires:\n\n```javascript\nconst serial = require('sliccy:serial');\nconst { exec } = require('sliccy:exec');\nconst port = (await serial.list())[0] ?? (await serial.request());\nconst { stdout } = await exec(`esptool --port ${port.handle} flash_id`);\nconsole.log(stdout);\nawait exec.spawn([\n 'esptool',\n '--port',\n port.handle,\n 'read_flash',\n '0',\n '0x1000',\n `${process.env.TMPDIR ?? '/tmp'}/header.bin`,\n]);\n```\n\n## Reaching these from sprinkles & dips\n\nThe high-value capabilities here — `exec` / `exec.spawn`, `fetch`, `http.client`, `browser.*`, and the device APIs (`hid.*` / `serial.*` / `usb.*`) — are also exposed to `.shtml` **sprinkles** and **trusted dips** through the `slicc.*` bridge, which routes each call into the **same worker shell** `.jsh` scripts run in. So a sprinkle button can `await slicc.exec('…')` to reach any supplemental command or `.jsh` script, `await slicc.agent('…')` to spawn a one-shot sub-scoop, or `slicc.hid.on('inputreport', cb)` + `slicc.hid.sendReport(handle, reportId, bytes)` to drive a VIA-style keyboard from a UI panel (handles persist across button clicks). The bridge is trust-gated: VFS-sourced sprinkles and trusted dips get it; untrusted inline-chat dips never receive `exec` / `agent` / `browser` / device globals. See the sprinkles skill (`/workspace/skills/sprinkles/SKILL.md`) \"Shell, agent, and jsh globals\" section, and `docs/shell-reference.md` \"Sprinkle & Dip Bridge\" (developer-facing).\n";export{e as default};
@@ -1 +0,0 @@
1
- import{b as e}from"./kernel-worker-CrTnmx6N.js";function t(){return e(`memory-v2`)}export{t as isMemoryV2Enabled};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-bridge-client--VZ3E0yk.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/port-bridge-client-Dn8JtUyP.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/proxied-fetch-DyBveeCl.js","assets/base64-DJRlyqZu.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/mount-bridge-client-CO2HxXrT.js","assets/types-D8gIX-W-.js","assets/page-approval-service-B8t-buCi.js","assets/float-topology-YtctpJaG.js","assets/speak-DbL0fEQT.js","assets/speech-assets-bridge-CFYafE89.js","assets/transformers-env-jBVeNAIF.js","assets/wc-shell-Cj705NBI.js","assets/mime-types-D0xZwlMO.js","assets/bridge-protocol-06nbmp2X.js","assets/account-store-CJHBoL7P.js","assets/core-BMcS6rur.js","assets/compat-qQM4gjF_.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/secret-topology-DLJBhHOi.js","assets/image-markers-BFDmhPy4.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-InF4o-U9.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/claude-model-version-aqjj5mtp.js","assets/telemetry-DJyRzh6X.js","assets/same-file-identity-DuEcSmPX.js","assets/icons-BM2l-_K7.js","assets/wc-shell-WkeczD9x.css","assets/shared-mBEktoxE.js","assets/hear-CovWNOND.js","assets/permissions-surface-registry-CilCRwhh.js","assets/whisper-session-FGrrhHcr.js","assets/esptool-operations-CiccBbBW.js","assets/rom-eeWiO07Z.js","assets/mount-picker-popup--ijSfN8u.js","assets/picker-popup-sQtXmfAo.js","assets/usb-claim-broker-Dacw2Z3M.js","assets/usb-device-registry--JwKRTYp.js","assets/theme-engine-B5SkYf3E.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-Czpn1I53.js";import"./proxied-fetch-DyBveeCl.js";import{J as t,m as n}from"./account-store-CJHBoL7P.js";import{a as r,t as i}from"./api-endpoint-DGxXvrur.js";import"./main-Dxem3Ydy.js";import{n as a,r as o}from"./hid-device-registry-B2R-0rNt.js";import{a as s,i as c}from"./serial-port-registry-CCqklAEr.js";import{_ as l,a as u,c as d,d as ee,f,g as p,h as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as ce,s as le,t as ue,u as de,v as m}from"./hid-operations-C97SZtrY.js";import{a as h,i as g}from"./usb-device-registry--JwKRTYp.js";import{a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./usb-operations-v1mGAdRY.js";function N(e={}){let t=new Map;return{...z(),...B(e),...fe(),...V(e),...pe(e),...me(e),...he(e,t),...ge(),..._e(e),...ve(e),...be(e),...R(),...I(),...L(),...P(),...F(),...Oe(),...ke()}}function P(){return{"secrets-bridge":async({type:t,payload:n})=>{let{callSecretsBridge:r}=await e(async()=>{let{callSecretsBridge:e}=await import(`./secrets-bridge-client--VZ3E0yk.js`).then(e=>e.t);return{callSecretsBridge:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));return{response:await r(t,n)}}}}function F(){return{"mount-sign-and-forward":async({type:t,envelope:n})=>{let{callMountBridge:r}=await e(async()=>{let{callMountBridge:e}=await import(`./mount-bridge-client-CO2HxXrT.js`);return{callMountBridge:e}},__vite__mapDeps([10,2,3,4,5,1,6,7,8,9,11]));return{response:await r(t,n)}}}}function I(){return{"sudo-request":async({request:t,mode:n})=>{let{resolveSudoApprovalInPage:r}=await e(async()=>{let{resolveSudoApprovalInPage:e}=await import(`./page-approval-service-B8t-buCi.js`);return{resolveSudoApprovalInPage:e}},__vite__mapDeps([12,4,13,5,1,3,6,7,8,9]));return r(t,n??`resolve`)}}}function L(){return{"secret-request":async t=>{let{getSecretRequestSurface:n}=await e(async()=>{let{getSecretRequestSurface:e}=await import(`./secret-request-registry-DrOMKR1H.js`);return{getSecretRequestSurface:e}},[]),r=n();return r?r(t):{stored:!1,reason:`unavailable`}}}}function R(){return{"proxied-fetch":async({url:t,method:n,headers:r,body:i})=>{let{collectViaExtensionDelegate:a}=await e(async()=>{let{collectViaExtensionDelegate:e}=await import(`./proxied-fetch-DyBveeCl.js`).then(e=>e.i);return{collectViaExtensionDelegate:e}},__vite__mapDeps([5,1,3,6,7,8,9])),{head:o,body:s}=await a(t,{method:n,headers:r,body:i});return{head:o,body:s}}}}function z(){return{"page-info":()=>({origin:window.location.origin,href:window.location.href,title:document.title||``}),screencapture:async({mimeType:t,quality:n,mode:r,durationMs:i,audio:a})=>{let{captureDisplayMedia:o}=await e(async()=>{let{captureDisplayMedia:e}=await import(`./screencapture-media-YBE2VnLF.js`);return{captureDisplayMedia:e}},[]),s=await o(r===`video`?{mode:`video`,mimeType:t,durationMs:i??5e3,audio:!!a}:{mode:`image`,mimeType:t,quality:n});return{bytes:s.bytes.buffer.slice(s.bytes.byteOffset,s.bytes.byteOffset+s.bytes.byteLength),width:s.width,height:s.height,mimeType:s.mimeType,...s.durationMs===void 0?{}:{durationMs:s.durationMs}}},"speak-text":async({text:t,lang:n,voice:r,rate:i,pitch:a,volume:o})=>{let{speak:s}=await e(async()=>{let{speak:e}=await import(`./speak-DbL0fEQT.js`);return{speak:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await s({text:t,lang:n,voice:r,rate:i,pitch:a,volume:o}),{done:!0}},"list-voices":async()=>{let{kokoroVoicesIfReady:t}=await e(async()=>{let{kokoroVoicesIfReady:e}=await import(`./speak-DbL0fEQT.js`);return{kokoroVoicesIfReady:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40])),n=t().map(e=>({name:e.id,lang:e.lang,default:!1,onDevice:e.onDevice}));if(typeof speechSynthesis>`u`){if(n.length>0)return{voices:n};throw Error(`speechSynthesis is unavailable in this page`)}let r=speechSynthesis.getVoices();if(r.length>0)return{voices:[...n,...r.map(Q)]};let i=await new Promise(e=>{let t=()=>{speechSynthesis.removeEventListener(`voiceschanged`,t),e(speechSynthesis.getVoices())};speechSynthesis.addEventListener(`voiceschanged`,t),setTimeout(()=>{speechSynthesis.removeEventListener(`voiceschanged`,t),e(speechSynthesis.getVoices())},1e3)});return{voices:[...n,...i.map(Q)]}},"speak-status":async()=>{let{kokoroStatus:t}=await e(async()=>{let{kokoroStatus:e}=await import(`./speak-DbL0fEQT.js`);return{kokoroStatus:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"speak-warmup":async()=>{let{kokoroWarmup:t}=await e(async()=>{let{kokoroWarmup:e}=await import(`./speak-DbL0fEQT.js`);return{kokoroWarmup:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"synthesize-to-wav":async({text:t,lang:n,voice:r,rate:i})=>{let{synthesizeToWav:a}=await e(async()=>{let{synthesizeToWav:e}=await import(`./speak-DbL0fEQT.js`);return{synthesizeToWav:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40])),o=await a({text:t,...n===void 0?{}:{lang:n},...r===void 0?{}:{voice:r},...i===void 0?{}:{rate:i}});return{bytes:o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}},"play-audio":async({bytes:e,volume:t})=>{if(typeof AudioContext>`u`)throw Error(`Web Audio API is unavailable in this page`);let n=new AudioContext;try{let r=await n.decodeAudioData(e.slice(0)),i=n.createBufferSource();if(i.buffer=r,t!==void 0){let e=n.createGain();e.gain.value=Math.max(0,Math.min(1,t)),i.connect(e),e.connect(n.destination)}else i.connect(n.destination);await new Promise(e=>{i.onended=()=>e(),i.start()})}finally{try{await n.close()}catch{}}return{done:!0}},"play-chime":async({tone:e})=>{let t={success:[880,1320],error:[440,220],notify:[660,660]},[n,r]=t[e??`notify`]??t.notify;if(typeof AudioContext>`u`)throw Error(`Web Audio API is unavailable in this page`);let i=new AudioContext;try{let e=i.currentTime;for(let[t,a]of[n,r].entries()){let n=i.createOscillator();n.type=`sine`,n.frequency.value=a;let r=i.createGain();r.gain.setValueAtTime(1e-4,e+t*.18),r.gain.exponentialRampToValueAtTime(.2,e+t*.18+.02),r.gain.exponentialRampToValueAtTime(1e-4,e+t*.18+.18),n.connect(r),r.connect(i.destination),n.start(e+t*.18),n.stop(e+t*.18+.2)}await new Promise(e=>setTimeout(e,450))}finally{try{await i.close()}catch{}}return{done:!0}}}}function B(e={}){return{"clipboard-read-text":async()=>{if(!navigator.clipboard?.readText)throw Error(`clipboard API unavailable`);return{text:await navigator.clipboard.readText()}},"clipboard-write-text":async({text:e})=>{if(!navigator.clipboard?.writeText)throw Error(`clipboard API unavailable`);return await $(),await navigator.clipboard.writeText(e),{done:!0}},"clipboard-write-image":async({bytes:e,mimeType:t})=>{if(!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`clipboard image API unavailable`);let n,r=new Blob([e],{type:t});return n=t===`image/png`?r:await De(r),await $(),await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),{done:!0}},"window-open":async({url:e,target:t,features:n})=>({opened:window.open(e,t??`_blank`,n??`noopener,noreferrer`)!==null}),"oauth-popup":async({url:t})=>{let n=await e.delegateOAuthLogin?.(t);return n?.delegated?{redirectUrl:n.redirectUrl,error:n.error}:{redirectUrl:await Te(t,e.getPermissionsSurface)}},"oauth-route":async()=>({delegate:await e.shouldDelegateOAuth?.()===!0}),"capture-camera":async e=>await Ce(e),"enumerate-media-devices":async()=>{if(!navigator.mediaDevices?.enumerateDevices)throw Error(`enumerateDevices is not supported in this browser`);let e=await navigator.mediaDevices.enumerateDevices(),t=e=>({deviceId:e.deviceId,label:e.label||``,...e.groupId?{groupId:e.groupId}:{}});return{videoinputs:e.filter(e=>e.kind===`videoinput`).map(t),audioinputs:e.filter(e=>e.kind===`audioinput`).map(t)}}}}function fe(){return{"hear-capture":async t=>{let{hearCapture:n}=await e(async()=>{let{hearCapture:e}=await import(`./hear-CovWNOND.js`);return{hearCapture:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await n(t??{})},"hear-transcribe":async({bytes:t,lang:n})=>{let{hearTranscribe:r}=await e(async()=>{let{hearTranscribe:e}=await import(`./hear-CovWNOND.js`);return{hearTranscribe:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await r(t,n)},"hear-status":async()=>{let{hearStatus:t}=await e(async()=>{let{hearStatus:e}=await import(`./hear-CovWNOND.js`);return{hearStatus:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"hear-warmup":async()=>{let{hearWarmup:t}=await e(async()=>{let{hearWarmup:e}=await import(`./hear-CovWNOND.js`);return{hearWarmup:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()}}}function V(r){return{"tray-reset":async()=>{if(!r.resetTray)throw Error(`host reset: no active tray session to reset`);return await r.resetTray()},"tray-webhook-rotate":async()=>{if(!r.rotateWebhook)throw Error(`webhook rotate: no active leader tray`);return await r.rotateWebhook()},"tray-webhook-revoke":async e=>{if(!r.revokeWebhook)throw Error(`webhook delete: no active leader tray`);return await r.revokeWebhook(e.webhookId),{ok:!0}},"tray-open-preview":async e=>{if(!r.mintPreview)throw Error(`serve: no active leader tray; cannot mint preview`);return await r.mintPreview(e)},"tray-revoke-preview":async e=>{if(!r.revokePreview)throw Error(`serve: no active leader tray; cannot revoke preview`);return await r.revokePreview(e)},"tray-list-previews":async()=>{if(!r.listPreviews)throw Error(`serve: no active leader tray; cannot list previews`);return await r.listPreviews()},"tray-mint-biscotto":async e=>{if(!r.mintBiscotto)throw Error(`biscotto: no active leader tray; cannot mint a seat`);return await r.mintBiscotto(e)},"tray-revoke-biscotto":async e=>{if(!r.revokeBiscotto)throw Error(`biscotto revoke: no active leader tray; cannot revoke a seat`);return await r.revokeBiscotto(e)},"tray-list-biscotti":async()=>{if(!r.listBiscotti)throw Error(`biscotti: no active leader tray; cannot list seats`);return await r.listBiscotti()},"tray-preview-logs":async({previewToken:e})=>{if(!r.getPreviewLifecycleRecords)throw Error(`serve --logs: no active leader tray; cannot read preview logs`);return r.getPreviewLifecycleRecords(e)},"tray-preview-truncate":async({previewToken:e})=>{if(!r.truncatePreviewLifecycleRecords)throw Error(`serve --truncate: no active leader tray; cannot truncate preview logs`);return r.truncatePreviewLifecycleRecords(e)},"tray-leave":async({workerBaseUrl:e,requestId:t})=>{if(!r.leaveTray)throw Error(`host leave: tray leave is not available in this environment`);return await r.leaveTray({workerBaseUrl:e,requestId:t})},"tray-join":async({joinUrl:e,requestId:t})=>{if(!r.joinTray)throw Error(`host join: tray join is not available in this environment`);return await r.joinTray({joinUrl:e,requestId:t})},"cherry-emit":async({runtimeId:e,name:t,detail:n})=>{if(!r.emitCherrySliccEvent)throw Error(`cherry-emit: not available in this environment`);return{delivered:r.emitCherrySliccEvent(e,t,n)}},"tray-exec":async e=>{if(!r.execOnRemote)throw Error(`ssh: no active leader tray in this environment`);return await r.execOnRemote(e)},"tray-exec-signal":({execToken:e})=>(r.signalRemoteExec?.({execToken:e}),{ok:!0}),"oauth-extras-set":({providerId:e,domains:r})=>(t(e,r),{storeAfter:n()}),"silent-renew":async({providerId:t})=>{let{getRegisteredProviderConfig:n}=await e(async()=>{let{getRegisteredProviderConfig:e}=await import(`./providers-InF4o-U9.js`).then(e=>e.r);return{getRegisteredProviderConfig:e}},__vite__mapDeps([32,1,3])),r=n(t);return r?.onSilentRenew?{accessToken:await r.onSilentRenew()}:{accessToken:null}},"save-oauth-accounts":({accountsJson:e})=>(localStorage.setItem(`slicc_accounts`,e),{storedJson:localStorage.getItem(`slicc_accounts`)??e})}}function pe(e){let t=new Map,n=()=>{if(!e.sliccSidecar)throw Error(`slicc: sidecar attachments are not available in this environment`);return e.sliccSidecar},r=async(e,r)=>{let i=n(),a=new AbortController;t.set(e,a);try{return await r(i,a.signal)}finally{t.delete(e)}};return{"slicc-attach":async({joinUrl:e,name:t,connectTimeoutMs:r})=>await n().attach({joinUrl:e,name:t,connectTimeoutMs:r}),"slicc-detach":({name:e})=>({detached:n().detach(e)}),"slicc-list":()=>({attachments:n().list()}),"slicc-prompt":async({name:e,text:t,runToken:n,steer:i,timeoutMs:a})=>await r(n,async(n,r)=>await n.prompt(e,t,{steer:i,timeoutMs:a,signal:r})),"slicc-exec":async({name:e,command:t,runToken:n,cwd:i,env:a,timeoutMs:o,stdin:s})=>await r(n,async(n,r)=>await n.exec(e,t,{cwd:i,env:a,timeoutMs:o,stdin:s,signal:r})),"slicc-watch":async({name:e,runToken:t,durationMs:n,scoopJid:i,untilIdle:a})=>await r(t,async(t,r)=>await t.watch(e,{durationMs:n,scoopJid:i,untilIdle:a,signal:r})),"slicc-cancel":({runToken:e})=>(t.get(e)?.abort(),{ok:!0})}}function me(e){return xe(e.emitEvent),{"usb-list":async()=>({devices:await w(H(),G())}),"usb-request":async({filters:e})=>({device:await b(H(),G(),e)}),"usb-device-info":({handle:e})=>({device:A(H(),e)}),"usb-open":async({handle:e})=>(await M(H(),e),{done:!0}),"usb-close":async({handle:e,owner:t,force:n})=>(await C(H(),e,{owner:t,force:n}),{done:!0}),"usb-select-configuration":async({handle:e,configurationValue:t})=>(await T(H(),e,t),{done:!0}),"usb-claim-interface":async({handle:e,interfaceNumber:t,owner:n,wait:r})=>(await E(H(),e,t,{owner:n,wait:r}),{done:!0}),"usb-release-interface":async({handle:e,interfaceNumber:t,owner:n})=>(await y(H(),e,t,{owner:n}),{done:!0}),"usb-cancel-claim-wait":async({handle:e,interfaceNumber:t,owner:n})=>(await j(H(),e,t,n??`usb`),{done:!0}),"usb-drop-owner":async({owner:e})=>(await v(H(),e),{done:!0}),"usb-control-transfer-in":async({handle:e,setup:t,length:n})=>_(H(),e,t,n),"usb-control-transfer-out":async({handle:e,setup:t,bytes:n})=>D(H(),e,t,n),"usb-transfer-in":async({handle:e,endpointNumber:t,length:n})=>S(H(),e,t,n),"usb-transfer-out":async({handle:e,endpointNumber:t,bytes:n})=>x(H(),e,t,n),"usb-reset":async({handle:e,owner:t,force:n})=>(await O(H(),e,{owner:t,force:n}),{done:!0}),"usb-clear-halt":async({handle:e,direction:t,endpointNumber:n})=>(await k(H(),e,t,n),{done:!0})}}function he(e,t){return{"hid-list":async()=>({devices:await ce(K(),q())}),"hid-request":async({filters:e})=>({devices:await oe(K(),q(),e)}),"hid-device-info":({handle:e})=>({device:ae(K(),e)}),"hid-open":async({handle:e})=>(await ne(K(),e),{done:!0}),"hid-close":async({handle:e})=>(await ue(K(),e),{done:!0}),"hid-send-report":async({handle:e,reportId:t,bytes:n})=>(await d(K(),e,t,n),{done:!0}),"hid-send-feature-report":async({handle:e,reportId:t,bytes:n})=>(await le(K(),e,t,n),{done:!0}),"hid-receive-feature-report":async({handle:e,reportId:t})=>u(K(),e,t),"hid-subscribe-input-reports":async({handle:n})=>{t.get(n)?.();let r=await re(K(),n,t=>{e.emitEvent?.(`hid-input-report`,{handle:n,reportId:t.reportId,bytes:t.bytes})});return t.set(n,r),{done:!0}},"hid-unsubscribe-input-reports":({handle:e})=>(t.get(e)?.(),t.delete(e),{done:!0})}}function ge(){return{"serial-list":async()=>({devices:await se(J(),Y())}),"serial-request":async({filters:e})=>({device:await p(J(),Y(),e)}),"serial-device-info":({handle:e})=>({device:ee(J(),e)}),"serial-open":async({handle:e,options:t})=>(await ie(J(),e,t),{done:!0}),"serial-close":async({handle:e})=>(await de(J(),e),{done:!0}),"serial-read":async({handle:e,maxBytes:t,until:n,timeoutMs:r})=>{let i=await te(J(),e,{maxBytes:t,until:n?new Uint8Array(n):void 0,timeoutMs:r});return{bytes:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}},"serial-write":async({handle:e,bytes:t})=>({bytesWritten:await m(J(),e,new Uint8Array(t))}),"serial-get-signals":async({handle:e})=>({signals:await f(J(),e)}),"serial-set-signals":async({handle:e,signals:t})=>(await l(J(),e,t),{done:!0})}}function _e(t){return{"esptool-chip-info":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolChipInfo(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-read-mac":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadMac(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-erase-flash":async({handle:n,baudRate:r})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolEraseFlash(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-flash":async({handle:n,baudRate:r,eraseAll:i,segments:a})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolFlash(J(),n,r,i,a.map(e=>({address:e.address,data:new Uint8Array(e.bytes)})),e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-read-flash":async({handle:n,baudRate:r,address:i,size:a})=>{let o=await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadFlash(J(),n,r,i,a,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e}));return{bytes:o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}},"esptool-read-reg":async({handle:n,baudRate:r,address:i})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadReg(J(),n,r,i,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-flash-id":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolFlashId(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-erase-region":async({handle:n,baudRate:r,address:i,size:a})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolEraseRegion(J(),n,r,i,a,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-run":async({handle:n,baudRate:r})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolRun(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0})}}function ve(e){return{"list-remote-targets":async()=>e.listRemoteTargets?{targets:(await e.listRemoteTargets()).filter(e=>e.targetId.includes(`:`)).map(e=>({targetId:e.targetId,title:e.title,url:e.url}))}:{targets:[]},"remote-cdp-send":async({runtimeId:t,localTargetId:n,method:r,params:i,sessionId:a,timeout:o})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.send({runtimeId:t,localTargetId:n,method:r,params:i,sessionId:a,timeout:o})},"remote-cdp-subscribe":async({runtimeId:t,localTargetId:n,event:r})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.subscribe({runtimeId:t,localTargetId:n,event:r})},"remote-cdp-unsubscribe":async({runtimeId:t,localTargetId:n,event:r})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.unsubscribe({runtimeId:t,localTargetId:n,event:r})},"remote-cdp-detach":async({runtimeId:t,localTargetId:n})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.detach({runtimeId:t,localTargetId:n})},"remote-open-tab":async({runtimeId:t,url:n})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.openTab({runtimeId:t,url:n})}}}function ye(e,t){return t===void 0?e.length>0&&e.every(e=>e===`camera`||e===`microphone`):t}function be(t){return{"permission-request":async n=>{let r=t.getPermissionsSurface?.()??null;if(!r)throw Error(`permission-request: permission surface unavailable`);let i=await r.prompt({kinds:n.kinds,description:n.description,heading:n.heading,grantLabel:n.grantLabel,cancelLabel:n.cancelLabel,skipIfGranted:ye(n.kinds,n.skipIfGranted)});if(i.status!==`granted`){let e=i.message?`: ${i.message}`:``;throw Error(`permission-request: ${i.reason??i.status}${e}`)}let a=[];for(let t of i.grants)switch(t.kind){case`usb`:{let e=H().register(t.device);a.push({kind:`usb`,handle:e});break}case`hid`:{let e=K().register(t.device);a.push({kind:`hid`,handle:e});break}case`serial`:{let e=J().register(t.port);a.push({kind:`serial`,handle:e});break}case`filesystem`:{let{storePendingHandle:n}=await e(async()=>{let{storePendingHandle:e}=await import(`./mount-picker-popup--ijSfN8u.js`);return{storePendingHandle:e}},__vite__mapDeps([46,4,47,9])),r=`pendingMount:rpc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;await n(r,t.handle),a.push({kind:`filesystem`,idbKey:r,dirName:t.handle.name});break}case`camera`:case`microphone`:case`screenshare`:for(let e of t.stream.getTracks())e.stop();a.push({kind:t.kind,ok:!0})}return{grants:a}}}}function H(){return h()}var U=null,W;function xe(t){W=t,!(U||!t)&&e(()=>import(`./usb-claim-broker-Dacw2Z3M.js`).then(e=>{U||=e.addClaimListener(H(),e=>{W?.(`usb-claim-event`,e)})}),__vite__mapDeps([48,49,1]))}function G(){let e=g();if(!e)throw Error(`WebUSB is unavailable in this browser`);return e}function K(){return o()}function q(){let e=a();if(!e)throw Error(`WebHID is unavailable in this browser`);return e}function J(){return s()}function Y(){let e=c();if(!e)throw Error(`Web Serial is unavailable in this browser`);return e}var Se=1500;async function Ce(e){if(!navigator.mediaDevices?.getUserMedia)throw Error(`getUserMedia is not supported in this browser`);let t=e.mode===`photo`||e.captureVideo!==!1,n=!!e.captureAudio&&e.mode===`video`;if(!t&&!n)throw Error(`camera capture: at least one of video or audio must be requested`);let r=await we({wantVideo:t,videoDeviceId:t?await X(e.deviceId,`videoinput`):void 0,audioDeviceId:n?await X(e.audioDeviceId,`audioinput`):void 0,wantAudio:n,width:e.width,height:e.height,frameRate:e.frameRate,exact:!!e.exactSize});try{let n=null,i=0,a=0;if(t){n=document.createElement(`video`),n.srcObject=r,n.muted=!0,n.playsInline=!0;let e=n;await new Promise((t,n)=>{e.onloadedmetadata=()=>e.play().then(()=>t()).catch(n),e.onerror=()=>n(Error(`Failed to load camera stream`))}),await new Promise(e=>requestAnimationFrame(()=>e())),await new Promise(e=>requestAnimationFrame(()=>e())),i=e.videoWidth,a=e.videoHeight}if(e.mode===`photo`){if(!n)throw Error(`photo capture requires a video track`);let t=e.warmupMs??Se;t>0&&await new Promise(e=>setTimeout(e,t));let r=document.createElement(`canvas`);r.width=i,r.height=a;let o=r.getContext(`2d`);if(!o)throw Error(`Failed to get canvas context`);o.drawImage(n,0,0,i,a);let s=await new Promise((t,n)=>{r.toBlob(e=>e?t(e):n(Error(`Failed to encode photo`)),e.mimeType,e.quality)});return{bytes:await s.arrayBuffer(),mimeType:s.type||e.mimeType,width:i,height:a}}let o=Math.max(100,Math.min(e.durationMs??5e3,6e4)),s=typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported(e.mimeType)?e.mimeType:`video/webm`,c=new MediaRecorder(r,{mimeType:s}),l=[];c.ondataavailable=e=>{e.data&&e.data.size>0&&l.push(e.data)};let u=new Promise(e=>{c.onstop=()=>e()});c.start(),await new Promise(e=>setTimeout(e,o)),c.stop(),await u;let d=new Blob(l,{type:s});return{bytes:await d.arrayBuffer(),mimeType:d.type||s,width:i,height:a,durationMs:o}}finally{r.getTracks().forEach(e=>{e.stop()})}}async function X(e,t){if(e===void 0||e===``)return;if(!/^\d+$/.test(e))return e;if(!navigator.mediaDevices?.enumerateDevices)return;let n=parseInt(e,10);return(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===t)[n]?.deviceId}async function we(e){let t=t=>{if(!e.wantVideo)return!1;let n={};return e.videoDeviceId&&(n.deviceId={exact:e.videoDeviceId}),e.width&&(n.width=t===`exact`?{exact:e.width}:{ideal:e.width}),e.height&&(n.height=t===`exact`?{exact:e.height}:{ideal:e.height}),e.frameRate&&(n.frameRate=t===`exact`?{exact:e.frameRate}:{ideal:e.frameRate}),Object.keys(n).length>0?n:!0},n=()=>e.wantAudio?!e.audioDeviceId||{deviceId:{exact:e.audioDeviceId}}:!1;try{return await navigator.mediaDevices.getUserMedia({video:t(e.exact?`exact`:`ideal`),audio:n()})}catch(r){let i=r?.name;if(!e.exact||i!==`OverconstrainedError`&&i!==`NotReadableError`)throw r;return console.warn(`panel-rpc:capture-camera: exact ${e.width??`?`}x${e.height??`?`}@${e.frameRate??`?`} unmet, falling back to ideal`),await navigator.mediaDevices.getUserMedia({video:t(`ideal`),audio:n()})}}async function Te(e,t){if((typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0)return Z(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let n=t?.()??null;if(n){let t=await Ee(n,e);return t===void 0?null:Z(t)}return Z(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function Z(e){return new Promise(t=>{let n=!1,a=null,o=()=>{n||(n=!0,window.removeEventListener(`message`,s),clearTimeout(c),a&&clearInterval(a))},s=n=>{if(n.data?.type!==`oauth-callback`||n.origin!==window.location.origin||e&&n.source!==e)return;if(o(),n.data.error){console.error(`[panel-rpc:oauth-popup] OAuth error:`,n.data.error),t(null);return}let r=n.data.redirectUrl;(typeof r==`string`||r==null)&&t(r??null)};window.addEventListener(`message`,s),a=setInterval(async()=>{if(!n)try{let e=await fetch(r(`/api/oauth-result`),{headers:i()});if(e.status===204||!e.ok)return;let a=await e.json();if(n)return;if(o(),a.error){console.error(`[panel-rpc:oauth-popup] Server relay OAuth error:`,a.error),t(null);return}t(a.redirectUrl??null)}catch(e){console.warn(`[panel-rpc:oauth-popup] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3);let c=setTimeout(()=>{o();try{e?.close()}catch{}t(null)},12e4)})}async function Ee(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}function Q(e){return{name:e.name,lang:e.lang,default:e.default,onDevice:!1}}async function De(e){let t=URL.createObjectURL(e);try{let e=new Image;await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(`Failed to load image for clipboard conversion`)),e.src=t});let n=document.createElement(`canvas`);n.width=e.naturalWidth,n.height=e.naturalHeight;let r=n.getContext(`2d`);if(!r)throw Error(`Failed to get canvas context`);return r.drawImage(e,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`PNG re-encode failed`)),`image/png`)})}finally{URL.revokeObjectURL(t)}}async function $(e=3e5){typeof document>`u`||typeof document.hasFocus==`function`&&(document.hasFocus()||await new Promise((t,n)=>{let r=()=>{window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a),clearTimeout(o)},i=()=>{document.hasFocus()&&(r(),t())},a=()=>{document.visibilityState===`visible`&&document.hasFocus()&&(r(),t())},o=setTimeout(()=>{r(),n(Error(`timed out waiting for window focus`))},e);window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a)}))}function Oe(){return{"theme-apply":async({themeJson:t,action:n})=>{let{importTheme:r,saveCustomTheme:i,setActiveTheme:a,clearActiveTheme:o,applyThemeOverrides:s}=await e(async()=>{let{importTheme:e,saveCustomTheme:t,setActiveTheme:n,clearActiveTheme:r,applyThemeOverrides:i}=await import(`./theme-engine-B5SkYf3E.js`).then(e=>e.m);return{importTheme:e,saveCustomTheme:t,setActiveTheme:n,clearActiveTheme:r,applyThemeOverrides:i}},__vite__mapDeps([50,1,4]));if(n===`reset`)return o(),s(),{applied:null};if(t){let e=r(t);return i(e),a(e.id),s(),{applied:e.id}}return{applied:null}}}}function ke(){return{"layout-apply":async t=>{let{getLayoutApplier:n}=await e(async()=>{let{getLayoutApplier:e}=await import(`./layout-apply-registry-Cw730jao.js`);return{getLayoutApplier:e}},[]),r=n();return r?await r(t)??{applied:!0}:{applied:!1,error:`no layout is mounted`}}}}export{N as createStandalonePanelRpcHandlers};
@@ -1 +0,0 @@
1
- import{t as e}from"./provider-DE1pR-oR.js";export{e as readMcpAuthEntries};
@@ -1 +0,0 @@
1
- import{t as e}from"./store-BRXCCWDC.js";import"./provider-CNKZIWc1.js";export{e as readMcpAuthEntries};