@cortex-agent/server 2026.10.21 → 2026.10.27

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 (1815) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -6
  3. package/THIRD_PARTY_NOTICES.txt +16546 -0
  4. package/defaults/context/projects/AGENTS.md +1 -1
  5. package/defaults/gitignore +3 -3
  6. package/defaults/hooks/new-session-hook.mjs +1 -1
  7. package/defaults/hooks/status-md-guard.mjs +6 -6
  8. package/defaults/plugins/cortex-system/plugin.json +1 -1
  9. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +16 -9
  10. package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +2 -2
  11. package/defaults/prompts/clean-workspace.md +21 -0
  12. package/defaults/rules/agents-md.md +1 -1
  13. package/defaults/rules/issues-md.md +1 -1
  14. package/defaults/rules/meta-conventions.md +3 -3
  15. package/defaults/rules/mission-md.md +1 -1
  16. package/defaults/rules/status-md.md +1 -1
  17. package/dist/agent-adapter/claude/remote-mcp-proxy.js +4 -66
  18. package/dist/build-info.json +1 -0
  19. package/dist/chunks/anthropic-SUZWKBRW.js +4 -0
  20. package/dist/chunks/anthropic-messages-M3SMXACA.js +8 -0
  21. package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +4 -0
  22. package/dist/chunks/azure-openai-responses-76YWXHSB.js +4 -0
  23. package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +58 -0
  24. package/dist/chunks/child-runner-3GHOWGZP.js +4 -0
  25. package/dist/chunks/chunk-23PRJECN.js +4 -0
  26. package/dist/chunks/chunk-2ZNLUY2U.js +128 -0
  27. package/dist/chunks/chunk-3F6WW7HR.js +13 -0
  28. package/dist/chunks/chunk-3OKHUVEM.js +7 -0
  29. package/dist/chunks/chunk-3TGQSGG4.js +8 -0
  30. package/dist/chunks/chunk-3THJYAEF.js +4 -0
  31. package/dist/chunks/chunk-3YHOCPQU.js +10 -0
  32. package/dist/chunks/chunk-4EX2JJWB.js +4 -0
  33. package/dist/chunks/chunk-4LLH5OWM.js +10 -0
  34. package/dist/chunks/chunk-4U7XXM4W.js +4 -0
  35. package/dist/chunks/chunk-52T37Y47.js +8 -0
  36. package/dist/chunks/chunk-5M4PFLRW.js +4 -0
  37. package/dist/chunks/chunk-5NRGVROY.js +4 -0
  38. package/dist/chunks/chunk-5T7IX5KN.js +4 -0
  39. package/dist/chunks/chunk-6AKUD3CF.js +4 -0
  40. package/dist/chunks/chunk-6LZK4DDH.js +4 -0
  41. package/dist/chunks/chunk-6R73ICDB.js +4 -0
  42. package/dist/chunks/chunk-7MU2AKNM.js +4 -0
  43. package/dist/chunks/chunk-A34TDMIC.js +7 -0
  44. package/dist/chunks/chunk-AAA3UBIS.js +4 -0
  45. package/dist/chunks/chunk-ASYQHJVQ.js +9 -0
  46. package/dist/chunks/chunk-AWFUHWQK.js +4 -0
  47. package/dist/chunks/chunk-B3XBQEFM.js +4 -0
  48. package/dist/chunks/chunk-BGVHA2D4.js +4 -0
  49. package/dist/chunks/chunk-BGYR4ID3.js +4 -0
  50. package/dist/chunks/chunk-BKHDWCRT.js +79 -0
  51. package/dist/chunks/chunk-BR7A5SWM.js +23 -0
  52. package/dist/chunks/chunk-CQLH4UVX.js +4 -0
  53. package/dist/chunks/chunk-CVC66CFV.js +33 -0
  54. package/dist/chunks/chunk-CXT5IR5T.js +4 -0
  55. package/dist/chunks/chunk-D3NXKK2L.js +4 -0
  56. package/dist/chunks/chunk-D6UA4BZC.js +19 -0
  57. package/dist/chunks/chunk-D6VMBA4C.js +4 -0
  58. package/dist/chunks/chunk-DGMNI4AO.js +4 -0
  59. package/dist/chunks/chunk-DHSA5ACV.js +125 -0
  60. package/dist/chunks/chunk-DPQPXBTP.js +68 -0
  61. package/dist/chunks/chunk-DQJ6LLAS.js +4 -0
  62. package/dist/chunks/chunk-DXBSQXJL.js +18 -0
  63. package/dist/chunks/chunk-E6BYRULL.js +4 -0
  64. package/dist/chunks/chunk-E7ZMYIY6.js +30 -0
  65. package/dist/chunks/chunk-EQIMHXC4.js +5 -0
  66. package/dist/chunks/chunk-EQITBTJC.js +10 -0
  67. package/dist/chunks/chunk-EXJA5RIX.js +357 -0
  68. package/dist/chunks/chunk-FF7UELTU.js +4 -0
  69. package/dist/chunks/chunk-FH74NME3.js +115 -0
  70. package/dist/chunks/chunk-FOJQXLL2.js +6 -0
  71. package/dist/chunks/chunk-FOQ7VLIL.js +17 -0
  72. package/dist/chunks/chunk-FX6MOGLR.js +11 -0
  73. package/dist/chunks/chunk-FXDIR3SQ.js +4 -0
  74. package/dist/chunks/chunk-G2V65UBA.js +4 -0
  75. package/dist/chunks/chunk-H2FP6DG4.js +5 -0
  76. package/dist/chunks/chunk-HALUQ7ZF.js +4 -0
  77. package/dist/chunks/chunk-HGPBHTVD.js +6 -0
  78. package/dist/chunks/chunk-HU6UIDEJ.js +6 -0
  79. package/dist/chunks/chunk-I6OPDRVF.js +4 -0
  80. package/dist/chunks/chunk-ILEML5IP.js +4 -0
  81. package/dist/chunks/chunk-IRWZ7UPF.js +77 -0
  82. package/dist/chunks/chunk-J5DVLUKY.js +6 -0
  83. package/dist/chunks/chunk-JERCOLY3.js +142 -0
  84. package/dist/chunks/chunk-JW2HFMTF.js +4 -0
  85. package/dist/chunks/chunk-JXFG66UN.js +4 -0
  86. package/dist/chunks/chunk-K4NTZEDJ.js +4 -0
  87. package/dist/chunks/chunk-KDYEGGMW.js +4 -0
  88. package/dist/chunks/chunk-KENCMLRE.js +4 -0
  89. package/dist/chunks/chunk-KGJZAYQD.js +4 -0
  90. package/dist/chunks/chunk-KIGMAATV.js +23 -0
  91. package/dist/chunks/chunk-KIU5FAPY.js +5 -0
  92. package/dist/chunks/chunk-KIWMQPH7.js +739 -0
  93. package/dist/chunks/chunk-KRXTI4JO.js +3 -0
  94. package/dist/chunks/chunk-L6VCIGWS.js +11 -0
  95. package/dist/chunks/chunk-LACGULCN.js +10 -0
  96. package/dist/chunks/chunk-LCKVYFMD.js +4 -0
  97. package/dist/chunks/chunk-LEUENXI2.js +6 -0
  98. package/dist/chunks/chunk-LMDWRRX4.js +4 -0
  99. package/dist/chunks/chunk-LMSQZ6TQ.js +4 -0
  100. package/dist/chunks/chunk-MEPASGPP.js +6 -0
  101. package/dist/chunks/chunk-MFAEUHMV.js +28 -0
  102. package/dist/chunks/chunk-N6BTQN7R.js +8 -0
  103. package/dist/chunks/chunk-NAA7GF6Q.js +5 -0
  104. package/dist/chunks/chunk-NHD2ESHA.js +4 -0
  105. package/dist/chunks/chunk-NKDMKRSB.js +68 -0
  106. package/dist/chunks/chunk-NKXV32S6.js +4 -0
  107. package/dist/chunks/chunk-NR6U3WIZ.js +4 -0
  108. package/dist/chunks/chunk-NT32UURL.js +4 -0
  109. package/dist/chunks/chunk-NVX5IPRN.js +4 -0
  110. package/dist/chunks/chunk-O3JW2F7D.js +8 -0
  111. package/dist/chunks/chunk-OE4KH3NJ.js +4 -0
  112. package/dist/chunks/chunk-OISO5JXB.js +4 -0
  113. package/dist/chunks/chunk-OKRK6JPY.js +4 -0
  114. package/dist/chunks/chunk-OPYXNSMY.js +4 -0
  115. package/dist/chunks/chunk-OSEIQ7SS.js +4 -0
  116. package/dist/chunks/chunk-OZGBWAT2.js +4 -0
  117. package/dist/chunks/chunk-P52RMIYX.js +6 -0
  118. package/dist/chunks/chunk-PBJ5MPPX.js +60 -0
  119. package/dist/chunks/chunk-PFMEUFJ7.js +4 -0
  120. package/dist/chunks/chunk-PMG4YGDU.js +7 -0
  121. package/dist/chunks/chunk-PXS5SHOV.js +4 -0
  122. package/dist/chunks/chunk-PZMGBKUR.js +13 -0
  123. package/dist/chunks/chunk-PZMXHA6X.js +9 -0
  124. package/dist/chunks/chunk-Q4UGYGU5.js +4 -0
  125. package/dist/chunks/chunk-Q7CE3UIE.js +133 -0
  126. package/dist/chunks/chunk-QBKCAIJG.js +4 -0
  127. package/dist/chunks/chunk-QEOFEETJ.js +4 -0
  128. package/dist/chunks/chunk-QN44UXQR.js +11 -0
  129. package/dist/chunks/chunk-QUUEQRIT.js +4 -0
  130. package/dist/chunks/chunk-QWAQHHRS.js +4 -0
  131. package/dist/chunks/chunk-RA6HKFBV.js +4 -0
  132. package/dist/chunks/chunk-REBNWCKI.js +4 -0
  133. package/dist/chunks/chunk-REPYBMQS.js +4 -0
  134. package/dist/chunks/chunk-RO4C2MJP.js +4 -0
  135. package/dist/chunks/chunk-SKHLZ6XY.js +9 -0
  136. package/dist/chunks/chunk-STUHNKQS.js +4 -0
  137. package/dist/chunks/chunk-SUFW24P4.js +7 -0
  138. package/dist/chunks/chunk-TAWLERZA.js +4 -0
  139. package/dist/chunks/chunk-TCAEECDI.js +4 -0
  140. package/dist/chunks/chunk-TJ4GQRT6.js +8 -0
  141. package/dist/chunks/chunk-TURBFBYN.js +4 -0
  142. package/dist/chunks/chunk-TWAEABGG.js +52 -0
  143. package/dist/chunks/chunk-TZFLHVOQ.js +7 -0
  144. package/dist/chunks/chunk-TZGNSHOL.js +4 -0
  145. package/dist/chunks/chunk-UD3NMUHR.js +12 -0
  146. package/dist/chunks/chunk-UNVEZI57.js +4 -0
  147. package/dist/chunks/chunk-USBJFDJ6.js +4 -0
  148. package/dist/chunks/chunk-V3AQJSWR.js +4 -0
  149. package/dist/chunks/chunk-VQUPKMDR.js +4 -0
  150. package/dist/chunks/chunk-W25TB3PU.js +4 -0
  151. package/dist/chunks/chunk-W5LGYSPZ.js +4 -0
  152. package/dist/chunks/chunk-WEZWKMYU.js +4 -0
  153. package/dist/chunks/chunk-WHC7AYZD.js +4 -0
  154. package/dist/chunks/chunk-X2GYYRVM.js +22 -0
  155. package/dist/chunks/chunk-XAJLZR7C.js +28 -0
  156. package/dist/chunks/chunk-XAXWLYH5.js +4 -0
  157. package/dist/chunks/chunk-XBJOYU5Y.js +4 -0
  158. package/dist/chunks/chunk-XH6FMP3N.js +71 -0
  159. package/dist/chunks/chunk-XIECJESP.js +4 -0
  160. package/dist/chunks/chunk-XNSSUVT6.js +4 -0
  161. package/dist/chunks/chunk-XSRZHN63.js +4 -0
  162. package/dist/chunks/chunk-Y3GFB5XM.js +8 -0
  163. package/dist/chunks/chunk-Y6ZEVVL5.js +4 -0
  164. package/dist/chunks/chunk-YAEVYJAR.js +4 -0
  165. package/dist/chunks/chunk-YG7OEPR2.js +6 -0
  166. package/dist/chunks/chunk-YHIWOGVL.js +4 -0
  167. package/dist/chunks/chunk-YKKEI5GI.js +4 -0
  168. package/dist/chunks/chunk-YPK2CAIZ.js +8 -0
  169. package/dist/chunks/chunk-YZSHTWNM.js +92 -0
  170. package/dist/chunks/chunk-Z2Q2NR46.js +34 -0
  171. package/dist/chunks/chunk-Z4H3VDHI.js +4 -0
  172. package/dist/chunks/chunk-ZFPMIQA3.js +6 -0
  173. package/dist/chunks/chunk-ZNZFWSPH.js +4 -0
  174. package/dist/chunks/chunk-ZQ7LGTSN.js +8 -0
  175. package/dist/chunks/chunk-ZSV6TO7Q.js +4 -0
  176. package/dist/chunks/cli-5DBTRMHU.js +53 -0
  177. package/dist/chunks/client-XOGYH5UR.js +4 -0
  178. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +4 -0
  179. package/dist/chunks/config-DJSQI77S-335IXHSM.js +4 -0
  180. package/dist/chunks/context-VCQH5OB6.js +4 -0
  181. package/dist/chunks/cost-PGGFI7QJ.js +5 -0
  182. package/dist/chunks/dist-7RWW7YH4.js +11 -0
  183. package/dist/chunks/dist-PUKMZ7GW.js +4 -0
  184. package/dist/chunks/easter-egg-3d-MO4MOEVF.js +4 -0
  185. package/dist/chunks/es5-VNTQPCKX.js +4 -0
  186. package/dist/chunks/event-streams-3JSFPOTZ.js +4 -0
  187. package/dist/chunks/execution-repo-ZLJTBWFC.js +4 -0
  188. package/dist/chunks/executions-6ARGR3IO.js +9 -0
  189. package/dist/chunks/file-7BN7RCAY.js +4 -0
  190. package/dist/chunks/gateway-UCRPMR75.js +36 -0
  191. package/dist/chunks/github-copilot-HAI2DA62.js +4 -0
  192. package/dist/chunks/google-generative-ai-2VXWLHWI.js +4 -0
  193. package/dist/chunks/google-vertex-UA36QP2U.js +4 -0
  194. package/dist/chunks/init-HA7FAQ73.js +4 -0
  195. package/dist/chunks/install-cli-4IZCSDFZ.js +16 -0
  196. package/dist/chunks/interaction-ask-G5T3H3CG.js +9 -0
  197. package/dist/chunks/interaction-plan-E5V42MUP.js +11 -0
  198. package/dist/chunks/jiti-loader-WANUXUDO.js +4 -0
  199. package/dist/chunks/jiti-static-loader-W3QZ4GDS.js +476 -0
  200. package/dist/chunks/kimi-coding-HMJRKCPA.js +4 -0
  201. package/dist/chunks/lib-RSOU34HQ.js +11 -0
  202. package/dist/chunks/llama-cpp-classify-OTXZWCMW.js +24 -0
  203. package/dist/chunks/local-client-stop-SQRU7ZZM.js +4 -0
  204. package/dist/chunks/memory-cli-PYOILNN5.js +11 -0
  205. package/dist/chunks/meta-KY3LNFV2.js +4 -0
  206. package/dist/chunks/mistral-conversations-34F66L3O.js +7 -0
  207. package/dist/chunks/model-resolver-N3DTAQ2S.js +4 -0
  208. package/dist/chunks/models-L5VF4I5O-XXNJYQMQ.js +4 -0
  209. package/dist/chunks/multipart-parser-GEHG6YAR.js +5 -0
  210. package/dist/chunks/node-PTK2HCDV.js +18 -0
  211. package/dist/chunks/node-VLVSZ76W.js +4 -0
  212. package/dist/chunks/openai-chatgpt-PETGIJOZ.js +4 -0
  213. package/dist/chunks/openai-codex-2REL6UQU.js +4 -0
  214. package/dist/chunks/openai-codex-responses-ZBVHREB3.js +12 -0
  215. package/dist/chunks/openai-completions-VVIB26SH.js +9 -0
  216. package/dist/chunks/openai-decisions-2N6ZRPZC.js +7 -0
  217. package/dist/chunks/openai-responses-735XA2ZX.js +6 -0
  218. package/dist/chunks/openrouter-GDY3BLT2.js +4 -0
  219. package/dist/chunks/openrouter-images-3IKETHAC.js +4 -0
  220. package/dist/chunks/pi-messages-I3E4ZFHA.js +10 -0
  221. package/dist/chunks/radius-HXRZVBDB.js +4 -0
  222. package/dist/chunks/remote-ops-BALZYKH6.js +14 -0
  223. package/dist/chunks/runner-PLVZDGHB.js +4 -0
  224. package/dist/chunks/runtime-6YLTA2ZD.js +4 -0
  225. package/dist/chunks/schedule-cli-OLASBBYJ.js +4 -0
  226. package/dist/chunks/slack-WAGSPZUX.js +4 -0
  227. package/dist/chunks/src-CCI7P7AI.js +6 -0
  228. package/dist/chunks/start-ui-http-QALT7C3P.js +43 -0
  229. package/dist/chunks/subagent-E3UC7ZHC.js +4 -0
  230. package/dist/chunks/time-KEHDQT6K.js +4 -0
  231. package/dist/chunks/tool-shims-Q6P6UXVC.js +4 -0
  232. package/dist/chunks/typesafe-system-one-6ULACYD4.js +4 -0
  233. package/dist/chunks/ui-board-4GYW6KKW.js +5 -0
  234. package/dist/chunks/ui-decision-U2FXSEC2.js +4 -0
  235. package/dist/chunks/ui-file-GVH53O3X.js +5 -0
  236. package/dist/chunks/ui-view-O7PLANT7.js +4 -0
  237. package/dist/chunks/virtual-modules-IDC5YKZJ.js +4 -0
  238. package/dist/chunks/waitpoint-2FGQBIAC.js +5 -0
  239. package/dist/chunks/workers-XN4PSTH6.js +4 -0
  240. package/dist/chunks/xai-KEVUJTFV.js +4 -0
  241. package/dist/client-bundle/client.mjs +10 -5
  242. package/dist/client-bundle/manifest.json +2 -2
  243. package/dist/core/pi-sdk.js +4 -73
  244. package/dist/domain/auth/cc-auth-cli.js +4 -248
  245. package/dist/domain/mcp/bundled-server.js +4 -146
  246. package/dist/entry/app.js +601 -593
  247. package/dist/entry/browser-cli.js +14 -316
  248. package/dist/entry/cli.js +4 -587
  249. package/dist/entry/cortex-cli.js +4 -2
  250. package/dist/entry/daemon.js +7 -895
  251. package/dist/entry/hook-cli.js +6 -401
  252. package/dist/entry/production-app-bootstrap.js +5 -42
  253. package/dist/entry/production-evidence-export-cli.js +12 -99
  254. package/dist/entry/signal-cli.js +6 -201
  255. package/dist/tui/index.js +114 -306
  256. package/package.json +11 -50
  257. package/scripts/bundle-prune-browser.mjs +52 -0
  258. package/scripts/postinstall-restart-trigger.mjs +8 -0
  259. package/vendor/aistatus/gateway-cli.js +21 -0
  260. package/vendor/pi/CHANGELOG.md +6365 -0
  261. package/vendor/pi/README.md +95 -0
  262. package/vendor/pi/dist/codemode-worker.js +478 -0
  263. package/vendor/pi/dist/core/export-html/ansi-to-html.js +249 -0
  264. package/vendor/pi/dist/core/export-html/index.js +228 -0
  265. package/vendor/pi/dist/core/export-html/template.css +1076 -0
  266. package/vendor/pi/dist/core/export-html/template.html +56 -0
  267. package/vendor/pi/dist/core/export-html/template.js +1924 -0
  268. package/vendor/pi/dist/core/export-html/tool-renderer.js +110 -0
  269. package/vendor/pi/dist/core/export-html/vendor/highlight.min.js +1213 -0
  270. package/vendor/pi/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  271. package/vendor/pi/dist/core/export-html/vendor/marked.min.js +79 -0
  272. package/vendor/pi/dist/core/extensions/loader.js +4 -0
  273. package/vendor/pi/dist/extensions/codemode/execute.js +507 -0
  274. package/vendor/pi/dist/modes/interactive/assets/clankolas.png +0 -0
  275. package/vendor/pi/dist/modes/interactive/theme/dark.json +78 -0
  276. package/vendor/pi/dist/modes/interactive/theme/light.json +78 -0
  277. package/vendor/pi/dist/modes/interactive/theme/system-theme.js +546 -0
  278. package/vendor/pi/dist/modes/interactive/theme/theme-controller.js +210 -0
  279. package/vendor/pi/dist/modes/interactive/theme/theme-schema.js +105 -0
  280. package/vendor/pi/dist/modes/interactive/theme/theme-tokens.js +94 -0
  281. package/vendor/pi/dist/modes/interactive/theme/theme.js +905 -0
  282. package/vendor/pi/dist/utils/image-resize-worker.js +4 -0
  283. package/vendor/pi/dist/utils/image-resize.js +4 -0
  284. package/vendor/pi/docs/cli-integration.md +106 -0
  285. package/vendor/pi/docs/cli.md +333 -0
  286. package/vendor/pi/docs/codemode.md +230 -0
  287. package/vendor/pi/docs/compaction.md +463 -0
  288. package/vendor/pi/docs/configuration.md +47 -0
  289. package/vendor/pi/docs/containerization.md +183 -0
  290. package/vendor/pi/docs/custom-provider.md +225 -0
  291. package/vendor/pi/docs/docs.json +220 -0
  292. package/vendor/pi/docs/environment-variables.md +101 -0
  293. package/vendor/pi/docs/extensions.md +400 -0
  294. package/vendor/pi/docs/how-pi-works.md +49 -0
  295. package/vendor/pi/docs/images/doom-extension.png +0 -0
  296. package/vendor/pi/docs/images/exy.png +0 -0
  297. package/vendor/pi/docs/images/interactive-mode.png +0 -0
  298. package/vendor/pi/docs/images/tree-view.png +0 -0
  299. package/vendor/pi/docs/index.md +39 -0
  300. package/vendor/pi/docs/json.md +226 -0
  301. package/vendor/pi/docs/keybindings.md +195 -0
  302. package/vendor/pi/docs/llama-cpp.md +121 -0
  303. package/vendor/pi/docs/mcp.md +272 -0
  304. package/vendor/pi/docs/message-types.md +279 -0
  305. package/vendor/pi/docs/models-configuration.md +196 -0
  306. package/vendor/pi/docs/models.md +225 -0
  307. package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +96 -0
  308. package/vendor/pi/docs/packages.md +129 -0
  309. package/vendor/pi/docs/prompt-templates.md +59 -0
  310. package/vendor/pi/docs/providers.md +247 -0
  311. package/vendor/pi/docs/quickstart.md +136 -0
  312. package/vendor/pi/docs/rpc-commands.md +860 -0
  313. package/vendor/pi/docs/rpc-extension-ui.md +200 -0
  314. package/vendor/pi/docs/rpc.md +193 -0
  315. package/vendor/pi/docs/sdk.md +147 -0
  316. package/vendor/pi/docs/security.md +99 -0
  317. package/vendor/pi/docs/session-format.md +293 -0
  318. package/vendor/pi/docs/sessions.md +66 -0
  319. package/vendor/pi/docs/settings.md +172 -0
  320. package/vendor/pi/docs/shell-aliases.md +93 -0
  321. package/vendor/pi/docs/skills.md +93 -0
  322. package/vendor/pi/docs/slash-commands.md +60 -0
  323. package/vendor/pi/docs/terminal-setup.md +233 -0
  324. package/vendor/pi/docs/termux.md +117 -0
  325. package/vendor/pi/docs/themes.md +138 -0
  326. package/vendor/pi/docs/tmux.md +55 -0
  327. package/vendor/pi/docs/tui.md +195 -0
  328. package/vendor/pi/docs/usage.md +94 -0
  329. package/vendor/pi/docs/virtual-models.md +114 -0
  330. package/vendor/pi/docs/windows.md +81 -0
  331. package/vendor/pi/examples/README.md +36 -0
  332. package/vendor/pi/examples/extensions/README.md +214 -0
  333. package/vendor/pi/examples/extensions/auto-commit-on-exit.ts +49 -0
  334. package/vendor/pi/examples/extensions/bash-spawn-hook.ts +30 -0
  335. package/vendor/pi/examples/extensions/bookmark.ts +50 -0
  336. package/vendor/pi/examples/extensions/border-status-editor.ts +150 -0
  337. package/vendor/pi/examples/extensions/built-in-tool-renderer.ts +225 -0
  338. package/vendor/pi/examples/extensions/claude-rules.ts +86 -0
  339. package/vendor/pi/examples/extensions/commands.ts +72 -0
  340. package/vendor/pi/examples/extensions/confirm-destructive.ts +59 -0
  341. package/vendor/pi/examples/extensions/custom-compaction.ts +117 -0
  342. package/vendor/pi/examples/extensions/custom-footer.ts +64 -0
  343. package/vendor/pi/examples/extensions/custom-header.ts +73 -0
  344. package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  345. package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  346. package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +19 -0
  347. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  348. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  349. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  350. package/vendor/pi/examples/extensions/debug-provider.ts +90 -0
  351. package/vendor/pi/examples/extensions/dirty-repo-guard.ts +56 -0
  352. package/vendor/pi/examples/extensions/doom-overlay/README.md +46 -0
  353. package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  354. package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  355. package/vendor/pi/examples/extensions/doom-overlay/doom/build.sh +152 -0
  356. package/vendor/pi/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  357. package/vendor/pi/examples/extensions/doom-overlay/doom-component.ts +132 -0
  358. package/vendor/pi/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  359. package/vendor/pi/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  360. package/vendor/pi/examples/extensions/doom-overlay/index.ts +74 -0
  361. package/vendor/pi/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  362. package/vendor/pi/examples/extensions/dynamic-resources/SKILL.md +8 -0
  363. package/vendor/pi/examples/extensions/dynamic-resources/dynamic.json +81 -0
  364. package/vendor/pi/examples/extensions/dynamic-resources/dynamic.md +5 -0
  365. package/vendor/pi/examples/extensions/dynamic-resources/index.ts +15 -0
  366. package/vendor/pi/examples/extensions/dynamic-tools.ts +74 -0
  367. package/vendor/pi/examples/extensions/entry-renderer.ts +41 -0
  368. package/vendor/pi/examples/extensions/event-bus.ts +43 -0
  369. package/vendor/pi/examples/extensions/file-trigger.ts +41 -0
  370. package/vendor/pi/examples/extensions/git-checkpoint.ts +53 -0
  371. package/vendor/pi/examples/extensions/git-merge-and-resolve.ts +115 -0
  372. package/vendor/pi/examples/extensions/github-issue-autocomplete.ts +185 -0
  373. package/vendor/pi/examples/extensions/gondolin/index.ts +531 -0
  374. package/vendor/pi/examples/extensions/gondolin/package-lock.json +185 -0
  375. package/vendor/pi/examples/extensions/gondolin/package.json +19 -0
  376. package/vendor/pi/examples/extensions/handoff.ts +190 -0
  377. package/vendor/pi/examples/extensions/hello.ts +26 -0
  378. package/vendor/pi/examples/extensions/hidden-thinking-label.ts +53 -0
  379. package/vendor/pi/examples/extensions/inline-bash.ts +94 -0
  380. package/vendor/pi/examples/extensions/input-transform-streaming.ts +39 -0
  381. package/vendor/pi/examples/extensions/input-transform.ts +43 -0
  382. package/vendor/pi/examples/extensions/interactive-shell.ts +196 -0
  383. package/vendor/pi/examples/extensions/jev-router.ts +113 -0
  384. package/vendor/pi/examples/extensions/mac-system-theme.ts +47 -0
  385. package/vendor/pi/examples/extensions/message-renderer.ts +59 -0
  386. package/vendor/pi/examples/extensions/minimal-mode.ts +353 -0
  387. package/vendor/pi/examples/extensions/modal-editor.ts +85 -0
  388. package/vendor/pi/examples/extensions/model-status.ts +31 -0
  389. package/vendor/pi/examples/extensions/notify.ts +57 -0
  390. package/vendor/pi/examples/extensions/overlay-qa-tests.ts +1450 -0
  391. package/vendor/pi/examples/extensions/overlay-test.ts +153 -0
  392. package/vendor/pi/examples/extensions/permission-gate.ts +34 -0
  393. package/vendor/pi/examples/extensions/pirate.ts +47 -0
  394. package/vendor/pi/examples/extensions/plan-mode/README.md +66 -0
  395. package/vendor/pi/examples/extensions/plan-mode/index.ts +394 -0
  396. package/vendor/pi/examples/extensions/plan-mode/utils.ts +168 -0
  397. package/vendor/pi/examples/extensions/preset.ts +436 -0
  398. package/vendor/pi/examples/extensions/project-trust.ts +64 -0
  399. package/vendor/pi/examples/extensions/prompt-customizer.ts +49 -0
  400. package/vendor/pi/examples/extensions/protected-paths.ts +30 -0
  401. package/vendor/pi/examples/extensions/provider-payload.ts +18 -0
  402. package/vendor/pi/examples/extensions/qna.ts +118 -0
  403. package/vendor/pi/examples/extensions/question.ts +286 -0
  404. package/vendor/pi/examples/extensions/questionnaire.ts +448 -0
  405. package/vendor/pi/examples/extensions/rainbow-editor.ts +88 -0
  406. package/vendor/pi/examples/extensions/reload-runtime.ts +37 -0
  407. package/vendor/pi/examples/extensions/rpc-demo.ts +118 -0
  408. package/vendor/pi/examples/extensions/sandbox/index.ts +321 -0
  409. package/vendor/pi/examples/extensions/sandbox/package-lock.json +92 -0
  410. package/vendor/pi/examples/extensions/sandbox/package.json +19 -0
  411. package/vendor/pi/examples/extensions/send-user-message.ts +97 -0
  412. package/vendor/pi/examples/extensions/session-name.ts +27 -0
  413. package/vendor/pi/examples/extensions/shutdown-command.ts +63 -0
  414. package/vendor/pi/examples/extensions/snake.ts +343 -0
  415. package/vendor/pi/examples/extensions/space-invaders.ts +560 -0
  416. package/vendor/pi/examples/extensions/ssh.ts +220 -0
  417. package/vendor/pi/examples/extensions/status-line.ts +32 -0
  418. package/vendor/pi/examples/extensions/structured-output.ts +65 -0
  419. package/vendor/pi/examples/extensions/subagent/README.md +177 -0
  420. package/vendor/pi/examples/extensions/subagent/agents/planner.md +37 -0
  421. package/vendor/pi/examples/extensions/subagent/agents/reviewer.md +35 -0
  422. package/vendor/pi/examples/extensions/subagent/agents/scout.md +50 -0
  423. package/vendor/pi/examples/extensions/subagent/agents/worker.md +24 -0
  424. package/vendor/pi/examples/extensions/subagent/agents.ts +157 -0
  425. package/vendor/pi/examples/extensions/subagent/index.ts +1036 -0
  426. package/vendor/pi/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  427. package/vendor/pi/examples/extensions/subagent/prompts/implement.md +10 -0
  428. package/vendor/pi/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  429. package/vendor/pi/examples/extensions/summarize.ts +199 -0
  430. package/vendor/pi/examples/extensions/system-prompt-header.ts +17 -0
  431. package/vendor/pi/examples/extensions/tic-tac-toe.ts +1008 -0
  432. package/vendor/pi/examples/extensions/timed-confirm.ts +70 -0
  433. package/vendor/pi/examples/extensions/titlebar-spinner.ts +58 -0
  434. package/vendor/pi/examples/extensions/todo.ts +297 -0
  435. package/vendor/pi/examples/extensions/tool-override.ts +144 -0
  436. package/vendor/pi/examples/extensions/tools.ts +146 -0
  437. package/vendor/pi/examples/extensions/trigger-compact.ts +50 -0
  438. package/vendor/pi/examples/extensions/truncated-tool.ts +195 -0
  439. package/vendor/pi/examples/extensions/widget-placement.ts +9 -0
  440. package/vendor/pi/examples/extensions/with-deps/index.ts +32 -0
  441. package/vendor/pi/examples/extensions/with-deps/package-lock.json +31 -0
  442. package/vendor/pi/examples/extensions/with-deps/package.json +22 -0
  443. package/vendor/pi/examples/extensions/working-indicator.ts +123 -0
  444. package/vendor/pi/examples/extensions/working-message-test.ts +25 -0
  445. package/vendor/pi/examples/rpc-client.ts +35 -0
  446. package/vendor/pi/examples/rpc-extension-ui.ts +661 -0
  447. package/vendor/pi/examples/sdk/01-minimal.ts +26 -0
  448. package/vendor/pi/examples/sdk/02-custom-model.ts +49 -0
  449. package/vendor/pi/examples/sdk/03-custom-prompt.ts +75 -0
  450. package/vendor/pi/examples/sdk/04-skills.ts +55 -0
  451. package/vendor/pi/examples/sdk/05-tools.ts +48 -0
  452. package/vendor/pi/examples/sdk/06-extensions.ts +99 -0
  453. package/vendor/pi/examples/sdk/07-context-files.ts +47 -0
  454. package/vendor/pi/examples/sdk/08-prompt-templates.ts +51 -0
  455. package/vendor/pi/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  456. package/vendor/pi/examples/sdk/10-settings.ts +53 -0
  457. package/vendor/pi/examples/sdk/11-sessions.ts +52 -0
  458. package/vendor/pi/examples/sdk/12-full-control.ts +74 -0
  459. package/vendor/pi/examples/sdk/13-session-runtime.ts +67 -0
  460. package/vendor/pi/examples/sdk/14-codemode-mcp.ts +61 -0
  461. package/vendor/pi/examples/sdk/README.md +141 -0
  462. package/vendor/pi/package.json +98 -0
  463. package/vendor/pi/schemas/keybindings.schema.json +393 -0
  464. package/vendor/pi/schemas/models.schema.json +1211 -0
  465. package/vendor/pi/schemas/settings.schema.json +783 -0
  466. package/vendor/pi/schemas/theme.schema.json +365 -0
  467. package/vendor/pi-ai/bedrock.js +4 -0
  468. package/vendor/pi-ai/oauth-load.js +4 -0
  469. package/vendor/quickjs.wasm +0 -0
  470. package/web/dist/assets/board-math-css-BmiXB1z5.js +2 -0
  471. package/web/dist/assets/index-DqWMdMkh.css +1 -0
  472. package/web/dist/assets/index-XBRXpnC5.js +1 -0
  473. package/web/dist/assets/index-btKNdkvc.js +525 -0
  474. package/web/dist/index.html +2 -2
  475. package/dist/agent-adapter/bg-wait.d.ts +0 -11
  476. package/dist/agent-adapter/bg-wait.js +0 -32
  477. package/dist/agent-adapter/capabilities.d.ts +0 -18
  478. package/dist/agent-adapter/capabilities.js +0 -39
  479. package/dist/agent-adapter/claude/active-capture-registry.d.ts +0 -7
  480. package/dist/agent-adapter/claude/active-capture-registry.js +0 -42
  481. package/dist/agent-adapter/claude/adapter.d.ts +0 -170
  482. package/dist/agent-adapter/claude/adapter.js +0 -459
  483. package/dist/agent-adapter/claude/assistant-blocks.d.ts +0 -5
  484. package/dist/agent-adapter/claude/assistant-blocks.js +0 -61
  485. package/dist/agent-adapter/claude/bg-task-tracker.d.ts +0 -103
  486. package/dist/agent-adapter/claude/bg-task-tracker.js +0 -164
  487. package/dist/agent-adapter/claude/cache-refresh.d.ts +0 -58
  488. package/dist/agent-adapter/claude/cache-refresh.js +0 -145
  489. package/dist/agent-adapter/claude/cache-touch.d.ts +0 -12
  490. package/dist/agent-adapter/claude/cache-touch.js +0 -75
  491. package/dist/agent-adapter/claude/compact-window.d.ts +0 -18
  492. package/dist/agent-adapter/claude/compact-window.js +0 -49
  493. package/dist/agent-adapter/claude/context-usage.d.ts +0 -28
  494. package/dist/agent-adapter/claude/context-usage.js +0 -173
  495. package/dist/agent-adapter/claude/defaults.d.ts +0 -42
  496. package/dist/agent-adapter/claude/defaults.js +0 -59
  497. package/dist/agent-adapter/claude/engine.d.ts +0 -75
  498. package/dist/agent-adapter/claude/engine.js +0 -139
  499. package/dist/agent-adapter/claude/event-parser.d.ts +0 -60
  500. package/dist/agent-adapter/claude/event-parser.js +0 -259
  501. package/dist/agent-adapter/claude/event-translator.d.ts +0 -45
  502. package/dist/agent-adapter/claude/event-translator.js +0 -98
  503. package/dist/agent-adapter/claude/hooks-builder.d.ts +0 -19
  504. package/dist/agent-adapter/claude/hooks-builder.js +0 -57
  505. package/dist/agent-adapter/claude/mcp-config.d.ts +0 -11
  506. package/dist/agent-adapter/claude/mcp-config.js +0 -131
  507. package/dist/agent-adapter/claude/remote-mcp-proxy.d.ts +0 -1
  508. package/dist/agent-adapter/claude/session-options.d.ts +0 -70
  509. package/dist/agent-adapter/claude/session-options.js +0 -148
  510. package/dist/agent-adapter/claude/spawn-args.d.ts +0 -70
  511. package/dist/agent-adapter/claude/spawn-args.js +0 -367
  512. package/dist/agent-adapter/claude/tool-summarizers.d.ts +0 -2
  513. package/dist/agent-adapter/claude/tool-summarizers.js +0 -20
  514. package/dist/agent-adapter/claude/transcript-clear.d.ts +0 -42
  515. package/dist/agent-adapter/claude/transcript-clear.js +0 -217
  516. package/dist/agent-adapter/claude/transcript-path.d.ts +0 -39
  517. package/dist/agent-adapter/claude/transcript-path.js +0 -114
  518. package/dist/agent-adapter/claude/turn-machine.d.ts +0 -219
  519. package/dist/agent-adapter/claude/turn-machine.js +0 -728
  520. package/dist/agent-adapter/claude/window-warmup.d.ts +0 -13
  521. package/dist/agent-adapter/claude/window-warmup.js +0 -38
  522. package/dist/agent-adapter/continuation-phase.d.ts +0 -128
  523. package/dist/agent-adapter/continuation-phase.js +0 -340
  524. package/dist/agent-adapter/engine-injections.d.ts +0 -47
  525. package/dist/agent-adapter/engine-injections.js +0 -80
  526. package/dist/agent-adapter/mcp-remote-fetch.d.ts +0 -1
  527. package/dist/agent-adapter/mcp-remote-fetch.js +0 -32
  528. package/dist/agent-adapter/normalize/event-types.d.ts +0 -125
  529. package/dist/agent-adapter/normalize/event-types.js +0 -1
  530. package/dist/agent-adapter/normalize/prompt-builder.d.ts +0 -22
  531. package/dist/agent-adapter/normalize/prompt-builder.js +0 -41
  532. package/dist/agent-adapter/normalize/tool-result-images.d.ts +0 -11
  533. package/dist/agent-adapter/normalize/tool-result-images.js +0 -32
  534. package/dist/agent-adapter/pi/adapter.d.ts +0 -125
  535. package/dist/agent-adapter/pi/adapter.js +0 -275
  536. package/dist/agent-adapter/pi/agent-dir.d.ts +0 -57
  537. package/dist/agent-adapter/pi/agent-dir.js +0 -154
  538. package/dist/agent-adapter/pi/background-subagent.d.ts +0 -26
  539. package/dist/agent-adapter/pi/background-subagent.js +0 -1
  540. package/dist/agent-adapter/pi/child-events.d.ts +0 -13
  541. package/dist/agent-adapter/pi/child-events.js +0 -96
  542. package/dist/agent-adapter/pi/child-runner.d.ts +0 -31
  543. package/dist/agent-adapter/pi/child-runner.js +0 -133
  544. package/dist/agent-adapter/pi/child-session.d.ts +0 -28
  545. package/dist/agent-adapter/pi/child-session.js +0 -70
  546. package/dist/agent-adapter/pi/custom-catalog.d.ts +0 -10
  547. package/dist/agent-adapter/pi/custom-catalog.js +0 -38
  548. package/dist/agent-adapter/pi/defaults.d.ts +0 -7
  549. package/dist/agent-adapter/pi/defaults.js +0 -11
  550. package/dist/agent-adapter/pi/discovery.d.ts +0 -37
  551. package/dist/agent-adapter/pi/discovery.js +0 -33
  552. package/dist/agent-adapter/pi/engine.d.ts +0 -66
  553. package/dist/agent-adapter/pi/engine.js +0 -180
  554. package/dist/agent-adapter/pi/event-parser.d.ts +0 -43
  555. package/dist/agent-adapter/pi/event-parser.js +0 -446
  556. package/dist/agent-adapter/pi/extensions.d.ts +0 -33
  557. package/dist/agent-adapter/pi/extensions.js +0 -58
  558. package/dist/agent-adapter/pi/hook-bridge.d.ts +0 -54
  559. package/dist/agent-adapter/pi/hook-bridge.js +0 -394
  560. package/dist/agent-adapter/pi/image-first.d.ts +0 -3
  561. package/dist/agent-adapter/pi/image-first.js +0 -31
  562. package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +0 -32
  563. package/dist/agent-adapter/pi/mcp-bridge-logic.js +0 -63
  564. package/dist/agent-adapter/pi/mcp-bridge.d.ts +0 -65
  565. package/dist/agent-adapter/pi/mcp-bridge.js +0 -389
  566. package/dist/agent-adapter/pi/native-tool-policy.d.ts +0 -3
  567. package/dist/agent-adapter/pi/native-tool-policy.js +0 -11
  568. package/dist/agent-adapter/pi/pi-session.d.ts +0 -185
  569. package/dist/agent-adapter/pi/pi-session.js +0 -656
  570. package/dist/agent-adapter/pi/providers-config.d.ts +0 -60
  571. package/dist/agent-adapter/pi/providers-config.js +0 -96
  572. package/dist/agent-adapter/pi/quota-probe.d.ts +0 -12
  573. package/dist/agent-adapter/pi/quota-probe.js +0 -33
  574. package/dist/agent-adapter/pi/quota-sink.d.ts +0 -33
  575. package/dist/agent-adapter/pi/quota-sink.js +0 -57
  576. package/dist/agent-adapter/pi/runtime-settings.d.ts +0 -9
  577. package/dist/agent-adapter/pi/runtime-settings.js +0 -53
  578. package/dist/agent-adapter/pi/runtime.d.ts +0 -48
  579. package/dist/agent-adapter/pi/runtime.js +0 -163
  580. package/dist/agent-adapter/pi/session-files.d.ts +0 -2
  581. package/dist/agent-adapter/pi/session-files.js +0 -15
  582. package/dist/agent-adapter/pi/session-options.d.ts +0 -86
  583. package/dist/agent-adapter/pi/session-options.js +0 -162
  584. package/dist/agent-adapter/pi/session-support.d.ts +0 -54
  585. package/dist/agent-adapter/pi/session-support.js +0 -101
  586. package/dist/agent-adapter/pi/subagent-bridge.d.ts +0 -17
  587. package/dist/agent-adapter/pi/subagent-bridge.js +0 -1
  588. package/dist/agent-adapter/pi/subagent.d.ts +0 -100
  589. package/dist/agent-adapter/pi/subagent.js +0 -199
  590. package/dist/agent-adapter/pi/tool-shims.d.ts +0 -32
  591. package/dist/agent-adapter/pi/tool-shims.js +0 -148
  592. package/dist/agent-adapter/pi/ui-context.d.ts +0 -20
  593. package/dist/agent-adapter/pi/ui-context.js +0 -92
  594. package/dist/agent-adapter/pi/web-fetch.d.ts +0 -13
  595. package/dist/agent-adapter/pi/web-fetch.js +0 -196
  596. package/dist/agent-adapter/pi/web-search.d.ts +0 -9
  597. package/dist/agent-adapter/pi/web-search.js +0 -517
  598. package/dist/agent-adapter/run-events.d.ts +0 -165
  599. package/dist/agent-adapter/run-events.js +0 -119
  600. package/dist/agent-adapter/types.d.ts +0 -323
  601. package/dist/agent-adapter/types.js +0 -3
  602. package/dist/core/agents/roles.d.ts +0 -50
  603. package/dist/core/agents/roles.js +0 -176
  604. package/dist/core/agents/subagent/attribution.d.ts +0 -15
  605. package/dist/core/agents/subagent/attribution.js +0 -60
  606. package/dist/core/agents/subagent/catalog.d.ts +0 -65
  607. package/dist/core/agents/subagent/catalog.js +0 -200
  608. package/dist/core/agents/subagent/model-spec.d.ts +0 -28
  609. package/dist/core/agents/subagent/model-spec.js +0 -39
  610. package/dist/core/agents/subagent/orchestrate.d.ts +0 -25
  611. package/dist/core/agents/subagent/orchestrate.js +0 -92
  612. package/dist/core/agents/subagent/schema.d.ts +0 -12
  613. package/dist/core/agents/subagent/schema.js +0 -51
  614. package/dist/core/agents/subagent/types.d.ts +0 -84
  615. package/dist/core/agents/subagent/types.js +0 -1
  616. package/dist/core/agents/subagent/usage.d.ts +0 -8
  617. package/dist/core/agents/subagent/usage.js +0 -32
  618. package/dist/core/anthropic-model-discovery.d.ts +0 -54
  619. package/dist/core/anthropic-model-discovery.js +0 -156
  620. package/dist/core/anthropic-models.d.ts +0 -1
  621. package/dist/core/anthropic-models.js +0 -13
  622. package/dist/core/async-mutex.d.ts +0 -6
  623. package/dist/core/async-mutex.js +0 -32
  624. package/dist/core/atomic-write.d.ts +0 -9
  625. package/dist/core/atomic-write.js +0 -104
  626. package/dist/core/auth.d.ts +0 -40
  627. package/dist/core/auth.js +0 -94
  628. package/dist/core/board-action.d.ts +0 -19
  629. package/dist/core/board-action.js +0 -24
  630. package/dist/core/builtin-layer.d.ts +0 -22
  631. package/dist/core/builtin-layer.js +0 -45
  632. package/dist/core/cached-scan.d.ts +0 -42
  633. package/dist/core/cached-scan.js +0 -95
  634. package/dist/core/calver.d.ts +0 -1
  635. package/dist/core/calver.js +0 -25
  636. package/dist/core/claude-credentials.d.ts +0 -85
  637. package/dist/core/claude-credentials.js +0 -231
  638. package/dist/core/cli-utils.d.ts +0 -56
  639. package/dist/core/cli-utils.js +0 -70
  640. package/dist/core/codex-quota.d.ts +0 -27
  641. package/dist/core/codex-quota.js +0 -55
  642. package/dist/core/codex-token.d.ts +0 -4
  643. package/dist/core/codex-token.js +0 -26
  644. package/dist/core/config-generator.d.ts +0 -17
  645. package/dist/core/config-generator.js +0 -181
  646. package/dist/core/debug-mode.d.ts +0 -15
  647. package/dist/core/debug-mode.js +0 -22
  648. package/dist/core/exec-async.d.ts +0 -28
  649. package/dist/core/exec-async.js +0 -48
  650. package/dist/core/file-lock.d.ts +0 -15
  651. package/dist/core/file-lock.js +0 -164
  652. package/dist/core/format-duration.d.ts +0 -7
  653. package/dist/core/format-duration.js +0 -23
  654. package/dist/core/gateway-generator.d.ts +0 -135
  655. package/dist/core/gateway-generator.js +0 -521
  656. package/dist/core/git-availability.d.ts +0 -2
  657. package/dist/core/git-availability.js +0 -43
  658. package/dist/core/hook-bus.d.ts +0 -25
  659. package/dist/core/hook-bus.js +0 -106
  660. package/dist/core/hook-exec.d.ts +0 -15
  661. package/dist/core/hook-exec.js +0 -86
  662. package/dist/core/hook-scripts.d.ts +0 -19
  663. package/dist/core/hook-scripts.js +0 -30
  664. package/dist/core/i18n.d.ts +0 -19
  665. package/dist/core/i18n.js +0 -42
  666. package/dist/core/icons.d.ts +0 -72
  667. package/dist/core/icons.js +0 -71
  668. package/dist/core/json-repository.d.ts +0 -78
  669. package/dist/core/json-repository.js +0 -154
  670. package/dist/core/locales/en.d.ts +0 -910
  671. package/dist/core/locales/en.js +0 -32
  672. package/dist/core/locales/slices/commands.d.ts +0 -301
  673. package/dist/core/locales/slices/commands.js +0 -634
  674. package/dist/core/locales/slices/init.d.ts +0 -152
  675. package/dist/core/locales/slices/init.js +0 -429
  676. package/dist/core/locales/slices/interactions.d.ts +0 -47
  677. package/dist/core/locales/slices/interactions.js +0 -99
  678. package/dist/core/locales/slices/lang.d.ts +0 -8
  679. package/dist/core/locales/slices/lang.js +0 -15
  680. package/dist/core/locales/slices/notices.d.ts +0 -78
  681. package/dist/core/locales/slices/notices.js +0 -156
  682. package/dist/core/locales/slices/providers.d.ts +0 -43
  683. package/dist/core/locales/slices/providers.js +0 -87
  684. package/dist/core/locales/slices/scheduling.d.ts +0 -33
  685. package/dist/core/locales/slices/scheduling.js +0 -65
  686. package/dist/core/locales/slices/startup.d.ts +0 -10
  687. package/dist/core/locales/slices/startup.js +0 -19
  688. package/dist/core/locales/slices/status.d.ts +0 -48
  689. package/dist/core/locales/slices/status.js +0 -109
  690. package/dist/core/locales/slices/tui.d.ts +0 -93
  691. package/dist/core/locales/slices/tui.js +0 -192
  692. package/dist/core/locales/slices/uiextra.d.ts +0 -49
  693. package/dist/core/locales/slices/uiextra.js +0 -102
  694. package/dist/core/locales/slices/uimsg.d.ts +0 -74
  695. package/dist/core/locales/slices/uimsg.js +0 -158
  696. package/dist/core/locales/zh.d.ts +0 -5
  697. package/dist/core/locales/zh.js +0 -30
  698. package/dist/core/log.d.ts +0 -13
  699. package/dist/core/log.js +0 -157
  700. package/dist/core/loopback-http.d.ts +0 -6
  701. package/dist/core/loopback-http.js +0 -43
  702. package/dist/core/mcp-bundles.d.ts +0 -8
  703. package/dist/core/mcp-bundles.js +0 -47
  704. package/dist/core/mcp-timeout.d.ts +0 -1
  705. package/dist/core/mcp-timeout.js +0 -1
  706. package/dist/core/mcp-tool-gate.d.ts +0 -25
  707. package/dist/core/mcp-tool-gate.js +0 -97
  708. package/dist/core/media-types.d.ts +0 -20
  709. package/dist/core/media-types.js +0 -63
  710. package/dist/core/models-generator.d.ts +0 -29
  711. package/dist/core/models-generator.js +0 -82
  712. package/dist/core/native-name.d.ts +0 -4
  713. package/dist/core/native-name.js +0 -57
  714. package/dist/core/paths.d.ts +0 -63
  715. package/dist/core/paths.js +0 -105
  716. package/dist/core/pi-sdk.d.ts +0 -38
  717. package/dist/core/pi-session-filename.d.ts +0 -10
  718. package/dist/core/pi-session-filename.js +0 -49
  719. package/dist/core/platform-settings-spec.d.ts +0 -47
  720. package/dist/core/platform-settings-spec.js +0 -28
  721. package/dist/core/private-dir.d.ts +0 -13
  722. package/dist/core/private-dir.js +0 -48
  723. package/dist/core/process-command-line.d.ts +0 -6
  724. package/dist/core/process-command-line.js +0 -39
  725. package/dist/core/prompt-template.d.ts +0 -14
  726. package/dist/core/prompt-template.js +0 -29
  727. package/dist/core/rebuild-progress.d.ts +0 -59
  728. package/dist/core/rebuild-progress.js +0 -106
  729. package/dist/core/resilient-watch.d.ts +0 -28
  730. package/dist/core/resilient-watch.js +0 -108
  731. package/dist/core/resume-reminder.d.ts +0 -5
  732. package/dist/core/resume-reminder.js +0 -12
  733. package/dist/core/run-registry.d.ts +0 -134
  734. package/dist/core/run-registry.js +0 -256
  735. package/dist/core/runtime-env.d.ts +0 -1
  736. package/dist/core/runtime-env.js +0 -11
  737. package/dist/core/session-holds.d.ts +0 -88
  738. package/dist/core/session-holds.js +0 -168
  739. package/dist/core/session-state.d.ts +0 -32
  740. package/dist/core/session-state.js +0 -39
  741. package/dist/core/session-todos.d.ts +0 -12
  742. package/dist/core/session-todos.js +0 -44
  743. package/dist/core/settings-migration.d.ts +0 -5
  744. package/dist/core/settings-migration.js +0 -128
  745. package/dist/core/settings-spec.d.ts +0 -296
  746. package/dist/core/settings-spec.js +0 -305
  747. package/dist/core/settings.d.ts +0 -19
  748. package/dist/core/settings.js +0 -492
  749. package/dist/core/short-session-id.d.ts +0 -2
  750. package/dist/core/short-session-id.js +0 -4
  751. package/dist/core/singleton-lock.d.ts +0 -39
  752. package/dist/core/singleton-lock.js +0 -127
  753. package/dist/core/status-format.d.ts +0 -70
  754. package/dist/core/status-format.js +0 -59
  755. package/dist/core/subagent-spawn.d.ts +0 -40
  756. package/dist/core/subagent-spawn.js +0 -47
  757. package/dist/core/team-action.d.ts +0 -28
  758. package/dist/core/team-action.js +0 -65
  759. package/dist/core/todo.d.ts +0 -18
  760. package/dist/core/todo.js +0 -79
  761. package/dist/core/tool-names.d.ts +0 -12
  762. package/dist/core/tool-names.js +0 -65
  763. package/dist/core/types/agent-types.d.ts +0 -171
  764. package/dist/core/types/agent-types.js +0 -1
  765. package/dist/core/types/environment-types.d.ts +0 -50
  766. package/dist/core/types/environment-types.js +0 -1
  767. package/dist/core/utils.d.ts +0 -72
  768. package/dist/core/utils.js +0 -176
  769. package/dist/core/version.d.ts +0 -6
  770. package/dist/core/version.js +0 -11
  771. package/dist/core/workspace-filenames.d.ts +0 -9
  772. package/dist/core/workspace-filenames.js +0 -61
  773. package/dist/domain/agents/agent-state.d.ts +0 -19
  774. package/dist/domain/agents/agent-state.js +0 -73
  775. package/dist/domain/agents/agent-switch.d.ts +0 -16
  776. package/dist/domain/agents/agent-switch.js +0 -30
  777. package/dist/domain/agents/config.d.ts +0 -20
  778. package/dist/domain/agents/config.js +0 -89
  779. package/dist/domain/agents/engine-selection.d.ts +0 -21
  780. package/dist/domain/agents/engine-selection.js +0 -37
  781. package/dist/domain/agents/environments/entities.d.ts +0 -50
  782. package/dist/domain/agents/environments/entities.js +0 -94
  783. package/dist/domain/agents/environments/file-refs.d.ts +0 -20
  784. package/dist/domain/agents/environments/file-refs.js +0 -51
  785. package/dist/domain/agents/environments/index.d.ts +0 -7
  786. package/dist/domain/agents/environments/index.js +0 -9
  787. package/dist/domain/agents/environments/paths.d.ts +0 -7
  788. package/dist/domain/agents/environments/paths.js +0 -9
  789. package/dist/domain/agents/environments/prompt-includes.d.ts +0 -1
  790. package/dist/domain/agents/environments/prompt-includes.js +0 -91
  791. package/dist/domain/agents/environments/registry.d.ts +0 -17
  792. package/dist/domain/agents/environments/registry.js +0 -162
  793. package/dist/domain/agents/environments/resolve.d.ts +0 -11
  794. package/dist/domain/agents/environments/resolve.js +0 -36
  795. package/dist/domain/agents/environments/schema.d.ts +0 -68
  796. package/dist/domain/agents/environments/schema.js +0 -114
  797. package/dist/domain/agents/environments/schema.parity.d.ts +0 -1
  798. package/dist/domain/agents/environments/schema.parity.js +0 -7
  799. package/dist/domain/agents/environments/system-prompt.d.ts +0 -37
  800. package/dist/domain/agents/environments/system-prompt.js +0 -110
  801. package/dist/domain/agents/index.d.ts +0 -6
  802. package/dist/domain/agents/index.js +0 -7
  803. package/dist/domain/agents/model-selection.d.ts +0 -30
  804. package/dist/domain/agents/model-selection.js +0 -111
  805. package/dist/domain/agents/models.d.ts +0 -12
  806. package/dist/domain/agents/models.js +0 -94
  807. package/dist/domain/agents/provider-run-lifecycle.d.ts +0 -11
  808. package/dist/domain/agents/provider-run-lifecycle.js +0 -17
  809. package/dist/domain/agents/subagent/background-spend.d.ts +0 -17
  810. package/dist/domain/agents/subagent/background-spend.js +0 -42
  811. package/dist/domain/agents/subagent/foreign.d.ts +0 -13
  812. package/dist/domain/agents/subagent/foreign.js +0 -30
  813. package/dist/domain/agents/subagent/registry.d.ts +0 -106
  814. package/dist/domain/agents/subagent/registry.js +0 -272
  815. package/dist/domain/agents/subagent/runner.d.ts +0 -61
  816. package/dist/domain/agents/subagent/runner.js +0 -301
  817. package/dist/domain/agents/subagent/service.d.ts +0 -26
  818. package/dist/domain/agents/subagent/service.js +0 -68
  819. package/dist/domain/auth/anthropic-env.d.ts +0 -20
  820. package/dist/domain/auth/anthropic-env.js +0 -132
  821. package/dist/domain/auth/auth-events.d.ts +0 -18
  822. package/dist/domain/auth/auth-events.js +0 -34
  823. package/dist/domain/auth/auth-format.d.ts +0 -2
  824. package/dist/domain/auth/auth-format.js +0 -53
  825. package/dist/domain/auth/auth-status.d.ts +0 -63
  826. package/dist/domain/auth/auth-status.js +0 -286
  827. package/dist/domain/auth/auth-watch.d.ts +0 -16
  828. package/dist/domain/auth/auth-watch.js +0 -136
  829. package/dist/domain/auth/cc-auth-cli.d.ts +0 -30
  830. package/dist/domain/auth/cc-login.d.ts +0 -7
  831. package/dist/domain/auth/cc-login.js +0 -20
  832. package/dist/domain/auth/cc-subscription.d.ts +0 -18
  833. package/dist/domain/auth/cc-subscription.js +0 -54
  834. package/dist/domain/auth/claude-account-credentials.d.ts +0 -13
  835. package/dist/domain/auth/claude-account-credentials.js +0 -22
  836. package/dist/domain/auth/claude-user-settings.d.ts +0 -22
  837. package/dist/domain/auth/claude-user-settings.js +0 -104
  838. package/dist/domain/auth/codex-credentials.d.ts +0 -13
  839. package/dist/domain/auth/codex-credentials.js +0 -25
  840. package/dist/domain/auth/gateway-sync.d.ts +0 -19
  841. package/dist/domain/auth/gateway-sync.js +0 -46
  842. package/dist/domain/auth/index.d.ts +0 -14
  843. package/dist/domain/auth/index.js +0 -14
  844. package/dist/domain/auth/login-flow.d.ts +0 -141
  845. package/dist/domain/auth/login-flow.js +0 -339
  846. package/dist/domain/auth/login-service.d.ts +0 -33
  847. package/dist/domain/auth/login-service.js +0 -65
  848. package/dist/domain/auth/logout.d.ts +0 -32
  849. package/dist/domain/auth/logout.js +0 -156
  850. package/dist/domain/auth/pi-login.d.ts +0 -26
  851. package/dist/domain/auth/pi-login.js +0 -70
  852. package/dist/domain/auth/pi-oauth.d.ts +0 -26
  853. package/dist/domain/auth/pi-oauth.js +0 -85
  854. package/dist/domain/auth/pi-runtime.d.ts +0 -82
  855. package/dist/domain/auth/pi-runtime.js +0 -40
  856. package/dist/domain/benchmark/accounting-reconciliation.d.ts +0 -117
  857. package/dist/domain/benchmark/accounting-reconciliation.js +0 -174
  858. package/dist/domain/benchmark/atif.d.ts +0 -42
  859. package/dist/domain/benchmark/atif.js +0 -263
  860. package/dist/domain/benchmark/attempt-record.d.ts +0 -167
  861. package/dist/domain/benchmark/attempt-record.js +0 -113
  862. package/dist/domain/benchmark/benchmark-types.d.ts +0 -17
  863. package/dist/domain/benchmark/benchmark-types.js +0 -1
  864. package/dist/domain/benchmark/composite-manifest.d.ts +0 -117
  865. package/dist/domain/benchmark/composite-manifest.js +0 -477
  866. package/dist/domain/benchmark/decimal-text.d.ts +0 -22
  867. package/dist/domain/benchmark/decimal-text.js +0 -42
  868. package/dist/domain/benchmark/identity.d.ts +0 -39
  869. package/dist/domain/benchmark/identity.js +0 -70
  870. package/dist/domain/benchmark/journal.d.ts +0 -47
  871. package/dist/domain/benchmark/journal.js +0 -254
  872. package/dist/domain/benchmark/manifest-contract.d.ts +0 -30
  873. package/dist/domain/benchmark/manifest-contract.js +0 -118
  874. package/dist/domain/benchmark/production-attempt-identity.d.ts +0 -73
  875. package/dist/domain/benchmark/production-attempt-identity.js +0 -372
  876. package/dist/domain/benchmark/production-attempt-journal.d.ts +0 -38
  877. package/dist/domain/benchmark/production-attempt-journal.js +0 -267
  878. package/dist/domain/benchmark/production-benchmark-evidence.d.ts +0 -2
  879. package/dist/domain/benchmark/production-benchmark-evidence.js +0 -67
  880. package/dist/domain/benchmark/production-evidence-export.d.ts +0 -14
  881. package/dist/domain/benchmark/production-evidence-export.js +0 -134
  882. package/dist/domain/benchmark/production-evidence-journal.d.ts +0 -11
  883. package/dist/domain/benchmark/production-evidence-journal.js +0 -81
  884. package/dist/domain/benchmark/production-evidence-projection.d.ts +0 -39
  885. package/dist/domain/benchmark/production-evidence-projection.js +0 -392
  886. package/dist/domain/benchmark/role-surface.d.ts +0 -4
  887. package/dist/domain/benchmark/role-surface.js +0 -117
  888. package/dist/domain/benchmark/session-evidence.d.ts +0 -7
  889. package/dist/domain/benchmark/session-evidence.js +0 -34
  890. package/dist/domain/boards/board-context.d.ts +0 -17
  891. package/dist/domain/boards/board-context.js +0 -11
  892. package/dist/domain/boards/board-paths.d.ts +0 -18
  893. package/dist/domain/boards/board-paths.js +0 -32
  894. package/dist/domain/boards/board-service.d.ts +0 -50
  895. package/dist/domain/boards/board-service.js +0 -146
  896. package/dist/domain/boards/board-watcher.d.ts +0 -36
  897. package/dist/domain/boards/board-watcher.js +0 -284
  898. package/dist/domain/boards/decision-projection.d.ts +0 -46
  899. package/dist/domain/boards/decision-projection.js +0 -44
  900. package/dist/domain/browser/broker.d.ts +0 -99
  901. package/dist/domain/browser/broker.js +0 -487
  902. package/dist/domain/costs/account-reset.d.ts +0 -30
  903. package/dist/domain/costs/account-reset.js +0 -98
  904. package/dist/domain/costs/aistatus-config.d.ts +0 -27
  905. package/dist/domain/costs/aistatus-config.js +0 -56
  906. package/dist/domain/costs/claude-account.d.ts +0 -34
  907. package/dist/domain/costs/claude-account.js +0 -170
  908. package/dist/domain/costs/codex-account.d.ts +0 -55
  909. package/dist/domain/costs/codex-account.js +0 -155
  910. package/dist/domain/costs/cost-tracker.d.ts +0 -181
  911. package/dist/domain/costs/cost-tracker.js +0 -350
  912. package/dist/domain/costs/gateway-manager.d.ts +0 -6
  913. package/dist/domain/costs/gateway-manager.js +0 -225
  914. package/dist/domain/costs/rate-limit-throttle.d.ts +0 -78
  915. package/dist/domain/costs/rate-limit-throttle.js +0 -502
  916. package/dist/domain/costs/reset-account.d.ts +0 -36
  917. package/dist/domain/costs/reset-account.js +0 -5
  918. package/dist/domain/costs/resume-registry.d.ts +0 -30
  919. package/dist/domain/costs/resume-registry.js +0 -108
  920. package/dist/domain/costs/usage-service.d.ts +0 -80
  921. package/dist/domain/costs/usage-service.js +0 -618
  922. package/dist/domain/costs/usage-store.d.ts +0 -83
  923. package/dist/domain/costs/usage-store.js +0 -104
  924. package/dist/domain/executions/registry.d.ts +0 -47
  925. package/dist/domain/executions/registry.js +0 -100
  926. package/dist/domain/hooks/hook-view.d.ts +0 -22
  927. package/dist/domain/hooks/hook-view.js +0 -34
  928. package/dist/domain/mcp/bundled-server.d.ts +0 -19
  929. package/dist/domain/mcp/feishu/client.d.ts +0 -46
  930. package/dist/domain/mcp/feishu/client.js +0 -91
  931. package/dist/domain/mcp/feishu/file.d.ts +0 -14
  932. package/dist/domain/mcp/feishu/file.js +0 -88
  933. package/dist/domain/mcp/feishu/types.d.ts +0 -31
  934. package/dist/domain/mcp/feishu/types.js +0 -34
  935. package/dist/domain/mcp/feishu/user-auth.d.ts +0 -140
  936. package/dist/domain/mcp/feishu/user-auth.js +0 -278
  937. package/dist/domain/mcp/tools/agents-md.d.ts +0 -16
  938. package/dist/domain/mcp/tools/agents-md.js +0 -34
  939. package/dist/domain/mcp/tools/catalog-owner.d.ts +0 -3
  940. package/dist/domain/mcp/tools/catalog-owner.js +0 -23
  941. package/dist/domain/mcp/tools/context.d.ts +0 -70
  942. package/dist/domain/mcp/tools/context.js +0 -107
  943. package/dist/domain/mcp/tools/cost.d.ts +0 -2
  944. package/dist/domain/mcp/tools/cost.js +0 -56
  945. package/dist/domain/mcp/tools/executions.d.ts +0 -2
  946. package/dist/domain/mcp/tools/executions.js +0 -71
  947. package/dist/domain/mcp/tools/interaction-ask.d.ts +0 -37
  948. package/dist/domain/mcp/tools/interaction-ask.js +0 -131
  949. package/dist/domain/mcp/tools/interaction-plan.d.ts +0 -34
  950. package/dist/domain/mcp/tools/interaction-plan.js +0 -116
  951. package/dist/domain/mcp/tools/remote-devices.d.ts +0 -9
  952. package/dist/domain/mcp/tools/remote-devices.js +0 -28
  953. package/dist/domain/mcp/tools/remote-file.d.ts +0 -24
  954. package/dist/domain/mcp/tools/remote-file.js +0 -52
  955. package/dist/domain/mcp/tools/remote-ops.d.ts +0 -3
  956. package/dist/domain/mcp/tools/remote-ops.js +0 -359
  957. package/dist/domain/mcp/tools/slack.d.ts +0 -23
  958. package/dist/domain/mcp/tools/slack.js +0 -106
  959. package/dist/domain/mcp/tools/subagent.d.ts +0 -23
  960. package/dist/domain/mcp/tools/subagent.js +0 -179
  961. package/dist/domain/mcp/tools/time.d.ts +0 -2
  962. package/dist/domain/mcp/tools/time.js +0 -62
  963. package/dist/domain/mcp/tools/ui-board.d.ts +0 -12
  964. package/dist/domain/mcp/tools/ui-board.js +0 -48
  965. package/dist/domain/mcp/tools/ui-decision.d.ts +0 -3
  966. package/dist/domain/mcp/tools/ui-decision.js +0 -37
  967. package/dist/domain/mcp/tools/ui-file.d.ts +0 -3
  968. package/dist/domain/mcp/tools/ui-file.js +0 -70
  969. package/dist/domain/mcp/tools/ui-view.d.ts +0 -3
  970. package/dist/domain/mcp/tools/ui-view.js +0 -44
  971. package/dist/domain/mcp/tools/waitpoint.d.ts +0 -28
  972. package/dist/domain/mcp/tools/waitpoint.js +0 -109
  973. package/dist/domain/mcp/tools/workers.d.ts +0 -5
  974. package/dist/domain/mcp/tools/workers.js +0 -77
  975. package/dist/domain/memory/agents-md-injector.d.ts +0 -25
  976. package/dist/domain/memory/agents-md-injector.js +0 -58
  977. package/dist/domain/memory/consolidate.d.ts +0 -56
  978. package/dist/domain/memory/consolidate.js +0 -419
  979. package/dist/domain/memory/index-regen.d.ts +0 -30
  980. package/dist/domain/memory/index-regen.js +0 -334
  981. package/dist/domain/memory/rules-loader.d.ts +0 -6
  982. package/dist/domain/memory/rules-loader.js +0 -13
  983. package/dist/domain/memory/user-context.d.ts +0 -5
  984. package/dist/domain/memory/user-context.js +0 -32
  985. package/dist/domain/memory/watcher.d.ts +0 -8
  986. package/dist/domain/memory/watcher.js +0 -135
  987. package/dist/domain/monitor/disk-monitor.d.ts +0 -17
  988. package/dist/domain/monitor/disk-monitor.js +0 -117
  989. package/dist/domain/monitor/event-loop-monitor.d.ts +0 -33
  990. package/dist/domain/monitor/event-loop-monitor.js +0 -60
  991. package/dist/domain/monitor/gpu-monitor.d.ts +0 -26
  992. package/dist/domain/monitor/gpu-monitor.js +0 -132
  993. package/dist/domain/pi-providers/custom-provider-model.d.ts +0 -49
  994. package/dist/domain/pi-providers/custom-provider-model.js +0 -116
  995. package/dist/domain/pi-providers/custom-provider-service.d.ts +0 -57
  996. package/dist/domain/pi-providers/custom-provider-service.js +0 -153
  997. package/dist/domain/pi-providers/gateway-route-store.d.ts +0 -23
  998. package/dist/domain/pi-providers/gateway-route-store.js +0 -74
  999. package/dist/domain/pi-providers/index.d.ts +0 -3
  1000. package/dist/domain/pi-providers/index.js +0 -3
  1001. package/dist/domain/pi-providers/models-json-store.d.ts +0 -6
  1002. package/dist/domain/pi-providers/models-json-store.js +0 -73
  1003. package/dist/domain/plugins/agent-plugins-v1.d.ts +0 -58
  1004. package/dist/domain/plugins/agent-plugins-v1.js +0 -84
  1005. package/dist/domain/plugins/authoring.d.ts +0 -39
  1006. package/dist/domain/plugins/authoring.js +0 -320
  1007. package/dist/domain/plugins/builtin.d.ts +0 -25
  1008. package/dist/domain/plugins/builtin.js +0 -44
  1009. package/dist/domain/plugins/catalog-types.d.ts +0 -89
  1010. package/dist/domain/plugins/catalog-types.js +0 -39
  1011. package/dist/domain/plugins/catalog.d.ts +0 -39
  1012. package/dist/domain/plugins/catalog.js +0 -482
  1013. package/dist/domain/plugins/conversation-skills.d.ts +0 -10
  1014. package/dist/domain/plugins/conversation-skills.js +0 -22
  1015. package/dist/domain/plugins/fs-helpers.d.ts +0 -9
  1016. package/dist/domain/plugins/fs-helpers.js +0 -107
  1017. package/dist/domain/plugins/mcp.d.ts +0 -6
  1018. package/dist/domain/plugins/mcp.js +0 -223
  1019. package/dist/domain/plugins/runtime-gc.d.ts +0 -10
  1020. package/dist/domain/plugins/runtime-gc.js +0 -68
  1021. package/dist/domain/plugins/runtime.d.ts +0 -21
  1022. package/dist/domain/plugins/runtime.js +0 -554
  1023. package/dist/domain/plugins/skill-projection.d.ts +0 -19
  1024. package/dist/domain/plugins/skill-projection.js +0 -193
  1025. package/dist/domain/plugins/skill.d.ts +0 -14
  1026. package/dist/domain/plugins/skill.js +0 -145
  1027. package/dist/domain/projects/index.d.ts +0 -3
  1028. package/dist/domain/projects/index.js +0 -3
  1029. package/dist/domain/projects/project-store.d.ts +0 -72
  1030. package/dist/domain/projects/project-store.js +0 -240
  1031. package/dist/domain/projects/project-types.d.ts +0 -11
  1032. package/dist/domain/projects/project-types.js +0 -1
  1033. package/dist/domain/remote/client-bootstrap.d.ts +0 -1
  1034. package/dist/domain/remote/client-bootstrap.js +0 -126
  1035. package/dist/domain/remote/client-hot-reload.d.ts +0 -40
  1036. package/dist/domain/remote/client-hot-reload.js +0 -269
  1037. package/dist/domain/remote/client-lifecycle.d.ts +0 -32
  1038. package/dist/domain/remote/client-lifecycle.js +0 -382
  1039. package/dist/domain/remote/client-manager.d.ts +0 -54
  1040. package/dist/domain/remote/client-manager.js +0 -320
  1041. package/dist/domain/remote/client-pids.d.ts +0 -13
  1042. package/dist/domain/remote/client-pids.js +0 -43
  1043. package/dist/domain/remote/client-protocol.d.ts +0 -1
  1044. package/dist/domain/remote/client-protocol.js +0 -1
  1045. package/dist/domain/remote/client-remove.d.ts +0 -61
  1046. package/dist/domain/remote/client-remove.js +0 -129
  1047. package/dist/domain/remote/client-ssh-tunnel.d.ts +0 -79
  1048. package/dist/domain/remote/client-ssh-tunnel.js +0 -352
  1049. package/dist/domain/remote/device-browser.d.ts +0 -38
  1050. package/dist/domain/remote/device-browser.js +0 -158
  1051. package/dist/domain/remote/device-chrome-commands.d.ts +0 -18
  1052. package/dist/domain/remote/device-chrome-commands.js +0 -125
  1053. package/dist/domain/remote/device-file.d.ts +0 -51
  1054. package/dist/domain/remote/device-file.js +0 -193
  1055. package/dist/domain/remote/device-port.d.ts +0 -23
  1056. package/dist/domain/remote/device-port.js +0 -192
  1057. package/dist/domain/remote/local-client-install.d.ts +0 -32
  1058. package/dist/domain/remote/local-client-install.js +0 -168
  1059. package/dist/domain/remote/local-client-stop.d.ts +0 -37
  1060. package/dist/domain/remote/local-client-stop.js +0 -101
  1061. package/dist/domain/remote/machine-registry.d.ts +0 -54
  1062. package/dist/domain/remote/machine-registry.js +0 -184
  1063. package/dist/domain/remote/owned-local-launch.d.ts +0 -22
  1064. package/dist/domain/remote/owned-local-launch.js +0 -75
  1065. package/dist/domain/remote/package-client-bundle.d.ts +0 -14
  1066. package/dist/domain/remote/package-client-bundle.js +0 -37
  1067. package/dist/domain/remote/reverse-stream.d.ts +0 -42
  1068. package/dist/domain/remote/reverse-stream.js +0 -95
  1069. package/dist/domain/remote/ssh-exec.d.ts +0 -10
  1070. package/dist/domain/remote/ssh-exec.js +0 -25
  1071. package/dist/domain/runs/adapters.d.ts +0 -15
  1072. package/dist/domain/runs/adapters.js +0 -59
  1073. package/dist/domain/runs/attempt.d.ts +0 -37
  1074. package/dist/domain/runs/attempt.js +0 -232
  1075. package/dist/domain/runs/builders.d.ts +0 -27
  1076. package/dist/domain/runs/builders.js +0 -47
  1077. package/dist/domain/runs/compact.d.ts +0 -30
  1078. package/dist/domain/runs/compact.js +0 -43
  1079. package/dist/domain/runs/config-resolver.d.ts +0 -26
  1080. package/dist/domain/runs/config-resolver.js +0 -38
  1081. package/dist/domain/runs/engine-spec.d.ts +0 -40
  1082. package/dist/domain/runs/engine-spec.js +0 -215
  1083. package/dist/domain/runs/engines.d.ts +0 -71
  1084. package/dist/domain/runs/engines.js +0 -181
  1085. package/dist/domain/runs/events.d.ts +0 -2
  1086. package/dist/domain/runs/events.js +0 -1
  1087. package/dist/domain/runs/fallback.d.ts +0 -11
  1088. package/dist/domain/runs/fallback.js +0 -18
  1089. package/dist/domain/runs/mode-env.d.ts +0 -16
  1090. package/dist/domain/runs/mode-env.js +0 -48
  1091. package/dist/domain/runs/notices.d.ts +0 -44
  1092. package/dist/domain/runs/notices.js +0 -109
  1093. package/dist/domain/runs/observers/resume-recorder.d.ts +0 -26
  1094. package/dist/domain/runs/observers/resume-recorder.js +0 -27
  1095. package/dist/domain/runs/prompt.d.ts +0 -78
  1096. package/dist/domain/runs/prompt.js +0 -98
  1097. package/dist/domain/runs/request.d.ts +0 -99
  1098. package/dist/domain/runs/request.js +0 -1
  1099. package/dist/domain/runs/retryable-errors.d.ts +0 -5
  1100. package/dist/domain/runs/retryable-errors.js +0 -22
  1101. package/dist/domain/runs/run.d.ts +0 -238
  1102. package/dist/domain/runs/run.js +0 -574
  1103. package/dist/domain/runs/service.d.ts +0 -12
  1104. package/dist/domain/runs/service.js +0 -49
  1105. package/dist/domain/runs/spec-loader.d.ts +0 -75
  1106. package/dist/domain/runs/spec-loader.js +0 -58
  1107. package/dist/domain/runs/spend.d.ts +0 -16
  1108. package/dist/domain/runs/spend.js +0 -31
  1109. package/dist/domain/scheduling/builtin-job-controller.d.ts +0 -19
  1110. package/dist/domain/scheduling/builtin-job-controller.js +0 -103
  1111. package/dist/domain/scheduling/builtin-job-migration.d.ts +0 -23
  1112. package/dist/domain/scheduling/builtin-job-migration.js +0 -64
  1113. package/dist/domain/scheduling/builtin-jobs.d.ts +0 -2
  1114. package/dist/domain/scheduling/builtin-jobs.js +0 -37
  1115. package/dist/domain/scheduling/job-registry.d.ts +0 -22
  1116. package/dist/domain/scheduling/job-registry.js +0 -16
  1117. package/dist/domain/scheduling/jobs/auth-expiry-scan.d.ts +0 -15
  1118. package/dist/domain/scheduling/jobs/auth-expiry-scan.js +0 -75
  1119. package/dist/domain/scheduling/jobs/scheduled-task.d.ts +0 -24
  1120. package/dist/domain/scheduling/jobs/scheduled-task.js +0 -112
  1121. package/dist/domain/scheduling/jobs/sync-public.d.ts +0 -4
  1122. package/dist/domain/scheduling/jobs/sync-public.js +0 -40
  1123. package/dist/domain/scheduling/run-guards.d.ts +0 -6
  1124. package/dist/domain/scheduling/run-guards.js +0 -18
  1125. package/dist/domain/scheduling/runner.d.ts +0 -17
  1126. package/dist/domain/scheduling/runner.js +0 -22
  1127. package/dist/domain/scheduling/schedule-ops.d.ts +0 -15
  1128. package/dist/domain/scheduling/schedule-ops.js +0 -43
  1129. package/dist/domain/scheduling/schedule-selection.d.ts +0 -3
  1130. package/dist/domain/scheduling/schedule-selection.js +0 -16
  1131. package/dist/domain/scheduling/schedule-spec.d.ts +0 -79
  1132. package/dist/domain/scheduling/schedule-spec.js +0 -169
  1133. package/dist/domain/scheduling/scheduler.d.ts +0 -75
  1134. package/dist/domain/scheduling/scheduler.js +0 -303
  1135. package/dist/domain/sessions/session-backup.d.ts +0 -44
  1136. package/dist/domain/sessions/session-backup.js +0 -138
  1137. package/dist/domain/sessions/session-hooks.d.ts +0 -130
  1138. package/dist/domain/sessions/session-hooks.js +0 -347
  1139. package/dist/domain/sessions/session-lifecycle.d.ts +0 -91
  1140. package/dist/domain/sessions/session-lifecycle.js +0 -82
  1141. package/dist/domain/sessions/session-retention.d.ts +0 -50
  1142. package/dist/domain/sessions/session-retention.js +0 -466
  1143. package/dist/domain/sessions/session-use.d.ts +0 -28
  1144. package/dist/domain/sessions/session-use.js +0 -45
  1145. package/dist/domain/sessions/session.d.ts +0 -3
  1146. package/dist/domain/sessions/session.js +0 -13
  1147. package/dist/domain/sessions/team.d.ts +0 -26
  1148. package/dist/domain/sessions/team.js +0 -30
  1149. package/dist/domain/system/doctor.d.ts +0 -82
  1150. package/dist/domain/system/doctor.js +0 -484
  1151. package/dist/domain/system/github-release.d.ts +0 -16
  1152. package/dist/domain/system/github-release.js +0 -101
  1153. package/dist/domain/system/install-cli.d.ts +0 -7
  1154. package/dist/domain/system/install-cli.js +0 -107
  1155. package/dist/domain/system/notice-history.d.ts +0 -18
  1156. package/dist/domain/system/notice-history.js +0 -23
  1157. package/dist/domain/system/own-bin-path.d.ts +0 -13
  1158. package/dist/domain/system/own-bin-path.js +0 -36
  1159. package/dist/domain/system/preferences.d.ts +0 -30
  1160. package/dist/domain/system/preferences.js +0 -59
  1161. package/dist/domain/system/rebuild-hold.d.ts +0 -36
  1162. package/dist/domain/system/rebuild-hold.js +0 -83
  1163. package/dist/domain/system/server-update-check.d.ts +0 -24
  1164. package/dist/domain/system/server-update-check.js +0 -88
  1165. package/dist/domain/system/server-update-coordinator.d.ts +0 -46
  1166. package/dist/domain/system/server-update-coordinator.js +0 -155
  1167. package/dist/domain/system/server-update-install.d.ts +0 -16
  1168. package/dist/domain/system/server-update-install.js +0 -65
  1169. package/dist/domain/system/system-notice.d.ts +0 -24
  1170. package/dist/domain/system/system-notice.js +0 -31
  1171. package/dist/domain/system/terminal-cli/index.d.ts +0 -58
  1172. package/dist/domain/system/terminal-cli/index.js +0 -100
  1173. package/dist/domain/system/terminal-cli/posix-profiles.d.ts +0 -23
  1174. package/dist/domain/system/terminal-cli/posix-profiles.js +0 -74
  1175. package/dist/domain/system/terminal-cli/registrar.d.ts +0 -12
  1176. package/dist/domain/system/terminal-cli/registrar.js +0 -1
  1177. package/dist/domain/system/terminal-cli/shims.d.ts +0 -27
  1178. package/dist/domain/system/terminal-cli/shims.js +0 -108
  1179. package/dist/domain/system/terminal-cli/state.d.ts +0 -7
  1180. package/dist/domain/system/terminal-cli/state.js +0 -36
  1181. package/dist/domain/system/terminal-cli/windows-user-path.d.ts +0 -13
  1182. package/dist/domain/system/terminal-cli/windows-user-path.js +0 -67
  1183. package/dist/domain/system/update-prompt.d.ts +0 -8
  1184. package/dist/domain/system/update-prompt.js +0 -1
  1185. package/dist/domain/system/update-state.d.ts +0 -9
  1186. package/dist/domain/system/update-state.js +0 -22
  1187. package/dist/domain/system/update-ui-state.d.ts +0 -39
  1188. package/dist/domain/system/update-ui-state.js +0 -70
  1189. package/dist/domain/tui-session/index.d.ts +0 -2
  1190. package/dist/domain/tui-session/index.js +0 -1
  1191. package/dist/domain/tui-session/tui-session-service.d.ts +0 -2
  1192. package/dist/domain/tui-session/tui-session-service.js +0 -85
  1193. package/dist/domain/tui-session/types.d.ts +0 -40
  1194. package/dist/domain/tui-session/types.js +0 -1
  1195. package/dist/domain/ui-service/app-router.d.ts +0 -1136
  1196. package/dist/domain/ui-service/app-router.js +0 -305
  1197. package/dist/domain/ui-service/assistant-snapshots.d.ts +0 -10
  1198. package/dist/domain/ui-service/assistant-snapshots.js +0 -45
  1199. package/dist/domain/ui-service/contract.parity.d.ts +0 -19
  1200. package/dist/domain/ui-service/contract.parity.js +0 -1
  1201. package/dist/domain/ui-service/index.d.ts +0 -4
  1202. package/dist/domain/ui-service/index.js +0 -1
  1203. package/dist/domain/ui-service/inline-media-types.d.ts +0 -18
  1204. package/dist/domain/ui-service/inline-media-types.js +0 -1
  1205. package/dist/domain/ui-service/input-schemas.d.ts +0 -1068
  1206. package/dist/domain/ui-service/input-schemas.js +0 -702
  1207. package/dist/domain/ui-service/mutate/approvals.d.ts +0 -32
  1208. package/dist/domain/ui-service/mutate/approvals.js +0 -133
  1209. package/dist/domain/ui-service/mutate/auth.d.ts +0 -15
  1210. package/dist/domain/ui-service/mutate/auth.js +0 -103
  1211. package/dist/domain/ui-service/mutate/config.d.ts +0 -18
  1212. package/dist/domain/ui-service/mutate/config.js +0 -108
  1213. package/dist/domain/ui-service/mutate/custom-providers.d.ts +0 -8
  1214. package/dist/domain/ui-service/mutate/custom-providers.js +0 -33
  1215. package/dist/domain/ui-service/mutate/environments.d.ts +0 -27
  1216. package/dist/domain/ui-service/mutate/environments.js +0 -66
  1217. package/dist/domain/ui-service/mutate/errors.d.ts +0 -7
  1218. package/dist/domain/ui-service/mutate/errors.js +0 -14
  1219. package/dist/domain/ui-service/mutate/executions.d.ts +0 -4
  1220. package/dist/domain/ui-service/mutate/executions.js +0 -15
  1221. package/dist/domain/ui-service/mutate/hooks.d.ts +0 -12
  1222. package/dist/domain/ui-service/mutate/hooks.js +0 -110
  1223. package/dist/domain/ui-service/mutate/issues.d.ts +0 -18
  1224. package/dist/domain/ui-service/mutate/issues.js +0 -100
  1225. package/dist/domain/ui-service/mutate/models.d.ts +0 -13
  1226. package/dist/domain/ui-service/mutate/models.js +0 -137
  1227. package/dist/domain/ui-service/mutate/notes.d.ts +0 -6
  1228. package/dist/domain/ui-service/mutate/notes.js +0 -32
  1229. package/dist/domain/ui-service/mutate/platform-settings.d.ts +0 -6
  1230. package/dist/domain/ui-service/mutate/platform-settings.js +0 -17
  1231. package/dist/domain/ui-service/mutate/plugin-packages.d.ts +0 -10
  1232. package/dist/domain/ui-service/mutate/plugin-packages.js +0 -152
  1233. package/dist/domain/ui-service/mutate/plugins.d.ts +0 -2
  1234. package/dist/domain/ui-service/mutate/plugins.js +0 -38
  1235. package/dist/domain/ui-service/mutate/projects.d.ts +0 -4
  1236. package/dist/domain/ui-service/mutate/projects.js +0 -7
  1237. package/dist/domain/ui-service/mutate/resolve-media.d.ts +0 -4
  1238. package/dist/domain/ui-service/mutate/resolve-media.js +0 -17
  1239. package/dist/domain/ui-service/mutate/schedules.d.ts +0 -12
  1240. package/dist/domain/ui-service/mutate/schedules.js +0 -75
  1241. package/dist/domain/ui-service/mutate/session-metadata.d.ts +0 -3
  1242. package/dist/domain/ui-service/mutate/session-metadata.js +0 -22
  1243. package/dist/domain/ui-service/mutate/sessions.d.ts +0 -19
  1244. package/dist/domain/ui-service/mutate/sessions.js +0 -307
  1245. package/dist/domain/ui-service/mutate/system.d.ts +0 -10
  1246. package/dist/domain/ui-service/mutate/system.js +0 -120
  1247. package/dist/domain/ui-service/mutate/usage-sharing.d.ts +0 -8
  1248. package/dist/domain/ui-service/mutate/usage-sharing.js +0 -16
  1249. package/dist/domain/ui-service/mutate/waitpoints.d.ts +0 -2
  1250. package/dist/domain/ui-service/mutate/waitpoints.js +0 -13
  1251. package/dist/domain/ui-service/platform-settings.d.ts +0 -5
  1252. package/dist/domain/ui-service/platform-settings.js +0 -72
  1253. package/dist/domain/ui-service/plugins-shared.d.ts +0 -29
  1254. package/dist/domain/ui-service/plugins-shared.js +0 -176
  1255. package/dist/domain/ui-service/query/approvals.d.ts +0 -10
  1256. package/dist/domain/ui-service/query/approvals.js +0 -118
  1257. package/dist/domain/ui-service/query/auth.d.ts +0 -6
  1258. package/dist/domain/ui-service/query/auth.js +0 -8
  1259. package/dist/domain/ui-service/query/boards.d.ts +0 -14
  1260. package/dist/domain/ui-service/query/boards.js +0 -111
  1261. package/dist/domain/ui-service/query/config.d.ts +0 -9
  1262. package/dist/domain/ui-service/query/config.js +0 -167
  1263. package/dist/domain/ui-service/query/cost.d.ts +0 -3
  1264. package/dist/domain/ui-service/query/cost.js +0 -3
  1265. package/dist/domain/ui-service/query/custom-providers.d.ts +0 -8
  1266. package/dist/domain/ui-service/query/custom-providers.js +0 -9
  1267. package/dist/domain/ui-service/query/environments.d.ts +0 -12
  1268. package/dist/domain/ui-service/query/environments.js +0 -73
  1269. package/dist/domain/ui-service/query/executions.d.ts +0 -3
  1270. package/dist/domain/ui-service/query/executions.js +0 -61
  1271. package/dist/domain/ui-service/query/hooks.d.ts +0 -9
  1272. package/dist/domain/ui-service/query/hooks.js +0 -92
  1273. package/dist/domain/ui-service/query/issues.d.ts +0 -14
  1274. package/dist/domain/ui-service/query/issues.js +0 -78
  1275. package/dist/domain/ui-service/query/machine-detail.d.ts +0 -2
  1276. package/dist/domain/ui-service/query/machine-detail.js +0 -30
  1277. package/dist/domain/ui-service/query/machine-probe.d.ts +0 -18
  1278. package/dist/domain/ui-service/query/machine-probe.js +0 -132
  1279. package/dist/domain/ui-service/query/machines.d.ts +0 -2
  1280. package/dist/domain/ui-service/query/machines.js +0 -21
  1281. package/dist/domain/ui-service/query/memory.d.ts +0 -7
  1282. package/dist/domain/ui-service/query/memory.js +0 -191
  1283. package/dist/domain/ui-service/query/models.d.ts +0 -24
  1284. package/dist/domain/ui-service/query/models.js +0 -108
  1285. package/dist/domain/ui-service/query/notes.d.ts +0 -3
  1286. package/dist/domain/ui-service/query/notes.js +0 -15
  1287. package/dist/domain/ui-service/query/plugin-source.d.ts +0 -4
  1288. package/dist/domain/ui-service/query/plugin-source.js +0 -57
  1289. package/dist/domain/ui-service/query/plugins.d.ts +0 -2
  1290. package/dist/domain/ui-service/query/plugins.js +0 -28
  1291. package/dist/domain/ui-service/query/projects.d.ts +0 -2
  1292. package/dist/domain/ui-service/query/projects.js +0 -27
  1293. package/dist/domain/ui-service/query/schedules.d.ts +0 -5
  1294. package/dist/domain/ui-service/query/schedules.js +0 -28
  1295. package/dist/domain/ui-service/query/sessions.d.ts +0 -6
  1296. package/dist/domain/ui-service/query/sessions.js +0 -429
  1297. package/dist/domain/ui-service/query/skills.d.ts +0 -5
  1298. package/dist/domain/ui-service/query/skills.js +0 -16
  1299. package/dist/domain/ui-service/query/system.d.ts +0 -6
  1300. package/dist/domain/ui-service/query/system.js +0 -120
  1301. package/dist/domain/ui-service/query/usage-sharing.d.ts +0 -4
  1302. package/dist/domain/ui-service/query/usage-sharing.js +0 -5
  1303. package/dist/domain/ui-service/query/waitpoints.d.ts +0 -10
  1304. package/dist/domain/ui-service/query/waitpoints.js +0 -37
  1305. package/dist/domain/ui-service/query-input-schemas.d.ts +0 -73
  1306. package/dist/domain/ui-service/query-input-schemas.js +0 -70
  1307. package/dist/domain/ui-service/session-metadata-schemas.d.ts +0 -13
  1308. package/dist/domain/ui-service/session-metadata-schemas.js +0 -9
  1309. package/dist/domain/ui-service/subscribe.d.ts +0 -6
  1310. package/dist/domain/ui-service/subscribe.js +0 -125
  1311. package/dist/domain/ui-service/trpc.d.ts +0 -47
  1312. package/dist/domain/ui-service/trpc.js +0 -43
  1313. package/dist/domain/ui-service/types.d.ts +0 -1790
  1314. package/dist/domain/ui-service/types.js +0 -1
  1315. package/dist/domain/ui-service/ui-service.d.ts +0 -512
  1316. package/dist/domain/ui-service/ui-service.js +0 -234
  1317. package/dist/domain/waitpoints/notices.d.ts +0 -25
  1318. package/dist/domain/waitpoints/notices.js +0 -125
  1319. package/dist/domain/waitpoints/service.d.ts +0 -107
  1320. package/dist/domain/waitpoints/service.js +0 -276
  1321. package/dist/domain/waitpoints/view.d.ts +0 -29
  1322. package/dist/domain/waitpoints/view.js +0 -97
  1323. package/dist/entry/admin-channel-hot-reload.d.ts +0 -4
  1324. package/dist/entry/admin-channel-hot-reload.js +0 -17
  1325. package/dist/entry/app.d.ts +0 -1
  1326. package/dist/entry/auth-cli.d.ts +0 -9
  1327. package/dist/entry/auth-cli.js +0 -55
  1328. package/dist/entry/auth-login-cli.d.ts +0 -20
  1329. package/dist/entry/auth-login-cli.js +0 -153
  1330. package/dist/entry/auth-login-terminal.d.ts +0 -16
  1331. package/dist/entry/auth-login-terminal.js +0 -59
  1332. package/dist/entry/boot-jobs.d.ts +0 -7
  1333. package/dist/entry/boot-jobs.js +0 -16
  1334. package/dist/entry/browser-cli.d.ts +0 -39
  1335. package/dist/entry/cli-help.d.ts +0 -10
  1336. package/dist/entry/cli-help.js +0 -277
  1337. package/dist/entry/cli.d.ts +0 -19
  1338. package/dist/entry/client-cli.d.ts +0 -4
  1339. package/dist/entry/client-cli.js +0 -62
  1340. package/dist/entry/cortex-cli.d.ts +0 -1
  1341. package/dist/entry/daemon-notice.d.ts +0 -26
  1342. package/dist/entry/daemon-notice.js +0 -38
  1343. package/dist/entry/daemon.d.ts +0 -120
  1344. package/dist/entry/doctor-cli.d.ts +0 -8
  1345. package/dist/entry/doctor-cli.js +0 -70
  1346. package/dist/entry/draft-attachments.d.ts +0 -8
  1347. package/dist/entry/draft-attachments.js +0 -79
  1348. package/dist/entry/fast-install.d.ts +0 -49
  1349. package/dist/entry/fast-install.js +0 -192
  1350. package/dist/entry/feishu-login.d.ts +0 -21
  1351. package/dist/entry/feishu-login.js +0 -209
  1352. package/dist/entry/hook-cli.d.ts +0 -14
  1353. package/dist/entry/init-auth.d.ts +0 -4
  1354. package/dist/entry/init-auth.js +0 -42
  1355. package/dist/entry/init-git.d.ts +0 -6
  1356. package/dist/entry/init-git.js +0 -36
  1357. package/dist/entry/init-local-client.d.ts +0 -11
  1358. package/dist/entry/init-local-client.js +0 -34
  1359. package/dist/entry/init.d.ts +0 -148
  1360. package/dist/entry/init.js +0 -1270
  1361. package/dist/entry/local-ui.d.ts +0 -38
  1362. package/dist/entry/local-ui.js +0 -107
  1363. package/dist/entry/memory-cli.d.ts +0 -3
  1364. package/dist/entry/memory-cli.js +0 -79
  1365. package/dist/entry/path-cli.d.ts +0 -4
  1366. package/dist/entry/path-cli.js +0 -65
  1367. package/dist/entry/platform-connect.d.ts +0 -23
  1368. package/dist/entry/platform-connect.js +0 -94
  1369. package/dist/entry/production-app-bootstrap.d.ts +0 -1
  1370. package/dist/entry/production-evidence-export-cli.d.ts +0 -13
  1371. package/dist/entry/provider-cli.d.ts +0 -12
  1372. package/dist/entry/provider-cli.js +0 -199
  1373. package/dist/entry/schedule-cli.d.ts +0 -10
  1374. package/dist/entry/schedule-cli.js +0 -166
  1375. package/dist/entry/shutdown.d.ts +0 -32
  1376. package/dist/entry/shutdown.js +0 -81
  1377. package/dist/entry/signal-cli.d.ts +0 -25
  1378. package/dist/entry/start-ui-http.d.ts +0 -24
  1379. package/dist/entry/start-ui-http.js +0 -166
  1380. package/dist/entry/startup-helpers.d.ts +0 -2
  1381. package/dist/entry/startup-helpers.js +0 -15
  1382. package/dist/entry/startup-notify.d.ts +0 -6
  1383. package/dist/entry/startup-notify.js +0 -18
  1384. package/dist/entry/ui-cli.d.ts +0 -13
  1385. package/dist/entry/ui-cli.js +0 -78
  1386. package/dist/entry/ui-http-gate.d.ts +0 -17
  1387. package/dist/entry/ui-http-gate.js +0 -17
  1388. package/dist/entry/ui-service-wiring.d.ts +0 -12
  1389. package/dist/entry/ui-service-wiring.js +0 -144
  1390. package/dist/events/event-bus.d.ts +0 -47
  1391. package/dist/events/event-bus.js +0 -83
  1392. package/dist/events/event-logger.d.ts +0 -12
  1393. package/dist/events/event-logger.js +0 -144
  1394. package/dist/events/event-types.d.ts +0 -262
  1395. package/dist/events/event-types.js +0 -1
  1396. package/dist/events/index.d.ts +0 -5
  1397. package/dist/events/index.js +0 -2
  1398. package/dist/orchestration/agent-decision-send.d.ts +0 -42
  1399. package/dist/orchestration/agent-decision-send.js +0 -62
  1400. package/dist/orchestration/agent-file-send.d.ts +0 -58
  1401. package/dist/orchestration/agent-file-send.js +0 -69
  1402. package/dist/orchestration/agent-runner.d.ts +0 -52
  1403. package/dist/orchestration/agent-runner.js +0 -230
  1404. package/dist/orchestration/agent-view-send.d.ts +0 -66
  1405. package/dist/orchestration/agent-view-send.js +0 -103
  1406. package/dist/orchestration/attachments-store.d.ts +0 -31
  1407. package/dist/orchestration/attachments-store.js +0 -156
  1408. package/dist/orchestration/benchmark-session-webhook.d.ts +0 -19
  1409. package/dist/orchestration/benchmark-session-webhook.js +0 -142
  1410. package/dist/orchestration/board-webhook.d.ts +0 -7
  1411. package/dist/orchestration/board-webhook.js +0 -38
  1412. package/dist/orchestration/browser-webhook.d.ts +0 -11
  1413. package/dist/orchestration/browser-webhook.js +0 -28
  1414. package/dist/orchestration/busy-tracker.d.ts +0 -15
  1415. package/dist/orchestration/busy-tracker.js +0 -38
  1416. package/dist/orchestration/cache-keep-warm.d.ts +0 -77
  1417. package/dist/orchestration/cache-keep-warm.js +0 -213
  1418. package/dist/orchestration/claude-window-warmup.d.ts +0 -40
  1419. package/dist/orchestration/claude-window-warmup.js +0 -126
  1420. package/dist/orchestration/conduit-queue.d.ts +0 -14
  1421. package/dist/orchestration/conduit-queue.js +0 -53
  1422. package/dist/orchestration/conversation-request.d.ts +0 -163
  1423. package/dist/orchestration/conversation-request.js +0 -276
  1424. package/dist/orchestration/delta-coalescer.d.ts +0 -69
  1425. package/dist/orchestration/delta-coalescer.js +0 -120
  1426. package/dist/orchestration/durable-helpers.d.ts +0 -3
  1427. package/dist/orchestration/durable-helpers.js +0 -38
  1428. package/dist/orchestration/edit-retry.d.ts +0 -35
  1429. package/dist/orchestration/edit-retry.js +0 -127
  1430. package/dist/orchestration/injection-ledger.d.ts +0 -56
  1431. package/dist/orchestration/injection-ledger.js +0 -270
  1432. package/dist/orchestration/inline-media-eager.d.ts +0 -13
  1433. package/dist/orchestration/inline-media-eager.js +0 -58
  1434. package/dist/orchestration/inline-media.d.ts +0 -22
  1435. package/dist/orchestration/inline-media.js +0 -151
  1436. package/dist/orchestration/interactions/answer-question.d.ts +0 -16
  1437. package/dist/orchestration/interactions/answer-question.js +0 -38
  1438. package/dist/orchestration/interactions/ask-user-question.d.ts +0 -34
  1439. package/dist/orchestration/interactions/ask-user-question.js +0 -179
  1440. package/dist/orchestration/interactions/ask-user-resume.d.ts +0 -11
  1441. package/dist/orchestration/interactions/ask-user-resume.js +0 -57
  1442. package/dist/orchestration/interactions/command-action-router.d.ts +0 -31
  1443. package/dist/orchestration/interactions/command-action-router.js +0 -48
  1444. package/dist/orchestration/interactions/interaction-handlers.d.ts +0 -5
  1445. package/dist/orchestration/interactions/interaction-handlers.js +0 -288
  1446. package/dist/orchestration/interactions/interaction-records.d.ts +0 -57
  1447. package/dist/orchestration/interactions/interaction-records.js +0 -142
  1448. package/dist/orchestration/interactions/plan-approvals.d.ts +0 -38
  1449. package/dist/orchestration/interactions/plan-approvals.js +0 -73
  1450. package/dist/orchestration/interactions/plan-handler.d.ts +0 -3
  1451. package/dist/orchestration/interactions/plan-handler.js +0 -13
  1452. package/dist/orchestration/interactions/plan-response.d.ts +0 -9
  1453. package/dist/orchestration/interactions/plan-response.js +0 -23
  1454. package/dist/orchestration/interactions/ui-update-prompt.d.ts +0 -8
  1455. package/dist/orchestration/interactions/ui-update-prompt.js +0 -39
  1456. package/dist/orchestration/interactions/update-prompt.d.ts +0 -6
  1457. package/dist/orchestration/interactions/update-prompt.js +0 -150
  1458. package/dist/orchestration/mid-turn-inject.d.ts +0 -64
  1459. package/dist/orchestration/mid-turn-inject.js +0 -103
  1460. package/dist/orchestration/orchestrator.d.ts +0 -23
  1461. package/dist/orchestration/orchestrator.js +0 -12
  1462. package/dist/orchestration/outputs-store.d.ts +0 -40
  1463. package/dist/orchestration/outputs-store.js +0 -83
  1464. package/dist/orchestration/pending-injection-recovery.d.ts +0 -36
  1465. package/dist/orchestration/pending-injection-recovery.js +0 -88
  1466. package/dist/orchestration/pi-background-subagent.d.ts +0 -15
  1467. package/dist/orchestration/pi-background-subagent.js +0 -34
  1468. package/dist/orchestration/resume-dispatcher.d.ts +0 -20
  1469. package/dist/orchestration/resume-dispatcher.js +0 -97
  1470. package/dist/orchestration/resume-target-sink.d.ts +0 -37
  1471. package/dist/orchestration/resume-target-sink.js +0 -68
  1472. package/dist/orchestration/routing/commands/cancel.d.ts +0 -58
  1473. package/dist/orchestration/routing/commands/cancel.js +0 -212
  1474. package/dist/orchestration/routing/commands/channel.d.ts +0 -7
  1475. package/dist/orchestration/routing/commands/channel.js +0 -229
  1476. package/dist/orchestration/routing/commands/command-context.d.ts +0 -14
  1477. package/dist/orchestration/routing/commands/command-context.js +0 -1
  1478. package/dist/orchestration/routing/commands/compact.d.ts +0 -6
  1479. package/dist/orchestration/routing/commands/compact.js +0 -22
  1480. package/dist/orchestration/routing/commands/cost.d.ts +0 -11
  1481. package/dist/orchestration/routing/commands/cost.js +0 -101
  1482. package/dist/orchestration/routing/commands/device.d.ts +0 -4
  1483. package/dist/orchestration/routing/commands/device.js +0 -70
  1484. package/dist/orchestration/routing/commands/index.d.ts +0 -22
  1485. package/dist/orchestration/routing/commands/index.js +0 -160
  1486. package/dist/orchestration/routing/commands/lang.d.ts +0 -9
  1487. package/dist/orchestration/routing/commands/lang.js +0 -34
  1488. package/dist/orchestration/routing/commands/login-custom.d.ts +0 -26
  1489. package/dist/orchestration/routing/commands/login-custom.js +0 -85
  1490. package/dist/orchestration/routing/commands/login-notice.d.ts +0 -23
  1491. package/dist/orchestration/routing/commands/login-notice.js +0 -84
  1492. package/dist/orchestration/routing/commands/login.d.ts +0 -12
  1493. package/dist/orchestration/routing/commands/login.js +0 -560
  1494. package/dist/orchestration/routing/commands/mode.d.ts +0 -10
  1495. package/dist/orchestration/routing/commands/mode.js +0 -302
  1496. package/dist/orchestration/routing/commands/nvtop.d.ts +0 -3
  1497. package/dist/orchestration/routing/commands/nvtop.js +0 -107
  1498. package/dist/orchestration/routing/commands/orient.d.ts +0 -2
  1499. package/dist/orchestration/routing/commands/orient.js +0 -5
  1500. package/dist/orchestration/routing/commands/restart.d.ts +0 -18
  1501. package/dist/orchestration/routing/commands/restart.js +0 -31
  1502. package/dist/orchestration/routing/commands/schedule.d.ts +0 -6
  1503. package/dist/orchestration/routing/commands/schedule.js +0 -206
  1504. package/dist/orchestration/routing/commands/sendfile.d.ts +0 -2
  1505. package/dist/orchestration/routing/commands/sendfile.js +0 -97
  1506. package/dist/orchestration/routing/commands/session.d.ts +0 -18
  1507. package/dist/orchestration/routing/commands/session.js +0 -131
  1508. package/dist/orchestration/routing/commands/status.d.ts +0 -5
  1509. package/dist/orchestration/routing/commands/status.js +0 -165
  1510. package/dist/orchestration/routing/commands/tail.d.ts +0 -2
  1511. package/dist/orchestration/routing/commands/tail.js +0 -79
  1512. package/dist/orchestration/routing/commands/time-ago.d.ts +0 -2
  1513. package/dist/orchestration/routing/commands/time-ago.js +0 -14
  1514. package/dist/orchestration/routing/commands/usage-format.d.ts +0 -5
  1515. package/dist/orchestration/routing/commands/usage-format.js +0 -107
  1516. package/dist/orchestration/routing/commands/usage-reset.d.ts +0 -20
  1517. package/dist/orchestration/routing/commands/usage-reset.js +0 -123
  1518. package/dist/orchestration/routing/commands/usage.d.ts +0 -10
  1519. package/dist/orchestration/routing/commands/usage.js +0 -54
  1520. package/dist/orchestration/routing/edit-handler.d.ts +0 -27
  1521. package/dist/orchestration/routing/edit-handler.js +0 -205
  1522. package/dist/orchestration/routing/file-handler.d.ts +0 -15
  1523. package/dist/orchestration/routing/file-handler.js +0 -39
  1524. package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +0 -14
  1525. package/dist/orchestration/routing/hook-bridge-subscribers.js +0 -174
  1526. package/dist/orchestration/routing/hook-bridge.d.ts +0 -28
  1527. package/dist/orchestration/routing/hook-bridge.js +0 -104
  1528. package/dist/orchestration/routing/message-router.d.ts +0 -6
  1529. package/dist/orchestration/routing/message-router.js +0 -60
  1530. package/dist/orchestration/routing/webhook.d.ts +0 -10
  1531. package/dist/orchestration/routing/webhook.js +0 -432
  1532. package/dist/orchestration/runtime.d.ts +0 -30
  1533. package/dist/orchestration/runtime.js +0 -37
  1534. package/dist/orchestration/session-compact.d.ts +0 -50
  1535. package/dist/orchestration/session-compact.js +0 -84
  1536. package/dist/orchestration/session-events.d.ts +0 -173
  1537. package/dist/orchestration/session-events.js +0 -140
  1538. package/dist/orchestration/session-gateway.d.ts +0 -52
  1539. package/dist/orchestration/session-gateway.js +0 -87
  1540. package/dist/orchestration/session-retention-controller.d.ts +0 -14
  1541. package/dist/orchestration/session-retention-controller.js +0 -88
  1542. package/dist/orchestration/session-retention-liveness.d.ts +0 -13
  1543. package/dist/orchestration/session-retention-liveness.js +0 -31
  1544. package/dist/orchestration/session-rewind.d.ts +0 -79
  1545. package/dist/orchestration/session-rewind.js +0 -147
  1546. package/dist/orchestration/status-helpers.d.ts +0 -40
  1547. package/dist/orchestration/status-helpers.js +0 -177
  1548. package/dist/orchestration/subagent-adopt.d.ts +0 -20
  1549. package/dist/orchestration/subagent-adopt.js +0 -43
  1550. package/dist/orchestration/subagent-attribution.d.ts +0 -42
  1551. package/dist/orchestration/subagent-attribution.js +0 -130
  1552. package/dist/orchestration/subagent-delivery.d.ts +0 -43
  1553. package/dist/orchestration/subagent-delivery.js +0 -112
  1554. package/dist/orchestration/subagent-rows.d.ts +0 -11
  1555. package/dist/orchestration/subagent-rows.js +0 -16
  1556. package/dist/orchestration/subagent-webhook.d.ts +0 -6
  1557. package/dist/orchestration/subagent-webhook.js +0 -89
  1558. package/dist/orchestration/team-delivery.d.ts +0 -81
  1559. package/dist/orchestration/team-delivery.js +0 -284
  1560. package/dist/orchestration/team-inbox.d.ts +0 -18
  1561. package/dist/orchestration/team-inbox.js +0 -49
  1562. package/dist/orchestration/team-state.d.ts +0 -74
  1563. package/dist/orchestration/team-state.js +0 -219
  1564. package/dist/orchestration/team-webhook.d.ts +0 -57
  1565. package/dist/orchestration/team-webhook.js +0 -293
  1566. package/dist/orchestration/transcript-sink.d.ts +0 -77
  1567. package/dist/orchestration/transcript-sink.js +0 -250
  1568. package/dist/orchestration/turn/active-turns.d.ts +0 -49
  1569. package/dist/orchestration/turn/active-turns.js +0 -76
  1570. package/dist/orchestration/turn/background-hold.d.ts +0 -158
  1571. package/dist/orchestration/turn/background-hold.js +0 -240
  1572. package/dist/orchestration/turn/hold-render-platform.d.ts +0 -35
  1573. package/dist/orchestration/turn/hold-render-platform.js +0 -105
  1574. package/dist/orchestration/turn/hold-render-web.d.ts +0 -17
  1575. package/dist/orchestration/turn/hold-render-web.js +0 -51
  1576. package/dist/orchestration/turn/terminal.d.ts +0 -105
  1577. package/dist/orchestration/turn/terminal.js +0 -194
  1578. package/dist/orchestration/turn/turn-prep.d.ts +0 -33
  1579. package/dist/orchestration/turn/turn-prep.js +0 -44
  1580. package/dist/orchestration/turn/turn-tracking.d.ts +0 -22
  1581. package/dist/orchestration/turn/turn-tracking.js +0 -89
  1582. package/dist/orchestration/turn/turn.d.ts +0 -199
  1583. package/dist/orchestration/turn/turn.js +0 -586
  1584. package/dist/orchestration/turn-mutation-lock.d.ts +0 -3
  1585. package/dist/orchestration/turn-mutation-lock.js +0 -32
  1586. package/dist/orchestration/turn-notify.d.ts +0 -22
  1587. package/dist/orchestration/turn-notify.js +0 -50
  1588. package/dist/orchestration/waitpoint-ingress.d.ts +0 -36
  1589. package/dist/orchestration/waitpoint-ingress.js +0 -180
  1590. package/dist/orchestration/waitpoint-notifier.d.ts +0 -32
  1591. package/dist/orchestration/waitpoint-notifier.js +0 -140
  1592. package/dist/orchestration/waitpoint-remote-drain.d.ts +0 -22
  1593. package/dist/orchestration/waitpoint-remote-drain.js +0 -134
  1594. package/dist/orchestration/waitpoint-sweep.d.ts +0 -43
  1595. package/dist/orchestration/waitpoint-sweep.js +0 -84
  1596. package/dist/platform/adapter.d.ts +0 -48
  1597. package/dist/platform/adapter.js +0 -1
  1598. package/dist/platform/adapters/chunked-output-stream.d.ts +0 -71
  1599. package/dist/platform/adapters/chunked-output-stream.js +0 -382
  1600. package/dist/platform/adapters/composite-adapter.d.ts +0 -99
  1601. package/dist/platform/adapters/composite-adapter.js +0 -369
  1602. package/dist/platform/adapters/feishu-http.d.ts +0 -46
  1603. package/dist/platform/adapters/feishu-http.js +0 -108
  1604. package/dist/platform/adapters/feishu-image.d.ts +0 -19
  1605. package/dist/platform/adapters/feishu-image.js +0 -64
  1606. package/dist/platform/adapters/feishu-output-stream.d.ts +0 -11
  1607. package/dist/platform/adapters/feishu-output-stream.js +0 -29
  1608. package/dist/platform/adapters/feishu.d.ts +0 -167
  1609. package/dist/platform/adapters/feishu.js +0 -1059
  1610. package/dist/platform/adapters/index.d.ts +0 -19
  1611. package/dist/platform/adapters/index.js +0 -108
  1612. package/dist/platform/adapters/project-conduits.d.ts +0 -9
  1613. package/dist/platform/adapters/project-conduits.js +0 -36
  1614. package/dist/platform/adapters/slack-output-stream.d.ts +0 -15
  1615. package/dist/platform/adapters/slack-output-stream.js +0 -33
  1616. package/dist/platform/adapters/slack.d.ts +0 -106
  1617. package/dist/platform/adapters/slack.js +0 -733
  1618. package/dist/platform/adapters/tui/index.d.ts +0 -2
  1619. package/dist/platform/adapters/tui/index.js +0 -2
  1620. package/dist/platform/adapters/tui/ports.d.ts +0 -46
  1621. package/dist/platform/adapters/tui/ports.js +0 -1
  1622. package/dist/platform/adapters/tui/tui-connection.d.ts +0 -20
  1623. package/dist/platform/adapters/tui/tui-connection.js +0 -44
  1624. package/dist/platform/adapters/tui/tui-gateway.d.ts +0 -90
  1625. package/dist/platform/adapters/tui/tui-gateway.js +0 -884
  1626. package/dist/platform/adapters/tui/tui-output-stream.d.ts +0 -35
  1627. package/dist/platform/adapters/tui/tui-output-stream.js +0 -94
  1628. package/dist/platform/adapters/tui/tui-transcript.d.ts +0 -8
  1629. package/dist/platform/adapters/tui/tui-transcript.js +0 -42
  1630. package/dist/platform/browser/agent-browser.d.ts +0 -50
  1631. package/dist/platform/browser/agent-browser.js +0 -165
  1632. package/dist/platform/browser/display.d.ts +0 -48
  1633. package/dist/platform/browser/display.js +0 -188
  1634. package/dist/platform/browser/managed-browser.d.ts +0 -23
  1635. package/dist/platform/browser/managed-browser.js +0 -357
  1636. package/dist/platform/index.d.ts +0 -10
  1637. package/dist/platform/index.js +0 -6
  1638. package/dist/platform/interactive-builder.d.ts +0 -34
  1639. package/dist/platform/interactive-builder.js +0 -138
  1640. package/dist/platform/output-stream-chunk.d.ts +0 -6
  1641. package/dist/platform/output-stream-chunk.js +0 -42
  1642. package/dist/platform/output-stream-helpers.d.ts +0 -8
  1643. package/dist/platform/output-stream-helpers.js +0 -19
  1644. package/dist/platform/output-stream.d.ts +0 -35
  1645. package/dist/platform/output-stream.js +0 -1
  1646. package/dist/platform/testing.d.ts +0 -136
  1647. package/dist/platform/testing.js +0 -286
  1648. package/dist/platform/tool-trace.d.ts +0 -35
  1649. package/dist/platform/tool-trace.js +0 -287
  1650. package/dist/platform/tui/protocol.d.ts +0 -352
  1651. package/dist/platform/tui/protocol.js +0 -146
  1652. package/dist/platform/types.d.ts +0 -223
  1653. package/dist/platform/types.js +0 -22
  1654. package/dist/platform/ui-http/access-jwt.d.ts +0 -28
  1655. package/dist/platform/ui-http/access-jwt.js +0 -53
  1656. package/dist/platform/ui-http/app-update.d.ts +0 -69
  1657. package/dist/platform/ui-http/app-update.js +0 -143
  1658. package/dist/platform/ui-http/browser-stream.d.ts +0 -110
  1659. package/dist/platform/ui-http/browser-stream.js +0 -447
  1660. package/dist/platform/ui-http/device-ports.d.ts +0 -34
  1661. package/dist/platform/ui-http/device-ports.js +0 -102
  1662. package/dist/platform/ui-http/file-routes.d.ts +0 -23
  1663. package/dist/platform/ui-http/file-routes.js +0 -224
  1664. package/dist/platform/ui-http/http-json.d.ts +0 -24
  1665. package/dist/platform/ui-http/http-json.js +0 -109
  1666. package/dist/platform/ui-http/listening-ports.d.ts +0 -98
  1667. package/dist/platform/ui-http/listening-ports.js +0 -239
  1668. package/dist/platform/ui-http/port-forward.d.ts +0 -40
  1669. package/dist/platform/ui-http/port-forward.js +0 -130
  1670. package/dist/platform/ui-http/ui-auth-routes.d.ts +0 -49
  1671. package/dist/platform/ui-http/ui-auth-routes.js +0 -113
  1672. package/dist/platform/ui-http/ui-http-server.d.ts +0 -93
  1673. package/dist/platform/ui-http/ui-http-server.js +0 -306
  1674. package/dist/platform/ui-http/ui-ota.d.ts +0 -22
  1675. package/dist/platform/ui-http/ui-ota.js +0 -151
  1676. package/dist/platform/ui-http/ui-session.d.ts +0 -33
  1677. package/dist/platform/ui-http/ui-session.js +0 -124
  1678. package/dist/platform/ui-http/zip-writer.d.ts +0 -13
  1679. package/dist/platform/ui-http/zip-writer.js +0 -93
  1680. package/dist/platform/utils/rate-limiter.d.ts +0 -90
  1681. package/dist/platform/utils/rate-limiter.js +0 -203
  1682. package/dist/platform/utils/reaction-diagnostics.d.ts +0 -9
  1683. package/dist/platform/utils/reaction-diagnostics.js +0 -19
  1684. package/dist/platform/utils/readable-file.d.ts +0 -9
  1685. package/dist/platform/utils/readable-file.js +0 -18
  1686. package/dist/store/board-migration.d.ts +0 -21
  1687. package/dist/store/board-migration.js +0 -217
  1688. package/dist/store/board-repo.d.ts +0 -35
  1689. package/dist/store/board-repo.js +0 -62
  1690. package/dist/store/builtin-overlay-migration.d.ts +0 -11
  1691. package/dist/store/builtin-overlay-migration.js +0 -308
  1692. package/dist/store/claude-transcript-migration.d.ts +0 -32
  1693. package/dist/store/claude-transcript-migration.js +0 -119
  1694. package/dist/store/conversation-display-projection.d.ts +0 -36
  1695. package/dist/store/conversation-display-projection.js +0 -180
  1696. package/dist/store/conversation-history-reader.d.ts +0 -30
  1697. package/dist/store/conversation-history-reader.js +0 -440
  1698. package/dist/store/conversation-history-repo.d.ts +0 -449
  1699. package/dist/store/conversation-history-repo.js +0 -632
  1700. package/dist/store/conversation-ledger-repo.d.ts +0 -76
  1701. package/dist/store/conversation-ledger-repo.js +0 -219
  1702. package/dist/store/cost-repo.d.ts +0 -88
  1703. package/dist/store/cost-repo.js +0 -233
  1704. package/dist/store/execution-repo.d.ts +0 -169
  1705. package/dist/store/execution-repo.js +0 -329
  1706. package/dist/store/hook-registry.d.ts +0 -101
  1707. package/dist/store/hook-registry.js +0 -314
  1708. package/dist/store/hook-writer.d.ts +0 -43
  1709. package/dist/store/hook-writer.js +0 -133
  1710. package/dist/store/models-repo.d.ts +0 -18
  1711. package/dist/store/models-repo.js +0 -74
  1712. package/dist/store/outbound-queue.d.ts +0 -67
  1713. package/dist/store/outbound-queue.js +0 -284
  1714. package/dist/store/pending-injection-repo.d.ts +0 -29
  1715. package/dist/store/pending-injection-repo.js +0 -52
  1716. package/dist/store/project-dir-repo.d.ts +0 -17
  1717. package/dist/store/project-dir-repo.js +0 -44
  1718. package/dist/store/project-notes-repo.d.ts +0 -27
  1719. package/dist/store/project-notes-repo.js +0 -219
  1720. package/dist/store/prompt-migration-replacements.d.ts +0 -3
  1721. package/dist/store/prompt-migration-replacements.js +0 -96
  1722. package/dist/store/provider-state-repo.d.ts +0 -22
  1723. package/dist/store/provider-state-repo.js +0 -115
  1724. package/dist/store/retention-candidate-repo.d.ts +0 -12
  1725. package/dist/store/retention-candidate-repo.js +0 -47
  1726. package/dist/store/retire-profiles-migration.d.ts +0 -28
  1727. package/dist/store/retire-profiles-migration.js +0 -335
  1728. package/dist/store/schedule-repo.d.ts +0 -53
  1729. package/dist/store/schedule-repo.js +0 -121
  1730. package/dist/store/session-registry-import.d.ts +0 -34
  1731. package/dist/store/session-registry-import.js +0 -173
  1732. package/dist/store/session-registry-journal.d.ts +0 -195
  1733. package/dist/store/session-registry-journal.js +0 -868
  1734. package/dist/store/session-registry-repo.d.ts +0 -169
  1735. package/dist/store/session-registry-repo.js +0 -530
  1736. package/dist/store/session-totals-repo.d.ts +0 -45
  1737. package/dist/store/session-totals-repo.js +0 -104
  1738. package/dist/store/session-totals.d.ts +0 -69
  1739. package/dist/store/session-totals.js +0 -93
  1740. package/dist/store/team-inbox-repo.d.ts +0 -34
  1741. package/dist/store/team-inbox-repo.js +0 -72
  1742. package/dist/store/team-outbox-repo.d.ts +0 -20
  1743. package/dist/store/team-outbox-repo.js +0 -39
  1744. package/dist/store/tool-image-files.d.ts +0 -12
  1745. package/dist/store/tool-image-files.js +0 -40
  1746. package/dist/store/version-migrations.d.ts +0 -115
  1747. package/dist/store/version-migrations.js +0 -1371
  1748. package/dist/store/waitpoint-repo.d.ts +0 -111
  1749. package/dist/store/waitpoint-repo.js +0 -83
  1750. package/dist/tui/App.d.ts +0 -27
  1751. package/dist/tui/App.js +0 -406
  1752. package/dist/tui/components/AskUserModal.d.ts +0 -10
  1753. package/dist/tui/components/AskUserModal.js +0 -362
  1754. package/dist/tui/components/ConfirmModal.d.ts +0 -12
  1755. package/dist/tui/components/ConfirmModal.js +0 -29
  1756. package/dist/tui/components/Dashboard.d.ts +0 -24
  1757. package/dist/tui/components/Dashboard.js +0 -88
  1758. package/dist/tui/components/DashboardCostTab.d.ts +0 -7
  1759. package/dist/tui/components/DashboardCostTab.js +0 -32
  1760. package/dist/tui/components/DashboardExecutionsTab.d.ts +0 -11
  1761. package/dist/tui/components/DashboardExecutionsTab.js +0 -112
  1762. package/dist/tui/components/DashboardSchedulesTab.d.ts +0 -11
  1763. package/dist/tui/components/DashboardSchedulesTab.js +0 -132
  1764. package/dist/tui/components/InputBox.d.ts +0 -26
  1765. package/dist/tui/components/InputBox.js +0 -266
  1766. package/dist/tui/components/Notifications.d.ts +0 -12
  1767. package/dist/tui/components/Notifications.js +0 -59
  1768. package/dist/tui/components/ProjectSwitcher.d.ts +0 -17
  1769. package/dist/tui/components/ProjectSwitcher.js +0 -40
  1770. package/dist/tui/components/SessionPicker.d.ts +0 -13
  1771. package/dist/tui/components/SessionPicker.js +0 -42
  1772. package/dist/tui/components/SidePanel.d.ts +0 -19
  1773. package/dist/tui/components/SidePanel.js +0 -8
  1774. package/dist/tui/components/SlashMenu.d.ts +0 -8
  1775. package/dist/tui/components/SlashMenu.js +0 -15
  1776. package/dist/tui/components/StatusLine.d.ts +0 -19
  1777. package/dist/tui/components/StatusLine.js +0 -39
  1778. package/dist/tui/components/Transcript.d.ts +0 -21
  1779. package/dist/tui/components/Transcript.js +0 -150
  1780. package/dist/tui/components/dashboard-constants.d.ts +0 -1
  1781. package/dist/tui/components/dashboard-constants.js +0 -1
  1782. package/dist/tui/hooks/useDashboardData.d.ts +0 -24
  1783. package/dist/tui/hooks/useDashboardData.js +0 -75
  1784. package/dist/tui/hooks/useKeybindings.d.ts +0 -19
  1785. package/dist/tui/hooks/useKeybindings.js +0 -75
  1786. package/dist/tui/hooks/useMouseHandler.d.ts +0 -15
  1787. package/dist/tui/hooks/useMouseHandler.js +0 -90
  1788. package/dist/tui/hooks/useMutate.d.ts +0 -22
  1789. package/dist/tui/hooks/useMutate.js +0 -54
  1790. package/dist/tui/hooks/useNotifications.d.ts +0 -26
  1791. package/dist/tui/hooks/useNotifications.js +0 -60
  1792. package/dist/tui/hooks/useTranscript.d.ts +0 -42
  1793. package/dist/tui/hooks/useTranscript.js +0 -277
  1794. package/dist/tui/index.d.ts +0 -2
  1795. package/dist/tui/logic.d.ts +0 -144
  1796. package/dist/tui/logic.js +0 -388
  1797. package/dist/tui/raf-batch.d.ts +0 -31
  1798. package/dist/tui/raf-batch.js +0 -89
  1799. package/dist/tui/render/inline-markdown.d.ts +0 -22
  1800. package/dist/tui/render/inline-markdown.js +0 -99
  1801. package/dist/tui/render/markdown.d.ts +0 -10
  1802. package/dist/tui/render/markdown.js +0 -35
  1803. package/dist/tui/render-output.d.ts +0 -42
  1804. package/dist/tui/render-output.js +0 -81
  1805. package/dist/tui/slash-commands.d.ts +0 -21
  1806. package/dist/tui/slash-commands.js +0 -71
  1807. package/dist/tui/turn-status.d.ts +0 -10
  1808. package/dist/tui/turn-status.js +0 -48
  1809. package/dist/tui/ws-client.d.ts +0 -39
  1810. package/dist/tui/ws-client.js +0 -139
  1811. package/scripts/install-bundled-dependencies.mjs +0 -54
  1812. package/web/dist/assets/board-math-css-CB4GJ6qO.js +0 -2
  1813. package/web/dist/assets/index-CaSZPg_H.css +0 -1
  1814. package/web/dist/assets/index-CzOR7Edh.js +0 -522
  1815. package/web/dist/assets/index-cIGFv27z.js +0 -1
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ function r(_){if(_===void 0)return;let n=Array.from(_);return n.length<=64?_:n.slice(0,64).join("")}export{r as a};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a,d as u}from"./chunk-TAWLERZA.js";import*as n from"fs";import*as s from"path";function f(t){return!!(s.isAbsolute(t)||/^[A-Za-z]:[/\\]/.test(t))}function w(t,r){return t&&(t.startsWith(r)?t.slice(r.length):t)}var m=10*6e4;async function c(t,r,e){if(!f(e))throw new Error("file_path must be absolute when `device` is set");let{body:o}=await a("POST",`${t.webhookBaseUrl}/webhook/remote-fetch`,{device:r,filePath:e},u(t),m);if(!o.success)throw new Error(o.error||`Failed to fetch ${e} from ${r}`);return o.data}async function l(t,r,e,o){let i=await c(t,r,e);try{return await o(i)}finally{await n.promises.rm(s.dirname(i.localPath),{recursive:!0,force:!0}).catch(()=>{})}}export{f as a,w as b,l as c};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ var f=class extends Error{status;body;constructor(r,e){super(`HTTP ${r}`),this.name="HTTPStatusError",this.status=r,this.body=e}};function h(r,e){return`${r.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`}function y(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}async function v(r,e={}){let n=new AbortController,a=e.timeoutMs??3e3,l=setTimeout(()=>{n.abort(new Error(`Request timed out after ${a}ms`))},a),o=e.signal,c=()=>{n.abort(o?.reason)};o&&(o.aborted?n.abort(o.reason):o.addEventListener("abort",c,{once:!0}));try{let s=new Headers(e.headers??{}),t=e.body;t!=null&&typeof t!="string"&&!(t instanceof URLSearchParams)&&!(t instanceof FormData)&&!(t instanceof Blob)&&!(t instanceof ArrayBuffer)&&(t=JSON.stringify(t)),typeof t=="string"&&!s.has("content-type")&&s.set("content-type","application/json");let i=await fetch(r,{...e,headers:s,body:t,signal:n.signal}),u=await i.text(),d=u?p(u):null;if(!i.ok)throw new f(i.status,d);return d}finally{clearTimeout(l),o?.removeEventListener("abort",c)}}function p(r){try{return JSON.parse(r)}catch{return r}}export{f as a,h as b,y as c,v as d};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as Le}from"./chunk-EQIMHXC4.js";import{a as de}from"./chunk-FX6MOGLR.js";import{M as O,e as v,g as I,m as $}from"./chunk-QUUEQRIT.js";import{a as Oe}from"./chunk-B3XBQEFM.js";import{e as ce}from"./chunk-WHC7AYZD.js";import{execSync as Ve,spawnSync as De}from"child_process";var G=new Map,Ne=/^[A-Za-z_][A-Za-z0-9_]*$/,ke=/^[A-Za-z_][A-Za-z0-9_]*/;function C(s,e){if(!e)return;let t=s[s.length-1];if(t?.type==="literal"){t.value+=e;return}s.push({type:"literal",value:e})}function qe(s){let e=[],t=0;for(;t<s.length;){let r=s.indexOf("$",t);if(r<0){C(e,s.slice(t));break}C(e,s.slice(t,r));let n=s[r+1];if(n==="$"||n==="!"){C(e,n),t=r+2;continue}if(n==="{"){let o=s.indexOf("}",r+2);if(o<0){C(e,"$"),t=r+1;continue}let a=s.slice(r+2,o);Ne.test(a)?e.push({type:"env",name:a}):C(e,s.slice(r,o+1)),t=o+1;continue}let i=s.slice(r+1).match(ke);if(i){e.push({type:"env",name:i[0]}),t=r+1+i[0].length;continue}C(e,"$"),t=r+1}return e}function L(s){return s.startsWith("!")?{type:"command",config:s}:{type:"template",parts:qe(s)}}function le(s,e){return e?.[s]||process.env[s]||void 0}function $e(s){let e=[];for(let t of s)t.type!=="env"||e.includes(t.name)||e.push(t.name);return e}function fe(s,e){let t="";for(let r of s){if(r.type==="literal"){t+=r.value;continue}let n=le(r.name,e);if(n===void 0)return;t+=n}return t}function je(s){let e=L(s);return e.type==="template"?$e(e.parts):[]}function he(s,e){return je(s).filter(t=>le(t,e)===void 0)}function pe(s){return L(s).type==="command"}function wt(s,e){return he(s,e).length===0}function W(s,e){let t=L(s);return t.type==="command"?Fe(t.config):fe(t.parts,e)}function Be(s){try{let{shell:e,args:t,commandTransport:r}=de(),n=r==="stdin",i=De(e,n?t:[...t,s],{encoding:"utf-8",input:n?s:void 0,timeout:1e4,stdio:[n?"pipe":"ignore","pipe","ignore"],shell:!1,windowsHide:!0});return i.error?i.error.code==="ENOENT"?{executed:!1,value:void 0}:{executed:!0,value:void 0}:i.status!==0?{executed:!0,value:void 0}:{executed:!0,value:(i.stdout??"").trim()||void 0}}catch{return{executed:!1,value:void 0}}}function ue(s){try{return Ve(s,{encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{return}}function me(s){let e=s.slice(1);return process.platform==="win32"?(()=>{let t=Be(e);return t.executed?t.value:ue(e)})():ue(e)}function Fe(s){if(G.has(s))return G.get(s);let e=me(s);return G.set(s,e),e}function Je(s,e){let t=L(s);return t.type==="command"?me(t.config):fe(t.parts,e)}function Ue(s,e,t){let r=Je(s,t);if(r!==void 0)return r;let n=L(s);if(n.type==="command")throw new Error(`Failed to resolve ${e} from shell command: ${n.config.slice(1)}`);if(n.type==="template"){let i=he(s,t);if(i.length===1)throw new Error(`Failed to resolve ${e} from environment variable: ${i[0]}`);if(i.length>1)throw new Error(`Failed to resolve ${e} from environment variables: ${i.join(", ")}`)}throw new Error(`Failed to resolve ${e}`)}function Et(s,e,t){if(!s)return;let r={};for(let[n,i]of Object.entries(s))r[n]=Ue(i,`${e} header "${n}"`,t);return Object.keys(r).length>0?r:void 0}var K=ce(Le(),1);import{existsSync as j,mkdirSync as ze,readFileSync as F,writeFileSync as Y}from"fs";import{dirname as He,join as J}from"path";import{setTimeout as we}from"timers/promises";function ye(s){if(s.reason!==void 0)return s.reason;let e=new Error("The operation was aborted");return e.name="AbortError",e}function St(s){return s??new AbortController().signal}function X(s,e){return e?e.aborted?(s.catch(()=>{}),Promise.reject(ye(e))):new Promise((t,r)=>{let n=!1,i=()=>e.removeEventListener("abort",o),o=()=>{n||(n=!0,i(),r(ye(e)))};e.addEventListener("abort",o,{once:!0}),s.then(a=>{n||(n=!0,i(),t(a))},a=>{n||(n=!0,i(),r(a))}),e.aborted&&o()}):s}var Ge=5;function Ee(s){let e=s instanceof Error&&"code"in s?s.code:void 0;if(e==="ELOCKED"||e==="EPERM"&&process.platform==="win32")return e}var Z={encoding:"utf-8",mode:384},B,Q=class{authPath;constructor(e=J(O(),"auth.json")){this.authPath=I(e)}ensureParentDir(){let e=He(this.authPath);j(e)||ze(e,{recursive:!0,mode:448})}ensureFileExists(){j(this.authPath)||Y(this.authPath,"{}",Z)}acquireLockSyncWithRetry(e){for(let n=1;;n++)try{return K.default.lockSync(e,{realpath:!1})}catch(i){if(!Ee(i)||n===10)throw i;let o=Date.now();for(;Date.now()-o<20;);}}withLock(e){this.ensureParentDir(),this.ensureFileExists();let t;try{t=this.acquireLockSyncWithRetry(this.authPath);let r=j(this.authPath)?F(this.authPath,"utf-8"):void 0,{result:n,next:i}=e(r);return i!==void 0&&Y(this.authPath,i,Z),n}finally{t&&t()}}async acquireLockAsync(e,t){let i=Date.now()+3e4,o=0,a=0;for(;;){e?.throwIfAborted();let d;try{d=await K.default.lock(this.authPath,{realpath:!1,retries:0,stale:3e4,onCompromised:t})}catch(c){e?.throwIfAborted();let l=Ee(c),x=i-Date.now();if(!l||x<=0||l==="EPERM"&&++a>Ge)throw c;let f=Math.min(10*2**o,2e3/2);o++;let h=Math.min(Math.round(f*(1+Math.random())),x);e?await we(h,void 0,{signal:e}):await we(h);continue}return e?.aborted&&(await d(),e.throwIfAborted()),d}}async withLockAsync(e,t){t?.signal?.throwIfAborted(),this.ensureParentDir(),this.ensureFileExists();let r,n=!1,i,o=()=>{if(n)throw i??new Error("Auth storage lock was compromised")};try{r=await this.acquireLockAsync(t?.signal,l=>{n=!0,i=l}),o(),t?.signal?.throwIfAborted();let a=j(this.authPath)?F(this.authPath,"utf-8"):void 0,{result:d,next:c}=await e(a);return o(),t?.signal?.throwIfAborted(),c!==void 0&&Y(this.authPath,c,Z),o(),d}finally{if(r)try{await r()}catch{}}}},ge=class{authPath;data;constructor(e=J(O(),"auth.json")){this.authPath=I(e)}load(){if(this.data)return this.data;let e;try{e=JSON.parse($(F(this.authPath,"utf-8")))}catch(t){if(t.code==="ENOENT")return this.data={},this.data;throw new Error(`Failed to read auth.json: ${t instanceof Error?t.message:String(t)}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Invalid auth.json: expected an object");for(let[t,r]of Object.entries(e)){if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`Invalid auth.json credential for provider "${t}"`);let n=r;if(n.type==="api_key"){let i=n.key===void 0||typeof n.key=="string",o=n.env===void 0||typeof n.env=="object"&&n.env!==null&&!Array.isArray(n.env)&&Object.values(n.env).every(a=>typeof a=="string");if(i&&o)continue}else if(n.type==="oauth"&&typeof n.access=="string"&&typeof n.refresh=="string"&&typeof n.expires=="number"&&Number.isFinite(n.expires))continue;throw new Error(`Invalid auth.json credential for provider "${t}"`)}return this.data=e,this.data}async read(e,t){t?.signal?.throwIfAborted();let r=this.load()[e];if(t?.signal?.throwIfAborted(),!!r)return r.type!=="api_key"||!r.key||pe(r.key)?structuredClone(r):{...r,key:W(r.key,r.env)}}async list(e){e?.signal?.throwIfAborted();let t=Object.entries(this.load()).map(([r,n])=>({providerId:r,type:n.type}));return e?.signal?.throwIfAborted(),t}async modify(e,t,r){throw new Error("Read-only credential storage cannot modify auth.json")}async delete(e,t){throw new Error("Read-only credential storage cannot modify auth.json")}},ee=class{value;asyncChain=Promise.resolve();withLock(e){let{result:t,next:r}=e(this.value);return r!==void 0&&(this.value=r),t}withLockAsync(e,t){let r=this.asyncChain,n=(async()=>{await r.catch(()=>{}),t?.signal?.throwIfAborted();let{result:i,next:o}=await e(this.value);return t?.signal?.throwIfAborted(),o!==void 0&&(this.value=o),i})();return this.asyncChain=n.catch(()=>{}),X(n,t?.signal)}},Se=class s{storage;authPath;readState;constructor(e,t){if(this.storage=e,this.authPath=t,this.readState=t&&B?.authPath===t?B.readState:{data:{}},t&&!B&&(B={authPath:t,readState:this.readState}),t){let r=v(t);if(r!==void 0&&r===this.readState.revision)return}this.reload()}static create(e=J(O(),"auth.json")){let t=I(e);return new s(new Q(t),t)}static fromStorage(e){return new s(e)}static inMemory(e={}){let t=new ee;return t.withLock(()=>({result:void 0,next:JSON.stringify(e,null,2)})),s.fromStorage(t)}parseStorageData(e){return e?JSON.parse($(e)):{}}updateReadState(e,t){this.readState.data=e,this.readState.revision=t}reload(){let e,t;try{this.storage.withLock(r=>(e=r,t=this.authPath?v(this.authPath):void 0,{result:void 0})),this.updateReadState(this.parseStorageData(e),t)}catch{}}async reloadFromStorageAsync(e){return this.storage.withLockAsync(async t=>{let r=this.parseStorageData(t),n=this.authPath?v(this.authPath):void 0;return this.updateReadState(r,n),{result:r}},e)}async readLatestData(e){if(e?.signal?.throwIfAborted(),!this.authPath){let n=this.reloadFromStorageAsync(e);return e?.signal?n:n.catch(()=>this.readState.data)}let t=v(this.authPath);if(t!==void 0&&t===this.readState.revision)return this.readState.data;if(!this.readState.reload){let n=new AbortController,i={controller:n,promise:this.reloadFromStorageAsync({signal:n.signal}),readers:0};this.readState.reload=i,i.promise.then(()=>{this.readState.reload===i&&(this.readState.reload=void 0)},()=>{this.readState.reload===i&&(this.readState.reload=void 0)})}let r=this.readState.reload;r.readers++;try{let n=X(r.promise,e?.signal);return e?.signal?await n:await n.catch(()=>this.readState.data)}finally{r.readers--,r.readers===0&&this.readState.reload===r&&(this.readState.reload=void 0,r.controller.abort())}}async read(e,t){let r=(await this.readLatestData(t))[e];return t?.signal?.throwIfAborted(),r?.type!=="api_key"||r.key===void 0?r:{...r,key:W(r.key,r.env)}}async modify(e,t,r){let n=this.readState.data,i,o=await this.storage.withLockAsync(async a=>{let d=this.parseStorageData(a),c=await t(d[e]);if(c===void 0)return n=d,i=this.authPath?v(this.authPath):void 0,{result:d[e]};let l={...d,[e]:c};return n=l,{result:c,next:JSON.stringify(l,null,2)}},r);return this.updateReadState(n,i),o}async delete(e,t){let r=this.readState.data;await this.storage.withLockAsync(async n=>{let i=this.parseStorageData(n);return delete i[e],r=i,{result:void 0,next:JSON.stringify(i,null,2)}},t),this.updateReadState(r)}async list(e){let t=Object.entries(await this.readLatestData(e));return e?.signal?.throwIfAborted(),t.map(([r,n])=>({providerId:r,type:n.type}))}};function _t(s,e=J(O(),"auth.json")){try{return JSON.parse($(F(I(e),"utf-8")))[s]}catch{return}}var w={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603},y=class extends Error{code;data;constructor(e,t,r){super(t),this.name="McpError",this.code=e,this.data=r}},p=class extends Error{constructor(e="MCP connection closed"){super(e),this.name="McpConnectionClosedError"}},V=class extends Error{timeoutMs;constructor(e){super(`MCP request timed out after ${e}ms`),this.name="McpTimeoutError",this.timeoutMs=e}},S=class extends Error{constructor(e="MCP request aborted"){super(e),this.name="AbortError"}};function u(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function R(s){return s instanceof Error?s:new Error(String(s))}function D(s){return typeof s=="string"||typeof s=="number"&&Number.isFinite(s)}function b(s){return u(s)&&s.jsonrpc==="2.0"&&D(s.id)&&typeof s.method=="string"}function U(s){return u(s)&&s.jsonrpc==="2.0"&&!("id"in s)&&typeof s.method=="string"}function P(s){return!u(s)||s.jsonrpc!=="2.0"||!D(s.id)?!1:"result"in s?!("error"in s):!("error"in s)||!u(s.error)?!1:typeof s.error.code=="number"&&typeof s.error.message=="string"}function M(s){if(b(s)||U(s)||P(s))return s;throw new y(w.invalidRequest,"Invalid JSON-RPC message")}var te="2025-11-25",xe=[te,"2025-06-18","2025-03-26","2024-11-05"];var We=3e4,Re=1e3;function Xe(s){if(!u(s)||typeof s.protocolVersion!="string"||!u(s.capabilities)||!u(s.serverInfo)||typeof s.serverInfo.name!="string"||typeof s.serverInfo.version!="string"||s.instructions!==void 0&&typeof s.instructions!="string")throw new y(w.invalidRequest,"Invalid MCP initialize result");return s}function N(s){return new y(w.invalidRequest,s)}function Ye(s,e,t,r){let n=u(t)?t[e]:void 0;if(!u(t)||!Array.isArray(n))throw N(`Invalid MCP ${s} result`);for(let o of n)if(!u(o)||!r(o))throw N(`Invalid entry in MCP ${s} result`);let i=t.nextCursor===null||t.nextCursor===""?void 0:t.nextCursor;if(i!==void 0&&typeof i!="string")throw N(`Invalid MCP ${s} cursor`);return{items:n,...i===void 0?{}:{nextCursor:i}}}var Ze=s=>typeof s.name=="string"&&u(s.inputSchema),ve=s=>typeof s.uri=="string"&&(s.name===void 0||typeof s.name=="string"),Ce=s=>typeof s.uriTemplate=="string"&&(s.name===void 0||typeof s.name=="string");function be(s){return{...s,name:s.name??s.uri}}function Pe(s){return{...s,name:s.name??s.uriTemplate}}function Me(s){return s.nextCursor===void 0?{}:{nextCursor:s.nextCursor}}function Ke(s){if(!u(s)||!Array.isArray(s.contents))throw N("Invalid MCP resources/read result");for(let e of s.contents)if(!u(e)||typeof e.uri!="string"||typeof e.text!="string"&&typeof e.blob!="string")throw N("Invalid contents in MCP resources/read result");return s}function Qe(s){if(!u(s)||s.content!==void 0&&!Array.isArray(s.content))throw new y(w.invalidRequest,"Invalid MCP tools/call result");return s.content===void 0?{...s,content:[]}:s}var re=class{options;state="idle";transport;nextRequestId=1;serverInfoValue;serverCapabilitiesValue;instructionsValue;protocolVersionValue;pending=new Map;progressRequests=new Map;incoming=new Map;requestHandlers=new Map;notificationListeners=new Map;errorListeners=new Set;closeListeners=new Set;disposers=[];constructor(e){this.options=Object.freeze({...e}),this.requestHandlers.set("ping",()=>({}));let t=e.roots;t&&this.requestHandlers.set("roots/list",async()=>({roots:[...typeof t=="function"?await t():t]}))}get connectionState(){return this.state}get serverInfo(){return this.serverInfoValue}get serverCapabilities(){return this.serverCapabilitiesValue}get instructions(){return this.instructionsValue}get protocolVersion(){return this.protocolVersionValue}async connect(e){if(this.state!=="idle")throw new Error(`Cannot connect MCP client in ${this.state} state`);this.state="connecting",this.transport=e,this.disposers=[e.onMessage(t=>this.handleMessage(t)),e.onError(t=>this.emitError(t)),e.onClose(()=>this.handleTransportClose())];try{await e.start();let t={...this.options.capabilities};this.options.roots&&t.roots===void 0&&(t.roots={});let r=Xe(await this.requestInternal("initialize",{protocolVersion:this.options.protocolVersion??te,capabilities:t,clientInfo:{name:this.options.name,version:this.options.version,...this.options.title===void 0?{}:{title:this.options.title}}},{},!0));if(!xe.includes(r.protocolVersion))throw new Error(`MCP server selected unsupported protocol version ${r.protocolVersion}`);return this.protocolVersionValue=r.protocolVersion,this.serverInfoValue=r.serverInfo,this.serverCapabilitiesValue=r.capabilities,this.instructionsValue=r.instructions,e.setProtocolVersion?.(r.protocolVersion),await this.notifyInternal("notifications/initialized",void 0,!0),this.state="connected",r}catch(t){throw await this.close().catch(()=>{}),t}}request(e,t,r={}){return this.requestInternal(e,t,r,!1)}notify(e,t){return this.notifyInternal(e,t,!1)}setRequestHandler(e,t){return this.requestHandlers.set(e,t),()=>{this.requestHandlers.get(e)===t&&this.requestHandlers.delete(e)}}onNotification(e,t){let r=this.notificationListeners.get(e)??new Set;return this.notificationListeners.set(e,r),r.add(t),()=>{r.delete(t),r.size===0&&this.notificationListeners.delete(e)}}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}async ping(e={}){await this.request("ping",void 0,e)}async listTools(e={}){return await this.listAll("tools/list","tools",Ze,e)}async listResources(e={}){return(await this.listAll("resources/list","resources",ve,e)).map(be)}async listResourcesPage(e,t={}){let r=await this.listPage("resources/list","resources",ve,e,t);return{resources:r.items.map(be),...Me(r)}}async listResourceTemplates(e={}){return(await this.listAll("resources/templates/list","resourceTemplates",Ce,e)).map(Pe)}async listResourceTemplatesPage(e,t={}){let r=await this.listPage("resources/templates/list","resourceTemplates",Ce,e,t);return{resourceTemplates:r.items.map(Pe),...Me(r)}}async readResource(e,t={}){return Ke(await this.request("resources/read",{uri:e},t))}async listPage(e,t,r,n,i){return Ye(e,t,await this.request(e,n===void 0?void 0:{cursor:n},i),r)}async listAll(e,t,r,n){let i=[],o=new Set,a;for(let d=0;d<Re;d++){let c=await this.listPage(e,t,r,a,n);if(i.push(...c.items),c.nextCursor===void 0)return i;if(o.has(c.nextCursor))throw new Error(`MCP ${e} returned duplicate cursor: ${c.nextCursor}`);o.add(c.nextCursor),a=c.nextCursor}throw new Error(`MCP ${e} exceeded ${Re} pages`)}async callTool(e,t,r={}){return Qe(await this.request("tools/call",{name:e,...t===void 0?{}:{arguments:t}},r))}async close(){let e=this.transport;this.transport=void 0,this.disposeTransportListeners(),this.markClosed(new p),await e?.close()}async requestInternal(e,t,r,n){let i=this.requireTransport(n);if(r.signal?.aborted)throw new S;let o=this.nextRequestId++,a=r.onProgress?o:void 0,d=a===void 0?t:{...t,_meta:{...u(t?._meta)?t._meta:{},progressToken:a}},c={jsonrpc:"2.0",id:o,method:e,...d===void 0?{}:{params:d}};return new Promise((l,x)=>{let f={resolve:l,reject:x,timeoutMs:r.timeoutMs??this.options.requestTimeoutMs??We,timer:void 0,signal:r.signal,onAbort:()=>this.cancelPending(o,new S,e!=="initialize",String(r.signal?.reason??"Aborted")),sendController:new AbortController,cancellable:e!=="initialize",onProgress:r.onProgress,progressToken:a};this.pending.set(o,f),a!==void 0&&this.progressRequests.set(a,o),r.signal?.addEventListener("abort",f.onAbort,{once:!0}),this.armTimeout(o,f),i.send(c,{signal:f.sendController.signal}).catch(h=>this.cancelPending(o,h,!1))})}async notifyInternal(e,t,r){await this.requireTransport(r).send({jsonrpc:"2.0",method:e,...t===void 0?{}:{params:t}})}requireTransport(e){if(this.transport&&(this.state==="connected"||e&&this.state==="connecting"))return this.transport;throw new p(`MCP client is ${this.state}`)}handleMessage(e){if(P(e)){this.handleResponse(e);return}if(b(e)){this.handleRequest(e);return}if(U(e)){this.handleNotification(e.method,e.params);return}this.emitError(new y(w.invalidRequest,"Received invalid JSON-RPC message"))}handleResponse(e){let t=this.pending.get(e.id);if(!t){this.emitError(new Error(`Received response for unknown MCP request ${String(e.id)}`));return}this.removePending(e.id,t),"error"in e?t.reject(new y(e.error.code,e.error.message,e.error.data)):t.resolve(e.result)}async handleRequest(e){let t=this.transport;if(!t)return;let r=this.requestHandlers.get(e.method);if(!r){await t.send({jsonrpc:"2.0",id:e.id,error:{code:w.methodNotFound,message:`Method not found: ${e.method}`}}).catch(i=>this.emitError(i));return}let n=new AbortController;this.incoming.set(e.id,n);try{let i=await r(e.params,{signal:n.signal});await t.send({jsonrpc:"2.0",id:e.id,result:i??{}})}catch(i){let o=i instanceof y?{code:i.code,message:i.message,data:i.data}:{code:w.internalError,message:R(i).message};await t.send({jsonrpc:"2.0",id:e.id,error:o}).catch(a=>this.emitError(a))}finally{this.incoming.delete(e.id)}}handleNotification(e,t){e==="notifications/progress"?this.handleProgress(t):e==="notifications/cancelled"&&this.handleCancelled(t);for(let r of this.notificationListeners.get(e)??[])try{r(t)}catch(n){this.emitError(n)}}handleProgress(e){if(!u(e)||!D(e.progressToken)||typeof e.progress!="number")return;let t=this.progressRequests.get(e.progressToken),r=t===void 0?void 0:this.pending.get(t);if(!(t===void 0||!r)){this.armTimeout(t,r);try{r.onProgress?.(e)}catch(n){this.emitError(n)}}}handleCancelled(e){u(e)&&D(e.requestId)&&this.incoming.get(e.requestId)?.abort(e.reason)}armTimeout(e,t){t.timer&&clearTimeout(t.timer),!(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)&&(t.timer=setTimeout(()=>{this.cancelPending(e,new V(t.timeoutMs),t.cancellable,"Request timed out")},t.timeoutMs))}cancelPending(e,t,r,n){let i=this.pending.get(e);i&&(this.removePending(e,i),i.reject(t),r&&this.transport&&this.transport.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:e,...n?{reason:n}:{}}}).catch(o=>this.emitError(o)))}removePending(e,t){this.pending.delete(e),t.timer&&clearTimeout(t.timer),t.progressToken!==void 0&&this.progressRequests.delete(t.progressToken),t.signal?.removeEventListener("abort",t.onAbort),t.sendController.abort()}rejectPending(e){for(let[t,r]of this.pending)this.removePending(t,r),r.reject(e)}handleTransportClose(){this.markClosed(new p)}markClosed(e){let t=this.state==="closed";this.state="closed",this.rejectPending(e);for(let r of this.incoming.values())r.abort(e);if(this.incoming.clear(),!t)for(let r of[...this.closeListeners])try{r()}catch(n){this.emitError(n)}}emitError(e){let t=R(e);for(let r of this.errorListeners)r(t)}disposeTransportListeners(){for(let e of this.disposers.splice(0))e()}};var Ae=ce(Oe(),1);import{spawn as et}from"node:child_process";import A from"node:process";var k=16*1024*1024,T=class{messageListeners=new Set;errorListeners=new Set;closeListeners=new Set;closeEmitted=!1;onMessage(e){return this.messageListeners.add(e),()=>this.messageListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}emitMessage(e){for(let t of this.messageListeners)t(e)}emitError(e){let t=R(e);for(let r of this.errorListeners)r(t)}emitClose(){if(!this.closeEmitted){this.closeEmitted=!0;for(let e of this.closeListeners)e()}}};var tt=64*1024,rt=2e3,st=500,ne=A.platform!=="win32",ie=new Set,Te=!1;function se(s,e){let t=s.pid;if(A.platform==="win32"&&t!==void 0){if(s.exitCode!==null)return;et("taskkill",["/pid",String(t),"/T","/F"],{stdio:"ignore",windowsHide:!0}).on("error",()=>{});return}if(ne&&t!==void 0)try{A.kill(-t,e);return}catch{}try{s.kill(e)}catch{}}function nt(){Te||(Te=!0,A.once("exit",()=>{for(let s of ie)try{A.kill(-s,"SIGTERM")}catch{}}))}var oe=class extends T{options;child;stdoutBuffer=Buffer.alloc(0);stderrBuffer=Buffer.alloc(0);started=!1;closed=!1;constructor(e){super(),this.options=Object.freeze({...e,args:e.args?[...e.args]:void 0})}get pid(){return this.child?.pid}get stderr(){return this.stderrBuffer.toString("utf8")}async start(){if(this.started)throw new Error("MCP stdio transport already started");if(this.closed)throw new p;this.started=!0;let e=this.options.inheritEnv===!1?{...this.options.env}:{...A.env,...this.options.env},t=(0,Ae.default)(this.options.command,this.options.args??[],{cwd:this.options.cwd,env:e,stdio:["pipe","pipe",this.options.stderr==="inherit"?"inherit":"pipe"],windowsHide:!0,detached:ne});this.child=t;let r=t.pid;ne&&r!==void 0&&(nt(),ie.add(r),t.once("exit",()=>ie.delete(r))),t.stdout?.on("data",n=>this.handleStdout(n)),t.stdout?.on("error",n=>this.emitError(n)),t.stdin?.on("error",n=>{this.closed||this.emitError(n)}),t.stderr?.on("data",n=>this.handleStderr(n)),t.stderr?.on("error",n=>this.emitError(n)),t.on("close",()=>{this.child=void 0,this.stdoutBuffer.toString("utf8").trim()&&this.emitError(new Error("MCP stdio server closed with an incomplete JSON-RPC message")),this.stdoutBuffer=Buffer.alloc(0),this.emitClose()}),await new Promise((n,i)=>{let o=()=>{t.off("error",a),n()},a=d=>{t.off("spawn",o),i(d)};t.once("spawn",o),t.once("error",a)}),t.on("error",n=>{this.closed||this.emitError(n)})}async send(e){let t=this.child?.stdin;if(!this.started||this.closed||!t?.writable)throw new p;let r=`${JSON.stringify(e)}
5
+ `;await new Promise((n,i)=>{t.write(r,o=>o?i(o):n())})}async close(){if(this.closed)return;this.closed=!0;let e=this.child;if(!e){this.emitClose();return}if(e.exitCode!==null||e.signalCode!==null){e.stdin?.end();return}let t=this.options.closeTimeoutMs??rt;await new Promise(r=>{let n=[];e.once("close",()=>{for(let o of n)clearTimeout(o);se(e,"SIGTERM"),r()});let i=Math.min(st,t);n.push(setTimeout(()=>se(e,"SIGTERM"),i)),n.push(setTimeout(()=>se(e,"SIGKILL"),i+t)),e.stdin?.end()})}handleStdout(e){this.stdoutBuffer=Buffer.concat([this.stdoutBuffer,Buffer.isBuffer(e)?e:Buffer.from(e)]);let t=this.options.maxMessageBytes??k;for(;;){let r=this.stdoutBuffer.indexOf(10);if(r<0){this.stdoutBuffer.length>t&&(this.stdoutBuffer=Buffer.alloc(0),this.emitError(new Error(`MCP stdio message exceeds ${t} bytes`)));return}let n=this.stdoutBuffer.subarray(0,r);if(this.stdoutBuffer=this.stdoutBuffer.subarray(r+1),n.length>t){this.emitError(new Error(`MCP stdio message exceeds ${t} bytes`));continue}let i=n.toString("utf8").replace(/\r$/,"");if(i.trim())try{this.emitMessage(M(JSON.parse(i)))}catch(o){this.emitError(o)}}}handleStderr(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e),r=this.options.maxStderrBytes??tt;this.stderrBuffer=Buffer.concat([this.stderrBuffer,t]),this.stderrBuffer.length>r&&(this.stderrBuffer=this.stderrBuffer.subarray(-r)),this.options.onStderr?.(t.toString("utf8"))}};var it=8*1024,_e=500,ot=1e3,at=3e4,ct=5;async function dt(s,e){let t=s.getReader(),r=new TextDecoder,n="",i,o,a=[],d=0,c=e.maxEventBytes??k,l=()=>{if(a.length===0){i=void 0,o=void 0;return}let f=a.join(`
6
+ `);e.onEvent({...i?{event:i}:{},data:f,...o?{id:o}:{}}),i=void 0,o=void 0,a=[],d=0},x=f=>{let h=f.endsWith("\r")?f.slice(0,-1):f;if(h===""){l();return}if(h.startsWith(":"))return;let g=h.indexOf(":"),q=g<0?h:h.slice(0,g),m=g<0?"":h.slice(g+1);if(m.startsWith(" ")&&(m=m.slice(1)),q==="data"){if(d+=Buffer.byteLength(m)+(a.length>0?1:0),d>c)throw new Error(`MCP SSE event exceeds ${c} bytes`);a.push(m)}else q==="event"?i=m:q==="id"&&!m.includes("\0")?(o=m,e.onId?.(m)):q==="retry"&&/^\d+$/.test(m)&&e.onRetry?.(Number(m))};try{for(;;){let{done:f,value:h}=await t.read();if(f)break;n+=r.decode(h,{stream:!0});let g=n.indexOf(`
7
+ `);for(;g>=0;)x(n.slice(0,g)),n=n.slice(g+1),g=n.indexOf(`
8
+ `);if(Buffer.byteLength(n)>c)throw new Error(`MCP SSE event exceeds ${c} bytes`)}n+=r.decode(),n&&x(n),l()}finally{t.releaseLock()}}var E=class extends Error{status;body;constructor(e,t,r=""){super(t),this.name="McpHttpError",this.status=e,this.body=r}},z=class extends E{wwwAuthenticate;constructor(e,t=""){super(401,"MCP server requires authentication",t),this.name="McpAuthRequiredError",this.wwwAuthenticate=e.headers.get("www-authenticate")}},H=class extends E{constructor(e=""){super(404,"MCP session expired",e),this.name="McpSessionExpiredError"}};function Ie(s){return s.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()}function ut(s){return s.status===401?!0:s.status!==403?!1:/(?:^|[\s,])error="?insufficient_scope"?/i.test(s.headers.get("www-authenticate")??"")}function lt(s){return s===408||s===429||s>=500}function _(s){return s.body?.cancel().catch(()=>{})??Promise.resolve()}function ft(s,e){let t=e.trim(),r=t.length>_e?`${t.slice(0,_e-3)}...`:t;return`MCP HTTP request failed with status ${s}${r?`: ${r}`:""}`}var ae=class extends T{url;options;fetch;controller=new AbortController;started=!1;closed=!1;sessionIdValue;protocolVersion;getStreamStarted=!1;lastToken;constructor(e){super(),this.options=Object.freeze({...e,headers:e.headers?{...e.headers}:void 0}),this.url=new URL(e.url);let t=e.fetch??globalThis.fetch;this.fetch=(r,n)=>t(r,n)}get sessionId(){return this.sessionIdValue}async start(){if(this.started)throw new Error("MCP Streamable HTTP transport already started");if(this.closed)throw new p;this.started=!0}setProtocolVersion(e){this.protocolVersion=e}async send(e,{signal:t}={}){if(!this.started||this.closed)throw new p;let r=await this.authorizedFetch("POST",{headers:{accept:"application/json, text/event-stream","content-type":"application/json"},body:JSON.stringify(e)},t);if(await this.checkResponse(r),this.captureSession(r),!b(e)){await _(r),"method"in e&&e.method==="notifications/initialized"&&this.startGetStream();return}if(r.status===202||r.status===204)throw new E(r.status,`MCP server accepted request ${e.method} without a response`);let n=Ie(r);if(n==="application/json"){let i=await r.json();for(let o of Array.isArray(i)?i:[i])this.emitMessage(M(o));return}if(n==="text/event-stream"&&r.body){this.consumeResponseStream(r.body,e.id);return}throw await _(r),new E(r.status,`Unsupported MCP response content type: ${n??"missing"}`)}async close(){if(!this.closed){if(this.closed=!0,this.controller.abort(),this.started&&this.sessionIdValue)try{let e=await this.fetch(this.url,{method:"DELETE",headers:this.buildHeaders({},this.lastToken),signal:AbortSignal.timeout(1e3)});await _(e)}catch{}this.emitClose()}}async authorizedFetch(e,t,r){let n=this.options.authProvider?.onUnauthorized?.bind(this.options.authProvider);for(let i=0;;i++){let{headers:o,token:a}=await this.headers(t.headers);if(r?.aborted)throw new S;let d=await this.fetch(this.url,{method:e,headers:o,body:t.body,signal:this.controller.signal});if(i>0||!n||!ut(d))return d;try{await n({response:d,serverUrl:this.url,fetch:this.fetch,token:a})}finally{await _(d)}}}async headers(e={}){let t=await this.options.authProvider?.token();return this.lastToken=t,{headers:this.buildHeaders(e,t),...t?{token:t}:{}}}buildHeaders(e,t){let r=new Headers(this.options.headers);for(let[n,i]of Object.entries(e))r.set(n,i);return this.sessionIdValue&&r.set("Mcp-Session-Id",this.sessionIdValue),this.protocolVersion&&r.set("MCP-Protocol-Version",this.protocolVersion),t&&r.set("Authorization",`Bearer ${t}`),r}captureSession(e){let t=e.headers.get("mcp-session-id");t&&(this.sessionIdValue=t)}async checkResponse(e){if(e.ok)return;let t=(await e.text().catch(()=>"")).slice(0,it);throw e.status===401?new z(e,t):e.status===404&&this.sessionIdValue?new H(t):new E(e.status,ft(e.status,t),t)}async consumeSse(e,t,r){await dt(e,{maxEventBytes:this.options.maxMessageBytes??k,onId:n=>{t.lastEventId=n},onRetry:n=>{t.retryMs=n},onEvent:n=>{if(t.received=!0,!n.data.trim()||n.event!==void 0&&n.event!=="message")return;let i;try{i=M(JSON.parse(n.data))}catch(o){this.emitError(o);return}r?.(i),this.emitMessage(i)}})}async consumeResponseStream(e,t){let r={lastEventId:void 0,retryMs:void 0,received:!1},n=!1,i=c=>{P(c)&&c.id===t&&(n=!0)},o=e,a;for(let c=0;;){if(o)try{await this.consumeSse(o,r,i),a=void 0}catch(l){a=l}if(n||this.closed)return;if(a!==void 0&&!this.isRetryable(a)||r.lastEventId===void 0||c>=this.maxRetries())break;if(r.received&&(c=0),r.received=!1,!await this.sleep(this.reconnectDelay(c++,r.retryMs)))return;try{o=await this.openSseStream(r.lastEventId)}catch(l){if(a=l,!this.isRetryable(l))break;o=void 0}}if(this.closed)return;let d=a===void 0?"stream ended without a response":R(a).message;this.emitMessage({jsonrpc:"2.0",id:t,error:{code:w.internalError,message:`MCP response stream failed: ${d}`}})}startGetStream(){this.options.openGetStream===!1||this.getStreamStarted||this.closed||(this.getStreamStarted=!0,this.runGetStream())}async runGetStream(){let e={lastEventId:void 0,retryMs:void 0,received:!1};for(let t=0;!this.closed;){try{let r=await this.openSseStream(e.lastEventId);if(!r)return;let n=Date.now();await this.consumeSse(r,e),(e.received||Date.now()-n>this.maxDelay())&&(t=0)}catch(r){if(this.closed)return;if(!this.isRetryable(r)){this.emitError(r);return}}if(e.received=!1,t>=this.maxRetries()){this.emitError(new Error("MCP server-to-client stream dropped and could not be reopened"));return}if(!await this.sleep(this.reconnectDelay(t++,e.retryMs)))return}}async openSseStream(e){let t=await this.authorizedFetch("GET",{headers:{accept:"text/event-stream",...e===void 0?{}:{"last-event-id":e}}});if(t.status===405){await _(t);return}await this.checkResponse(t),this.captureSession(t);let r=Ie(t);if(r!=="text/event-stream"||!t.body)throw await _(t),new E(t.status,`Unsupported MCP GET response content type: ${r??"missing"}`);return t.body}isRetryable(e){if(e instanceof E)return lt(e.status);if(e instanceof TypeError)return!0;let t=e?.code;return typeof t=="string"&&(t.startsWith("E")||t.startsWith("UND_ERR"))}reconnectDelay(e,t){if(t!==void 0)return t;let r=this.options.reconnect?.initialDelayMs??ot;return Math.min(r*2**e,this.maxDelay())}maxDelay(){return this.options.reconnect?.maxDelayMs??at}maxRetries(){return this.options.reconnect?.maxRetries??ct}sleep(e){let t=this.controller.signal;return t.aborted?Promise.resolve(!1):new Promise(r=>{let n=()=>{clearTimeout(i),r(!1)},i=setTimeout(()=>{t.removeEventListener("abort",n),r(!0)},e);i.unref?.(),t.addEventListener("abort",n,{once:!0})})}};function ht(s){switch(s.type){case"text":return{type:"text",text:s.text};case"image":return{type:"image",data:s.data,mimeType:s.mimeType};case"audio":return{type:"text",text:`[audio ${s.mimeType} omitted]`};case"resource_link":return{type:"text",text:`${s.name}: ${s.uri}`};case"resource":{let e=s.resource;return"text"in e?{type:"text",text:e.text}:e.mimeType?.startsWith("image/")?{type:"image",data:e.blob,mimeType:e.mimeType}:{type:"text",text:`[binary resource ${e.uri} (${e.mimeType??"unknown type"}) omitted]`}}default:return{type:"text",text:`[unsupported MCP content ${s.type}]`}}}function pt(s){let e=(s.content??[]).map(ht);return e.length===0&&s.structuredContent!==void 0&&e.push({type:"text",text:JSON.stringify(s.structuredContent,null,2)}),e}export{je as a,pe as b,wt as c,Ue as d,Et as e,St as f,X as g,Q as h,ge as i,Se as j,_t as k,w as l,y as m,u as n,te as o,re as p,pt as q,oe as r,E as s,z as t,H as u,ae as v};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import*as a from"node:path";import{promises as f}from"node:fs";var l=200;function u(e){if(Buffer.byteLength(e)<=l)return e;let n=a.extname(e),t=Buffer.byteLength(n)<=32?n:"",o=t?e.slice(0,-t.length):e,c="",s=Buffer.byteLength(t);for(let r of o){let i=Buffer.byteLength(r);if(s+i>l)break;c+=r,s+=i}return`${c||"file"}${t}`}function h(e){let t=(e.replace(/\\/g,"/").split("/").pop()??"").replace(/[\u0000-\u001F\u007F]/g,"_").trim();return!t||t==="."||t===".."?"file":u(t)}function m(e){let n=a.extname(e),t=/^\.[A-Za-z0-9]{1,16}$/.test(n)?n:"";return`${((t?e.slice(0,-n.length):e).replace(/[^A-Za-z0-9._-]/g,"_").replace(/^[._-]+|[._-]+$/g,"")||"file").slice(0,l-t.length)}${t}`}async function x(e,n){let t=n.lastIndexOf("."),o=t>0?n.slice(0,t):n,c=t>0?n.slice(t):"",s=n,r=0;for(;;){let i=a.join(e,s);try{await f.access(i),r++,s=`${o}_${r}${c}`}catch{return{destPath:i,finalName:s}}}}export{h as a,m as b,x as c};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{e as l}from"./chunk-NAA7GF6Q.js";import{f as s}from"./chunk-J5DVLUKY.js";import{spawn as f}from"node:child_process";var i=l("hook-exec"),c=2e3;function u(r,n){r.settled||(r.settled=!0,r.resolve(n))}function d(r,n,e,o=null){r.settled||(i.error(e),u(r,{stdout:r.stdout.trim(),stderr:r.stderr.slice(-c),exitCode:o,error:n}))}function m(r,n,e,o){if(o==="SIGTERM"||o==="SIGKILL"){let t=`timed out after ${n.timeoutMs}ms`;d(r,t,`${t} (${n.label})`);return}if(e!==0){let t=`exited with code ${e}`,a=r.stderr?`: ${r.stderr.trim()}`:"";d(r,t,`${t} (${n.label})${a}`,e);return}u(r,{stdout:r.stdout.trim(),stderr:r.stderr.slice(-c),exitCode:0})}function $(r,n){r.on("error",e=>{i.warn(`stdin write failed (${n.label}): ${e.message}`)});try{r.write(n.stdinPayload)}catch(e){i.warn(`stdin write failed (${n.label}): ${String(e)}`)}try{r.end()}catch(e){i.warn(`stdin end failed (${n.label}): ${String(e)}`)}}function w(r){return f("sh",["-c",`${r.command} "$@"`,"hook",...r.args??[]],{stdio:["pipe","pipe","pipe"],cwd:s,timeout:r.timeoutMs,...r.env?{env:r.env}:{}})}function g(r,n){try{let e=w(r);e.stdout.on("data",o=>{n.stdout+=o.toString()}),e.stderr.on("data",o=>{n.stderr+=o.toString()}),e.on("error",o=>{d(n,o.message,`spawn error (${r.label}): ${o.message}`)}),e.on("close",(o,t)=>m(n,r,o,t)),$(e.stdin,r)}catch(e){let o=e instanceof Error?e.message:String(e);d(n,o,`spawn error (${r.label}): ${o}`)}}function I(r){return new Promise(n=>{g(r,{stdout:"",stderr:"",settled:!1,resolve:n})})}export{I as a};
@@ -0,0 +1,6 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as i,b as m}from"./chunk-7MU2AKNM.js";import{f as g}from"./chunk-LMSQZ6TQ.js";import{e as f,f as y}from"./chunk-BGVHA2D4.js";import{e as l}from"./chunk-NAA7GF6Q.js";import{mkdirSync as a,existsSync as u,readFileSync as D,writeFileSync as S,lstatSync as h,readlinkSync as d,unlinkSync as I,symlinkSync as _,copyFileSync as x}from"fs";import*as o from"path";var p=l("pi-agent-dir"),j=f(),O=y();function N(t){let r=t?.userAuthPath??j,n=t?.agentDir??i,e=o.join(n,"auth.json");if(u(r)){if(a(n,{recursive:!0}),u(e)||R(e))try{if(h(e).isSymbolicLink()&&d(e)===r&&process.platform!=="win32")return;I(e)}catch(s){p.warn(`Failed to inspect/remove existing ${e}: ${s.message}`);return}process.platform==="win32"?x(r,e):_(r,e)}}function R(t){try{return h(t).isSymbolicLink()?!u(t):!1}catch{return!1}}var k=o.join(i,"agents");function $(t){g({defaultsDir:t?.defaultsDir,rolesDir:t?.rolesDir,legacyDir:t?.legacyDir??k})}function T(){a(i,{recursive:!0}),a(m,{recursive:!0}),$(),E()}function E(t){let r=o.join(t?.agentDir??i,"settings.json"),n=A(r);if(n.transport!=="sse")try{S(r,`${JSON.stringify({...n,transport:"sse"},null,2)}
5
+ `)}catch(e){p.warn(`Failed to pin PI transport in ${r}: ${e.message}`)}}function U(t,r){let n=o.join(r?.agentDir??i,"settings.json"),e=A(n),s=e.compaction,c=s&&typeof s=="object"&&!Array.isArray(s)?s:{};if(c.reserveTokens!==t)try{S(n,`${JSON.stringify({...e,compaction:{...c,reserveTokens:t}},null,2)}
6
+ `)}catch(P){p.warn(`Failed to set PI compaction reserve in ${n}: ${P.message}`)}}function A(t){try{let r=JSON.parse(D(t,"utf-8"));return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch{return{}}}export{O as a,N as b,$ as c,T as d,U as e};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ var a=["anthropic-messages","openai-completions","openai-responses","google-generative-ai"],c=/^[a-zA-Z0-9_-]+$/,p="cortex-gateway",m={"anthropic-messages":"anthropic","openai-completions":"openai","openai-responses":"openai","google-generative-ai":"google"};function f(e){return m[e]}function d(e,o){return e==="anthropic-messages"?"anthropic":o}function u(e,o,s){return`${e.replace(/\/+$/,"")}/m/${o}/${d(s,o)}`}function l(e){let o=[],s=e.name?.trim()??"";s?c.test(s)||o.push("name-charset"):o.push("name-required"),a.includes(e.api)||o.push("api-invalid");let n=e.upstreamUrl?.trim()??"";n?/^https?:\/\/\S+$/i.test(n)||o.push("upstream-scheme"):o.push("upstream-required");let t=e.models??[];if(t.length===0)o.push("models-required");else{let r=t.map(i=>i.id?.trim()??"");r.some(i=>!i)?o.push("model-id-required"):new Set(r).size!==r.length&&o.push("model-id-duplicate")}return o}function g(e){return{...e,name:e.name?.trim()??"",upstreamUrl:e.upstreamUrl?.trim()??"",models:(e.models??[]).map(o=>({...o,id:o.id?.trim()??""}))}}function h(e,o){let s={baseUrl:u(o,e.name,e.api),api:e.api,apiKey:p,models:e.models.map(n=>{let t={id:n.id};return n.contextWindow!==void 0&&(t.contextWindow=n.contextWindow),n.maxTokens!==void 0&&(t.maxTokens=n.maxTokens),n.reasoning!==void 0&&(t.reasoning=n.reasoning),t})};return e.headers&&Object.keys(e.headers).length>0&&(s.headers=e.headers),e.compat&&Object.keys(e.compat).length>0&&(s.compat=e.compat),s}function x(e){return(Array.isArray(e.models)?e.models:[]).filter(s=>!!s&&typeof s=="object").map(s=>{let n={id:String(s.id??"")};return typeof s.contextWindow=="number"&&(n.contextWindow=s.contextWindow),typeof s.maxTokens=="number"&&(n.maxTokens=s.maxTokens),typeof s.reasoning=="boolean"&&(n.reasoning=s.reasoning),n})}export{a,c as b,f as c,d,l as e,g as f,h as g,x as h};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ var f=new Set;function g(r){return f.add(r),()=>{f.delete(r)}}function l(r){let t=[];for(let s of f)try{s(r)}catch(e){t.push(e)}if(t.length>0)throw new AggregateError(t,"Failed to cleanup session resources")}var a=(1n<<41n)-1n,u=-1,n;function x(r){let t=r??Date.now();if(!Number.isInteger(t)||t<0||t>0xffffffffffff)throw new RangeError(`UUIDv7 timestamp must be an integer between 0 and ${0xffffffffffff}`);let s=r===void 0?Math.max(t,u):r;r===void 0&&(u=s);let e=new Uint8Array(16);if(globalThis.crypto.getRandomValues(e),n===void 0)n=BigInt(e[1])<<32n|BigInt(e[2])<<24n|BigInt(e[3])<<16n|BigInt(e[4])<<8n|BigInt(e[5]);else{if(n===a)throw new RangeError("UUIDv7 generator sequence exhausted");n++}let c=BigInt(s);for(let o=5;o>=0;o--)e[o]=Number(c>>BigInt((5-o)*8))&255;e[6]=112|Number(n>>37n&0x0fn),e[7]=Number(n>>29n&0xffn),e[8]=128|Number(n>>23n&0x3fn),e[9]=Number(n>>15n&0xffn),e[10]=Number(n>>7n&0xffn),e[11]=Number((n&0x7fn)<<1n)|e[11]&1;let i=Array.from(e,o=>o.toString(16).padStart(2,"0"));return`${i.slice(0,4).join("")}-${i.slice(4,6).join("")}-${i.slice(6,8).join("")}-${i.slice(8,10).join("")}-${i.slice(10).join("")}`}export{g as a,l as b,x as c};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as K}from"./chunk-JERCOLY3.js";import{d as I}from"./chunk-W5LGYSPZ.js";import{e as A}from"./chunk-NAA7GF6Q.js";import{t as S}from"./chunk-J5DVLUKY.js";import{e as Y}from"./chunk-WHC7AYZD.js";var j=Y(K(),1);import*as u from"fs";import*as f from"path";var b=A("index-regen"),C=["experiments","knowledge","patterns"],X=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,H=/^([A-Za-z_][\w-]*):(?:\s|$)/;function N(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function J(t){let s={},r=null,i=[],c=()=>{if(!r)return;let o=i.join(`
5
+ `);try{let n=(0,j.parse)(o);s[r]=N(n)?n[r]:null}catch{s[r]=o.slice(r.length+1).trim()}};for(let o of t.split(/\r?\n/)){let n=H.exec(o);n?(c(),r=n[1],i=[o]):r&&i.push(o)}return c(),s}function B(t){let s=X.exec(t);if(!s)return{meta:{},valid:!0};try{let r=(0,j.parse)(s[1]);if(N(r))return{meta:r,valid:!0}}catch{}return{meta:J(s[1]),valid:!1}}function w(t){return Array.isArray(t)?t.map(s=>String(s)):[]}function V(t){let s=new Map,r;try{r=u.readFileSync(f.join(t,"_meta","access-log.jsonl"),"utf8")}catch{return s}for(let i of r.split(`
6
+ `)){if(!i.trim())continue;let c;try{c=JSON.parse(i)}catch{continue}if(typeof c.file!="string")continue;let o=typeof c.ts=="string"?c.ts:null,n=s.get(c.file);if(!n){s.set(c.file,{refs:1,lastRef:o});continue}n.refs++,o&&(!n.lastRef||o>n.lastRef)&&(n.lastRef=o)}return s}var q={refs:0,lastRef:null};function z(t){let s;try{s=u.readdirSync(t).sort()}catch{return[]}let r=[];for(let i of s){if(i==="index.md"||i.startsWith("_")||i.startsWith(".")||!i.endsWith(".md"))continue;let c;try{c=u.readFileSync(f.join(t,i),"utf8")}catch{continue}let{meta:o,valid:n}=B(c);o.id===void 0||o.id===null||o.id===""||(n||b.warn(`${f.join(t,i)}: frontmatter is not valid YAML, read key by key`),r.push({id:String(o.id),filename:i,meta:o,validFrontmatter:n}))}return r}var Z=["invalidated"],G=["superseded","deprecated"],Q=["refined","stale"];function m(t){let s=t.meta.status;return s==null?"":String(s)}function T(t){if(!t)return!0;let s=t.toLowerCase();return!(Z.some(r=>s.startsWith(r))||G.some(r=>s.startsWith(r))||Q.includes(s))}function k(t){return t.toLowerCase().startsWith("invalidated")}var ee={experiments:"Use when: reviewing past experiment results, checking what has been tried, or looking for related prior work before designing a new experiment.",knowledge:"Use when: applying validated facts/principles to current work, checking if a question has already been answered, or verifying assumptions against established knowledge.",patterns:"Use when: looking for cross-experiment regularities, anti-patterns to avoid, or established best practices before making design decisions."},te="> Auto-generated from YAML frontmatter; Refs / Last ref come from _meta/access-log.jsonl. Do not edit manually. Not tracked by git.";function a(t,s){if(t==null)return"";let r=(typeof t=="object"?JSON.stringify(t):String(t)).replace(/\s*\r?\n\s*/g," ");return s!==void 0&&(r=r.slice(0,s)),r.replace(/\|/g,"\\|")}function g(t,...s){for(let r of s){let i=t.meta[r];if(i!=null&&i!=="")return i}}function L(t){return w(t.meta.tags).slice(0,4).map(s=>`\`${a(s)}\``).join(", ")}function _(t,s){I(f.join(t,"index.md"),s)}function ne(t,s){let r=z(t),i=f.basename(t),c=ee[i]||"",o=new Date().toISOString().slice(0,19),n=[`# ${s}`,""];if(c&&n.push(c,""),n.push(te,`> Last updated: ${o}`,""),r.length===0){n.push("_No entries._",""),_(t,n.join(`
7
+ `));return}let W=V(f.dirname(t)),p=e=>W.get(e.filename)??q,x=e=>`${p(e).refs} | ${p(e).lastRef?.slice(0,10)??""}`,d=r.filter(e=>T(m(e))),y=r.filter(e=>k(m(e))),$=r.filter(e=>!T(m(e))&&!k(m(e)));d.sort((e,l)=>{let h=p(l).refs-p(e).refs;return h!==0?h:String(l.meta.date??"").localeCompare(String(e.meta.date??""))});let F=r.some(e=>e.id.startsWith("EXP-")),O=r.some(e=>e.id.startsWith("K-"));if(n.push(`## Active (${d.length} entries)`,""),F){n.push("| ID | Date | Summary | Tags | Refs | Last ref | Links |"),n.push("|----|------|---------|------|------|----------|-------|");for(let e of d){let l=w(e.meta.links).map(h=>a(h)).join(", ");n.push(`| ${a(e.id)} | ${a(e.meta.date)} | ${a(g(e,"summary")??"\u2014",100)} | ${L(e)} | ${x(e)} | ${l} |`)}}else if(O){n.push("| ID | Title | Source | Refs | Last ref |"),n.push("|----|-------|--------|------|----------|");for(let e of d)n.push(`| ${a(e.id)} | ${a(g(e,"title","summary")??"\u2014")} | ${a(e.meta.source)} | ${x(e)} |`)}else{n.push("| ID | Summary | Tags | Sources | Refs | Last ref |"),n.push("|----|---------|------|---------|------|----------|");for(let e of d){let l=w(e.meta["source-experiments"]).map(h=>a(h)).join(", ");n.push(`| ${a(e.id)} | ${a(g(e,"summary","title")??"\u2014")} | ${L(e)} | ${l} | ${x(e)} |`)}}if(y.length>0){n.push("",`## Invalidated (${y.length} entries)`,""),n.push("> These entries have been proven wrong. Do NOT use their conclusions. Kept for audit trail only."),n.push(""),n.push("| ID | Date | Summary | Invalidated By | Refs |"),n.push("|----|------|---------|----------------|------|");for(let e of y){let l=m(e).replace(/^invalidated:/i,"").trim();n.push(`| ${a(e.id)} | ${a(e.meta.date)} | ${a(g(e,"summary","title")??"\u2014",80)} | ${a(l)} | ${p(e).refs} |`)}}if($.length>0){n.push("",`## Superseded / Deprecated (${$.length} entries)`,""),n.push("| ID | Date | Summary | Status | Refs |"),n.push("|----|------|---------|--------|------|");for(let e of $)n.push(`| ${a(e.id)} | ${a(e.meta.date)} | ${a(g(e,"summary","title")??"\u2014",80)} | ${a(m(e))} | ${p(e).refs} |`)}let D=5,R=14,M=Date.now(),P=d.filter(e=>p(e).refs>=D).map(e=>e.id),U=d.filter(e=>{if(p(e).refs>0)return!1;let l=e.meta.date?new Date(String(e.meta.date)):null;return!l||isNaN(l.getTime())?!1:(M-l.getTime())/864e5>R}).map(e=>e.id),E=d.filter(e=>m(e).toLowerCase().startsWith("challenged")),v=r.filter(e=>!e.validFrontmatter);n.push("","## Stats"),n.push(`- Total: ${r.length} (${d.length} active, ${y.length} invalidated, ${$.length} superseded/deprecated)`),E.length>0&&n.push(`- Challenged (under review): ${E.map(e=>e.id).join(", ")}`),n.push(`- Hot (refs >= ${D}): ${P.slice(0,10).join(", ")||"none"}`),n.push(`- Cold (refs=0, age>${R}d): ${U.slice(0,10).join(", ")||"none"}`),v.length>0&&n.push(`- Invalid YAML frontmatter (fix the file): ${v.map(e=>e.filename).join(", ")}`),n.push(""),_(t,n.join(`
8
+ `))}function se(t){return C.some(s=>u.existsSync(f.join(t,s)))}function re(){return u.readdirSync(S,{withFileTypes:!0}).filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).filter(t=>se(f.join(S,t))).sort()}function fe(){let t=re();for(let s of t)ie(s);return t}function ie(t){let s=f.join(S,t);if(!u.existsSync(s))return b.error(`Project not found: ${t}`),[];let r=[];for(let i of C){let c=f.join(s,i);if(!u.existsSync(c))continue;let o=i.charAt(0).toUpperCase()+i.slice(1);ne(c,`${o} Index \u2014 ${t}`),r.push(`${i}/index.md`)}return r}export{C as a,w as b,V as c,z as d,re as e,fe as f,ie as g};
@@ -0,0 +1,92 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as K}from"./chunk-JERCOLY3.js";import{e as x}from"./chunk-WHC7AYZD.js";var g=x(K(),1);import*as _ from"fs";import*as m from"path";import*as E from"os";var v=m.join(E.homedir(),".aistatus"),T=m.join(v,"gateway.yaml"),A=100,C=new Set(["host","port","mode","auth","status_check","max_body_size_mb","websocket","endpoint_modes","endpoints"]),P={anthropic:"https://api.anthropic.com",openai:"https://api.openai.com",google:"https://generativelanguage.googleapis.com","openai-codex":"https://chatgpt.com/backend-api",deepseek:"https://api.deepseek.com"},I={anthropic:["x-api-key",""],openai:["authorization","Bearer "],bearer:["authorization","Bearer "],google:["x-goog-api-key",""]},Y={ANTHROPIC_API_KEY:"anthropic",OPENAI_API_KEY:"openai",GEMINI_API_KEY:"google",DEEPSEEK_API_KEY:"deepseek"},w={openrouter:{base_url:"https://openrouter.ai/api/v1",env:"OPENROUTER_API_KEY"},deepseek:{base_url:"https://api.deepseek.com",env:"DEEPSEEK_API_KEY"},together:{base_url:"https://api.together.xyz/v1",env:"TOGETHER_API_KEY"},groq:{base_url:"https://api.groq.com/openai/v1",env:"GROQ_API_KEY"}};function O(e){return typeof e=="string"&&e.startsWith("$")?process.env[e.slice(1)]??"":e}function S(e){let t=[];for(let a of e){let s=O(String(a));s&&t.push(s)}return t}function N(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("model_fallbacks must be a mapping");let t={};for(let[a,s]of Object.entries(e)){let n=String(a).trim();if(!n)throw new Error("source model must be a non-empty string");if(!Array.isArray(s)||s.length===0)throw new Error(`model_fallbacks[${JSON.stringify(n)}] fallback list must be a non-empty list`);let o=[];for(let u of s){let i=String(u).trim();if(!i)throw new Error(`model_fallbacks[${JSON.stringify(n)}] fallback target must be a non-empty string`);o.push(i)}t[n]=o}return t}function k(e,t){let a=S(t.keys??[]),s=t.auth_style??(e in I?e:"bearer"),n=t.base_url??P[e]??"",o=[];for(let r of t.fallbacks??[]){let h=O(r.key??r.api_key??"");o.push({name:r.name??"fallback",base_url:r.base_url,api_key:h,auth_style:r.auth_style??"bearer",model_prefix:r.model_prefix??"",model_map:r.model_map??{},translate:r.translate??null})}let u=t.passthrough!==!1,i=N(t.model_fallbacks);return{name:e,base_url:n,auth_style:s,keys:a,passthrough:u,fallbacks:o,model_fallbacks:i}}function R(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.keys(e).some(a=>["keys","base_url","auth_style","passthrough","fallbacks","model_fallbacks"].includes(a))}function D(e){if(e===void 0)return A;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error("max_body_size_mb must be a finite number greater than zero");return e}function j(e){let t=e.host??"127.0.0.1",a=e.port??9880,s=e.status_check!==!1,n=e.websocket!==!1,o=D(e.max_body_size_mb),u={},i=[];for(let c of Object.keys(e)){if(C.has(c))continue;let l=e[c];if(!(!l||typeof l!="object"||Array.isArray(l))){if(R(l)){u.default??={},u.default[c]=k(c,l);continue}for(let[f,d]of Object.entries(l))!d||typeof d!="object"||Array.isArray(d)||(u[f]??={},u[f][c]=k(c,d),i.includes(f)||i.push(f))}}let r=Object.keys(u),h=e.mode??i[0]??r[0]??"default",b=u[h]?h:r[0]??"default";u[b]??={};let y,p=e.auth;if(p){let c=S(p.keys??[]);y={enabled:p.enabled!==!1&&c.length>0,keys:c,header:p.header??"authorization",public_paths:p.public_paths??["/health"]}}return{host:t,port:a,status_check:s,websocket:n,max_body_size_mb:o,mode:b,auth:y,endpoints:u[b],endpoint_modes:u}}function z(e="127.0.0.1",t=9880){let a={};for(let[n,o]of Object.entries(Y)){let u=process.env[n];if(!u)continue;let i=o in I?o:"bearer",r=P[o]??"";a[o]={name:o,base_url:r,auth_style:i,keys:[u],passthrough:!0,fallbacks:[],model_fallbacks:{}}}let s=process.env.OPENROUTER_API_KEY;if(s){let n=w.openrouter.base_url;for(let[o,u]of Object.entries(a)){let i=o!=="openai"?`${o}/`:"openai/",r=o==="anthropic"?"anthropic-to-openai":null;u.fallbacks.push({name:"openrouter",base_url:n,api_key:s,model_prefix:i,model_map:{},auth_style:"bearer",translate:r})}}return{host:e,port:t,status_check:!0,websocket:!0,max_body_size_mb:A,mode:"default",endpoints:a,endpoint_modes:{default:a}}}function M(e){let t=e??T;if(!_.existsSync(t))return z();let a=_.readFileSync(t,"utf-8"),s=g.default.parse(a)??{};return j(s)}function $(){return`# aistatus gateway configuration
5
+ # Docs: https://aistatus.cc/docs
6
+ #
7
+ # After editing, start with:
8
+ # npx aistatus-gateway start
9
+ #
10
+ # Or skip this file entirely with auto-discovery:
11
+ # npx aistatus-gateway start --auto
12
+
13
+ port: 9880
14
+ max_body_size_mb: 100
15
+
16
+ # Proxy WebSocket upgrades as well as HTTP (default true). Clients that speak both \u2014 such as
17
+ # PI's Codex backend \u2014 fall back to SSE over HTTP when this is off.
18
+ # websocket: true
19
+
20
+ # \u2500\u2500 Authentication \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
21
+ # auth:
22
+ # keys:
23
+ # - $GATEWAY_API_KEY
24
+ # # header: authorization # default: Bearer scheme
25
+ # # public_paths: ["/health"] # default
26
+
27
+ # \u2500\u2500 Anthropic (for Claude Code) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
28
+ anthropic:
29
+ # Multiple keys \u2192 automatic rotation on rate-limit / 5xx
30
+ keys:
31
+ - $ANTHROPIC_API_KEY
32
+ # - sk-ant-your-second-key
33
+
34
+ # Hybrid mode: when true (default), the caller's own API key is
35
+ # tried after managed keys, before fallbacks.
36
+ # Set to false to use only managed keys.
37
+ # Automatic model-level degradation order.
38
+ # When a model is unhealthy, later tasks can switch to the first healthy fallback.
39
+ # model_fallbacks:
40
+ # claude-opus-4-6:
41
+ # - claude-sonnet-4-6
42
+ # - claude-haiku-4-5
43
+
44
+ fallbacks:
45
+ # OpenRouter serves Claude models via OpenAI-compatible API
46
+ - name: openrouter
47
+ base_url: https://openrouter.ai/api/v1
48
+ key: $OPENROUTER_API_KEY
49
+ model_prefix: "anthropic/"
50
+ translate: anthropic-to-openai
51
+
52
+ # \u2500\u2500 OpenAI (for Codex) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
53
+ openai:
54
+ keys:
55
+ - $OPENAI_API_KEY
56
+
57
+ fallbacks:
58
+ - name: openrouter
59
+ base_url: https://openrouter.ai/api/v1
60
+ key: $OPENROUTER_API_KEY
61
+ model_prefix: "openai/"
62
+
63
+ # DeepSeek as budget fallback (different models)
64
+ # - name: deepseek
65
+ # base_url: https://api.deepseek.com
66
+ # key: $DEEPSEEK_API_KEY
67
+ # model_map:
68
+ # gpt-4o: deepseek-chat
69
+ # gpt-4o-mini: deepseek-chat
70
+
71
+ # \u2500\u2500 OpenAI Codex (ChatGPT Plus/Pro OAuth subscription) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
72
+ # Codex uses OAuth bearer tokens tied to a ChatGPT subscription, NOT a static
73
+ # API key. The gateway transparently passes through the caller's own bearer
74
+ # token; no managed keys are set here.
75
+ openai-codex:
76
+ base_url: https://chatgpt.com/backend-api
77
+ auth_style: bearer
78
+ passthrough: true
79
+
80
+ # \u2500\u2500 DeepSeek \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
81
+ deepseek:
82
+ keys:
83
+ - $DEEPSEEK_API_KEY
84
+ base_url: https://api.deepseek.com
85
+ auth_style: bearer
86
+ passthrough: true
87
+
88
+ # \u2500\u2500 Google (for Gemini CLI) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
89
+ # google:
90
+ # keys:
91
+ # - $GEMINI_API_KEY
92
+ `}export{A as a,C as b,P as c,I as d,j as e,z as f,M as g,$ as h};
@@ -0,0 +1,34 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as wt,b as Ct,c as mr,e as $n}from"./chunk-WHC7AYZD.js";var Qn=mr((Tt,Nn)=>{(function(f,s){typeof Tt=="object"&&typeof Nn<"u"?s(Tt):typeof define=="function"&&define.amd?define(["exports"],s):(f=typeof globalThis<"u"?globalThis:f||self,s(f.WebStreamsPolyfill={}))})(Tt,(function(f){"use strict";function s(){}function l(e){return typeof e=="object"&&e!==null||typeof e=="function"}let b=s;function d(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}let R=Promise,C=Promise.prototype.then,ue=Promise.reject.bind(R);function P(e){return new R(e)}function S(e){return P(t=>t(e))}function c(e){return ue(e)}function W(e,t,r){return C.call(e,t,r)}function v(e,t,r){W(W(e,t,r),void 0,b)}function M(e,t){v(e,t)}function N(e,t){v(e,void 0,t)}function Q(e,t,r){return W(e,t,r)}function we(e){W(e,void 0,b)}let fe=e=>{if(typeof queueMicrotask=="function")fe=queueMicrotask;else{let t=S(void 0);fe=r=>W(t,r)}return fe(e)};function de(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function J(e,t,r){try{return S(de(e,t,r))}catch(n){return c(n)}}let Rr=16384;class k{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){let r=this._back,n=r;r._elements.length===Rr-1&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){let t=this._front,r=t,n=this._cursor,o=n+1,a=t._elements,i=a[n];return o===Rr&&(r=t._next,o=0),--this._size,this._cursor=o,t!==r&&(this._front=r),a[n]=void 0,i}forEach(t){let r=this._cursor,n=this._front,o=n._elements;for(;(r!==o.length||n._next!==void 0)&&!(r===o.length&&(n=n._next,o=n._elements,r=0,o.length===0));)t(o[r]),++r}peek(){let t=this._front,r=this._cursor;return t._elements[r]}}let wr=Symbol("[[AbortSteps]]"),Cr=Symbol("[[ErrorSteps]]"),qt=Symbol("[[CancelSteps]]"),At=Symbol("[[PullSteps]]"),Wt=Symbol("[[ReleaseSteps]]");function Tr(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?kt(e):t._state==="closed"?to(e):Pr(e,t._storedError)}function Bt(e,t){let r=e._ownerReadableStream;return j(r,t)}function U(e){let t=e._ownerReadableStream;t._state==="readable"?Ot(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):ro(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[Wt](),t._reader=void 0,e._ownerReadableStream=void 0}function Ve(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function kt(e){e._closedPromise=P((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function Pr(e,t){kt(e),Ot(e,t)}function to(e){kt(e),vr(e)}function Ot(e,t){e._closedPromise_reject!==void 0&&(we(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function ro(e,t){Pr(e,t)}function vr(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}let Er=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},no=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function oo(e){return typeof e=="object"||typeof e=="function"}function L(e,t){if(e!==void 0&&!oo(e))throw new TypeError(`${t} is not an object.`)}function O(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function ao(e){return typeof e=="object"&&e!==null||typeof e=="function"}function qr(e,t){if(!ao(e))throw new TypeError(`${t} is not an object.`)}function Y(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Ft(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function zt(e){return Number(e)}function Ar(e){return e===0?0:e}function io(e){return Ar(no(e))}function It(e,t){let n=Number.MAX_SAFE_INTEGER,o=Number(e);if(o=Ar(o),!Er(o))throw new TypeError(`${t} is not a finite number`);if(o=io(o),o<0||o>n)throw new TypeError(`${t} is outside the accepted range of 0 to ${n}, inclusive`);return!Er(o)||o===0?0:o}function jt(e,t){if(!ae(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Ce(e){return new K(e)}function Wr(e,t){e._reader._readRequests.push(t)}function Dt(e,t,r){let o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function He(e){return e._reader._readRequests.length}function Br(e){let t=e._reader;return!(t===void 0||!ee(t))}class K{constructor(t){if(Y(t,1,"ReadableStreamDefaultReader"),jt(t,"First parameter"),ie(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Tr(this,t),this._readRequests=new k}get closed(){return ee(this)?this._closedPromise:c(Ge("closed"))}cancel(t=void 0){return ee(this)?this._ownerReadableStream===void 0?c(Ve("cancel")):Bt(this,t):c(Ge("cancel"))}read(){if(!ee(this))return c(Ge("read"));if(this._ownerReadableStream===void 0)return c(Ve("read from"));let t,r,n=P((a,i)=>{t=a,r=i});return ze(this,{_chunkSteps:a=>t({value:a,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:a=>r(a)}),n}releaseLock(){if(!ee(this))throw Ge("releaseLock");this._ownerReadableStream!==void 0&&so(this)}}Object.defineProperties(K.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),d(K.prototype.cancel,"cancel"),d(K.prototype.read,"read"),d(K.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(K.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function ee(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readRequests")?!1:e instanceof K}function ze(e,t){let r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[At](t)}function so(e){U(e);let t=new TypeError("Reader was released");kr(e,t)}function kr(e,t){let r=e._readRequests;e._readRequests=new k,r.forEach(n=>{n._errorSteps(t)})}function Ge(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let lo=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class Or{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){let t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Q(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){let r=()=>this._returnSteps(t);return this._ongoingPromise?Q(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let t=this._reader,r,n,o=P((i,u)=>{r=i,n=u});return ze(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,fe(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,U(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,U(t),n(i)}}),o}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;let r=this._reader;if(!this._preventCancel){let n=Bt(r,t);return U(r),Q(n,()=>({value:t,done:!0}))}return U(r),S({value:t,done:!0})}}let Fr={next(){return zr(this)?this._asyncIteratorImpl.next():c(Ir("next"))},return(e){return zr(this)?this._asyncIteratorImpl.return(e):c(Ir("return"))}};Object.setPrototypeOf(Fr,lo);function uo(e,t){let r=Ce(e),n=new Or(r,t),o=Object.create(Fr);return o._asyncIteratorImpl=n,o}function zr(e){if(!l(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Or}catch{return!1}}function Ir(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}let jr=Number.isNaN||function(e){return e!==e};var Mt,Lt,$t;function Ie(e){return e.slice()}function Dr(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}let V=e=>(typeof e.transfer=="function"?V=t=>t.transfer():typeof structuredClone=="function"?V=t=>structuredClone(t,{transfer:[t]}):V=t=>t,V(e)),te=e=>(typeof e.detached=="boolean"?te=t=>t.detached:te=t=>t.byteLength===0,te(e));function Mr(e,t,r){if(e.slice)return e.slice(t,r);let n=r-t,o=new ArrayBuffer(n);return Dr(o,0,e,t,n),o}function xe(e,t){let r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(`${String(t)} is not a function`);return r}}function fo(e){let t={[Symbol.iterator]:()=>e.iterator},r=(async function*(){return yield*t})(),n=r.next;return{iterator:r,nextMethod:n,done:!1}}let Nt=($t=(Mt=Symbol.asyncIterator)!==null&&Mt!==void 0?Mt:(Lt=Symbol.for)===null||Lt===void 0?void 0:Lt.call(Symbol,"Symbol.asyncIterator"))!==null&&$t!==void 0?$t:"@@asyncIterator";function Lr(e,t="sync",r){if(r===void 0)if(t==="async"){if(r=xe(e,Nt),r===void 0){let a=xe(e,Symbol.iterator),i=Lr(e,"sync",a);return fo(i)}}else r=xe(e,Symbol.iterator);if(r===void 0)throw new TypeError("The object is not iterable");let n=de(r,e,[]);if(!l(n))throw new TypeError("The iterator method must return an object");let o=n.next;return{iterator:n,nextMethod:o,done:!1}}function co(e){let t=de(e.nextMethod,e.iterator,[]);if(!l(t))throw new TypeError("The iterator.next() method must return an object");return t}function ho(e){return!!e.done}function bo(e){return e.value}function mo(e){return!(typeof e!="number"||jr(e)||e<0)}function $r(e){let t=Mr(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Qt(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Ut(e,t,r){if(!mo(r)||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function po(e){return e._queue.peek().value}function re(e){e._queue=new k,e._queueTotalSize=0}function Nr(e){return e===DataView}function yo(e){return Nr(e.constructor)}function _o(e){return Nr(e)?1:e.BYTES_PER_ELEMENT}class ce{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Yt(this))throw Zt("view");return this._view}respond(t){if(!Yt(this))throw Zt("respond");if(Y(t,1,"respond"),t=It(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(te(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ke(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!Yt(this))throw Zt("respondWithNewView");if(Y(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(te(t.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");et(this._associatedReadableByteStreamController,t)}}Object.defineProperties(ce.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),d(ce.prototype.respond,"respond"),d(ce.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ce.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class H{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!he(this))throw De("byobRequest");return xt(this)}get desiredSize(){if(!he(this))throw De("desiredSize");return Jr(this)}close(){if(!he(this))throw De("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);je(this)}enqueue(t){if(!he(this))throw De("enqueue");if(Y(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);Je(this,t)}error(t=void 0){if(!he(this))throw De("error");F(this,t)}[qt](t){Qr(this),re(this);let r=this._cancelAlgorithm(t);return Xe(this),r}[At](t){let r=this._controlledReadableByteStream;if(this._queueTotalSize>0){Xr(this,t);return}let n=this._autoAllocateChunkSize;if(n!==void 0){let o;try{o=new ArrayBuffer(n)}catch(i){t._errorSteps(i);return}let a={buffer:o,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}Wr(r,t),be(this)}[Wt](){if(this._pendingPullIntos.length>0){let t=this._pendingPullIntos.peek();t.readerType="none",this._pendingPullIntos=new k,this._pendingPullIntos.push(t)}}}Object.defineProperties(H.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),d(H.prototype.close,"close"),d(H.prototype.enqueue,"enqueue"),d(H.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(H.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function he(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")?!1:e instanceof H}function Yt(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")?!1:e instanceof ce}function be(e){if(!Co(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;let r=e._pullAlgorithm();v(r,()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,be(e)),null),n=>(F(e,n),null))}function Qr(e){Ht(e),e._pendingPullIntos=new k}function Vt(e,t){let r=!1;e._state==="closed"&&(r=!0);let n=Ur(t);t.readerType==="default"?Dt(e,n,r):Ao(e,n,r)}function Ur(e){let t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ze(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function Yr(e,t,r,n){let o;try{o=Mr(t,r,r+n)}catch(a){throw F(e,a),a}Ze(e,o,0,n)}function Vr(e,t){t.bytesFilled>0&&Yr(e,t.buffer,t.byteOffset,t.bytesFilled),Te(e)}function Hr(e,t){let r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r,o=r,a=!1,i=n%t.elementSize,u=n-i;u>=t.minimumFill&&(o=u-t.bytesFilled,a=!0);let p=e._queue;for(;o>0;){let h=p.peek(),y=Math.min(o,h.byteLength),_=t.byteOffset+t.bytesFilled;Dr(t.buffer,_,h.buffer,h.byteOffset,y),h.byteLength===y?p.shift():(h.byteOffset+=y,h.byteLength-=y),e._queueTotalSize-=y,Gr(e,y,t),o-=y}return a}function Gr(e,t,r){r.bytesFilled+=t}function xr(e){e._queueTotalSize===0&&e._closeRequested?(Xe(e),Ue(e._controlledReadableByteStream)):be(e)}function Ht(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Gt(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;let t=e._pendingPullIntos.peek();Hr(e,t)&&(Te(e),Vt(e._controlledReadableByteStream,t))}}function So(e){let t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(e._queueTotalSize===0)return;let r=t._readRequests.shift();Xr(e,r)}}function go(e,t,r,n){let o=e._controlledReadableByteStream,a=t.constructor,i=_o(a),{byteOffset:u,byteLength:p}=t,h=r*i,y;try{y=V(t.buffer)}catch(w){n._errorSteps(w);return}let _={buffer:y,bufferByteLength:y.byteLength,byteOffset:u,byteLength:p,bytesFilled:0,minimumFill:h,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0){e._pendingPullIntos.push(_),tn(o,n);return}if(o._state==="closed"){let w=new a(_.buffer,_.byteOffset,0);n._closeSteps(w);return}if(e._queueTotalSize>0){if(Hr(e,_)){let w=Ur(_);xr(e),n._chunkSteps(w);return}if(e._closeRequested){let w=new TypeError("Insufficient bytes to fill elements in the given buffer");F(e,w),n._errorSteps(w);return}}e._pendingPullIntos.push(_),tn(o,n),be(e)}function Ro(e,t){t.readerType==="none"&&Te(e);let r=e._controlledReadableByteStream;if(Xt(r))for(;rn(r)>0;){let n=Te(e);Vt(r,n)}}function wo(e,t,r){if(Gr(e,t,r),r.readerType==="none"){Vr(e,r),Gt(e);return}if(r.bytesFilled<r.minimumFill)return;Te(e);let n=r.bytesFilled%r.elementSize;if(n>0){let o=r.byteOffset+r.bytesFilled;Yr(e,r.buffer,o-n,n)}r.bytesFilled-=n,Vt(e._controlledReadableByteStream,r),Gt(e)}function Zr(e,t){let r=e._pendingPullIntos.peek();Ht(e),e._controlledReadableByteStream._state==="closed"?Ro(e,r):wo(e,t,r),be(e)}function Te(e){return e._pendingPullIntos.shift()}function Co(e){let t=e._controlledReadableByteStream;return t._state!=="readable"||e._closeRequested||!e._started?!1:!!(Br(t)&&He(t)>0||Xt(t)&&rn(t)>0||Jr(e)>0)}function Xe(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function je(e){let t=e._controlledReadableByteStream;if(!(e._closeRequested||t._state!=="readable")){if(e._queueTotalSize>0){e._closeRequested=!0;return}if(e._pendingPullIntos.length>0){let r=e._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!==0){let n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw F(e,n),n}}Xe(e),Ue(t)}}function Je(e,t){let r=e._controlledReadableByteStream;if(e._closeRequested||r._state!=="readable")return;let{buffer:n,byteOffset:o,byteLength:a}=t;if(te(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let i=V(n);if(e._pendingPullIntos.length>0){let u=e._pendingPullIntos.peek();if(te(u.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Ht(e),u.buffer=V(u.buffer),u.readerType==="none"&&Vr(e,u)}if(Br(r))if(So(e),He(r)===0)Ze(e,i,o,a);else{e._pendingPullIntos.length>0&&Te(e);let u=new Uint8Array(i,o,a);Dt(r,u,!1)}else Xt(r)?(Ze(e,i,o,a),Gt(e)):Ze(e,i,o,a);be(e)}function F(e,t){let r=e._controlledReadableByteStream;r._state==="readable"&&(Qr(e),re(e),Xe(e),En(r,t))}function Xr(e,t){let r=e._queue.shift();e._queueTotalSize-=r.byteLength,xr(e);let n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function xt(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(ce.prototype);Po(n,e,r),e._byobRequest=n}return e._byobRequest}function Jr(e){let t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Ke(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=V(r.buffer),Zr(e,t)}function et(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let o=t.byteLength;r.buffer=V(t.buffer),Zr(e,o)}function Kr(e,t,r,n,o,a,i){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,re(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=i,t._pendingPullIntos=new k,e._readableStreamController=t;let u=r();v(S(u),()=>(t._started=!0,be(t),null),p=>(F(t,p),null))}function To(e,t,r){let n=Object.create(H.prototype),o,a,i;t.start!==void 0?o=()=>t.start(n):o=()=>{},t.pull!==void 0?a=()=>t.pull(n):a=()=>S(void 0),t.cancel!==void 0?i=p=>t.cancel(p):i=()=>S(void 0);let u=t.autoAllocateChunkSize;if(u===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Kr(e,n,o,a,i,r,u)}function Po(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}function Zt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function De(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function vo(e,t){L(e,t);let r=e?.mode;return{mode:r===void 0?void 0:Eo(r,`${t} has member 'mode' that`)}}function Eo(e,t){if(e=`${e}`,e!=="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function qo(e,t){var r;L(e,t);let n=(r=e?.min)!==null&&r!==void 0?r:1;return{min:It(n,`${t} has member 'min' that`)}}function en(e){return new ne(e)}function tn(e,t){e._reader._readIntoRequests.push(t)}function Ao(e,t,r){let o=e._reader._readIntoRequests.shift();r?o._closeSteps(t):o._chunkSteps(t)}function rn(e){return e._reader._readIntoRequests.length}function Xt(e){let t=e._reader;return!(t===void 0||!me(t))}class ne{constructor(t){if(Y(t,1,"ReadableStreamBYOBReader"),jt(t,"First parameter"),ie(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!he(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Tr(this,t),this._readIntoRequests=new k}get closed(){return me(this)?this._closedPromise:c(tt("closed"))}cancel(t=void 0){return me(this)?this._ownerReadableStream===void 0?c(Ve("cancel")):Bt(this,t):c(tt("cancel"))}read(t,r={}){if(!me(this))return c(tt("read"));if(!ArrayBuffer.isView(t))return c(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return c(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return c(new TypeError("view's buffer must have non-zero byteLength"));if(te(t.buffer))return c(new TypeError("view's buffer has been detached"));let n;try{n=qo(r,"options")}catch(h){return c(h)}let o=n.min;if(o===0)return c(new TypeError("options.min must be greater than 0"));if(yo(t)){if(o>t.byteLength)return c(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(o>t.length)return c(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return c(Ve("read from"));let a,i,u=P((h,y)=>{a=h,i=y});return nn(this,t,o,{_chunkSteps:h=>a({value:h,done:!1}),_closeSteps:h=>a({value:h,done:!0}),_errorSteps:h=>i(h)}),u}releaseLock(){if(!me(this))throw tt("releaseLock");this._ownerReadableStream!==void 0&&Wo(this)}}Object.defineProperties(ne.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),d(ne.prototype.cancel,"cancel"),d(ne.prototype.read,"read"),d(ne.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ne.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function me(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")?!1:e instanceof ne}function nn(e,t,r,n){let o=e._ownerReadableStream;o._disturbed=!0,o._state==="errored"?n._errorSteps(o._storedError):go(o._readableStreamController,t,r,n)}function Wo(e){U(e);let t=new TypeError("Reader was released");on(e,t)}function on(e,t){let r=e._readIntoRequests;e._readIntoRequests=new k,r.forEach(n=>{n._errorSteps(t)})}function tt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Me(e,t){let{highWaterMark:r}=e;if(r===void 0)return t;if(jr(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function rt(e){let{size:t}=e;return t||(()=>1)}function nt(e,t){L(e,t);let r=e?.highWaterMark,n=e?.size;return{highWaterMark:r===void 0?void 0:zt(r),size:n===void 0?void 0:Bo(n,`${t} has member 'size' that`)}}function Bo(e,t){return O(e,t),r=>zt(e(r))}function ko(e,t){L(e,t);let r=e?.abort,n=e?.close,o=e?.start,a=e?.type,i=e?.write;return{abort:r===void 0?void 0:Oo(r,e,`${t} has member 'abort' that`),close:n===void 0?void 0:Fo(n,e,`${t} has member 'close' that`),start:o===void 0?void 0:zo(o,e,`${t} has member 'start' that`),write:i===void 0?void 0:Io(i,e,`${t} has member 'write' that`),type:a}}function Oo(e,t,r){return O(e,r),n=>J(e,t,[n])}function Fo(e,t,r){return O(e,r),()=>J(e,t,[])}function zo(e,t,r){return O(e,r),n=>de(e,t,[n])}function Io(e,t,r){return O(e,r),(n,o)=>J(e,t,[n,o])}function an(e,t){if(!Pe(e))throw new TypeError(`${t} is not a WritableStream.`)}function jo(e){if(typeof e!="object"||e===null)return!1;try{return typeof e.aborted=="boolean"}catch{return!1}}let Do=typeof AbortController=="function";function Mo(){if(Do)return new AbortController}class oe{constructor(t={},r={}){t===void 0?t=null:qr(t,"First parameter");let n=nt(r,"Second parameter"),o=ko(t,"First parameter");if(ln(this),o.type!==void 0)throw new RangeError("Invalid type is specified");let i=rt(n),u=Me(n,1);Ko(this,o,u,i)}get locked(){if(!Pe(this))throw lt("locked");return ve(this)}abort(t=void 0){return Pe(this)?ve(this)?c(new TypeError("Cannot abort a stream that already has a writer")):ot(this,t):c(lt("abort"))}close(){return Pe(this)?ve(this)?c(new TypeError("Cannot close a stream that already has a writer")):$(this)?c(new TypeError("Cannot close an already-closing stream")):un(this):c(lt("close"))}getWriter(){if(!Pe(this))throw lt("getWriter");return sn(this)}}Object.defineProperties(oe.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),d(oe.prototype.abort,"abort"),d(oe.prototype.close,"close"),d(oe.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(oe.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function sn(e){return new G(e)}function Lo(e,t,r,n,o=1,a=()=>1){let i=Object.create(oe.prototype);ln(i);let u=Object.create(Ee.prototype);return mn(i,u,e,t,r,n,o,a),i}function ln(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new k,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Pe(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")?!1:e instanceof oe}function ve(e){return e._writer!==void 0}function ot(e,t){var r;if(e._state==="closed"||e._state==="errored")return S(void 0);e._writableStreamController._abortReason=t,(r=e._writableStreamController._abortController)===null||r===void 0||r.abort(t);let n=e._state;if(n==="closed"||n==="errored")return S(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let o=!1;n==="erroring"&&(o=!0,t=void 0);let a=P((i,u)=>{e._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:u,_reason:t,_wasAlreadyErroring:o}});return e._pendingAbortRequest._promise=a,o||Kt(e,t),a}function un(e){let t=e._state;if(t==="closed"||t==="errored")return c(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let r=P((o,a)=>{let i={_resolve:o,_reject:a};e._closeRequest=i}),n=e._writer;return n!==void 0&&e._backpressure&&t==="writable"&&sr(n),ea(e._writableStreamController),r}function $o(e){return P((r,n)=>{let o={_resolve:r,_reject:n};e._writeRequests.push(o)})}function Jt(e,t){if(e._state==="writable"){Kt(e,t);return}er(e)}function Kt(e,t){let r=e._writableStreamController;e._state="erroring",e._storedError=t;let n=e._writer;n!==void 0&&dn(n,t),!Vo(e)&&r._started&&er(e)}function er(e){e._state="errored",e._writableStreamController[Cr]();let t=e._storedError;if(e._writeRequests.forEach(o=>{o._reject(t)}),e._writeRequests=new k,e._pendingAbortRequest===void 0){at(e);return}let r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring){r._reject(t),at(e);return}let n=e._writableStreamController[wr](r._reason);v(n,()=>(r._resolve(),at(e),null),o=>(r._reject(o),at(e),null))}function No(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}function Qo(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,Jt(e,t)}function Uo(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state==="erroring"&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";let r=e._writer;r!==void 0&&Sn(r)}function Yo(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),Jt(e,t)}function $(e){return!(e._closeRequest===void 0&&e._inFlightCloseRequest===void 0)}function Vo(e){return!(e._inFlightWriteRequest===void 0&&e._inFlightCloseRequest===void 0)}function Ho(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0}function Go(e){e._inFlightWriteRequest=e._writeRequests.shift()}function at(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&ar(t,e._storedError)}function tr(e,t){let r=e._writer;r!==void 0&&t!==e._backpressure&&(t?sa(r):sr(r)),e._backpressure=t}class G{constructor(t){if(Y(t,1,"WritableStreamDefaultWriter"),an(t,"First parameter"),ve(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;let r=t._state;if(r==="writable")!$(t)&&t._backpressure?ft(this):gn(this),ut(this);else if(r==="erroring")ir(this,t._storedError),ut(this);else if(r==="closed")gn(this),aa(this);else{let n=t._storedError;ir(this,n),_n(this,n)}}get closed(){return pe(this)?this._closedPromise:c(ye("closed"))}get desiredSize(){if(!pe(this))throw ye("desiredSize");if(this._ownerWritableStream===void 0)throw $e("desiredSize");return Jo(this)}get ready(){return pe(this)?this._readyPromise:c(ye("ready"))}abort(t=void 0){return pe(this)?this._ownerWritableStream===void 0?c($e("abort")):xo(this,t):c(ye("abort"))}close(){if(!pe(this))return c(ye("close"));let t=this._ownerWritableStream;return t===void 0?c($e("close")):$(t)?c(new TypeError("Cannot close an already-closing stream")):fn(this)}releaseLock(){if(!pe(this))throw ye("releaseLock");this._ownerWritableStream!==void 0&&cn(this)}write(t=void 0){return pe(this)?this._ownerWritableStream===void 0?c($e("write to")):hn(this,t):c(ye("write"))}}Object.defineProperties(G.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),d(G.prototype.abort,"abort"),d(G.prototype.close,"close"),d(G.prototype.releaseLock,"releaseLock"),d(G.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(G.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function pe(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")?!1:e instanceof G}function xo(e,t){let r=e._ownerWritableStream;return ot(r,t)}function fn(e){let t=e._ownerWritableStream;return un(t)}function Zo(e){let t=e._ownerWritableStream,r=t._state;return $(t)||r==="closed"?S(void 0):r==="errored"?c(t._storedError):fn(e)}function Xo(e,t){e._closedPromiseState==="pending"?ar(e,t):ia(e,t)}function dn(e,t){e._readyPromiseState==="pending"?Rn(e,t):la(e,t)}function Jo(e){let t=e._ownerWritableStream,r=t._state;return r==="errored"||r==="erroring"?null:r==="closed"?0:pn(t._writableStreamController)}function cn(e){let t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");dn(e,r),Xo(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function hn(e,t){let r=e._ownerWritableStream,n=r._writableStreamController,o=ta(n,t);if(r!==e._ownerWritableStream)return c($e("write to"));let a=r._state;if(a==="errored")return c(r._storedError);if($(r)||a==="closed")return c(new TypeError("The stream is closing or closed and cannot be written to"));if(a==="erroring")return c(r._storedError);let i=$o(r);return ra(n,t,o),i}let bn={};class Ee{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!rr(this))throw or("abortReason");return this._abortReason}get signal(){if(!rr(this))throw or("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!rr(this))throw or("error");this._controlledWritableStream._state==="writable"&&yn(this,t)}[wr](t){let r=this._abortAlgorithm(t);return it(this),r}[Cr](){re(this)}}Object.defineProperties(Ee.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ee.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function rr(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")?!1:e instanceof Ee}function mn(e,t,r,n,o,a,i,u){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,re(t),t._abortReason=void 0,t._abortController=Mo(),t._started=!1,t._strategySizeAlgorithm=u,t._strategyHWM=i,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=a;let p=nr(t);tr(e,p);let h=r(),y=S(h);v(y,()=>(t._started=!0,st(t),null),_=>(t._started=!0,Jt(e,_),null))}function Ko(e,t,r,n){let o=Object.create(Ee.prototype),a,i,u,p;t.start!==void 0?a=()=>t.start(o):a=()=>{},t.write!==void 0?i=h=>t.write(h,o):i=()=>S(void 0),t.close!==void 0?u=()=>t.close():u=()=>S(void 0),t.abort!==void 0?p=h=>t.abort(h):p=()=>S(void 0),mn(e,o,a,i,u,p,r,n)}function it(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ea(e){Ut(e,bn,0),st(e)}function ta(e,t){try{return e._strategySizeAlgorithm(t)}catch(r){return Le(e,r),1}}function pn(e){return e._strategyHWM-e._queueTotalSize}function ra(e,t,r){try{Ut(e,t,r)}catch(o){Le(e,o);return}let n=e._controlledWritableStream;if(!$(n)&&n._state==="writable"){let o=nr(e);tr(n,o)}st(e)}function st(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring"){er(t);return}if(e._queue.length===0)return;let n=po(e);n===bn?na(e):oa(e,n)}function Le(e,t){e._controlledWritableStream._state==="writable"&&yn(e,t)}function na(e){let t=e._controlledWritableStream;Ho(t),Qt(e);let r=e._closeAlgorithm();it(e),v(r,()=>(Uo(t),null),n=>(Yo(t,n),null))}function oa(e,t){let r=e._controlledWritableStream;Go(r);let n=e._writeAlgorithm(t);v(n,()=>{No(r);let o=r._state;if(Qt(e),!$(r)&&o==="writable"){let a=nr(e);tr(r,a)}return st(e),null},o=>(r._state==="writable"&&it(e),Qo(r,o),null))}function nr(e){return pn(e)<=0}function yn(e,t){let r=e._controlledWritableStream;it(e),Kt(r,t)}function lt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function or(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function ye(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function $e(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function ut(e){e._closedPromise=P((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function _n(e,t){ut(e),ar(e,t)}function aa(e){ut(e),Sn(e)}function ar(e,t){e._closedPromise_reject!==void 0&&(we(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function ia(e,t){_n(e,t)}function Sn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function ft(e){e._readyPromise=P((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function ir(e,t){ft(e),Rn(e,t)}function gn(e){ft(e),sr(e)}function Rn(e,t){e._readyPromise_reject!==void 0&&(we(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function sa(e){ft(e)}function la(e,t){ir(e,t)}function sr(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}function ua(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global}let lr=ua();function fa(e){if(!(typeof e=="function"||typeof e=="object")||e.name!=="DOMException")return!1;try{return new e,!0}catch{return!1}}function da(){let e=lr?.DOMException;return fa(e)?e:void 0}function ca(){let e=function(r,n){this.message=r||"",this.name=n||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return d(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}let ha=da()||ca();function wn(e,t,r,n,o,a){let i=Ce(e),u=sn(t);e._disturbed=!0;let p=!1,h=S(void 0);return P((y,_)=>{let w;if(a!==void 0){if(w=()=>{let m=a.reason!==void 0?a.reason:new ha("Aborted","AbortError"),g=[];n||g.push(()=>t._state==="writable"?ot(t,m):S(void 0)),o||g.push(()=>e._state==="readable"?j(e,m):S(void 0)),A(()=>Promise.all(g.map(T=>T())),!0,m)},a.aborted){w();return}a.addEventListener("abort",w)}function D(){return P((m,g)=>{function T(B){B?m():W(Be(),T,g)}T(!1)})}function Be(){return p?S(!0):W(u._readyPromise,()=>P((m,g)=>{ze(i,{_chunkSteps:T=>{h=W(hn(u,T),void 0,s),m(!1)},_closeSteps:()=>m(!0),_errorSteps:g})}))}if(Z(e,i._closedPromise,m=>(n?z(!0,m):A(()=>ot(t,m),!0,m),null)),Z(t,u._closedPromise,m=>(o?z(!0,m):A(()=>j(e,m),!0,m),null)),q(e,i._closedPromise,()=>(r?z():A(()=>Zo(u)),null)),$(t)||t._state==="closed"){let m=new TypeError("the destination writable stream closed before all data could be piped to it");o?z(!0,m):A(()=>j(e,m),!0,m)}we(D());function le(){let m=h;return W(h,()=>m!==h?le():void 0)}function Z(m,g,T){m._state==="errored"?T(m._storedError):N(g,T)}function q(m,g,T){m._state==="closed"?T():M(g,T)}function A(m,g,T){if(p)return;p=!0,t._state==="writable"&&!$(t)?M(le(),B):B();function B(){return v(m(),()=>X(g,T),ke=>X(!0,ke)),null}}function z(m,g){p||(p=!0,t._state==="writable"&&!$(t)?M(le(),()=>X(m,g)):X(m,g))}function X(m,g){return cn(u),U(i),a!==void 0&&a.removeEventListener("abort",w),m?_(g):y(void 0),null}})}class x{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!dt(this))throw ht("desiredSize");return ur(this)}close(){if(!dt(this))throw ht("close");if(!Ae(this))throw new TypeError("The stream is not in a state that permits close");_e(this)}enqueue(t=void 0){if(!dt(this))throw ht("enqueue");if(!Ae(this))throw new TypeError("The stream is not in a state that permits enqueue");return qe(this,t)}error(t=void 0){if(!dt(this))throw ht("error");I(this,t)}[qt](t){re(this);let r=this._cancelAlgorithm(t);return ct(this),r}[At](t){let r=this._controlledReadableStream;if(this._queue.length>0){let n=Qt(this);this._closeRequested&&this._queue.length===0?(ct(this),Ue(r)):Ne(this),t._chunkSteps(n)}else Wr(r,t),Ne(this)}[Wt](){}}Object.defineProperties(x.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),d(x.prototype.close,"close"),d(x.prototype.enqueue,"enqueue"),d(x.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(x.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function dt(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")?!1:e instanceof x}function Ne(e){if(!Cn(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;let r=e._pullAlgorithm();v(r,()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ne(e)),null),n=>(I(e,n),null))}function Cn(e){let t=e._controlledReadableStream;return!Ae(e)||!e._started?!1:!!(ie(t)&&He(t)>0||ur(e)>0)}function ct(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function _e(e){if(!Ae(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(ct(e),Ue(t))}function qe(e,t){if(!Ae(e))return;let r=e._controlledReadableStream;if(ie(r)&&He(r)>0)Dt(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(o){throw I(e,o),o}try{Ut(e,t,n)}catch(o){throw I(e,o),o}}Ne(e)}function I(e,t){let r=e._controlledReadableStream;r._state==="readable"&&(re(e),ct(e),En(r,t))}function ur(e){let t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function ba(e){return!Cn(e)}function Ae(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function Tn(e,t,r,n,o,a,i){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,re(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=i,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t;let u=r();v(S(u),()=>(t._started=!0,Ne(t),null),p=>(I(t,p),null))}function ma(e,t,r,n){let o=Object.create(x.prototype),a,i,u;t.start!==void 0?a=()=>t.start(o):a=()=>{},t.pull!==void 0?i=()=>t.pull(o):i=()=>S(void 0),t.cancel!==void 0?u=p=>t.cancel(p):u=()=>S(void 0),Tn(e,o,a,i,u,r,n)}function ht(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function pa(e,t){return he(e._readableStreamController)?_a(e):ya(e)}function ya(e,t){let r=Ce(e),n=!1,o=!1,a=!1,i=!1,u,p,h,y,_,w=P(q=>{_=q});function D(){return n?(o=!0,S(void 0)):(n=!0,ze(r,{_chunkSteps:A=>{fe(()=>{o=!1;let z=A,X=A;a||qe(h._readableStreamController,z),i||qe(y._readableStreamController,X),n=!1,o&&D()})},_closeSteps:()=>{n=!1,a||_e(h._readableStreamController),i||_e(y._readableStreamController),(!a||!i)&&_(void 0)},_errorSteps:()=>{n=!1}}),S(void 0))}function Be(q){if(a=!0,u=q,i){let A=Ie([u,p]),z=j(e,A);_(z)}return w}function le(q){if(i=!0,p=q,a){let A=Ie([u,p]),z=j(e,A);_(z)}return w}function Z(){}return h=Qe(Z,D,Be),y=Qe(Z,D,le),N(r._closedPromise,q=>(I(h._readableStreamController,q),I(y._readableStreamController,q),(!a||!i)&&_(void 0),null)),[h,y]}function _a(e){let t=Ce(e),r=!1,n=!1,o=!1,a=!1,i=!1,u,p,h,y,_,w=P(m=>{_=m});function D(m){N(m._closedPromise,g=>(m!==t||(F(h._readableStreamController,g),F(y._readableStreamController,g),(!a||!i)&&_(void 0)),null))}function Be(){me(t)&&(U(t),t=Ce(e),D(t)),ze(t,{_chunkSteps:g=>{fe(()=>{n=!1,o=!1;let T=g,B=g;if(!a&&!i)try{B=$r(g)}catch(ke){F(h._readableStreamController,ke),F(y._readableStreamController,ke),_(j(e,ke));return}a||Je(h._readableStreamController,T),i||Je(y._readableStreamController,B),r=!1,n?Z():o&&q()})},_closeSteps:()=>{r=!1,a||je(h._readableStreamController),i||je(y._readableStreamController),h._readableStreamController._pendingPullIntos.length>0&&Ke(h._readableStreamController,0),y._readableStreamController._pendingPullIntos.length>0&&Ke(y._readableStreamController,0),(!a||!i)&&_(void 0)},_errorSteps:()=>{r=!1}})}function le(m,g){ee(t)&&(U(t),t=en(e),D(t));let T=g?y:h,B=g?h:y;nn(t,m,1,{_chunkSteps:Oe=>{fe(()=>{n=!1,o=!1;let Fe=g?i:a;if(g?a:i)Fe||et(T._readableStreamController,Oe);else{let Ln;try{Ln=$r(Oe)}catch(br){F(T._readableStreamController,br),F(B._readableStreamController,br),_(j(e,br));return}Fe||et(T._readableStreamController,Oe),Je(B._readableStreamController,Ln)}r=!1,n?Z():o&&q()})},_closeSteps:Oe=>{r=!1;let Fe=g?i:a,Rt=g?a:i;Fe||je(T._readableStreamController),Rt||je(B._readableStreamController),Oe!==void 0&&(Fe||et(T._readableStreamController,Oe),!Rt&&B._readableStreamController._pendingPullIntos.length>0&&Ke(B._readableStreamController,0)),(!Fe||!Rt)&&_(void 0)},_errorSteps:()=>{r=!1}})}function Z(){if(r)return n=!0,S(void 0);r=!0;let m=xt(h._readableStreamController);return m===null?Be():le(m._view,!1),S(void 0)}function q(){if(r)return o=!0,S(void 0);r=!0;let m=xt(y._readableStreamController);return m===null?Be():le(m._view,!0),S(void 0)}function A(m){if(a=!0,u=m,i){let g=Ie([u,p]),T=j(e,g);_(T)}return w}function z(m){if(i=!0,p=m,a){let g=Ie([u,p]),T=j(e,g);_(T)}return w}function X(){}return h=vn(X,Z,A),y=vn(X,q,z),D(t),[h,y]}function Sa(e){return l(e)&&typeof e.getReader<"u"}function ga(e){return Sa(e)?wa(e.getReader()):Ra(e)}function Ra(e){let t,r=Lr(e,"async"),n=s;function o(){let i;try{i=co(r)}catch(p){return c(p)}let u=S(i);return Q(u,p=>{if(!l(p))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(ho(p))_e(t._readableStreamController);else{let y=bo(p);qe(t._readableStreamController,y)}})}function a(i){let u=r.iterator,p;try{p=xe(u,"return")}catch(_){return c(_)}if(p===void 0)return S(void 0);let h;try{h=de(p,u,[i])}catch(_){return c(_)}let y=S(h);return Q(y,_=>{if(!l(_))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return t=Qe(n,o,a,0),t}function wa(e){let t,r=s;function n(){let a;try{a=e.read()}catch(i){return c(i)}return Q(a,i=>{if(!l(i))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(i.done)_e(t._readableStreamController);else{let u=i.value;qe(t._readableStreamController,u)}})}function o(a){try{return S(e.cancel(a))}catch(i){return c(i)}}return t=Qe(r,n,o,0),t}function Ca(e,t){L(e,t);let r=e,n=r?.autoAllocateChunkSize,o=r?.cancel,a=r?.pull,i=r?.start,u=r?.type;return{autoAllocateChunkSize:n===void 0?void 0:It(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:o===void 0?void 0:Ta(o,r,`${t} has member 'cancel' that`),pull:a===void 0?void 0:Pa(a,r,`${t} has member 'pull' that`),start:i===void 0?void 0:va(i,r,`${t} has member 'start' that`),type:u===void 0?void 0:Ea(u,`${t} has member 'type' that`)}}function Ta(e,t,r){return O(e,r),n=>J(e,t,[n])}function Pa(e,t,r){return O(e,r),n=>J(e,t,[n])}function va(e,t,r){return O(e,r),n=>de(e,t,[n])}function Ea(e,t){if(e=`${e}`,e!=="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function qa(e,t){return L(e,t),{preventCancel:!!e?.preventCancel}}function Pn(e,t){L(e,t);let r=e?.preventAbort,n=e?.preventCancel,o=e?.preventClose,a=e?.signal;return a!==void 0&&Aa(a,`${t} has member 'signal' that`),{preventAbort:!!r,preventCancel:!!n,preventClose:!!o,signal:a}}function Aa(e,t){if(!jo(e))throw new TypeError(`${t} is not an AbortSignal.`)}function Wa(e,t){L(e,t);let r=e?.readable;Ft(r,"readable","ReadableWritablePair"),jt(r,`${t} has member 'readable' that`);let n=e?.writable;return Ft(n,"writable","ReadableWritablePair"),an(n,`${t} has member 'writable' that`),{readable:r,writable:n}}class E{constructor(t={},r={}){t===void 0?t=null:qr(t,"First parameter");let n=nt(r,"Second parameter"),o=Ca(t,"First parameter");if(fr(this),o.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let a=Me(n,0);To(this,o,a)}else{let a=rt(n),i=Me(n,1);ma(this,o,i,a)}}get locked(){if(!ae(this))throw Se("locked");return ie(this)}cancel(t=void 0){return ae(this)?ie(this)?c(new TypeError("Cannot cancel a stream that already has a reader")):j(this,t):c(Se("cancel"))}getReader(t=void 0){if(!ae(this))throw Se("getReader");return vo(t,"First parameter").mode===void 0?Ce(this):en(this)}pipeThrough(t,r={}){if(!ae(this))throw Se("pipeThrough");Y(t,1,"pipeThrough");let n=Wa(t,"First parameter"),o=Pn(r,"Second parameter");if(ie(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ve(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let a=wn(this,n.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal);return we(a),n.readable}pipeTo(t,r={}){if(!ae(this))return c(Se("pipeTo"));if(t===void 0)return c("Parameter 1 is required in 'pipeTo'.");if(!Pe(t))return c(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=Pn(r,"Second parameter")}catch(o){return c(o)}return ie(this)?c(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):ve(t)?c(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):wn(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!ae(this))throw Se("tee");let t=pa(this);return Ie(t)}values(t=void 0){if(!ae(this))throw Se("values");let r=qa(t,"First parameter");return uo(this,r.preventCancel)}[Nt](t){return this.values(t)}static from(t){return ga(t)}}Object.defineProperties(E,{from:{enumerable:!0}}),Object.defineProperties(E.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),d(E.from,"from"),d(E.prototype.cancel,"cancel"),d(E.prototype.getReader,"getReader"),d(E.prototype.pipeThrough,"pipeThrough"),d(E.prototype.pipeTo,"pipeTo"),d(E.prototype.tee,"tee"),d(E.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(E.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(E.prototype,Nt,{value:E.prototype.values,writable:!0,configurable:!0});function Qe(e,t,r,n=1,o=()=>1){let a=Object.create(E.prototype);fr(a);let i=Object.create(x.prototype);return Tn(a,i,e,t,r,n,o),a}function vn(e,t,r){let n=Object.create(E.prototype);fr(n);let o=Object.create(H.prototype);return Kr(n,o,e,t,r,0,void 0),n}function fr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function ae(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")?!1:e instanceof E}function ie(e){return e._reader!==void 0}function j(e,t){if(e._disturbed=!0,e._state==="closed")return S(void 0);if(e._state==="errored")return c(e._storedError);Ue(e);let r=e._reader;if(r!==void 0&&me(r)){let o=r._readIntoRequests;r._readIntoRequests=new k,o.forEach(a=>{a._closeSteps(void 0)})}let n=e._readableStreamController[qt](t);return Q(n,s)}function Ue(e){e._state="closed";let t=e._reader;if(t!==void 0&&(vr(t),ee(t))){let r=t._readRequests;t._readRequests=new k,r.forEach(n=>{n._closeSteps()})}}function En(e,t){e._state="errored",e._storedError=t;let r=e._reader;r!==void 0&&(Ot(r,t),ee(r)?kr(r,t):on(r,t))}function Se(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function qn(e,t){L(e,t);let r=e?.highWaterMark;return Ft(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:zt(r)}}let An=e=>e.byteLength;d(An,"size");class bt{constructor(t){Y(t,1,"ByteLengthQueuingStrategy"),t=qn(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!Bn(this))throw Wn("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Bn(this))throw Wn("size");return An}}Object.defineProperties(bt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(bt.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function Wn(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Bn(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")?!1:e instanceof bt}let kn=()=>1;d(kn,"size");class mt{constructor(t){Y(t,1,"CountQueuingStrategy"),t=qn(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!Fn(this))throw On("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Fn(this))throw On("size");return kn}}Object.defineProperties(mt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function On(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Fn(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")?!1:e instanceof mt}function Ba(e,t){L(e,t);let r=e?.cancel,n=e?.flush,o=e?.readableType,a=e?.start,i=e?.transform,u=e?.writableType;return{cancel:r===void 0?void 0:za(r,e,`${t} has member 'cancel' that`),flush:n===void 0?void 0:ka(n,e,`${t} has member 'flush' that`),readableType:o,start:a===void 0?void 0:Oa(a,e,`${t} has member 'start' that`),transform:i===void 0?void 0:Fa(i,e,`${t} has member 'transform' that`),writableType:u}}function ka(e,t,r){return O(e,r),n=>J(e,t,[n])}function Oa(e,t,r){return O(e,r),n=>de(e,t,[n])}function Fa(e,t,r){return O(e,r),(n,o)=>J(e,t,[n,o])}function za(e,t,r){return O(e,r),n=>J(e,t,[n])}class pt{constructor(t={},r={},n={}){t===void 0&&(t=null);let o=nt(r,"Second parameter"),a=nt(n,"Third parameter"),i=Ba(t,"First parameter");if(i.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(i.writableType!==void 0)throw new RangeError("Invalid writableType specified");let u=Me(a,0),p=rt(a),h=Me(o,1),y=rt(o),_,w=P(D=>{_=D});Ia(this,w,h,y,u,p),Da(this,i),i.start!==void 0?_(i.start(this._transformStreamController)):_(void 0)}get readable(){if(!zn(this))throw Mn("readable");return this._readable}get writable(){if(!zn(this))throw Mn("writable");return this._writable}}Object.defineProperties(pt.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pt.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function Ia(e,t,r,n,o,a){function i(){return t}function u(w){return $a(e,w)}function p(w){return Na(e,w)}function h(){return Qa(e)}e._writable=Lo(i,u,h,p,r,n);function y(){return Ua(e)}function _(w){return Ya(e,w)}e._readable=Qe(i,y,_,o,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,yt(e,!0),e._transformStreamController=void 0}function zn(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")?!1:e instanceof pt}function In(e,t){I(e._readable._readableStreamController,t),dr(e,t)}function dr(e,t){St(e._transformStreamController),Le(e._writable._writableStreamController,t),cr(e)}function cr(e){e._backpressure&&yt(e,!1)}function yt(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=P(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}class se{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!_t(this))throw gt("desiredSize");let t=this._controlledTransformStream._readable._readableStreamController;return ur(t)}enqueue(t=void 0){if(!_t(this))throw gt("enqueue");jn(this,t)}error(t=void 0){if(!_t(this))throw gt("error");Ma(this,t)}terminate(){if(!_t(this))throw gt("terminate");La(this)}}Object.defineProperties(se.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),d(se.prototype.enqueue,"enqueue"),d(se.prototype.error,"error"),d(se.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(se.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function _t(e){return!l(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")?!1:e instanceof se}function ja(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}function Da(e,t){let r=Object.create(se.prototype),n,o,a;t.transform!==void 0?n=i=>t.transform(i,r):n=i=>{try{return jn(r,i),S(void 0)}catch(u){return c(u)}},t.flush!==void 0?o=()=>t.flush(r):o=()=>S(void 0),t.cancel!==void 0?a=i=>t.cancel(i):a=()=>S(void 0),ja(e,r,n,o,a)}function St(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function jn(e,t){let r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Ae(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{qe(n,t)}catch(a){throw dr(r,a),r._readable._storedError}ba(n)!==r._backpressure&&yt(r,!0)}function Ma(e,t){In(e._controlledTransformStream,t)}function Dn(e,t){let r=e._transformAlgorithm(t);return Q(r,void 0,n=>{throw In(e._controlledTransformStream,n),n})}function La(e){let t=e._controlledTransformStream,r=t._readable._readableStreamController;_e(r);let n=new TypeError("TransformStream terminated");dr(t,n)}function $a(e,t){let r=e._transformStreamController;if(e._backpressure){let n=e._backpressureChangePromise;return Q(n,()=>{let o=e._writable;if(o._state==="erroring")throw o._storedError;return Dn(r,t)})}return Dn(r,t)}function Na(e,t){let r=e._transformStreamController;if(r._finishPromise!==void 0)return r._finishPromise;let n=e._readable;r._finishPromise=P((a,i)=>{r._finishPromise_resolve=a,r._finishPromise_reject=i});let o=r._cancelAlgorithm(t);return St(r),v(o,()=>(n._state==="errored"?We(r,n._storedError):(I(n._readableStreamController,t),hr(r)),null),a=>(I(n._readableStreamController,a),We(r,a),null)),r._finishPromise}function Qa(e){let t=e._transformStreamController;if(t._finishPromise!==void 0)return t._finishPromise;let r=e._readable;t._finishPromise=P((o,a)=>{t._finishPromise_resolve=o,t._finishPromise_reject=a});let n=t._flushAlgorithm();return St(t),v(n,()=>(r._state==="errored"?We(t,r._storedError):(_e(r._readableStreamController),hr(t)),null),o=>(I(r._readableStreamController,o),We(t,o),null)),t._finishPromise}function Ua(e){return yt(e,!1),e._backpressureChangePromise}function Ya(e,t){let r=e._transformStreamController;if(r._finishPromise!==void 0)return r._finishPromise;let n=e._writable;r._finishPromise=P((a,i)=>{r._finishPromise_resolve=a,r._finishPromise_reject=i});let o=r._cancelAlgorithm(t);return St(r),v(o,()=>(n._state==="errored"?We(r,n._storedError):(Le(n._writableStreamController,t),cr(e),hr(r)),null),a=>(Le(n._writableStreamController,a),cr(e),We(r,a),null)),r._finishPromise}function gt(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function hr(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function We(e,t){e._finishPromise_reject!==void 0&&(we(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Mn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}f.ByteLengthQueuingStrategy=bt,f.CountQueuingStrategy=mt,f.ReadableByteStreamController=H,f.ReadableStream=E,f.ReadableStreamBYOBReader=ne,f.ReadableStreamBYOBRequest=ce,f.ReadableStreamDefaultController=x,f.ReadableStreamDefaultReader=K,f.TransformStream=pt,f.TransformStreamDefaultController=se,f.WritableStream=oe,f.WritableStreamDefaultController=Ee,f.WritableStreamDefaultWriter=G}))});var Un=mr(()=>{if(!globalThis.ReadableStream)try{let f=wt("node:process"),{emitWarning:s}=f;try{f.emitWarning=()=>{},Object.assign(globalThis,wt("node:stream/web")),f.emitWarning=s}catch(l){throw f.emitWarning=s,l}}catch{Object.assign(globalThis,Qn())}try{let{Blob:f}=wt("buffer");f&&!f.prototype.stream&&(f.prototype.stream=function(l){let b=0,d=this;return new ReadableStream({type:"bytes",async pull(R){let ue=await d.slice(b,Math.min(d.size,b+65536)).arrayBuffer();b+=ue.byteLength,R.enqueue(new Uint8Array(ue)),b===d.size&&R.close()}})})}catch{}});async function*pr(f,s=!0){for(let l of f)if("stream"in l)yield*l.stream();else if(ArrayBuffer.isView(l))if(s){let b=l.byteOffset,d=l.byteOffset+l.byteLength;for(;b!==d;){let R=Math.min(d-b,Yn),C=l.buffer.slice(b,b+R);b+=C.byteLength,yield new Uint8Array(C)}}else yield l;else{let b=0,d=l;for(;b!==d.size;){let C=await d.slice(b,Math.min(d.size,b+Yn)).arrayBuffer();b+=C.byteLength,yield new Uint8Array(C)}}}var ai,Yn,Vn,Va,ge,Pt=Ct(()=>{ai=$n(Un(),1);Yn=65536;Vn=class yr{#e=[];#t="";#r=0;#n="transparent";constructor(s=[],l={}){if(typeof s!="object"||s===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof s[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof l!="object"&&typeof l!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");l===null&&(l={});let b=new TextEncoder;for(let R of s){let C;ArrayBuffer.isView(R)?C=new Uint8Array(R.buffer.slice(R.byteOffset,R.byteOffset+R.byteLength)):R instanceof ArrayBuffer?C=new Uint8Array(R.slice(0)):R instanceof yr?C=R:C=b.encode(`${R}`),this.#r+=ArrayBuffer.isView(C)?C.byteLength:C.size,this.#e.push(C)}this.#n=`${l.endings===void 0?"transparent":l.endings}`;let d=l.type===void 0?"":String(l.type);this.#t=/^[\x20-\x7E]*$/.test(d)?d:""}get size(){return this.#r}get type(){return this.#t}async text(){let s=new TextDecoder,l="";for await(let b of pr(this.#e,!1))l+=s.decode(b,{stream:!0});return l+=s.decode(),l}async arrayBuffer(){let s=new Uint8Array(this.size),l=0;for await(let b of pr(this.#e,!1))s.set(b,l),l+=b.length;return s.buffer}stream(){let s=pr(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(l){let b=await s.next();b.done?l.close():l.enqueue(b.value)},async cancel(){await s.return()}})}slice(s=0,l=this.size,b=""){let{size:d}=this,R=s<0?Math.max(d+s,0):Math.min(s,d),C=l<0?Math.max(d+l,0):Math.min(l,d),ue=Math.max(C-R,0),P=this.#e,S=[],c=0;for(let v of P){if(c>=ue)break;let M=ArrayBuffer.isView(v)?v.byteLength:v.size;if(R&&M<=R)R-=M,C-=M;else{let N;ArrayBuffer.isView(v)?(N=v.subarray(R,Math.min(M,C)),c+=N.byteLength):(N=v.slice(R,Math.min(M,C)),c+=N.size),C-=M,S.push(N),R=0}}let W=new yr([],{type:String(b).toLowerCase()});return W.#r=ue,W.#e=S,W}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](s){return s&&typeof s=="object"&&typeof s.constructor=="function"&&(typeof s.stream=="function"||typeof s.arrayBuffer=="function")&&/^(Blob|File)$/.test(s[Symbol.toStringTag])}};Object.defineProperties(Vn.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Va=Vn,ge=Va});var Ha,Ga,vt,_r=Ct(()=>{Pt();Ha=class extends ge{#e=0;#t="";constructor(s,l,b={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(s,b),b===null&&(b={});let d=b.lastModified===void 0?Date.now():Number(b.lastModified);Number.isNaN(d)||(this.#e=d),this.#t=String(l)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](s){return!!s&&s instanceof ge&&/^(File)$/.test(s[Symbol.toStringTag])}},Ga=Ha,vt=Ga});function bi(f,s=ge){var l=`${Hn()}${Hn()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),b=[],d=`--${l}\r
5
+ Content-Disposition: form-data; name="`;return f.forEach((R,C)=>typeof R=="string"?b.push(d+Sr(C)+`"\r
6
+ \r
7
+ ${R.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
8
+ `)}\r
9
+ `):b.push(d+Sr(C)+`"; filename="${Sr(R.name,1)}"\r
10
+ Content-Type: ${R.type||"application/octet-stream"}\r
11
+ \r
12
+ `,R,`\r
13
+ `)),b.push(`--${l}--`),new s(b,{type:"multipart/form-data; boundary="+l})}var Ye,xa,Za,Hn,Xa,Gn,Sr,Re,ci,Ja=Ct(()=>{Pt();_r();({toStringTag:Ye,iterator:xa,hasInstance:Za}=Symbol),Hn=Math.random,Xa="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),Gn=(f,s,l)=>(f+="",/^(Blob|File)$/.test(s&&s[Ye])?[(l=l!==void 0?l+"":s[Ye]=="File"?s.name:"blob",f),s.name!==l||s[Ye]=="blob"?new vt([s],l,s):s]:[f,s+""]),Sr=(f,s)=>(s?f:f.replace(/\r?\n|\r/g,`\r
14
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Re=(f,s,l)=>{if(s.length<l)throw new TypeError(`Failed to execute '${f}' on 'FormData': ${l} arguments required, but only ${s.length} present.`)},ci=class{#e=[];constructor(...s){if(s.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Ye](){return"FormData"}[xa](){return this.entries()}static[Za](s){return s&&typeof s=="object"&&s[Ye]==="FormData"&&!Xa.some(l=>typeof s[l]!="function")}append(...s){Re("append",arguments,2),this.#e.push(Gn(...s))}delete(s){Re("delete",arguments,1),s+="",this.#e=this.#e.filter(([l])=>l!==s)}get(s){Re("get",arguments,1),s+="";for(var l=this.#e,b=l.length,d=0;d<b;d++)if(l[d][0]===s)return l[d][1];return null}getAll(s,l){return Re("getAll",arguments,1),l=[],s+="",this.#e.forEach(b=>b[0]===s&&l.push(b[1])),l}has(s){return Re("has",arguments,1),s+="",this.#e.some(l=>l[0]===s)}forEach(s,l){Re("forEach",arguments,1);for(var[b,d]of this)s.call(l,d,b,this)}set(...s){Re("set",arguments,2);var l=[],b=!0;s=Gn(...s),this.#e.forEach(d=>{d[0]===s[0]?b&&(b=!l.push(s)):l.push(d)}),b&&l.push(s),this.#e=l}*entries(){yield*this.#e}*keys(){for(var[s]of this)yield s}*values(){for(var[,s]of this)yield s}}});var Zn=mr((pi,xn)=>{if(!globalThis.DOMException)try{let{MessageChannel:f}=wt("worker_threads"),s=new f().port1,l=new ArrayBuffer;s.postMessage(l,[l,l])}catch(f){f.constructor.name==="DOMException"&&(globalThis.DOMException=f.constructor)}xn.exports=globalThis.DOMException});import{statSync as Xn,createReadStream as Ka,promises as ei}from"node:fs";import{basename as ti}from"node:path";var Jn,gr,Ri,wi,Ci,Ti,Kn,eo,Et,ri=Ct(()=>{Jn=$n(Zn(),1);_r();Pt();({stat:gr}=ei),Ri=(f,s)=>Kn(Xn(f),f,s),wi=(f,s)=>gr(f).then(l=>Kn(l,f,s)),Ci=(f,s)=>gr(f).then(l=>eo(l,f,s)),Ti=(f,s)=>eo(Xn(f),f,s),Kn=(f,s,l="")=>new ge([new Et({path:s,size:f.size,lastModified:f.mtimeMs,start:0})],{type:l}),eo=(f,s,l="")=>new vt([new Et({path:s,size:f.size,lastModified:f.mtimeMs,start:0})],ti(s),{type:l,lastModified:f.mtimeMs}),Et=class f{#e;#t;constructor(s){this.#e=s.path,this.#t=s.start,this.size=s.size,this.lastModified=s.lastModified}slice(s,l){return new f({path:this.#e,lastModified:this.lastModified,size:l-s,start:this.#t+s})}async*stream(){let{mtimeMs:s}=await gr(this.#e);if(s>this.lastModified)throw new Jn.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*Ka(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});export{ge as a,Pt as b,vt as c,ci as d,bi as e,Ja as f,Ri as g,wi as h,Ci as i,Ti as j,ri as k};
15
+ /*! Bundled license information:
16
+
17
+ web-streams-polyfill/dist/ponyfill.es2018.js:
18
+ (**
19
+ * @license
20
+ * web-streams-polyfill v3.3.3
21
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
22
+ * This code is released under the MIT license.
23
+ * SPDX-License-Identifier: MIT
24
+ *)
25
+
26
+ fetch-blob/index.js:
27
+ (*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
28
+
29
+ formdata-polyfill/esm.min.js:
30
+ (*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
31
+
32
+ node-domexception/index.js:
33
+ (*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
34
+ */
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{K as L,L as M,O as v,P as V,R as w,S as P,U as m,Z as $,_ as d,a as y,aa as z,ba as O,c as _,ca as A,da as U,e as E,ea as H,fa as x,ga as B,k as S,l as k,o as f,q as R,r as q,t as I,v as T}from"./chunk-FOQ7VLIL.js";var b=class{constructor(e){this._server=e}requestStream(e,t,s){return this._server.requestStream(e,t,s)}createMessageStream(e,t){let s=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!s?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],r=Array.isArray(i.content)?i.content:[i.content],n=r.some(a=>a.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,u=o?Array.isArray(o.content)?o.content:[o.content]:[],c=u.some(a=>a.type==="tool_use");if(n){if(r.some(a=>a.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let a=new Set(u.filter(h=>h.type==="tool_use").map(h=>h.id)),l=new Set(r.filter(h=>h.type==="tool_result").map(h=>h.toolUseId));if(a.size!==l.size||![...a].every(h=>l.has(h)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},w,t)}elicitInputStream(e,t){let s=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!s?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!s?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let r=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:r},m,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._server.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};var D=class extends z{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(v.options.map((s,i)=>[s,i])),this.isMessageIgnored=(s,i)=>{let r=this._loggingLevels.get(i);return r?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(r):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new A,this.setRequestHandler(q,s=>this._oninitialize(s)),this.setNotificationHandler(I,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(V,async(s,i)=>{let r=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:n}=s.params,o=v.safeParse(n);return o.success&&this._loggingLevels.set(r,o.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new b(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=O(this._capabilities,e)}setRequestHandler(e,t){let i=E(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let r;if(y(i)){let o=i;r=o._zod?.def?.value??o.value}else{let o=i;r=o._def?.value??o.value}if(typeof r!="string")throw new Error("Schema method literal must be a string");if(r==="tools/call"){let o=async(u,c)=>{let a=_(M,u);if(!a.success){let p=a.error instanceof Error?a.error.message:String(a.error);throw new d(f.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=a.data,h=await Promise.resolve(t(u,c));if(l.task){let p=_(T,h);if(!p.success){let G=p.error instanceof Error?p.error.message:String(p.error);throw new d(f.InvalidParams,`Invalid task creation result: ${G}`)}return p.data}let g=_(L,h);if(!g.success){let p=g.error instanceof Error?g.error.message:String(g.error);throw new d(f.InvalidParams,`Invalid tools/call result: ${p}`)}return g.data};return super.setRequestHandler(e,o)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){H(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&U(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:k.includes(t)?t:S,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},R)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],i=Array.isArray(s.content)?s.content:[s.content],r=i.some(c=>c.type==="tool_result"),n=e.messages.length>1?e.messages[e.messages.length-2]:void 0,o=n?Array.isArray(n.content)?n.content:[n.content]:[],u=o.some(c=>c.type==="tool_use");if(r){if(i.some(c=>c.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(o.filter(l=>l.type==="tool_use").map(l=>l.id)),a=new Set(i.filter(l=>l.type==="tool_result").map(l=>l.toolUseId));if(c.size!==a.size||![...c].every(l=>a.has(l)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},P,t):this.request({method:"sampling/createMessage",params:e},w,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},m,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},r=await this.request({method:"elicitation/create",params:i},m,t);if(r.action==="accept"&&r.content&&i.requestedSchema)try{let o=this._jsonSchemaValidator.getValidator(i.requestedSchema)(r.content);if(!o.valid)throw new d(f.InvalidParams,`Elicitation response content does not match requested schema: ${o.errorMessage}`)}catch(n){throw n instanceof d?n:new d(f.InternalError,`Error validating elicitation response: ${n instanceof Error?n.message:String(n)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},$,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import j from"node:process";var N=class{constructor(e=j.stdin,t=j.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new x,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{this.onerror?.(s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let s=B(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};export{D as a,N as b};
@@ -0,0 +1,6 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import*as i from"node:fs";import*as O from"node:os";import*as a from"node:path";import{createRequire as T}from"node:module";import{spawn as w}from"node:child_process";var E="CORTEX_AGENT_BROWSER_BIN",_=class extends Error{hint;constructor(t,r){super(t),this.name="AgentBrowserMissingError",this.hint=r}};function d(){return!process.report?.getReport?.()?.header?.glibcVersionRuntime}function N(e=process.platform,t=process.arch,r=d){let o=e==="darwin"?"darwin":e==="linux"?r()?"linux-musl":"linux":e==="win32"?"win32":null,n=t==="x64"?"x64":t==="arm64"?e==="win32"?"x64":"arm64":null;return!o||!n?null:`agent-browser-${o}-${n}${e==="win32"?".exe":""}`}function h(e){if(process.platform!=="win32")try{i.accessSync(e,i.constants.X_OK)}catch{i.chmodSync(e,493)}}function B(e=process.env){let t=e[E];if(t){if(!i.existsSync(t))throw new _(`${E} points at ${t}, which does not exist`,`fix or unset ${E}`);return t}let r;try{r=a.dirname(T(new URL("dist/platform/browser/agent-browser.js",__cortexPackageRoot).href).resolve("agent-browser/package.json"))}catch{throw new _("the agent-browser package is not installed with this Cortex server",`reinstall @cortex-agent/server, or set ${E} to an agent-browser binary`)}let o=N(),n=o?a.join(r,"bin",o):null;if(!n||!i.existsSync(n))throw new _(`agent-browser has no binary for ${process.platform}-${process.arch}`,`build one and set ${E} to its path`);return h(n),n}function f(e,t){return e.replace(/[^A-Za-z0-9_-]/g,"").slice(0,t)||"x"}function I(e,t){return`cortex-${f(e,36)}-${f(t,24)}`}function P(e,t,r){return["--cdp",e,"--session",t,"--pin-tab",...r]}var D=["set","viewport","1280","800"];function b(e){return/(^|\s)tab_gone[:\s]/.test(e)||e.includes('"code":"tab_gone"')}var x=new Set(["PATH","HOME","USER","LOGNAME","SHELL","LANG","LANGUAGE","TZ","TMPDIR","TMP","TEMP","XDG_RUNTIME_DIR","XDG_CONFIG_HOME","XDG_CACHE_HOME","XDG_DATA_HOME","SYSTEMROOT","WINDIR","USERPROFILE","APPDATA","LOCALAPPDATA","PROGRAMFILES","PROGRAMDATA","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","http_proxy","https_proxy","no_proxy","all_proxy","SSL_CERT_FILE"]),l=new Set(["AGENT_BROWSER_SOCKET_DIR","AGENT_BROWSER_SESSION","AGENT_BROWSER_CDP","AGENT_BROWSER_NAMESPACE","AGENT_BROWSER_PROVIDER","AGENT_BROWSER_AUTO_CONNECT","AGENT_BROWSER_PIN_TAB","AGENT_BROWSER_ENGINE"]);function g(e){return e.XDG_RUNTIME_DIR?a.join(e.XDG_RUNTIME_DIR,"agent-browser"):a.join(e.HOME||O.homedir(),".agent-browser")}function W(e=process.env){let t={};for(let[r,o]of Object.entries(e))o!==void 0&&(x.has(r)||r.startsWith("LC_")||r.startsWith("AGENT_BROWSER_")&&!l.has(r))&&(t[r]=o);return t.AGENT_BROWSER_SOCKET_DIR=e.AGENT_BROWSER_SOCKET_DIR||g(e),t}function L(e,t){let r={...e};for(let[o,n]of Object.entries(t))n!==void 0&&o.startsWith("AGENT_BROWSER_")&&!l.has(o)&&(r[o]=n);return r}function M(e,t,r){return new Promise(o=>{let n="",u="",p=!1,c=w(e,t,{env:r.env,cwd:r.cwd,stdio:["ignore","pipe","pipe"],windowsHide:!0}),R=s=>{p||(p=!0,clearTimeout(S),o(s))},S=setTimeout(()=>{c.kill("SIGKILL"),R({code:124,stdout:n,stderr:`${u}agent-browser timed out after ${r.timeoutMs}ms
5
+ `})},r.timeoutMs??12e4);c.stdout.on("data",s=>{n+=String(s)}),c.stderr.on("data",s=>{u+=String(s)}),c.on("error",s=>R({code:127,stdout:n,stderr:`${u}cannot run ${e}: ${s.message}
6
+ `})),c.on("close",(s,A)=>R({code:s??(A?128:1),stdout:n,stderr:u}))})}export{_ as a,B as b,I as c,P as d,D as e,b as f,W as g,L as h,M as i};
@@ -0,0 +1,4 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as o}from"./chunk-6R73ICDB.js";var s="v1";function m(r){let e=new Map;if(!r)return e;for(let t of r.split(",")){let a=t.trim();if(!a)continue;let[n,i]=a.split("=",2);!n||!i||e.set(n.trim(),i.trim())}return e}function A(r,e){return e?.azureDeploymentName?e.azureDeploymentName:m(o("AZURE_OPENAI_DEPLOYMENT_NAME_MAP",e?.env)).get(r.id)||r.id}function u(r){let e=r.trim().replace(/\/+$/,""),t;try{t=new URL(e)}catch{throw new Error(`Invalid Azure OpenAI base URL: ${r}`)}let a=t.hostname.endsWith(".openai.azure.com")||t.hostname.endsWith(".cognitiveservices.azure.com")||t.hostname.endsWith(".ai.azure.com"),n=t.pathname.replace(/\/+$/,"");return a&&(n===""||n==="/"||n==="/openai"||n==="/openai/v1/responses")&&(t.pathname="/openai/v1",t.search=""),t.toString().replace(/\/+$/,"")}function c(r){return`https://${r}.openai.azure.com/openai/v1`}function l(r,e){let t=e?.azureBaseUrl?.trim()||o("AZURE_OPENAI_BASE_URL",e?.env)?.trim()||void 0,a=e?.azureResourceName||o("AZURE_OPENAI_RESOURCE_NAME",e?.env),n=t;if(!n&&a&&(n=c(a)),!n&&r.baseUrl&&(n=r.baseUrl),!n)throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return u(n)}function E(r,e){return{baseUrl:l(r,e),apiVersion:e?.azureApiVersion||o("AZURE_OPENAI_API_VERSION",e?.env)||s}}export{A as a,l as b,E as c};