@cortex-agent/server 2026.10.28 → 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 (401) hide show
  1. package/LICENSE +255 -21
  2. package/README.md +36 -7
  3. package/THIRD_PARTY_NOTICES.txt +1990 -593
  4. package/defaults/hooks/cortex-hook-api.mjs +2 -1
  5. package/defaults/hooks/quota-stop.mjs +37 -0
  6. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +23 -15
  7. package/defaults/prompts/clean-workspace.md +5 -0
  8. package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
  9. package/dist/chunks/agent-runner-LVZVKBZX.js +4 -0
  10. package/dist/chunks/anthropic-messages-TT6454AA.js +8 -0
  11. package/dist/chunks/azure-openai-responses-52LR2XZD.js +4 -0
  12. package/dist/chunks/bedrock-converse-stream-EOZGYUNY.js +60 -0
  13. package/dist/chunks/bowser-MLGGLXTZ.js +20 -0
  14. package/dist/chunks/child-runner-SMG2VOU5.js +4 -0
  15. package/dist/chunks/chunk-24DH4IR5.js +4 -0
  16. package/dist/chunks/chunk-25XKBRDT.js +70 -0
  17. package/dist/chunks/chunk-2ABET62E.js +23 -0
  18. package/dist/chunks/chunk-2BVUA256.js +4 -0
  19. package/dist/chunks/{chunk-LEUENXI2.js → chunk-2WFL62UO.js} +1 -1
  20. package/dist/chunks/{chunk-OZGBWAT2.js → chunk-2YTYYG4K.js} +1 -1
  21. package/dist/chunks/chunk-335SSANX.js +4 -0
  22. package/dist/chunks/chunk-377OPTXX.js +17 -0
  23. package/dist/chunks/chunk-3EZNVLBF.js +129 -0
  24. package/dist/chunks/chunk-3O6ZG5HA.js +7 -0
  25. package/dist/chunks/{chunk-6AKUD3CF.js → chunk-3XLHL5YT.js} +1 -1
  26. package/dist/chunks/chunk-4HRI75GU.js +4 -0
  27. package/dist/chunks/chunk-4JBYLRPM.js +57 -0
  28. package/dist/chunks/chunk-4KKV7VKE.js +4 -0
  29. package/dist/chunks/chunk-4KQHDDC5.js +4 -0
  30. package/dist/chunks/chunk-4SWD4JMP.js +33 -0
  31. package/dist/chunks/chunk-52VCLZS5.js +4 -0
  32. package/dist/chunks/chunk-54P7TSY3.js +10 -0
  33. package/dist/chunks/chunk-5DVSAXOI.js +7 -0
  34. package/dist/chunks/chunk-5F3A62YS.js +4 -0
  35. package/dist/chunks/{chunk-XNSSUVT6.js → chunk-5FHETFZM.js} +1 -1
  36. package/dist/chunks/{chunk-A34TDMIC.js → chunk-5LBLRAHS.js} +1 -1
  37. package/dist/chunks/chunk-5UYVNA3W.js +4 -0
  38. package/dist/chunks/chunk-6G3OYMCV.js +21 -0
  39. package/dist/chunks/chunk-7GGPYU5E.js +30 -0
  40. package/dist/chunks/chunk-7TYSMLUV.js +4 -0
  41. package/dist/chunks/chunk-7W7VYUTK.js +5 -0
  42. package/dist/chunks/chunk-AXYAZTTN.js +6 -0
  43. package/dist/chunks/{chunk-BGVHA2D4.js → chunk-B3NB243Z.js} +1 -1
  44. package/dist/chunks/chunk-BKYP6AGM.js +8 -0
  45. package/dist/chunks/chunk-BVEDNESB.js +4 -0
  46. package/dist/chunks/chunk-BWDJS6A4.js +12 -0
  47. package/dist/chunks/chunk-C6YVF7EI.js +4 -0
  48. package/dist/chunks/chunk-CEJIYYVE.js +15 -0
  49. package/dist/chunks/chunk-CI2RHH74.js +50 -0
  50. package/dist/chunks/chunk-CMSOOLJB.js +4 -0
  51. package/dist/chunks/chunk-CSVTYYLP.js +4 -0
  52. package/dist/chunks/chunk-DE5EGVKG.js +6 -0
  53. package/dist/chunks/{chunk-E6BYRULL.js → chunk-DK3RPZOQ.js} +1 -1
  54. package/dist/chunks/{chunk-YPK2CAIZ.js → chunk-DK4UCK7L.js} +1 -1
  55. package/dist/chunks/chunk-DYLBVUAU.js +4 -0
  56. package/dist/chunks/chunk-FDC2GRBK.js +27 -0
  57. package/dist/chunks/chunk-FE7HH5JS.js +18 -0
  58. package/dist/chunks/chunk-FYD57YRO.js +436 -0
  59. package/dist/chunks/chunk-G264APQN.js +5 -0
  60. package/dist/chunks/chunk-G4JYZFEO.js +11 -0
  61. package/dist/chunks/chunk-GFFM56U2.js +4 -0
  62. package/dist/chunks/chunk-GOS3P7KS.js +132 -0
  63. package/dist/chunks/chunk-HVN37UXD.js +4 -0
  64. package/dist/chunks/chunk-IA6IODY3.js +4 -0
  65. package/dist/chunks/{chunk-HU6UIDEJ.js → chunk-IGZWZP7Z.js} +1 -1
  66. package/dist/chunks/{chunk-NR6U3WIZ.js → chunk-IJ7XFQMI.js} +1 -1
  67. package/dist/chunks/chunk-IMMGYDAB.js +6 -0
  68. package/dist/chunks/chunk-IOWBF7UK.js +10 -0
  69. package/dist/chunks/{chunk-HALUQ7ZF.js → chunk-ITGCWQFK.js} +1 -1
  70. package/dist/chunks/chunk-IVZ7QUEG.js +4 -0
  71. package/dist/chunks/{chunk-YAEVYJAR.js → chunk-IWY2HIFK.js} +1 -1
  72. package/dist/chunks/{chunk-KGJZAYQD.js → chunk-J7OBATRN.js} +1 -1
  73. package/dist/chunks/{chunk-QWAQHHRS.js → chunk-JGUEIW2W.js} +1 -1
  74. package/dist/chunks/chunk-JKL3AK5D.js +106 -0
  75. package/dist/chunks/chunk-JZ7U7RUK.js +351 -0
  76. package/dist/chunks/chunk-KJUQCCB5.js +4 -0
  77. package/dist/chunks/chunk-KST6OY76.js +10 -0
  78. package/dist/chunks/chunk-KZSAFVSY.js +129 -0
  79. package/dist/chunks/chunk-LD2ZSH3M.js +903 -0
  80. package/dist/chunks/chunk-LE6QPXN6.js +7 -0
  81. package/dist/chunks/chunk-LEAV3FFG.js +4 -0
  82. package/dist/chunks/chunk-LIIZI3HY.js +5 -0
  83. package/dist/chunks/chunk-LP72AF56.js +45 -0
  84. package/dist/chunks/{chunk-FXDIR3SQ.js → chunk-MJQ2D2OP.js} +1 -1
  85. package/dist/chunks/{chunk-6LZK4DDH.js → chunk-NHHR4DCF.js} +1 -1
  86. package/dist/chunks/chunk-NW4GW47L.js +4 -0
  87. package/dist/chunks/chunk-OALEJ6FG.js +60 -0
  88. package/dist/chunks/chunk-OIV4DIMB.js +4 -0
  89. package/dist/chunks/chunk-OJ37ZWBG.js +4 -0
  90. package/dist/chunks/chunk-OZXMPBUX.js +4 -0
  91. package/dist/chunks/{chunk-3THJYAEF.js → chunk-PG7452XE.js} +1 -1
  92. package/dist/chunks/chunk-PJCUB7YJ.js +4 -0
  93. package/dist/chunks/chunk-PTS3J4DQ.js +6 -0
  94. package/dist/chunks/{chunk-PXS5SHOV.js → chunk-PVVEEBUU.js} +1 -1
  95. package/dist/chunks/chunk-Q7BZLPBU.js +8 -0
  96. package/dist/chunks/{chunk-FOJQXLL2.js → chunk-QC66ZXPP.js} +1 -1
  97. package/dist/chunks/chunk-QXFWIL4C.js +4 -0
  98. package/dist/chunks/{chunk-PFMEUFJ7.js → chunk-R2CCD4OF.js} +1 -1
  99. package/dist/chunks/chunk-R6CGBSTC.js +22 -0
  100. package/dist/chunks/chunk-RG5GP4RB.js +5 -0
  101. package/dist/chunks/{chunk-D3NXKK2L.js → chunk-RW2F2QNP.js} +1 -1
  102. package/dist/chunks/{models-L5VF4I5O-XXNJYQMQ.js → chunk-RWPO3NZ3.js} +1 -1
  103. package/dist/chunks/chunk-SAJD4EKE.js +10 -0
  104. package/dist/chunks/chunk-SDUS2H3E.js +4 -0
  105. package/dist/chunks/chunk-SIHGKM4E.js +4 -0
  106. package/dist/chunks/chunk-SKHFU5DI.js +4 -0
  107. package/dist/chunks/{chunk-STUHNKQS.js → chunk-SM45TH22.js} +1 -1
  108. package/dist/chunks/chunk-T54CZKNJ.js +6 -0
  109. package/dist/chunks/chunk-TKFFQNAP.js +19 -0
  110. package/dist/chunks/chunk-TMV2ZDOI.js +18 -0
  111. package/dist/chunks/chunk-TRXLIL7V.js +4 -0
  112. package/dist/chunks/{chunk-SUFW24P4.js → chunk-UEEW2R4E.js} +1 -1
  113. package/dist/chunks/chunk-UHXPRU6G.js +10 -0
  114. package/dist/chunks/chunk-UPQVWHZ3.js +4 -0
  115. package/dist/chunks/{chunk-JERCOLY3.js → chunk-V35MFAUQ.js} +4 -6
  116. package/dist/chunks/chunk-V7K3KNDM.js +4 -0
  117. package/dist/chunks/chunk-VHX2GHBF.js +4 -0
  118. package/dist/chunks/chunk-VOAKRJ4R.js +4 -0
  119. package/dist/chunks/{chunk-X2GYYRVM.js → chunk-VW7TLY3P.js} +1 -1
  120. package/dist/chunks/chunk-W34AK4SK.js +65 -0
  121. package/dist/chunks/{chunk-REBNWCKI.js → chunk-WU7RNAZD.js} +1 -1
  122. package/dist/chunks/chunk-WZC4TDDM.js +6 -0
  123. package/dist/chunks/chunk-WZYS2HAK.js +4 -0
  124. package/dist/chunks/chunk-X2TKJ7KR.js +11 -0
  125. package/dist/chunks/{chunk-H2FP6DG4.js → chunk-X5ND4H4P.js} +1 -1
  126. package/dist/chunks/{chunk-4U7XXM4W.js → chunk-Y3AOGNDT.js} +1 -1
  127. package/dist/chunks/chunk-Y6DGVTKM.js +6 -0
  128. package/dist/chunks/{chunk-KENCMLRE.js → chunk-YAEHSSR4.js} +1 -1
  129. package/dist/chunks/chunk-YWPBE5LP.js +4 -0
  130. package/dist/chunks/chunk-ZAVX7G2M.js +15 -0
  131. package/dist/chunks/chunk-ZD2M73XA.js +19 -0
  132. package/dist/chunks/chunk-ZD4O6NPV.js +4 -0
  133. package/dist/chunks/chunk-ZNAMETPQ.js +4 -0
  134. package/dist/chunks/chunk-ZY6N5LVQ.js +4 -0
  135. package/dist/chunks/chunk-ZYQ4TDTT.js +81 -0
  136. package/dist/chunks/cli-VB2N7HEK.js +55 -0
  137. package/dist/chunks/cloudflare-workers-ai-system-one-YKU742EC.js +4 -0
  138. package/dist/chunks/context-CI2FKEQE.js +4 -0
  139. package/dist/chunks/cost-CZRRSIUF.js +5 -0
  140. package/dist/chunks/dist-QCNQN6DY.js +4 -0
  141. package/dist/chunks/easter-egg-3d-XR5S2O3T.js +4 -0
  142. package/dist/chunks/{event-streams-3JSFPOTZ.js → event-streams-AVE4MSS6.js} +1 -1
  143. package/dist/chunks/{execution-repo-ZLJTBWFC.js → execution-repo-5TLV2NM4.js} +1 -1
  144. package/dist/chunks/{executions-6ARGR3IO.js → executions-I3UUIGSL.js} +1 -1
  145. package/dist/chunks/file-Y5G56IUT.js +4 -0
  146. package/dist/chunks/github-copilot-BRU2SRRZ.js +4 -0
  147. package/dist/chunks/google-generative-ai-ZF5QEUZV.js +4 -0
  148. package/dist/chunks/google-vertex-4PJZZI3Y.js +4 -0
  149. package/dist/chunks/init-A6GY656J.js +4 -0
  150. package/dist/chunks/{install-cli-4IZCSDFZ.js → install-cli-FALWKQYO.js} +1 -1
  151. package/dist/chunks/{interaction-ask-G5T3H3CG.js → interaction-ask-O5HGF6CH.js} +1 -1
  152. package/dist/chunks/{interaction-plan-E5V42MUP.js → interaction-plan-JTVDN3BC.js} +1 -1
  153. package/dist/chunks/kimi-coding-ZCIBMDZ6.js +4 -0
  154. package/dist/chunks/{llama-cpp-classify-OTXZWCMW.js → llama-cpp-classify-NRUXAIGQ.js} +3 -3
  155. package/dist/chunks/local-client-stop-RS4AHNF4.js +4 -0
  156. package/dist/chunks/{memory-cli-PYOILNN5.js → memory-cli-DIT4DQF3.js} +1 -1
  157. package/dist/chunks/meta-JQH66YU7.js +4 -0
  158. package/dist/chunks/mistral-conversations-CXHOECUV.js +7 -0
  159. package/dist/chunks/model-resolver-GIBPYRKP.js +4 -0
  160. package/dist/chunks/monitor-Z2HKNY5E.js +4 -0
  161. package/dist/chunks/{node-PTK2HCDV.js → node-DAO3SX7O.js} +1 -1
  162. package/dist/chunks/{openai-codex-2REL6UQU.js → openai-codex-JULCKICT.js} +1 -1
  163. package/dist/chunks/openai-codex-responses-U6DGMGDK.js +12 -0
  164. package/dist/chunks/openai-completions-PP4XLLOM.js +9 -0
  165. package/dist/chunks/{openai-decisions-2N6ZRPZC.js → openai-decisions-JU6QQKEM.js} +1 -1
  166. package/dist/chunks/openai-responses-2SG757TL.js +6 -0
  167. package/dist/chunks/openrouter-images-32M7YZWC.js +4 -0
  168. package/dist/chunks/pi-messages-VSINMXN4.js +10 -0
  169. package/dist/chunks/radius-THYKWV4E.js +4 -0
  170. package/dist/chunks/remote-ops-2WBEFQ3E.js +14 -0
  171. package/dist/chunks/runner-5MKMRTIN.js +4 -0
  172. package/dist/chunks/runtime-DST3H5JP.js +4 -0
  173. package/dist/chunks/schedule-cli-V7Y2BBVY.js +4 -0
  174. package/dist/chunks/slack-R7SEJYMY.js +4 -0
  175. package/dist/chunks/start-ui-http-7K5JOLPU.js +43 -0
  176. package/dist/chunks/subagent-Z5IQ4L54.js +4 -0
  177. package/dist/chunks/{time-KEHDQT6K.js → time-P6PE52WL.js} +1 -1
  178. package/dist/chunks/tool-shims-YCXZWTST.js +4 -0
  179. package/dist/chunks/typesafe-system-one-M2DABJSZ.js +4 -0
  180. package/dist/chunks/ui-board-HQIE4RZG.js +5 -0
  181. package/dist/chunks/ui-decision-YBZDS4YW.js +4 -0
  182. package/dist/chunks/{ui-file-GVH53O3X.js → ui-file-SRD4ILBS.js} +1 -1
  183. package/dist/chunks/ui-view-Z25MTZT7.js +4 -0
  184. package/dist/chunks/virtual-modules-H4DXPJZB.js +4 -0
  185. package/dist/chunks/waitpoint-M6JZBSLT.js +5 -0
  186. package/dist/chunks/workers-SQ2R32TK.js +4 -0
  187. package/dist/client-bundle/client.mjs +273 -93
  188. package/dist/client-bundle/manifest.json +2 -2
  189. package/dist/core/pi-sdk.js +1 -1
  190. package/dist/domain/auth/cc-auth-cli.js +1 -1
  191. package/dist/domain/mcp/bundled-server.js +1 -1
  192. package/dist/domain/mcp/feishu/client.js +4 -0
  193. package/dist/entry/app.js +151 -559
  194. package/dist/entry/browser-cli.js +10 -10
  195. package/dist/entry/cli.js +1 -1
  196. package/dist/entry/cortex-cli.js +1 -1
  197. package/dist/entry/daemon.js +4 -4
  198. package/dist/entry/hook-cli.js +2 -2
  199. package/dist/entry/production-app-bootstrap.js +1 -1
  200. package/dist/entry/production-evidence-export-cli.js +1 -1
  201. package/dist/entry/signal-cli.js +2 -2
  202. package/dist/tui/index.js +41 -41
  203. package/package.json +3 -3
  204. package/vendor/pi/CHANGELOG.md +330 -0
  205. package/vendor/pi/dist/codemode-worker.js +2 -0
  206. package/vendor/pi/dist/core/export-html/ansi-to-html.js +57 -20
  207. package/vendor/pi/dist/core/export-html/template.css +9 -0
  208. package/vendor/pi/dist/core/export-html/template.js +166 -46
  209. package/vendor/pi/dist/core/export-html/tool-renderer.js +5 -3
  210. package/vendor/pi/dist/core/extensions/loader.js +1 -1
  211. package/vendor/pi/dist/extensions/codemode/execute.js +15 -13
  212. package/vendor/pi/dist/modes/interactive/theme/theme.js +36 -23
  213. package/vendor/pi/dist/utils/image-resize-worker.js +1 -1
  214. package/vendor/pi/dist/utils/image-resize.js +1 -1
  215. package/vendor/pi/docs/cli.md +35 -12
  216. package/vendor/pi/docs/custom-provider.md +2 -0
  217. package/vendor/pi/docs/environment-variables.md +2 -0
  218. package/vendor/pi/docs/extensions.md +3192 -225
  219. package/vendor/pi/docs/keybindings.md +2 -2
  220. package/vendor/pi/docs/llama-cpp.md +27 -19
  221. package/vendor/pi/docs/mcp.md +6 -4
  222. package/vendor/pi/docs/message-types.md +1 -1
  223. package/vendor/pi/docs/models-configuration.md +9 -3
  224. package/vendor/pi/docs/models.md +2 -1
  225. package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +5 -5
  226. package/vendor/pi/docs/packages.md +24 -0
  227. package/vendor/pi/docs/prompt-templates.md +1 -1
  228. package/vendor/pi/docs/providers.md +4 -2
  229. package/vendor/pi/docs/quickstart.md +7 -3
  230. package/vendor/pi/docs/rpc-commands.md +1 -1
  231. package/vendor/pi/docs/rpc.md +4 -2
  232. package/vendor/pi/docs/sessions.md +17 -3
  233. package/vendor/pi/docs/settings.md +6 -5
  234. package/vendor/pi/docs/slash-commands.md +3 -2
  235. package/vendor/pi/docs/terminal-setup.md +3 -1
  236. package/vendor/pi/docs/tmux.md +6 -0
  237. package/vendor/pi/docs/tui.md +4 -0
  238. package/vendor/pi/docs/windows.md +27 -0
  239. package/vendor/pi/examples/extensions/README.md +2 -1
  240. package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +27 -31
  241. package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  242. package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
  243. package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  244. package/vendor/pi/examples/extensions/debug-provider.ts +2 -2
  245. package/vendor/pi/examples/extensions/gondolin/index.ts +4 -7
  246. package/vendor/pi/examples/extensions/gondolin/package-lock.json +19 -29
  247. package/vendor/pi/examples/extensions/gondolin/package.json +2 -2
  248. package/vendor/pi/examples/extensions/plan-mode/index.ts +23 -13
  249. package/vendor/pi/examples/extensions/plan-mode/utils.ts +42 -16
  250. package/vendor/pi/examples/extensions/preset.ts +2 -0
  251. package/vendor/pi/examples/extensions/reload-runtime.ts +17 -5
  252. package/vendor/pi/examples/extensions/subagent/README.md +14 -11
  253. package/vendor/pi/examples/extensions/subagent/index.ts +392 -171
  254. package/vendor/pi/examples/extensions/todo.ts +7 -0
  255. package/vendor/pi/examples/extensions/tools.ts +2 -0
  256. package/vendor/pi/examples/extensions/with-deps/package-lock.json +2 -2
  257. package/vendor/pi/examples/extensions/with-deps/package.json +1 -1
  258. package/vendor/pi/examples/tsconfig.json +208 -0
  259. package/vendor/pi/package.json +15 -16
  260. package/vendor/pi/schemas/models.schema.json +66 -37
  261. package/vendor/pi/schemas/settings.schema.json +18 -1
  262. package/vendor/pi-ai/bedrock.js +1 -1
  263. package/vendor/pi-ai/oauth-load.js +1 -1
  264. package/web/dist/assets/{board-math-css-BPXakv_3.js → board-math-css-DKX6FcUS.js} +1 -1
  265. package/web/dist/assets/index-D11wi0uG.js +540 -0
  266. package/web/dist/assets/index-JedYumhY.css +1 -0
  267. package/web/dist/assets/{index-WCm6wwmM.js → index-jl30Gy8P.js} +1 -1
  268. package/web/dist/assets/pdf-worker-DdZgk2mV.js +57 -0
  269. package/web/dist/assets/pdf.worker.min-Bz_KHX45.js +55 -0
  270. package/web/dist/index.html +2 -2
  271. package/web/dist/theme.css +22 -0
  272. package/dist/chunks/anthropic-messages-M3SMXACA.js +0 -8
  273. package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +0 -4
  274. package/dist/chunks/azure-openai-responses-76YWXHSB.js +0 -4
  275. package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +0 -58
  276. package/dist/chunks/child-runner-3GHOWGZP.js +0 -4
  277. package/dist/chunks/chunk-2ZNLUY2U.js +0 -128
  278. package/dist/chunks/chunk-3F6WW7HR.js +0 -13
  279. package/dist/chunks/chunk-3OKHUVEM.js +0 -7
  280. package/dist/chunks/chunk-3YHOCPQU.js +0 -10
  281. package/dist/chunks/chunk-4EX2JJWB.js +0 -4
  282. package/dist/chunks/chunk-4LLH5OWM.js +0 -10
  283. package/dist/chunks/chunk-52T37Y47.js +0 -8
  284. package/dist/chunks/chunk-7MU2AKNM.js +0 -4
  285. package/dist/chunks/chunk-AAA3UBIS.js +0 -4
  286. package/dist/chunks/chunk-ASYQHJVQ.js +0 -9
  287. package/dist/chunks/chunk-BKHDWCRT.js +0 -79
  288. package/dist/chunks/chunk-CQLH4UVX.js +0 -4
  289. package/dist/chunks/chunk-CVC66CFV.js +0 -33
  290. package/dist/chunks/chunk-D6UA4BZC.js +0 -19
  291. package/dist/chunks/chunk-DGMNI4AO.js +0 -4
  292. package/dist/chunks/chunk-DHSA5ACV.js +0 -125
  293. package/dist/chunks/chunk-DPQPXBTP.js +0 -68
  294. package/dist/chunks/chunk-DXBSQXJL.js +0 -18
  295. package/dist/chunks/chunk-E7ZMYIY6.js +0 -30
  296. package/dist/chunks/chunk-EQITBTJC.js +0 -10
  297. package/dist/chunks/chunk-EXJA5RIX.js +0 -357
  298. package/dist/chunks/chunk-FF7UELTU.js +0 -4
  299. package/dist/chunks/chunk-FH74NME3.js +0 -115
  300. package/dist/chunks/chunk-FOQ7VLIL.js +0 -17
  301. package/dist/chunks/chunk-FX6MOGLR.js +0 -11
  302. package/dist/chunks/chunk-G2V65UBA.js +0 -4
  303. package/dist/chunks/chunk-HGPBHTVD.js +0 -6
  304. package/dist/chunks/chunk-J5DVLUKY.js +0 -6
  305. package/dist/chunks/chunk-JW2HFMTF.js +0 -4
  306. package/dist/chunks/chunk-KDYEGGMW.js +0 -4
  307. package/dist/chunks/chunk-KIGMAATV.js +0 -23
  308. package/dist/chunks/chunk-KIU5FAPY.js +0 -5
  309. package/dist/chunks/chunk-KIWMQPH7.js +0 -739
  310. package/dist/chunks/chunk-L6VCIGWS.js +0 -11
  311. package/dist/chunks/chunk-LACGULCN.js +0 -10
  312. package/dist/chunks/chunk-LMSQZ6TQ.js +0 -4
  313. package/dist/chunks/chunk-MEPASGPP.js +0 -6
  314. package/dist/chunks/chunk-MFAEUHMV.js +0 -28
  315. package/dist/chunks/chunk-NAA7GF6Q.js +0 -5
  316. package/dist/chunks/chunk-NKDMKRSB.js +0 -68
  317. package/dist/chunks/chunk-NKXV32S6.js +0 -4
  318. package/dist/chunks/chunk-NVX5IPRN.js +0 -4
  319. package/dist/chunks/chunk-O3JW2F7D.js +0 -8
  320. package/dist/chunks/chunk-OE4KH3NJ.js +0 -4
  321. package/dist/chunks/chunk-OISO5JXB.js +0 -4
  322. package/dist/chunks/chunk-OPYXNSMY.js +0 -4
  323. package/dist/chunks/chunk-OSEIQ7SS.js +0 -4
  324. package/dist/chunks/chunk-P52RMIYX.js +0 -6
  325. package/dist/chunks/chunk-PBJ5MPPX.js +0 -60
  326. package/dist/chunks/chunk-PZMGBKUR.js +0 -13
  327. package/dist/chunks/chunk-PZMXHA6X.js +0 -9
  328. package/dist/chunks/chunk-Q7CE3UIE.js +0 -133
  329. package/dist/chunks/chunk-QBKCAIJG.js +0 -4
  330. package/dist/chunks/chunk-QEOFEETJ.js +0 -4
  331. package/dist/chunks/chunk-QUUEQRIT.js +0 -4
  332. package/dist/chunks/chunk-RA6HKFBV.js +0 -4
  333. package/dist/chunks/chunk-REPYBMQS.js +0 -4
  334. package/dist/chunks/chunk-SKHLZ6XY.js +0 -9
  335. package/dist/chunks/chunk-TAWLERZA.js +0 -4
  336. package/dist/chunks/chunk-TWAEABGG.js +0 -52
  337. package/dist/chunks/chunk-TZFLHVOQ.js +0 -7
  338. package/dist/chunks/chunk-UD3NMUHR.js +0 -12
  339. package/dist/chunks/chunk-UNVEZI57.js +0 -4
  340. package/dist/chunks/chunk-VQUPKMDR.js +0 -4
  341. package/dist/chunks/chunk-W25TB3PU.js +0 -4
  342. package/dist/chunks/chunk-W5LGYSPZ.js +0 -4
  343. package/dist/chunks/chunk-WEZWKMYU.js +0 -4
  344. package/dist/chunks/chunk-XAJLZR7C.js +0 -28
  345. package/dist/chunks/chunk-XH6FMP3N.js +0 -71
  346. package/dist/chunks/chunk-XSRZHN63.js +0 -4
  347. package/dist/chunks/chunk-Y3GFB5XM.js +0 -8
  348. package/dist/chunks/chunk-YG7OEPR2.js +0 -6
  349. package/dist/chunks/chunk-YHIWOGVL.js +0 -4
  350. package/dist/chunks/chunk-YKKEI5GI.js +0 -4
  351. package/dist/chunks/chunk-YZSHTWNM.js +0 -92
  352. package/dist/chunks/chunk-Z4H3VDHI.js +0 -4
  353. package/dist/chunks/cli-5DBTRMHU.js +0 -53
  354. package/dist/chunks/client-XOGYH5UR.js +0 -4
  355. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +0 -4
  356. package/dist/chunks/config-DJSQI77S-335IXHSM.js +0 -4
  357. package/dist/chunks/context-VCQH5OB6.js +0 -4
  358. package/dist/chunks/cost-PGGFI7QJ.js +0 -5
  359. package/dist/chunks/dist-PUKMZ7GW.js +0 -4
  360. package/dist/chunks/easter-egg-3d-MO4MOEVF.js +0 -4
  361. package/dist/chunks/es5-VNTQPCKX.js +0 -4
  362. package/dist/chunks/file-7BN7RCAY.js +0 -4
  363. package/dist/chunks/gateway-UCRPMR75.js +0 -36
  364. package/dist/chunks/github-copilot-HAI2DA62.js +0 -4
  365. package/dist/chunks/google-generative-ai-2VXWLHWI.js +0 -4
  366. package/dist/chunks/google-vertex-UA36QP2U.js +0 -4
  367. package/dist/chunks/init-HA7FAQ73.js +0 -4
  368. package/dist/chunks/kimi-coding-HMJRKCPA.js +0 -4
  369. package/dist/chunks/local-client-stop-SQRU7ZZM.js +0 -4
  370. package/dist/chunks/meta-KY3LNFV2.js +0 -4
  371. package/dist/chunks/mistral-conversations-34F66L3O.js +0 -7
  372. package/dist/chunks/model-resolver-N3DTAQ2S.js +0 -4
  373. package/dist/chunks/openai-codex-responses-ZBVHREB3.js +0 -12
  374. package/dist/chunks/openai-completions-VVIB26SH.js +0 -9
  375. package/dist/chunks/openai-responses-735XA2ZX.js +0 -6
  376. package/dist/chunks/openrouter-images-3IKETHAC.js +0 -4
  377. package/dist/chunks/pi-messages-I3E4ZFHA.js +0 -10
  378. package/dist/chunks/radius-HXRZVBDB.js +0 -4
  379. package/dist/chunks/remote-ops-BALZYKH6.js +0 -14
  380. package/dist/chunks/runner-PLVZDGHB.js +0 -4
  381. package/dist/chunks/runtime-6YLTA2ZD.js +0 -4
  382. package/dist/chunks/schedule-cli-OLASBBYJ.js +0 -4
  383. package/dist/chunks/slack-WAGSPZUX.js +0 -4
  384. package/dist/chunks/start-ui-http-QALT7C3P.js +0 -43
  385. package/dist/chunks/subagent-E3UC7ZHC.js +0 -4
  386. package/dist/chunks/tool-shims-Q6P6UXVC.js +0 -4
  387. package/dist/chunks/typesafe-system-one-6ULACYD4.js +0 -4
  388. package/dist/chunks/ui-board-4GYW6KKW.js +0 -5
  389. package/dist/chunks/ui-decision-U2FXSEC2.js +0 -4
  390. package/dist/chunks/ui-view-O7PLANT7.js +0 -4
  391. package/dist/chunks/virtual-modules-IDC5YKZJ.js +0 -4
  392. package/dist/chunks/waitpoint-2FGQBIAC.js +0 -5
  393. package/dist/chunks/workers-XN4PSTH6.js +0 -4
  394. package/vendor/aistatus/gateway-cli.js +0 -21
  395. package/vendor/pi/examples/extensions/sandbox/index.ts +0 -321
  396. package/vendor/pi/examples/extensions/sandbox/package-lock.json +0 -92
  397. package/vendor/pi/examples/extensions/sandbox/package.json +0 -19
  398. package/web/dist/assets/index-BHZpFXhc.js +0 -525
  399. package/web/dist/assets/index-DqWMdMkh.css +0 -1
  400. package/web/dist/assets/pdf-worker-Hp15W1QJ.js +0 -57
  401. package/web/dist/assets/pdf.worker.min-DnhTvCwe.js +0 -55
