@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
@@ -23,9 +23,10 @@ cp permission-gate.ts ~/.pi/agent/extensions/
23
23
  | `protected-paths.ts` | Blocks writes to protected paths (.env, .git/, node_modules/) |
24
24
  | `confirm-destructive.ts` | Confirms before destructive session actions (clear, switch, fork) |
25
25
  | `dirty-repo-guard.ts` | Prevents session changes with uncommitted git changes |
26
- | `sandbox/` | OS-level sandboxing using `@anthropic-ai/sandbox-runtime` with per-project config |
27
26
  | `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM |
28
27
 
28
+ For isolation setup and limitations, see [Run Pi in an isolated environment](../../docs/containerization.md).
29
+
29
30
  ### Custom Tools
30
31
 
31
32
  | Extension | Description |
@@ -42,7 +42,7 @@ import {
42
42
  type TextContent,
43
43
  type ThinkingContent,
44
44
  type Tool,
45
- type ToolCall,
45
+ ToolCallArgumentsStream,
46
46
  type ToolResultMessage,
47
47
  type TranscriptContext,
48
48
  } from "@earendil-works/pi-ai";
@@ -454,8 +454,9 @@ function streamCustomAnthropic(
454
454
  const anthropicStream = client.messages.stream({ ...params }, { signal: options?.signal });
455
455
  stream.push({ type: "start", partial: output });
456
456
 
457
- type Block = (ThinkingContent | TextContent | (ToolCall & { partialJson: string })) & { index: number };
458
- const blocks = output.content as Block[];
457
+ // Stream state per Anthropic block index, kept off the content blocks so it never reaches partial messages.
458
+ // ToolCallArgumentsStream reads each argument delta once and shows the arguments parsed so far.
459
+ const openBlocks = new Map<number, { contentIndex: number; arguments?: ToolCallArgumentsStream }>();
459
460
 
460
461
  for await (const event of anthropicStream) {
461
462
  if (event.type === "message_start") {
@@ -468,15 +469,12 @@ function streamCustomAnthropic(
468
469
  calculateCost(model, output.usage);
469
470
  } else if (event.type === "content_block_start") {
470
471
  if (event.content_block.type === "text") {
471
- output.content.push({ type: "text", text: "", index: event.index } as any);
472
+ output.content.push({ type: "text", text: "" });
473
+ openBlocks.set(event.index, { contentIndex: output.content.length - 1 });
472
474
  stream.push({ type: "text_start", contentIndex: output.content.length - 1, partial: output });
473
475
  } else if (event.content_block.type === "thinking") {
474
- output.content.push({
475
- type: "thinking",
476
- thinking: "",
477
- thinkingSignature: "",
478
- index: event.index,
479
- } as any);
476
+ output.content.push({ type: "thinking", thinking: "", thinkingSignature: "" });
477
+ openBlocks.set(event.index, { contentIndex: output.content.length - 1 });
480
478
  stream.push({ type: "thinking_start", contentIndex: output.content.length - 1, partial: output });
481
479
  } else if (event.content_block.type === "tool_use") {
482
480
  output.content.push({
@@ -484,15 +482,18 @@ function streamCustomAnthropic(
484
482
  id: event.content_block.id,
485
483
  name: isOAuth ? fromClaudeCodeName(event.content_block.name, tools) : event.content_block.name,
486
484
  arguments: {},
487
- partialJson: "",
488
- index: event.index,
489
- } as any);
485
+ });
486
+ openBlocks.set(event.index, {
487
+ contentIndex: output.content.length - 1,
488
+ arguments: new ToolCallArgumentsStream(),
489
+ });
490
490
  stream.push({ type: "toolcall_start", contentIndex: output.content.length - 1, partial: output });
491
491
  }
492
492
  } else if (event.type === "content_block_delta") {
493
- const index = blocks.findIndex((b) => b.index === event.index);
494
- const block = blocks[index];
495
- if (!block) continue;
493
+ const open = openBlocks.get(event.index);
494
+ if (!open) continue;
495
+ const index = open.contentIndex;
496
+ const block = output.content[index]!;
496
497
 
497
498
  if (event.delta.type === "text_delta" && block.type === "text") {
498
499
  block.text += event.delta.text;
@@ -505,11 +506,8 @@ function streamCustomAnthropic(
505
506
  delta: event.delta.thinking,
506
507
  partial: output,
507
508
  });
508
- } else if (event.delta.type === "input_json_delta" && block.type === "toolCall") {
509
- (block as any).partialJson += event.delta.partial_json;
510
- try {
511
- block.arguments = JSON.parse((block as any).partialJson);
512
- } catch {}
509
+ } else if (event.delta.type === "input_json_delta" && block.type === "toolCall" && open.arguments) {
510
+ block.arguments = open.arguments.append(event.delta.partial_json);
513
511
  stream.push({
514
512
  type: "toolcall_delta",
515
513
  contentIndex: index,
@@ -520,20 +518,19 @@ function streamCustomAnthropic(
520
518
  block.thinkingSignature = (block.thinkingSignature || "") + (event.delta as any).signature;
521
519
  }
522
520
  } else if (event.type === "content_block_stop") {
523
- const index = blocks.findIndex((b) => b.index === event.index);
524
- const block = blocks[index];
525
- if (!block) continue;
521
+ const open = openBlocks.get(event.index);
522
+ if (!open) continue;
523
+ openBlocks.delete(event.index);
524
+ const index = open.contentIndex;
525
+ const block = output.content[index]!;
526
526
 
527
- delete (block as any).index;
528
527
  if (block.type === "text") {
529
528
  stream.push({ type: "text_end", contentIndex: index, content: block.text, partial: output });
530
529
  } else if (block.type === "thinking") {
531
530
  stream.push({ type: "thinking_end", contentIndex: index, content: block.thinking, partial: output });
532
- } else if (block.type === "toolCall") {
533
- try {
534
- block.arguments = JSON.parse((block as any).partialJson);
535
- } catch {}
536
- delete (block as any).partialJson;
531
+ } else if (block.type === "toolCall" && open.arguments) {
532
+ // One full parse of the complete text; malformed arguments are reported in `argumentsError`.
533
+ Object.assign(block, open.arguments.finish());
537
534
  stream.push({ type: "toolcall_end", contentIndex: index, toolCall: block, partial: output });
538
535
  }
539
536
  } else if (event.type === "message_delta") {
@@ -563,7 +560,6 @@ function streamCustomAnthropic(
563
560
  stream.push({ type: "done", reason: output.stopReason, message: output });
564
561
  stream.end();
565
562
  } catch (error) {
566
- for (const block of output.content) delete (block as any).index;
567
563
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
568
564
  output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
569
565
  stream.push({ type: "error", reason: output.stopReason, error: output });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.4.0",
3
+ "version": "1.5.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.4.0",
9
+ "version": "1.5.2",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.4.0",
4
+ "version": "1.5.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.4.0",
4
+ "version": "1.5.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -6,7 +6,7 @@
6
6
  * as expandable custom entries.
7
7
  */
8
8
 
9
- import { type ExtensionAPI, keyHint } from "@earendil-works/pi-coding-agent";
9
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
10
  import { Box, Text } from "@earendil-works/pi-tui";
11
11
 
12
12
  const ENTRY_TYPE = "debug-provider-events";
@@ -24,7 +24,7 @@ export default function (pi: ExtensionAPI) {
24
24
  let activeEvents: unknown[] | undefined;
25
25
  let completedEntry: ProviderDebugEntry | undefined;
26
26
 
27
- pi.registerEntryRenderer<ProviderDebugEntry>(ENTRY_TYPE, (entry, { expanded }, theme) => {
27
+ pi.registerEntryRenderer<ProviderDebugEntry>(ENTRY_TYPE, (entry, { expanded, keyHint }, theme) => {
28
28
  const data = entry.data;
29
29
  if (!data) return new Text(theme.fg("warning", "[provider debug] Missing event data"), 0, 0);
30
30
 
@@ -169,14 +169,11 @@ async function walkGuestFiles(
169
169
  return walkDirectory(root, "");
170
170
  }
171
171
 
172
+ // Like the built-in find and grep: a pattern with '/' is relative to the search root, one without
173
+ // '/' matches file names at any depth.
172
174
  function matchesToolGlob(relativePath: string, pattern: string): boolean {
173
- const normalizedPattern = toPosix(pattern);
174
- if (normalizedPattern.includes("/")) {
175
- return (
176
- path.posix.matchesGlob(relativePath, normalizedPattern) ||
177
- path.posix.matchesGlob(relativePath, `**/${normalizedPattern}`)
178
- );
179
- }
175
+ const normalizedPattern = toPosix(pattern).replace(/^(?:\.\/)+/, "");
176
+ if (normalizedPattern.includes("/")) return path.posix.matchesGlob(relativePath, normalizedPattern);
180
177
  return path.posix.matchesGlob(path.posix.basename(relativePath), normalizedPattern);
181
178
  }
182
179
 
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "1.4.0",
3
+ "version": "1.5.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "1.4.0",
9
+ "version": "1.5.2",
10
10
  "dependencies": {
11
- "@earendil-works/gondolin": "0.12.0"
11
+ "@earendil-works/gondolin": "0.14.0"
12
12
  }
13
13
  },
14
14
  "node_modules/@cto.af/wtf8": {
@@ -21,31 +21,30 @@
21
21
  }
22
22
  },
23
23
  "node_modules/@earendil-works/gondolin": {
24
- "version": "0.12.0",
25
- "resolved": "https://registry.npmjs.org/@earendil-works/gondolin/-/gondolin-0.12.0.tgz",
26
- "integrity": "sha512-BXbvzQKb5QmxY5NtthRDONJTu7+IDKbzqWGrJyyNXMP7N681Tx0Q9TK8pK1ba8nUvYQTipNJyGZOsJfYiZll1A==",
24
+ "version": "0.14.0",
25
+ "resolved": "https://registry.npmjs.org/@earendil-works/gondolin/-/gondolin-0.14.0.tgz",
26
+ "integrity": "sha512-MSw+EGcqFJeyKHdXEfm+nMRr74ytT4x8DGIohav0oPCHeVQAB9AajquM94cv2xqvIU3VDAaZZVC07IXsOY6OVQ==",
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
29
  "cbor2": "^2.3.0",
30
- "node-forge": "^1.3.3",
31
30
  "ssh2": "^1.17.0",
32
- "undici": "^6.21.0"
31
+ "undici": "^6.29.0"
33
32
  },
34
33
  "bin": {
35
34
  "gondolin": "dist/bin/gondolin.js"
36
35
  },
37
36
  "engines": {
38
- "node": ">=23.6.0"
37
+ "node": ">=22.19.0"
39
38
  },
40
39
  "optionalDependencies": {
41
- "@earendil-works/gondolin-krun-runner-darwin-arm64": "0.12.0",
42
- "@earendil-works/gondolin-krun-runner-linux-x64": "0.12.0"
40
+ "@earendil-works/gondolin-krun-runner-darwin-arm64": "0.14.0",
41
+ "@earendil-works/gondolin-krun-runner-linux-x64": "0.14.0"
43
42
  }
44
43
  },
45
44
  "node_modules/@earendil-works/gondolin-krun-runner-darwin-arm64": {
46
- "version": "0.12.0",
47
- "resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-darwin-arm64/-/gondolin-krun-runner-darwin-arm64-0.12.0.tgz",
48
- "integrity": "sha512-ftDlusht4PcT7Y3TuPrZIKrCXy3isiBTVMvlXYK0pcud2uXY6uwFTGeunYgP+8ND/60ddb+MImqbfmkcK8B84A==",
45
+ "version": "0.14.0",
46
+ "resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-darwin-arm64/-/gondolin-krun-runner-darwin-arm64-0.14.0.tgz",
47
+ "integrity": "sha512-fvuhz1CZPaEbmXC0luZoXd1obAb0bjaaGJz33Jo63bhMlosYunAahItakh7cU0dnTlNFzufOSnpGOPqtuYjnpQ==",
49
48
  "cpu": [
50
49
  "arm64"
51
50
  ],
@@ -59,9 +58,9 @@
59
58
  }
60
59
  },
61
60
  "node_modules/@earendil-works/gondolin-krun-runner-linux-x64": {
62
- "version": "0.12.0",
63
- "resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-linux-x64/-/gondolin-krun-runner-linux-x64-0.12.0.tgz",
64
- "integrity": "sha512-RRYsgwe2r5ApKmFNy469QgwnyjAHpAs9XANdWpTd9ol4iUYOY3sX7e0xIooAKxd+ktxGI4N/xRWicwGen3D/Ow==",
61
+ "version": "0.14.0",
62
+ "resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-linux-x64/-/gondolin-krun-runner-linux-x64-0.14.0.tgz",
63
+ "integrity": "sha512-91iw4smoOH/yOoAuQS6N2UZOxqSFwRhtk8rTyrokXBoWiWcveAzg4kHvnLcm40ZlNrWwzIDFrere4bkZeGDQcA==",
65
64
  "cpu": [
66
65
  "x64"
67
66
  ],
@@ -134,15 +133,6 @@
134
133
  "license": "MIT",
135
134
  "optional": true
136
135
  },
137
- "node_modules/node-forge": {
138
- "version": "1.4.0",
139
- "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz",
140
- "integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==",
141
- "license": "(BSD-3-Clause OR GPL-2.0)",
142
- "engines": {
143
- "node": ">= 6.13.0"
144
- }
145
- },
146
136
  "node_modules/safer-buffer": {
147
137
  "version": "2.1.2",
148
138
  "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
@@ -173,9 +163,9 @@
173
163
  "license": "Unlicense"
174
164
  },
175
165
  "node_modules/undici": {
176
- "version": "6.26.0",
177
- "resolved": "https://registry.npmjs.org/undici/-/undici-6.26.0.tgz",
178
- "integrity": "sha512-4yqz8a3n5HmGTlsbADNtr/dJlhkh/55Rq798G6ibiULcXbDtaLpTl1pvdqcbFfeoj3iSi52lePFM7h9H21cw/A==",
166
+ "version": "6.29.1",
167
+ "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
168
+ "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
179
169
  "license": "MIT",
180
170
  "engines": {
181
171
  "node": ">=18.17"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "1.4.0",
4
+ "version": "1.5.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -14,6 +14,6 @@
14
14
  ]
15
15
  },
16
16
  "dependencies": {
17
- "@earendil-works/gondolin": "0.12.0"
17
+ "@earendil-works/gondolin": "0.14.0"
18
18
  }
19
19
  }
@@ -16,7 +16,7 @@ import type { AgentMessage } from "@earendil-works/pi-agent-core";
16
16
  import type { AssistantMessage, TextContent } from "@earendil-works/pi-ai";
17
17
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
18
18
  import { Key } from "@earendil-works/pi-tui";
19
- import { extractTodoItems, isSafeCommand, markCompletedSteps, type TodoItem } from "./utils.ts";
19
+ import { allStepsComplete, extractTodoItems, isSafeCommand, markCompletedSteps, type TodoItem } from "./utils.ts";
20
20
 
21
21
  // Tools
22
22
  const PLAN_MODE_TOOLS = ["read", "bash", "grep", "find", "ls", "questionnaire"];
@@ -36,11 +36,16 @@ function isAssistantMessage(m: AgentMessage): m is AssistantMessage {
36
36
  return m.role === "assistant" && Array.isArray(m.content);
37
37
  }
38
38
 
39
- // Extract text content from an assistant message
39
+ // Extract text content from an assistant message.
40
+ // Includes thinking blocks: with reasoning-max models the [DONE:n] tags and
41
+ // plan drafts usually land in thinking, not the visible text.
40
42
  function getTextContent(message: AssistantMessage): string {
41
43
  return message.content
42
- .filter((block): block is TextContent => block.type === "text")
43
- .map((block) => block.text)
44
+ .map((block) => {
45
+ if (block.type === "text") return block.text;
46
+ if (block.type === "thinking") return (block as { thinking?: string }).thinking ?? "";
47
+ return "";
48
+ })
44
49
  .join("\n");
45
50
  }
46
51
 
@@ -70,12 +75,11 @@ export default function planModeExtension(pi: ExtensionAPI): void {
70
75
  // Widget showing todo list
71
76
  if (executionMode && todoItems.length > 0) {
72
77
  const lines = todoItems.map((item) => {
78
+ const text = item.text.length > 60 ? `${item.text.slice(0, 57)}...` : item.text;
73
79
  if (item.completed) {
74
- return (
75
- ctx.ui.theme.fg("success", "☑ ") + ctx.ui.theme.fg("muted", ctx.ui.theme.strikethrough(item.text))
76
- );
80
+ return ctx.ui.theme.fg("success", "☑ ") + ctx.ui.theme.fg("muted", ctx.ui.theme.strikethrough(text));
77
81
  }
78
- return `${ctx.ui.theme.fg("muted", "☐ ")}${item.text}`;
82
+ return `${ctx.ui.theme.fg("muted", "☐ ")}${text}`;
79
83
  });
80
84
  ctx.ui.setWidget("plan-todos", lines);
81
85
  } else {
@@ -255,10 +259,9 @@ After completing a step, include a [DONE:n] tag in your response.`,
255
259
  if (!executionMode || todoItems.length === 0) return;
