@cortex-agent/server 2026.11.17 → 2026.12.5

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 (338) hide show
  1. package/README.md +5 -5
  2. package/THIRD_PARTY_NOTICES.txt +860 -294
  3. package/defaults/hooks/quota-stop.mjs +37 -0
  4. package/defaults/prompts/clean-workspace.md +5 -0
  5. package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
  6. package/dist/chunks/agent-runner-LVZVKBZX.js +4 -0
  7. package/dist/chunks/anthropic-messages-TT6454AA.js +8 -0
  8. package/dist/chunks/azure-openai-responses-52LR2XZD.js +4 -0
  9. package/dist/chunks/bedrock-converse-stream-EOZGYUNY.js +60 -0
  10. package/dist/chunks/child-runner-SMG2VOU5.js +4 -0
  11. package/dist/chunks/chunk-24DH4IR5.js +4 -0
  12. package/dist/chunks/chunk-25XKBRDT.js +70 -0
  13. package/dist/chunks/{chunk-VTL3Z2OP.js → chunk-2ABET62E.js} +1 -1
  14. package/dist/chunks/chunk-2BVUA256.js +4 -0
  15. package/dist/chunks/{chunk-4YLAGSDM.js → chunk-2WFL62UO.js} +1 -1
  16. package/dist/chunks/{chunk-LQTFDC67.js → chunk-335SSANX.js} +1 -1
  17. package/dist/chunks/chunk-377OPTXX.js +17 -0
  18. package/dist/chunks/chunk-3EZNVLBF.js +129 -0
  19. package/dist/chunks/{chunk-V6X7Y62J.js → chunk-3O6ZG5HA.js} +1 -1
  20. package/dist/chunks/{chunk-6AKUD3CF.js → chunk-3XLHL5YT.js} +1 -1
  21. package/dist/chunks/{chunk-2ATTYCRJ.js → chunk-4HRI75GU.js} +1 -1
  22. package/dist/chunks/chunk-4JBYLRPM.js +57 -0
  23. package/dist/chunks/chunk-4KKV7VKE.js +4 -0
  24. package/dist/chunks/chunk-4KQHDDC5.js +4 -0
  25. package/dist/chunks/chunk-4SWD4JMP.js +33 -0
  26. package/dist/chunks/chunk-52VCLZS5.js +4 -0
  27. package/dist/chunks/chunk-54P7TSY3.js +10 -0
  28. package/dist/chunks/chunk-5DVSAXOI.js +7 -0
  29. package/dist/chunks/chunk-5F3A62YS.js +4 -0
  30. package/dist/chunks/{chunk-S3MR37DL.js → chunk-5FHETFZM.js} +1 -1
  31. package/dist/chunks/{chunk-CEGSDGYQ.js → chunk-5LBLRAHS.js} +1 -1
  32. package/dist/chunks/chunk-5UYVNA3W.js +4 -0
  33. package/dist/chunks/chunk-6G3OYMCV.js +21 -0
  34. package/dist/chunks/chunk-7GGPYU5E.js +30 -0
  35. package/dist/chunks/chunk-7TYSMLUV.js +4 -0
  36. package/dist/chunks/chunk-7W7VYUTK.js +5 -0
  37. package/dist/chunks/chunk-AXYAZTTN.js +6 -0
  38. package/dist/chunks/chunk-B3NB243Z.js +4 -0
  39. package/dist/chunks/{chunk-XPPZ6Y3X.js → chunk-BKYP6AGM.js} +1 -1
  40. package/dist/chunks/{chunk-QUXPMNFQ.js → chunk-BVEDNESB.js} +1 -1
  41. package/dist/chunks/chunk-BWDJS6A4.js +12 -0
  42. package/dist/chunks/chunk-C6YVF7EI.js +4 -0
  43. package/dist/chunks/chunk-CEJIYYVE.js +15 -0
  44. package/dist/chunks/{chunk-5PAW3DEU.js → chunk-CI2RHH74.js} +4 -4
  45. package/dist/chunks/{chunk-OFEPDNRB.js → chunk-CMSOOLJB.js} +1 -1
  46. package/dist/chunks/chunk-CSVTYYLP.js +4 -0
  47. package/dist/chunks/chunk-DE5EGVKG.js +6 -0
  48. package/dist/chunks/{chunk-E6BYRULL.js → chunk-DK3RPZOQ.js} +1 -1
  49. package/dist/chunks/{chunk-ROVKOIHF.js → chunk-DK4UCK7L.js} +1 -1
  50. package/dist/chunks/chunk-DYLBVUAU.js +4 -0
  51. package/dist/chunks/{chunk-WBSE3EF3.js → chunk-FDC2GRBK.js} +1 -1
  52. package/dist/chunks/chunk-FE7HH5JS.js +18 -0
  53. package/dist/chunks/chunk-FYD57YRO.js +436 -0
  54. package/dist/chunks/chunk-G264APQN.js +5 -0
  55. package/dist/chunks/chunk-G4JYZFEO.js +11 -0
  56. package/dist/chunks/chunk-GFFM56U2.js +4 -0
  57. package/dist/chunks/chunk-GOS3P7KS.js +132 -0
  58. package/dist/chunks/{chunk-2VVRTJQN.js → chunk-HVN37UXD.js} +1 -1
  59. package/dist/chunks/{chunk-53TQNK7Z.js → chunk-IGZWZP7Z.js} +1 -1
  60. package/dist/chunks/{chunk-AFTBQRPN.js → chunk-IJ7XFQMI.js} +1 -1
  61. package/dist/chunks/{chunk-U23S37TT.js → chunk-IMMGYDAB.js} +1 -1
  62. package/dist/chunks/chunk-IOWBF7UK.js +10 -0
  63. package/dist/chunks/{chunk-MGYYSX7Y.js → chunk-ITGCWQFK.js} +1 -1
  64. package/dist/chunks/{chunk-QEL6CMLE.js → chunk-IVZ7QUEG.js} +1 -1
  65. package/dist/chunks/{chunk-EE3WT25T.js → chunk-IWY2HIFK.js} +1 -1
  66. package/dist/chunks/{chunk-KGJZAYQD.js → chunk-J7OBATRN.js} +1 -1
  67. package/dist/chunks/{chunk-NXZS5PEW.js → chunk-JGUEIW2W.js} +1 -1
  68. package/dist/chunks/chunk-JZ7U7RUK.js +351 -0
  69. package/dist/chunks/{chunk-VIMHSW6J.js → chunk-KJUQCCB5.js} +1 -1
  70. package/dist/chunks/{chunk-BUZQBTV2.js → chunk-KST6OY76.js} +1 -1
  71. package/dist/chunks/{chunk-KDPY2YA3.js → chunk-KZSAFVSY.js} +2 -2
  72. package/dist/chunks/chunk-LD2ZSH3M.js +903 -0
  73. package/dist/chunks/{chunk-RYLSRII6.js → chunk-LE6QPXN6.js} +1 -1
  74. package/dist/chunks/{chunk-TX46YMGI.js → chunk-LIIZI3HY.js} +1 -1
  75. package/dist/chunks/{chunk-3CZPBLB3.js → chunk-MJQ2D2OP.js} +1 -1
  76. package/dist/chunks/{chunk-P7TVR4GY.js → chunk-NHHR4DCF.js} +1 -1
  77. package/dist/chunks/chunk-NW4GW47L.js +4 -0
  78. package/dist/chunks/chunk-OALEJ6FG.js +60 -0
  79. package/dist/chunks/chunk-OIV4DIMB.js +4 -0
  80. package/dist/chunks/{chunk-T73GHMFB.js → chunk-OJ37ZWBG.js} +1 -1
  81. package/dist/chunks/{chunk-7GEBDPTT.js → chunk-OZXMPBUX.js} +1 -1
  82. package/dist/chunks/chunk-PG7452XE.js +4 -0
  83. package/dist/chunks/chunk-PJCUB7YJ.js +4 -0
  84. package/dist/chunks/{chunk-RA2BUYI3.js → chunk-PTS3J4DQ.js} +1 -1
  85. package/dist/chunks/{chunk-2ROGTDM2.js → chunk-PVVEEBUU.js} +1 -1
  86. package/dist/chunks/{chunk-W6AKCEYF.js → chunk-Q7BZLPBU.js} +1 -1
  87. package/dist/chunks/{chunk-SY2HV3V5.js → chunk-QC66ZXPP.js} +1 -1
  88. package/dist/chunks/chunk-QXFWIL4C.js +4 -0
  89. package/dist/chunks/{chunk-NRD57ICT.js → chunk-R2CCD4OF.js} +1 -1
  90. package/dist/chunks/{chunk-R52AVUQB.js → chunk-RG5GP4RB.js} +1 -1
  91. package/dist/chunks/{chunk-IKLTEWA3.js → chunk-RW2F2QNP.js} +1 -1
  92. package/dist/chunks/{chunk-XEBEWR6Y.js → chunk-RWPO3NZ3.js} +1 -1
  93. package/dist/chunks/chunk-SDUS2H3E.js +4 -0
  94. package/dist/chunks/chunk-SIHGKM4E.js +4 -0
  95. package/dist/chunks/{chunk-NNBSSISP.js → chunk-SKHFU5DI.js} +1 -1
  96. package/dist/chunks/{chunk-STUHNKQS.js → chunk-SM45TH22.js} +1 -1
  97. package/dist/chunks/chunk-T54CZKNJ.js +6 -0
  98. package/dist/chunks/chunk-TRXLIL7V.js +4 -0
  99. package/dist/chunks/{chunk-KUDK7GPS.js → chunk-UEEW2R4E.js} +1 -1
  100. package/dist/chunks/chunk-UHXPRU6G.js +10 -0
  101. package/dist/chunks/chunk-UPQVWHZ3.js +4 -0
  102. package/dist/chunks/{chunk-BDLKI2NT.js → chunk-VHX2GHBF.js} +1 -1
  103. package/dist/chunks/chunk-VOAKRJ4R.js +4 -0
  104. package/dist/chunks/{chunk-FP7ML72L.js → chunk-WU7RNAZD.js} +1 -1
  105. package/dist/chunks/chunk-WZC4TDDM.js +6 -0
  106. package/dist/chunks/chunk-X2TKJ7KR.js +11 -0
  107. package/dist/chunks/{chunk-H4QZ2P3Z.js → chunk-X5ND4H4P.js} +1 -1
  108. package/dist/chunks/{chunk-5A6CA5TM.js → chunk-Y3AOGNDT.js} +1 -1
  109. package/dist/chunks/chunk-Y6DGVTKM.js +6 -0
  110. package/dist/chunks/{chunk-LP7T32PW.js → chunk-YAEHSSR4.js} +1 -1
  111. package/dist/chunks/chunk-YWPBE5LP.js +4 -0
  112. package/dist/chunks/chunk-ZAVX7G2M.js +15 -0
  113. package/dist/chunks/chunk-ZD2M73XA.js +19 -0
  114. package/dist/chunks/chunk-ZD4O6NPV.js +4 -0
  115. package/dist/chunks/chunk-ZNAMETPQ.js +4 -0
  116. package/dist/chunks/chunk-ZY6N5LVQ.js +4 -0
  117. package/dist/chunks/chunk-ZYQ4TDTT.js +81 -0
  118. package/dist/chunks/cli-VB2N7HEK.js +55 -0
  119. package/dist/chunks/cloudflare-workers-ai-system-one-YKU742EC.js +4 -0
  120. package/dist/chunks/context-CI2FKEQE.js +4 -0
  121. package/dist/chunks/cost-CZRRSIUF.js +5 -0
  122. package/dist/chunks/dist-QCNQN6DY.js +4 -0
  123. package/dist/chunks/{easter-egg-3d-CZH7AYZ7.js → easter-egg-3d-XR5S2O3T.js} +1 -1
  124. package/dist/chunks/execution-repo-5TLV2NM4.js +4 -0
  125. package/dist/chunks/{executions-BN6OLLVM.js → executions-I3UUIGSL.js} +1 -1
  126. package/dist/chunks/file-Y5G56IUT.js +4 -0
  127. package/dist/chunks/github-copilot-BRU2SRRZ.js +4 -0
  128. package/dist/chunks/google-generative-ai-ZF5QEUZV.js +4 -0
  129. package/dist/chunks/google-vertex-4PJZZI3Y.js +4 -0
  130. package/dist/chunks/init-A6GY656J.js +4 -0
  131. package/dist/chunks/{install-cli-ABBD7DO5.js → install-cli-FALWKQYO.js} +1 -1
  132. package/dist/chunks/{interaction-ask-EE2UPR3Q.js → interaction-ask-O5HGF6CH.js} +1 -1
  133. package/dist/chunks/{interaction-plan-C446T2GZ.js → interaction-plan-JTVDN3BC.js} +1 -1
  134. package/dist/chunks/kimi-coding-ZCIBMDZ6.js +4 -0
  135. package/dist/chunks/{llama-cpp-classify-IA2F2H7A.js → llama-cpp-classify-NRUXAIGQ.js} +3 -3
  136. package/dist/chunks/local-client-stop-RS4AHNF4.js +4 -0
  137. package/dist/chunks/memory-cli-DIT4DQF3.js +11 -0
  138. package/dist/chunks/meta-JQH66YU7.js +4 -0
  139. package/dist/chunks/mistral-conversations-CXHOECUV.js +7 -0
  140. package/dist/chunks/model-resolver-GIBPYRKP.js +4 -0
  141. package/dist/chunks/monitor-Z2HKNY5E.js +4 -0
  142. package/dist/chunks/openai-codex-responses-U6DGMGDK.js +12 -0
  143. package/dist/chunks/openai-completions-PP4XLLOM.js +9 -0
  144. package/dist/chunks/{openai-decisions-P5UX7BWY.js → openai-decisions-JU6QQKEM.js} +1 -1
  145. package/dist/chunks/openai-responses-2SG757TL.js +6 -0
  146. package/dist/chunks/openrouter-images-32M7YZWC.js +4 -0
  147. package/dist/chunks/pi-messages-VSINMXN4.js +10 -0
  148. package/dist/chunks/radius-THYKWV4E.js +4 -0
  149. package/dist/chunks/remote-ops-2WBEFQ3E.js +14 -0
  150. package/dist/chunks/runner-5MKMRTIN.js +4 -0
  151. package/dist/chunks/runtime-DST3H5JP.js +4 -0
  152. package/dist/chunks/schedule-cli-V7Y2BBVY.js +4 -0
  153. package/dist/chunks/slack-R7SEJYMY.js +4 -0
  154. package/dist/chunks/start-ui-http-7K5JOLPU.js +43 -0
  155. package/dist/chunks/subagent-Z5IQ4L54.js +4 -0
  156. package/dist/chunks/tool-shims-YCXZWTST.js +4 -0
  157. package/dist/chunks/typesafe-system-one-M2DABJSZ.js +4 -0
  158. package/dist/chunks/ui-board-HQIE4RZG.js +5 -0
  159. package/dist/chunks/ui-decision-YBZDS4YW.js +4 -0
  160. package/dist/chunks/{ui-file-6PLXHSTB.js → ui-file-SRD4ILBS.js} +1 -1
  161. package/dist/chunks/ui-view-Z25MTZT7.js +4 -0
  162. package/dist/chunks/virtual-modules-H4DXPJZB.js +4 -0
  163. package/dist/chunks/{waitpoint-W5M3BE55.js → waitpoint-M6JZBSLT.js} +1 -1
  164. package/dist/chunks/workers-SQ2R32TK.js +4 -0
  165. package/dist/client-bundle/client.mjs +229 -62
  166. package/dist/client-bundle/manifest.json +2 -2
  167. package/dist/core/pi-sdk.js +1 -1
  168. package/dist/domain/auth/cc-auth-cli.js +1 -1
  169. package/dist/domain/mcp/bundled-server.js +1 -1
  170. package/dist/domain/mcp/feishu/client.js +1 -1
  171. package/dist/entry/app.js +138 -556
  172. package/dist/entry/browser-cli.js +1 -1
  173. package/dist/entry/cli.js +1 -1
  174. package/dist/entry/cortex-cli.js +1 -1
  175. package/dist/entry/daemon.js +3 -3
  176. package/dist/entry/hook-cli.js +1 -1
  177. package/dist/entry/production-app-bootstrap.js +1 -1
  178. package/dist/entry/production-evidence-export-cli.js +1 -1
  179. package/dist/entry/signal-cli.js +1 -1
  180. package/dist/tui/index.js +1 -1
  181. package/package.json +1 -1
  182. package/vendor/pi/CHANGELOG.md +330 -0
  183. package/vendor/pi/dist/codemode-worker.js +2 -0
  184. package/vendor/pi/dist/core/export-html/ansi-to-html.js +57 -20
  185. package/vendor/pi/dist/core/export-html/template.css +9 -0
  186. package/vendor/pi/dist/core/export-html/template.js +166 -46
  187. package/vendor/pi/dist/core/export-html/tool-renderer.js +5 -3
  188. package/vendor/pi/dist/core/extensions/loader.js +1 -1
  189. package/vendor/pi/dist/extensions/codemode/execute.js +15 -13
  190. package/vendor/pi/dist/modes/interactive/theme/theme.js +36 -23
  191. package/vendor/pi/dist/utils/image-resize-worker.js +1 -1
  192. package/vendor/pi/dist/utils/image-resize.js +1 -1
  193. package/vendor/pi/docs/cli.md +35 -12
  194. package/vendor/pi/docs/custom-provider.md +2 -0
  195. package/vendor/pi/docs/environment-variables.md +2 -0
  196. package/vendor/pi/docs/extensions.md +3192 -225
  197. package/vendor/pi/docs/keybindings.md +2 -2
  198. package/vendor/pi/docs/llama-cpp.md +27 -19
  199. package/vendor/pi/docs/mcp.md +6 -4
  200. package/vendor/pi/docs/message-types.md +1 -1
  201. package/vendor/pi/docs/models-configuration.md +9 -3
  202. package/vendor/pi/docs/models.md +2 -1
  203. package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +5 -5
  204. package/vendor/pi/docs/packages.md +24 -0
  205. package/vendor/pi/docs/prompt-templates.md +1 -1
  206. package/vendor/pi/docs/providers.md +4 -2
  207. package/vendor/pi/docs/quickstart.md +7 -3
  208. package/vendor/pi/docs/rpc-commands.md +1 -1
  209. package/vendor/pi/docs/rpc.md +4 -2
  210. package/vendor/pi/docs/sessions.md +17 -3
  211. package/vendor/pi/docs/settings.md +6 -5
  212. package/vendor/pi/docs/slash-commands.md +3 -2
  213. package/vendor/pi/docs/terminal-setup.md +3 -1
  214. package/vendor/pi/docs/tmux.md +6 -0
  215. package/vendor/pi/docs/tui.md +4 -0
  216. package/vendor/pi/docs/windows.md +27 -0
  217. package/vendor/pi/examples/extensions/README.md +2 -1
  218. package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +27 -31
  219. package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  220. package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
  221. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  222. package/vendor/pi/examples/extensions/debug-provider.ts +2 -2
  223. package/vendor/pi/examples/extensions/gondolin/index.ts +4 -7
  224. package/vendor/pi/examples/extensions/gondolin/package-lock.json +19 -29
  225. package/vendor/pi/examples/extensions/gondolin/package.json +2 -2
  226. package/vendor/pi/examples/extensions/plan-mode/index.ts +23 -13
  227. package/vendor/pi/examples/extensions/plan-mode/utils.ts +42 -16
  228. package/vendor/pi/examples/extensions/preset.ts +2 -0
  229. package/vendor/pi/examples/extensions/reload-runtime.ts +17 -5
  230. package/vendor/pi/examples/extensions/subagent/README.md +14 -11
  231. package/vendor/pi/examples/extensions/subagent/index.ts +392 -171
  232. package/vendor/pi/examples/extensions/todo.ts +7 -0
  233. package/vendor/pi/examples/extensions/tools.ts +2 -0
  234. package/vendor/pi/examples/extensions/with-deps/package-lock.json +2 -2
  235. package/vendor/pi/examples/extensions/with-deps/package.json +1 -1
  236. package/vendor/pi/examples/tsconfig.json +208 -0
  237. package/vendor/pi/package.json +15 -16
  238. package/vendor/pi/schemas/models.schema.json +66 -37
  239. package/vendor/pi/schemas/settings.schema.json +18 -1
  240. package/vendor/pi-ai/bedrock.js +1 -1
  241. package/vendor/pi-ai/oauth-load.js +1 -1
  242. package/web/dist/assets/{board-math-css-BgIyUG-C.js → board-math-css-DKX6FcUS.js} +1 -1
  243. package/web/dist/assets/index-D11wi0uG.js +540 -0
  244. package/web/dist/assets/index-JedYumhY.css +1 -0
  245. package/web/dist/assets/{index-C2eMpcuI.js → index-jl30Gy8P.js} +1 -1
  246. package/web/dist/index.html +2 -2
  247. package/dist/chunks/anthropic-messages-M732OMEE.js +0 -8
  248. package/dist/chunks/azure-openai-responses-RAKTV6JY.js +0 -4
  249. package/dist/chunks/bedrock-converse-stream-WNUGNZ27.js +0 -62
  250. package/dist/chunks/child-runner-MO5RT6FH.js +0 -4
  251. package/dist/chunks/chunk-3CPIMAYX.js +0 -30
  252. package/dist/chunks/chunk-3ORG56I5.js +0 -8
  253. package/dist/chunks/chunk-4EX2JJWB.js +0 -4
  254. package/dist/chunks/chunk-5DF5WJNM.js +0 -60
  255. package/dist/chunks/chunk-7GAYFN52.js +0 -18
  256. package/dist/chunks/chunk-AVXDF7AG.js +0 -4
  257. package/dist/chunks/chunk-BJGYGEZO.js +0 -6
  258. package/dist/chunks/chunk-BZDIAI5M.js +0 -125
  259. package/dist/chunks/chunk-CK3P345X.js +0 -133
  260. package/dist/chunks/chunk-CVC66CFV.js +0 -33
  261. package/dist/chunks/chunk-ETIBCA2S.js +0 -4
  262. package/dist/chunks/chunk-FF7UELTU.js +0 -4
  263. package/dist/chunks/chunk-FX6MOGLR.js +0 -11
  264. package/dist/chunks/chunk-G2V65UBA.js +0 -4
  265. package/dist/chunks/chunk-HGPBHTVD.js +0 -6
  266. package/dist/chunks/chunk-IYVZHGUQ.js +0 -5
  267. package/dist/chunks/chunk-JJDEQ6N2.js +0 -4
  268. package/dist/chunks/chunk-KDYEGGMW.js +0 -4
  269. package/dist/chunks/chunk-L6VCIGWS.js +0 -11
  270. package/dist/chunks/chunk-LACGULCN.js +0 -10
  271. package/dist/chunks/chunk-LAWOWPZX.js +0 -363
  272. package/dist/chunks/chunk-NNTQUHLO.js +0 -877
  273. package/dist/chunks/chunk-OE4KH3NJ.js +0 -4
  274. package/dist/chunks/chunk-OSEIQ7SS.js +0 -4
  275. package/dist/chunks/chunk-PZMGBKUR.js +0 -13
  276. package/dist/chunks/chunk-QBKCAIJG.js +0 -4
  277. package/dist/chunks/chunk-QMSSIDRQ.js +0 -70
  278. package/dist/chunks/chunk-QUUEQRIT.js +0 -4
  279. package/dist/chunks/chunk-RA6HKFBV.js +0 -4
  280. package/dist/chunks/chunk-RDW6FRF5.js +0 -4
  281. package/dist/chunks/chunk-RF4JLYBX.js +0 -6
  282. package/dist/chunks/chunk-SFX7V5O2.js +0 -10
  283. package/dist/chunks/chunk-SKHLZ6XY.js +0 -9
  284. package/dist/chunks/chunk-STCNHXPJ.js +0 -6
  285. package/dist/chunks/chunk-UT6DGZDO.js +0 -4
  286. package/dist/chunks/chunk-VBN2JSER.js +0 -5
  287. package/dist/chunks/chunk-VK5J556O.js +0 -4
  288. package/dist/chunks/chunk-VPVSKJGX.js +0 -6
  289. package/dist/chunks/chunk-VQUPKMDR.js +0 -4
  290. package/dist/chunks/chunk-WEZWKMYU.js +0 -4
  291. package/dist/chunks/chunk-XYSXL3KX.js +0 -4
  292. package/dist/chunks/chunk-Y3GFB5XM.js +0 -8
  293. package/dist/chunks/chunk-YAAKL3QS.js +0 -80
  294. package/dist/chunks/chunk-YB5LUJHS.js +0 -65
  295. package/dist/chunks/chunk-YKKEI5GI.js +0 -4
  296. package/dist/chunks/chunk-Z24SBRJK.js +0 -4
  297. package/dist/chunks/cli-5DBTRMHU.js +0 -53
  298. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +0 -4
  299. package/dist/chunks/context-GQKWKFRM.js +0 -4
  300. package/dist/chunks/cost-OOO32GLC.js +0 -5
  301. package/dist/chunks/dist-V5FRMUFH.js +0 -4
  302. package/dist/chunks/execution-repo-XXL4FXC6.js +0 -4
  303. package/dist/chunks/file-H572PL2Z.js +0 -4
  304. package/dist/chunks/github-copilot-HAI2DA62.js +0 -4
  305. package/dist/chunks/google-generative-ai-2G4ITOZL.js +0 -4
  306. package/dist/chunks/google-vertex-PACHCMRZ.js +0 -4
  307. package/dist/chunks/init-75F4V7SK.js +0 -4
  308. package/dist/chunks/kimi-coding-HMJRKCPA.js +0 -4
  309. package/dist/chunks/local-client-stop-5YOLXGYT.js +0 -4
  310. package/dist/chunks/memory-cli-5SSF6YJM.js +0 -11
  311. package/dist/chunks/meta-KY3LNFV2.js +0 -4
  312. package/dist/chunks/mistral-conversations-VHP63CDS.js +0 -7
  313. package/dist/chunks/model-resolver-FVJNZ6NA.js +0 -4
  314. package/dist/chunks/openai-codex-responses-EHJ4AZBE.js +0 -12
  315. package/dist/chunks/openai-completions-CRAGQFCE.js +0 -9
  316. package/dist/chunks/openai-responses-IZ22NVQ7.js +0 -6
  317. package/dist/chunks/openrouter-images-W2JAMSRH.js +0 -4
  318. package/dist/chunks/pi-messages-MJEEQU2R.js +0 -10
  319. package/dist/chunks/radius-ZM7ZRMXF.js +0 -4
  320. package/dist/chunks/remote-ops-O5CR4RGA.js +0 -14
  321. package/dist/chunks/runner-S6R3US24.js +0 -4
  322. package/dist/chunks/runtime-6YLTA2ZD.js +0 -4
  323. package/dist/chunks/schedule-cli-4T4YC5V5.js +0 -4
  324. package/dist/chunks/slack-2CGM4SMY.js +0 -4
  325. package/dist/chunks/start-ui-http-3D7QNHGB.js +0 -43
  326. package/dist/chunks/subagent-OZGUOV3J.js +0 -4
  327. package/dist/chunks/tool-shims-IA2WELXJ.js +0 -4
  328. package/dist/chunks/typesafe-system-one-6ULACYD4.js +0 -4
  329. package/dist/chunks/ui-board-H4INJD6C.js +0 -5
  330. package/dist/chunks/ui-decision-6HHNROIT.js +0 -4
  331. package/dist/chunks/ui-view-6MDU4GXY.js +0 -4
  332. package/dist/chunks/virtual-modules-OFI7QKYH.js +0 -4
  333. package/dist/chunks/workers-GTFP75MS.js +0 -4
  334. package/vendor/pi/examples/extensions/sandbox/index.ts +0 -321
  335. package/vendor/pi/examples/extensions/sandbox/package-lock.json +0 -92
  336. package/vendor/pi/examples/extensions/sandbox/package.json +0 -19
  337. package/web/dist/assets/index-9lyu2S6W.css +0 -1
  338. package/web/dist/assets/index-C-hpzey7.js +0 -532
