sliccy 6.231.0 → 6.232.1

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 (165) hide show
  1. package/dist/ui/.vite/manifest.json +189 -189
  2. package/dist/ui/assets/{SKILL-JUdJZkmv.js → SKILL-CDWYTQKl.js} +1 -1
  3. package/dist/ui/assets/{account-store-DRTAuWKO.js → account-store-B9NAiCud.js} +1 -1
  4. package/dist/ui/assets/{account-store-BDhl4FmG.js → account-store-BjfGeTTt.js} +1 -1
  5. package/dist/ui/assets/{adobe-DoHg-2lG.js → adobe-Bz-ZNRYT.js} +1 -1
  6. package/dist/ui/assets/{adobe-ysrWj4jj.js → adobe-Djo2u4ZW.js} +1 -1
  7. package/dist/ui/assets/{agent-panels-CSvtZZfx.js → agent-panels-CP61MyvH.js} +1 -1
  8. package/dist/ui/assets/{almost-bash-shell-headless-BeHEXW-d.js → almost-bash-shell-headless-CSew1mj5.js} +27 -27
  9. package/dist/ui/assets/{apply-layout-CIdieZGs.js → apply-layout-C5tkEPIw.js} +1 -1
  10. package/dist/ui/assets/{apps-CoeSQrOQ.js → apps-Dp0TUE_0.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-H3O476sm.js → azure-openai-CzOmuJGM.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-CDdcjgHQ.js → azure-openai-JkY4uYkc.js} +1 -1
  13. package/dist/ui/assets/{backend-hostfs-CZqZIcpZ.js → backend-hostfs-DoiWbvcu.js} +1 -1
  14. package/dist/ui/assets/{cdp-CTQm78CE.js → cdp-38zgn7rv.js} +1 -1
  15. package/dist/ui/assets/{cerebras-Xmq2dYp-.js → cerebras-DTSHi-Ie.js} +1 -1
  16. package/dist/ui/assets/{cerebras-vGhLunfJ.js → cerebras-j4mzqJoZ.js} +1 -1
  17. package/dist/ui/assets/{composer-speech-DndQLjuX.js → composer-speech-BeeuLGg2.js} +1 -1
  18. package/dist/ui/assets/{connect-surface-DulRxsS5.js → connect-surface-CeR_GM7x.js} +1 -1
  19. package/dist/ui/assets/{directed-approval-nInaNDbZ.js → directed-approval-CX_HvwXp.js} +1 -1
  20. package/dist/ui/assets/{emscripten-vfs-hook-D7vG6p6H.js → emscripten-vfs-hook-BJh0QvlC.js} +1 -1
  21. package/dist/ui/assets/{emscripten-vfs-hook-DvVgkZgO.js → emscripten-vfs-hook-CD4XHFnz.js} +1 -1
  22. package/dist/ui/assets/{ensure-speech-assets-B6w01583.js → ensure-speech-assets-D_Xx-dcP.js} +1 -1
  23. package/dist/ui/assets/{frozen-archive-writer-BgYbTecB.js → frozen-archive-writer-B2hU8rG5.js} +1 -1
  24. package/dist/ui/assets/fs-B-LLf0bG.js +2 -0
  25. package/dist/ui/assets/fs-BWRHmpI5.js +1 -0
  26. package/dist/ui/assets/{gelatiere-unit-82abEqSG.js → gelatiere-unit-CSTPHfIX.js} +1 -1
  27. package/dist/ui/assets/{github-CoUESA03.js → github-9cbMQjmV.js} +2 -2
  28. package/dist/ui/assets/{github-auth-Id_A8T_v.js → github-auth-BZVZ7x8a.js} +1 -1
  29. package/dist/ui/assets/{github-copilot-Cw07_5Nx.js → github-copilot-BpQfJba9.js} +1 -1
  30. package/dist/ui/assets/{github-copilot-D1puBuQW.js → github-copilot-CoY3bmiB.js} +1 -1
  31. package/dist/ui/assets/{github-install-di1PoBfi.js → github-install-D1o7qomc.js} +1 -1
  32. package/dist/ui/assets/{github-B6URrDYP.js → github-j3XObHP4.js} +1 -1
  33. package/dist/ui/assets/{github-zip-Ctc-8bo0.js → github-zip-CF_1Mtat.js} +1 -1
  34. package/dist/ui/assets/{go-driver-BWErcamd.js → go-driver-DKvMuQ4C.js} +1 -1
  35. package/dist/ui/assets/{hear-DByBSPCL.js → hear-BDEEoiSx.js} +1 -1
  36. package/dist/ui/assets/{help-Dx9wACbd.js → help-Dmz0iRDg.js} +1 -1
  37. package/dist/ui/assets/icons-2DY2vYOc.js +1 -0
  38. package/dist/ui/assets/{installer-BDq0btpb.js → installer-vW0yDgjr.js} +1 -1
  39. package/dist/ui/assets/{ipk-mamba-kWpl-f0P.js → ipk-mamba-COgtFryU.js} +1 -1
  40. package/dist/ui/assets/{js-realm-worker-DxkK05PW.js → js-realm-worker-b9Yx9oEC.js} +2 -2
  41. package/dist/ui/assets/{jsh-executor-BWMFIKh0.js → jsh-executor-By4DIUnQ.js} +3 -3
  42. package/dist/ui/assets/{kernel-worker-BcHp1zY-.js → kernel-worker-Cvf_O6Kr.js} +10 -10
  43. package/dist/ui/assets/{lick-ws-bridge-DmWgf92l.js → lick-ws-bridge-Bn8djfxu.js} +1 -1
  44. package/dist/ui/assets/{lick-ws-bridge-TTX2-dgM.js → lick-ws-bridge-CIDrcFiD.js} +1 -1
  45. package/dist/ui/assets/{live-session-curation-BA3ZTkuL.js → live-session-curation-kO8HahKE.js} +1 -1
  46. package/dist/ui/assets/{live-session-snapshot-CBrEjsMz.js → live-session-snapshot-CabSfB3u.js} +1 -1
  47. package/dist/ui/assets/{local-llm-BH_iobqv.js → local-llm-BncDAj1R.js} +1 -1
  48. package/dist/ui/assets/{local-llm-B3raU8f6.js → local-llm-sQhI3SXN.js} +1 -1
  49. package/dist/ui/assets/{main-B1vIdnKe.js → main-DFzXj4Ap.js} +3 -3
  50. package/dist/ui/assets/{main-cherry-wlPAenOZ.js → main-cherry-DjaHu26a.js} +1 -1
  51. package/dist/ui/assets/{mcp-command-C4qUwKwm.js → mcp-command-BQXcGbwB.js} +12 -12
  52. package/dist/ui/assets/{memory-curation-seam-DIqJvu5z.js → memory-curation-seam-B_qGv6QI.js} +1 -1
  53. package/dist/ui/assets/{memory-health-wXVIjuiu.js → memory-health-Cr7zxx4A.js} +1 -1
  54. package/dist/ui/assets/{memory-write-execute-FGxJnrj8.js → memory-write-execute-U7BM-a7_.js} +1 -1
  55. package/dist/ui/assets/{merge-folded-cost-into-frozen-FU9cBahx.js → merge-folded-cost-into-frozen-DIIPiCza.js} +1 -1
  56. package/dist/ui/assets/{mount-DD_GvXyU.js → mount-CV-BVSM3.js} +1 -1
  57. package/dist/ui/assets/{mount-HS42qOxZ.js → mount-D70lNd1N.js} +3 -3
  58. package/dist/ui/assets/{new-session-BdDo7il2.js → new-session-CQAuY4KE.js} +2 -2
  59. package/dist/ui/assets/{oauth-bootstrap-D1lZwRxa.js → oauth-bootstrap-BaNDvFJl.js} +2 -2
  60. package/dist/ui/assets/{onboarding-orchestrator-CQqlpNVr.js → onboarding-orchestrator-CeGSoBBd.js} +1 -1
  61. package/dist/ui/assets/{openai-codex-CKQIAwhG.js → openai-codex-AiKZcdM6.js} +1 -1
  62. package/dist/ui/assets/{openai-codex-DsTvRXyd.js → openai-codex-D8h522X1.js} +1 -1
  63. package/dist/ui/assets/{openrouter-CpSm3-JU.js → openrouter-D4UvvWjX.js} +1 -1
  64. package/dist/ui/assets/{openrouter-free-DypgurAf.js → openrouter-free-Dpl6B5fH.js} +1 -1
  65. package/dist/ui/assets/{openrouter-free-Dsypxtc7.js → openrouter-free-Jo6JUMdn.js} +1 -1
  66. package/dist/ui/assets/{openrouter-oauth-D1VRAmyp.js → openrouter-oauth-BzcBCIMl.js} +1 -1
  67. package/dist/ui/assets/{openrouter-oauth-BETSiUD9.js → openrouter-oauth-CPpLFF4m.js} +1 -1
  68. package/dist/ui/assets/{openrouter-WcKReRM6.js → openrouter-w4y3GCPU.js} +1 -1
  69. package/dist/ui/assets/{opfs-mount-DgVoz4bA.js → opfs-mount-CEISbLdP.js} +1 -1
  70. package/dist/ui/assets/{panel-rpc-handlers-CN0aa_DM.js → panel-rpc-handlers-COj4LAbm.js} +2 -2
  71. package/dist/ui/assets/{panelize-shell-CelbmkVZ.js → panelize-shell-gHzxRw9h.js} +1 -1
  72. package/dist/ui/assets/{pi-edit-execution-BtOdWD98.js → pi-edit-execution-B-htZMe7.js} +1 -1
  73. package/dist/ui/assets/{process-worker-hDwxYbba.js → process-worker-BXcmjjns.js} +1 -1
  74. package/dist/ui/assets/{provider-Byt42beJ.js → provider-DV5A_7IM.js} +2 -2
  75. package/dist/ui/assets/{provider-DzOEVDMJ.js → provider-DqfbNx1g.js} +1 -1
  76. package/dist/ui/assets/{provider-settings-kKfcZd62.js → provider-settings--5JFkAeb.js} +1 -1
  77. package/dist/ui/assets/provider-store-access-Dtozn27m.js +1 -0
  78. package/dist/ui/assets/provider-store-access-Dzd2VXlw.js +1 -0
  79. package/dist/ui/assets/{providers-CVxmiC_d.js → providers-DRXtGsiH.js} +1 -1
  80. package/dist/ui/assets/{providers-DttKhdvc.js → providers-DdxfStbH.js} +2 -2
  81. package/dist/ui/assets/{py-live-vfs-Cn9MjKIq.js → py-live-vfs-BY0JeFky.js} +1 -1
  82. package/dist/ui/assets/{quick-llm-BD5VACPm.js → quick-llm-BC2oDrme.js} +1 -1
  83. package/dist/ui/assets/{realm-inprocess-Co6fyJIH.js → realm-inprocess-9LFGFCcK.js} +2 -2
  84. package/dist/ui/assets/{realm-sync-transport-DwPCYtlC.js → realm-sync-transport-CTz7jTgb.js} +1 -1
  85. package/dist/ui/assets/{realm-unhandled-rejections-BEbqq4bE.js → realm-unhandled-rejections-CAczZ0N0.js} +1 -1
  86. package/dist/ui/assets/{realm-unhandled-rejections-SdD0tCxO.js → realm-unhandled-rejections-aM-BvJZR.js} +1 -1
  87. package/dist/ui/assets/{recovery-screen-D-6NA_fS.js → recovery-screen-ZhIfXWHL.js} +1 -1
  88. package/dist/ui/assets/{remote-terminal-view-Bqdy5JXC.js → remote-terminal-view-BQ8uaUim.js} +2 -2
  89. package/dist/ui/assets/rename-via-fs-YCnDOxaH.js +1 -0
  90. package/dist/ui/assets/{require-guards-Rdu-Iq5i.js → require-guards-BX-XDJnh.js} +1 -1
  91. package/dist/ui/assets/{restore-Cezkzq3h.js → restore-CTCRzvNh.js} +1 -1
  92. package/dist/ui/assets/{run-CNEW3a-_.js → run-B8IAldKH.js} +1 -1
  93. package/dist/ui/assets/{run-NeJoZx1G.js → run-CVZ8dV9Z.js} +2 -2
  94. package/dist/ui/assets/{run-C0Y6RGj7.js → run-D7w8ut3l.js} +2 -2
  95. package/dist/ui/assets/{run-CRgvorhM.js → run-DemKXbNO.js} +1 -1
  96. package/dist/ui/assets/{run-B6SZhKIe.js → run-DuqDZMb3.js} +2 -2
  97. package/dist/ui/assets/{run-BPS1ftNJ.js → run-g-X3dTSo.js} +1 -1
  98. package/dist/ui/assets/{session-command-memory-DDPdqshX.js → session-command-memory-wRVMs4Tj.js} +2 -2
  99. package/dist/ui/assets/{session-jsonl-CELPCDGy.js → session-jsonl-BMe2gRCP.js} +1 -1
  100. package/dist/ui/assets/{session-jsonl-DqnVvEWF.js → session-jsonl-jHmA3Z8R.js} +1 -1
  101. package/dist/ui/assets/{session-search-index-D4QNw_5h.js → session-search-index-CPxHdFiO.js} +1 -1
  102. package/dist/ui/assets/{setup-feature-flags-remote-nr0HPF9a.js → setup-feature-flags-remote-CLK9RQld.js} +1 -1
  103. package/dist/ui/assets/{setup-model-catalog-WchqEEtY.js → setup-model-catalog-DzoZIXjc.js} +1 -1
  104. package/dist/ui/assets/{signed-fetch-b2-h4EWV.js → signed-fetch-BYlgbN5-.js} +1 -1
  105. package/dist/ui/assets/{silent-renew-backoff-CIJqsk9Q.js → silent-renew-backoff-C_5vt7WN.js} +1 -1
  106. package/dist/ui/assets/slicc-version-BQjDBKr6.js +1 -0
  107. package/dist/ui/assets/{snapshot-FmSqJRm3.js → snapshot-CRzAt7FE.js} +1 -1
  108. package/dist/ui/assets/{snapshot-features-Cx73FWo9.js → snapshot-features-Dl5OZRRD.js} +1 -1
  109. package/dist/ui/assets/{soundscape-D-rAYV9G.js → soundscape-B5wl6uNe.js} +1 -1
  110. package/dist/ui/assets/{speak-DLZJFObh.js → speak-CsDBSFSc.js} +1 -1
  111. package/dist/ui/assets/{sprinkle-manager-CuMuX-wI.js → sprinkle-manager-ByegzK4g.js} +1 -1
  112. package/dist/ui/assets/{sprinkle-renderer-6xiUQ9vH.js → sprinkle-renderer-DEvWTy4j.js} +1 -1
  113. package/dist/ui/assets/{state-D3jCjcYF.js → state-UjVstscY.js} +1 -1
  114. package/dist/ui/assets/{store-CnKXKr-6.js → store-jaaK6Occ.js} +1 -1
  115. package/dist/ui/assets/{store-GlGRqUdE.js → store-uM0i8Poo.js} +1 -1
  116. package/dist/ui/assets/{sudo-Cu8eDDJm.js → sudo-DhuLhnRd.js} +1 -1
  117. package/dist/ui/assets/{supervisor-8bRUk-JC.js → supervisor-C1NKlIKp.js} +1 -1
  118. package/dist/ui/assets/{sync-dialog-CjHqeAKu.js → sync-dialog-yG1Kj0Ua.js} +1 -1
  119. package/dist/ui/assets/{sync-exec-dispatch-BvwkIQoA.js → sync-exec-dispatch-DSTbkRmG.js} +1 -1
  120. package/dist/ui/assets/{sync-sab-responder-CvWMn8kd.js → sync-sab-responder-BmZDqqnK.js} +1 -1
  121. package/dist/ui/assets/{transformers-env-Dspqb96d.js → transformers-env-CXVElXgN.js} +1 -1
  122. package/dist/ui/assets/{tray-leader-Cqfz9_Vj.js → tray-leader-B4LxY7F_.js} +1 -1
  123. package/dist/ui/assets/{tray-leave-runtime-lRrAp4QN.js → tray-leave-runtime-CAdFVkVo.js} +1 -1
  124. package/dist/ui/assets/{tray-sidecar-5uvaJdVv.js → tray-sidecar-C8CforeJ.js} +1 -1
  125. package/dist/ui/assets/{upgrade-detection-3PSa6j1r.js → upgrade-detection-QfynQMyL.js} +1 -1
  126. package/dist/ui/assets/{upskill-lick-skip-BdsOwers.js → upskill-lick-skip-B1oh3KFo.js} +1 -1
  127. package/dist/ui/assets/{voice-reply-ecmQSaMb.js → voice-reply-2rym12dk.js} +1 -1
  128. package/dist/ui/assets/wasi-runtime-DpCCpScc.js +5 -0
  129. package/dist/ui/assets/{wc-attach-SHc2Ho4j.js → wc-attach-8DvAlvRk.js} +2 -2
  130. package/dist/ui/assets/{wc-browser-BP-dikej.js → wc-browser-Cc0wc7sK.js} +1 -1
  131. package/dist/ui/assets/{wc-computers-B3vpbiGP.js → wc-computers-D2WMYpRs.js} +1 -1
  132. package/dist/ui/assets/{wc-detached-Ca5YKqdD.js → wc-detached-BYrJv1Pi.js} +1 -1
  133. package/dist/ui/assets/{wc-extension-D0yVWsCM.js → wc-extension-bGGA59Lc.js} +2 -2
  134. package/dist/ui/assets/{wc-follower-jb8wxTGY.js → wc-follower-BEFn4tDO.js} +3 -3
  135. package/dist/ui/assets/{wc-follower-oauth-DDo7-Kvo.js → wc-follower-oauth-BITU1r1m.js} +1 -1
  136. package/dist/ui/assets/{wc-gelatiere-BIH57y3B.js → wc-gelatiere-DpUliuo8.js} +1 -1
  137. package/dist/ui/assets/{wc-live-t3r1qyvP.js → wc-live-B3xfspeg.js} +5 -5
  138. package/dist/ui/assets/{wc-nav-DTTuD_dS.js → wc-nav-BvM4z5jU.js} +2 -2
  139. package/dist/ui/assets/{wc-onboarding-BwkySH1j.js → wc-onboarding-Cj-8agbG.js} +2 -2
  140. package/dist/ui/assets/{wc-permissions-DE_5Ourr.js → wc-permissions-DC3jkato.js} +2 -2
  141. package/dist/ui/assets/{wc-placeholder-CXiPwCuH.js → wc-placeholder-DLtjzvI2.js} +3 -3
  142. package/dist/ui/assets/{wc-secret-request-Yopi8ypF.js → wc-secret-request-mkhCBMcE.js} +1 -1
  143. package/dist/ui/assets/{wc-settings-BdPwWLFu.js → wc-settings-MSj3TwSP.js} +3 -3
  144. package/dist/ui/assets/{wc-shell-CwRtZNl5.js → wc-shell-CjZMoCV4.js} +3 -3
  145. package/dist/ui/assets/{wc-shortcut-config-RnVikRk4.js → wc-shortcut-config-D8qtJaB9.js} +1 -1
  146. package/dist/ui/assets/{wc-sprinkles-DepR8-YI.js → wc-sprinkles-CWh_QyqB.js} +2 -2
  147. package/dist/ui/assets/{wc-transcript-export-O5Z_GsRv.js → wc-transcript-export-C4au4GRp.js} +2 -2
  148. package/dist/ui/assets/{wc-tray-bDfDsRDI.js → wc-tray-Crx_RosL.js} +4 -4
  149. package/dist/ui/assets/welcome-detection-H8o_tuf3.js +1 -0
  150. package/dist/ui/assets/{whisper-session-DgwYNQ3h.js → whisper-session-DVySo8di.js} +2 -2
  151. package/dist/ui/assets/{xai-grok-D5pl-VNi.js → xai-grok-BK3Rrluc.js} +1 -1
  152. package/dist/ui/assets/{xai-grok-C6On1cTt.js → xai-grok-Dw3U-q7x.js} +1 -1
  153. package/dist/ui/index.html +3 -3
  154. package/dist/ui/lucide-icons.js +272 -266
  155. package/dist/ui/packages/webapp/index.html +3 -3
  156. package/package.json +1 -1
  157. package/dist/ui/assets/fs-CUHs2PgD.js +0 -1
  158. package/dist/ui/assets/fs-DvX9ooxQ.js +0 -2
  159. package/dist/ui/assets/icons-dEBJiC8z.js +0 -1
  160. package/dist/ui/assets/provider-store-access-Bjg-2oyZ.js +0 -1
  161. package/dist/ui/assets/provider-store-access-DQ96fWR0.js +0 -1
  162. package/dist/ui/assets/rename-via-fs-ckVY1Ljv.js +0 -1
  163. package/dist/ui/assets/slicc-version-DfYKiyo1.js +0 -1
  164. package/dist/ui/assets/wasi-runtime-CAPHvQ3Q.js +0 -3
  165. package/dist/ui/assets/welcome-detection-BIJAPrR-.js +0 -1