256
260
  if (!isAssistantMessage(event.message)) return;
257
261
 
258
- const text = getTextContent(event.message);
259
- if (markCompletedSteps(text, todoItems) > 0) {
260
- updateStatus(ctx);
261
- }
262
+ markCompletedSteps(getTextContent(event.message), todoItems);
263
+ // Always refresh: cheap, keeps the widget consistent even when nothing matched.
264
+ updateStatus(ctx);
262
265
  persistState();
263
266
  });
264
267
 
@@ -266,11 +269,18 @@ After completing a step, include a [DONE:n] tag in your response.`,
266
269
  pi.on("agent_end", async (event, ctx) => {
267
270
  // Check if execution is complete
268
271
  if (executionMode && todoItems.length > 0) {
272
+ // Fallback: the model wrapped up without [DONE:n] tags ("All steps complete").
273
+ const lastAssistant = [...event.messages].reverse().find(isAssistantMessage);
274
+ if (lastAssistant && allStepsComplete(getTextContent(lastAssistant))) {
275
+ for (const t of todoItems) t.completed = true;
276
+ }
269
277
  if (todoItems.every((t) => t.completed)) {
270
278
  const completedList = todoItems.map((t) => `~~${t.text}~~`).join("\n");
271
279
  pi.sendMessage(
272
280
  { customType: "plan-complete", content: `**Plan Complete!** ✓\n\n${completedList}`, display: true },
273
- { triggerTurn: false },
281
+ // nextTurn: delivered with the next user prompt instead of triggering an
282
+ // extra (expensive, reasoning-max) LLM turn to acknowledge the card.
283
+ { deliverAs: "nextTurn" },
274
284
  );
275
285
  executionMode = false;
276
286
  todoItems = [];
@@ -120,26 +120,30 @@ export function cleanStepText(text: string): string {
120
120
  if (cleaned.length > 0) {
121
121
  cleaned = cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
122
122
  }
123
- if (cleaned.length > 50) {
124
- cleaned = `${cleaned.slice(0, 47)}...`;
125
- }
123
+ // Keep full text: the exec message and widget display need the whole step.
124
+ // The widget truncates for display (see updateStatus in index.ts).
126
125
  return cleaned;
127
126
  }
128
127
 
129
128
  export function extractTodoItems(message: string): TodoItem[] {
130
129
  const items: TodoItem[] = [];
131
- const headerMatch = message.match(/\*{0,2}Plan:\*{0,2}\s*\n/i);
132
- if (!headerMatch) return items;
133
-
134
- const planSection = message.slice(message.indexOf(headerMatch[0]) + headerMatch[0].length);
135
- const numberedPattern = /^\s*(\d+)[.)]\s+\*{0,2}([^*\n]+)/gm;
130
+ // Take the LAST "Plan:" section: since getTextContent includes thinking blocks,
131
+ // a draft in the reasoning block can precede the user-visible plan in the text
132
+ // block — the text block comes last in content order.
133
+ const headers = [...message.matchAll(/\*{0,2}Plan:\*{0,2}\s*\n/gi)];
134
+ if (headers.length === 0) return items;
135
+ const lastHeader = headers[headers.length - 1];
136
+ const planSection = message.slice((lastHeader.index ?? 0) + lastHeader[0].length);
137
+ // Full-line capture: step titles may contain bold/italic/backticks ("1. **Step** \`x\` …").
138
+ // cleanStepText strips the markdown; / and - items are still skipped below.
139
+ const numberedPattern = /^\s*(\d+)[.)]\s+(.+)$/gm;
136
140
 
137
141
  for (const match of planSection.matchAll(numberedPattern)) {
138
142
  const text = match[2]
139
143
  .trim()
140
144
  .replace(/\*{1,2}$/, "")
141
145
  .trim();
142
- if (text.length > 5 && !text.startsWith("`") && !text.startsWith("/") && !text.startsWith("-")) {
146
+ if (text.length > 5 && !text.startsWith("/") && !text.startsWith("-")) {
143
147
  const cleaned = cleanStepText(text);
144
148
  if (cleaned.length > 3) {
145
149
  items.push({ step: items.length + 1, text: cleaned, completed: false });
@@ -151,18 +155,40 @@ export function extractTodoItems(message: string): TodoItem[] {
151
155
 
152
156
  export function extractDoneSteps(message: string): number[] {
153
157
  const steps: number[] = [];
154
- for (const match of message.matchAll(/\[DONE:(\d+)\]/gi)) {
155
- const step = Number(match[1]);
156
- if (Number.isFinite(step)) steps.push(step);
158
+ // Canonical and bracket variants: [DONE:1], [DONE: 1], [DONE 1], [Done:1]
159
+ for (const match of message.matchAll(/\[DONE\s*:?\s*(\d+)\]/gi)) {
160
+ steps.push(Number(match[1]));
161
+ }
162
+ // "Done: 1" without brackets
163
+ for (const match of message.matchAll(/\bDone\s*:\s*(\d+)\b/gi)) {
164
+ steps.push(Number(match[1]));
165
+ }
166
+ // "Step 1 done", "Step 2 is complete", "Step 3 finished" — adjacency-anchored,
167
+ // so "Step 9 is not done" / "Step 9 incomplete" never match.
168
+ for (const match of message.matchAll(/\bStep\s*(\d+)\s+(?:is\s+)?(?:done|complete|completed|finished)\b/gi)) {
169
+ steps.push(Number(match[1]));
157
170
  }
158
- return steps;
171
+ return [...new Set(steps)];
159
172
  }
160
173
 
161
174
  export function markCompletedSteps(text: string, items: TodoItem[]): number {
162
175
  const doneSteps = extractDoneSteps(text);
176
+ let marked = 0;
163
177
  for (const step of doneSteps) {
164
- const item = items.find((t) => t.step === step);
165
- if (item) item.completed = true;
178
+ const item = items.find((t) => t.step === step && !t.completed);
179
+ if (item) {
180
+ item.completed = true;
181
+ marked++;
182
+ }
166
183
  }
167
- return doneSteps.length;
184
+ return marked;
185
+ }
186
+
187
+ // Whole-plan completion phrasing, used as a fallback when the model summarizes
188
+ // without [DONE:n] tags. Only consulted on the run's final message (agent_end).
189
+ export function allStepsComplete(message: string): boolean {
190
+ return (
191
+ /(?:all|every)\s+steps?\s+(?:are|is\s+)?(?:done|complete|completed|finished)/i.test(message) ||
192
+ /\b(?:the\s+)?plan\s+(?:is\s+)?(?:complete|completed|done)\b/i.test(message)
193
+ );
168
194
  }
@@ -252,6 +252,8 @@ export default function presetExtension(pi: ExtensionAPI) {
252
252
  container.addChild(new DynamicBorder((str) => theme.fg("accent", str)));
253
253
 
254
254
  return {
255
+ // Let PageUp/PageDown page the list instead of scrolling the fullscreen transcript.
256
+ capturesViewportInput: selectList.capturesViewportInput,
255
257
  render(width: number) {
256
258
  return container.render(width);
257
259
  },
@@ -2,7 +2,7 @@
2
2
  * Reload Runtime Extension
3
3
  *
4
4
  * Demonstrates ctx.reload() from ExtensionCommandContext and an LLM-callable
5
- * tool that queues a follow-up command to trigger reload.
5
+ * tool that requests a reload once the agent has settled.
6
6
  */
7
7
 
8
8
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
@@ -19,19 +19,31 @@ export default function (pi: ExtensionAPI) {
19
19
  },
20
20
  });
21
21
 
22
- // LLM-callable tool. Tools get ExtensionContext, so they cannot call ctx.reload() directly.
23
- // Instead, queue a follow-up user command that executes the command above.
22
+ // LLM-callable tool. Tools do not receive ExtensionCommandContext, so they cannot call
23
+ // ctx.reload(), and Pi cannot reload while the agent is running. The tool records the
24
+ // request and ends the run; the agent_settled handler then runs the command above.
25
+ let reloadRequested = false;
26
+
24
27
  pi.registerTool({
25
28
  name: "reload_runtime",
26
29
  label: "Reload Runtime",
27
30
  description: "Reload extensions, skills, prompts, themes, and context files",
28
31
  parameters: Type.Object({}),
29
32
  async execute() {
30
- pi.sendUserMessage("/reload-runtime", { deliverAs: "followUp" });
33
+ reloadRequested = true;
31
34
  return {
32
- content: [{ type: "text", text: "Queued /reload-runtime as a follow-up command." }],
35
+ content: [{ type: "text", text: "Reload requested. Pi reloads after this response." }],
33
36
  details: {},
37
+ terminate: true,
34
38
  };
35
39
  },
36
40
  });
41
+
42
+ pi.on("agent_settled", () => {
43
+ if (!reloadRequested) return;
44
+ reloadRequested = false;
45
+ // Sent from agent_settled, the command runs after every settled handler finishes, while
46
+ // the agent is idle. expandPromptTemplates dispatches it as a command, not as model input.
47
+ pi.sendUserMessage("/reload-runtime", { expandPromptTemplates: true });
48
+ });
37
49
  }
@@ -8,7 +8,7 @@ Delegate tasks to specialized subagents with isolated context windows.
8
8
  - **Streaming output**: See tool calls and progress as they happen
9
9
  - **Parallel streaming**: All parallel tasks stream updates simultaneously
10
10
  - **Markdown rendering**: Final output rendered with proper formatting (expanded view)
11
- - **Usage tracking**: Shows turns, tokens, cost, and context usage per agent
11
+ - **Usage display**: Shows turns, tokens, cost, and context usage inside each subagent result
12
12
  - **Abort support**: Ctrl+C propagates to kill subagent processes
13
13
 
14
14
  ## Structure
@@ -62,7 +62,7 @@ This tool executes a separate `pi` subprocess with a delegated system prompt and
62
62
 
63
63
  To enable project-local agents, pass `agentScope: "both"` (or `"project"`). Only do this for repositories you trust.
64
64
 
65
- When running interactively, the tool prompts for confirmation before running project-local agents in untrusted projects. Trusted projects skip the additional prompt. Set `confirmProjectAgents: false` to disable confirmation.
65
+ When running interactively, the tool prompts for confirmation before running project-local agents unless the session trust context reports trusted and the agents come from that session project's `.pi/agents` directory. Agents loaded from another task `cwd` still require confirmation. Set `confirmProjectAgents: false` to disable confirmation.
66
66
 
67
67
  ## Usage
68
68
 
@@ -112,8 +112,8 @@ Use a chain: first have scout find the read tool, then have planner suggest impr
112
112
  **Parallel mode streaming**:
113
113
  - Shows all tasks with live status (⏳ running, ✓ done, ✗ failed)
114
114
  - Updates as each task makes progress
115
- - Shows "2/3 done, 1 running" status
116
- - Returns each completed task's final output to the parent model, capped at 50 KB per task
115
+ - Distinguishes pending, running, completed, failed, and aborted tasks
116
+ - Returns each completed task summary to the parent model with its own 50 KB limit
117
117
  - Returns failure diagnostics from stderr/error messages when a child exits before producing output
118
118
 
119
119
  **Tool call formatting** (mimics built-in tools):
@@ -140,7 +140,7 @@ System prompt for the agent goes here.
140
140
  When `model` is omitted, the subagent inherits the dispatching session's active model and thinking level.
141
141
 
142
142
  **Locations:**
143
- - `~/.pi/agent/agents/*.md` - User-level (always loaded)
143
+ - `~/.pi/agent/agents/*.md` - User-level (with `agentScope: "user"` or `"both"`)
144
144
  - `.pi/agents/*.md` - Project-level (only with `agentScope: "project"` or `"both"`)
145
145
 
146
146
  Project agents override user agents with the same name when `agentScope: "both"`.
@@ -164,14 +164,17 @@ Project agents override user agents with the same name when `agentScope: "both"`
164
164
 
165
165
  ## Error Handling
166
166
 
167
- - **Exit code != 0**: Tool returns error with stderr/output
168
- - **stopReason "error"**: LLM error propagated with error message
169
- - **stopReason "aborted"**: User abort (Ctrl+C) kills subprocess, throws error
170
- - **Chain mode**: Stops at first failing step, reports which step failed
167
+ - **Exit code != 0 or signal termination**: Tool returns an error with preserved stderr/output
168
+ - **Spawn errors**: Tool returns the spawn diagnostic
169
+ - **stopReason "error"**: LLM error is propagated with its error message
170
+ - **Abort**: Ctrl+C sends SIGTERM, escalates to SIGKILL after five seconds if needed, and preserves partial details/usage
171
+ - **Chain mode**: Stops at the first failing step and reports which step failed
171
172
 
172
173
  ## Limitations
173
174
 
174
175
  - Output truncated to last 10 items in collapsed view (expand to see all)
175
- - Parallel model-visible output is capped at 50 KB per task; full results remain in tool details
176
- - Agents discovered fresh on each invocation (allows editing mid-session)
176
+ - Single and chain output is capped at 50 KB/2,000 lines; full results remain in tool details
177
+ - Parallel output keeps a separate 50 KB budget per task, allowing up to roughly 400 KB across eight tasks
178
+ - Child usage is displayed in tool details but is not added to the calling session's usage totals
179
+ - Agents are snapshotted from each task's effective cwd when the tool invocation starts; relative task cwd values resolve from the session cwd
177
180
  - Parallel mode limited to 8 tasks, 4 concurrent