@@ -1,10 +0,0 @@
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 nt,k as rt}from"./chunk-RDW6FRF5.js";import{c as et}from"./chunk-IKLTEWA3.js";import{f as st}from"./chunk-BDLKI2NT.js";import{L as it}from"./chunk-JJDEQ6N2.js";import{d as ot}from"./chunk-OE4KH3NJ.js";import{d as I,f as Q,i as N,j as Z,k as tt}from"./chunk-Z24SBRJK.js";import w from"node:fs";import g from"node:path";var at="cortex-production-benchmark-evidence-context/1",Nt=/^[a-f0-9]{64}$/;function u(t){return new Error(`Production benchmark evidence context invalid: ${t}`)}function H(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ct(t,e){let o=new Set(e);return e.every(n=>Object.hasOwn(t,n))&&Object.keys(t).every(n=>o.has(n))}function E(t,e){if(typeof t!="string"||t.length===0)throw u(e);return t}function v(t){if(t===null)return null;if(typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(v));if(!H(t))throw u("model_execution.model_alias_policy");let e=Object.entries(t).map(([o,n])=>[o,v(n)]);return Object.freeze(Object.fromEntries(e))}function vt(t){let e=["model_alias_policy","cli_name","cli_version","max_output_tokens"];if(!H(t)||!ct(t,e))throw u("model_execution");if(t.cli_name!=="claude"&&t.cli_name!=="pi")throw u("model_execution.cli_name");let o=t.max_output_tokens;if(o!==null&&(!Number.isInteger(o)||Number(o)<=0))throw u("model_execution.max_output_tokens");return Object.freeze({model_alias_policy:v(t.model_alias_policy),cli_name:t.cli_name,cli_version:E(t.cli_version,"model_execution.cli_version"),max_output_tokens:o})}function lt(t){let e=["schema_version","trial_id","root_run_id","bundle_manifest_hash","model_execution"];if(!H(t)||!ct(t,e))throw u("evidence context envelope");if(t.schema_version!==at)throw u("schema_version");let o=E(t.bundle_manifest_hash,"bundle_manifest_hash");if(!Nt.test(o))throw u("bundle_manifest_hash");return Object.freeze({schema_version:at,trial_id:E(t.trial_id,"trial_id"),root_run_id:E(t.root_run_id,"root_run_id"),bundle_manifest_hash:o,model_execution:vt(t.model_execution)})}import{createHash as Ht}from"node:crypto";function Ct(t){return JSON.stringify(t)}function Dt(t){return`[${Array.from({length:t.length},(o,n)=>C(t[n])??"null").join(",")}]`}function Ft(t,e){let o=C(t[e]);return o===void 0?null:`${JSON.stringify(e)}:${o}`}function Mt(t){return t!==null}function $t(t){return`{${Object.keys(t).sort().map(o=>Ft(t,o)).filter(Mt).join(",")}}`}function C(t){return t===null||typeof t!="object"?Ct(t):Array.isArray(t)?Dt(t):$t(t)}function d(t){let e=C(t);if(e===void 0)throw new TypeError("Value is not JSON-serializable");return Ht("sha256").update(e,"utf8").digest("hex")}function dt(t){return d({backend:t.backend,requested_model:t.requestedModel,model_alias_policy:t.modelAliasPolicy,provider_protocol:t.providerProtocol,configured_route_base_host:t.configuredRouteBaseHost,claude_cli_version:t.claudeCliVersion,cli_name:t.cliName,cli_version:t.cliVersion,reasoning_effort:t.reasoningEffort,max_output_tokens:t.maxOutputTokens??null})}function ut(t,e){return t<e?-1:t>e?1:0}function k(t){return d({system_prompt_sha256:t.systemPromptSha256,directive_sha256:t.directiveSha256,tools:[...t.tools].sort(),plugin_dirs:[...t.pluginDirs].sort((e,o)=>ut(e.path,o.path)),skills:[...t.skills].sort((e,o)=>ut(e.name,o.name)),mcp_composition:t.mcpComposition,mcp_tool_allowlist:t.mcpToolAllowlist?[...new Set(t.mcpToolAllowlist)].sort():void 0,hook_policy:t.hookPolicy})}import{createHash as zt}from"node:crypto";import p from"node:fs";import _ from"node:path";import*as f from"path";var Ve=3900*1e3,We=3600*1e3,Ke=f.join(tt,"projects"),Ye=f.join(I,"logs","sessions"),Xe=f.join(N,"mcp-config.json"),Qe=f.join(N,"mcp-config-empty.json"),Ze=f.join(I,".claude","settings.json"),to=["plan"],S="AskUserQuestion,Bash,Edit,EnterPlanMode,ExitPlanMode,Glob,Grep,Read,Skill,TaskStop,TodoWrite,WebFetch,WebSearch,Write",P="mcp__cortex-core__",eo=[`${P}cortex_plan_enter`,`${P}cortex_plan_exit`,`${P}cortex_ask_user`],oo=new Set(["AskUserQuestion","EnterPlanMode","ExitPlanMode"]),no=new Set(["Agent"]);function ro(){return ot.map(t=>P+t)}var ht=class extends Error{cancelled;constructor(){super("Cancelled by user"),this.cancelled=!0}};var Lt={"agent:pre-tool":"PreToolUse","agent:post-tool":"PostToolUse","agent:session-start":"SessionStart"};function Jt(t){return t.startsWith("cc:")?t.slice(3):Lt[t]??null}function mt(t){let o={type:"command",command:t.script!==void 0?`node ${et(t.script).join(" ")}`:t.command};return t.timeout!==void 0&&(o.timeout=t.timeout),o}function qt(t,e,o){let n=t[e]??[];t[e]===void 0&&(t[e]=n);let r=typeof o.matcher=="string"?o.matcher:void 0,i=n.at(-1);if(i&&i.matcher===r){i.hooks.push(mt(o.run));return}let l=[mt(o.run)];n.push(r===void 0?{hooks:l}:{matcher:r,hooks:l})}function Ut(t){let e=rt(nt(),{backend:"claude",availableTools:new Set(t)}),o=Object.create(null);for(let n of e){let r=Jt(n.event);r!==null&&qt(o,r,n)}return o}function ft(t){let e=(t||S).split(",").map(o=>o.trim());return Ut(e)}function D(t){return zt("sha256").update(t).digest("hex")}function pt(t,e=t){let o=[];for(let n of p.readdirSync(e,{withFileTypes:!0})){let r=_.join(e,n.name);n.isDirectory()&&o.push(...pt(t,r)),n.isFile()&&o.push({path:_.relative(t,r),type:"file",sha256:D(p.readFileSync(r))}),n.isSymbolicLink()&&o.push({path:_.relative(t,r),type:"symlink",target:p.readlinkSync(r)})}return o}function F(t,e){return t<e?-1:t>e?1:0}function M(t){if(!p.statSync(t).isDirectory())throw new Error(`Plugin path is not a directory: ${t}`);return d(pt(t).sort((e,o)=>F(e.path,o.path)))}function Bt(t,e){let o=t.map(n=>({path:n,content_sha256:M(n)}));return e&&o.push({path:"@plugin-capability",content_sha256:e}),o.sort((n,r)=>F(n.path,r.path))}function Gt(t){let e=_.join(t,"skills");return p.existsSync(e)?p.readdirSync(e,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>({name:o.name,content_sha256:M(_.join(e,o.name))})):[]}function Vt(t){return t.map(e=>({name:_.basename(e),content_sha256:M(e)}))}function Wt(t){let e=new Set;for(let o of t){if(e.has(o.name))throw new Error(`Duplicate plugin skill name: ${o.name}`);e.add(o.name)}return t.sort((o,n)=>F(o.name,n.name))}function Kt(t,e){return Wt([...t.flatMap(Gt),...Vt(e)])}function _t(t){return t.tools.rawClaude!==void 0?(t.tools.rawClaude||S).split(","):t.tools.canonical?.length?t.tools.canonical:S.split(",")}function Yt(t){if(t.flags.disableHooks===!0)return{};let e=_t(t).join(",");return ft(e)}function Xt(t){return t.prompt.append===void 0?D(t.prompt.system??""):d({system_prompt:t.prompt.system??"",append_system_prompt:t.prompt.append})}function O(t,e=""){let o=t.plugins.dirs??[],n={systemPromptSha256:Xt(t),directiveSha256:D(e),tools:_t(t),pluginDirs:Bt(o,t.plugins.fingerprint),skills:Kt(o,t.plugins.skillDirs??[]),mcpComposition:t.mcp.composition??"direct",hookPolicy:Yt(t)};return t.mcp.allowlist!==void 0&&(n.mcpToolAllowlist=t.mcp.allowlist),n}import{createHash as G}from"node:crypto";import h from"node:fs";import b from"node:path";import{createHash as Qt}from"node:crypto";import s from"node:fs";var wt="cortex-bench-journal/2",Zt=64*1024,J="direct",j=class extends Error{reason="trajectory_write_failed";constructor(e="Trajectory write failed",o){super(e,o),this.name="TrajectoryWriteFailedError"}},$=class extends Error{operation;constructor(e,o){super(`${e} failed`,{cause:o}),this.operation=e,this.name="FilesystemOperationError"}};function a(t,e){return new $(t,e)}function m(t,e){let o=e.length===1?e[0]:new AggregateError(e);return new j(`${t}: trajectory write failed`,{cause:o})}function St(t,e){throw e instanceof j?e:m(t,[e])}function xt(t){try{return Buffer.from(`${JSON.stringify(t)}
5
- `,"utf8")}catch(e){throw a("serialize",e)}}function te(t,e,o){try{return s.writeSync(t,e,o,e.length-o)}catch(n){throw a("write",n)}}function bt(t,e){let o=0;for(;o<e.length;){let n=te(t,e,o);if(n<=0)throw a("write",new Error("zero-byte write"));o+=n}}function yt(t){try{return s.fsyncSync(t),null}catch(e){return a("fsync",e)}}function q(t){try{return s.closeSync(t),null}catch(e){return a("close",e)}}function R(t,e){e&&t.push(e)}function gt(t){try{return t().toISOString()}catch(e){throw a("timestamp",e)}}function ee(t,e){return{schema_version:wt,type:"run_header",root_run_id:t.rootRunId,session_id:t.sessionId,agent_slot:t.agentSlot,seq:0,ts:e,resolved_cwd:t.resolvedCwd,canonical_instruction_sha256:t.canonicalInstructionSha256,model_visible_prompt_sha256:t.modelVisiblePromptSha256,system_prompt_sha256:t.systemPromptSha256,tool_manifest_sha256:t.toolManifestSha256,plugin_manifest_sha256:t.pluginManifestSha256,model_execution_identity_hash:t.modelExecutionIdentityHash,role_tool_surface_hash:t.roleToolSurfaceHash,bundle_manifest_hash:t.bundleManifestHash}}function oe(t,e,o,n){return{schema_version:wt,type:"event",root_run_id:e.rootRunId,session_id:t.sessionId,agent_slot:t.agentSlot,seq:o,ts:n,backend:t.backend,provider:t.provider,requested_model:t.requestedModel,reported_model:t.reportedModel,model_execution_identity_hash:e.modelExecutionIdentityHash,role_tool_surface_hash:e.roleToolSurfaceHash,bundle_manifest_hash:e.bundleManifestHash,event:t.event}}var L=class{path;identity;now;fd;nextSeq=1;count=0;constructor(e,o,n,r){this.path=e,this.identity=n,this.now=r,this.fd=o}get eventCount(){return this.count}writeEvent(e){let o;try{let n=this.requireOpenFd();o=oe(e,this.identity,this.nextSeq,gt(this.now)),bt(n,xt(o))}catch(n){St("event write",n)}return this.nextSeq+=1,this.count+=1,o}sha256(){let e=this.fd===null?null:yt(this.fd);if(e)throw m("journal hash flush",[e]);return ae(this.path)}closeSync(){if(this.fd===null)return;let e=this.fd;this.fd=null;let o=[];if(R(o,yt(e)),R(o,q(e)),o.length>0)throw m("journal close",o)}requireOpenFd(){if(this.fd!==null)return this.fd;let e=a("write",new Error("journal is closed"));throw m("event write",[e])}};function ne(t){return{rootRunId:t.rootRunId,modelExecutionIdentityHash:t.modelExecutionIdentityHash,roleToolSurfaceHash:t.roleToolSurfaceHash,bundleManifestHash:t.bundleManifestHash}}function re(t){try{let e=s.constants.O_WRONLY|s.constants.O_CREAT|s.constants.O_EXCL|s.constants.O_APPEND;return s.openSync(t,e,384)}catch(e){throw a("open",e)}}function ie(t,e){let o=[e];throw R(o,q(t)),m("journal open",o)}function Et(t){let e;try{e=re(t.path)}catch(r){St("journal open",r)}let o=t.now??(()=>new Date),n=ee(t.header,gt(o));try{bt(e,xt(n))}catch(r){ie(e,r)}return new L(t.path,e,ne(t.header),o)}function se(t){let e=Qt("sha256"),o=Buffer.allocUnsafe(Zt);for(;;){let n=s.readSync(t,o,0,o.length,null);if(n===0)return e.digest("hex");e.update(o.subarray(0,n))}}function ae(t){let e;try{e=s.openSync(t,"r")}catch(r){throw m("journal hash",[a("open",r)])}let o=null,n=[];try{o=se(e)}catch(r){n.push(a("read",r))}if(R(n,q(e)),n.length>0)throw m("journal hash",n);return o}var jt="cortex-production-attempt-journal/1",ce=/^[a-f0-9]{64}$/,kt=["schema_version","attempt_id","execution_id","journal_path","journal_sha256","event_count","closed_at"],y=null,x=null;function le(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ue(t){let e=new Set(kt);return kt.every(o=>Object.hasOwn(t,o))&&Object.keys(t).every(o=>e.has(o))}function T(t){return typeof t=="string"&&t.length>0}function de(t){return ue(t)&&t.schema_version===jt&&T(t.attempt_id)&&T(t.execution_id)&&T(t.journal_path)&&b.isAbsolute(t.journal_path)&&typeof t.journal_sha256=="string"&&ce.test(t.journal_sha256)&&Number.isInteger(t.event_count)&&Number(t.event_count)>=0&&T(t.closed_at)&&!Number.isNaN(Date.parse(t.closed_at))}function he(t,e){let o;try{o=JSON.parse(t)}catch{throw new Error(`Production attempt journal store malformed at line ${e}`)}if(!le(o)||!de(o))throw new Error(`Production attempt journal store invalid at line ${e}`);return o}function me(t){let e=h.readFileSync(t);if(e.length===0||e.at(-1)!==10)throw new Error(`Production attempt journal is empty or incomplete: ${t}`);let n=e.toString("utf8").trimEnd().split(`
6
- `).map((r,i)=>{try{return JSON.parse(r)}catch{throw new Error(`Production attempt journal malformed at ${t}:${i+1}`)}});if(n[0]?.type!=="run_header")throw new Error(`Production attempt journal header missing: ${t}`);return{sha256:G("sha256").update(e).digest("hex"),eventCount:n.slice(1).filter(r=>r.type==="event").length}}function Pt(t){let e=me(t.journal_path);if(e.sha256!==t.journal_sha256)throw new Error(`Production attempt journal digest mismatch: ${t.execution_id}`);if(e.eventCount!==t.event_count)throw new Error(`Production attempt journal event count mismatch: ${t.execution_id}`)}function U(t,e){return JSON.stringify(t)===JSON.stringify(e)}var z=class{filePath;byExecution=new Map;byAttempt=new Map;constructor(e){this.filePath=e,this.load()}load(){let e;try{e=h.readFileSync(this.filePath,"utf8")}catch(o){if(o.code==="ENOENT")return;throw o}e.split(`
7
- `).filter(Boolean).forEach((o,n)=>{let r=he(o,n+1);Pt(r),this.remember(r)})}remember(e){let o=this.byExecution.get(e.execution_id),n=this.byAttempt.get(e.attempt_id);if(o&&!U(o,e)||n&&!U(n,e))throw new Error(`Production attempt journal identity collision: ${e.execution_id}`);if(o)return o;let r=Object.freeze({...e});return this.byExecution.set(e.execution_id,r),this.byAttempt.set(e.attempt_id,r),r}get(e){return this.byExecution.get(e)??null}append(e){let o=this.get(e.execution_id);if(o){if(!U(o,e))throw new Error(`Production attempt journal changed for execution ${e.execution_id}`);return o}Pt(e),h.mkdirSync(b.dirname(this.filePath),{recursive:!0,mode:448});let n=h.openSync(this.filePath,"a",384);try{h.writeFileSync(n,`${JSON.stringify(e)}
8
- `,"utf8"),h.fsyncSync(n)}finally{h.closeSync(n)}return this.remember(e)}};function fe(t){return`${G("sha256").update(t.attempt_id).digest("hex")}.ndjson`}function Ot(t){return G("sha256").update(t,"utf8").digest("hex")}function pe(t){let e=O(t.spec,t.canonicalInstruction);if(k(e)!==t.identity.role_tool_surface_hash)throw new Error("Production attempt journal role identity drifted before open");return{canonicalInstructionSha256:Ot(t.canonicalInstruction),modelVisiblePromptSha256:Ot(t.message),systemPromptSha256:e.systemPromptSha256,toolManifestSha256:d(e.tools),pluginManifestSha256:d({plugin_dirs:e.pluginDirs,skills:e.skills})}}function _e(t){let{identity:e,spec:o}=t;return{rootRunId:e.root_run_id,sessionId:e.session_id,agentSlot:J,resolvedCwd:Q(o.cwd),...pe(t),modelExecutionIdentityHash:e.model_execution_identity_hash,roleToolSurfaceHash:e.role_tool_surface_hash,bundleManifestHash:e.bundle_manifest_hash}}function ye(t){if(t.type!=="tool_result"||!t.images)return t;let{images:e,...o}=t;return o}function we(t){return"model"in t&&typeof t.model=="string"&&t.model.length>0?t.model:null}var B=class{identity;journal;repo;closed=!1;writeFailure=null;constructor(e,o,n){this.identity=e,this.journal=o,this.repo=n}onEvent(e){try{this.journal.writeEvent({sessionId:this.identity.session_id,agentSlot:J,backend:this.identity.backend,provider:this.identity.provider,requestedModel:this.identity.requested_model,reportedModel:we(e),event:ye(e)})}catch(o){throw this.writeFailure??=o,o}}onClose(){if(!this.closed){if(this.closed=!0,this.journal.closeSync(),this.writeFailure)throw this.writeFailure;this.repo.append(Object.freeze({schema_version:jt,attempt_id:this.identity.attempt_id,execution_id:this.identity.execution_id,journal_path:b.resolve(this.journal.path),journal_sha256:this.journal.sha256(),event_count:this.journal.eventCount,closed_at:new Date().toISOString()}))}}};function Rt(t){x=b.resolve(t.journalDir),y=new z(t.storePath)}function V(){y=null,x=null}function Ro(t){if(!y||!x)throw new Error("Production attempt journal store is not initialized");if(y.get(t.identity.execution_id))throw new Error(`Production attempt journal already exists for execution ${t.identity.execution_id}`);h.mkdirSync(x,{recursive:!0,mode:448});let e=Et({path:b.join(x,fe(t.identity)),header:_e(t)});return new B(t.identity,e,y)}function To(t){return y?.get(t)??null}var X="cortex-production-attempt-identity/5",Se=/^[a-f0-9]{64}$/,xe=g.join(Z,"benchmark-attempt-identities.jsonl"),be=["schema_version","trial_id","root_run_id","attempt_id","root_attempt_id","spawn_parent_attempt_id","execution_id","session_id","thinking","mode","backend","provider","requested_model","model_execution_identity_hash","role_tool_surface_hash","bundle_manifest_hash","frozen_at"],c=null;function ge(t){return new Error(`Production benchmark evidence context invalid: ${t}`)}function Tt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ee(t,e){let o=new Set(e);return e.every(n=>Object.hasOwn(t,n))&&Object.keys(t).every(n=>o.has(n))}function At(t,e){if(typeof t!="string"||t.length===0)throw ge(e);return t}function ke(t){return t===null||typeof t=="string"&&t.length>0}function Pe(t){let e=["trial_id","root_run_id","attempt_id","root_attempt_id","execution_id","session_id","mode","requested_model","model_execution_identity_hash","role_tool_surface_hash","bundle_manifest_hash","frozen_at"],o=["spawn_parent_attempt_id","provider","thinking"],n=[t.model_execution_identity_hash,t.role_tool_surface_hash,t.bundle_manifest_hash];return Ee(t,be)&&t.schema_version===X&&e.every(r=>typeof t[r]=="string"&&String(t[r]).length>0)&&o.every(r=>ke(t[r]))&&(t.backend==="claude"||t.backend==="pi")&&n.every(r=>typeof r=="string"&&Se.test(r))}function Oe(t,e){let o;try{o=JSON.parse(t)}catch{throw new Error(`Production attempt identity store malformed at line ${e}`)}if(Tt(o)&&typeof o.schema_version=="string"&&o.schema_version!==X)return null;if(!Tt(o)||!Pe(o))throw new Error(`Production attempt identity store invalid at line ${e}`);return o}function je(t,e){return JSON.stringify(t)===JSON.stringify(e)}function W(t,e){return t.trial_id===e.trial_id&&t.root_run_id===e.root_run_id}var K=class{filePath;byExecution=new Map;byAttempt=new Map;ordered=[];constructor(e){this.filePath=e,this.load()}load(){let e;try{e=w.readFileSync(this.filePath,"utf8")}catch(o){if(o.code==="ENOENT")return;throw o}e.split(`
9
- `).filter(Boolean).forEach((o,n)=>{let r=Oe(o,n+1);r&&this.remember(r)})}latestSessionAttempt(e){for(let o=this.ordered.length-1;o>=0;o-=1){let n=this.ordered[o];if(W(n,e)&&n.session_id===e.session_id)return n}return null}assertRunSession(e){let o=this.ordered.find(n=>W(n,e));if(o&&o.session_id!==e.session_id)throw new Error("Production attempt identity cross-run session collision")}resolveRootAttemptId(e,o){return this.assertRunSession(e),this.latestSessionAttempt(e)?.root_attempt_id??o}resolveSpawnParentAttemptId(e){return this.assertRunSession(e),this.latestSessionAttempt(e)?.attempt_id??null}assertTopology(e){if(e.attempt_id!==`execution-${e.execution_id}`)throw new Error("Production attempt identity collision between execution and attempt");if(e.spawn_parent_attempt_id===e.attempt_id)throw new Error("Production attempt identity cannot self-link");let o=this.resolveRootAttemptId(e,e.attempt_id),n=this.resolveSpawnParentAttemptId(e);if(e.root_attempt_id!==o||e.spawn_parent_attempt_id!==n)throw new Error("Production attempt spawn topology is invalid")}remember(e){if(this.byExecution.has(e.execution_id)||this.byAttempt.has(e.attempt_id))throw new Error(`Production attempt identity collision: ${e.execution_id}`);this.assertTopology(e);let o=Object.freeze({...e});return this.byExecution.set(e.execution_id,o),this.byAttempt.set(e.attempt_id,o),this.ordered.push(o),o}get(e){return this.byExecution.get(e)??null}list(e){let o=At(e.trialId,"trial identity"),n=At(e.rootRunId,"root run identity"),r=this.ordered.filter(i=>i.trial_id===o&&i.root_run_id===n);if(r.length===0)throw new Error(`No production attempts found for ${o}/${n}`);return Object.freeze([...r])}firstRootAttempt(e){return this.ordered.find(o=>W(o,e))??null}append(e){let o=this.get(e.execution_id);if(o){if(!je(o,e))throw new Error(`Production attempt identity changed for execution ${e.execution_id}`);return o}this.assertTopology(e),w.mkdirSync(g.dirname(this.filePath),{recursive:!0,mode:448});let n=w.openSync(this.filePath,"a",384);try{w.writeFileSync(n,`${JSON.stringify(e)}
10
- `,"utf8"),w.fsyncSync(n)}finally{w.closeSync(n)}return this.remember(e)}};function Re(t){return t.configurationRevision?.()??null}function $o(t={}){c=null,V();let e=t.storePath??xe,o=g.dirname(e);try{let n=new K(e);Rt({journalDir:g.join(o,"benchmark-attempt-journals"),storePath:g.join(o,"benchmark-attempt-journals.jsonl")}),c={repo:n,revision:Re(t),configurationRevision:t.configurationRevision}}catch(n){throw V(),n}}function Te(t){let e=t.configurationRevision?.()??null;if(JSON.stringify(e)!==JSON.stringify(t.revision))throw new Error("Production benchmark configuration hot-reload drift detected")}function Y(t,e){if(typeof t!="string"||t.length===0)throw new Error(`Production benchmark attempt is missing ${e}`);return t}var It=Object.freeze({deepseek:"https://api.deepseek.com","openai-codex":"https://chatgpt.com/backend-api"});function Ae(t){if(!t)return null;let e=it.findPi(t)?.baseUrl;return e||(Object.hasOwn(It,t)?It[t]:null)}function Ie(t,e){let o=e==="pi"?Ae(t.model.provider):t.env.sets?.ANTHROPIC_BASE_URL??t.route.anthropicBaseUrl;if(!o)return null;try{return new URL(o).host}catch{throw new Error(`Production benchmark resolved route is invalid: ${o}`)}}function Ne(t,e){if(t.model.id!==e.model)throw new Error("Production benchmark resolved model drifted before adapter spawn");if((t.model.thinking??null)!==e.thinking)throw new Error("Production benchmark resolved thinking drifted before adapter spawn");if(e.backend==="pi"&&(t.model.provider??null)!==e.provider)throw new Error("Production benchmark resolved provider drifted before adapter spawn")}function ve(t,e){let o=t.selection;if(!o)throw new Error("Production benchmark attempt is missing selection");if(o.backend!==e.model_execution.cli_name||o.backend!==t.adapterBackend)throw new Error("Production benchmark backend differs from injected CLI identity");return Ne(t.spec,o),o}function He(t,e){let o=e.model_execution.max_output_tokens,n=t.model.benchmarkMaxOutputTokens??null;if(n!==o)throw new Error("Production benchmark max output token identity drifted");return n}function Ce(t,e,o,n,r){let i=Y(o,"execution identity"),l=`execution-${i}`,A={trial_id:n.trial_id,root_run_id:n.root_run_id,session_id:Y(e.session.sessionId,"session identity")};return{attempt_id:l,root_attempt_id:r?.root_attempt_id??t.repo.resolveRootAttemptId(A,l),spawn_parent_attempt_id:r?.spawn_parent_attempt_id??t.repo.resolveSpawnParentAttemptId(A),execution_id:i,session_id:A.session_id}}function De(t,e,o){let n=t.model_execution;return dt({backend:o.backend,requestedModel:o.model,modelAliasPolicy:n.model_alias_policy,providerProtocol:o.provider,configuredRouteBaseHost:Ie(e,o.backend),claudeCliVersion:o.backend==="claude"?n.cli_version:null,cliName:n.cli_name,cliVersion:n.cli_version,reasoningEffort:o.thinking,maxOutputTokens:He(e,t)})}function Fe(t,e){let o=ve(e,t),n=typeof e.request.benchmark?.identityDirective=="string"?e.request.benchmark.identityDirective:"",r=O(e.spec,n);return{thinking:o.thinking,mode:st(o),backend:o.backend,provider:o.provider,requested_model:o.model,model_execution_identity_hash:De(t,e.spec,o),role_tool_surface_hash:k(r)}}function Me(t,e,o,n){return{schema_version:X,trial_id:o.trial_id,root_run_id:o.root_run_id,...Ce(t,e.request,e.executionId,o,n),...Fe(o,e),bundle_manifest_hash:o.bundle_manifest_hash,frozen_at:new Date().toISOString()}}function $e(t,e){let o=t.firstRootAttempt(e);if(!o)return;if(["trial_id","root_run_id","bundle_manifest_hash","thinking","mode","backend","provider","requested_model","model_execution_identity_hash"].some(r=>o[r]!==e[r]))throw new Error("Production benchmark immutable root identity baseline drifted");if(o.role_tool_surface_hash!==e.role_tool_surface_hash)throw new Error("Production benchmark immutable role tool baseline drifted")}function Lo(t){let e=t.request.benchmark?.evidenceContext??null;if(e==null)return null;if(!c)throw new Error("Production benchmark identity store is not initialized");Te(c);let o=lt(e),n=Y(t.executionId,"execution identity"),r=c.repo.get(n),i=Me(c,t,o,r),l=r?{...i,frozen_at:r.frozen_at}:i;return $e(c.repo,l),c.repo.append(l)}function Le(){if(!c)throw new Error("Production benchmark identity store is not initialized");return c.repo}function Jo(t){return Le().list(t)}export{Ve as a,We as b,Ke as c,Ye as d,Xe as e,Qe as f,Ze as g,to as h,S as i,eo as j,oo as k,no as l,ro as m,ht as n,Jt as o,ft as p,lt as q,J as r,Ro as s,To as t,$o as u,Lo as v,Jo as w};
@@ -1,9 +0,0 @@
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{c as h,e as C}from"./chunk-WHC7AYZD.js";var p=h(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Allow=r.ALL=r.COLLECTION=r.ATOM=r.SPECIAL=r.INF=r._INFINITY=r.INFINITY=r.NAN=r.BOOL=r.NULL=r.OBJ=r.ARR=r.NUM=r.STR=void 0;r.STR=1;r.NUM=2;r.ARR=4;r.OBJ=8;r.NULL=16;r.BOOL=32;r.NAN=64;r.INFINITY=128;r._INFINITY=256;r.INF=r.INFINITY|r._INFINITY;r.SPECIAL=r.NULL|r.BOOL|r.INF|r.NAN;r.ATOM=r.STR|r.NUM|r.SPECIAL;r.COLLECTION=r.ARR|r.OBJ;r.ALL=r.ATOM|r.COLLECTION;r.Allow={STR:r.STR,NUM:r.NUM,ARR:r.ARR,OBJ:r.OBJ,NULL:r.NULL,BOOL:r.BOOL,NAN:r.NAN,INFINITY:r.INFINITY,_INFINITY:r._INFINITY,INF:r.INF,SPECIAL:r.SPECIAL,ATOM:r.ATOM,COLLECTION:r.COLLECTION,ALL:r.ALL};r.default=r.Allow});var y=h(a=>{"use strict";var E=a&&a.__createBinding||(Object.create?(function(t,n,u,e){e===void 0&&(e=u);var i=Object.getOwnPropertyDescriptor(n,u);(!i||("get"in i?!n.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return n[u]}}),Object.defineProperty(t,e,i)}):(function(t,n,u,e){e===void 0&&(e=u),t[e]=n[u]})),R=a&&a.__exportStar||function(t,n){for(var u in t)u!=="default"&&!Object.prototype.hasOwnProperty.call(n,u)&&E(n,t,u)};Object.defineProperty(a,"__esModule",{value:!0});a.Allow=a.MalformedJSON=a.PartialJSON=a.parseJSON=a.parse=void 0;var c=p();Object.defineProperty(a,"Allow",{enumerable:!0,get:function(){return c.Allow}});R(p(),a);var I=class extends Error{};a.PartialJSON=I;var A=class extends Error{};a.MalformedJSON=A;function L(t,n=c.Allow.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return B(t.trim(),n)}a.parseJSON=L;var B=(t,n)=>{let u=t.length,e=0,i=s=>{throw new I(`${s} at position ${e}`)},N=s=>{throw new A(`${s} at position ${e}`)},o=()=>(O(),e>=u&&i("Unexpected end of input"),t[e]==='"'?d():t[e]==="{"?J():t[e]==="["?m():t.substring(e,e+4)==="null"||c.Allow.NULL&n&&u-e<4&&"null".startsWith(t.substring(e))?(e+=4,null):t.substring(e,e+4)==="true"||c.Allow.BOOL&n&&u-e<4&&"true".startsWith(t.substring(e))?(e+=4,!0):t.substring(e,e+5)==="false"||c.Allow.BOOL&n&&u-e<5&&"false".startsWith(t.substring(e))?(e+=5,!1):t.substring(e,e+8)==="Infinity"||c.Allow.INFINITY&n&&u-e<8&&"Infinity".startsWith(t.substring(e))?(e+=8,1/0):t.substring(e,e+9)==="-Infinity"||c.Allow._INFINITY&n&&1<u-e&&u-e<9&&"-Infinity".startsWith(t.substring(e))?(e+=9,-1/0):t.substring(e,e+3)==="NaN"||c.Allow.NAN&n&&u-e<3&&"NaN".startsWith(t.substring(e))?(e+=3,NaN):_()),d=()=>{let s=e,f=!1;for(e++;e<u&&(t[e]!=='"'||f&&t[e-1]==="\\");)f=t[e]==="\\"?!f:!1,e++;if(t.charAt(e)=='"')try{return JSON.parse(t.substring(s,++e-Number(f)))}catch(l){N(String(l))}else if(c.Allow.STR&n)try{return JSON.parse(t.substring(s,e-Number(f))+'"')}catch{return JSON.parse(t.substring(s,t.lastIndexOf("\\"))+'"')}i("Unterminated string literal")},J=()=>{e++,O();let s={};try{for(;t[e]!=="}";){if(O(),e>=u&&c.Allow.OBJ&n)return s;let f=d();O(),e++;try{let l=o();s[f]=l}catch(l){if(c.Allow.OBJ&n)return s;throw l}O(),t[e]===","&&e++}}catch{if(c.Allow.OBJ&n)return s;i("Expected '}' at end of object")}return e++,s},m=()=>{e++;let s=[];try{for(;t[e]!=="]";)s.push(o()),O(),t[e]===","&&e++}catch{if(c.Allow.ARR&n)return s;i("Expected ']' at end of array")}return e++,s},_=()=>{if(e===0){t==="-"&&N("Not sure what '-' is");try{return JSON.parse(t)}catch(f){if(c.Allow.NUM&n)try{return JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}N(String(f))}}let s=e;for(t[e]==="-"&&e++;t[e]&&",]}".indexOf(t[e])===-1;)e++;e==u&&!(c.Allow.NUM&n)&&i("Unterminated number literal");try{return JSON.parse(t.substring(s,e))}catch{t.substring(s,e)==="-"&&i("Not sure what '-' is");try{return JSON.parse(t.substring(s,t.lastIndexOf("e")))}catch(l){N(String(l))}}},O=()=>{for(;e<u&&`
5
- \r `.includes(t[e]);)e++};return o()},F=L;a.parse=F});var b=C(y(),1),P=new Set(['"',"\\","/","b","f","n","r","t"]);function M(t){let n=t.codePointAt(0);return n!==void 0&&n>=0&&n<=31}function x(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
6
- `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function w(t){let n="",u=!1;for(let e=0;e<t.length;e++){let i=t[e];if(!u){n+=i,i==='"'&&(u=!0);continue}if(i==='"'){n+=i,u=!1;continue}if(i==="\\"){let N=t[e+1];if(N===void 0){n+="\\\\";continue}if(N==="u"){let o=t.slice(e+2,e+6);if(/^[0-9a-fA-F]{4}$/.test(o)){n+=`\\u${o}`,e+=5;continue}}if(P.has(N)){n+=`\\${N}`,e+=1;continue}n+="\\\\";continue}n+=M(i)?x(i):i}return n}function T(t){try{return JSON.parse(t)}catch(n){let u=w(t);if(u!==t)return JSON.parse(u);throw n}}function $(t){if(!t?.trim())return{arguments:{}};try{let n=T(t);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Tool arguments must be a JSON object");return{arguments:n}}catch(n){return{arguments:{},argumentsError:`${n instanceof Error?n.message:String(n)}
7
-
8
- Received arguments:
9
- ${t}`}}}function v(t){if(!t||t.trim()==="")return{};try{return T(t)}catch{try{return(0,b.parse)(t)??{}}catch{try{return(0,b.parse)(w(t))??{}}catch{return{}}}}}export{w as a,T as b,$ as c,v as d};
@@ -1,6 +0,0 @@
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{c as $}from"./chunk-STUHNKQS.js";import{b as j}from"./chunk-TX46YMGI.js";import{a as A}from"./chunk-Q4UGYGU5.js";import{d as _}from"./chunk-AVXDF7AG.js";import{e as L}from"./chunk-VBN2JSER.js";import{i as I}from"./chunk-Z24SBRJK.js";import{readFileSync as de}from"node:fs";import fe from"node:path";var M=Math.floor(Number.MAX_SAFE_INTEGER/864e5);function x(e){return Number.isInteger(e)?e<1e3?"must be at least 1000 milliseconds":e>2147483647?"must be at most 2147483647 milliseconds":null:"must be an integer number of milliseconds"}var V=1024,k=131072;function ae(e){return Number.isInteger(e)?e<V?`must be at least ${V} tokens`:e>k?`must be at most ${k} tokens`:null:"must be a whole number of tokens"}var X=1e5,W=1e6;function le(e){return e===null?null:Number.isInteger(e)?e<X||e>W?`must be between ${X} and ${W} tokens`:null:"must be a whole number of tokens"}function ue(e){return Number.isSafeInteger(e)?e<1?"must be at least 1 day":e>M?`must be at most ${M} days`:null:"must be a safe integer number of days"}var F=24;function ce(e){return Number.isFinite(e)?e<0||e>F?`must be between 0 and ${F} hours`:null:"must be a number of hours"}var d={turnNotify:{envVar:"CORTEX_TURN_NOTIFY",type:"boolean",default:!0,legacyParse:e=>!["0","false","off","no"].includes(e.trim().toLowerCase())},turnNotifyThresholdS:{envVar:"CORTEX_TURN_NOTIFY_THRESHOLD_S",type:"number",default:60,legacyParse:e=>{let t=Number(e.trim());return Number.isFinite(t)&&t>0?t:60}},notifyCompaction:{envVar:"CORTEX_NOTIFY_COMPACTION",type:"boolean",default:!0,legacyParse:e=>!["0","false","off","no"].includes(e.trim().toLowerCase())},showToolCalls:{envVar:"CORTEX_SHOW_TOOL_CALLS",type:"boolean",default:!1,legacyParse:e=>["1","true","yes","on"].includes(e.trim().toLowerCase())},statusNewqButton:{envVar:"CORTEX_STATUS_NEWQ_BUTTON",type:"boolean",default:!1,legacyParse:e=>["1","true","on","yes"].includes(e.trim().toLowerCase())},autoResume:{envVar:"CORTEX_AUTO_RESUME",type:"boolean",default:!0,legacyParse:e=>e!=="0"&&e!=="false"},accountFailover:{type:"boolean",default:!1},showThinking:{envVar:"CORTEX_SHOW_THINKING",type:"boolean",default:!0,legacyParse:e=>!["0","false","off","no"].includes(e.trim().toLowerCase())},streamDeltas:{envVar:"CORTEX_STREAM_DELTAS",type:"boolean",default:!0,legacyParse:e=>e!=="0"},bgContinuation:{envVar:"CORTEX_BG_CONTINUATION",type:"boolean",default:!0,legacyParse:e=>!["0","false","off","no"].includes(e.trim().toLowerCase())},eventLog:{envVar:"CORTEX_EVENT_LOG",type:"boolean",default:!0,legacyParse:e=>e!=="off"},diskMonitor:{envVar:"CORTEX_DISK_MONITOR",type:"boolean",default:!0,legacyParse:e=>!["0","false","off","no"].includes(e.trim().toLowerCase())},disableUserContext:{envVar:"CORTEX_DISABLE_USER_CONTEXT",type:"boolean",default:!1,legacyParse:e=>e==="1"},serverUpdateDisable:{envVar:"CORTEX_SERVER_UPDATE_DISABLE",type:"boolean",default:!1,legacyParse:e=>e==="1"},serverAutoUpdate:{type:"boolean",default:!0},clientHotReloadEnabled:{type:"boolean",default:!0},feishuSkillsInWeb:{type:"boolean",default:!1},teamEnabled:{envVar:"CORTEX_TEAM_ENABLED",type:"boolean",default:!0,legacyParse:e=>e==="1"},telemetryEnabled:{type:"boolean",default:!0},waitpointSweepMs:{envVar:"CORTEX_WAITPOINT_SWEEP_MS",type:"number",default:3e4,legacyParse:e=>{let t=Number.parseInt(e||"",10);return Number.isFinite(t)?t:3e4}},waitpointTtlMs:{envVar:"CORTEX_WAITPOINT_TTL_MS",type:"number",default:10080*60*1e3,legacyParse:e=>{let t=Number.parseInt(e||"",10);return Number.isFinite(t)&&t>0?t:10080*60*1e3}},waitpointMaxWakesPerHour:{envVar:"CORTEX_WAITPOINT_MAX_WAKES_PER_HOUR",type:"number",default:12,legacyParse:e=>{let t=Number.parseInt(e||"",10);return Number.isFinite(t)&&t>0?t:12}},injectWaitMaxS:{envVar:"CORTEX_INJECT_WAIT_MAX_S",type:"number",default:600,legacyParse:e=>Number(e)},providerUsageCollectionEnabled:{type:"boolean",default:!0},providerUsageCollectionIntervalMs:{type:"number",default:300*1e3,validate:x},claudeWindowWarmupEnabled:{type:"boolean",default:!1},providerRateLimits:{type:"provider-rate-limits",default:{}},storeArchiveEnabled:{type:"boolean",default:!0},memoryIndexRegenEnabled:{type:"boolean",default:!0},memoryIndexRegenIntervalMs:{type:"number",default:1440*60*1e3,validate:x},sessionRetentionDays:{type:"number",default:90,validate:ue},piCompactReserveTokens:{envVar:"CORTEX_PI_COMPACT_RESERVE_TOKENS",type:"number",default:16384,legacyParse:e=>{let t=Number.parseInt(e.trim(),10);return Number.isFinite(t)?t:16384},validate:ae},maxContextTokens:{type:"number|null",default:null,validate:le},cacheKeepWarmHours:{type:"number",default:6,validate:ce},coldResumeClearToolResults:{type:"boolean",default:!0},uiCorsOrigins:{envVar:"CORTEX_UI_CORS_ORIGINS",type:"string[]",default:[],legacyParse:e=>e.split(",").map(t=>t.trim()).filter(Boolean)},adminChannel:{envVar:["SLACK_ADMIN_CHANNEL","CORTEX_ADMIN_CHANNEL"],type:"string|null",default:null,legacyParse:e=>e||null},feishuAdminChannel:{envVar:"FEISHU_ADMIN_CHANNEL",type:"string|null",default:null,legacyParse:e=>e||null}};var R=j;function Ge(e,t){return t&&t!==e?t:R}var c=L("settings"),w=fe.join(I,"settings.json"),E=Object.keys(d),be=new Set(["adminChannel","feishuAdminChannel"]),O=new Set,D=new Set,Y=new A,me=new Set(["__proto__","prototype","constructor"]),U=120,H=!1,v={},g=null,B=null,ye=null,y=null,f=!1,pe={boolean:e=>typeof e=="boolean",number:e=>typeof e=="number"&&Number.isFinite(e),"number|null":e=>e===null||typeof e=="number"&&Number.isFinite(e),"string[]":e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),"string|null":e=>e===null||typeof e=="string","provider-rate-limits":u};function u(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function h(e){let t=e.trim();return t.length===0?"provider keys must not be empty":t!==e?"provider keys must not have leading or trailing whitespace":t.length>U?`provider keys must be at most ${U} characters`:me.has(t)?`provider key "${t}" is reserved`:null}function z(e){return typeof e!="number"||!Number.isFinite(e)?"threshold must be a finite number":e<=0?"threshold must be greater than 0":e>1?"threshold must be at most 1":null}function S(e,t){if(typeof e!="string")return`${t} must be a string`;let n=e.trim();return n.length===0?`${t} must not be empty`:n!==e?`${t} must not have leading or trailing whitespace`:null}function J(e,t){if(!Object.hasOwn(e,"threshold"))return null;if(typeof e.enabled!="boolean")return`${t}.enabled must be a boolean`;let n=z(e.threshold);return n?`${t}.${n}`:null}function we(e,t){if(!u(e))return`${t} must be a plain object`;for(let r of Object.keys(e))if(!(r==="type"||r==="label"||r==="enabled"||r==="threshold"))return`${t} has unknown field "${r}"`;let n=S(e.type,"type");if(n)return`${t}.${n}`;if(Object.hasOwn(e,"label")){let r=S(e.label,"label");if(r)return`${t}.${r}`}return typeof e.enabled!="boolean"?`${t}.enabled must be a boolean`:J(e,t)}function Ee(e,t){return`${e}\0${t??""}`}function q(e,t,n=`providerRateLimits.${t}.windows`){if(!Array.isArray(e))return`${n} must be an array`;let r=new Set;for(let[o,i]of e.entries()){let s=`${n}.${o}`,a=we(i,s);if(a)return a;let l=Ee(i.type,i.label);if(r.has(l))return`${s} duplicates an existing window identity`;r.add(l)}return null}function he(e,t){if(!u(e))return`providerRateLimits.${t}.accounts must be a plain object`;for(let[n,r]of Object.entries(e)){let o=`providerRateLimits.${t}.accounts.${n}`,i=h(n);if(i)return`${o}: ${i.replace("provider keys","account keys")}`;if(!u(r))return`${o} must be a plain object`;let s=Object.keys(r).find(l=>l!=="windows");if(s)return`${o} has unknown field "${s}"`;let a=q(r.windows,t,`${o}.windows`);if(a)return a}return null}function Te(e,t){if(!u(e))return`providerRateLimits.${t} must be a plain object`;for(let r of Object.keys(e))if(!(r==="enabled"||r==="threshold"||r==="windows"||r==="accounts"))return`providerRateLimits.${t} has unknown field "${r}"`;if(Object.hasOwn(e,"enabled")&&typeof e.enabled!="boolean")return`providerRateLimits.${t}.enabled must be a boolean`;let n=J(e,`providerRateLimits.${t}`);if(n)return n;if(Object.hasOwn(e,"windows")){let r=q(e.windows,t);if(r)return r}if(Object.hasOwn(e,"accounts")){let r=he(e.accounts,t);if(r)return r}return typeof e.enabled=="boolean"||Object.hasOwn(e,"windows")||Object.hasOwn(e,"accounts")?null:`providerRateLimits.${t} must declare enabled, windows or accounts`}function Q(e){if(!u(e))return"must be a plain object";for(let[t,n]of Object.entries(e)){let r=h(t);if(r)return r;let o=Te(n,t);if(o)return o}return null}function Z(e,t){let n=S(e,t);if(n)throw new TypeError(n);return e.trim()}function _e(e){if(e!=null)return Z(e,"label")}function Oe(e){let t=e.provider.trim(),n=h(t);if(n)throw new TypeError(n);if(typeof e.enabled!="boolean")throw new TypeError("enabled must be a boolean");if(e.threshold!==null){let s=z(e.threshold);if(s)throw new TypeError(s)}let r=e.windowType===void 0?void 0:Z(e.windowType,"type"),o=_e(e.windowLabel);if(o&&!r)throw new TypeError("windowLabel requires windowType");let i=ge(e.account);if(i&&!r)throw new TypeError("account requires windowType");return{provider:t,enabled:e.enabled,threshold:e.threshold,...r?{windowType:r,account:i??R}:{},...o?{windowLabel:o}:{}}}function ge(e){if(e==null)return;if(typeof e!="string")throw new TypeError("account must be a string");let t=h(e.trim());if(t)throw new TypeError(t.replace("provider keys","account keys"));return e.trim()}function ee(e){return{type:e.type,...e.label?{label:e.label}:{},enabled:e.enabled,...Object.hasOwn(e,"threshold")?{threshold:e.threshold}:{}}}function Se(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{windows:n.windows.map(ee)}]))}function C(e){return{...typeof e.enabled=="boolean"?{enabled:e.enabled}:{},...Object.hasOwn(e,"threshold")?{threshold:e.threshold}:{},...e.windows?{windows:e.windows.map(ee)}:{},...e.accounts?{accounts:Se(e.accounts)}:{}}}function te(e){let t=Q(e);if(t)throw new TypeError(t);return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,C(r)]))}function Ne(e){return Object.hasOwn(e,"providerRateLimits")?te(e.providerRateLimits):{}}function ne(e){if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("settings.json must contain a JSON object");for(let t of E){if(!Object.hasOwn(e,t))continue;let n=d[t];if(!pe[n.type](e[t]))throw new TypeError(`settings.json key "${t}" must have type ${n.type}`);if(n.type==="provider-rate-limits"){let o=Q(e[t]);if(o)throw new TypeError(`settings.json key "${t}" ${o}`);continue}let r=n.validate?.(e[t]);if(r)throw new TypeError(`settings.json key "${t}" ${r}`)}}function T(){try{let e=JSON.parse(de(w,"utf8"));return ne(e),e}catch(e){if(e?.code==="ENOENT")return{};throw e}}function Ye(){T()}function Re(e,t){D.has(t)||(D.add(t),c.warn(`Deprecated env ${t} supplies settings.${e}; move it to settings.json`))}function ve(e,t){return e!=="providerRateLimits"?t[e]:te(t[e])}function re(e,t,n,r){let o=d[e];if(Object.hasOwn(t,e))return{key:e,value:ve(e,t),source:"file"};let i=o.envVar===void 0?[]:typeof o.envVar=="string"?[o.envVar]:o.envVar;for(let s of i){let a=n[s];if(!(a===void 0||be.has(e)&&a.length===0))return r&&Re(e,s),{key:e,value:o.legacyParse(a),source:"env"}}return{key:e,value:o.default,source:"default"}}function P(e,t=process.env){return ne(e),E.map(n=>re(n,e,t,!1))}function N(e){return Object.fromEntries(E.map(t=>{let n=re(t,e,process.env,!0);return[t,n.value]}))}function p(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((n,r)=>p(n,t[r]));if(u(e)&&u(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((o,i)=>o===r[i]&&p(e[o],t[o]))}return Object.is(e,t)}function Ce(e,t){return E.filter(n=>!p(e[n],t[n]))}function Pe(e,t){let n=Ce(e,t);if(n.length!==0)for(let r of O)try{r(n)}catch(o){c.error("Settings change callback failed:",o)}}function oe(e){return Object.fromEntries(e.map(t=>[t.key,t.value]))}function Ae(e,t){return P(e).map(n=>({key:n.key,value:t[n.key],source:n.source}))}function b(e,t,n=Ae(e,t)){let r=g;v=e,g=t,B=n,r&&Pe(r,t)}function ie(){y&&clearTimeout(y),y=setTimeout(()=>{y=null,Ie()},300)}function Ie(){if(f)return ie();try{let e=T();if(p(v,e))return;b(e,N(e)),c.info("Hot-reload: settings.json reloaded")}catch(e){c.error(`Hot-reload settings.json failed: ${e.message} \u2014 keeping previous settings`)}}function Le(){ye=$({label:"settings.json",filePath:w,onChange:ie,warn:e=>c.error(e),unref:!0})}function m(){if(!H){H=!0,Le();try{let e=T();b(e,N(e))}catch(e){c.error(`Load settings.json failed: ${e.message} \u2014 using env/default settings`),b({},N({}))}}}function Be(){return m(),g}function ze(){return m(),B}function Je(e){return m(),O.add(e),()=>O.delete(e)}function se(){try{return T()}catch(e){return c.error(`Update settings.json read failed: ${e.message} \u2014 using previous settings`),v}}function K(e,t){return e.type===t.windowType&&e.label===t.windowLabel}function $e(e){return{type:e.windowType,...e.windowLabel?{label:e.windowLabel}:{},enabled:e.enabled,...e.threshold!==null?{threshold:e.threshold}:{}}}function G(e){let t=C(e);t.windows?.length||delete t.windows;for(let[n,r]of Object.entries(t.accounts??{}))r.windows.length===0&&delete t.accounts[n];return t.accounts&&Object.keys(t.accounts).length===0&&delete t.accounts,t.enabled===void 0&&t.threshold===void 0&&!t.windows&&!t.accounts?null:t}function je(e){return e.enabled===!1||e.threshold!==void 0}function Me(e,t){let n=C(e??{});if(!t.windowType)return delete n.enabled,delete n.threshold,(!t.enabled||t.threshold!==null)&&(n.enabled=t.enabled),t.threshold!==null&&(n.threshold=t.threshold),G(n);let r=t.account??R,o=n.accounts??{},i=o[r]?.windows.filter(l=>!K(l,t))??[],s=je(n)||!!n.windows?.some(l=>K(l,t)),a=t.enabled&&t.threshold===null&&s;return(!t.enabled||t.threshold!==null||a)&&i.push($e(t)),o[r]={windows:i},n.accounts=o,G(n)}async function qe(e){m();let t={...process.env};await Y.run(async()=>{let n={...se(),...e},r=P(n,t),o=oe(r);f=!0;try{await _(w,`${JSON.stringify(n,null,2)}
5
- `),b(n,o,r)}finally{f=!1}})}async function Qe(e){m();let t={...process.env},n=Oe(e);return Y.run(async()=>{let r={...se()},o=Ne(r),i=Me(o[n.provider],n);i?o[n.provider]=i:delete o[n.provider],r.providerRateLimits=o;let s=P(r,t),a=oe(s);f=!0;try{await _(w,`${JSON.stringify(r,null,2)}
6
- `),b(r,a,s)}finally{f=!1}return n})}export{d as a,Ge as b,ne as c,Ye as d,Be as e,ze as f,Je as g,qe as h,Qe as i};
@@ -1,4 +0,0 @@
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{j as E,k as C}from"./chunk-ETIBCA2S.js";import{a as u,h as d}from"./chunk-OE4KH3NJ.js";import{i as p}from"./chunk-QUXPMNFQ.js";import*as O from"node:http";function T(o,n,e,t={},s=183e4){let c=e===void 0?null:JSON.stringify(e),f=new URL(n);return new Promise((h,_)=>{let i=O.request(m(o,f,c,t,s),l=>{let a=[];l.on("data",b=>a.push(Buffer.from(b))),l.on("end",()=>h({status:l.statusCode??0,body:S(Buffer.concat(a).toString("utf8"))}))});i.on("error",_),i.on("timeout",()=>i.destroy(new Error(`Loopback request timed out after ${s}ms`))),c!==null&&i.write(c),i.end()})}function m(o,n,e,t,s){return{hostname:n.hostname,port:n.port,path:`${n.pathname}${n.search}`,method:o,headers:e===null?t:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(e),...t},timeout:s}}function S(o){if(!o)return null;try{return JSON.parse(o)}catch{return{_raw:o}}}function r(o){return o===void 0||o===""?null:o}function L(o){let n=o.CORTEX_BACKEND,e=r(o.CORTEX_MODEL);return n!=="claude"&&n!=="pi"||!e?null:{backend:n,model:e,provider:n==="pi"?r(o.CORTEX_PROVIDER):null,thinking:r(o.CORTEX_THINKING),connection:r(o.CORTEX_CONNECTION)}}function M(o=process.env){return{channel:r(o.SLACK_CHANNEL)??r(o.FEISHU_CHANNEL),sessionId:r(o.CORTEX_SESSION_ID),selection:L(o),project:r(o.CORTEX_PROJECT),backend:r(o.CORTEX_BACKEND),claudeModel:r(o.CORTEX_CLAUDE_MODEL),subagentPiModels:C(o.CORTEX_SUBAGENT_PI_MODELS),subagentClaudeModels:E(o.CORTEX_SUBAGENT_CLAUDE_MODELS),scheduleTaskId:r(o.CORTEX_SCHEDULE_TASK_ID),callbackSource:r(o.CORTEX_CALLBACK_SOURCE),webhookBaseUrl:p(o,null),webhookToken:o.CORTEX_WEBHOOK_TOKEN||"",slackBotToken:r(o.SLACK_BOT_TOKEN),toolAllowlist:d(o[u])}}function R(o){return{"x-cortex-token":o.webhookToken}}function w(o){return o.sessionId?o.sessionId:o.channel?.startsWith("web:")?o.channel.slice(4):null}var I=async(o,n)=>{let{body:e}=await T("POST",`${o.webhookBaseUrl}/webhook/board`,{sessionId:n,action:"status"},R(o));if(!e?.success)throw new Error(e?.error||"board status failed");let t=e.data;return t?{id:t.id,title:t.title,dir:t.dir??null}:null};async function N(o,n=I){let e={channel:o.channel,sessionId:o.sessionId,model:o.selection?.model??null,thinking:o.selection?.thinking??null,connection:o.selection?.connection??null,project:o.project,backend:o.backend,scheduleTaskId:o.scheduleTaskId,callbackSource:o.callbackSource},t=w(o);if(t)try{e.board=await n(o,t)}catch{}return e}function D(o,n){o.tool("cortex_context","Get current session identity, backend, model, thinking, connection, project, bound board and trigger context.",{},{readOnlyHint:!0},async()=>{try{let e=await N(n),{channel:t,...s}=e;return{content:[{type:"text",text:JSON.stringify(s,null,2)}]}}catch(e){return{content:[{type:"text",text:`Failed to resolve context: ${e.message}`}],isError:!0}}})}export{T as a,M as b,R as c,w as d,N as e,D as f};
@@ -1,5 +0,0 @@
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{z as c}from"./chunk-Z24SBRJK.js";import o from"node:fs";import g from"node:path";function S(t=process.env){return t.DEBUG==="1"}function _(t=process.env){let e=Number(t.CORTEX_DEBUG_TOOL_WARNING_CHARS);return Number.isSafeInteger(e)&&e>0?e:1e4}function N(t,e=process.env){return t>_(e)}process.stderr.on("error",()=>{});process.stdout.on("error",()=>{});var d=14,m=100*1024*1024,p=2,i={consoleToStderr:!1,files:!0,console:!0};function k(t){let e=i;return i=t,()=>{i=e}}var D="",n=null,y="";function R(){let t=new Date;return[t.getFullYear(),String(t.getMonth()+1).padStart(2,"0"),String(t.getDate()).padStart(2,"0")].join("")}function T(){let t=R();return(t!==D||!n)&&(n?.end(),o.mkdirSync(c,{recursive:!0}),D=t,n=o.createWriteStream(g.join(c,`server-${t}.log`),{flags:"a"}),y!==t&&(y=t,O())),n.bytesWritten>=m&&(n.end(),n=h(t)),n}function h(t){let e=g.join(c,`server-${t}`);for(let r=p;r>=1;r--){let u=`${e}.${r}.log`,s=`${e}.${r+1}.log`;try{if(r===p)try{o.unlinkSync(s)}catch{}o.renameSync(u,s)}catch{}}try{o.renameSync(`${e}.log`,`${e}.1.log`)}catch{}return o.createWriteStream(`${e}.log`,{flags:"a"})}function O(){try{let t=Date.now()-d*864e5;for(let e of o.readdirSync(c)){let r=e.match(/^server-(\d{4})(\d{2})(\d{2})\.log$/);if(!r)continue;new Date(+r[1],+r[2]-1,+r[3]).getTime()<t&&o.unlinkSync(g.join(c,e))}}catch{}}function A(t){if(t instanceof Error)return t.stack||t.message;if(typeof t=="object"&&t!==null)try{return JSON.stringify(t)}catch{return String(t)}return String(t)}var a=null,l=!1;function C(t){a=t}function L(t,e){if(!(!a||l)){l=!0;try{a(t,e)}catch{}finally{l=!1}}}function $(t,e,r){if(i.consoleToStderr)return console.error(e,...r);if(t==="ERROR")return console.error(e,...r);if(t==="WARN")return console.warn(e,...r);if(t==="DEBUG")return console.debug(e,...r);console.log(e,...r)}function f(t,e,r){let u=new Date().toLocaleTimeString("en-GB",{hour12:!1}),s=`[${e} ${u}]`;if(i.console!==!1)try{$(t,s,r)}catch{}if(!i.files)return;let E=`${s} ${t} ${r.map(A).join(" ")}
5
- `;try{T().write(E)}catch{}}function U(t){return{info:(...e)=>f("INFO",t,e),warn:(...e)=>f("WARN",t,e),error:(...e)=>{f("ERROR",t,e),L(t,e)},debug:(...e)=>{S()&&f("DEBUG",t,e)}}}process.on("exit",()=>{n?.end()});export{S as a,N as b,k as c,C as d,U as e};
@@ -1,4 +0,0 @@
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 i}from"./chunk-VBN2JSER.js";import*as s from"node:os";import*as r from"node:path";var o=i("pi-sdk");var l="./core/model-resolver.js",a;function p(){return a??=import("./dist-V5FRMUFH.js"),a}var u="gpt-5.5",c="gpt-6.1-sol";function f(e){return e.openai===u?{...e,openai:c}:e}function P(e){return typeof e=="object"&&e!==null&&Object.values(e).every(t=>typeof t=="string")}async function h(e){try{let t=e??"file:///unused-bundled-entry.js",n=e?await import(new URL(l,t).href):await import("./model-resolver-FVJNZ6NA.js");if(P(n.defaultModelPerProvider))return f(n.defaultModelPerProvider);o.warn("PI default model table has an unexpected shape; using PI model order")}catch(t){o.warn(`PI default model table unavailable; using PI model order: ${t.message}`)}return{}}function g(){let e=Date.now();p().then(()=>o.info(`PI SDK preloaded in ${Date.now()-e}ms`)).catch(t=>o.warn(`PI SDK preload failed; the first PI session will surface the error: ${t.message}`))}function d(){return r.join(s.homedir(),".pi","agent")}function w(){return r.join(d(),"auth.json")}function A(){return r.join(d(),"models.json")}export{p as a,h as b,g as c,d,w as e,A as f};
@@ -1,6 +0,0 @@
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 g,c as _}from"./chunk-WHC7AYZD.js";var D=_((U,O)=>{O.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var S=_((B,d)=>{var E=g("fs"),h=g("path"),T=g("os"),I=g("crypto"),$=D(),m=$.version,A=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function j(e){let r={},n=e.toString();n=n.replace(/\r\n?/mg,`
5
- `);let s;for(;(s=A.exec(n))!=null;){let i=s[1],t=s[2]||"";t=t.trim();let o=t[0];t=t.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(t=t.replace(/\\n/g,`
6
- `),t=t.replace(/\\r/g,"\r")),r[i]=t}return r}function k(e){e=e||{};let r=w(e);e.path=r;let n=c.configDotenv(e);if(!n.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw o.code="MISSING_DATA",o}let s=V(e).split(","),i=s.length,t;for(let o=0;o<i;o++)try{let a=s[o].trim(),u=K(n,a);t=c.decrypt(u.ciphertext,u.key);break}catch(a){if(o+1>=i)throw a}return c.parse(t)}function x(e){console.log(`[dotenv@${m}][WARN] ${e}`)}function v(e){console.log(`[dotenv@${m}][DEBUG] ${e}`)}function b(e){console.log(`[dotenv@${m}] ${e}`)}function V(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function K(e,r){let n;try{n=new URL(r)}catch(a){if(a.code==="ERR_INVALID_URL"){let u=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw u.code="INVALID_DOTENV_KEY",u}throw a}let s=n.password;if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let t=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[t];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${t} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:s}}function w(e){let r=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let n of e.path)E.existsSync(n)&&(r=n.endsWith(".vault")?n:`${n}.vault`);else r=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else r=h.resolve(process.cwd(),".env.vault");return E.existsSync(r)?r:null}function N(e){return e[0]==="~"?h.join(T.homedir(),e.slice(1)):e}function Y(e){let r=!!(e&&e.debug),n=e&&"quiet"in e?e.quiet:!0;(r||!n)&&b("Loading env from encrypted .env.vault");let s=c._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),c.populate(i,s,e),{parsed:s}}function L(e){let r=h.resolve(process.cwd(),".env"),n="utf8",s=!!(e&&e.debug),i=e&&"quiet"in e?e.quiet:!0;e&&e.encoding?n=e.encoding:s&&v("No encoding is specified. UTF-8 is used by default");let t=[r];if(e&&e.path)if(!Array.isArray(e.path))t=[N(e.path)];else{t=[];for(let f of e.path)t.push(N(f))}let o,a={};for(let f of t)try{let l=c.parse(E.readFileSync(f,{encoding:n}));c.populate(a,l,e)}catch(l){s&&v(`Failed to load ${f} ${l.message}`),o=l}let u=process.env;if(e&&e.processEnv!=null&&(u=e.processEnv),c.populate(u,a,e),s||!i){let f=Object.keys(a).length,l=[];for(let y of t)try{let p=h.relative(process.cwd(),y);l.push(p)}catch(p){s&&v(`Failed to load ${y} ${p.message}`),o=p}b(`injecting env (${f}) from ${l.join(",")}`)}return o?{parsed:a,error:o}:{parsed:a}}function R(e){if(V(e).length===0)return c.configDotenv(e);let r=w(e);return r?c._configVault(e):(x(`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`),c.configDotenv(e))}function q(e,r){let n=Buffer.from(r.slice(-64),"hex"),s=Buffer.from(e,"base64"),i=s.subarray(0,12),t=s.subarray(-16);s=s.subarray(12,-16);try{let o=I.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(t),`${o.update(s)}${o.final()}`}catch(o){let a=o instanceof RangeError,u=o.message==="Invalid key length",f=o.message==="Unsupported state or unable to authenticate data";if(a||u){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(f){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw o}}function P(e,r,n={}){let s=!!(n&&n.debug),i=!!(n&&n.override);if(typeof r!="object"){let t=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw t.code="OBJECT_REQUIRED",t}for(let t of Object.keys(r))Object.prototype.hasOwnProperty.call(e,t)?(i===!0&&(e[t]=r[t]),s&&v(i===!0?`"${t}" is already defined and WAS overwritten`:`"${t}" is already defined and was NOT overwritten`)):e[t]=r[t]}var c={configDotenv:L,_configVault:Y,_parseVault:k,config:R,decrypt:q,parse:j,populate:P};d.exports.configDotenv=c.configDotenv;d.exports._configVault=c._configVault;d.exports._parseVault=c._parseVault;d.exports.config=c.config;d.exports.decrypt=c.decrypt;d.exports.parse=c.parse;d.exports.populate=c.populate;d.exports=c});export{S as a};
@@ -1,4 +0,0 @@
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 o={"anthropic-messages":{"chat:claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-fable-5.1":{id:"claude-fable-5.1",name:"Claude Fable 5.1",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:.25,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-5.5":{id:"claude-haiku-5.5",name:"Claude Haiku 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:1e5,input:.5,output:2.5,cacheRead:.05,cacheWrite:.625}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.2,cacheWrite:5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Claude Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.8-flash":{id:"gemini-3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.75,cacheRead:.075,cacheWrite:0},contextWindow:1e6,maxTokens:64e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-4-argon":{id:"gemini-4-argon",name:"Gemini 4 Argon",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:0},contextWindow:1048576,maxTokens:65536,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25,tiers:[{inputTokensAbove:2e5,input:.4,output:1.8,cacheRead:.04,cacheWrite:.5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:.4,cacheWrite:5,tiers:[{inputTokensAbove:272e3,input:8,output:30,cacheRead:.8,cacheWrite:10}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:18,cacheRead:.4,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272e3,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.5,cacheRead:.01,cacheWrite:.125,tiers:[{inputTokensAbove:272e3,input:.2,output:.75,cacheRead:.02,cacheWrite:.25}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272e3,input:4,output:15,cacheRead:.2,cacheWrite:5}]},contextWindow:105e4,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.5,cacheWrite:0,tiers:[{inputTokensAbove:2e5,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:5e5,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:128e3,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2e3,maxHeight:2e3,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};function a(e,t){return Object.fromEntries(Object.values(e).flatMap(i=>Object.values(i)).filter(i=>i.type===t).map(i=>[i.id,i]))}function s(e,t){return a(t,"chat")}function n(e,t){return a(t,"image")}function p(e,t){return a(t,"classifier")}var d=s("github-copilot",o),m=n("github-copilot",o),g=p("github-copilot",o);export{s as a,n as b,p as c,d,m as e,g as f};
@@ -1,4 +0,0 @@
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 d="https://radius.pi.dev";function a(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;return typeof r.id=="string"&&typeof r.name=="string"&&typeof r.reasoning=="boolean"&&Array.isArray(r.input)&&typeof r.cost=="object"&&r.cost!==null&&!Array.isArray(r.cost)&&typeof r.contextWindow=="number"&&typeof r.maxTokens=="number"}function s(t){if(typeof t!="object"||t===null||Array.isArray(t))return;let{baseUrl:r,models:e}=t;if(!(typeof r!="string"||!Array.isArray(e)))return{baseUrl:r,models:e.filter(a).map(n=>({...n}))}}function p(t){return(/^https?:\/\//iu.test(t)?t:`https://${t}`).replace(/\/+$/u,"")}function u(t){return s(t?.gatewayConfig)}function f(t,r){return r.models.map(e=>({...e,api:"pi-messages",provider:t,baseUrl:r.baseUrl}))}function l(t,r){let e=u(r);return e?f(t,e):[]}function c(t){let r=t.trim();return r.length>512?`${r.slice(0,512)}\u2026`:r}async function y(t,r,e){let n={accept:"application/json"};r&&(n.authorization=`Bearer ${r}`);let o=await fetch(new URL("/v1/config",t),{headers:n,signal:e});if(!o.ok)throw new Error(`Could not load Radius config from ${t}: ${o.status}: ${c(await o.text())}`);let i=s(await o.json());if(!i)throw new Error(`Invalid Radius config from ${t}`);return i}export{d as a,p as b,f as c,l as d,y as e};
@@ -1,4 +0,0 @@
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 c}from"./chunk-XPPZ6Y3X.js";import{e as a}from"./chunk-AVXDF7AG.js";import{j as l}from"./chunk-Z24SBRJK.js";import{a as S}from"./chunk-VPVSKJGX.js";import{e as g}from"./chunk-WHC7AYZD.js";var u=g(S(),1),E=new Set(["CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT"]);function O(n,t=process.env){let e={};u.config({path:n,processEnv:e});for(let r of E)delete e[r];u.populate(t,e)}var x="CORTEX_CHILD_EXIT";function I(n){return JSON.stringify(n)}function y(n){if(!n)return null;try{let t=JSON.parse(n);if(typeof t.uptimeMs!="number"||typeof t.backoffMs!="number")return null;let e=Number.isInteger(t.code)?t.code:null,r=typeof t.signal=="string"?t.signal.slice(0,20):null;return{code:e,signal:r,uptimeMs:Math.max(0,t.uptimeMs),backoffMs:Math.max(0,Math.round(t.backoffMs))}}catch{return null}}function M(n=process.env){let t=y(n[x]);!t||t.code===0&&!t.signal||c({component:"server",kind:"childExit",errorName:"ChildExit",message:t.signal?`signal ${t.signal}`:`exit code ${t.code??"unknown"}`,stack:"",uptimeS:Math.round(t.uptimeMs/1e3),exit:{code:t.code,signal:t.signal,backoffMs:t.backoffMs}})}import{existsSync as b,readFileSync as h}from"node:fs";import*as d from"node:path";var p=d.join(l,"daemon-rebuild.json");function C(n){let t=(n.now??(()=>new Date))().toISOString();return{status:"running",reason:n.reason,current:null,steps:n.names.map(e=>({name:e,status:"pending",detail:null,startedAt:null,endedAt:null})),startedAt:t,updatedAt:t,endedAt:null,detail:null,daemonPid:n.daemonPid}}function f(n,t,e,r){return{...n,updatedAt:r,steps:n.steps.map(o=>o.name===t?{...o,...e}:o)}}function P(n,t,e=()=>new Date){let r=e().toISOString();return{...f(n,t,{status:"running",startedAt:r,endedAt:null},r),current:t}}function w(n,t,e,r=null,o=()=>new Date){let s=o().toISOString(),i=f(n,t,{status:e,detail:r,endedAt:s},s);return i.current!==t?i:{...i,current:i.steps.filter(m=>m.status==="running").at(-1)?.name??null}}function L(n,t,e=null,r=()=>new Date){let o=r().toISOString();return{...n,status:t,current:null,detail:e,updatedAt:o,endedAt:o,steps:n.steps.map(s=>s.status==="pending"?{...s,status:"skipped"}:s)}}function A(n){if(!n||typeof n!="object")return!1;let t=n;return typeof t.status=="string"&&typeof t.reason=="string"&&typeof t.startedAt=="string"&&Array.isArray(t.steps)}function T(n=p){try{if(!b(n))return null;let t=JSON.parse(h(n,"utf8"));return A(t)?t:null}catch{return null}}function F(n,t=p){try{return a(t,JSON.stringify(n,null,2)),!0}catch{return!1}}export{O as a,x as b,I as c,M as d,C as e,P as f,w as g,L as h,T as i,F as j};
@@ -1,8 +0,0 @@
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};