@@ -1 +1 @@
1
- import{_ as e,n as t,r as n}from"./account-store-BDhl4FmG.js";import"./proxied-fetch-CoZ8jHud.js";import{o as r}from"./api-endpoint-D8lUKmPu.js";import{n as i}from"./tray-storage-keys-DbThbnIh.js";import{t as a}from"./tray-runtime-config-ConrTcOf.js";import{t as o}from"./global-db-DJXlpNui.js";import{r as s,t as c}from"./silent-renew-backoff-Dmz3DJHb.js";import{getOAuthPageOrigin as l,resolveOAuthDelegation as u}from"./oauth-service-Bx_Dy3GC.js";import"./provider-settings-kKfcZd62.js";import{n as d,r as f,t as p}from"./bridge-token-required-BYgoMwr7.js";var m={clientId:``,scopes:`repo,read:user,user:email`};function h(){try{let e=localStorage.getItem(i);if(e)return e.replace(/\/$/,``)}catch{}return a}function g(e){return{access_token:e.access_token,token_type:e.token_type,scope:e.scope,refresh_token:e.refresh_token,expires_in:e.expires_in}}async function _(e){let t;try{t=await e.json()}catch{throw Error(`Token exchange failed (HTTP ${e.status}): non-JSON response`)}if(!e.ok&&e.status!==200){let n=t.error_description??t.error??`Token exchange failed (HTTP ${e.status})`;throw Error(n)}if(t.error){let e=t.error_description??t.error;throw Error(e)}return g(t)}async function v(e){let t=`${h()}/oauth/token`;return _(await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,code:e.code,redirect_uri:e.redirectUri})}))}async function y(e){if(d())throw new p;let t=`${h()}/oauth/token`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,refresh_token:e.refreshToken})});if(n.status===403&&typeof n.clone==`function`){let e=await n.clone().text();if(f(n.status,e))throw new p}return _(n)}async function b(e){let t=`${h()}/oauth/revoke`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,access_token:e.accessToken})});if(!(n.status===204||n.ok)){if(n.status===400)try{if((await n.json()).error===`unsupported`)return}catch{}throw Error(`Token revocation failed (HTTP ${n.status})`)}}const x=Object.assign({"/packages/webapp/providers/github-config.json":m})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`};let S=null,C=null;function w(e){let{isExtension:t,isConnectMode:n,workerBaseUrl:r,pageOrigin:i,pageHref:a,bridgeApiBaseUrl:o,extensionId:c,nonce:l}=e;if(t)return{redirectUri:`${r}/auth/callback`,state:{source:`extension`,extensionId:c,path:`/github`,nonce:l}};if(e.delegated)return{redirectUri:`${e.runtimeWorkerBaseUrl??r}/auth/callback`,state:{source:`opener`,path:`/auth/callback`,nonce:l}};if(n){let e=i??``;if(/^https?:\/\/(localhost|127\.0\.0\.1):\d+$/.test(e)){let t=parseInt(new URL(a??e).port||`8790`,10);return{redirectUri:`${r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:l}}}return{redirectUri:`${r}/auth/callback`,state:{source:`remote`,origin:e,path:`/auth/callback`,nonce:l}}}if(o&&a&&s(a)){let t=null;try{let e=new URL(o);(e.hostname===`localhost`||e.hostname===`127.0.0.1`)&&(t=parseInt(e.port||`5710`,10))}catch{t=null}if(t!==null&&!Number.isNaN(t))return{redirectUri:`${e.runtimeWorkerBaseUrl??r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:l}}}return{redirectUri:`${e.runtimeWorkerBaseUrl??i??``}/auth/callback`,state:{port:parseInt(new URL(a??i??`http://localhost:5710`).port||`5710`,10),path:`/auth/callback`,nonce:l}}}async function T(){if(S)return S;if(E){try{let e=await fetch(`${h()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,S}}catch{}return x.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,t.trayWorkerBaseUrl&&(C=t.trayWorkerBaseUrl),S;if(t.trayWorkerBaseUrl){C=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,S}}}}catch{}return x.clientId}const E=typeof globalThis<`u`&&typeof globalThis.chrome?.runtime?.id==`string`;function D(){return n().find(e=>e.providerId===`github`)}function O(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function k(e){try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();return{name:e.name||e.login,avatar:e.avatar_url,login:e.login,id:e.id}}}catch(e){console.warn(`[github] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function A(e,t){return`${e}+${t}@users.noreply.github.com`}async function j(e){try{let{VirtualFS:t}=await import(`./fs-CUHs2PgD.js`).then(e=>e.t);await(await t.create({dbName:o})).writeFile(`/workspace/.git/github-token`,e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch(e){console.warn(`[github] Failed to write git token:`,e instanceof Error?e.message:String(e))}}async function M(){try{let{VirtualFS:e}=await import(`./fs-CUHs2PgD.js`).then(e=>e.t);await(await e.create({dbName:o})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function N(e){let n=await t(`github`);if(n.maskedValue){await j(n.maskedValue);return}e?.clearOnFailure&&await M()}async function P(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await import(`./fs-CUHs2PgD.js`).then(e=>e.t),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await import(`./git-config-Bdgu8kD2.js`).then(e=>e.n),i=await t.create({dbName:o}),a=e.name||e.login,s=A(e.id,e.login);!await n(i,`user.name`)&&a&&await r(i,`user.name`,a),await n(i,`user.email`)||await r(i,`user.email`,s)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}const F=c();async function I(){try{let t=D();if(!t?.refreshToken)return null;let n=await y({provider:`github`,refreshToken:t.refreshToken});return await e({providerId:`github`,accessToken:n.access_token,refreshToken:n.refresh_token,tokenExpiresAt:n.expires_in?Date.now()+n.expires_in*1e3:void 0,userName:t.userName,userAvatar:t.userAvatar,scopes:n.scope??t.scopes}),await N({clearOnFailure:!0}),n.access_token}catch(e){return console.warn(`[github] Silent renewal failed:`,e instanceof Error?e.message:String(e)),null}}async function L(){let e=D()?.accessToken;if(!e)return{status:`unknown`,detail:`no stored token`};try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`},signal:AbortSignal.timeout(1e4)});if(t.ok){let e=await t.json().catch(()=>({}));return{status:`accepted`,userName:e.name||e.login}}return R(t)}catch(e){return{status:`unknown`,detail:e instanceof Error?e.message:String(e)}}}function R(e){let t=`HTTP ${e.status}${e.statusText?` ${e.statusText}`:``}`;return e.status===401?{status:`rejected`,detail:t}:e.status===403&&z(e)?{status:`unknown`,detail:`${t} (rate limited)`}:{status:`unknown`,detail:t}}function z(e){return e.headers.get(`x-ratelimit-remaining`)===`0`||e.headers.has(`retry-after`)}async function B(){await N()}async function V(){let e=D();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);if((e.tokenExpiresAt??1/0)-Date.now()>6e4)return await B(),e.accessToken;let t=await F.run(()=>I());if(t)return t;let n=D();if((n?.tokenExpiresAt??1/0)-Date.now()>0&&n?.accessToken)return await B(),n.accessToken;throw Error(`GitHub session expired — please log in again`)}const H={id:`github`,name:`GitHub`,description:"Sign in with GitHub for git authentication (push/pull/clone) and the `oauth-token github` shell command. Does not expose LLM models — use the GitHub Copilot provider for those.",requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`],getModelIds:()=>[],onOAuthLogin:async(t,n,i)=>{let a=await T();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let o=i?.scopes??x.scopes,s=E?null:await l(),c=!E&&await u(),d=crypto.randomUUID(),f=E?chrome.runtime.id:``,{redirectUri:p,state:m}=w({isExtension:E,isConnectMode:!!globalThis.__slicc_connect_mode,workerBaseUrl:h(),runtimeWorkerBaseUrl:C,pageOrigin:s?.origin??null,pageHref:s?.href??null,bridgeApiBaseUrl:r(),delegated:c,extensionId:f,nonce:d}),g=btoa(JSON.stringify(m)),_=d,y=new URLSearchParams({client_id:a,scope:o,redirect_uri:p});g&&y.set(`state`,g);let b=await t(`https://github.com/login/oauth/authorize?${y}`);if(!b)return;if(_)try{if(new URL(b).searchParams.get(`nonce`)!==_){console.error(`[github] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[github] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let S=O(b);if(!S){console.error(`[github] Could not extract authorization code from redirect URL`);return}let D=await v({provider:`github`,code:S,redirectUri:p}),A=await k(D.access_token);await e({providerId:`github`,accessToken:D.access_token,refreshToken:D.refresh_token,tokenExpiresAt:D.expires_in?Date.now()+D.expires_in*1e3:void 0,userName:A.name,userAvatar:A.avatar,scopes:D.scope}),await N({clearOnFailure:!0}),await P(A),n()},onSilentRenew:I,onValidateToken:L,getValidAccessToken:V,onOAuthLogout:async()=>{let t=D();t?.accessToken&&await b({provider:`github`,accessToken:t.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await M(),await e({providerId:`github`,accessToken:``})},getOAuthLogoutUrl:e=>`https://github.com/logout`};export{A as buildNoreplyEmail,H as config,O as extractCodeFromUrl,V as getValidAccessToken,w as resolveGithubOAuthRedirect,P as syncGitIdentityFromGitHub};
1
+ import{_ as e,n as t,r as n}from"./account-store-BjfGeTTt.js";import"./proxied-fetch-CoZ8jHud.js";import{o as r}from"./api-endpoint-D8lUKmPu.js";import{n as i}from"./tray-storage-keys-DbThbnIh.js";import{t as a}from"./tray-runtime-config-ConrTcOf.js";import{t as o}from"./global-db-DJXlpNui.js";import{r as s,t as c}from"./silent-renew-backoff-Dmz3DJHb.js";import{getOAuthPageOrigin as l,resolveOAuthDelegation as u}from"./oauth-service-Bx_Dy3GC.js";import"./provider-settings--5JFkAeb.js";import{n as d,r as f,t as p}from"./bridge-token-required-BYgoMwr7.js";var m={clientId:``,scopes:`repo,read:user,user:email`};function h(){try{let e=localStorage.getItem(i);if(e)return e.replace(/\/$/,``)}catch{}return a}function g(e){return{access_token:e.access_token,token_type:e.token_type,scope:e.scope,refresh_token:e.refresh_token,expires_in:e.expires_in}}async function _(e){let t;try{t=await e.json()}catch{throw Error(`Token exchange failed (HTTP ${e.status}): non-JSON response`)}if(!e.ok&&e.status!==200){let n=t.error_description??t.error??`Token exchange failed (HTTP ${e.status})`;throw Error(n)}if(t.error){let e=t.error_description??t.error;throw Error(e)}return g(t)}async function v(e){let t=`${h()}/oauth/token`;return _(await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,code:e.code,redirect_uri:e.redirectUri})}))}async function y(e){if(d())throw new p;let t=`${h()}/oauth/token`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,refresh_token:e.refreshToken})});if(n.status===403&&typeof n.clone==`function`){let e=await n.clone().text();if(f(n.status,e))throw new p}return _(n)}async function b(e){let t=`${h()}/oauth/revoke`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e.provider,access_token:e.accessToken})});if(!(n.status===204||n.ok)){if(n.status===400)try{if((await n.json()).error===`unsupported`)return}catch{}throw Error(`Token revocation failed (HTTP ${n.status})`)}}const x=Object.assign({"/packages/webapp/providers/github-config.json":m})[`/packages/webapp/providers/github-config.json`]??{clientId:``,scopes:`repo,read:user,user:email`};let S=null,C=null;function w(e){let{isExtension:t,isConnectMode:n,workerBaseUrl:r,pageOrigin:i,pageHref:a,bridgeApiBaseUrl:o,extensionId:c,nonce:l}=e;if(t)return{redirectUri:`${r}/auth/callback`,state:{source:`extension`,extensionId:c,path:`/github`,nonce:l}};if(e.delegated)return{redirectUri:`${e.runtimeWorkerBaseUrl??r}/auth/callback`,state:{source:`opener`,path:`/auth/callback`,nonce:l}};if(n){let e=i??``;if(/^https?:\/\/(localhost|127\.0\.0\.1):\d+$/.test(e)){let t=parseInt(new URL(a??e).port||`8790`,10);return{redirectUri:`${r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:l}}}return{redirectUri:`${r}/auth/callback`,state:{source:`remote`,origin:e,path:`/auth/callback`,nonce:l}}}if(o&&a&&s(a)){let t=null;try{let e=new URL(o);(e.hostname===`localhost`||e.hostname===`127.0.0.1`)&&(t=parseInt(e.port||`5710`,10))}catch{t=null}if(t!==null&&!Number.isNaN(t))return{redirectUri:`${e.runtimeWorkerBaseUrl??r}/auth/callback`,state:{source:`local`,port:t,path:`/auth/callback`,nonce:l}}}return{redirectUri:`${e.runtimeWorkerBaseUrl??i??``}/auth/callback`,state:{port:parseInt(new URL(a??i??`http://localhost:5710`).port||`5710`,10),path:`/auth/callback`,nonce:l}}}async function T(){if(S)return S;if(E){try{let e=await fetch(`${h()}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,S}}catch{}return x.clientId}try{let e=await fetch(`/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,t.trayWorkerBaseUrl&&(C=t.trayWorkerBaseUrl),S;if(t.trayWorkerBaseUrl){C=t.trayWorkerBaseUrl;let e=await fetch(`${t.trayWorkerBaseUrl}/api/runtime-config`);if(e.ok){let t=await e.json();if(t.oauth?.github)return S=t.oauth.github,S}}}}catch{}return x.clientId}const E=typeof globalThis<`u`&&typeof globalThis.chrome?.runtime?.id==`string`;function D(){return n().find(e=>e.providerId===`github`)}function O(e){try{return new URL(e).searchParams.get(`code`)}catch{return null}}async function k(e){try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`}});if(t.ok){let e=await t.json();return{name:e.name||e.login,avatar:e.avatar_url,login:e.login,id:e.id}}}catch(e){console.warn(`[github] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function A(e,t){return`${e}+${t}@users.noreply.github.com`}async function j(e){try{let{VirtualFS:t}=await import(`./fs-BWRHmpI5.js`).then(e=>e.t);await(await t.create({dbName:o})).writeFile(`/workspace/.git/github-token`,e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch(e){console.warn(`[github] Failed to write git token:`,e instanceof Error?e.message:String(e))}}async function M(){try{let{VirtualFS:e}=await import(`./fs-BWRHmpI5.js`).then(e=>e.t);await(await e.create({dbName:o})).rm(`/workspace/.git/github-token`),typeof window<`u`&&window.dispatchEvent(new CustomEvent(`github-token-changed`))}catch{}}async function N(e){let n=await t(`github`);if(n.maskedValue){await j(n.maskedValue);return}e?.clearOnFailure&&await M()}async function P(e){if(!(!e.login||e.id===void 0))try{let{VirtualFS:t}=await import(`./fs-BWRHmpI5.js`).then(e=>e.t),{readGlobalGitConfigValue:n,writeGlobalGitConfigValue:r}=await import(`./git-config-Bdgu8kD2.js`).then(e=>e.n),i=await t.create({dbName:o}),a=e.name||e.login,s=A(e.id,e.login);!await n(i,`user.name`)&&a&&await r(i,`user.name`,a),await n(i,`user.email`)||await r(i,`user.email`,s)}catch(e){console.warn(`[github] Failed to seed git identity:`,e instanceof Error?e.message:String(e))}}const F=c();async function I(){try{let t=D();if(!t?.refreshToken)return null;let n=await y({provider:`github`,refreshToken:t.refreshToken});return await e({providerId:`github`,accessToken:n.access_token,refreshToken:n.refresh_token,tokenExpiresAt:n.expires_in?Date.now()+n.expires_in*1e3:void 0,userName:t.userName,userAvatar:t.userAvatar,scopes:n.scope??t.scopes}),await N({clearOnFailure:!0}),n.access_token}catch(e){return console.warn(`[github] Silent renewal failed:`,e instanceof Error?e.message:String(e)),null}}async function L(){let e=D()?.accessToken;if(!e)return{status:`unknown`,detail:`no stored token`};try{let t=await fetch(`https://api.github.com/user`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/vnd.github+json`},signal:AbortSignal.timeout(1e4)});if(t.ok){let e=await t.json().catch(()=>({}));return{status:`accepted`,userName:e.name||e.login}}return R(t)}catch(e){return{status:`unknown`,detail:e instanceof Error?e.message:String(e)}}}function R(e){let t=`HTTP ${e.status}${e.statusText?` ${e.statusText}`:``}`;return e.status===401?{status:`rejected`,detail:t}:e.status===403&&z(e)?{status:`unknown`,detail:`${t} (rate limited)`}:{status:`unknown`,detail:t}}function z(e){return e.headers.get(`x-ratelimit-remaining`)===`0`||e.headers.has(`retry-after`)}async function B(){await N()}async function V(){let e=D();if(!e?.accessToken)throw Error(`Not logged in to GitHub — please log in first`);if((e.tokenExpiresAt??1/0)-Date.now()>6e4)return await B(),e.accessToken;let t=await F.run(()=>I());if(t)return t;let n=D();if((n?.tokenExpiresAt??1/0)-Date.now()>0&&n?.accessToken)return await B(),n.accessToken;throw Error(`GitHub session expired — please log in again`)}const H={id:`github`,name:`GitHub`,description:"Sign in with GitHub for git authentication (push/pull/clone) and the `oauth-token github` shell command. Does not expose LLM models — use the GitHub Copilot provider for those.",requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:[`github.com`,`*.github.com`,`api.github.com`,`raw.githubusercontent.com`],getModelIds:()=>[],onOAuthLogin:async(t,n,i)=>{let a=await T();if(!a)throw Error(`GitHub OAuth not configured — no client ID available`);let o=i?.scopes??x.scopes,s=E?null:await l(),c=!E&&await u(),d=crypto.randomUUID(),f=E?chrome.runtime.id:``,{redirectUri:p,state:m}=w({isExtension:E,isConnectMode:!!globalThis.__slicc_connect_mode,workerBaseUrl:h(),runtimeWorkerBaseUrl:C,pageOrigin:s?.origin??null,pageHref:s?.href??null,bridgeApiBaseUrl:r(),delegated:c,extensionId:f,nonce:d}),g=btoa(JSON.stringify(m)),_=d,y=new URLSearchParams({client_id:a,scope:o,redirect_uri:p});g&&y.set(`state`,g);let b=await t(`https://github.com/login/oauth/authorize?${y}`);if(!b)return;if(_)try{if(new URL(b).searchParams.get(`nonce`)!==_){console.error(`[github] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[github] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let S=O(b);if(!S){console.error(`[github] Could not extract authorization code from redirect URL`);return}let D=await v({provider:`github`,code:S,redirectUri:p}),A=await k(D.access_token);await e({providerId:`github`,accessToken:D.access_token,refreshToken:D.refresh_token,tokenExpiresAt:D.expires_in?Date.now()+D.expires_in*1e3:void 0,userName:A.name,userAvatar:A.avatar,scopes:D.scope}),await N({clearOnFailure:!0}),await P(A),n()},onSilentRenew:I,onValidateToken:L,getValidAccessToken:V,onOAuthLogout:async()=>{let t=D();t?.accessToken&&await b({provider:`github`,accessToken:t.accessToken}).catch(e=>console.warn(`[github] Token revocation failed:`,e instanceof Error?e.message:String(e))),await M(),await e({providerId:`github`,accessToken:``})},getOAuthLogoutUrl:e=>`https://github.com/logout`};export{A as buildNoreplyEmail,H as config,O as extractCodeFromUrl,V as getValidAccessToken,w as resolveGithubOAuthRedirect,P as syncGitIdentityFromGitHub};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{i as n,n as r,r as i}from"./fetch-body-CuwTaJC_.js";import{i as a}from"./browser-DuyhpHbR.js";import{i as o,n as s}from"./github-auth-Id_A8T_v.js";function c(e){return e.split(`/`).some(e=>e.startsWith(`.`))}async function l(e,t,n){return!c(n)||!await e.exists(`${t}/${n}`)}async function u(e,t,n,r=``){let i;try{i=await e.readDir(t)}catch{return!1}let a=!1;for(let o of i){let i=`${t}/${o.name}`,s=r?`${r}/${o.name}`:o.name;if(o.name.startsWith(`.`)){a=!0;continue}o.type===`directory`?await u(e,i,n,s)?a=!0:await e.rm(i,{recursive:!0}):n&&!n.has(s)?a=!0:await e.rm(i)}return a}async function d(e,t,n=!1,r=``){let i;try{i=await e.readDir(t)}catch{return[]}let a=[];for(let o of i){if(!n&&o.name.startsWith(`.`))continue;let i=r?`${r}/${o.name}`:o.name;o.type===`directory`?a.push(...await d(e,`${t}/${o.name}`,n,i)):a.push(i)}return a.sort()}function f(e){return!e||e.startsWith(`/`)||e.includes(`\0`)||e.includes(`\\`)||/^[A-Za-z]:/.test(e)?!1:!e.split(`/`).some(e=>e===``||e===`.`||e===`..`)}function p(e){let t=r(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function m(e,t,n){let r=p(e.body),i=r?` GitHub said: ${r}`:``,a=s(e.headers,`retry-after`),o=s(e.headers,`x-ratelimit-remaining`),c=r?.toLowerCase()??``;if(e.status===429||o===`0`||c.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let l=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${l}).${i}`}var h=e({downloadGitHubDir:()=>b,fetchGitHubDirFiles:()=>y,fetchRepoZip:()=>g,stripZipPrefix:()=>_,writeZipFilesToDir:()=>v});async function g(e,n,r,s=`main`){let c=`https://codeload.github.com/${e}/${n}/zip/refs/heads/${s}`,l;try{l=await r(c,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:o(e,c)}}if(l.status===404)return s===`main`?g(e,n,r,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(l.status!==200)return{status:`error`,message:`codeload returned HTTP ${l.status}`};let u=t(c);u||=i(l.body);try{return{status:`ok`,files:a(u)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function _(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function v(e,t,n,r,i=!0){let a=[];for(let[o,s]of Object.entries(e)){if(!o.startsWith(t))continue;let e=o.slice(t.length);if(o.endsWith(`/`)||!f(e)||i&&!await l(r,n,e))continue;let c=`${n}/${e}`,u=c.substring(0,c.lastIndexOf(`/`));u!==n&&await r.mkdir(u,{recursive:!0}),await r.writeFile(c,s),a.push(e)}return a.sort()}async function y(e,r,a,o,s,c=new Map,l=``){let u=`https://api.github.com/repos/${e}/${r}/contents/${a}`,d=o?`${u}?ref=${encodeURIComponent(o)}`:u,p=await s.request(d);if(p.status!==200)throw Error(m(p,`${e}/${r}${a?`/${a}`:``}`,s.hasToken));for(let a of n(p.body)){let n=l?`${l}/${a.name}`:a.name;if(f(n)){if(a.type===`file`&&a.download_url){let o=await s.request(a.download_url,`*/*`);if(o.status!==200)throw Error(m(o,`${e}/${r}/${a.path}`,s.hasToken));let l=t(a.download_url);c.set(n,l??i(o.body))}else a.type===`dir`&&await y(e,r,a.path,o,s,c,n)}}return c}async function b(e,r,i,a,o,s,l,u=[],d=``){for(let p of e){let e=d?`${d}/${p.name}`:p.name;if(f(e)){if(p.type===`file`&&p.download_url){if(c(e)&&await s.exists(`${r}/${p.name}`))continue;let n=await l.request(p.download_url,`*/*`);if(n.status!==200)throw Error(m(n,`${i}/${a}/${p.path}`,l.hasToken));let o=t(p.download_url);await s.writeFile(`${r}/${p.name}`,o??n.body),u.push(e)}else if(p.type===`dir`){let t=`https://api.github.com/repos/${i}/${a}/contents/${p.path}`,c=o?`${t}?ref=${encodeURIComponent(o)}`:t,d=await l.request(c);if(d.status!==200)throw Error(m(d,`${i}/${a}/${p.path}`,l.hasToken));let f=n(d.body);await s.mkdir(`${r}/${p.name}`,{recursive:!0}),await b(f,`${r}/${p.name}`,i,a,o,s,l,u,e)}}}return u.sort()}export{_ as a,f as c,c as d,d as f,h as i,l,y as n,v as o,g as r,m as s,b as t,u};
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t}from"./binary-cache-bSOhqXB1.js";import{i as n,n as r,r as i}from"./fetch-body-CuwTaJC_.js";import{i as a}from"./browser-DuyhpHbR.js";import{i as o,n as s}from"./github-auth-BZVZ7x8a.js";function c(e){return e.split(`/`).some(e=>e.startsWith(`.`))}async function l(e,t,n){return!c(n)||!await e.exists(`${t}/${n}`)}async function u(e,t,n,r=``){let i;try{i=await e.readDir(t)}catch{return!1}let a=!1;for(let o of i){let i=`${t}/${o.name}`,s=r?`${r}/${o.name}`:o.name;if(o.name.startsWith(`.`)){a=!0;continue}o.type===`directory`?await u(e,i,n,s)?a=!0:await e.rm(i,{recursive:!0}):n&&!n.has(s)?a=!0:await e.rm(i)}return a}async function d(e,t,n=!1,r=``){let i;try{i=await e.readDir(t)}catch{return[]}let a=[];for(let o of i){if(!n&&o.name.startsWith(`.`))continue;let i=r?`${r}/${o.name}`:o.name;o.type===`directory`?a.push(...await d(e,`${t}/${o.name}`,n,i)):a.push(i)}return a.sort()}function f(e){return!e||e.startsWith(`/`)||e.includes(`\0`)||e.includes(`\\`)||/^[A-Za-z]:/.test(e)?!1:!e.split(`/`).some(e=>e===``||e===`.`||e===`..`)}function p(e){let t=r(e);if(!t)return;try{let e=JSON.parse(t);if(typeof e.message==`string`&&e.message.trim())return e.message.trim()}catch{}let n=t.trim();if(n)return n.slice(0,200)}function m(e,t,n){let r=p(e.body),i=r?` GitHub said: ${r}`:``,a=s(e.headers,`retry-after`),o=s(e.headers,`x-ratelimit-remaining`),c=r?.toLowerCase()??``;if(e.status===429||o===`0`||c.includes(`rate limit`))return n?`GitHub rate-limited access to ${t} (HTTP ${e.status}). The configured github.token was used, so retry later${a?` after about ${a} seconds`:``}.${i}`:`GitHub rate-limited anonymous access to ${t} (HTTP ${e.status}). This often happens on shared VPNs or corporate egress IPs because unauthenticated GitHub API requests are limited per IP. Configure a token with: git config github.token <PAT>, then retry. You can also retry off VPN or later.${i}`;if(e.status===401)return n?`GitHub rejected the configured github.token while accessing ${t} (HTTP 401). Update it with: git config github.token <PAT>, then retry.${i}`:`GitHub requires authentication to access ${t} (HTTP 401). Configure a token with: git config github.token <PAT>, then retry.${i}`;if(e.status===404)return`GitHub could not find ${t} (HTTP 404). Check the repository, path, and permissions.${i}`;if(e.status===403)return n?`GitHub denied access to ${t} (HTTP 403). Check that your github.token can access this repository or retry later if GitHub is throttling requests.${i}`:`GitHub denied anonymous access to ${t} (HTTP 403). If this repo is public on a shared VPN, you may have hit GitHub's shared IP limit; otherwise the repository or path may require authentication. Configure a token with: git config github.token <PAT>, then retry.${i}`;let l=e.statusText?` ${e.statusText}`:``;return`GitHub request for ${t} failed (HTTP ${e.status}${l}).${i}`}var h=e({downloadGitHubDir:()=>b,fetchGitHubDirFiles:()=>y,fetchRepoZip:()=>g,stripZipPrefix:()=>_,writeZipFilesToDir:()=>v});async function g(e,n,r,s=`main`){let c=`https://codeload.github.com/${e}/${n}/zip/refs/heads/${s}`,l;try{l=await r(c,{headers:{"User-Agent":`slicc-upskill`}})}catch(e){return{status:`error`,message:o(e,c)}}if(l.status===404)return s===`main`?g(e,n,r,`master`):{status:`error`,message:`codeload returned HTTP 404`};if(l.status!==200)return{status:`error`,message:`codeload returned HTTP ${l.status}`};let u=t(c);u||=i(l.body);try{return{status:`ok`,files:a(u)}}catch(e){return{status:`error`,message:`failed to unzip: ${e instanceof Error?e.message:String(e)}`}}}function _(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.indexOf(`/`);if(e<0)continue;let i=n.slice(e+1);i&&(t[i]=r)}return t}async function v(e,t,n,r,i=!0){let a=[];for(let[o,s]of Object.entries(e)){if(!o.startsWith(t))continue;let e=o.slice(t.length);if(o.endsWith(`/`)||!f(e)||i&&!await l(r,n,e))continue;let c=`${n}/${e}`,u=c.substring(0,c.lastIndexOf(`/`));u!==n&&await r.mkdir(u,{recursive:!0}),await r.writeFile(c,s),a.push(e)}return a.sort()}async function y(e,r,a,o,s,c=new Map,l=``){let u=`https://api.github.com/repos/${e}/${r}/contents/${a}`,d=o?`${u}?ref=${encodeURIComponent(o)}`:u,p=await s.request(d);if(p.status!==200)throw Error(m(p,`${e}/${r}${a?`/${a}`:``}`,s.hasToken));for(let a of n(p.body)){let n=l?`${l}/${a.name}`:a.name;if(f(n)){if(a.type===`file`&&a.download_url){let o=await s.request(a.download_url,`*/*`);if(o.status!==200)throw Error(m(o,`${e}/${r}/${a.path}`,s.hasToken));let l=t(a.download_url);c.set(n,l??i(o.body))}else a.type===`dir`&&await y(e,r,a.path,o,s,c,n)}}return c}async function b(e,r,i,a,o,s,l,u=[],d=``){for(let p of e){let e=d?`${d}/${p.name}`:p.name;if(f(e)){if(p.type===`file`&&p.download_url){if(c(e)&&await s.exists(`${r}/${p.name}`))continue;let n=await l.request(p.download_url,`*/*`);if(n.status!==200)throw Error(m(n,`${i}/${a}/${p.path}`,l.hasToken));let o=t(p.download_url);await s.writeFile(`${r}/${p.name}`,o??n.body),u.push(e)}else if(p.type===`dir`){let t=`https://api.github.com/repos/${i}/${a}/contents/${p.path}`,c=o?`${t}?ref=${encodeURIComponent(o)}`:t,d=await l.request(c);if(d.status!==200)throw Error(m(d,`${i}/${a}/${p.path}`,l.hasToken));let f=n(d.body);await s.mkdir(`${r}/${p.name}`,{recursive:!0}),await b(f,`${r}/${p.name}`,i,a,o,s,l,u,e)}}}return u.sort()}export{_ as a,f as c,c as d,d as f,h as i,l,y as n,v as o,g as r,m as s,b as t,u};
@@ -21,5 +21,5 @@ Builds are for GOOS=wasip1 GOARCH=wasm unless the environment says otherwise;
21
21
  a wasip1 program runs here (./prog, or go run). Only the standard library and
22
22
  the main module's own packages build: no cgo, //go:embed, assembly or module
23
23
  downloads yet.
24
- `,z="go: no Go toolchain installed: install one with `ipk add -g` (a package whose manifest has a `slicc.go` block)\n",B=new Set([`-o`,`-tags`,`-gcflags`,`-ldflags`,`-p`,`-mod`,`-modfile`,`-C`]),V=new Set([`-v`,`-x`,`-a`,`-n`,`-trimpath`,`-work`,`-buildvcs=false`]),H=new Set([`-race`,`-msan`,`-asan`,`-cover`,`-linkshared`,`-buildmode`]);function U(e){return e.match(/'[^']*'|"[^"]*"|\S+/g)?.map(e=>e.replace(/^['"]|['"]$/g,``))??[]}function W(e,t,n){t===`-o`?e.output=n:t===`-tags`?e.tags=n.split(/[,\s]+/).filter(Boolean):t===`-gcflags`?e.gcflags=U(n.replace(/^all=/,``)):t===`-ldflags`&&(e.ldflags=U(n.replace(/^all=/,``)))}function G(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i>0?r.slice(0,i):r).replace(/^--/,`-`);if(H.has(a))throw new x(`go: ${a} is not supported by SLICC's go`);if(V.has(a)||V.has(r))return a===`-v`&&(e.verbose=!0),a===`-x`&&(e.trace=!0),1;if(!B.has(a))throw new x(`go: unknown flag ${r}`);let o=i>0?r.slice(i+1):t[n+1];if(o===void 0)throw new x(`go: flag needs an argument: ${a}`);return W(e,a,o),i>0?1:2}function K(e){let t={},n=0;for(;n<e.length&&e[n].startsWith(`-`);){if(e[n]===`--`){n++;break}n+=G(t,e,n)}return{flags:t,rest:e.slice(n)}}function q(e){return{readText:async t=>{let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)},readdir:async t=>{if(e.readdirWithFileTypes)return(await e.readdirWithFileTypes(t)).map(e=>({name:e.name,isDir:e.isDirectory}));let n=[];for(let r of await e.readdir(t))n.push({name:r,isDir:(await e.stat(`${t}/${r}`)).isDirectory});return n},exists:t=>e.exists(t)}}function J(e){return{goos:e.env.get(`GOOS`)||`wasip1`,goarch:e.env.get(`GOARCH`)||`wasm`}}function Y(e,n){let r={...e.exportedEnv??Object.fromEntries(e.env),...n};return{...e,stdin:t(``),env:new Map([...e.env,...Object.entries(n)]),exportedEnv:r}}function ie(e,t){return async(n,r,i)=>{let{runWasmCommand:a}=await import(`./run-B6SZhKIe.js`),o=await a([n,...r],Y(e,i),{...t,onOutput:void 0});return{exitCode:o.exitCode,stdout:String(o.stdout),stderr:o.stderr}}}function ae(e){return[...e].sort((e,t)=>oe(t.version,e.version))[0]}function oe(e,t){let n=e=>e.replace(/^go/,``).split(`.`).map(e=>Number.parseInt(e,10)||0),[r,i]=[n(e),n(t)];for(let e=0;e<Math.max(r.length,i.length);e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t}return 0}async function se(e,t,n={},r={}){let[i,...a]=e;if(!i||i===`help`||i===`-h`||i===`--help`)return{stdout:i?R:``,stderr:i?``:R,exitCode:i?0:2};let o=q(t.fs),{toolchains:s,std:c}=await ne(o),l=ae(s),{goos:u,goarch:d}=J(t);try{switch(i){case`version`:return l?{stdout:`go version ${l.version} ${u}/${d}\n`,stderr:``,exitCode:0}:{stdout:``,stderr:z,exitCode:1};case`env`:return de(a,t,l,o);case`build`:case`run`:{if(!l)return{stdout:``,stderr:z,exitCode:1};let e=await j(o,c,l.version,`${u}/${d}`);if(e.size===0)return{stdout:``,stderr:`go: no standard library for ${u}/${d} (${l.version}) installed\n`,exitCode:1};let s={ctx:t,toolchain:l,goos:u,goarch:d,archives:e,options:n,deps:r,fs:o};return i===`build`?await ce(a,s):await $(a,s)}default:return{stdout:``,stderr:`go ${i}: unknown command (SLICC's go supports build, run, env and version)\nRun 'go help' for usage.\n`,exitCode:2}}}catch(e){if(e instanceof x)return{stdout:``,stderr:e.message?`${e.message}\n`:``,exitCode:1};throw e}}async function X(e,t,n){let{ctx:r,toolchain:i,goos:a,goarch:o,archives:s,fs:c}=e,l=await T(c,r.cwd);return new E(c,{goos:a,goarch:o,version:i.version,...t.tags?{tags:t.tags}:{}},new Set(s.keys()),l,r.cwd).plan(n)}async function Z(e){let t=`${(e.env.get(`TMPDIR`)||`/tmp`).replace(/\/+$/,``)}/go-build${Math.random().toString(36).slice(2,10)}`;return await e.fs.mkdir(t,{recursive:!0}),t}async function Q(e,t,n,r,i){let{ctx:a,toolchain:o,goos:s,goarch:c,archives:l,options:u,deps:d}=e,f=``;await F(n,{writeFile:(e,t)=>a.fs.writeFile(e,t),mkdir:e=>a.fs.mkdir(e,{recursive:!0})},d.runner??ie(a,u),{toolchain:o,goos:s,goarch:c,std:l,work:r,cwd:a.cwd,outputs:i,...t.gcflags?{gcflags:t.gcflags}:{},...t.ldflags?{ldflags:t.ldflags}:{},...t.verbose?{verbose:!0}:{},...t.trace?{trace:!0}:{},log:e=>{f+=e}}).catch(e=>{throw e instanceof x?new x(`${f}${e.message}`.replace(/\n$/,``)):e});for(let e of i.values())await a.fs.chmod(e,493);return f}async function ce(e,t){let{flags:n,rest:r}=K(e),{ctx:i,goos:a}=t,o=await X(t,n,r),s=o.roots.filter(e=>e.name===`main`),c=new Map,l=n.output&&O(n.output.startsWith(`/`)?n.output:`${i.cwd}/${n.output}`),u=n.output!==void 0&&(n.output.endsWith(`/`)||l!==void 0&&await i.fs.exists(l)&&(await i.fs.stat(l)).isDirectory);if(l&&!u&&o.roots.length>1)throw new x(`go: -o names a file, but several packages are built (name a directory)`);if(l&&!u&&s.length===0)throw new x(`go: -o names a file, but the package built is not a main package`);if(s.length===1&&o.roots.length===1){let e=s[0];c.set(e.path,l&&!u?l:`${l??i.cwd}/${L(e,a)}`)}else if(l&&u)for(let e of s)c.set(e.path,`${l}/${L(e,a)}`);let d=await Z(i);try{return{stdout:``,stderr:await Q(t,n,o,d,c),exitCode:0}}finally{await i.fs.rm(d,{recursive:!0,force:!0})}}function le(e){if(e.length===0)throw new x(`go: no go files listed`);if(e[0].endsWith(`.go`)){let t=0;for(;t<e.length&&e[t].endsWith(`.go`);)t++;return{pkgs:e.slice(0,t),progArgs:e.slice(t)}}return{pkgs:[e[0]],progArgs:e.slice(1)}}async function $(e,t){let{flags:n,rest:r}=K(e),{ctx:i,goos:a,goarch:o}=t;if(a!==`wasip1`||o!==`wasm`)throw new x(`go: cannot run ${a}/${o} programs here: build them with go build (only wasip1/wasm runs in SLICC)`);let{pkgs:s,progArgs:c}=le(r),l=await X(t,n,s),u=l.roots[0];if(u?.name!==`main`)throw new x(`package ${u?.path??s[0]} is not a main package`);let d=await Z(i);try{let e=`${d}/exe/${L(u,a)}`;await i.fs.mkdir(`${d}/exe`,{recursive:!0});let r=await Q(t,n,l,d,new Map([[u.path,e]])),o=await(t.deps.runProgram??ue(i,t.options))([e,...c]);return o.exitCode===0?{...o,stderr:`${r}${o.stderr}`}:{...o,stderr:`${r}${o.stderr}exit status ${o.exitCode}\n`,exitCode:1}}finally{await i.fs.rm(d,{recursive:!0,force:!0})}}function ue(e,t){return async n=>{let{runWasmCommand:r}=await import(`./run-B6SZhKIe.js`);return r([`--argv0`,n[0].split(`/`).pop(),...n],e,t)}}async function de(e,t,n,r){let{goos:i,goarch:a}=J(t),o=await T(r,t.cwd),s={GOARCH:a,GOOS:i,GOHOSTARCH:`wasm`,GOHOSTOS:`wasip1`,GOROOT:n?.goroot??``,GOTOOLDIR:n?`${n.goroot}/pkg/tool/wasip1_wasm`:``,GOVERSION:n?.version??``,CGO_ENABLED:`0`,GOMOD:o?`${o.dir===`/`?``:o.dir}/go.mod`:`/dev/null`,GOFLAGS:t.env.get(`GOFLAGS`)??``},c=e.filter(e=>!e.startsWith(`-`));return c.length>0?{stdout:c.map(e=>`${s[e]??t.env.get(e)??``}\n`).join(``),stderr:``,exitCode:0}:{stdout:`${Object.keys(s).sort().map(e=>`${e}='${s[e]}'`).join(`
24
+ `,z="go: no Go toolchain installed: install one with `ipk add -g` (a package whose manifest has a `slicc.go` block)\n",B=new Set([`-o`,`-tags`,`-gcflags`,`-ldflags`,`-p`,`-mod`,`-modfile`,`-C`]),V=new Set([`-v`,`-x`,`-a`,`-n`,`-trimpath`,`-work`,`-buildvcs=false`]),H=new Set([`-race`,`-msan`,`-asan`,`-cover`,`-linkshared`,`-buildmode`]);function U(e){return e.match(/'[^']*'|"[^"]*"|\S+/g)?.map(e=>e.replace(/^['"]|['"]$/g,``))??[]}function W(e,t,n){t===`-o`?e.output=n:t===`-tags`?e.tags=n.split(/[,\s]+/).filter(Boolean):t===`-gcflags`?e.gcflags=U(n.replace(/^all=/,``)):t===`-ldflags`&&(e.ldflags=U(n.replace(/^all=/,``)))}function G(e,t,n){let r=t[n],i=r.indexOf(`=`),a=(i>0?r.slice(0,i):r).replace(/^--/,`-`);if(H.has(a))throw new x(`go: ${a} is not supported by SLICC's go`);if(V.has(a)||V.has(r))return a===`-v`&&(e.verbose=!0),a===`-x`&&(e.trace=!0),1;if(!B.has(a))throw new x(`go: unknown flag ${r}`);let o=i>0?r.slice(i+1):t[n+1];if(o===void 0)throw new x(`go: flag needs an argument: ${a}`);return W(e,a,o),i>0?1:2}function K(e){let t={},n=0;for(;n<e.length&&e[n].startsWith(`-`);){if(e[n]===`--`){n++;break}n+=G(t,e,n)}return{flags:t,rest:e.slice(n)}}function q(e){return{readText:async t=>{let n=await e.readFile(t);return typeof n==`string`?n:new TextDecoder().decode(n)},readdir:async t=>{if(e.readdirWithFileTypes)return(await e.readdirWithFileTypes(t)).map(e=>({name:e.name,isDir:e.isDirectory}));let n=[];for(let r of await e.readdir(t))n.push({name:r,isDir:(await e.stat(`${t}/${r}`)).isDirectory});return n},exists:t=>e.exists(t)}}function J(e){return{goos:e.env.get(`GOOS`)||`wasip1`,goarch:e.env.get(`GOARCH`)||`wasm`}}function Y(e,n){let r={...e.exportedEnv??Object.fromEntries(e.env),...n};return{...e,stdin:t(``),env:new Map([...e.env,...Object.entries(n)]),exportedEnv:r}}function ie(e,t){return async(n,r,i)=>{let{runWasmCommand:a}=await import(`./run-DuqDZMb3.js`),o=await a([n,...r],Y(e,i),{...t,onOutput:void 0});return{exitCode:o.exitCode,stdout:String(o.stdout),stderr:o.stderr}}}function ae(e){return[...e].sort((e,t)=>oe(t.version,e.version))[0]}function oe(e,t){let n=e=>e.replace(/^go/,``).split(`.`).map(e=>Number.parseInt(e,10)||0),[r,i]=[n(e),n(t)];for(let e=0;e<Math.max(r.length,i.length);e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t}return 0}async function se(e,t,n={},r={}){let[i,...a]=e;if(!i||i===`help`||i===`-h`||i===`--help`)return{stdout:i?R:``,stderr:i?``:R,exitCode:i?0:2};let o=q(t.fs),{toolchains:s,std:c}=await ne(o),l=ae(s),{goos:u,goarch:d}=J(t);try{switch(i){case`version`:return l?{stdout:`go version ${l.version} ${u}/${d}\n`,stderr:``,exitCode:0}:{stdout:``,stderr:z,exitCode:1};case`env`:return de(a,t,l,o);case`build`:case`run`:{if(!l)return{stdout:``,stderr:z,exitCode:1};let e=await j(o,c,l.version,`${u}/${d}`);if(e.size===0)return{stdout:``,stderr:`go: no standard library for ${u}/${d} (${l.version}) installed\n`,exitCode:1};let s={ctx:t,toolchain:l,goos:u,goarch:d,archives:e,options:n,deps:r,fs:o};return i===`build`?await ce(a,s):await $(a,s)}default:return{stdout:``,stderr:`go ${i}: unknown command (SLICC's go supports build, run, env and version)\nRun 'go help' for usage.\n`,exitCode:2}}}catch(e){if(e instanceof x)return{stdout:``,stderr:e.message?`${e.message}\n`:``,exitCode:1};throw e}}async function X(e,t,n){let{ctx:r,toolchain:i,goos:a,goarch:o,archives:s,fs:c}=e,l=await T(c,r.cwd);return new E(c,{goos:a,goarch:o,version:i.version,...t.tags?{tags:t.tags}:{}},new Set(s.keys()),l,r.cwd).plan(n)}async function Z(e){let t=`${(e.env.get(`TMPDIR`)||`/tmp`).replace(/\/+$/,``)}/go-build${Math.random().toString(36).slice(2,10)}`;return await e.fs.mkdir(t,{recursive:!0}),t}async function Q(e,t,n,r,i){let{ctx:a,toolchain:o,goos:s,goarch:c,archives:l,options:u,deps:d}=e,f=``;await F(n,{writeFile:(e,t)=>a.fs.writeFile(e,t),mkdir:e=>a.fs.mkdir(e,{recursive:!0})},d.runner??ie(a,u),{toolchain:o,goos:s,goarch:c,std:l,work:r,cwd:a.cwd,outputs:i,...t.gcflags?{gcflags:t.gcflags}:{},...t.ldflags?{ldflags:t.ldflags}:{},...t.verbose?{verbose:!0}:{},...t.trace?{trace:!0}:{},log:e=>{f+=e}}).catch(e=>{throw e instanceof x?new x(`${f}${e.message}`.replace(/\n$/,``)):e});for(let e of i.values())await a.fs.chmod(e,493);return f}async function ce(e,t){let{flags:n,rest:r}=K(e),{ctx:i,goos:a}=t,o=await X(t,n,r),s=o.roots.filter(e=>e.name===`main`),c=new Map,l=n.output&&O(n.output.startsWith(`/`)?n.output:`${i.cwd}/${n.output}`),u=n.output!==void 0&&(n.output.endsWith(`/`)||l!==void 0&&await i.fs.exists(l)&&(await i.fs.stat(l)).isDirectory);if(l&&!u&&o.roots.length>1)throw new x(`go: -o names a file, but several packages are built (name a directory)`);if(l&&!u&&s.length===0)throw new x(`go: -o names a file, but the package built is not a main package`);if(s.length===1&&o.roots.length===1){let e=s[0];c.set(e.path,l&&!u?l:`${l??i.cwd}/${L(e,a)}`)}else if(l&&u)for(let e of s)c.set(e.path,`${l}/${L(e,a)}`);let d=await Z(i);try{return{stdout:``,stderr:await Q(t,n,o,d,c),exitCode:0}}finally{await i.fs.rm(d,{recursive:!0,force:!0})}}function le(e){if(e.length===0)throw new x(`go: no go files listed`);if(e[0].endsWith(`.go`)){let t=0;for(;t<e.length&&e[t].endsWith(`.go`);)t++;return{pkgs:e.slice(0,t),progArgs:e.slice(t)}}return{pkgs:[e[0]],progArgs:e.slice(1)}}async function $(e,t){let{flags:n,rest:r}=K(e),{ctx:i,goos:a,goarch:o}=t;if(a!==`wasip1`||o!==`wasm`)throw new x(`go: cannot run ${a}/${o} programs here: build them with go build (only wasip1/wasm runs in SLICC)`);let{pkgs:s,progArgs:c}=le(r),l=await X(t,n,s),u=l.roots[0];if(u?.name!==`main`)throw new x(`package ${u?.path??s[0]} is not a main package`);let d=await Z(i);try{let e=`${d}/exe/${L(u,a)}`;await i.fs.mkdir(`${d}/exe`,{recursive:!0});let r=await Q(t,n,l,d,new Map([[u.path,e]])),o=await(t.deps.runProgram??ue(i,t.options))([e,...c]);return o.exitCode===0?{...o,stderr:`${r}${o.stderr}`}:{...o,stderr:`${r}${o.stderr}exit status ${o.exitCode}\n`,exitCode:1}}finally{await i.fs.rm(d,{recursive:!0,force:!0})}}function ue(e,t){return async n=>{let{runWasmCommand:r}=await import(`./run-DuqDZMb3.js`);return r([`--argv0`,n[0].split(`/`).pop(),...n],e,t)}}async function de(e,t,n,r){let{goos:i,goarch:a}=J(t),o=await T(r,t.cwd),s={GOARCH:a,GOOS:i,GOHOSTARCH:`wasm`,GOHOSTOS:`wasip1`,GOROOT:n?.goroot??``,GOTOOLDIR:n?`${n.goroot}/pkg/tool/wasip1_wasm`:``,GOVERSION:n?.version??``,CGO_ENABLED:`0`,GOMOD:o?`${o.dir===`/`?``:o.dir}/go.mod`:`/dev/null`,GOFLAGS:t.env.get(`GOFLAGS`)??``},c=e.filter(e=>!e.startsWith(`-`));return c.length>0?{stdout:c.map(e=>`${s[e]??t.env.get(e)??``}\n`).join(``),stderr:``,exitCode:0}:{stdout:`${Object.keys(s).sort().map(e=>`${e}='${s[e]}'`).join(`
25
25
  `)}\n`,stderr:``,exitCode:0}}export{se as runGoCommand};