@@ -1,13 +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 V}from"./chunk-D6VMBA4C.js";import{c as B,g as Q}from"./chunk-6AKUD3CF.js";import{a as C}from"./chunk-OSEIQ7SS.js";import{d as be}from"./chunk-WHC7AYZD.js";function _(r,e=`
5
- `){return typeof r=="string"?r:r.filter(t=>t.type==="text").map(t=>t.text).join(e)}function Z(r){let e=[_(r.content)];for(let t of Object.values(r.sections??{}))t!==null&&e.push(t);return e.filter(t=>t.length>0).join(`
6
-
7
- `)}function Ye(r){let e=[],t=_(r.content);t.length>0&&e.push(t);for(let[n,s]of Object.entries(r.sections??{}))e.push(s===null?`Removed system prompt section "${n}".`:`Updated system prompt section "${n}":
8
-
9
- ${s}`);return e.join(`
10
-
11
- `)}function Me(r,e){let t=r!==void 0&&r.length>0,n=e!==void 0&&e.length>0;if(!(!t&&!n))return{role:"system",content:r??"",...n?{toolsAdded:e}:{},timestamp:0}}function U(r){let e=Me(r.systemPrompt,r.tools);return{messages:e?[e,...r.messages]:r.messages}}function T(r){return r.role==="system"}function ee(r){let e=r[0];return e&&T(e)?e:void 0}function Je(r){return ee(r)?r.slice(1):r}function L(r){let e=new Map;for(let t of r)if(T(t)){for(let n of t.toolsRemoved??[])e.delete(n.name);for(let n of t.toolsAdded??[])e.set(n.name,n)}return[...e.values()]}function te(r){let e=[],t=new Map,n;for(let i of r){if(!T(i))continue;n??=i.timestamp;let o=_(i.content);o.length>0&&e.push(o);for(let[c,d]of Object.entries(i.sections??{}))d===null?t.delete(c):t.set(c,d)}let s=L(r);if(!(n===void 0&&s.length===0))return{role:"system",content:e.join(`
12
-
13
- `),...t.size>0?{sections:Object.fromEntries(t)}:{},...s.length>0?{toolsAdded:s}:{},timestamp:n??0}}function Xe(r){let e=te(r);return e?Z(e):""}function ve(r){let e=te(r.messages),t=r.messages.filter(n=>n.role!=="system");return{messages:e?[e,...t]:t}}function Ve(r,e){return e?r:ve(r)}function N(r){return{name:r.name,description:r.description,parameters:JSON.parse(JSON.stringify(r.parameters)),...r.constrainedSampling===void 0?{}:{constrainedSampling:r.constrainedSampling}}}function j(r,e){return JSON.stringify(N(r))===JSON.stringify(N(e))}function Be(r,e){let t=new Map(r.map(s=>[s.name,s])),n=new Map(e.map(s=>[s.name,s]));return{toolsAdded:e.filter(s=>{let i=t.get(s.name);return i===void 0||!j(i,s)}).map(N),toolsRemoved:r.filter(s=>{let i=n.get(s.name);return i===void 0||!j(s,i)}).map(s=>({name:s.name}))}}function Qe(r){let e=new Map;for(let t of r)if(T(t))for(let n of t.toolsAdded??[])e.set(n.name,n);return[...e.values()]}function Ze(r){let e=new Map;for(let t of r)if(T(t))for(let n of t.toolsAdded??[]){let s=e.get(n.name);if(s!==void 0&&!j(s,n))return!0;e.set(n.name,n)}return!1}function et(r){return re(r.filter(T))>=0}function re(r){let e=new Set,t=-1;for(let n=0;n<r.length;n++){let s=r[n];(s.toolsRemoved?.length??0)>0&&(t=n);for(let i of s.toolsAdded??[])e.has(i.name)&&(t=n),e.add(i.name)}return t}function tt(r,e){let t=r.filter(T);if(e==="none")return{requestTools:L(t),foldedSystemMessages:t.length};if(e==="changes")return{requestTools:[],foldedSystemMessages:0};let n=Math.max(ee(r)?1:0,re(t)+1);return{requestTools:L(t.slice(0,n)),foldedSystemMessages:n}}var He={};be(He,{AI_TELEMETRY_SCHEMA:()=>$,ModelsError:()=>f,calculateCost:()=>Ke,clampThinkingLevel:()=>We,createModels:()=>Ne,createProvider:()=>je,getModelType:()=>S,getSupportedThinkingLevels:()=>ye,hasApi:()=>Ue,isModelType:()=>A,modelsAreEqual:()=>ze});var xe=function(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?t:s+i+"."+o.toLowerCase()+"js"}):r},ne=r=>import(xe(r));function Ae(){return globalThis.process?.env}function se(){return{async env(r){let e=Ae()?.[r];return typeof e=="string"&&e.trim().length>0?e:void 0},async fileExists(r){try{let e=await ne("node:fs/promises"),t=r;return t.startsWith("~")&&(t=(await ne("node:os")).homedir()+t.slice(1)),await e.access(t),!0}catch{return!1}}}}function ie(r){if(r.reason!==void 0)return r.reason;let e=new Error("The operation was aborted");return e.name="AbortError",e}function v(r){return r??new AbortController().signal}function x(r,e){return e.aborted?(r.catch(()=>{}),Promise.reject(ie(e))):new Promise((t,n)=>{let s=!1,i=()=>e.removeEventListener("abort",o),o=()=>{s||(s=!0,i(),n(ie(e)))};e.addEventListener("abort",o,{once:!0}),r.then(c=>{s||(s=!0,i(),t(c))},c=>{s||(s=!0,i(),n(c))}),e.aborted&&o()})}var I=class{credentials=new Map;chains=new Map;enqueue(e,t,n){let s=v(n?.signal),i=this.chains.get(e)??Promise.resolve(),o=(async()=>(await i.catch(()=>{}),s.throwIfAborted(),t()))(),c=o.catch(()=>{});return this.chains.set(e,c),c.then(()=>{this.chains.get(e)===c&&this.chains.delete(e)}),x(o,s)}async read(e,t){return t?.signal?.throwIfAborted(),this.credentials.get(e)}async list(e){return e?.signal?.throwIfAborted(),[...this.credentials].map(([t,n])=>({providerId:t,type:n.type}))}modify(e,t,n){return this.enqueue(e,async()=>{let s=this.credentials.get(e),i=await t(s);return n?.signal?.throwIfAborted(),i!==void 0&&this.credentials.set(e,i),i??s},n)}delete(e,t){return this.enqueue(e,async()=>{this.credentials.delete(e)},t)}};var f=class extends Error{code;constructor(e,t,n){super(Se(t,n?.cause),n),this.name="ModelsError",this.code=e}};function Se(r,e){if(e==null)return r;let t=V(e).trim();return!t||r.includes(t)?r:`${r}: ${t}`}function W(r,e,t,n){let s=v(n?.signal);return x(Te(r,e,t,n,s),s)}async function Te(r,e,t,n,s){s.throwIfAborted();let i=n?.env?Ce(t,n.env):t;if(n?.apiKey!==void 0&&r.auth.apiKey)return K(i,r.auth.apiKey,r.id,{type:"api_key",key:n.apiKey,env:n.env},s);let o=await Oe(e,r.id,s);if(o){if(o.type==="oauth"&&r.auth.oauth)return Pe(e,r.id,r.auth.oauth,o,s,n?.minOAuthValidityMs);if(o.type==="api_key"&&r.auth.apiKey){let c=n?.env?{...o,env:{...o.env,...n.env}}:o;return K(i,r.auth.apiKey,r.id,c,s)}return}return r.auth.apiKey?K(i,r.auth.apiKey,r.id,void 0,s):void 0}function Ce(r,e){return{env:async t=>e[t]||await r.env(t),fileExists:t=>r.fileExists(t)}}var Ee=300*1e3,ke=15e3;async function z(r,e,t,n,s){let i,o=new AbortController,c=()=>o.abort(s.reason);s.addEventListener("abort",c,{once:!0}),s.aborted&&c();try{i=await r.modify(e,async d=>{if(s.removeEventListener("abort",c),s.throwIfAborted(),d?.type==="oauth"&&n(d))try{return await t.refresh(d,AbortSignal.timeout(ke))}catch(p){throw new f("oauth",`OAuth refresh failed for ${e}`,{cause:p})}},{signal:o.signal})}catch(d){throw d instanceof f?d:(s.throwIfAborted(),new f("auth",`Credential store modify failed for ${e}`,{cause:d}))}finally{s.removeEventListener("abort",c)}return i?.type==="oauth"?i:void 0}async function Pe(r,e,t,n,s,i){let o=Math.max(Ee,i??0),c=p=>Date.now()+o>=p.expires,d=n;if(c(d)){let p=await z(r,e,t,c,s);if(!p)return;if(d=p,i!==void 0&&c(d))throw new f("oauth",`OAuth refresh returned a token that expires too soon for ${e}`)}try{return{auth:await t.toAuth(d),source:"OAuth"}}catch(p){throw new f("oauth",`OAuth auth derivation failed for ${e}`,{cause:p})}}async function K(r,e,t,n,s){try{return await e.resolve({ctx:r,credential:n,signal:s})}catch(i){throw new f("auth",`API key auth failed for provider ${t}`,{cause:i})}}async function Oe(r,e,t){try{return await r.read(e,{signal:t})}catch(n){throw new f("auth",`Credential store read failed for ${e}`,{cause:n})}}var R=class{entries=new Map;async read(e,t){t?.signal?.throwIfAborted();let n=this.entries.get(e);return n?structuredClone(n):void 0}async write(e,t,n){n?.signal?.throwIfAborted(),this.entries.set(e,structuredClone(t))}async delete(e,t){t?.signal?.throwIfAborted(),this.entries.delete(e)}};function H(r,e){let t=new Map;for(let n of e)for(let[s,i]of Object.entries(n.metrics??{}))t.set(s,i);return{counter:n=>r.counter(n,t.get(n)),upDownCounter:n=>r.upDownCounter(n,t.get(n)),histogram:n=>r.histogram(n,t.get(n))}}async function _e(r,e){return e(Y)}var Ie=Object.freeze({add:()=>{}}),Re=Object.freeze({add:()=>{}}),qe=Object.freeze({record:()=>{}}),q=Object.freeze({counter:()=>Ie,upDownCounter:()=>Re,histogram:()=>qe}),oe=Object.freeze({inject:()=>{},extract:()=>E}),Y={metrics:q,propagation:oe,startSpan:_e,addLink:()=>{},addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Y);var E=Y;function ae(r){return(t,n,s)=>r.startSpan({name:t,attributes:n},i=>s(i,ae(i)))}function ce(r,e){return ae(r)}var k={type:"string",description:"Provider identifier.",required:!0},P={type:"string",description:"Requested model identifier.",required:!0},fe={type:"string",description:"Normalized stop reason.",values:["pending","stop","length","toolUse","error","aborted","deferred"]},de={description:"One logical model request, including authentication and provider setup.",parents:{kind:"any"},startAttributes:{provider:k,api:{type:"string",description:"API identifier.",required:!0},model:P,reasoning:{type:"string",description:"Scalar requested reasoning level.",required:!1}},endAttributes:{stop:fe,"usage.input":{type:"number",description:"Uncached input tokens."},"usage.output":{type:"number",description:"Output tokens."},"usage.cache_read":{type:"number",description:"Cache-read tokens."},"usage.cache_write":{type:"number",description:"Cache-write tokens."},"cost.total":{type:"number",description:"Total request cost in USD."},"response.id":{type:"string",description:"Provider response identifier.",cardinality:"high"}},events:{"pi.ai.first_chunk":{description:"First normalized stream event delivered.",attributes:{}},"pi.ai.block":{description:"A completed content block; content is never recorded.",attributes:{type:{type:"string",description:"Block kind.",values:["text","thinking","tool_call"],required:!0},index:{type:"number",description:"Content block index.",required:!0},chars:{type:"number",description:"UTF-16 character count.",required:!0},tool:{type:"string",description:"Tool name, for tool-call blocks only.",required:!1}}}},status:{default:"ok",errorWhen:"Stop reason is error: provider_error with at most 500 error-message characters. Aborted stays ok."}},$={version:1,spans:{"pi.ai.request":de,"pi.ai.poll":{...de,description:"One deferred-response poll, not the deferred request's lifetime."}},metrics:{"pi.ai.request.duration":{kind:"histogram",description:"Logical request or poll duration.",unit:"ms",attributes:{provider:k,model:P,stop:{...fe,required:!0}}},"pi.ai.first_chunk.duration":{kind:"histogram",description:"Time to the first normalized stream event.",unit:"ms",attributes:{provider:k,model:P}},"pi.ai.tokens":{kind:"counter",description:"Reported model token usage; pending and deferred polls are excluded.",unit:"token",attributes:{provider:k,model:P,kind:{type:"string",description:"Token usage category.",values:["input","output","cache_read","cache_write"],required:!0}}},"pi.ai.cost":{kind:"counter",description:"Reported model cost; pending and deferred polls are excluded.",unit:"USD",attributes:{provider:k,model:P}}}};function $e(r){let e=H(r,[$]);return{requestDuration:e.histogram("pi.ai.request.duration"),firstChunkDuration:e.histogram("pi.ai.first_chunk.duration"),tokens:e.counter("pi.ai.tokens"),cost:e.counter("pi.ai.cost")}}var ue=new WeakMap;function D(r,e,t){let n=performance.now(),s={provider:r.provider,model:r.id},i=e?.telemetry?.metrics??q,o=ue.get(i);o||(o=$e(i),ue.set(i,o));let{requestDuration:c,firstChunkDuration:d,tokens:p,cost:b}=o,m,M,w=!0,y=new Map,a=new Promise(u=>{M=u}),l=u=>(m=u,a),h={...s,api:r.api,...typeof e?.reasoning=="string"?{reasoning:e.reasoning}:{}},g=ce(e?.telemetry??E,[$]);return g(t?"pi.ai.poll":"pi.ai.request",h,l),{onEvent(u){if(w&&(w=!1,m.addEvent("pi.ai.first_chunk"),d.record(performance.now()-n,s,m)),u.type==="toolcall_delta")y.set(u.contentIndex,(y.get(u.contentIndex)??0)+u.delta.length);else if(u.type==="text_end"||u.type==="thinking_end")m.addEvent("pi.ai.block",{type:u.type==="text_end"?"text":"thinking",index:u.contentIndex,chars:u.content.length});else if(u.type==="toolcall_end"){let we=y.get(u.contentIndex)??0;y.delete(u.contentIndex),m.addEvent("pi.ai.block",{type:"tool_call",index:u.contentIndex,chars:we,tool:u.toolCall.name})}},onResult(u){u&&(m.setAttributes({stop:u.stopReason,"usage.input":u.usage.input,"usage.output":u.usage.output,"usage.cache_read":u.usage.cacheRead,"usage.cache_write":u.usage.cacheWrite,"cost.total":u.usage.cost.total,"response.id":u.responseId}),u.stopReason==="error"&&m.setStatus({status:"error",error:{name:"provider_error",message:u.errorMessage?.slice(0,500)??""}}),c.record(performance.now()-n,{...s,stop:u.stopReason},m),(!t||u.stopReason!=="pending"&&u.stopReason!=="deferred")&&(p.add(u.usage.input,{...s,kind:"input"}),p.add(u.usage.output,{...s,kind:"output"}),p.add(u.usage.cacheRead,{...s,kind:"cache_read"}),p.add(u.usage.cacheWrite,{...s,kind:"cache_write"}),b.add(u.usage.cost.total,s))),M()}}}function S(r){return r.type??"chat"}function A(r,e){return S(r)===e}function le(r){if(!A(r,"chat"))throw new f("provider",`Model ${r.provider}/${r.id} is not a chat model`)}function pe(r){if(!A(r,"image"))throw new f("provider",`Model ${r.provider}/${r.id} is not an image model`)}function he(r){if(!A(r,"classifier"))throw new f("provider",`Model ${r.provider}/${r.id} is not a classifier model`)}function me(r,e){if(e.images?.length&&!r.input.includes("image"))throw new f("provider",`Model ${r.provider}/${r.id} does not accept image input`)}function G(r,e,t=!1){return{api:r.api,provider:r.provider,model:r.id,output:[],stopReason:t?"aborted":"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function F(r,e,t=!1){return{api:r.api,provider:r.provider,model:r.id,answers:{},stopReason:t?"aborted":"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}var De={chat:!0,image:!0,classifier:!0};function ge(r){return Object.hasOwn(De,S(r))}function Le(r){return{...r,models:r.models.filter(ge)}}function J(r,e){if(!r&&!e)return;let t={...r};for(let[n,s]of Object.entries(e??{})){let i=n.toLowerCase();for(let o of Object.keys(t))o.toLowerCase()===i&&delete t[o];t[n]=s}return t}var X=class{providers=new Map;credentials;modelsStore;authContext;identity;refreshGenerations=new Map;refreshControllers=new Map;publicationChains=new Map;constructor(e){this.credentials=e?.credentials??new I,this.modelsStore=e?.modelsStore??new R,this.authContext=e?.authContext??se(),this.identity=e?.identity}setProvider(e){this.supersedeProviderRefresh(e.id),this.providers.set(e.id,e)}deleteProvider(e){this.supersedeProviderRefresh(e),this.providers.delete(e)}clearProviders(){for(let e of new Set([...this.providers.keys(),...this.refreshControllers.keys()]))this.supersedeProviderRefresh(e);this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let n=this.providers.get(e);if(!n)return[];try{return n.getModels()}catch{return[]}}let t=[];for(let n of this.providers.values())try{t.push(...n.getModels())}catch{}return t}getAllModels(e){if(e!==void 0){let n=this.providers.get(e);if(!n)return[];try{return n.getAllModels?.()??n.getModels()}catch{return[]}}let t=[];for(let n of this.providers.values())try{t.push(...n.getAllModels?.()??n.getModels())}catch{}return t}getModelsOfType(e,t){return this.getAllModels(t).filter(n=>A(n,e))}getModel(e,t){return this.getModels(e).find(n=>n.id===t)}getModelOfType(e,t,n){return this.getModelsOfType(e,t).find(s=>s.id===n)}supersedeProviderRefresh(e){let t=(this.refreshGenerations.get(e)??0)+1;this.refreshGenerations.set(e,t);let n=this.refreshControllers.get(e);return n&&(this.refreshControllers.delete(e),n.abort()),t}beginProviderRefresh(e){let t=this.supersedeProviderRefresh(e),n=new AbortController;return this.refreshControllers.set(e,n),{generation:t,controller:n}}publishProviderModels(e,t,n,s){let i=this.publicationChains.get(e)??Promise.resolve(),o=(async()=>(await i.catch(()=>{}),n.aborted||this.refreshGenerations.get(e)!==t||(s.persist===null?await this.modelsStore.delete(e,{signal:n}):s.persist!==void 0&&await this.modelsStore.write(e,structuredClone(s.persist),{signal:n}),n.aborted||this.refreshGenerations.get(e)!==t)?!1:(s.update?.(),!0)))(),c=o.catch(()=>{});return this.publicationChains.set(e,c),c.then(()=>{this.publicationChains.get(e)===c&&this.publicationChains.delete(e)}),x(o,n)}async runProviderRefreshPhase(e,t,n,s,i,o){let c=await this.modelsStore.read(e.id,{signal:o});await e.refreshModels({credential:t,stored:c?Le(structuredClone(c)):void 0,publish:d=>this.publishProviderModels(e.id,i,o,d),allowNetwork:n,force:n?s:void 0,signal:o,baseUrl:e.baseUrl})}async refresh(e={}){let t=e.allowNetwork??!0,n=v(e.signal),s=new Map;if(n.aborted)return{aborted:!0,errors:s};let i=e.providers?new Set(e.providers):void 0,o=Array.from(this.providers.values()).filter(d=>d.refreshModels!==void 0&&(!i||i.has(d.id))),c=Promise.all(o.map(async d=>{let{generation:p,controller:b}=this.beginProviderRefresh(d.id),m=AbortSignal.any([n,b.signal]),M=(async()=>{let w,y;try{w=await this.readCredential(d.id,m)}catch(l){y=l}if(await this.runProviderRefreshPhase(d,w,!1,void 0,p,m),y!==void 0)throw y;if(!t||m.aborted)return;let a=await this.resolveRefreshCredential(d,w,m);a&&await this.runProviderRefreshPhase(d,a,!0,e.force,p,m)})();try{await x(M,m)}catch(w){m.aborted||s.set(d.id,w instanceof Error?w:new f("model_source",`Model refresh failed for ${d.id}`,{cause:w}))}finally{this.refreshControllers.get(d.id)===b&&this.refreshControllers.delete(d.id)}}));try{await x(c,n)}catch(d){if(!n.aborted)throw d}return{aborted:n.aborted,errors:new Map(s)}}async resolveRefreshCredential(e,t,n){if(t?.type==="oauth"){let c=e.auth.oauth;return c?Date.now()<t.expires?t:n.aborted?void 0:z(this.credentials,e.id,c,d=>Date.now()>=d.expires,n):void 0}let s=e.auth.apiKey;if(!s)return;let i=t?.type==="api_key"?t:void 0,o=await s.resolve({ctx:this.authContext,credential:i,signal:n});if(o)return{type:"api_key",key:o.auth.apiKey,env:o.env}}async readCredential(e,t){try{return await this.credentials.read(e,{signal:t})}catch(n){throw new f("auth",`Credential store read failed for ${e}`,{cause:n})}}async checkProviderAuth(e,t,n){if(t?.type==="oauth")return e.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let s=e.auth.apiKey;if(!s)return;if(s.check)try{return await s.check({ctx:this.authContext,credential:t?.type==="api_key"?t:void 0,signal:n})}catch(o){throw new f("auth",`API key auth check failed for provider ${e.id}`,{cause:o})}let i=await W(e,this.credentials,this.authContext,{signal:n});return i?{source:i.source,type:"api_key"}:void 0}checkAuth(e,t){let n=v(t?.signal),s=(async()=>{n.throwIfAborted();let i=this.providers.get(e);if(i)return this.checkProviderAuth(i,await this.readCredential(e,n),n)})();return x(s,n)}async getAuthenticatedProviders(e,t){t.throwIfAborted();let n=e?[this.providers.get(e)].filter(i=>i!==void 0):this.getProviders();return(await Promise.all(n.map(async i=>{let o=await this.readCredential(i.id,t);return{provider:i,credential:o,auth:await this.checkProviderAuth(i,o,t)}}))).filter(i=>i.auth!==void 0)}getAvailable(e,t){let n=v(t?.signal),s=(async()=>(await this.getAuthenticatedProviders(e,n)).flatMap(({provider:o,credential:c})=>{let d=o.getModels();return o.filterModels?.(d,c)??d}))();return x(s,n)}async getAvailableOfType(e,t,n){return(await this.getAllAvailable(t,n)).filter(s=>A(s,e))}getAllAvailable(e,t){let n=v(t?.signal),s=(async()=>(await this.getAuthenticatedProviders(e,n)).flatMap(({provider:o,credential:c})=>{let d=o.getAllModels?.()??o.getModels();if(o.filterAllModels)return o.filterAllModels(d,c);if(!o.filterModels)return d;let p=new Set(o.filterModels(o.getModels(),c).map(b=>b.id));return d.filter(b=>!A(b,"chat")||p.has(b.id))}))();return x(s,n)}async getAuth(e,t){let n=v(t?.signal),s=typeof e=="string"?e:e.provider,i=this.providers.get(s);if(!i)return;let o=await W(i,this.credentials,this.authContext,{...t,signal:n});return!o||typeof e=="string"||!e.headers?o:{...o,auth:{...o.auth,headers:J(o.auth.headers,e.headers)}}}async login(e,t,n,s){let i=v(n.signal);i.throwIfAborted();let o=this.providers.get(e);if(!o)throw new f("provider",`Unknown provider: ${e}`);let c=t==="oauth"?o.auth.oauth:o.auth.apiKey;if(!c?.login)throw new f("auth",`${o.name} does not support ${t} login`);let d=c.login({...n,signal:i},s),p=await x(d,i),b=!1,m,M=new Promise(y=>{m=y}),w=this.credentials.modify(e,async()=>(b=!0,m?.(),p),{signal:i});w.catch(()=>{});try{await new Promise((y,a)=>{let l=()=>{b||a(i.reason)};i.addEventListener("abort",l,{once:!0}),Promise.race([M,w]).then(()=>{i.removeEventListener("abort",l),y()},h=>{i.removeEventListener("abort",l),a(h)}),i.aborted&&l()}),await w}catch(y){throw i.throwIfAborted(),new f("auth",`Credential store modify failed for ${e}`,{cause:y})}return p}async logout(e,t){let n=v(t?.signal);n.throwIfAborted();try{await this.credentials.delete(e,{signal:n})}catch(s){throw n.throwIfAborted(),new f("auth",`Credential store delete failed for ${e}`,{cause:s})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new f("provider",`Unknown provider: ${e.provider}`);return t}requireChatProvider(e){return le(e),this.requireProvider(e)}async applyAuth(e,t){this.requireProvider(e);let n=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env,signal:t?.signal});if(!n)throw new f("auth",`Provider is not configured: ${e.provider}`);let s=n.auth,i=t?.apiKey??s.apiKey,o=s.baseUrl?{...e,baseUrl:s.baseUrl}:e,c=t&&"sessionId"in t&&typeof t.sessionId=="string"?t.sessionId:void 0,d=J(J(Q(o,c),s.headers),t?.headers);t?.transformHeaders&&(d=await t.transformHeaders(d??{}));let p=n.env||t?.env?{...n.env??{},...t?.env??{}}:void 0,b=B(this.identity,t?.identity),{transformHeaders:m,...M}=t??{},w={...M,apiKey:i,headers:d,env:p,...b===void 0?{}:{identity:b}};return{requestModel:o,requestOptions:w}}stream(e,t,n){let s=U(t);return C(e,async()=>{let i=this.requireChatProvider(e),{requestModel:o,requestOptions:c}=await this.applyAuth(e,n);return i.stream(o,s,c)},D(e,n,!1))}async complete(e,t,n){return this.stream(e,t,n).result()}streamSimple(e,t,n){let s=U(t);return C(e,async()=>{let i=this.requireChatProvider(e),{requestModel:o,requestOptions:c}=await this.applyAuth(e,n);return i.streamSimple(o,s,c)},D(e,n,!1))}async completeSimple(e,t,n){return this.streamSimple(e,t,n).result()}streamDeferred(e,t,n){return C(e,async()=>{let s=this.requireChatProvider(e);if(!s.fetchDeferred)throw new f("provider",`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:o}=await this.applyAuth(e,n);return s.fetchDeferred(i,t,o)},D(e,n,!0))}async fetchDeferred(e,t,n){return this.streamDeferred(e,t,n).result()}async cancelDeferred(e,t,n){let s=this.requireChatProvider(e);if(!s.cancelDeferred)throw new f("provider",`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:o}=await this.applyAuth(e,n);await s.cancelDeferred(i,t,o)}async generateImages(e,t,n){try{pe(e);let s=this.requireProvider(e);if(!s.generateImages)throw new f("provider",`Provider ${e.provider} does not support image generation`);let{requestModel:i,requestOptions:o}=await this.applyAuth(e,n);return await s.generateImages(i,t,o)}catch(s){return G(e,s,n?.signal?.aborted)}}async classify(e,t,n){try{he(e),me(e,t);let s=this.requireProvider(e);if(!s.classify)throw new f("provider",`Provider ${e.provider} does not support classification`);let{requestModel:i,requestOptions:o}=await this.applyAuth(e,n);return await s.classify(i,t,o)}catch(s){return F(e,s,n?.signal?.aborted)}}};function Ne(r){return new X(r)}function je(r){let e=r.api&&typeof r.api.stream=="function"?r.api:void 0,t=e||!r.api?void 0:r.api,n=r.images,s=r.classifiers,i=e?[e]:Object.values(t??{}).filter(a=>a!==void 0),o=Object.values(n??{}).filter(a=>a!==void 0),c=Object.values(s??{}).filter(a=>a!==void 0);if(i.length===0&&o.length===0&&c.length===0)throw new Error(`Provider ${r.id}: at least one of "api", "images", or "classifiers" is required.`);let d=r.models,p=[],b=r.fetchModels,m=()=>{let a=[...d];for(let l of p){let h=a.findIndex(g=>S(g)===S(l)&&g.id===l.id);h>=0?a[h]=l:a.push(l)}return a},M=a=>e??t?.[a.api],w=(a,l)=>{let h=M(a);return h?l(h):C(a,async()=>{throw new f("stream",`Provider ${r.id} has no API implementation for "${a.api}"`)})},y={id:r.id,name:r.name??r.id,baseUrl:r.baseUrl,headers:r.headers,auth:r.auth,getModels:()=>m().filter(a=>A(a,"chat")),getAllModels:m,refreshModels:b?async a=>{if(a.stored){let g=a.stored.models.filter(u=>u.provider===r.id).map(u=>u);if(!await a.publish({update:()=>{p=g}}))return}if(!a.allowNetwork||a.signal.aborted)return;let l=await b(a);if(a.signal.aborted)return;let h=l.filter(ge);await a.publish({persist:{models:h,checkedAt:Date.now()},update:()=>{p=h}})}:void 0,filterModels:r.filterModels,filterAllModels:r.filterAllModels,stream:(a,l,h)=>w(a,g=>g.stream(a,l,h)),streamSimple:(a,l,h)=>w(a,g=>g.streamSimple(a,l,h))};return i.some(a=>a.fetchDeferred!==void 0)&&(y.fetchDeferred=(a,l,h)=>C(a,async()=>{let g=M(a);if(!g?.fetchDeferred)throw new f("provider",`Provider ${r.id} does not support deferred responses for "${a.api}"`);return g.fetchDeferred(a,l,h)})),i.some(a=>a.cancelDeferred!==void 0)&&(y.cancelDeferred=async(a,l,h)=>{let g=M(a);if(!g?.cancelDeferred)throw new f("provider",`Provider ${r.id} cannot cancel deferred responses for "${a.api}"`);await g.cancelDeferred(a,l,h)}),n&&o.length>0&&(y.generateImages=async(a,l,h)=>{let g=n[a.api];return g?g.generateImages(a,l,h):G(a,new f("provider",`Provider ${r.id} has no image generation implementation for "${a.api}"`))}),s&&c.length>0&&(y.classify=async(a,l,h)=>{let g=s[a.api];return g?g.classify(a,l,h):F(a,new f("provider",`Provider ${r.id} has no classifier implementation for "${a.api}"`))}),y}function Ue(r,e){return A(r,"chat")&&r.api===e}function Ke(r,e){let t=e.input+e.cacheRead+e.cacheWrite,n=r.cost,s=-1;for(let c of r.cost.tiers??[])t>c.inputTokensAbove&&c.inputTokensAbove>s&&(n=c,s=c.inputTokensAbove);let i=e.cacheWrite1h??0,o=e.cacheWrite-i;return e.cost.input=n.input/1e6*e.input,e.cost.output=n.output/1e6*e.output,e.cost.cacheRead=n.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=(n.cacheWrite*o+n.input*2*i)/1e6,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}var O=["off","minimal","low","medium","high","xhigh","max"];function ye(r){return r.reasoning?O.filter(e=>{let t=r.thinkingLevelMap?.[e];return t===null?!1:e==="xhigh"||e==="max"?t!==void 0:!0}):["off"]}function We(r,e){let t=ye(r);if(t.includes(e))return e;let n=O.indexOf(e);if(n===-1)return t[0]??"off";for(let s=n;s<O.length;s++){let i=O[s];if(t.includes(i))return i}for(let s=n-1;s>=0;s--){let i=O[s];if(t.includes(i))return i}return t[0]??"off"}function ze(r,e){return!r||!e?!1:S(r)===S(e)&&r.id===e.id&&r.provider===e.provider}export{se as a,I as b,f as c,R as d,$ as e,S as f,A as g,le as h,pe as i,he as j,me as k,G as l,F as m,_ as n,Z as o,Ye as p,Me as q,U as r,ee as s,Je as t,L as u,te as v,Xe as w,ve as x,Ve as y,N as z,j as A,Be as B,Qe as C,Ze as D,et as E,tt as F,Ne as G,je as H,Ue as I,Ke as J,ye as K,We as L,ze as M,He as N};
@@ -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{a as t}from"./chunk-PMG4YGDU.js";import{e}from"./chunk-E7ZMYIY6.js";function r(){return["Initialize Cortex data directory","","Usage: cortex init [--home <path>] [--gateway-config-dir <path>] [--force] [--answers <file>] [--json]","","Creates the CORTEX_HOME directory structure and asks for the language, interaction","platform (Slack / Feishu), machine name, usage reporting and system service.","Writes .env, copies default configs and generates mcp-config*.json, machines.json","and agent-state.json. It then detects provider logins, offers to log in, and sets","up gateway routes, the default model and favorites.","","Options:"," --home <path> Set CORTEX_HOME (default: $CORTEX_HOME or ~/.cortex/)"," --gateway-config-dir <path> Gateway config output directory (default: gateway home/.aistatus/)"," --force Overwrite existing configs (.env, budget.json, agent-state.json, etc.)"," --answers <file> Read answers from a JSON file instead of prompting; omitted fields use defaults"," --json Print NDJSON progress events on stdout and send human output to stderr"," --help, -h Show this help","","With --answers or --json, init does not prompt or start provider login; it reports","credential status and can finish before any provider is set up.","","Examples:"," cortex init"," cortex init --home /data/cortex"," cortex init --answers answers.json --json"].join(`
5
- `)}function s(){return["Auto-detect Claude Code / PI configurations and generate gateway.yaml + models.json","","Usage: cortex setup-gateway [--dry-run] [--output-dir <path>]","","Discovers backend endpoints from local Claude Code and PI configs, then","writes gateway.yaml (with backup) and $CORTEX_HOME/config/models.json.","Gateway settings: CORTEX_GATEWAY_PORT (9880) and CORTEX_GATEWAY_HOME (OS home).","Both read config/.env; gateway.yaml lives in <gateway home>/.aistatus/.","Without flags, this command writes files in place.","","Options:"," --dry-run Print the generated gateway.yaml to stdout without writing anything"," --output-dir <path> Write gateway.yaml and models.json under <path> instead of the defaults"," --help, -h Show this help"].join(`
6
- `)}function c(){return["Start the Cortex TUI (terminal UI) client","","Usage: cortex tui [options]","","Connects to a running Cortex daemon via WebSocket and opens","a terminal-based chat interface.","","Options:"," --resume Open the resume-session picker on connect"," --project <id> Start a fresh session in the named project"," --port <n> Override TUI port (default: 3003, or CORTEX_TUI_PORT)"," --help, -h Show this help"].join(`
7
- `)}function d(){return t({name:"cortex ui",description:"Manage the Web UI endpoint used by the Cortex apps and browsers",usage:"cortex ui <enable|pair> [--port <port>] [--home <path>] [--json]",commands:[{name:"enable",description:"Turn on the loopback Web UI endpoint and print how to reach it"},{name:"pair",description:"Print a one-time pairing code (10 minutes) for a new app or browser"}],options:[{flag:"--port <port>",description:"enable: TCP port to serve the Web UI on",default:"the configured CORTEX_UI_PORT, else 3004"},{flag:"--home <path>",description:"CORTEX_HOME to use",default:"$CORTEX_HOME or ~/.cortex"},{flag:"--json",description:"Print the result as JSON (enable: endpoint, token, change state; pair: code, expiry)"},{flag:"--help, -h",description:"Show this help"}],examples:[{description:"Enable the endpoint, keeping the configured port",command:"cortex ui enable"},{description:"Serve on another port",command:"cortex ui enable --port 4000"},{description:"Machine-readable output for the desktop setup flow",command:"cortex ui enable --json"},{description:"Get a code to connect a phone or another computer",command:"cortex ui pair"}]})}function m(){return t({name:"cortex path",description:"Make this install's commands (cortex, cortex-signal, \u2026) available in new terminals",usage:"cortex path <install|remove|status> [--home <path>] [--dry-run] [--json]",commands:[{name:"install",description:"Write launchers that use this install's Node into <home>/runtime/bin and put that directory on PATH (shell profiles on Linux/macOS, the user Path on Windows)"},{name:"remove",description:"Delete the launchers and undo the PATH change"},{name:"status",description:"Show whether the launchers exist, are current, and are on PATH"}],options:[{flag:"--home <path>",description:"CORTEX_HOME the launchers belong to",default:"$CORTEX_HOME or ~/.cortex"},{flag:"--dry-run",description:"Report what install or remove would change and change nothing"},{flag:"--json",description:"Print the result as JSON"},{flag:"--help, -h",description:"Show this help"}],examples:[{description:"Add cortex to new terminals",command:"cortex path install"},{description:"Preview the change",command:"cortex path install --dry-run --json"},{description:"Check the current state",command:"cortex path status"},{description:"Undo it",command:"cortex path remove"}]})}function p(){return t({name:"cortex client",description:"Manage the cortex-client installs on remote machines",usage:"cortex client remove --device <name> [--keep-remote] [--dry-run] [--home <path>]",commands:[{name:"remove",description:"Unregister a machine from machines.json, stop and uninstall its client over SSH, and drop its runtime state"}],options:[{flag:"--device <name>",description:"Machine name as registered in machines.json (required)"},{flag:"--keep-remote",description:"Only unregister locally; leave the remote process and files alone"},{flag:"--dry-run",description:"Print what would be removed as JSON and change nothing"},{flag:"--home <path>",description:"CORTEX_HOME of the server",default:"$CORTEX_HOME or ~/.cortex"},{flag:"--help, -h",description:"Show this help"}],examples:[{description:"Preview the removal",command:"cortex client remove --device trainer --dry-run"},{description:"Remove a machine and uninstall its client",command:"cortex client remove --device trainer"},{description:"Unregister a machine that no longer exists",command:"cortex client remove --device trainer --keep-remote"}]})}function l(){return t({name:"cortex memory",description:`Project memory under $CORTEX_HOME/context/projects (experiments/, knowledge/, patterns/).
8
- regen rewrites only the generated index.md files; the EXP/K/PAT files are never modified. Output is JSON.`,usage:"cortex memory <command> [--project <name>]... [options]",commands:[{name:"regen",description:"Rebuild experiments/knowledge/patterns index.md from frontmatter and the access log"},{name:"consolidate",description:"Report contradictions, stale entries, anti-pattern signals and consolidation candidates"}],options:[{flag:"--project <name>",description:"Limit to one project; repeat for several",default:"every project with memory directories"},{flag:"--text",description:"consolidate: print a human-readable summary instead of JSON"},{flag:"--help, -h",description:"Show this help"}],examples:[{description:"Rebuild every index",command:"cortex memory regen"},{description:"Rebuild one project's indexes",command:"cortex memory regen --project wm-align"},{description:"Lifecycle report for all projects",command:"cortex memory consolidate --text"},{description:"Lifecycle report as JSON for one project",command:"cortex memory consolidate --project wm-align"}]})}function h(){return t({name:"cortex schedule",description:`Manage scheduled tasks. Each fire opens a new session in the schedule's project and sends it the message.
9
- Changes land in schedules.json; a running daemon picks them up within a second. Output is JSON.`,usage:"cortex schedule <command> [<id>] [options]",commands:[{name:"list",description:"List schedules (--project to filter)"},{name:"get <id>",description:"Show one schedule"},{name:"add --type <type>",description:"Create a schedule"},{name:"edit <id>",description:"Change message, project, model, thinking, pre-check or timing (the type is fixed)"},{name:"pause <id>",description:"Pause a recurring schedule"},{name:"resume <id>",description:"Resume a paused schedule"},{name:"remove <id>",description:"Delete a schedule (--dry-run to preview)"}],options:[{flag:"--type <type>",description:"add: interval | daily | weekly | once"},{flag:"--interval <duration>",description:"interval: repeat period, e.g. 30m, 2h, 1d"},{flag:"--time <HH:MM>",description:"daily/weekly: time of day, 24-hour, server local time"},{flag:"--day <day>",description:"weekly: sun..sat or 0-6"},{flag:"--delay <duration>",description:"once: fire this long from now, e.g. 90m, 2h"},{flag:"--message <text|->",description:'Prompt for the fired session; "-" reads stdin'},{flag:"--project <id>",description:"Project the fired session belongs to",default:"general"},{flag:"--model [provider/]model",description:"Model to run",default:"the default model"},{flag:"--thinking <level>",description:"Thinking level for the selected model"},{flag:"--pre-check <cmd>",description:"Shell gate run before each fire; non-zero exit skips it"},{flag:"--idempotency-key <key>",description:"add: return the schedule already created with this key"},{flag:"--dry-run",description:"remove: show what would be removed"},{flag:"--help, -h",description:"Show this help"}],examples:[{description:"Every 30 minutes in a project",command:'cortex schedule add --type interval --interval 30m --project nimbus --message "Check GPU usage on lab2 and report a one-line summary"'},{description:"Every day at 09:00",command:`cortex schedule add --type daily --time 09:00 --message "Summarize yesterday's sessions"`},{description:"Every Monday at 21:00",command:'cortex schedule add --type weekly --day mon --time 21:00 --message "Weekly review"'},{description:"Once, two hours from now, prompt from stdin",command:'echo "Check training run r42 on lab2" | cortex schedule add --type once --delay 2h --message -'},{description:"List one project's schedules",command:"cortex schedule list --project nimbus"},{description:"Move a daily schedule to 10:30",command:"cortex schedule edit a1b2c3d4 --time 10:30"},{description:"Preview a removal",command:"cortex schedule remove a1b2c3d4 --dry-run"}]})}function n(){return[{name:"init",description:"Initialize CORTEX_HOME directory with configs and API keys"},{name:"start",description:"Start the Cortex server (node dist/entry/app.js)"},{name:"daemon",description:"Start daemon mode with file watching and auto-restart"},{name:"daemon stop",description:"Stop the running daemon (SIGTERM) and the local client it launched"},{name:"daemon status",description:"Check daemon + child status (PID, uptime)"},{name:"daemon restart",description:"Graceful restart \u2014 signal daemon to drain and respawn app.js"},{name:"daemon restart --hard",description:"Hard restart \u2014 send SIGTERM directly to app.js (daemon auto-recovers)"},{name:"daemon restart --force",description:"Force restart \u2014 send SIGKILL immediately to app.js"},{name:"daemon restart-self",description:"Stop and restart the daemon process itself"},{name:"restart",description:"Legacy alias for daemon restart (touches $STORE_DIR/.restart)"},{name:"install latest",description:"Install the latest version of Cortex from npm"},{name:"config",description:"Show resolved paths and initialization status"},{name:"doctor",description:"Health-check the install (runtime, login, platform, gateway); --fix to repair"},{name:"auth status",description:e("cmd.auth.cli.statusDescription")},{name:"feishu",description:"Manage Feishu user-identity login (login / status / logout)"},{name:"setup-gateway",description:"Auto-detect Claude/PI configs and generate gateway.yaml + models.json"},{name:"ui enable",description:"Enable the local Web UI endpoint the desktop app connects to"},{name:"client remove",description:"Unregister a remote machine and uninstall its cortex-client"},{name:"path install",description:"Make cortex available in new terminals (remove / status to undo or check)"},{name:"schedule",description:"List, add, edit, pause, resume and remove scheduled tasks"},{name:"memory",description:"Rebuild project memory indexes; report knowledge lifecycle findings"},{name:"tui",description:"Start the Terminal UI (TUI) client for local interaction"}]}function o(){return[{description:"Interactive init",command:"cortex init"},{description:"Init to custom directory",command:"cortex init --home /tmp/my-cortex"},{description:"Show resolved paths",command:"cortex config"},{description:"Health-check the install",command:"cortex doctor"},{description:e("cmd.auth.cli.exampleSummary"),command:"cortex auth status"},{description:e("cmd.auth.cli.exampleJson"),command:"cortex auth status --json"},{description:"Diagnose and auto-repair",command:"cortex doctor --fix"},{description:"Re-generate gateway config",command:"cortex setup-gateway"},{description:"Enable the local Web UI endpoint",command:"cortex ui enable"},{description:"Remove a remote machine and its client",command:"cortex client remove --device trainer"},{description:"Add cortex to new terminals",command:"cortex path install"},{description:"List scheduled tasks",command:"cortex schedule list"},{description:"Rebuild every project memory index",command:"cortex memory regen"},{description:"Start the server",command:"cortex start"},{description:"Stop the daemon",command:"cortex daemon stop"},{description:"Check daemon status",command:"cortex daemon status"},{description:"Graceful restart",command:"cortex daemon restart"},{description:"Hard restart app.js",command:"cortex daemon restart --hard"},{description:"Restart daemon itself",command:"cortex daemon restart-self"}]}function u(){return t({name:"cortex",description:"Cortex CLI \u2014 server management and initialization",usage:"cortex <command> [options]",commands:n(),options:[{flag:"--help, -h",description:"Show this help"}],examples:o()})}function g(){return t({name:"cortex auth",description:e("cmd.auth.cli.description"),usage:"cortex auth <status|login|provider> [options]",commands:[{name:"status",description:e("cmd.auth.cli.statusDescription")},{name:"login",description:e("init.auth.loginDescription")},{name:"provider",description:e("provider.cli.description")}],options:[{flag:"--json",description:e("cmd.auth.cli.jsonDescription")},{flag:"--help, -h",description:e("cmd.auth.cli.helpDescription")}],examples:[{description:e("cmd.auth.cli.exampleSummary"),command:"cortex auth status"},{description:e("cmd.auth.cli.exampleJson"),command:"cortex auth status --json"},{description:e("provider.cli.exampleList"),command:"cortex auth provider list"}],labels:{usage:e("cmd.auth.cli.helpUsage"),commands:e("cmd.auth.cli.helpCommands"),options:e("cmd.auth.cli.helpOptions"),examples:e("cmd.auth.cli.helpExamples")}})}export{r as a,s as b,c,d,m as e,p as f,l as g,h,u as i,g as j};