@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
@@ -3732,9 +3732,9 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
3732
3732
  var wrapper_default = import_websocket.default;
3733
3733
 
3734
3734
  // src/client.ts
3735
- import * as fs6 from "fs";
3736
- import * as path5 from "path";
3737
- import * as os3 from "os";
3735
+ import * as fs7 from "fs";
3736
+ import * as path6 from "path";
3737
+ import * as os4 from "os";
3738
3738
  import { execFileSync as execFileSync3 } from "child_process";
3739
3739
 
3740
3740
  // src/agents-md-scanner.ts
@@ -3889,22 +3889,33 @@ function execBashBackground(command) {
3889
3889
  proc.unref();
3890
3890
  return { pid: proc.pid };
3891
3891
  }
3892
+ var EXIT_DRAIN_MS = 500;
3892
3893
  function monitorCommand(proc, stdout, stderr, timeoutMs) {
3894
+ const snapshot = (exitCode, note) => ({
3895
+ stdout: stdout.toString(),
3896
+ stderr: note ? joinStderr(stderr.toString(), note) : stderr.toString(),
3897
+ exitCode
3898
+ });
3893
3899
  return new Promise((resolve5) => {
3894
3900
  let settled = false;
3901
+ let drainTimer;
3895
3902
  const finish = (result) => {
3896
3903
  if (settled) return;
3897
3904
  settled = true;
3898
3905
  clearTimeout(timer);
3906
+ clearTimeout(drainTimer);
3899
3907
  resolve5(result);
3900
3908
  };
3901
3909
  const timer = setTimeout(() => {
3910
+ if (proc.exitCode !== null || proc.signalCode !== null) return finish(snapshot(proc.exitCode ?? 1));
3902
3911
  if (proc.pid) killCommandTree(proc.pid);
3903
- const message = `Command timed out after ${timeoutMs / 1e3}s`;
3904
- finish({ stdout: stdout.toString(), stderr: joinStderr(stderr.toString(), message), exitCode: 124 });
3912
+ finish(snapshot(124, `Command timed out after ${timeoutMs / 1e3}s`));
3905
3913
  }, timeoutMs);
3906
- proc.on("close", (code) => finish({ stdout: stdout.toString(), stderr: stderr.toString(), exitCode: code ?? 1 }));
3907
- proc.on("error", (error) => finish({ stdout: stdout.toString(), stderr: joinStderr(stderr.toString(), error.message), exitCode: 127 }));
3914
+ proc.on("exit", (code) => {
3915
+ if (!settled) drainTimer = setTimeout(() => finish(snapshot(code ?? 1)), EXIT_DRAIN_MS);
3916
+ });
3917
+ proc.on("close", (code) => finish(snapshot(code ?? 1)));
3918
+ proc.on("error", (error) => finish(snapshot(127, error.message)));
3908
3919
  });
3909
3920
  }