@@ -1 +1 @@
1
- import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-DgwYNQ3h.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
1
+ import{t as e}from"./logger-DDBAeTLF.js";import{t}from"./permissions-surface-registry-CilCRwhh.js";import{a as n,i as r,n as i,o as a,r as o}from"./whisper-session-DVySo8di.js";var s=e(`speech:hear`),c={};function l(){return c.getPermissionSurface?c.getPermissionSurface():t()||null}var u=3e4;function d(){if(typeof window>`u`)return null;let{SpeechRecognition:e,webkitSpeechRecognition:t}=window;return e??t??null}var f=class extends Error{code;constructor(e){super(p(e)),this.name=`SpeechRecognitionError`,this.code=e}};function p(e){switch(e){case`network`:case`service-not-allowed`:return"builtin speech recognition is unsupported in this browser (no Web Speech cloud backend) — use `hear --engine enhanced`";case`not-allowed`:return`microphone permission denied for builtin speech recognition`;case`audio-capture`:return`no microphone available for builtin speech recognition`;case`no-speech`:return`no speech detected`;case`aborted`:return`speech recognition aborted`;default:return`speech recognition error: ${e}`}}function m(e){return e instanceof f&&(e.code===`network`||e.code===`service-not-allowed`)}function h(e,t){let n=d();return n?new Promise((r,i)=>{let a=Date.now(),o=()=>Date.now()-a,c=new n;c.continuous=!1,c.interimResults=!1,e&&(c.lang=e),s.debug(`builtinOnce: recognizer constructed`,{lang:e??`(browser default)`,timeoutMs:t});let l=``,u=!1,d=setTimeout(()=>{s.debug(`builtinOnce: timeout reached — stopping recognizer`,{elapsedMs:o()});try{c.stop()}catch{}},t);c.onstart=()=>s.debug(`builtinOnce: onstart (recognition service active)`,{elapsedMs:o()}),c.onaudiostart=()=>s.debug(`builtinOnce: onaudiostart (capturing audio)`,{elapsedMs:o()}),c.onspeechstart=()=>s.debug(`builtinOnce: onspeechstart (speech detected)`,{elapsedMs:o()}),c.onspeechend=()=>s.debug(`builtinOnce: onspeechend (speech ended)`,{elapsedMs:o()}),c.onnomatch=()=>s.debug(`builtinOnce: onnomatch (no recognizable speech)`,{elapsedMs:o()}),c.onresult=e=>{let t=[];for(let n=0;n<e.results.length;n++)t.push(e.results[n][0]?.transcript??``);l=t.join(` `).trim(),s.debug(`builtinOnce: onresult`,{elapsedMs:o(),resultCount:e.results.length,transcriptLength:l.length})},c.onerror=e=>{if(e.error===`no-speech`||e.error===`aborted`){s.debug(`builtinOnce: onerror (non-fatal — ends with empty transcript)`,{elapsedMs:o(),code:e.error});return}u=!0,clearTimeout(d),s.error(`builtinOnce: onerror (fatal)`,{elapsedMs:o(),code:e.error}),i(new f(e.error))},c.onend=()=>{clearTimeout(d),u?s.debug(`builtinOnce: onend after fatal error (already rejected)`,{elapsedMs:o()}):(s.debug(`builtinOnce: onend — resolving`,{elapsedMs:o(),transcriptLength:l.length,empty:l.length===0}),r(l))},s.debug(`builtinOnce: calling recognizer.start()`,{elapsedMs:o()}),c.start()}):Promise.reject(Error(`speech recognition unavailable in this environment`))}async function g(e){let t={audio:!e||{deviceId:{exact:e}}},n=l();if(n){s.debug(`acquireMicrophoneStream: requesting microphone via permission surface`,{hasDeviceId:!!e});let r=await n.prompt({kinds:[`microphone`],description:`The hear command needs your microphone to transcribe speech.`,requestOptions:{microphone:{constraints:t}},skipIfGranted:!0});if(r.status!==`granted`){s.error(`acquireMicrophoneStream: microphone permission not granted`,{status:r.status,reason:r.reason});let e=r.message?`: ${r.message}`:``;throw Error(`microphone permission ${r.reason??r.status}${e}`)}let i=r.grants.find(e=>e.kind===`microphone`);if(!i)throw s.error(`acquireMicrophoneStream: permission granted without a microphone stream`),Error(`microphone permission granted without a stream`);return s.debug(`acquireMicrophoneStream: microphone stream acquired via surface`),i.stream}if(!navigator.mediaDevices?.getUserMedia)throw s.error(`acquireMicrophoneStream: getUserMedia unavailable in this realm`),Error(`microphone capture unavailable in this realm`);s.debug(`acquireMicrophoneStream: no permission surface; calling getUserMedia directly`);try{let e=await navigator.mediaDevices.getUserMedia(t);return s.debug(`acquireMicrophoneStream: getUserMedia succeeded (direct)`),e}catch(e){throw s.error(`acquireMicrophoneStream: getUserMedia failed (direct)`,e),e}}async function _(e){let t=await g(e),n=new MediaRecorder(t),r=[];n.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},n.start(500);let i=()=>{for(let e of t.getTracks())e.stop()};return{stop:()=>new Promise(e=>{n.onstop=()=>{i(),e(r.length?new Blob(r,{type:n.mimeType||`audio/webm`}):null)};try{n.stop()}catch{i(),e(null)}}),cancel:()=>{try{n.stop()}catch{}i()}}}async function v(e){if(!l())return s.debug(`primeBuiltinPermission: no permission surface; recognizer drives its own prompt`),null;s.debug(`primeBuiltinPermission: priming microphone grant via permission surface`,{hasDeviceId:!!e});let t=await g(e);return s.debug(`primeBuiltinPermission: microphone primed; holding stream open for recognizer`),t}function y(e){if(e){for(let t of e.getTracks())t.stop();s.debug(`primeBuiltinPermission: released primed microphone stream`)}}async function b(e,t){let n=await _(e.deviceId),a=``;try{a=await h(e.lang,t)}catch(e){s.warn(`builtin endpointing failed; transcribing captured audio anyway`,e)}let c=await n.stop();if(!c)return{transcript:a,engine:`builtin`};try{let t=await r(),n=await o(await c.arrayBuffer()),a=await t.transcribe(n,{language:i(e.lang)});if(a)return{transcript:a,engine:`enhanced`}}catch(e){s.warn(`whisper transcription failed; falling back to builtin text`,e)}return{transcript:a,engine:`builtin`}}async function x(e={}){let t=e.timeoutMs??u,n=e.engine??`auto`,r=a()===`ready`;if(n===`enhanced`&&!r)throw s.error(`hearCapture: enhanced engine requested but whisper is not ready`),Error("enhanced engine not ready — run `hear --warmup` (check progress with `hear --status`)");let i=n!==`builtin`&&r;if(s.debug(`hearCapture: engine dispatch`,{requested:n,enhancedReady:r,resolved:i?`enhanced`:`builtin`}),i)return b(e,t);let o=await v(e.deviceId);try{let n=await h(e.lang,t);return s.debug(`hearCapture: builtin recognition produced a transcript`),{transcript:n,engine:`builtin`}}catch(n){if(!m(n))throw s.error(`hearCapture: builtin recognition failed`,n),n;if(r)return s.debug(`hearCapture: builtin unsupported in this browser; falling back to enhanced whisper`),y(o),o=null,b(e,t);throw s.error(`hearCapture: builtin unsupported and whisper not ready`,{code:n.code}),n}finally{y(o)}}async function S(e,t){let n=await r(),a=await o(e);return{transcript:await n.transcribe(a,{language:i(t)}),engine:`enhanced`}}function C(){let e=n();return{state:a(),...e?{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}:{}}}function w(){return r().catch(()=>{}),C()}export{x as hearCapture,C as hearStatus,S as hearTranscribe,w as hearWarmup};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./subcommand-help-CgO7wRS5.js";import{r as t}from"./state-D3jCjcYF.js";function n(e){return`Usage: ${e} <command> [args...]
1
+ import{r as e}from"./subcommand-help-CgO7wRS5.js";import{r as t}from"./state-UjVstscY.js";function n(e){return`Usage: ${e} <command> [args...]
2
2
 
3
3
  Most commands operate on a tab and REQUIRE --tab=<targetId>. There is no
4
4
  implicit "current tab" — run "${e} tab-list" to get tab IDs.