3910
3921
  function resolveBash(posixShell = "/bin/bash") {
@@ -4190,30 +4201,101 @@ function detectGpuCount(run = runNvidiaSmi) {
4190
4201
  return count;
4191
4202
  }
4192
4203
 
4204
+ // src/dir-list.ts
4205
+ import * as fs5 from "node:fs";
4206
+ import * as os3 from "node:os";
4207
+ import * as path4 from "node:path";
4208
+ var LIST_ENTRY_CAP = 500;
4209
+ var LOCAL_HOST = { platform: process.platform, homedir: os3.homedir() };
4210
+ var ERROR_TEXT = {
4211
+ ENOENT: "Directory not found",
4212
+ ENOTDIR: "Not a directory",
4213
+ EACCES: "Permission denied",
4214
+ EPERM: "Permission denied"
4215
+ };
4216
+ function flavor(host) {
4217
+ return host.platform === "win32" ? path4.win32 : path4.posix;
4218
+ }
4219
+ function windowsSpelling(raw) {
4220
+ const gitBash = raw.match(/^\/([A-Za-z])(?:\/(.*))?$/);
4221
+ if (gitBash) return `${gitBash[1].toUpperCase()}:\\${(gitBash[2] ?? "").replace(/\//g, "\\")}`;
4222
+ return /^[A-Za-z]:$/.test(raw) ? `${raw}\\` : raw;
4223
+ }
4224
+ function resolveListPath(input, host = LOCAL_HOST) {
4225
+ const p = flavor(host);
4226
+ const raw = input.trim();
4227
+ if (raw === "~") return p.resolve(host.homedir);
4228
+ if (/^~[\\/]/.test(raw)) return p.resolve(host.homedir, raw.slice(2));
4229
+ const spelled = host.platform === "win32" ? windowsSpelling(raw) : raw;
4230
+ if (!p.isAbsolute(spelled)) throw new Error(`Path must be absolute or start with ~: ${input}`);
4231
+ return p.resolve(spelled);
4232
+ }
4233
+ function parentOf(dir, host = LOCAL_HOST) {
4234
+ const parent = flavor(host).dirname(dir);
4235
+ return parent === dir ? null : parent;
4236
+ }
4237
+ async function kindOf(dir, dirent) {
4238
+ if (!dirent.isSymbolicLink()) return dirent.isDirectory() ? "dir" : "file";
4239
+ try {
4240
+ return (await fs5.promises.stat(path4.join(dir, dirent.name))).isDirectory() ? "dir" : "file";
4241
+ } catch {
4242
+ return "file";
4243
+ }
4244
+ }
4245
+ function compareEntries(a, b) {
4246
+ if (a.kind !== b.kind) return a.kind === "dir" ? -1 : 1;
4247
+ const hidden = Number(a.name.startsWith(".")) - Number(b.name.startsWith("."));
4248
+ return hidden || a.name.localeCompare(b.name);
4249
+ }
4250
+ async function readDirectory(dir) {
4251
+ try {
4252
+ return await fs5.promises.readdir(dir, { withFileTypes: true });
4253
+ } catch (error) {
4254
+ const text = ERROR_TEXT[error.code ?? ""];
4255
+ throw text ? new Error(`${text}: ${dir}`) : error;
4256
+ }
4257
+ }
4258
+ async function listDirectory(params, host = LOCAL_HOST) {
4259
+ const dir = resolveListPath(params.path, host);
4260
+ const dirents = await readDirectory(dir);
4261
+ const visible = params.showHidden ? dirents : dirents.filter((dirent) => !dirent.name.startsWith("."));
4262
+ const entries = await Promise.all(visible.map(async (dirent) => ({
4263
+ name: dirent.name,
4264
+ kind: await kindOf(dir, dirent)
4265
+ })));
4266
+ entries.sort(compareEntries);
4267
+ return {
4268
+ path: dir,
4269
+ parent: parentOf(dir, host),
4270
+ entries: entries.slice(0, LIST_ENTRY_CAP),
4271
+ truncated: entries.length > LIST_ENTRY_CAP
4272
+ };
4273
+ }
4274
+
4193
4275
  // src/self-update.ts
4194
- import * as fs5 from "fs";
4195
- import * as path4 from "path";
4276
+ import * as fs6 from "fs";
4277
+ import * as path5 from "path";
4196
4278
  import * as crypto from "crypto";
4197
4279
  import { spawn as spawn2 } from "child_process";
4198
4280
  var log3 = createLogger("self-update");
4199
- var CLIENT_INSTALL_DIR = path4.join(DATA_DIR, "client");
4281
+ var CLIENT_INSTALL_DIR = path5.join(DATA_DIR, "client");
4200
4282
  var BUNDLE_FILES = ["client.mjs", "cortex-run-watcher.mjs"];
4201
4283
  function hashBundleFiles(dir) {
4202
4284
  const h = crypto.createHash("sha256");
4203
4285
  for (const name of BUNDLE_FILES) {
4204
- const p = path4.join(dir, name);
4205
- if (!fs5.existsSync(p)) return null;
4206
- h.update(fs5.readFileSync(p));
4286
+ const p = path5.join(dir, name);
4287
+ if (!fs6.existsSync(p)) return null;
4288
+ h.update(fs6.readFileSync(p));
4207
4289
  }
4208
4290
  return h.digest("hex");
4209
4291
  }
4210
4292
  function computeSelfBundleHash(entryPath = process.argv[1]) {
4211
4293
  if (!entryPath) return "unknown";
4212
- const entry = path4.resolve(entryPath);
4213
- const setHash = hashBundleFiles(path4.dirname(entry));
4294
+ const entry = path5.resolve(entryPath);
4295
+ const setHash = hashBundleFiles(path5.dirname(entry));
4214
4296
  if (setHash) return setHash;
4215
4297
  try {
4216
- return `entry-${crypto.createHash("sha256").update(fs5.readFileSync(entry)).digest("hex")}`;
4298
+ return `entry-${crypto.createHash("sha256").update(fs6.readFileSync(entry)).digest("hex")}`;
4217
4299
  } catch {
4218
4300
  return "unknown";
4219
4301
  }
@@ -4229,18 +4311,18 @@ function validateUpdateMessage(msg) {
4229
4311
  return null;
4230
4312
  }
4231
4313
  function swapDirs(root) {
4232
- const next = path4.join(root, "next");
4233
- const current = path4.join(root, "current");
4234
- const previous = path4.join(root, "previous");
4235
- fs5.rmSync(previous, { recursive: true, force: true });
4236
- const hadCurrent = fs5.existsSync(current);
4237
- if (hadCurrent) fs5.renameSync(current, previous);
4314
+ const next = path5.join(root, "next");
4315
+ const current = path5.join(root, "current");
4316
+ const previous = path5.join(root, "previous");
4317
+ fs6.rmSync(previous, { recursive: true, force: true });
4318
+ const hadCurrent = fs6.existsSync(current);
4319
+ if (hadCurrent) fs6.renameSync(current, previous);
4238
4320
  try {
4239
- fs5.renameSync(next, current);
4321
+ fs6.renameSync(next, current);
4240
4322
  } catch (err) {
4241
4323
  if (hadCurrent) {
4242
4324
  try {
4243
- fs5.renameSync(previous, current);
4325
+ fs6.renameSync(previous, current);
4244
4326
  } catch {
4245
4327
  }
4246
4328
  }
@@ -4263,16 +4345,16 @@ function handleUpdateMessage(msg, io) {
4263
4345
  return;
4264
4346
  }
4265
4347
  try {
4266
- const next = path4.join(CLIENT_INSTALL_DIR, "next");
4267
- fs5.rmSync(next, { recursive: true, force: true });
4268
- fs5.mkdirSync(next, { recursive: true });
4348
+ const next = path5.join(CLIENT_INSTALL_DIR, "next");
4349
+ fs6.rmSync(next, { recursive: true, force: true });
4350
+ fs6.mkdirSync(next, { recursive: true });
4269
4351
  for (const name of BUNDLE_FILES) {
4270
4352
  const file = msg.files.find((f) => f.name === name);
4271
- fs5.writeFileSync(path4.join(next, name), Buffer.from(file.data, "base64"), { mode: 493 });
4353
+ fs6.writeFileSync(path5.join(next, name), Buffer.from(file.data, "base64"), { mode: 493 });
4272
4354
  }
4273
4355
  const got = hashBundleFiles(next);
4274
4356
  if (got !== msg.hash) {
4275
- fs5.rmSync(next, { recursive: true, force: true });
4357
+ fs6.rmSync(next, { recursive: true, force: true });
4276
4358
  io.sendResult(false, `hash mismatch: expected ${msg.hash}, got ${got}`);
4277
4359
  return;
4278
4360
  }
@@ -4290,7 +4372,7 @@ function handleUpdateMessage(msg, io) {
4290
4372
  }
4291
4373
  setTimeout(() => {
4292
4374
  try {
4293
- io.respawn(path4.join(CLIENT_INSTALL_DIR, "current", "client.mjs"));
4375
+ io.respawn(path5.join(CLIENT_INSTALL_DIR, "current", "client.mjs"));
4294
4376
  } catch (err) {
4295
4377
  log3.error(`Respawn failed: ${err.message}`);
4296
4378
  }
@@ -4299,6 +4381,83 @@ function handleUpdateMessage(msg, io) {
4299
4381
  }, 400);
4300
4382
  }
4301
4383
 
4384
+ // src/result-outbox.ts
4385
+ var OPEN = 1;
4386
+ var RESEND_WINDOW_MS = 9e4;
4387
+ var UNDELIVERED_TTL_MS = 5 * 6e4;
4388
+ var MAX_UNDELIVERED = 64;
4389
+ var ResultOutbox = class {
4390
+ constructor(now = Date.now) {
4391
+ this.now = now;
4392
+ }
4393
+ now;
4394
+ running = /* @__PURE__ */ new Set();
4395
+ undelivered = /* @__PURE__ */ new Map();
4396
+ sent = /* @__PURE__ */ new Map();
4397
+ begin(commandId) {
4398
+ this.running.add(commandId);
4399
+ }
4400
+ /** Deliver a finished command's result on `socket`, or keep it for the next connection. */
4401
+ deliver(frame, socket) {
4402
+ this.running.delete(frame.commandId);
4403
+ this.send({ frame, at: this.now() }, socket);
4404
+ }
4405
+ /** Commands the server should keep pending: still running, or finished but not delivered. */
4406
+ pendingIds() {
4407
+ this.expire();
4408
+ return [...this.running, ...this.undelivered.keys()];
4409
+ }
4410
+ /** Send everything kept, on a socket that has just said hello. */
4411
+ flush(socket) {
4412
+ this.expire();
4413
+ const entries = [...this.undelivered.values()];
4414
+ this.undelivered.clear();
4415
+ for (const entry of entries) this.send(entry, socket);
4416
+ }
4417
+ /** `socket` closed: what it sent moments ago may never have arrived. */
4418
+ socketClosed(socket) {
4419
+ const cutoff = this.now() - RESEND_WINDOW_MS;
4420
+ for (const entry of this.sent.get(socket) ?? []) {
4421
+ if (entry.sentAt >= cutoff) this.keep({ frame: entry.frame, at: entry.at });
4422
+ }
4423
+ this.sent.delete(socket);
4424
+ }
4425
+ send(entry, socket) {
4426
+ if (!socket || socket.readyState !== OPEN) {
4427
+ this.keep(entry);
4428
+ return;
4429
+ }
4430
+ try {
4431
+ socket.send(JSON.stringify(entry.frame), (err) => {
4432
+ if (err) this.keep(entry);
4433
+ });
4434
+ } catch {
4435
+ this.keep(entry);
4436
+ return;
4437
+ }
4438
+ this.recordSent(socket, entry);
4439
+ }
4440
+ recordSent(socket, entry) {
4441
+ const now = this.now();
4442
+ const recent = (this.sent.get(socket) ?? []).filter((e) => e.sentAt >= now - RESEND_WINDOW_MS);
4443
+ recent.push({ ...entry, sentAt: now });
4444
+ this.sent.set(socket, recent);
4445
+ }
4446
+ keep(entry) {
4447
+ this.undelivered.delete(entry.frame.commandId);
4448
+ this.undelivered.set(entry.frame.commandId, entry);
4449
+ while (this.undelivered.size > MAX_UNDELIVERED) {
4450
+ this.undelivered.delete(this.undelivered.keys().next().value);
4451
+ }
4452
+ }
4453
+ expire() {
4454
+ const cutoff = this.now() - UNDELIVERED_TTL_MS;
4455
+ for (const [id, entry] of this.undelivered) {
4456
+ if (entry.at < cutoff) this.undelivered.delete(id);
4457
+ }
4458
+ }
4459
+ };
4460
+
4302
4461
  // src/client.ts
4303
4462
  var log4 = createLogger("cortex-client");
4304
4463
  function getClientHelp() {
@@ -4309,7 +4468,7 @@ function getClientHelp() {
4309
4468
  "",
4310
4469
  "cortex-client is a daemon-style worker that the agent-server starts.",
4311
4470
  "Configuration is read from",
4312
- ` ${path5.join(CONFIG_DIR, "cortex-client.json")}`,
4471
+ ` ${path6.join(CONFIG_DIR, "cortex-client.json")}`,
4313
4472
  "which is written by the server's bootstrap script (from agent-server/ in a",
4314
4473
  "source checkout: node --import tsx src/domain/remote/client-bootstrap.ts),",
4315
4474
  "by `cortex init` for a local desktop install, or by hand. There are no",
@@ -4326,7 +4485,7 @@ function getClientHelp() {
4326
4485
  "",
4327
4486
  "Behavior:",
4328
4487
  " \u2022 Opens a WebSocket to CORTEX_SERVER_URL, else serverUrl, else ws://<serverHost>:<serverPort>.",
4329
- " \u2022 Receives bash/read/write/edit/glob/grep commands.",
4488
+ " \u2022 Receives bash/read/write/edit/glob/grep/list commands.",
4330
4489
  " \u2022 Exits if the server rejects the handshake (e.g. device already connected).",
4331
4490
  " \u2022 Reconnects automatically on transient disconnects.",
4332
4491
  "",
@@ -4340,9 +4499,9 @@ if (process.argv.slice(2).some((a) => a === "--help" || a === "-h")) {
4340
4499
  process.exit(0);
4341
4500
  }
4342
4501
  function loadConfig() {
4343
- const configPath = path5.join(CONFIG_DIR, "cortex-client.json");
4502
+ const configPath = path6.join(CONFIG_DIR, "cortex-client.json");
4344
4503
  try {
4345
- const raw = fs6.readFileSync(configPath, "utf8");
4504
+ const raw = fs7.readFileSync(configPath, "utf8");
4346
4505
  const cfg = JSON.parse(raw);
4347
4506
  if (!cfg.serverHost && !cfg.serverUrl && !process.env.CORTEX_SERVER_URL) {
4348
4507
  throw new Error("Missing serverHost (or provide serverUrl / CORTEX_SERVER_URL)");
@@ -4350,7 +4509,7 @@ function loadConfig() {
4350
4509
  return {
4351
4510
  // Full WS URL (tunnel route). env CORTEX_SERVER_URL > config serverUrl > ws://host:port.
4352
4511
  serverUrl: resolveServerUrl(cfg, process.env),
4353
- deviceName: cfg.deviceName || os3.hostname(),
4512
+ deviceName: cfg.deviceName || os4.hostname(),
4354
4513
  // WS bearer token required by the agent-server gate; env overrides config (see auth-headers.ts).
4355
4514
  clientToken: resolveClientToken(cfg, process.env)
4356
4515
  };
@@ -4443,7 +4602,7 @@ function extractImageDimensions(buf, mime) {
4443
4602
  return null;
4444
4603
  }
4445
4604
  function detectCapabilities() {
4446
- const caps = ["file-stream"];
4605
+ const caps = ["file-stream", "fs-list"];
4447
4606
  try {
4448
4607
  execFileSync3("rg", ["--version"], { timeout: 5e3, stdio: "pipe", windowsHide: true });
4449
4608
  caps.push("rg");
@@ -4470,20 +4629,20 @@ function safeScanAgentsMDs(filePath) {
4470
4629
  function handleRead(params) {
4471
4630
  try {
4472
4631
  const filePath = normalizePath(params.file_path);
4473
- if (!path5.isAbsolute(filePath)) {
4632
+ if (!path6.isAbsolute(filePath)) {
4474
4633
  return { error: "file_path must be absolute" };
4475
4634
  }
4476
- if (!fs6.existsSync(filePath)) {
4635
+ if (!fs7.existsSync(filePath)) {
4477
4636
  return { error: `File not found: ${filePath}` };
4478
4637
  }
4479
- const stat = fs6.statSync(filePath);
4638
+ const stat = fs7.statSync(filePath);
4480
4639
  if (!stat.isFile()) {
4481
4640
  return { error: `Not a file: ${filePath}` };
4482
4641
  }
4483
4642
  if (stat.size > MAX_READ_FILE_SIZE) {
4484
4643
  return { error: `File too large (${(stat.size / 1024 / 1024).toFixed(1)}MB, max 10MB). Use offset and limit for range reading.` };
4485
4644
  }
4486
- const rawBuf = fs6.readFileSync(filePath);
4645
+ const rawBuf = fs7.readFileSync(filePath);
4487
4646
  const cortexMDs = safeScanAgentsMDs(filePath);
4488
4647
  const imageType = detectImageType(rawBuf);
4489
4648
  if (imageType) {
@@ -4523,14 +4682,14 @@ function handleRead(params) {
4523
4682
  function handleFileStat(params) {
4524
4683
  try {
4525
4684
  const filePath = normalizePath(params.file_path);
4526
- if (!path5.isAbsolute(filePath)) {
4685
+ if (!path6.isAbsolute(filePath)) {
4527
4686
  return { error: "file_path must be absolute" };
4528
4687
  }
4529
- const stat = fs6.statSync(filePath);
4688
+ const stat = fs7.statSync(filePath);
4530
4689
  if (!stat.isFile()) {
4531
4690
  return { error: `Not a file: ${filePath}` };
4532
4691
  }
4533
- return { size: stat.size, name: path5.basename(filePath), mtimeMs: stat.mtimeMs };
4692
+ return { size: stat.size, name: path6.basename(filePath), mtimeMs: stat.mtimeMs };
4534
4693
  } catch (err) {
4535
4694
  const e = err;
4536
4695
  if (e.code === "ENOENT") return { error: `File not found: ${params.file_path}` };
@@ -4540,15 +4699,15 @@ function handleFileStat(params) {
4540
4699
  function handleWrite(params) {
4541
4700
  try {
4542
4701
  const filePath = normalizePath(params.file_path);
4543
- if (!path5.isAbsolute(filePath)) {
4702
+ if (!path6.isAbsolute(filePath)) {
4544
4703
  return { error: "file_path must be absolute" };
4545
4704
  }
4546
- const dir = path5.dirname(filePath);
4547
- fs6.mkdirSync(dir, { recursive: true });
4705
+ const dir = path6.dirname(filePath);
4706
+ fs7.mkdirSync(dir, { recursive: true });
4548
4707
  let content = params.content;
4549
- if (fs6.existsSync(filePath)) {
4708
+ if (fs7.existsSync(filePath)) {
4550
4709
  try {
4551
- const existing = fs6.readFileSync(filePath, "utf8");
4710
+ const existing = fs7.readFileSync(filePath, "utf8");
4552
4711
  const lineEnding = detectLineEnding(existing);
4553
4712
  if (lineEnding === "\r\n") {
4554
4713
  content = content.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
@@ -4556,7 +4715,7 @@ function handleWrite(params) {
4556
4715
  } catch {
4557
4716
  }
4558
4717
  }
4559
- fs6.writeFileSync(filePath, content, "utf8");
4718
+ fs7.writeFileSync(filePath, content, "utf8");
4560
4719
  return {
4561
4720
  success: true,
4562
4721
  cortexMDs: safeScanAgentsMDs(filePath)
@@ -4568,10 +4727,10 @@ function handleWrite(params) {
4568
4727
  function handleEdit(params) {
4569
4728
  try {
4570
4729
  const filePath = normalizePath(params.file_path);
4571
- if (!path5.isAbsolute(filePath)) {
4730
+ if (!path6.isAbsolute(filePath)) {
4572
4731
  return { error: "file_path must be absolute" };
4573
4732
  }
4574
- const rawBuf = fs6.readFileSync(filePath);
4733
+ const rawBuf = fs7.readFileSync(filePath);
4575
4734
  const encoding = detectEncoding(rawBuf);
4576
4735
  const rawContent = rawBuf.toString(encoding);
4577
4736
  const originalLineEnding = detectLineEnding(rawContent);
@@ -4591,7 +4750,7 @@ function handleEdit(params) {
4591
4750
  }
4592
4751
  const result2 = content.split(oldStr).join(newStr);
4593
4752
  const final2 = originalLineEnding === "\r\n" ? result2.replace(/\n/g, "\r\n") : result2;
4594
- fs6.writeFileSync(filePath, final2, encoding);
4753
+ fs7.writeFileSync(filePath, final2, encoding);
4595
4754
  return buildResult();
4596
4755
  }
4597
4756
  const firstIdx = content.indexOf(oldStr);
@@ -4604,7 +4763,7 @@ function handleEdit(params) {
4604
4763
  }
4605
4764
  const result = content.replace(oldStr, () => newStr);
4606
4765
  const final = originalLineEnding === "\r\n" ? result.replace(/\n/g, "\r\n") : result;
4607
- fs6.writeFileSync(filePath, final, encoding);
4766
+ fs7.writeFileSync(filePath, final, encoding);
4608
4767
  return buildResult();
4609
4768
  } catch (err) {
4610
4769
  return { error: err.message };
@@ -4616,7 +4775,7 @@ async function handleGlob(params) {
4616
4775
  try {
4617
4776
  const pattern = params.pattern;
4618
4777
  const cwd = normalizePath(params.path || (PLATFORM === "win32" ? "C:\\" : process.cwd()));
4619
- if (!fs6.existsSync(cwd)) {
4778
+ if (!fs7.existsSync(cwd)) {
4620
4779
  return { error: `Directory not found: ${cwd}` };
4621
4780
  }
4622
4781
  const shell = resolveBash("bash");
@@ -4641,9 +4800,9 @@ function formatGlobResult(result, cwd) {
4641
4800
  let files = result.stdout.trim().split("\n").filter(Boolean);
4642
4801
  const truncated = files.length > GLOB_MAX_RESULTS;
4643
4802
  if (truncated) files = files.slice(0, GLOB_MAX_RESULTS);
4644
- files = files.map((f) => path5.isAbsolute(f) ? f : path5.resolve(cwd, f));
4803
+ files = files.map((f) => path6.isAbsolute(f) ? f : path6.resolve(cwd, f));
4645
4804
  files = files.filter((f) => {
4646
- const parts = path5.relative(cwd, f).split(path5.sep);
4805
+ const parts = path6.relative(cwd, f).split(path6.sep);
4647
4806
  return !parts.some((p) => VCS_DIRS.has(p));
4648
4807
  });
4649
4808
  return { files, truncated };
@@ -4717,6 +4876,7 @@ async function handleGrep(params) {
4717
4876
  function settle(result) {
4718
4877
  return result.error ? { success: false, error: result.error } : { success: true, data: result };
4719
4878
  }
4879
+ var MAX_BASH_TIMEOUT_MS = 30 * 6e4;
4720
4880
  async function handleBashCommand(params) {
4721
4881
  if (params.run_in_background) {
4722
4882
  const { pid } = execBashBackground(params.command);
@@ -4725,7 +4885,7 @@ async function handleBashCommand(params) {
4725
4885
  data: { stdout: `Background process started with PID ${pid}`, stderr: "", exitCode: 0 }
4726
4886
  };
4727
4887
  }
4728
- const timeout = Math.min(params.timeout || 12e4, 6e5);
4888
+ const timeout = Math.min(params.timeout || 12e4, MAX_BASH_TIMEOUT_MS);
4729
4889
  return { success: true, data: await execBash(params.command, timeout) };
4730
4890
  }
4731
4891
  var COMMAND_HANDLERS = {
@@ -4735,7 +4895,8 @@ var COMMAND_HANDLERS = {
4735
4895
  write: async (params) => settle(handleWrite(params)),
4736
4896
  edit: async (params) => settle(handleEdit(params)),
4737
4897
  glob: async (params) => settle(await handleGlob(params)),
4738
- grep: async (params) => settle(await handleGrep(params))
4898
+ grep: async (params) => settle(await handleGrep(params)),
4899
+ list: async (params) => ({ success: true, data: await listDirectory(params) })
4739
4900
  };
4740
4901
  async function handleCommand(action, params) {
4741
4902
  if (!Object.hasOwn(COMMAND_HANDLERS, action)) return { success: false, error: `Unknown action: ${action}` };
@@ -4745,19 +4906,21 @@ var ws = null;
4745
4906
  var heartbeatTimer = null;
4746
4907
  var reconnectDelay = 1e3;
4747
4908
  var MAX_RECONNECT_DELAY = 3e4;
4909
+ var HANDSHAKE_TIMEOUT_MS = 15e3;
4910
+ var outbox = new ResultOutbox();
4748
4911
  function sendFrame(socket, frame) {
4749
4912
  if (socket && socket.readyState === wrapper_default.OPEN) socket.send(JSON.stringify(frame));
4750
4913
  }
4751
4914
  async function runCommand(frame) {
4752
- const currentWs = ws;
4753
4915
  log4.info(`Executing ${frame.action}: ${JSON.stringify(frame.params).substring(0, 100)}`);
4916
+ outbox.begin(frame.commandId);
4754
4917
  let outcome;
4755
4918
  try {
4756
4919
  outcome = await handleCommand(frame.action, frame.params || {});
4757
4920
  } catch (err) {
4758
4921
  outcome = { success: false, error: err.message };
4759
4922
  }
4760
- sendFrame(currentWs, { type: "result", commandId: frame.commandId, ...outcome });
4923
+ outbox.deliver({ type: "result", commandId: frame.commandId, ...outcome }, ws);
4761
4924
  }
4762
4925
  function applyUpdate(frame) {
4763
4926
  const currentWs = ws;
@@ -4784,7 +4947,8 @@ function connect2() {
4784
4947
  const url = SERVER_URL;
4785
4948
  const headers = buildClientHeaders(CLIENT_TOKEN);
4786
4949
  log4.info(`Connecting to ${url} as "${DEVICE_NAME}" (${PLATFORM})${headers ? " [token]" : " [no-token]"}...`);
4787
- ws = headers ? new wrapper_default(url, { headers }) : new wrapper_default(url);
4950
+ const socket = new wrapper_default(url, { ...headers ? { headers } : {}, handshakeTimeout: HANDSHAKE_TIMEOUT_MS });
4951
+ ws = socket;
4788
4952
  ws.on("open", () => {
4789
4953
  log4.info(`Connected to server`);
4790
4954
  reconnectDelay = 1e3;
@@ -4797,8 +4961,10 @@ function connect2() {
4797
4961
  capabilities,
4798
4962
  gpuCount,
4799
4963
  bundleHash: BUNDLE_HASH,
4800
- pid: process.pid
4964
+ pid: process.pid,
4965
+ inflight: outbox.pendingIds()
4801
4966
  });
4967
+ outbox.flush(socket);
4802
4968
  if (heartbeatTimer) clearInterval(heartbeatTimer);
4803
4969
  heartbeatTimer = setInterval(() => {
4804
4970
  sendFrame(ws, { type: "heartbeat", device: DEVICE_NAME, timestamp: Date.now() });
@@ -4834,6 +5000,7 @@ function connect2() {
4834
5000
  });
4835
5001
  ws.on("close", (code, reason) => {
4836
5002
  log4.info(`Disconnected (code=${code}, reason=${reason?.toString() || "none"})`);
5003
+ outbox.socketClosed(socket);
4837
5004
  cleanup();
4838
5005
  if (code === 4002 || code === 4005) {
4839
5006
  const rejection = code === 4005 ? "unknown device" : "device already connected";
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "version": "2026.10.15",
3
- "hash": "5d65a73b0d64ed8b1d19a3e0ddec8ff58a60df244e0d7525006068f7d3469340",
4
- "source": "f55d8b21eccc3eeddcb3a3cfbbc5853e75e76f30"
3
+ "hash": "adbad698b41c837115e736880206de4c9f6148dbd5745bd244d61ecddb7bc91e",
4
+ "source": "5c345caf1795904f343b8151030a31a31ac6ffd3"
5
5
  }
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __cortexCreateRequire } from 'node:module';
2
2
  const require = __cortexCreateRequire(import.meta.url);
3
3
  const __cortexPackageRoot = new URL("../../", import.meta.url);
4
- import{a,b,c,d,e,f}from"../chunks/chunk-VK5J556O.js";import"../chunks/chunk-VBN2JSER.js";import"../chunks/chunk-Z24SBRJK.js";import"../chunks/chunk-VPVSKJGX.js";import"../chunks/chunk-WHC7AYZD.js";export{b as loadPiDefaultModels,a as loadPiSdk,d as piUserAgentDir,e as piUserAuthPath,f as piUserModelsPath,c as prewarmPiSdk};
4
+ import{a,b,c,d,e,f}from"../chunks/chunk-B3NB243Z.js";import"../chunks/chunk-7W7VYUTK.js";import"../chunks/chunk-T54CZKNJ.js";import"../chunks/chunk-WHC7AYZD.js";export{b as loadPiDefaultModels,a as loadPiSdk,d as piUserAgentDir,e as piUserAuthPath,f as piUserModelsPath,c as prewarmPiSdk};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __cortexCreateRequire } from 'node:module';
2
2
  const require = __cortexCreateRequire(import.meta.url);
3
3
  const __cortexPackageRoot = new URL("../../../", import.meta.url);
4
- import{m as a,n as b,o as c,p as d,q as e}from"../../chunks/chunk-V6X7Y62J.js";import"../../chunks/chunk-3CPIMAYX.js";import"../../chunks/chunk-VBN2JSER.js";import"../../chunks/chunk-Z24SBRJK.js";import"../../chunks/chunk-VPVSKJGX.js";import"../../chunks/chunk-WHC7AYZD.js";export{a as ClaudeAuthCliError,b as buildClaudeAuthEnv,d as loginClaudeAuth,e as logoutClaudeAuth,c as readClaudeAuthStatus};
4
+ import{m as a,n as b,o as c,p as d,q as e}from"../../chunks/chunk-3O6ZG5HA.js";import"../../chunks/chunk-7GGPYU5E.js";import"../../chunks/chunk-7W7VYUTK.js";import"../../chunks/chunk-T54CZKNJ.js";import"../../chunks/chunk-WHC7AYZD.js";export{a as ClaudeAuthCliError,b as buildClaudeAuthEnv,d as loginClaudeAuth,e as logoutClaudeAuth,c as readClaudeAuthStatus};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __cortexCreateRequire } from 'node:module';
2
2
  const require = __cortexCreateRequire(import.meta.url);
3
3
  const __cortexPackageRoot = new URL("../../../", import.meta.url);
4
- import{a,b,c,d}from"../../chunks/chunk-OFEPDNRB.js";import"../../chunks/chunk-UT6DGZDO.js";import"../../chunks/chunk-ETIBCA2S.js";import"../../chunks/chunk-WZYS2HAK.js";import"../../chunks/chunk-TMV2ZDOI.js";import"../../chunks/chunk-5T7IX5KN.js";import"../../chunks/chunk-OKRK6JPY.js";import"../../chunks/chunk-OE4KH3NJ.js";import"../../chunks/chunk-QUXPMNFQ.js";import"../../chunks/chunk-NRD57ICT.js";import"../../chunks/chunk-KRXTI4JO.js";import"../../chunks/chunk-W34AK4SK.js";import"../../chunks/chunk-VBN2JSER.js";import"../../chunks/chunk-NXZS5PEW.js";import"../../chunks/chunk-Z24SBRJK.js";import"../../chunks/chunk-VPVSKJGX.js";import"../../chunks/chunk-WHC7AYZD.js";export{b as createBundledServer,a as loadBundleRegistrars,d as openBundledMcpServer,c as startServer};
4
+ import{a,b,c,d}from"../../chunks/chunk-CMSOOLJB.js";import"../../chunks/chunk-ZNAMETPQ.js";import"../../chunks/chunk-4KQHDDC5.js";import"../../chunks/chunk-QXFWIL4C.js";import"../../chunks/chunk-Y6ZEVVL5.js";import"../../chunks/chunk-WZYS2HAK.js";import"../../chunks/chunk-TMV2ZDOI.js";import"../../chunks/chunk-5T7IX5KN.js";import"../../chunks/chunk-OKRK6JPY.js";import"../../chunks/chunk-52VCLZS5.js";import"../../chunks/chunk-BVEDNESB.js";import"../../chunks/chunk-R2CCD4OF.js";import"../../chunks/chunk-KRXTI4JO.js";import"../../chunks/chunk-W34AK4SK.js";import"../../chunks/chunk-7W7VYUTK.js";import"../../chunks/chunk-JGUEIW2W.js";import"../../chunks/chunk-T54CZKNJ.js";import"../../chunks/chunk-WHC7AYZD.js";export{b as createBundledServer,a as loadBundleRegistrars,d as openBundledMcpServer,c as startServer};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __cortexCreateRequire } from 'node:module';
2
2
  const require = __cortexCreateRequire(import.meta.url);
3
3
  const __cortexPackageRoot = new URL("../../../../", import.meta.url);
4
- import{c as m}from"../../../chunks/chunk-JKL3AK5D.js";import"../../../chunks/chunk-LP72AF56.js";import"../../../chunks/chunk-N6BTQN7R.js";import"../../../chunks/chunk-SAJD4EKE.js";import{k as p}from"../../../chunks/chunk-P7TVR4GY.js";import"../../../chunks/chunk-Z24SBRJK.js";import"../../../chunks/chunk-VPVSKJGX.js";import"../../../chunks/chunk-WHC7AYZD.js";var c=null;function t(){return c||(c=m()),c}var S={error:(...e)=>console.error("[lark:error]",...e),warn:(...e)=>console.error("[lark:warn]",...e),info:(...e)=>console.error("[lark:info]",...e),debug:(...e)=>console.error("[lark:debug]",...e),trace:(...e)=>console.error("[lark:trace]",...e)};function I(e){let r=e.domain==="lark"?t().Domain.Lark:t().Domain.Feishu;return new(t()).Client({appId:e.appId,appSecret:e.appSecret,appType:t().AppType.SelfBuild,domain:r,logger:S,loggerLevel:t().LoggerLevel.warn})}function w(e,r){let o=a=>new Proxy(a,{get(l,s,u){let n=Reflect.get(l,s,u);return typeof n=="function"?(d,i)=>r().then(f=>{let k=t().withUserAccessToken(f),g={...i??{},lark:{...i?.lark??{},...k.lark}};return n.call(l,d,g)}):n&&typeof n=="object"?o(n):n}});return o(e)}function F(e=process.env){let r=e.FEISHU_APP_ID,o=e.FEISHU_APP_SECRET;if(!r||!o)return null;let a=e.FEISHU_DOMAIN||void 0,l=I({appId:r,appSecret:o,domain:a});return e.FEISHU_AUTH_MODE==="user"?w(l,()=>p({appId:r,appSecret:o,domain:a})):l}export{F as buildFeishuClientFromEnv,I as createFeishuClient,S as stderrLogger,w as wrapWithUserToken};
4
+ import{c as m}from"../../../chunks/chunk-JKL3AK5D.js";import"../../../chunks/chunk-LP72AF56.js";import"../../../chunks/chunk-N6BTQN7R.js";import"../../../chunks/chunk-SAJD4EKE.js";import{k as p}from"../../../chunks/chunk-NHHR4DCF.js";import"../../../chunks/chunk-T54CZKNJ.js";import"../../../chunks/chunk-WHC7AYZD.js";var c=null;function t(){return c||(c=m()),c}var S={error:(...e)=>console.error("[lark:error]",...e),warn:(...e)=>console.error("[lark:warn]",...e),info:(...e)=>console.error("[lark:info]",...e),debug:(...e)=>console.error("[lark:debug]",...e),trace:(...e)=>console.error("[lark:trace]",...e)};function I(e){let r=e.domain==="lark"?t().Domain.Lark:t().Domain.Feishu;return new(t()).Client({appId:e.appId,appSecret:e.appSecret,appType:t().AppType.SelfBuild,domain:r,logger:S,loggerLevel:t().LoggerLevel.warn})}function w(e,r){let o=a=>new Proxy(a,{get(l,s,u){let n=Reflect.get(l,s,u);return typeof n=="function"?(d,i)=>r().then(f=>{let k=t().withUserAccessToken(f),g={...i??{},lark:{...i?.lark??{},...k.lark}};return n.call(l,d,g)}):n&&typeof n=="object"?o(n):n}});return o(e)}function F(e=process.env){let r=e.FEISHU_APP_ID,o=e.FEISHU_APP_SECRET;if(!r||!o)return null;let a=e.FEISHU_DOMAIN||void 0,l=I({appId:r,appSecret:o,domain:a});return e.FEISHU_AUTH_MODE==="user"?w(l,()=>p({appId:r,appSecret:o,domain:a})):l}export{F as buildFeishuClientFromEnv,I as createFeishuClient,S as stderrLogger,w as wrapWithUserToken};