zidane 7.2.4 → 8.0.4

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 (376) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -6
  3. package/dist/{acp-D-tVyUjw.js → acp-DQDhi2dj.js} +230 -77
  4. package/dist/acp-DQDhi2dj.js.map +1 -0
  5. package/dist/acp-cli.d.ts +1 -1
  6. package/dist/acp-cli.js +9 -66
  7. package/dist/acp-cli.js.map +1 -1
  8. package/dist/acp.d.ts +10 -590
  9. package/dist/acp.d.ts.map +1 -1
  10. package/dist/acp.js +3 -3
  11. package/dist/{agent-D0zZnGbt.js → agent-DSLNmBp0.js} +14401 -13214
  12. package/dist/agent-DSLNmBp0.js.map +1 -0
  13. package/dist/agent.d.ts +1 -1
  14. package/dist/agent.js +3 -2
  15. package/dist/aliasing-lVFbm81n.js +217 -0
  16. package/dist/aliasing-lVFbm81n.js.map +1 -0
  17. package/dist/{anthropic-C2aole0G.js → anthropic-CD00LhUP.js} +1442 -1264
  18. package/dist/anthropic-CD00LhUP.js.map +1 -0
  19. package/dist/artifacts-CV2hUKnL.js.map +1 -1
  20. package/dist/{atomic-write-B7zr1ddF.js → atomic-write-Ijgf2Mhc.js} +13 -3
  21. package/dist/atomic-write-Ijgf2Mhc.js.map +1 -0
  22. package/dist/call-tool-dHlbGOIY.js +70 -0
  23. package/dist/call-tool-dHlbGOIY.js.map +1 -0
  24. package/dist/chat/pure.d.ts +372 -6
  25. package/dist/chat/pure.d.ts.map +1 -1
  26. package/dist/chat/pure.js +35 -244
  27. package/dist/chat/pure.js.map +1 -1
  28. package/dist/{approvals-DKaJZYlm.js → chat-JPJJ8uu5.js} +15879 -14631
  29. package/dist/chat-JPJJ8uu5.js.map +1 -0
  30. package/dist/chat.d.ts +4 -6
  31. package/dist/chat.js +23 -12
  32. package/dist/cli-shared-C-YCaglL.js +159 -0
  33. package/dist/cli-shared-C-YCaglL.js.map +1 -0
  34. package/dist/client-core-BQSyDALT.d.ts +2115 -0
  35. package/dist/client-core-BQSyDALT.d.ts.map +1 -0
  36. package/dist/codemode-worker.d.ts +1 -0
  37. package/dist/codemode-worker.js +155 -0
  38. package/dist/codemode-worker.js.map +1 -0
  39. package/dist/codemode.d.ts +352 -0
  40. package/dist/codemode.d.ts.map +1 -0
  41. package/dist/codemode.js +5 -0
  42. package/dist/connection-Dr-Js4yZ.d.ts +28 -0
  43. package/dist/connection-Dr-Js4yZ.d.ts.map +1 -0
  44. package/dist/connection-loop-gdh22LTI.js +112 -0
  45. package/dist/connection-loop-gdh22LTI.js.map +1 -0
  46. package/dist/context-segments-BHKlagL6.js +1016 -0
  47. package/dist/context-segments-BHKlagL6.js.map +1 -0
  48. package/dist/{context-transport-T_6AYIvy.js → context-transport-DSMTUsK1.js} +3 -3
  49. package/dist/{context-transport-T_6AYIvy.js.map → context-transport-DSMTUsK1.js.map} +1 -1
  50. package/dist/contexts/daytona.d.ts +19 -8
  51. package/dist/contexts/daytona.d.ts.map +1 -1
  52. package/dist/contexts/daytona.js +1 -440
  53. package/dist/contexts/docker.d.ts +36 -7
  54. package/dist/contexts/docker.d.ts.map +1 -1
  55. package/dist/contexts/docker.js +1 -456
  56. package/dist/contexts/e2b.d.ts +68 -13
  57. package/dist/contexts/e2b.d.ts.map +1 -1
  58. package/dist/contexts/e2b.js +1 -382
  59. package/dist/contexts/sandbox.d.ts +1 -1
  60. package/dist/contexts/sandbox.js +5 -0
  61. package/dist/contexts/sandbox.js.map +1 -1
  62. package/dist/{contexts-CRE9pw07.js → contexts-d7UolYot.js} +1059 -524
  63. package/dist/contexts-d7UolYot.js.map +1 -0
  64. package/dist/contexts.d.ts +3 -3
  65. package/dist/contexts.js +1 -1
  66. package/dist/cred-keys-GpBg71cP.js +105 -0
  67. package/dist/cred-keys-GpBg71cP.js.map +1 -0
  68. package/dist/{auth-BG2rVKSt.js → credentials-JttEuRON.js} +55 -206
  69. package/dist/credentials-JttEuRON.js.map +1 -0
  70. package/dist/{cursor-iojRXHF9.js → cursor-CdjaQTBW.js} +3 -3
  71. package/dist/{cursor-iojRXHF9.js.map → cursor-CdjaQTBW.js.map} +1 -1
  72. package/dist/daemon-cli.d.ts +1 -1
  73. package/dist/daemon-cli.js +3 -2
  74. package/dist/daemon-cli.js.map +1 -1
  75. package/dist/daytona-DG3omipZ.js +513 -0
  76. package/dist/daytona-DG3omipZ.js.map +1 -0
  77. package/dist/defaults-Cx3zvDOV.js +23 -0
  78. package/dist/defaults-Cx3zvDOV.js.map +1 -0
  79. package/dist/dispatcher-BMlu2BmZ.js +4941 -0
  80. package/dist/dispatcher-BMlu2BmZ.js.map +1 -0
  81. package/dist/docker-BZhMMJUp.js +727 -0
  82. package/dist/docker-BZhMMJUp.js.map +1 -0
  83. package/dist/e2b-CEVOdRib.js +480 -0
  84. package/dist/e2b-CEVOdRib.js.map +1 -0
  85. package/dist/edit-utils-EGosADZq.js +234 -0
  86. package/dist/edit-utils-EGosADZq.js.map +1 -0
  87. package/dist/environment-8wsKE2Ln.js +214 -0
  88. package/dist/environment-8wsKE2Ln.js.map +1 -0
  89. package/dist/eval-BNcvle_J.js +1595 -0
  90. package/dist/eval-BNcvle_J.js.map +1 -0
  91. package/dist/eval.d.ts +2 -2
  92. package/dist/eval.js +1 -1489
  93. package/dist/executor-Cx5-8yqi.js +621 -0
  94. package/dist/executor-Cx5-8yqi.js.map +1 -0
  95. package/dist/extension-authoring-DyGGmq9V.js +385 -0
  96. package/dist/extension-authoring-DyGGmq9V.js.map +1 -0
  97. package/dist/extensions.d.ts +2 -2
  98. package/dist/extensions.js +3 -3
  99. package/dist/{fetch-url-DX75gpL0.js → fetch-url-Ct2TjDWt.js} +4 -4
  100. package/dist/{fetch-url-DX75gpL0.js.map → fetch-url-Ct2TjDWt.js.map} +1 -1
  101. package/dist/{format-BF745pLL.js → format-C2NQEVUH.js} +39 -2
  102. package/dist/format-C2NQEVUH.js.map +1 -0
  103. package/dist/format-bytes-C7tfc3Zm.js +55 -0
  104. package/dist/format-bytes-C7tfc3Zm.js.map +1 -0
  105. package/dist/headless-C_rNUuYC.js +960 -0
  106. package/dist/headless-C_rNUuYC.js.map +1 -0
  107. package/dist/headless.d.ts +1 -1
  108. package/dist/headless.js +1 -413
  109. package/dist/{history-search-C4bk1Wz_.js → history-search-CcYzF8-0.js} +7 -3
  110. package/dist/history-search-CcYzF8-0.js.map +1 -0
  111. package/dist/history-search-worker.d.ts +1 -1
  112. package/dist/history-search-worker.js +1 -1
  113. package/dist/host-D7NrI03V.js +378 -0
  114. package/dist/host-D7NrI03V.js.map +1 -0
  115. package/dist/host-signals-BcP5QKUD.js +118 -0
  116. package/dist/host-signals-BcP5QKUD.js.map +1 -0
  117. package/dist/identity-CwfO8K-t.js +26 -0
  118. package/dist/identity-CwfO8K-t.js.map +1 -0
  119. package/dist/{index-BgN1T3lk.d.ts → index-BGe1fQT7.d.ts} +10987 -9320
  120. package/dist/index-BGe1fQT7.d.ts.map +1 -0
  121. package/dist/index-BVQsIKGn.d.ts +448 -0
  122. package/dist/index-BVQsIKGn.d.ts.map +1 -0
  123. package/dist/{index-C6NEd5y_.d.ts → index-CHABJd-L.d.ts} +3386 -502
  124. package/dist/index-CHABJd-L.d.ts.map +1 -0
  125. package/dist/{index-C37_ppWv.d.ts → index-D6a7qXpg.d.ts} +2 -3
  126. package/dist/index-D6a7qXpg.d.ts.map +1 -0
  127. package/dist/index.d.ts +6 -6
  128. package/dist/index.js +27 -23
  129. package/dist/{completion-core-BRo86R_L.js → inline-ghost-BVRQeGoL.js} +50 -2
  130. package/dist/inline-ghost-BVRQeGoL.js.map +1 -0
  131. package/dist/ipc/remote.d.ts +313 -0
  132. package/dist/ipc/remote.d.ts.map +1 -0
  133. package/dist/ipc/remote.js +4 -0
  134. package/dist/ipc.d.ts +6 -964
  135. package/dist/ipc.js +403 -4
  136. package/dist/ipc.js.map +1 -0
  137. package/dist/{isolation-Kfoof0MM.d.ts → isolation-D9L650W5.d.ts} +100 -15
  138. package/dist/isolation-D9L650W5.d.ts.map +1 -0
  139. package/dist/json-rpc--HXQti1E.js +350 -0
  140. package/dist/json-rpc--HXQti1E.js.map +1 -0
  141. package/dist/links-j8rED1sR.js +603 -0
  142. package/dist/links-j8rED1sR.js.map +1 -0
  143. package/dist/local-terminal-D8QThwo_.js +252 -0
  144. package/dist/local-terminal-D8QThwo_.js.map +1 -0
  145. package/dist/{logger--C1VQjwJ.js → logger-Gtqlayx8.js} +199 -173
  146. package/dist/logger-Gtqlayx8.js.map +1 -0
  147. package/dist/logs-view-CWG8aUAG.js.map +1 -1
  148. package/dist/{mcp-CgNd-f3F.js → mcp-_wecH9Qe.js} +608 -562
  149. package/dist/mcp-_wecH9Qe.js.map +1 -0
  150. package/dist/mcp.d.ts +2 -2
  151. package/dist/mcp.js +2 -2
  152. package/dist/media-sniff-UKijEaiQ.js.map +1 -1
  153. package/dist/{messages-2jcOA_5R.js → messages-BqiwcD2Q.js} +1017 -1014
  154. package/dist/messages-BqiwcD2Q.js.map +1 -0
  155. package/dist/{oauth-DxHO17JE.js → oauth-Px_pBB9W.js} +5 -5
  156. package/dist/{oauth-DxHO17JE.js.map → oauth-Px_pBB9W.js.map} +1 -1
  157. package/dist/{openai-compat-Dy56weK8.js → openai-compat-CFrpH7uq.js} +432 -589
  158. package/dist/openai-compat-CFrpH7uq.js.map +1 -0
  159. package/dist/orchestration-BCGmB8Ps.js +511 -0
  160. package/dist/orchestration-BCGmB8Ps.js.map +1 -0
  161. package/dist/output/stream-json.d.ts +1 -2
  162. package/dist/output/stream-json.d.ts.map +1 -1
  163. package/dist/output/stream-json.js +1 -1
  164. package/dist/output/terminal.d.ts +1 -2
  165. package/dist/output/terminal.d.ts.map +1 -1
  166. package/dist/output/terminal.js +13 -7
  167. package/dist/output/terminal.js.map +1 -1
  168. package/dist/{plugins-gbI7SBA6.js → plugins-DS7mahzZ.js} +20 -101
  169. package/dist/plugins-DS7mahzZ.js.map +1 -0
  170. package/dist/plugins.d.ts +1 -1
  171. package/dist/plugins.js +1 -2
  172. package/dist/prelude-Cxo4t74B.js +517 -0
  173. package/dist/prelude-Cxo4t74B.js.map +1 -0
  174. package/dist/presets.d.ts +1 -1
  175. package/dist/presets.js +1 -2
  176. package/dist/project-root-B8zADr4o.js +167 -0
  177. package/dist/project-root-B8zADr4o.js.map +1 -0
  178. package/dist/project-user-paths-BSgtrRxl.js +58 -0
  179. package/dist/project-user-paths-BSgtrRxl.js.map +1 -0
  180. package/dist/{prompts-Pqc3JdW_.d.ts → prompts-DYcvqShf.d.ts} +14 -11
  181. package/dist/prompts-DYcvqShf.d.ts.map +1 -0
  182. package/dist/protocol-DnhqqSmE.js +13 -0
  183. package/dist/protocol-DnhqqSmE.js.map +1 -0
  184. package/dist/providers/anthropic.d.ts +2 -2
  185. package/dist/providers/anthropic.js +1 -2
  186. package/dist/providers/arcee.d.ts +1 -1
  187. package/dist/providers/arcee.js +1 -1
  188. package/dist/providers/baseten.d.ts +1 -1
  189. package/dist/providers/baseten.js +1 -1
  190. package/dist/providers/cerebras.d.ts +1 -1
  191. package/dist/providers/cerebras.js +3 -2
  192. package/dist/providers/cerebras.js.map +1 -1
  193. package/dist/providers/local.d.ts +1 -1
  194. package/dist/providers/local.js +1 -1
  195. package/dist/providers/openai-compat.d.ts +1 -1
  196. package/dist/providers/openai-compat.js +1 -2
  197. package/dist/providers/openai.d.ts +1 -1
  198. package/dist/providers/openai.js +15 -12
  199. package/dist/providers/openai.js.map +1 -1
  200. package/dist/providers/openrouter.d.ts +1 -1
  201. package/dist/providers/openrouter.js +3 -2
  202. package/dist/providers/openrouter.js.map +1 -1
  203. package/dist/providers/xai.d.ts +1 -1
  204. package/dist/providers/xai.js +3 -3
  205. package/dist/{providers-BVhnFyiY.js → providers-XUR7F4Hi.js} +4 -4
  206. package/dist/{providers-BVhnFyiY.js.map → providers-XUR7F4Hi.js.map} +1 -1
  207. package/dist/providers.d.ts +1 -1
  208. package/dist/providers.js +4 -4
  209. package/dist/registry-D6ShBWJU.js +5234 -0
  210. package/dist/registry-D6ShBWJU.js.map +1 -0
  211. package/dist/remote-hosts-BtA_9ZGp.js +97 -0
  212. package/dist/remote-hosts-BtA_9ZGp.js.map +1 -0
  213. package/dist/restate.d.ts +2 -3
  214. package/dist/restate.d.ts.map +1 -1
  215. package/dist/restate.js +631 -572
  216. package/dist/restate.js.map +1 -1
  217. package/dist/run-summary-CklLiZ4y.js +288 -0
  218. package/dist/run-summary-CklLiZ4y.js.map +1 -0
  219. package/dist/{sandbox-BH0WQkXn.d.ts → sandbox-C5dR5DwQ.d.ts} +6 -3
  220. package/dist/sandbox-C5dR5DwQ.d.ts.map +1 -0
  221. package/dist/session/sqlite.d.ts +1 -2
  222. package/dist/session/sqlite.d.ts.map +1 -1
  223. package/dist/session/sqlite.js +1 -616
  224. package/dist/session-factory-BUGY5P40.js +1576 -0
  225. package/dist/session-factory-BUGY5P40.js.map +1 -0
  226. package/dist/{session-BqRP1hS7.js → session-xh9JXu6i.js} +94 -52
  227. package/dist/session-xh9JXu6i.js.map +1 -0
  228. package/dist/session.d.ts +1 -1
  229. package/dist/session.js +2 -2
  230. package/dist/settings-keys-Ckf29NeM.js +677 -0
  231. package/dist/settings-keys-Ckf29NeM.js.map +1 -0
  232. package/dist/shell-path-Dqaoow2J.js +412 -0
  233. package/dist/shell-path-Dqaoow2J.js.map +1 -0
  234. package/dist/{skills-BC3dodWp.js → skills-DKqZJm4X.js} +430 -470
  235. package/dist/skills-DKqZJm4X.js.map +1 -0
  236. package/dist/skills.d.ts +2 -2
  237. package/dist/skills.js +1 -2
  238. package/dist/source-mPExaUm8.js +381 -0
  239. package/dist/source-mPExaUm8.js.map +1 -0
  240. package/dist/sqlite-DV1DQzN2.js +698 -0
  241. package/dist/sqlite-DV1DQzN2.js.map +1 -0
  242. package/dist/{src-CkNQKFKr.js → src-BRMYRJib.js} +903 -1121
  243. package/dist/src-BRMYRJib.js.map +1 -0
  244. package/dist/{stdio-DPpBDPx5.js → stdio-C6YyoW3I.js} +4 -4
  245. package/dist/{stdio-DPpBDPx5.js.map → stdio-C6YyoW3I.js.map} +1 -1
  246. package/dist/{stdio-loader-Bbx19dMZ.js → stdio-loader-C830Vg-Z.js} +4 -4
  247. package/dist/{stdio-loader-Bbx19dMZ.js.map → stdio-loader-C830Vg-Z.js.map} +1 -1
  248. package/dist/system-prompt-MNVHatSD.d.ts.map +1 -1
  249. package/dist/timeout-DEaqslLO.d.ts.map +1 -1
  250. package/dist/todo-edits-Dn251YUP.js +1790 -0
  251. package/dist/todo-edits-Dn251YUP.js.map +1 -0
  252. package/dist/{turn-operations-DrbJlpq9.js → tool-formatters-IQFDrdrs.js} +1456 -2120
  253. package/dist/tool-formatters-IQFDrdrs.js.map +1 -0
  254. package/dist/tool-state-Dku6YqAB.js +989 -0
  255. package/dist/tool-state-Dku6YqAB.js.map +1 -0
  256. package/dist/tools/fetch-url.d.ts +1 -2
  257. package/dist/tools/fetch-url.d.ts.map +1 -1
  258. package/dist/tools/fetch-url.js +1 -2
  259. package/dist/tools/prompts.d.ts +1 -1
  260. package/dist/tools/prompts.js +7 -7
  261. package/dist/tools/prompts.js.map +1 -1
  262. package/dist/tools/web-search.d.ts +1 -2
  263. package/dist/tools/web-search.d.ts.map +1 -1
  264. package/dist/tools/web-search.js +2 -2
  265. package/dist/tools/web-search.js.map +1 -1
  266. package/dist/tools-_DnT3AGM.js +578 -0
  267. package/dist/tools-_DnT3AGM.js.map +1 -0
  268. package/dist/tools.d.ts +3 -3
  269. package/dist/tools.js +4 -2
  270. package/dist/tui.d.ts +534 -517
  271. package/dist/tui.d.ts.map +1 -1
  272. package/dist/tui.js +34933 -27242
  273. package/dist/tui.js.map +1 -1
  274. package/dist/turn-operations-B8sokwi5.js +333 -0
  275. package/dist/turn-operations-B8sokwi5.js.map +1 -0
  276. package/dist/turn-operations-DQX5ZZni.d.ts +3089 -0
  277. package/dist/turn-operations-DQX5ZZni.d.ts.map +1 -0
  278. package/dist/types-C7ZFOztE.d.ts +132 -0
  279. package/dist/types-C7ZFOztE.d.ts.map +1 -0
  280. package/dist/types-CH5XpIHw.js +114 -0
  281. package/dist/types-CH5XpIHw.js.map +1 -0
  282. package/dist/{types-CWgENVLY.js → types-Cu0ZGDu9.js} +10 -6
  283. package/dist/types-Cu0ZGDu9.js.map +1 -0
  284. package/dist/types-IqegbJEE.d.ts +624 -0
  285. package/dist/types-IqegbJEE.d.ts.map +1 -0
  286. package/dist/types.d.ts +4 -4
  287. package/dist/types.js +1 -1
  288. package/dist/url-D8HCl65b.js +1259 -0
  289. package/dist/url-D8HCl65b.js.map +1 -0
  290. package/dist/wasm-BVT-j5cl.js +33 -0
  291. package/dist/wasm-BVT-j5cl.js.map +1 -0
  292. package/dist/workspace-exec-stream-SV2R9d5S.js +355 -0
  293. package/dist/workspace-exec-stream-SV2R9d5S.js.map +1 -0
  294. package/dist/ws-CIHMvlSh.js +952 -0
  295. package/dist/ws-CIHMvlSh.js.map +1 -0
  296. package/dist/ws-client-N7NxzvQp.js +230 -0
  297. package/dist/ws-client-N7NxzvQp.js.map +1 -0
  298. package/dist/{xai-CazjStOK.js → xai-CvJTeLrI.js} +165 -5
  299. package/dist/xai-CvJTeLrI.js.map +1 -0
  300. package/dist/xdg-zweed0-t.js +117 -0
  301. package/dist/xdg-zweed0-t.js.map +1 -0
  302. package/docs/ACP.md +52 -0
  303. package/docs/ARCHITECTURE.md +103 -6
  304. package/docs/ARTIFACTS.md +8 -4
  305. package/docs/CHAT.md +165 -14
  306. package/docs/EXECUTION_CONTEXT.md +8 -0
  307. package/docs/EXTENSIONS.md +123 -2
  308. package/docs/HEADLESS.md +2 -0
  309. package/docs/IPC.md +775 -64
  310. package/docs/MACHINES.md +456 -0
  311. package/docs/PANELS.md +3 -0
  312. package/docs/README.md +4 -0
  313. package/docs/RESTATE.md +3 -2
  314. package/docs/RUN_IN_BACKGROUND.md +10 -2
  315. package/docs/SERVER.md +1085 -0
  316. package/docs/SKILL.md +6 -1
  317. package/docs/TERMINAL.md +75 -0
  318. package/docs/TUI.md +65 -14
  319. package/package.json +58 -26
  320. package/scripts/eval.ts +4 -0
  321. package/dist/acp-D-tVyUjw.js.map +0 -1
  322. package/dist/agent-D0zZnGbt.js.map +0 -1
  323. package/dist/anthropic-C2aole0G.js.map +0 -1
  324. package/dist/approvals-DKaJZYlm.js.map +0 -1
  325. package/dist/atomic-write-B7zr1ddF.js.map +0 -1
  326. package/dist/auth-BG2rVKSt.js.map +0 -1
  327. package/dist/completion-core-BRo86R_L.js.map +0 -1
  328. package/dist/contexts/daytona.js.map +0 -1
  329. package/dist/contexts/docker.js.map +0 -1
  330. package/dist/contexts/e2b.js.map +0 -1
  331. package/dist/contexts-CRE9pw07.js.map +0 -1
  332. package/dist/eval.js.map +0 -1
  333. package/dist/format-BF745pLL.js.map +0 -1
  334. package/dist/glob-DluQFSw1.js +0 -270
  335. package/dist/glob-DluQFSw1.js.map +0 -1
  336. package/dist/headless.js.map +0 -1
  337. package/dist/history-search-C4bk1Wz_.js.map +0 -1
  338. package/dist/index-BgN1T3lk.d.ts.map +0 -1
  339. package/dist/index-C37_ppWv.d.ts.map +0 -1
  340. package/dist/index-C6NEd5y_.d.ts.map +0 -1
  341. package/dist/ipc-zVSyo6K1.js +0 -331
  342. package/dist/ipc-zVSyo6K1.js.map +0 -1
  343. package/dist/ipc.d.ts.map +0 -1
  344. package/dist/isolation-Kfoof0MM.d.ts.map +0 -1
  345. package/dist/json-rpc-rSWMUh9b.js +0 -192
  346. package/dist/json-rpc-rSWMUh9b.js.map +0 -1
  347. package/dist/logger--C1VQjwJ.js.map +0 -1
  348. package/dist/mcp-CgNd-f3F.js.map +0 -1
  349. package/dist/messages-2jcOA_5R.js.map +0 -1
  350. package/dist/openai-compat-Dy56weK8.js.map +0 -1
  351. package/dist/output-cap-C9zukcCj.js +0 -100
  352. package/dist/output-cap-C9zukcCj.js.map +0 -1
  353. package/dist/panels-B6gRk4bf.js +0 -789
  354. package/dist/panels-B6gRk4bf.js.map +0 -1
  355. package/dist/plugins-gbI7SBA6.js.map +0 -1
  356. package/dist/prompts-Pqc3JdW_.d.ts.map +0 -1
  357. package/dist/run-summary-BU_NgwUT.js +0 -269
  358. package/dist/run-summary-BU_NgwUT.js.map +0 -1
  359. package/dist/sandbox-BH0WQkXn.d.ts.map +0 -1
  360. package/dist/session/sqlite.js.map +0 -1
  361. package/dist/session-BqRP1hS7.js.map +0 -1
  362. package/dist/shell-path-h5czzllR.js +0 -1549
  363. package/dist/shell-path-h5czzllR.js.map +0 -1
  364. package/dist/skills-BC3dodWp.js.map +0 -1
  365. package/dist/src-CkNQKFKr.js.map +0 -1
  366. package/dist/todo-edits-UOwgxGKu.js +0 -528
  367. package/dist/todo-edits-UOwgxGKu.js.map +0 -1
  368. package/dist/tool-formatters-DoRLnfuD.d.ts +0 -759
  369. package/dist/tool-formatters-DoRLnfuD.d.ts.map +0 -1
  370. package/dist/transcript-anchors-BeudMbXx.d.ts +0 -1762
  371. package/dist/transcript-anchors-BeudMbXx.d.ts.map +0 -1
  372. package/dist/turn-operations-C8bMBDl_.d.ts +0 -1258
  373. package/dist/turn-operations-C8bMBDl_.d.ts.map +0 -1
  374. package/dist/turn-operations-DrbJlpq9.js.map +0 -1
  375. package/dist/types-CWgENVLY.js.map +0 -1
  376. package/dist/xai-CazjStOK.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-segments-BHKlagL6.js","names":["str"],"sources":["../src/extensions/badge-actions.ts","../src/chat/keybinding-spec.ts","../src/extensions/references.ts","../src/extensions/panels.ts","../src/chat/context-breakdown.ts","../src/chat/context-segments.ts"],"sourcesContent":["/**\n * Badge actions: what right-clicking a badge offers (a link, a file, a\n * commit or PR chip, an extension reference, a session badge).\n *\n * Every badge surface describes what it stands for as a {@link BadgeTarget};\n * the built-in actions (copy, add to prompt, open) derive from it alone, and\n * extensions add theirs with `ctx.registerBadgeActions`. Extension actions\n * answer EFFECTS ({@link BadgeActionEffect}): data the host applies with its\n * own clipboard, composer and opener, so the same registration works in the\n * TUI and across the GUI's IPC boundary.\n *\n * Pure except `runBadgeAction`, which calls into the registry.\n */\n\nimport type { ExtensionRegistry, ExtensionSessionBadgeCardRow, SessionBadgeEntry } from './types'\n\n/** What kind of thing a badge stands for. */\nexport type BadgeTargetKind = 'link' | 'file' | 'commit' | 'pull_request' | 'branch' | 'reference' | 'artifact'\n\nexport interface BadgeTarget {\n kind: BadgeTargetKind\n /** What the badge shows (`e32789e`, `BOA-123`, `sessions.db`). */\n text: string\n /** A URL, or an absolute path for files. */\n href?: string\n /** What \"Add to prompt\" inserts; default `href` (URLs), `@<path>` (files), else `text`. */\n prompt?: string\n /** The artifact behind the badge (session badges, card rows, artifact rows). */\n artifact?: { kind: string, uri: string }\n /** The reference behind the badge (`ctx.registerReferences`). */\n reference?: { providerId: string, key: string }\n /** The chat the badge is in. */\n sessionId?: string\n}\n\n/** One menu item. `group` places it: copy, prompt, open, then the extension's own. */\nexport interface BadgeAction {\n id: string\n label: string\n group?: 'copy' | 'prompt' | 'open' | 'more'\n /** Single-key accelerator shown in the menu. */\n shortcut?: string\n}\n\n/** What running an action asks the host to do. Every field is optional; several may combine. */\nexport interface BadgeActionEffect {\n /** Put this text on the clipboard. */\n copy?: string\n /** Insert this text into the composer at the caret (and focus it). */\n insert?: string\n /** Open this URL (browser) or absolute path (editor / file manager). */\n open?: string\n /** A one-line confirmation or error the host shows briefly. */\n notice?: string\n}\n\n/** Which badges a registration acts on. Omitted axes match everything; given axes must all match. */\nexport interface BadgeActionsMatch {\n kinds?: readonly BadgeTargetKind[]\n /** Artifact kinds (`target.artifact.kind`). */\n artifactKinds?: readonly string[]\n /** Reference provider ids (`target.reference.providerId`, as registered: `linear.issue`). */\n references?: readonly string[]\n}\n\nexport interface ExtensionBadgeActions {\n /** Unique per registry (`<ext>.<what>`); first registration wins. */\n id: string\n match?: BadgeActionsMatch\n /** The items for one badge (synchronous, cheap). Nothing or `[]`: none. */\n actions: (target: BadgeTarget) => readonly BadgeAction[] | undefined\n /** Run one of them. Throws become a `notice` with the message. */\n run: (actionId: string, target: BadgeTarget, ctx: { sessionId?: string, cwd?: string, signal: AbortSignal }) =>\n BadgeActionEffect | void | Promise<BadgeActionEffect | void>\n}\n\n/** A host's resolved menu item: a built-in, or an extension's (`source` names the registration). */\nexport interface BadgeMenuItem extends BadgeAction {\n source: 'builtin' | string\n}\n\nconst MAX_TEXT = 64 * 1024\nconst MAX_ITEMS_PER_SOURCE = 8\nconst GROUP_ORDER: Record<NonNullable<BadgeAction['group']>, number> = { copy: 0, prompt: 1, open: 2, more: 3 }\n\nfunction isWebUrl(href: string | undefined): href is string {\n return href !== undefined && /^https?:\\/\\//i.test(href)\n}\n\nfunction str(v: unknown, max: number): string | undefined {\n return typeof v === 'string' && v.length > 0 && v.length <= max ? v : undefined\n}\n\n/** A target from across a boundary (the GUI renderer), reduced to its known, bounded fields; `null` when unusable. */\nexport function normalizeBadgeTarget(raw: unknown): BadgeTarget | null {\n const t = raw && typeof raw === 'object' ? raw as Record<string, unknown> : null\n if (!t)\n return null\n const kinds: readonly BadgeTargetKind[] = ['link', 'file', 'commit', 'pull_request', 'branch', 'reference', 'artifact']\n const kind = kinds.find(k => k === t.kind)\n const text = str(t.text, 2048)\n if (!kind || !text)\n return null\n const href = str(t.href, 4096)\n const prompt = str(t.prompt, MAX_TEXT)\n const sessionId = str(t.sessionId, 512)\n const a = t.artifact && typeof t.artifact === 'object' ? t.artifact as Record<string, unknown> : undefined\n const artifactKind = str(a?.kind, 64)\n const artifactUri = str(a?.uri, 2048)\n const r = t.reference && typeof t.reference === 'object' ? t.reference as Record<string, unknown> : undefined\n const providerId = str(r?.providerId, 128)\n const key = str(r?.key, 512)\n return {\n kind,\n text,\n ...(href ? { href } : {}),\n ...(prompt ? { prompt } : {}),\n ...(artifactKind && artifactUri ? { artifact: { kind: artifactKind, uri: artifactUri } } : {}),\n ...(providerId && key ? { reference: { providerId, key } } : {}),\n ...(sessionId ? { sessionId } : {}),\n }\n}\n\n/** What \"Add to prompt\" inserts for a target. */\nexport function badgePromptText(target: BadgeTarget): string {\n if (target.prompt)\n return target.prompt\n if (target.kind === 'file' && target.href)\n return `@${target.href}`\n if (isWebUrl(target.href) && target.kind === 'link')\n return target.href\n return target.text\n}\n\n/** The built-in actions for a target (host-implemented; see {@link builtinBadgeEffect}). */\nexport function builtinBadgeActions(target: BadgeTarget): BadgeMenuItem[] {\n const items: BadgeMenuItem[] = []\n const web = isWebUrl(target.href)\n if (web)\n items.push({ id: 'copy-url', label: 'Copy URL', group: 'copy', shortcut: 'C', source: 'builtin' })\n else if (target.kind === 'file' && target.href)\n items.push({ id: 'copy-path', label: 'Copy path', group: 'copy', shortcut: 'C', source: 'builtin' })\n if (target.kind === 'commit')\n items.push({ id: 'copy-text', label: 'Copy SHA', group: 'copy', ...(web ? {} : { shortcut: 'C' }), source: 'builtin' })\n else if (!web && target.kind !== 'file')\n items.push({ id: 'copy-text', label: 'Copy', group: 'copy', shortcut: 'C', source: 'builtin' })\n items.push({ id: 'add-to-prompt', label: 'Add to prompt', group: 'prompt', shortcut: 'P', source: 'builtin' })\n if (web)\n items.push({ id: 'open-browser', label: 'Open in browser', group: 'open', shortcut: 'O', source: 'builtin' })\n else if (target.kind === 'file' && target.href)\n items.push({ id: 'open-file', label: 'Open', group: 'open', shortcut: 'O', source: 'builtin' })\n return items\n}\n\n/** The effect of a built-in action; `undefined` for an id that isn't one (or doesn't apply). */\nexport function builtinBadgeEffect(actionId: string, target: BadgeTarget): BadgeActionEffect | undefined {\n switch (actionId) {\n case 'copy-url':\n return isWebUrl(target.href) ? { copy: target.href } : undefined\n case 'copy-path':\n return target.kind === 'file' && target.href ? { copy: target.href } : undefined\n case 'copy-text':\n return { copy: target.text }\n case 'add-to-prompt':\n return { insert: badgePromptText(target) }\n case 'open-browser':\n return isWebUrl(target.href) ? { open: target.href } : undefined\n case 'open-file':\n return target.kind === 'file' && target.href ? { open: target.href } : undefined\n default:\n return undefined\n }\n}\n\nfunction matches(entry: { value: ExtensionBadgeActions }, target: BadgeTarget): boolean {\n const m = entry.value.match\n if (!m)\n return true\n if (m.kinds && !m.kinds.includes(target.kind))\n return false\n if (m.artifactKinds && (!target.artifact || !m.artifactKinds.includes(target.artifact.kind)))\n return false\n if (m.references) {\n const id = target.reference?.providerId\n if (!id || !m.references.includes(id))\n return false\n }\n return true\n}\n\n/**\n * Extension items for a target, in registration order, after validation:\n * ids and labels must be non-empty strings, ids unique per source, at most\n * eight per source. A throwing `actions` contributes nothing.\n */\nexport function extensionBadgeActions(\n target: BadgeTarget,\n registry: Pick<ExtensionRegistry, 'badgeActions'>,\n): BadgeMenuItem[] {\n const out: BadgeMenuItem[] = []\n for (const entry of registry.badgeActions) {\n if (!matches(entry, target))\n continue\n let listed: readonly BadgeAction[] | undefined\n try {\n listed = entry.value.actions(target)\n }\n catch {\n continue\n }\n const seen = new Set<string>()\n for (const action of listed ?? []) {\n if (seen.size >= MAX_ITEMS_PER_SOURCE)\n break\n const id = str(action?.id, 64)\n const label = str(action?.label, 80)\n if (!id || !label || seen.has(id))\n continue\n seen.add(id)\n const group = action.group && action.group in GROUP_ORDER ? action.group : 'more'\n const shortcut = str(action.shortcut, 1)\n out.push({ id, label, group, ...(shortcut ? { shortcut } : {}), source: entry.value.id })\n }\n }\n return out\n}\n\n/**\n * The full menu: built-ins then extension items, ordered by group (stable\n * within a group). An extension shortcut that collides with an earlier one\n * is dropped, never the item.\n */\nexport function badgeMenu(target: BadgeTarget, registry?: Pick<ExtensionRegistry, 'badgeActions'>): BadgeMenuItem[] {\n return mergeBadgeMenu([...builtinBadgeActions(target), ...(registry ? extensionBadgeActions(target, registry) : [])])\n}\n\n/**\n * Order items the way {@link badgeMenu} does: by group, stable within one,\n * later colliding shortcuts dropped. For hosts that get the built-ins and the\n * extension items separately (the GUI renderer asks main for the latter).\n */\nexport function mergeBadgeMenu(all: readonly BadgeMenuItem[]): BadgeMenuItem[] {\n const sorted = all\n .map((item, i) => ({ item, i }))\n .sort((a, b) => GROUP_ORDER[a.item.group ?? 'more'] - GROUP_ORDER[b.item.group ?? 'more'] || a.i - b.i)\n .map(({ item }) => item)\n const taken = new Set<string>()\n return sorted.map((item) => {\n if (!item.shortcut)\n return item\n const key = item.shortcut.toUpperCase()\n if (taken.has(key)) {\n const { shortcut: _drop, ...rest } = item\n return rest\n }\n taken.add(key)\n return item\n })\n}\n\n/** An effect from extension code, reduced to known, bounded string fields. */\nexport function normalizeBadgeEffect(raw: unknown): BadgeActionEffect {\n const e = raw && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n const copy = str(e.copy, MAX_TEXT)\n const insert = str(e.insert, MAX_TEXT)\n const open = str(e.open, 4096)\n const notice = str(e.notice, 280)\n return {\n ...(copy ? { copy } : {}),\n ...(insert ? { insert } : {}),\n ...(open && (/^https?:\\/\\//i.test(open) || open.startsWith('/')) ? { open } : {}),\n ...(notice ? { notice } : {}),\n }\n}\n\n/**\n * Run one menu item: a built-in resolves locally, an extension item runs its\n * registration's `run` (8 s deadline). Never throws: failures come back as a\n * `notice`.\n */\nexport async function runBadgeAction(\n source: string,\n actionId: string,\n target: BadgeTarget,\n registry: Pick<ExtensionRegistry, 'badgeActions'> | undefined,\n ctx: { sessionId?: string, cwd?: string } = {},\n): Promise<BadgeActionEffect> {\n if (source === 'builtin')\n return builtinBadgeEffect(actionId, target) ?? { notice: 'Not available for this badge.' }\n const entry = registry?.badgeActions.find(e => e.value.id === source)\n if (!entry || !matches(entry, target))\n return { notice: 'This action is no longer available.' }\n const signal = AbortSignal.timeout(8_000)\n try {\n const result = await Promise.race([\n Promise.resolve(entry.value.run(actionId, target, { ...ctx, signal })),\n new Promise<never>((_, reject) => signal.addEventListener('abort', () => reject(new Error('Timed out.')), { once: true })),\n ])\n return normalizeBadgeEffect(result)\n }\n catch (err) {\n return { notice: err instanceof Error ? err.message : String(err) }\n }\n}\n\n/**\n * The target for an artifact row (Artifacts panel / rail): its kind's\n * badge kind (commit, pull request, file; `artifact` for the rest), the\n * row's title and link, and what \"Add to prompt\" inserts: a commit's SHA,\n * a file's path, the link, else the label.\n */\nexport function artifactBadgeTarget(\n artifact: { kind: string, uri: string, label: string, sessionId?: string, meta?: unknown },\n row: { title: string, href?: string },\n): BadgeTarget {\n const kind: BadgeTargetKind = artifact.kind === 'commit'\n ? 'commit'\n : artifact.kind === 'pull_request'\n ? 'pull_request'\n : artifact.kind === 'file' ? 'file' : 'artifact'\n const sha = kind === 'commit' ? /^git:commit:([0-9a-f]{7,40})$/.exec(artifact.uri)?.[1] : undefined\n return {\n kind,\n text: sha ? sha.slice(0, 7) : row.title,\n ...(row.href ? { href: row.href } : {}),\n ...(sha ? { prompt: sha } : kind === 'artifact' && !row.href ? { prompt: artifact.label } : {}),\n artifact: { kind: artifact.kind, uri: artifact.uri },\n ...(artifact.sessionId ? { sessionId: artifact.sessionId } : {}),\n }\n}\n\n/** The target for a session badge (or one row of its card): GUI sidebar, TUI sessions list. */\nexport function sessionBadgeTarget(\n sessionId: string,\n entry: SessionBadgeEntry,\n row?: ExtensionSessionBadgeCardRow,\n): BadgeTarget {\n const { badge } = entry\n const uri = row?.uri ?? badge.card?.rows[0]?.uri ?? entry.kind\n const href = row ? row.href : badge.href\n const prompt = row ? (row.prompt ?? row.href ?? row.lead) : (badge.prompt ?? badge.href)\n return {\n kind: 'artifact',\n text: row ? (row.lead ?? row.title) : badge.text,\n ...(href ? { href } : {}),\n ...(prompt ? { prompt } : {}),\n artifact: { kind: entry.kind, uri },\n sessionId,\n }\n}\n","/**\n * The `keybindings.json` spec grammar (`\"ctrl+shift+o\"`, `\"ctrl+w | cmd+w\"`),\n * shared by the TUI (`./keybindings`) and the GUI renderer (through\n * `zidane/chat/pure`) so one file parses the same on both surfaces. No node\n * imports: the matchers live with each surface's key-event shape.\n */\n\n/** Parsed shape of a `\"ctrl+shift+o\"` spec. */\nexport interface ParsedBinding {\n ctrl: boolean\n shift: boolean\n alt: boolean\n meta: boolean\n /** The key name (e.g. `'o'`, `'tab'`, `'escape'`). Always lowercase. */\n name: string\n}\n\n/**\n * Aliases the parser accepts on input so the on-disk format can be\n * forgiving (different terminals + docs label modifiers + keys\n * differently). Output names are canonicalized to one form per key so a\n * matcher only has to compare one canonical against an event's key name.\n * Unknown names pass through verbatim, which is useful for\n * terminal-specific keys we don't have to enumerate.\n */\nconst NAME_ALIASES: Readonly<Record<string, string>> = {\n 'esc': 'escape',\n 'enter': 'return',\n 'ret': 'return',\n 'space': 'space',\n 'spc': 'space',\n 'del': 'delete',\n 'ins': 'insert',\n 'pgup': 'pageup',\n 'pgdn': 'pagedown',\n 'pagup': 'pageup',\n 'pagedn': 'pagedown',\n // `+` / `-` are spec separators, so specs spell the keys out; the DOM\n // reports the physical `=` key as `=` (or `+` with shift) and `-` as `-`.\n 'plus': '=',\n '+': '=',\n 'minus': '-',\n // Shifted brackets on US layouts report `{` / `}`; specs say `[` / `]`.\n '{': '[',\n '}': ']',\n // Shifted backquote reports `~`; specs say `` ` ``.\n '~': '`',\n // The DOM reports arrows as `ArrowLeft`…; specs say `left`.\n 'arrowleft': 'left',\n 'arrowright': 'right',\n 'arrowup': 'up',\n 'arrowdown': 'down',\n}\n\nconst MODIFIER_ALIASES: Readonly<Record<string, 'ctrl' | 'shift' | 'alt' | 'meta'>> = {\n ctrl: 'ctrl',\n control: 'ctrl',\n shift: 'shift',\n alt: 'alt',\n option: 'alt',\n opt: 'alt',\n meta: 'meta',\n cmd: 'meta',\n command: 'meta',\n super: 'meta',\n win: 'meta',\n}\n\n/** A key name as the parser canonicalizes it (`'Enter'` → `'return'`, `'ArrowLeft'` → `'left'`). */\nexport function canonicalKeyName(key: string): string {\n const lower = key.toLowerCase()\n return NAME_ALIASES[lower] ?? lower\n}\n\n/**\n * The chords one binding lists. A binding may name several, any of which\n * fires the action: `\"ctrl+w | cmd+w\"` (or, in `keybindings.json`, an array).\n * A `|` right after a `+` / `-` is the key itself (`ctrl+|`).\n */\nexport function bindingAlternatives(spec: string | undefined | null): string[] {\n if (typeof spec !== 'string')\n return []\n return spec.split(/(?<![+\\-])\\|/).map(part => part.trim()).filter(Boolean)\n}\n\n/** Every chord of `spec` that parses (see {@link bindingAlternatives}). */\nexport function parseBindingSpecs(spec: string | undefined | null): ParsedBinding[] {\n return bindingAlternatives(spec).map(parseOneSpec).filter((p): p is ParsedBinding => p !== null)\n}\n\n/**\n * The spec's first valid chord (callers that pre-parse one binding). Use\n * {@link parseBindingSpecs} to honour every alternative.\n */\nexport function parseBindingSpec(spec: string | undefined | null): ParsedBinding | null {\n return parseBindingSpecs(spec)[0] ?? null\n}\n\n/**\n * Parse one `'ctrl+shift+o'`-style chord. Returns `null` for empty /\n * malformed inputs; the caller falls back to the default for that action.\n *\n * Tolerant by design:\n * - Case-insensitive (`Ctrl+O` → same as `ctrl+o`).\n * - Modifier order doesn't matter (`shift+ctrl+o` works).\n * - Mixed `+` and `-` separators allowed (`ctrl-o`, `ctrl+o`).\n * - Trailing / leading whitespace is stripped.\n * - Duplicate modifiers collapse silently.\n */\nfunction parseOneSpec(spec: string): ParsedBinding | null {\n const trimmed = spec.trim().toLowerCase()\n if (!trimmed)\n return null\n // Split on `+` OR `-`. `-` is tolerated mostly for users who copy\n // bindings from VS Code-style strings (`ctrl-o`).\n const parts = trimmed.split(/[+\\-]/).map(p => p.trim()).filter(Boolean)\n if (parts.length === 0)\n return null\n const result: ParsedBinding = { ctrl: false, shift: false, alt: false, meta: false, name: '' }\n for (const part of parts) {\n const modifier = MODIFIER_ALIASES[part]\n if (modifier) {\n result[modifier] = true\n continue\n }\n // A second non-modifier token would mean a binding like `o+p`: not\n // meaningful in a one-key-at-a-time keypress model.\n if (result.name)\n return null\n result.name = NAME_ALIASES[part] ?? part\n }\n if (!result.name)\n return null\n return result\n}\n","/**\n * Text references (`ctx.registerReferences`): find, then resolve.\n *\n * Matching is pure and runs on the providers' declarative patterns\n * ({@link ReferenceProviderWire}), so the GUI renderer (no extension\n * runtime) and the TUI match the same text the same way. Resolving runs\n * where the extension lives, through {@link createReferenceResolver}: one\n * cache per registry, keyed `(provider, key)`, with in-flight dedupe and a\n * short negative cache so a key that names nothing isn't asked again on\n * every render.\n */\n\nimport type {\n ExtensionReferencePattern,\n ExtensionReferenceProvider,\n ExtensionReferenceSurface,\n ExtensionReferenceView,\n ExtensionRegistry,\n} from './types'\n\n/** What a host needs to match a provider's references: JSON-safe. */\nexport interface ReferenceProviderWire {\n id: string\n patterns: readonly ExtensionReferencePattern[]\n surfaces?: readonly ExtensionReferenceSurface[]\n}\n\n/** One reference found in a text: `[start, end)` and the key to resolve. */\nexport interface ReferenceMatch {\n start: number\n end: number\n providerId: string\n key: string\n}\n\nconst ALLOWED_FLAGS = new Set(['i', 'u', 'm', 's'])\nconst MAX_MATCHES = 200\n\n/** Compile a pattern, or `null` when its source doesn't parse. */\nexport function compileReferencePattern(pattern: ExtensionReferencePattern): RegExp | null {\n const flags = [...new Set([...(pattern.flags ?? '')].filter(f => ALLOWED_FLAGS.has(f)))].join('')\n try {\n return new RegExp(pattern.regex, `g${flags}`)\n }\n catch {\n return null\n }\n}\n\nfunction expandKey(template: string, m: RegExpExecArray): string {\n return template.replace(/\\$(\\d)/g, (_, d: string) => m[Number(d)] ?? '').trim()\n}\n\nconst compiled = new WeakMap<readonly ExtensionReferencePattern[], readonly (readonly [RegExp, string])[]>()\n\nfunction compiledPatterns(provider: ReferenceProviderWire): readonly (readonly [RegExp, string])[] {\n let list = compiled.get(provider.patterns)\n if (!list) {\n list = provider.patterns.flatMap((p) => {\n const re = compileReferencePattern(p)\n return re ? [[re, p.key ?? '$0'] as const] : []\n })\n compiled.set(provider.patterns, list)\n }\n return list\n}\n\n/**\n * Every reference in `text` for the providers that scan `surface`, sorted,\n * without overlaps: the earliest start wins, then the longest, then the\n * earlier provider. Zero-length matches are skipped.\n */\nexport function findReferences(\n text: string,\n providers: readonly ReferenceProviderWire[],\n surface?: ExtensionReferenceSurface,\n): ReferenceMatch[] {\n if (!text || providers.length === 0)\n return []\n const found: (ReferenceMatch & { rank: number })[] = []\n providers.forEach((provider, rank) => {\n if (surface && provider.surfaces && !provider.surfaces.includes(surface))\n return\n for (const [re, template] of compiledPatterns(provider)) {\n re.lastIndex = 0\n let m: RegExpExecArray | null\n let n = 0\n // eslint-disable-next-line no-cond-assign\n while ((m = re.exec(text)) && n++ < MAX_MATCHES) {\n if (m[0].length === 0) {\n re.lastIndex++\n continue\n }\n const key = expandKey(template, m)\n if (key)\n found.push({ start: m.index, end: m.index + m[0].length, providerId: provider.id, key, rank })\n }\n }\n })\n found.sort((a, b) => a.start - b.start || (b.end - b.start) - (a.end - a.start) || a.rank - b.rank)\n const out: ReferenceMatch[] = []\n let cursor = 0\n for (const { rank: _rank, ...match } of found) {\n if (match.start < cursor)\n continue\n out.push(match)\n cursor = match.end\n }\n return out\n}\n\n/** The registry's providers as wire data, in registration order. */\nexport function referenceProviderWires(registry: Pick<ExtensionRegistry, 'references'>): ReferenceProviderWire[] {\n return registry.references.map(({ value }) => ({\n id: value.id,\n patterns: value.patterns.map(p => ({ regex: p.regex, ...(p.flags ? { flags: p.flags } : {}), ...(p.key ? { key: p.key } : {}) })),\n ...(value.surfaces ? { surfaces: [...value.surfaces] } : {}),\n }))\n}\n\n/** A view clipped to bounds and stripped of anything not JSON-safe. */\nfunction normalizeView(view: ExtensionReferenceView | undefined): ExtensionReferenceView | null {\n if (!view || typeof view.label !== 'string' || !view.label)\n return null\n const str = (v: unknown, max: number) => (typeof v === 'string' && v ? v.slice(0, max) : undefined)\n const icon = view.icon && (str(view.icon.gui, 128) || str(view.icon.tui, 8))\n ? { ...(str(view.icon.gui, 128) ? { gui: str(view.icon.gui, 128) } : {}), ...(str(view.icon.tui, 8) ? { tui: str(view.icon.tui, 8) } : {}) }\n : undefined\n const tone = view.tone && ['muted', 'subtle', 'accent', 'success', 'warn', 'danger'].includes(view.tone) ? view.tone : undefined\n const status = str(view.status, 64)\n const title = str(view.title, 512)\n const href = str(view.href, 2048)\n return {\n label: view.label.slice(0, 128),\n ...(icon ? { icon } : {}),\n ...(tone ? { tone } : {}),\n ...(status ? { status } : {}),\n ...(title ? { title } : {}),\n ...(href ? { href } : {}),\n }\n}\n\nexport interface ReferenceResolverOptions {\n /** How long a view stays fresh. Default 5 minutes. */\n ttlMs?: number\n /** How long \"names nothing\" is remembered. Default 1 minute. */\n missTtlMs?: number\n /** Per-resolve deadline. Default 8 s. */\n timeoutMs?: number\n now?: () => number\n}\n\nexport interface ReferenceResolver {\n /** The view for `(providerId, key)`; `null` when it names nothing, the provider is unknown, or resolving failed. */\n resolve: (providerId: string, key: string) => Promise<ExtensionReferenceView | null>\n /** Drop every cached view. */\n clear: () => void\n}\n\n/** A cached resolver over the registry's providers. */\nexport function createReferenceResolver(\n registry: Pick<ExtensionRegistry, 'references'>,\n options: ReferenceResolverOptions = {},\n): ReferenceResolver {\n const ttl = options.ttlMs ?? 5 * 60_000\n const missTtl = options.missTtlMs ?? 60_000\n const timeoutMs = options.timeoutMs ?? 8_000\n const now = options.now ?? Date.now\n const cache = new Map<string, { view: ExtensionReferenceView | null, at: number }>()\n const inflight = new Map<string, Promise<ExtensionReferenceView | null>>()\n const byId = (id: string): ExtensionReferenceProvider | undefined => registry.references.find(c => c.value.id === id)?.value\n\n return {\n resolve: async (providerId, key) => {\n const provider = byId(providerId)\n if (!provider)\n return null\n const id = `${providerId}\\u0000${key}`\n const hit = cache.get(id)\n if (hit && now() - hit.at < (hit.view ? ttl : missTtl))\n return hit.view\n const pending = inflight.get(id)\n if (pending)\n return pending\n const run = (async () => {\n const signal = AbortSignal.timeout(timeoutMs)\n try {\n const view = normalizeView(await provider.resolve(key, { signal }))\n cache.set(id, { view, at: now() })\n return view\n }\n catch {\n // Not cached: a transient failure (offline, login pending) is asked again next time.\n return hit?.view ?? null\n }\n finally {\n inflight.delete(id)\n }\n })()\n inflight.set(id, run)\n return run\n },\n clear: () => cache.clear(),\n }\n}\n","/**\n * Panels: renderer-agnostic side-panel contributions.\n *\n * A panel is a tab in the host's side rail (TUI) / side panel (GUI). The\n * extension supplies DATA, never UI: `load()` returns a JSON-safe\n * `PanelContent` the host paints with its own components, so one\n * registration works in-process (TUI) and across the Electron IPC boundary\n * (GUI, where extensions run in the main process and the panel paints in\n * the renderer). `custom` items carry a mandatory markdown `fallback` for\n * hosts without the named renderer, the same invariant transcript custom\n * blocks follow.\n *\n * Interaction flows back as ids: rows and buttons name an `actionId`; the\n * host calls `onAction(actionId, payload)` where the extension runs.\n */\nimport type { JsonValue } from '../types'\nimport type { ExtensionArtifactRow } from './types'\n\n/**\n * Per-surface icon: an iconify class for the GUI, a single glyph for the\n * TUI. The GUI ships Phosphor only (`i-ph-<name>`, `-fill` for a filled\n * weight); other collections are not registered and paint nothing.\n */\nexport interface PanelIcon {\n gui?: string\n tui?: string\n}\n\nexport interface PanelAction {\n id: string\n label: string\n /** `danger` renders in the destructive tint. */\n tone?: 'default' | 'danger'\n}\n\n/** One line in a panel, same presentation as an artifact row. */\nexport interface PanelRowItem extends ExtensionArtifactRow {\n kind: 'row'\n /** Stable key for the host; defaults to the title. */\n id?: string\n /** Fired via `onAction` on click / Enter. `href` opens externally when no action is set. */\n actionId?: string\n /** Extra data handed back with the action. */\n payload?: JsonValue\n}\n\nexport interface PanelMarkdownItem {\n kind: 'markdown'\n text: string\n}\n\nexport interface PanelKeyValueItem {\n kind: 'kv'\n rows: readonly { label: string, value: string }[]\n}\n\n/**\n * Host-specific rich view. The TUI resolves `renderer` against\n * `ctx.tui.registerRenderer` ids (`<extension>/<id>`, bare ids are\n * prefixed at registration); the GUI, and any host without the renderer,\n * paints `fallback` as markdown.\n */\nexport interface PanelCustomItem {\n kind: 'custom'\n renderer: string\n data?: JsonValue\n fallback: string\n}\n\nexport type PanelItem = PanelRowItem | PanelMarkdownItem | PanelKeyValueItem | PanelCustomItem\n\nexport interface PanelSection {\n id: string\n title?: string\n items: readonly PanelItem[]\n /** Collapsed by default when true. */\n collapsed?: boolean\n}\n\nexport interface PanelContent {\n /** Overrides the tab label inside the panel header. */\n title?: string\n /** Count / short tag shown on the tab. `0` and `''` hide it. */\n badge?: number | string\n sections: readonly PanelSection[]\n /** Buttons in the panel footer. */\n actions?: readonly PanelAction[]\n /** Shown when `sections` are empty. */\n empty?: string\n}\n\nexport interface PanelLoadContext {\n /** Active session id, when a session is attached. */\n sessionId?: string\n cwd?: string\n /**\n * What opened the panel, when something pointed at it: a session badge\n * (its artifact `kind`) or one row of its card (`uri` too). Absent for a\n * plain tab pick. Show that item first or expanded; hosts keep sending it\n * on reloads until the panel is opened for something else.\n */\n focus?: PanelFocus\n}\n\nexport interface PanelFocus {\n kind?: string\n uri?: string\n}\n\n/**\n * A load context from across a boundary (the GUI renderer), reduced to its\n * known string fields. Hosts run it before handing the context to `load` /\n * `onAction`.\n */\nexport function normalizePanelLoadContext(raw: unknown): PanelLoadContext {\n const ctx = raw && typeof raw === 'object' ? raw as Record<string, unknown> : {}\n const str = (v: unknown, max: number) => (typeof v === 'string' && v && v.length <= max ? v : undefined)\n const sessionId = str(ctx.sessionId, 512)\n const cwd = str(ctx.cwd, 4096)\n const focusRaw = ctx.focus && typeof ctx.focus === 'object' ? ctx.focus as Record<string, unknown> : undefined\n const kind = str(focusRaw?.kind, 64)\n const uri = str(focusRaw?.uri, 2048)\n return {\n ...(sessionId ? { sessionId } : {}),\n ...(cwd ? { cwd } : {}),\n ...(kind || uri ? { focus: { ...(kind ? { kind } : {}), ...(uri ? { uri } : {}) } } : {}),\n }\n}\n\nexport interface ExtensionPanel {\n /** Stable id; namespaced `<extension>/<id>` at registration. */\n id: string\n label: string\n icon?: PanelIcon\n /** Produce the current content. Called on open, on `subscribe` emits, and on explicit refresh. */\n load: (ctx: PanelLoadContext) => PanelContent | Promise<PanelContent>\n /**\n * Live updates: call `emit()` whenever `load()` would return something\n * new. Return an unsubscribe. Hosts debounce emits and only reload while\n * the panel is visible.\n */\n subscribe?: (emit: () => void) => () => void\n /** Row / button callbacks. Runs where the extension runs. */\n onAction?: (actionId: string, payload: JsonValue | undefined, ctx: PanelLoadContext) => void | Promise<void>\n}\n\n/** Registry entry: the definition plus its owning extension. */\nexport interface ExtensionPanelEntry extends ExtensionPanel {\n owner: string\n}\n\n// ---------------------------------------------------------------------------\n// Normalisation\n// ---------------------------------------------------------------------------\n\n/** Caps applied before content crosses IPC or reaches a renderer. */\nexport const PANEL_CONTENT_LIMITS = {\n sections: 32,\n itemsPerSection: 200,\n actions: 8,\n /** Per string field. */\n textChars: 20_000,\n /** Whole payload, JSON-serialised. */\n bytes: 512 * 1024,\n} as const\n\nfunction str(v: unknown, max: number = PANEL_CONTENT_LIMITS.textChars): string | undefined {\n return typeof v === 'string' ? (v.length > max ? `${v.slice(0, max - 1)}…` : v) : undefined\n}\n\n/**\n * Coerce whatever `load()` returned into a well-formed `PanelContent`:\n * unknown item kinds and malformed entries are dropped, strings are\n * trimmed to the caps, and the whole thing is size-bounded. Never throws.\n */\nexport function normalizePanelContent(input: unknown): PanelContent {\n const empty: PanelContent = { sections: [] }\n if (!input || typeof input !== 'object')\n return empty\n const o = input as Record<string, unknown>\n\n const sections: PanelSection[] = []\n if (Array.isArray(o.sections)) {\n for (const raw of o.sections.slice(0, PANEL_CONTENT_LIMITS.sections)) {\n const s = normalizeSection(raw, sections.length)\n if (s)\n sections.push(s)\n }\n }\n\n const actions: PanelAction[] = []\n if (Array.isArray(o.actions)) {\n for (const raw of o.actions.slice(0, PANEL_CONTENT_LIMITS.actions)) {\n if (raw && typeof raw === 'object') {\n const a = raw as Record<string, unknown>\n const id = str(a.id, 200)\n const label = str(a.label, 200)\n if (id && label)\n actions.push({ id, label, ...(a.tone === 'danger' ? { tone: 'danger' as const } : {}) })\n }\n }\n }\n\n const out: PanelContent = { sections }\n const title = str(o.title, 200)\n if (title)\n out.title = title\n if (typeof o.badge === 'number' && Number.isFinite(o.badge))\n out.badge = o.badge\n else if (typeof o.badge === 'string' && o.badge)\n out.badge = o.badge.slice(0, 12)\n if (actions.length > 0)\n out.actions = actions\n const emptyText = str(o.empty, 500)\n if (emptyText)\n out.empty = emptyText\n\n return enforceBytes(out)\n}\n\nfunction normalizeSection(raw: unknown, index: number): PanelSection | null {\n if (!raw || typeof raw !== 'object')\n return null\n const s = raw as Record<string, unknown>\n const items: PanelItem[] = []\n if (Array.isArray(s.items)) {\n for (const item of s.items.slice(0, PANEL_CONTENT_LIMITS.itemsPerSection)) {\n const n = normalizeItem(item)\n if (n)\n items.push(n)\n }\n }\n const out: PanelSection = { id: str(s.id, 200) ?? `section-${index}`, items }\n const title = str(s.title, 200)\n if (title)\n out.title = title\n if (s.collapsed === true)\n out.collapsed = true\n return out\n}\n\nfunction normalizeItem(raw: unknown): PanelItem | null {\n if (!raw || typeof raw !== 'object')\n return null\n const i = raw as Record<string, unknown>\n switch (i.kind) {\n case 'row': {\n const title = str(i.title, 500)\n if (!title)\n return null\n const out: PanelRowItem = { kind: 'row', title }\n const id = str(i.id, 200)\n const subtitle = str(i.subtitle, 1000)\n const href = str(i.href, 2000)\n const status = str(i.status, 60)\n const actionId = str(i.actionId, 200)\n if (id)\n out.id = id\n if (subtitle)\n out.subtitle = subtitle\n if (href)\n out.href = href\n if (status)\n out.status = status\n if (actionId)\n out.actionId = actionId\n if (Array.isArray(i.badges))\n out.badges = i.badges.filter(isBadge).slice(0, 8)\n if (i.payload !== undefined && isJsonValue(i.payload))\n out.payload = i.payload\n return out\n }\n case 'markdown': {\n const text = str(i.text)\n return text === undefined ? null : { kind: 'markdown', text }\n }\n case 'kv': {\n if (!Array.isArray(i.rows))\n return null\n const rows = i.rows\n .map((r) => {\n if (!r || typeof r !== 'object')\n return null\n const row = r as Record<string, unknown>\n const label = str(row.label, 200)\n const value = str(row.value, 2000)\n return label !== undefined && value !== undefined ? { label, value } : null\n })\n .filter((r): r is { label: string, value: string } => r !== null)\n .slice(0, PANEL_CONTENT_LIMITS.itemsPerSection)\n return { kind: 'kv', rows }\n }\n case 'custom': {\n const renderer = str(i.renderer, 200)\n const fallback = str(i.fallback)\n if (!renderer || fallback === undefined)\n return null\n const out: PanelCustomItem = { kind: 'custom', renderer, fallback }\n if (i.data !== undefined && isJsonValue(i.data))\n out.data = i.data\n return out\n }\n default:\n return null\n }\n}\n\nfunction isBadge(v: unknown): v is NonNullable<ExtensionArtifactRow['badges']>[number] {\n return Boolean(v && typeof v === 'object' && typeof (v as { text?: unknown }).text === 'string')\n}\n\nfunction isJsonValue(v: unknown): v is JsonValue {\n try {\n JSON.stringify(v)\n return v !== undefined && typeof v !== 'function' && typeof v !== 'symbol'\n }\n catch {\n return false\n }\n}\n\n/**\n * Trim sections from the end until the payload fits the byte budget. A\n * panel that overflows keeps its first sections and gets an `empty`-style\n * note appended so the truncation is visible.\n */\nfunction enforceBytes(content: PanelContent): PanelContent {\n const size = (c: PanelContent) => JSON.stringify(c).length\n if (size(content) <= PANEL_CONTENT_LIMITS.bytes)\n return content\n const sections = [...content.sections]\n while (sections.length > 0 && size({ ...content, sections }) > PANEL_CONTENT_LIMITS.bytes)\n sections.pop()\n return {\n ...content,\n sections: [\n ...sections,\n { id: 'truncated', items: [{ kind: 'markdown', text: '_Panel content truncated (too large)._' }] },\n ],\n }\n}\n\n/** Tab badge as shown next to the label; `undefined` when nothing to show. */\nexport function panelBadgeText(badge: PanelContent['badge']): string | undefined {\n if (badge === undefined || badge === 0 || badge === '')\n return undefined\n if (typeof badge === 'number')\n return badge > 99 ? '99+' : String(badge)\n return badge\n}\n","/**\n * Context-usage breakdown — pure transforms.\n *\n * Turns a {@link ContextSnapshot} (the raw pieces the agent assembled for a\n * run: system prompt, wire tools, deferred tools, MCP tools/instructions,\n * skills catalog, ...) plus the real last-turn token total into a categorized\n * {@link ContextBreakdown} the TUI panel / GUI popover render.\n *\n * No React, no node — a browser-context renderer imports these via\n * `zidane/chat/pure`. The snapshot is captured main-side (TUI direct, GUI in\n * `main/chat`) because building it reads provider/agent state; only the pure\n * shaping lives here.\n *\n * Accuracy: per-category counts are estimates when no provider `countTokens`\n * is available — the heuristic ({@link estimateTokens}, ~4 bytes/token) sizes\n * each static segment and the bar is reconciled so it always sums to the real\n * last-turn total (`conversation = realTotal - sum(static)`). When a provider\n * exposes exact counts (Anthropic, OpenAI), the caller passes them in via\n * {@link ContextSnapshot.exact} and the corresponding categories drop their\n * `estimated` flag. Exact buckets (free space, autocompact buffer) are never\n * estimated.\n */\n\nimport type { SessionTurn } from '../types'\nimport { estimateTokens } from '../compact/utils'\n\n/**\n * Stable identifiers for each breakdown category. Drives swatch color +\n * ordering in both UIs. `*Deferred` buckets are tools/MCP that exist but are\n * NOT currently on the wire (lazy disclosure); `autocompactBuffer` is the\n * reserved output headroom; `freeSpace` is the remaining window.\n */\nexport type ContextCategoryId\n = | 'systemPrompt'\n | 'rules'\n | 'tools'\n | 'mcpTools'\n | 'mcpInstructions'\n | 'skills'\n | 'subagentDefs'\n | 'conversation'\n | 'mcpToolsDeferred'\n | 'toolsDeferred'\n | 'autocompactBuffer'\n | 'freeSpace'\n\n/**\n * Exact last-turn token usage split (provider-reported — always exact). Drives\n * the cache breakdown shown below the categories. `cacheRead + cacheCreation +\n * input` equals the live context total (`used`).\n */\nexport interface ContextUsageSplit {\n /** Fresh, uncached input tokens this turn. */\n input: number\n /** Tokens served from the prompt cache (the cached prefix). */\n cacheRead: number\n /** Tokens written to the cache this turn. */\n cacheCreation: number\n /** Assistant output tokens (not part of the input window; informational). */\n output: number\n}\n\n/** One display row contributed by an extension to the context panel. */\nexport interface ContextExtensionRow {\n label: string\n value: string\n}\n\n/** Extension-owned context panel section. Core treats rows as opaque display data. */\nexport interface ContextExtensionSection {\n id: string\n label: string\n /** Optional section-title foreground color. UIs fall back to their theme accent. */\n accentColor?: string\n rows: readonly ContextExtensionRow[]\n}\n\n/** Data exposed to extension context-breakdown contributors. */\nexport interface ContextBreakdownContributionContext {\n turns: readonly SessionTurn[]\n}\n\n/** Extension hook for adding opaque rows to the context panel. */\nexport type ContextBreakdownContributor\n = (ctx: ContextBreakdownContributionContext) =>\n | ContextExtensionSection\n | readonly ContextExtensionSection[]\n | null\n | undefined\n | Promise<ContextExtensionSection | readonly ContextExtensionSection[] | null | undefined>\n\n/** One expandable child row under a category (e.g. a single MCP tool / memory file). */\nexport interface ContextItem {\n /** Stable-ish key for rendering (tool name, file path). */\n id: string\n /** Display label. */\n label: string\n /** Token count for this item. */\n tokens: number\n /** True when `tokens` came from the heuristic rather than an exact count. */\n estimated: boolean\n /** Tool description (tool items only) — what a UI shows on hover. */\n description?: string\n /** Owning group when the category flattens several (MCP server name). */\n group?: string\n}\n\n/** One category row in the breakdown. */\nexport interface ContextCategory {\n id: ContextCategoryId\n /** Display label (e.g. \"Tool definitions\"). */\n label: string\n /** Token count for the category. */\n tokens: number\n /** True when `tokens` came from the heuristic rather than an exact count. */\n estimated: boolean\n /**\n * True for buckets that are NOT counted against the live window total\n * (deferred tools, free space, autocompact buffer) — the UI renders these\n * dimmed / below a divider, mirroring Claude Code's layout.\n */\n deferred?: boolean\n /** Optional expandable child rows (per MCP tool, per memory file, ...). */\n items?: ContextItem[]\n}\n\n/** The shaped, render-ready breakdown. */\nexport interface ContextBreakdown {\n /** Model id the snapshot was built for. */\n modelId: string\n /**\n * Real last-turn context size (provider-reported `input + cacheRead +\n * cacheCreation`) — the SAME number the footer/orb shows. The non-deferred\n * categories always sum to this.\n */\n used: number\n /** Effective window (raw - output reserve), the bar's denominator. */\n effectiveWindow: number\n /** `used / effectiveWindow`, clamped to [0, 1]. */\n fraction: number\n /** Live categories (sum to `used`) followed by deferred + free-space buckets. */\n categories: ContextCategory[]\n /** True when ANY live category is estimated (drives the panel's footnote). */\n hasEstimates: boolean\n /**\n * Exact last-turn usage split (cache read / write / fresh input / output),\n * when the host supplied it. Always exact — rendered as an informational\n * section below the categories. Absent when no usage is available yet.\n */\n usage?: ContextUsageSplit\n /** Extension-owned context panel sections. */\n extensionSections?: readonly ContextExtensionSection[]\n /**\n * Names of currently-active skills. Informational — an activated skill's body\n * lands in the conversation (tool-results), so its tokens are already counted\n * under Conversation; this just surfaces \"which skills are loaded\". Empty/absent\n * when none are active.\n */\n activeSkills?: string[]\n}\n\n/** Host-supplied options for `agent.getContextBreakdown`. */\nexport interface ContextBreakdownOptions {\n /**\n * Effective context window (`rawWindow - outputReserve`) for the active\n * model, resolved by the host via the chat model registry. Drives free-space\n * + fraction. When omitted, defaults to `used` (no headroom shown).\n */\n effectiveWindow?: number\n /**\n * Active model id — used for the exact `countTokens` call + the header label.\n * Only consulted on the PRE-RUN path (no snapshot yet); once a run has fired,\n * the snapshot's own model wins. When omitted, the provider default is used.\n */\n model?: string\n /** Tokens reserved for output (autocompact buffer). Defaults to 0. */\n autocompactBuffer?: number\n /**\n * Auto-compact threshold as a fraction of the window (0–1), when enabled.\n * When set, the \"Autocompact buffer\" bucket represents the ENTIRE tail from\n * the threshold to the end of the window (`(1 − threshold) × window`) rather\n * than just the reserved-output tokens — so the bar/row show exactly where\n * compaction fires. When omitted, `autocompactBuffer` is used as-is.\n */\n compactThreshold?: number\n /** Abort signal forwarded to the provider's `countTokens`. */\n signal?: AbortSignal\n}\n\n/** Tools grouped by MCP server, for the expandable per-server rows. */\nexport interface ContextMcpGroup {\n server: string\n /** Wire tool specs for this server (their JSON size is measured). */\n tools: { name: string, json: string, description?: string }[]\n}\n\n/**\n * Exact per-segment counts from a provider's `countTokens`, when available.\n * Each field is the count of the cumulative payload up to and including that\n * segment, so categories are derived by differencing (see\n * {@link buildContextBreakdown}). Any subset may be present; missing fields\n * fall back to the heuristic for that category.\n */\nexport interface ContextExactCounts {\n /** Tokens for system prompt alone. */\n system?: number\n /** Tokens for system + tools (so tools = systemAndTools - system). */\n systemAndTools?: number\n /** Tokens for the full payload (system + tools + messages) = the real total. */\n full?: number\n}\n\n/**\n * Raw inputs captured at agent prompt-assembly time. Everything here is what\n * actually went on (or was withheld from) the wire for the last run.\n */\nexport interface ContextSnapshot {\n modelId: string\n /** Full rendered system prompt (marker-stripped, as sent). */\n system: string\n /**\n * Host-composed base system BEFORE the agent appended skills / searchable /\n * MCP-instructions catalogs. Includes the rules block. The \"System prompt\"\n * (base doctrine) bucket = base − rules − env-noise. Defaults to `system`\n * when not provided (back-compat).\n */\n baseSystem?: string\n /** Rendered AGENTS.md/CLAUDE.md rules block (a substring of `baseSystem`). */\n rulesBlock?: string\n /** Source files behind the rules block, for per-file rows. */\n rulesFiles?: { path: string, source: string }[]\n /** Wire tool specs currently disclosed to the model, as JSON strings. */\n toolsJson: string[]\n /**\n * Per-tool detail for `toolsJson`, same order, when the host has it —\n * lets the breakdown list native tools like it lists MCP tools. Optional so\n * SDK callers assembling a snapshot by hand are unaffected.\n */\n toolItems?: { name: string, json: string, description?: string }[]\n /** Lazy tool entries NOT currently disclosed (deferred), as JSON strings. */\n deferredToolsJson: string[]\n /** MCP tools grouped by server (disclosed ones). */\n mcpGroups: ContextMcpGroup[]\n /** Deferred (undisclosed) MCP tools grouped by server. */\n deferredMcpGroups: ContextMcpGroup[]\n /** Rendered MCP instructions block, if any. */\n mcpInstructions?: string\n /** Rendered skills catalog text, if any. */\n skillsCatalog?: string\n /** Lazy-tool `<searchable_tools>` catalog text, if any (key name is historical). */\n subagentDefs?: string\n /** Memory / rules files in context. */\n /** Real last-turn total (input + cacheRead + cacheCreation). */\n used: number\n /** Effective window (raw - output reserve). */\n effectiveWindow: number\n /** Tokens reserved for output (autocompact buffer). */\n autocompactBuffer: number\n /** Exact per-segment counts from the provider, when available. */\n exact?: ContextExactCounts\n /** Exact last-turn usage split, when available (passed straight through). */\n usage?: ContextUsageSplit\n /** Extension-owned context panel sections. */\n extensionSections?: readonly ContextExtensionSection[]\n /** Names of currently-active skills (passed straight through). */\n activeSkills?: string[]\n}\n\nconst LABELS: Record<ContextCategoryId, string> = {\n systemPrompt: 'System prompt',\n rules: 'Rules (AGENTS.md)',\n tools: 'Tool definitions',\n mcpTools: 'MCP tools',\n mcpInstructions: 'MCP instructions',\n skills: 'Skills',\n subagentDefs: 'Searchable tools catalog',\n conversation: 'Conversation',\n mcpToolsDeferred: 'MCP tools (deferred)',\n toolsDeferred: 'System tools (deferred)',\n autocompactBuffer: 'Autocompact buffer',\n freeSpace: 'Free space',\n}\n\n/** Sum the heuristic token sizes of a list of strings. */\nfunction sumEstimate(parts: readonly string[]): number {\n let total = 0\n for (const p of parts)\n total += estimateTokens(p)\n return total\n}\n\nfunction mcpGroupTokens(group: ContextMcpGroup): { total: number, items: ContextItem[] } {\n const items: ContextItem[] = group.tools.map(t => ({\n id: `${group.server}:${t.name}`,\n label: t.name,\n tokens: estimateTokens(t.json),\n estimated: true,\n ...(t.description ? { description: t.description } : {}),\n group: group.server,\n }))\n let total = 0\n for (const it of items)\n total += it.tokens\n return { total, items }\n}\n\n/**\n * Shape a {@link ContextSnapshot} into a render-ready {@link ContextBreakdown}.\n *\n * Live categories (system prompt, tools, MCP tools/instructions, skills,\n * memory, searchable-tools catalog, conversation) sum to `snapshot.used` — `conversation`\n * absorbs the remainder so the bar matches the provider-reported total exactly.\n * Deferred + autocompact + free-space buckets follow.\n *\n * When `snapshot.exact` carries provider counts, the matching categories use\n * them (system, tools) and drop their `estimated` flag; everything else stays\n * on the heuristic.\n */\nexport function buildContextBreakdown(snapshot: ContextSnapshot): ContextBreakdown {\n const exact = snapshot.exact\n const systemExact = typeof exact?.system === 'number'\n\n // --- System-embedded sub-sections (heuristic) ----------------------------\n // The exact `count_tokens` system number covers the WHOLE system text. The\n // appended catalogs (rules / skills / MCP instructions / searchable-tools catalog) all\n // live inside it, so we size each heuristically and let the \"System prompt\"\n // (base doctrine) bucket absorb the remainder — keeping the system group's\n // sum exact while still attributing each section.\n const rulesTokens = snapshot.rulesBlock ? estimateTokens(snapshot.rulesBlock) : 0\n const rulesItems: ContextItem[] = (snapshot.rulesFiles ?? []).map(f => ({\n id: f.path,\n label: f.path,\n // Per-file size isn't separable from the rendered block; show the path only\n // (tokens 0, not estimated — there's nothing to estimate) so the row lists\n // sources without implying a per-file count or a `~` marker.\n tokens: 0,\n estimated: false,\n }))\n const skillsTokens = snapshot.skillsCatalog ? estimateTokens(snapshot.skillsCatalog) : 0\n const mcpInstructionsTokens = snapshot.mcpInstructions ? estimateTokens(snapshot.mcpInstructions) : 0\n const subagentTokens = snapshot.subagentDefs ? estimateTokens(snapshot.subagentDefs) : 0\n const embeddedSubsections = rulesTokens + skillsTokens + mcpInstructionsTokens + subagentTokens\n\n // System TOTAL (whole system text) — exact when available.\n const systemTotal = systemExact ? exact!.system! : estimateTokens(snapshot.system)\n // Base doctrine = system total minus the attributed sub-sections.\n const baseSystemTokens = Math.max(0, systemTotal - embeddedSubsections)\n\n // --- Native tool definitions (non-MCP, disclosed) ------------------------\n // When exact `systemAndTools` is available it covers BOTH native + MCP tools,\n // so we split that combined number proportionally by heuristic weight rather\n // than claiming exactness per sub-bucket.\n const nativeToolsEst = sumEstimate(snapshot.toolsJson)\n const mcpDisclosed = snapshot.mcpGroups.map(mcpGroupTokens)\n const mcpToolsEst = mcpDisclosed.reduce((a, g) => a + g.total, 0)\n\n let nativeToolsTokens = nativeToolsEst\n let mcpToolsTokens = mcpToolsEst\n let toolsEstimated = true\n if (systemExact && typeof exact?.systemAndTools === 'number') {\n const exactToolsTotal = Math.max(0, exact.systemAndTools - exact.system!)\n const estTotal = nativeToolsEst + mcpToolsEst\n if (estTotal > 0) {\n nativeToolsTokens = Math.round(exactToolsTotal * (nativeToolsEst / estTotal))\n mcpToolsTokens = exactToolsTotal - nativeToolsTokens\n }\n else {\n nativeToolsTokens = exactToolsTotal\n mcpToolsTokens = 0\n }\n toolsEstimated = false\n }\n\n // --- Live categories -----------------------------------------------------\n // Detailed split. The system-embedded sub-sections (rules / skills / MCP\n // instructions / searchable-tools catalog) are heuristic; the \"System prompt\" base\n // bucket carries the exact remainder so the whole system group still sums to\n // the exact system count. Tools/MCP-tools/conversation are split as before.\n const live: ContextCategory[] = []\n const push = (id: ContextCategoryId, tokens: number, estimated: boolean, items?: ContextItem[]) => {\n if (tokens <= 0 && !items?.length)\n return\n live.push({ id, label: LABELS[id], tokens: Math.max(0, tokens), estimated, ...(items?.length ? { items } : {}) })\n }\n\n // System group: base doctrine (exact remainder) + attributed sub-sections.\n push('systemPrompt', baseSystemTokens, !systemExact)\n push('rules', rulesTokens, true, rulesItems)\n push('skills', skillsTokens, true)\n push('mcpInstructions', mcpInstructionsTokens, true)\n push('subagentDefs', subagentTokens, true)\n // Tools.\n push('tools', nativeToolsTokens, toolsEstimated, snapshot.toolItems?.map(t => ({\n id: t.name,\n label: t.name,\n tokens: estimateTokens(t.json),\n estimated: true,\n ...(t.description ? { description: t.description } : {}),\n })))\n push('mcpTools', mcpToolsTokens, toolsEstimated, mcpDisclosed.flatMap(g => g.items))\n\n // --- Conversation = remainder (keeps the bar summing to `used`) ----------\n const accountedStatic = live.reduce((a, c) => a + c.tokens, 0)\n const conversationTokens = Math.max(0, snapshot.used - accountedStatic)\n // Exact when both system AND tools were exactly counted — then the remainder\n // (used − exactSystem − exactTools) is itself exact, since `used` is the\n // provider-reported total.\n const conversationEstimated = !(systemExact && !toolsEstimated)\n push('conversation', conversationTokens, conversationEstimated)\n\n // --- Deferred buckets (not counted against `used`) -----------------------\n const deferred: ContextCategory[] = []\n const deferredNativeTools = sumEstimate(snapshot.deferredToolsJson)\n if (deferredNativeTools > 0) {\n deferred.push({ id: 'toolsDeferred', label: LABELS.toolsDeferred, tokens: deferredNativeTools, estimated: true, deferred: true })\n }\n const deferredMcp = snapshot.deferredMcpGroups.map(mcpGroupTokens)\n const deferredMcpTotal = deferredMcp.reduce((a, g) => a + g.total, 0)\n if (deferredMcpTotal > 0) {\n deferred.push({\n id: 'mcpToolsDeferred',\n label: LABELS.mcpToolsDeferred,\n tokens: deferredMcpTotal,\n estimated: true,\n deferred: true,\n items: deferredMcp.flatMap(g => g.items),\n })\n }\n\n // --- Autocompact buffer + free space (exact) -----------------------------\n if (snapshot.autocompactBuffer > 0) {\n deferred.push({ id: 'autocompactBuffer', label: LABELS.autocompactBuffer, tokens: snapshot.autocompactBuffer, estimated: false, deferred: true })\n }\n const free = Math.max(0, snapshot.effectiveWindow - snapshot.used)\n deferred.push({ id: 'freeSpace', label: LABELS.freeSpace, tokens: free, estimated: false, deferred: true })\n\n const categories = [...live, ...deferred]\n const hasEstimates = live.some(c => c.estimated && c.tokens > 0)\n const fraction = snapshot.effectiveWindow > 0\n ? Math.max(0, Math.min(1, snapshot.used / snapshot.effectiveWindow))\n : 0\n\n return {\n modelId: snapshot.modelId,\n used: snapshot.used,\n effectiveWindow: snapshot.effectiveWindow,\n fraction,\n categories,\n hasEstimates,\n ...(snapshot.usage ? { usage: snapshot.usage } : {}),\n ...(snapshot.extensionSections?.length ? { extensionSections: snapshot.extensionSections } : {}),\n ...(snapshot.activeSkills?.length ? { activeSkills: snapshot.activeSkills } : {}),\n }\n}\n","/**\n * Context segments — pure transforms.\n *\n * Sibling to `context-breakdown.ts`: where that module answers \"how many\n * tokens is each part of my context\", this one answers \"what IS each part,\n * and where did it come from\". It turns the same assembled-prompt pieces into\n * a flat list of {@link ContextSegment}s carrying the actual TEXT plus its\n * provenance, so a UI can list every chunk loaded by default in a session,\n * let the user read it, and open the file behind it when there is one.\n *\n * No React, no node — a browser-context renderer imports these via\n * `zidane/chat/pure`.\n *\n * Provenance is honest about what can and can't be opened:\n * - `'file'` — a real path on disk (AGENTS.md / CLAUDE.md / ruler md).\n * The only origin that carries `path`, hence the only one\n * a host can hand to `$EDITOR`.\n * - `'built-in'` — compiled into the binary (base doctrine).\n * - `'generated'` — assembled at prompt time from discovered state (the\n * skills catalog is rendered from the skill manifests,\n * the searchable-tools catalog from lazy MCP tools).\n * - `'mcp'` — served by a remote MCP server at connect time.\n */\n\nimport { estimateTokens } from '../compact/utils'\n\n/** Where a segment's text came from. Only `'file'` segments carry a `path`. */\nexport type ContextSegmentOrigin = 'built-in' | 'file' | 'generated' | 'mcp'\n\n/** One chunk of text present in the session's default context. */\nexport interface ContextSegment {\n /** Stable key for rendering (`'system'`, `'rules:<path>'`, `'skills'`, ...). */\n id: string\n /** Display label (e.g. \"System prompt\", or the file's basename). */\n label: string\n origin: ContextSegmentOrigin\n /**\n * Short right-hand qualifier — the instruction scope for files, the server\n * list for MCP, a count for the skills catalog. Absent when there's nothing\n * useful to add beyond the origin badge.\n */\n detail?: string\n /** The text itself, as it sits in the prompt. Empty segments are dropped. */\n text: string\n /**\n * Absolute path of the file backing this segment. Present only for\n * `origin: 'file'` — a host uses it as the \"open in $EDITOR\" target.\n */\n path?: string\n /**\n * Heuristic token size (~4 bytes/token). Always an estimate: exact\n * per-segment counts aren't separable from the single system-prompt string\n * the provider counts, which is why {@link ContextSegment} carries no\n * `estimated` flag — every value here is one.\n */\n tokens: number\n}\n\n/**\n * A host-discovered instruction file. Structurally compatible with\n * `AgentsMdFile` from `./agents-md` (whose `source` field is the SCOPE, not\n * the text — `contents` is the text), so callers can pass those straight in.\n */\nexport interface ContextSegmentFile {\n path: string\n /** Instruction scope — `'project'` / `'user'`, surfaced as the row detail. */\n source?: string\n contents: string\n}\n\n/**\n * The assembled-prompt pieces {@link buildContextSegments} shapes. Mirrors the\n * subset of the agent's `ContextAssembly` that carries text, plus host-side\n * instruction files (which the assembly only knows as paths).\n */\nexport interface ContextSegmentsInput {\n /**\n * Host-composed base system BEFORE the agent appended its catalogs. The\n * rules block is a substring of this; the \"System prompt\" segment is the\n * remainder. Falls back to `system` when absent, which over-attributes the\n * appended catalogs into the base row rather than losing them.\n */\n baseSystem?: string\n /** Full rendered system prompt as sent. Used as the `baseSystem` fallback. */\n system?: string\n /**\n * Rendered instruction block (a substring of `baseSystem`). Subtracted from\n * the base so its text isn't reported twice — once as doctrine and once as\n * per-file rows.\n */\n rulesBlock?: string\n /** The files behind `rulesBlock`, each with its own text. */\n rulesFiles?: readonly ContextSegmentFile[]\n /**\n * Absolute path of a `SYSTEM.md` override backing the base prompt. When set,\n * the \"System prompt\" segment reports `origin: 'file'` and becomes openable\n * — the doctrine is the user's file, not compiled-in text.\n */\n systemPath?: string\n /** Rendered skills catalog (the per-skill blurbs, not skill bodies). */\n skillsCatalog?: string\n /** Rendered MCP instructions block. */\n mcpInstructions?: string\n /**\n * Lazy-tool `<searchable_tools>` catalog text. Key name is historical — it\n * holds no subagent definitions.\n */\n subagentDefs?: string\n}\n\n/**\n * Remove the first occurrence of `part` from `whole`, collapsing the blank-line\n * run left AT THE JOIN.\n *\n * Used to carve the rules block out of the base system so the \"System prompt\"\n * segment reports only doctrine + env. Substring-based because that's the\n * contract the assembly documents (`rulesBlock` IS a substring of\n * `baseSystem`); a miss leaves `whole` untouched, which degrades to\n * over-reporting the base row rather than dropping text on the floor.\n *\n * The collapse is deliberately scoped to the seam. An earlier version ran\n * `/\\n{3,}/g` over the whole result, which rewrote blank-line runs ANYWHERE in\n * the doctrine — and this tab exists precisely so the user can read what is in\n * context, not a reflowed approximation of it. Interior bytes now survive\n * verbatim; only the newlines that met when `part` was excised are normalized,\n * plus a `trim()` so a segment can't open or close on blank lines.\n */\nfunction removeFirst(whole: string, part: string): string {\n if (!part)\n return whole\n const at = whole.indexOf(part)\n if (at < 0)\n return whole\n const before = whole.slice(0, at)\n const after = whole.slice(at + part.length)\n const trailing = /\\n*$/.exec(before)?.[0] ?? ''\n const leading = /^\\n*/.exec(after)?.[0] ?? ''\n // Two newlines (one blank line) is the separator the prompt builder uses\n // between sections, so that's what the seam becomes when either side had any.\n const seam = trailing.length + leading.length >= 2 ? '\\n\\n' : `${trailing}${leading}`\n const head = before.slice(0, before.length - trailing.length)\n return `${head}${seam}${after.slice(leading.length)}`.trim()\n}\n\n/**\n * Best-effort display name for an instruction file: its basename, with the\n * parent directory prefixed when the basename alone would be ambiguous\n * (`AGENTS.md` appears at up to four paths per scope). Path-separator handling\n * covers both POSIX and Windows so this stays node-free.\n */\nfunction fileLabel(path: string): string {\n const parts = path.split(/[/\\\\]/).filter(Boolean)\n const base = parts.at(-1) ?? path\n const parent = parts.at(-2)\n // A dotted parent (`.agents`, `.zidane`, `.claude`, `.ruler`) is the\n // meaningful discriminator between same-named instruction files.\n return parent?.startsWith('.') ? `${parent}/${base}` : base\n}\n\n/**\n * Shape assembled-prompt pieces into a flat, render-ready segment list.\n *\n * Order is prompt order — base doctrine, then instruction files (broadest\n * scope first, as `discoverAgentsMd` returns them), then the appended\n * catalogs. Empty / whitespace-only pieces are dropped so the list never\n * shows a zero-byte row.\n */\nexport function buildContextSegments(input: ContextSegmentsInput): ContextSegment[] {\n const segments: ContextSegment[] = []\n const push = (seg: Omit<ContextSegment, 'tokens'>) => {\n if (!seg.text.trim())\n return\n segments.push({ ...seg, tokens: estimateTokens(seg.text) })\n }\n\n // --- Base doctrine -------------------------------------------------------\n // `baseSystem` minus the rules block. The per-file rows below carry the\n // instruction text, so leaving the block in would double-report it.\n const base = input.baseSystem ?? input.system ?? ''\n const overridden = input.systemPath !== undefined\n push({\n id: 'system',\n label: 'System prompt',\n // An override makes this a real file on disk; without one it's compiled in.\n origin: overridden ? 'file' : 'built-in',\n detail: overridden ? 'SYSTEM.md override + environment' : 'doctrine + environment',\n text: input.rulesBlock ? removeFirst(base, input.rulesBlock) : base,\n ...(input.systemPath !== undefined ? { path: input.systemPath } : {}),\n })\n\n // --- Instruction files ---------------------------------------------------\n // The only file-backed segments, and so the only openable ones.\n for (const file of input.rulesFiles ?? []) {\n push({\n id: `rules:${file.path}`,\n label: fileLabel(file.path),\n origin: 'file',\n ...(file.source ? { detail: file.source } : {}),\n text: file.contents,\n path: file.path,\n })\n }\n\n // --- Appended catalogs ---------------------------------------------------\n push({\n id: 'skills',\n label: 'Skills catalog',\n origin: 'generated',\n detail: 'name + description per skill (bodies load on activation)',\n text: input.skillsCatalog ?? '',\n })\n push({\n id: 'mcp-instructions',\n label: 'MCP instructions',\n origin: 'mcp',\n detail: 'served by the connected servers',\n text: input.mcpInstructions ?? '',\n })\n push({\n id: 'subagent-defs',\n label: 'Searchable tools',\n origin: 'generated',\n detail: 'name + description per lazy MCP tool (schemas load via tool_search)',\n text: input.subagentDefs ?? '',\n })\n\n return segments\n}\n"],"mappings":";;AAiFA,MAAM,WAAW;AACjB,MAAM,uBAAuB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O,UAAU,KAAK,IAAI;EAC1B,QAAQ;EACR,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;EAC7C,MAAM,KAAK;EACX,MAAM,KAAK;CACb,CAAC;CAIH,KAAK;EACH,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,MAAM,MAAM,iBAAiB;CAC/B,CAAC;CACD,KAAK;EACH,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,MAAM,MAAM,mBAAmB;CACjC,CAAC;CACD,KAAK;EACH,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,MAAM,MAAM,gBAAgB;CAC9B,CAAC;CAED,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { r as createStderrLineEmitter } from "./mcp-CgNd-f3F.js";
1
+ import { o as createStderrLineEmitter } from "./mcp-_wecH9Qe.js";
2
2
  import { Buffer } from "node:buffer";
3
3
  //#region src/mcp/context-transport.ts
4
4
  /**
@@ -10,7 +10,7 @@ import { Buffer } from "node:buffer";
10
10
  async function createContextStdioTransport(options) {
11
11
  const { name, context, handle, command, cwd, env, hooks } = options;
12
12
  if (!context.execStream) throw new Error(`MCP server "${name}" is configured with \`scope: 'context'\`, but the '${context.type}' execution context does not support live streams (\`execStream\`). Use \`scope: 'host'\` for this server, or switch to a context that advertises \`capabilities.stream\`.`);
13
- const { ReadBuffer, serializeMessage } = await import("./stdio-DPpBDPx5.js").then((n) => n.r);
13
+ const { ReadBuffer, serializeMessage } = await import("./stdio-C6YyoW3I.js").then((n) => n.r);
14
14
  const readBuffer = new ReadBuffer();
15
15
  let stream = null;
16
16
  let closed = false;
@@ -81,4 +81,4 @@ async function createContextStdioTransport(options) {
81
81
  //#endregion
82
82
  export { createContextStdioTransport };
83
83
 
84
- //# sourceMappingURL=context-transport-T_6AYIvy.js.map
84
+ //# sourceMappingURL=context-transport-DSMTUsK1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-transport-T_6AYIvy.js","names":[],"sources":["../src/mcp/context-transport.ts"],"sourcesContent":["/**\n * An MCP `Transport` that speaks stdio JSON-RPC to a server running INSIDE\n * an `ExecutionContext`, rather than as a child of the host process.\n *\n * Why this exists\n * ---------------\n * An MCP server is an ordinary program. When it calls `fs.readFileSync` or\n * `fs.writeFile`, those hit whatever filesystem it was spawned on. The\n * default `StdioClientTransport` spawns on the HOST, so with a sandboxed\n * execution context (Daytona / E2B / Docker) the agent's own tools and its\n * MCP servers end up looking at two different filesystems: a path the model\n * discovered via `list_files` does not exist for the MCP server, and an MCP\n * write lands somewhere `read_file` cannot see.\n *\n * Routing the server through `ExecutionContext.execStream` puts both on the\n * same filesystem. Note what this does NOT buy: isolation. Remote-transport\n * MCP servers are unreachable by this mechanism by construction, so\n * \"everything the agent touches runs in the execution context\" can never be\n * a true invariant. This is about coherence, not containment.\n *\n * Framing\n * -------\n * Delegated to the SDK's own `ReadBuffer` / `serializeMessage`, the exact\n * pair `StdioClientTransport` uses. That matters beyond code reuse:\n * `ReadBuffer` concatenates raw bytes and only decodes at newline\n * boundaries, so a multibyte codepoint split across two chunks survives.\n * Decoding each chunk independently would corrupt it irrecoverably — which\n * is precisely why `StreamHandle` carries bytes rather than strings.\n */\n\nimport type { Hookable } from 'hookable'\nimport type { AgentHooks } from '../agent'\nimport type { ExecutionContext, ExecutionHandle } from '../contexts/types'\nimport { Buffer } from 'node:buffer'\nimport { createStderrLineEmitter } from './index'\n\n/**\n * Structural subset of the MCP SDK's `Transport` that we implement. Declared\n * locally rather than imported as a type so this module keeps the optional\n * peer-dependency contract (see the note atop `./index.ts`) — the SDK is only\n * ever touched through a runtime `await import(...)`.\n */\nexport interface ContextStdioTransportLike {\n /**\n * Brand marking this transport's process as living OUTSIDE the host.\n * `stdioPidOf` keys off it to refuse handing any pid from here to\n * `killStdioChild`, which signals host pids: a sandbox pid like `77`\n * names a real, unrelated host process. Termination for this transport\n * goes through `StreamHandle.kill()`, which signals inside the context.\n */\n readonly __contextScoped: true\n start: () => Promise<void>\n send: (message: unknown) => Promise<void>\n close: () => Promise<void>\n onclose?: () => void\n onerror?: (error: Error) => void\n onmessage?: (message: unknown) => void\n}\n\nexport interface ContextStdioTransportOptions {\n /** Server name, used for `mcp:warn` attribution. */\n name: string\n context: ExecutionContext\n handle: ExecutionHandle\n /** Full command line, run through the context's shell. */\n command: string\n cwd?: string\n env?: Record<string, string>\n hooks?: Hookable<AgentHooks>\n}\n\n/**\n * Build the transport. Throws if the context can't stream — deliberately\n * loudly, because the alternative (quietly spawning on the host) would\n * reintroduce the split-filesystem bug this transport exists to fix, and\n * would do it invisibly.\n */\nexport async function createContextStdioTransport(\n options: ContextStdioTransportOptions,\n): Promise<ContextStdioTransportLike> {\n const { name, context, handle, command, cwd, env, hooks } = options\n\n if (!context.execStream) {\n throw new Error(\n `MCP server \"${name}\" is configured with \\`scope: 'context'\\`, but the `\n + `'${context.type}' execution context does not support live streams `\n + `(\\`execStream\\`). Use \\`scope: 'host'\\` for this server, or switch to a `\n + `context that advertises \\`capabilities.stream\\`.`,\n )\n }\n\n const { ReadBuffer, serializeMessage } = await import('@modelcontextprotocol/sdk/shared/stdio.js')\n\n const readBuffer = new ReadBuffer()\n let stream: Awaited<ReturnType<NonNullable<ExecutionContext['execStream']>>> | null = null\n let closed = false\n\n const transport: ContextStdioTransportLike = {\n __contextScoped: true,\n\n async start() {\n if (stream)\n throw new Error(`MCP context transport for \"${name}\" already started`)\n\n // cwd is defaulted HERE, not left to the context: process and docker\n // fall back to `handle.cwd` on their own, but the sandbox providers\n // forward `cwd` only when set, so their SDK default would win (E2B's\n // `/home/user`, Daytona's PTY login dir). A `scope: 'context'` server\n // without an explicit `cwd` — e.g. server-filesystem rooted at '.' —\n // would then serve the workspace on two contexts and the home\n // directory on the others: the exact silent path divergence this\n // transport exists to close. Redundant-but-harmless on contexts that\n // already default to `handle.cwd`.\n stream = await context.execStream!(handle, command, {\n cwd: cwd ?? handle.cwd,\n ...(env !== undefined ? { env } : {}),\n })\n\n const active = stream\n\n // stdout → framed JSON-RPC. Runs detached from `start()`; awaiting it\n // would never resolve, since the server lives as long as the session.\n void (async () => {\n try {\n for await (const chunk of active.stdout) {\n readBuffer.append(Buffer.from(chunk))\n for (;;) {\n // A malformed frame must not kill the pump: report it and keep\n // reading. Servers that interleave stray output with protocol\n // frames (a PTY-backed context that lost the `stty raw` race,\n // a server logging to stdout) would otherwise wedge the\n // connection permanently on the first bad line.\n let message: unknown\n try {\n message = readBuffer.readMessage()\n }\n catch (err) {\n transport.onerror?.(err instanceof Error ? err : new Error(String(err)))\n continue\n }\n if (message === null)\n break\n transport.onmessage?.(message)\n }\n }\n }\n catch (err) {\n if (!closed)\n transport.onerror?.(err instanceof Error ? err : new Error(String(err)))\n }\n })()\n\n // stderr → `mcp:warn`, when the context provides it separately. A\n // PTY-backed context cannot split it from the terminal stream, so it\n // redirects to a file and may surface it here out-of-band (Daytona\n // polls) or not at all — absence is expected, not an error.\n if (active.stderr) {\n const emitter = createStderrLineEmitter(name, hooks)\n // Streaming decoder for the same reason `ReadBuffer` exists on the\n // stdout side: a per-chunk decode corrupts any multibyte codepoint\n // split across a chunk boundary. Diagnostic-only here, but free to\n // get right.\n const decoder = new TextDecoder('utf-8')\n void (async () => {\n try {\n for await (const chunk of active.stderr!)\n emitter.push(decoder.decode(chunk, { stream: true }))\n }\n catch {\n // Diagnostic channel — a failure here must not surface as a\n // protocol error.\n }\n finally {\n emitter.push(decoder.decode())\n emitter.flush()\n }\n })()\n }\n\n // The child dying is the connection ending. Surface it once.\n void active.exited.then(() => {\n if (closed)\n return\n closed = true\n transport.onclose?.()\n })\n },\n\n async send(message: unknown) {\n if (!stream)\n throw new Error(`MCP context transport for \"${name}\" not started`)\n await stream.write(new TextEncoder().encode(serializeMessage(message as never)))\n },\n\n async close() {\n if (closed) {\n // Still ensure the child is gone: `closed` may have been set by the\n // exit watcher, but an explicit close after a half-dead stream\n // should not leave a process running in the sandbox.\n await stream?.kill()\n return\n }\n closed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vC,CAAM,YAAY;KAChB,IAAI;MACF,WAAW,MAAM,SAAS,OAAO,QAC/B,QAAQ,KAAK,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC,CAAC;KACxD,QACM,CAGN,UACQ;MACN,QAAQ,KAAK,QAAQ,OAAO,CAAC;MAC7B,QAAQ,MAAM;KAChB;IACF,EAAA,CAAG;GACL;GAGA,OAAY,OAAO,WAAW;IAC5B,IAAI,QACF;IACF,SAAS;IACT,UAAU,UAAU;GACtB,CAAC;EACH;EAEA,MAAM,KAAK,SAAkB;GAC3B,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,8BAA8B,KAAK,cAAc;GACnE,MAAM,OAAO,MAAM,IAAI,YAAY,CAAC,CAAC,OAAO,iBAAiB,OAAgB,CAAC,CAAC;EACjF;EAEA,MAAM,QAAQ;GACZ,IAAI,QAAQ;IAIV,MAAM,QAAQ,KAAK;IACnB;GACF;GACA,SAAS;GACT,WAAW,MAAM;GACjB,MAAM,QAAQ,KAAK;GACnB,UAAU,UAAU;EACtB;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"context-transport-DSMTUsK1.js","names":[],"sources":["../src/mcp/context-transport.ts"],"sourcesContent":["/**\n * An MCP `Transport` that speaks stdio JSON-RPC to a server running INSIDE\n * an `ExecutionContext`, rather than as a child of the host process.\n *\n * Why this exists\n * ---------------\n * An MCP server is an ordinary program. When it calls `fs.readFileSync` or\n * `fs.writeFile`, those hit whatever filesystem it was spawned on. The\n * default `StdioClientTransport` spawns on the HOST, so with a sandboxed\n * execution context (Daytona / E2B / Docker) the agent's own tools and its\n * MCP servers end up looking at two different filesystems: a path the model\n * discovered via `list_files` does not exist for the MCP server, and an MCP\n * write lands somewhere `read_file` cannot see.\n *\n * Routing the server through `ExecutionContext.execStream` puts both on the\n * same filesystem. Note what this does NOT buy: isolation. Remote-transport\n * MCP servers are unreachable by this mechanism by construction, so\n * \"everything the agent touches runs in the execution context\" can never be\n * a true invariant. This is about coherence, not containment.\n *\n * Framing\n * -------\n * Delegated to the SDK's own `ReadBuffer` / `serializeMessage`, the exact\n * pair `StdioClientTransport` uses. That matters beyond code reuse:\n * `ReadBuffer` concatenates raw bytes and only decodes at newline\n * boundaries, so a multibyte codepoint split across two chunks survives.\n * Decoding each chunk independently would corrupt it irrecoverably — which\n * is precisely why `StreamHandle` carries bytes rather than strings.\n */\n\nimport type { Hookable } from 'hookable'\nimport type { AgentHooks } from '../agent'\nimport type { ExecutionContext, ExecutionHandle } from '../contexts/types'\nimport { Buffer } from 'node:buffer'\nimport { createStderrLineEmitter } from './index'\n\n/**\n * Structural subset of the MCP SDK's `Transport` that we implement. Declared\n * locally rather than imported as a type so this module keeps the optional\n * peer-dependency contract (see the note atop `./index.ts`) — the SDK is only\n * ever touched through a runtime `await import(...)`.\n */\nexport interface ContextStdioTransportLike {\n /**\n * Brand marking this transport's process as living OUTSIDE the host.\n * `stdioPidOf` keys off it to refuse handing any pid from here to\n * `killStdioChild`, which signals host pids: a sandbox pid like `77`\n * names a real, unrelated host process. Termination for this transport\n * goes through `StreamHandle.kill()`, which signals inside the context.\n */\n readonly __contextScoped: true\n start: () => Promise<void>\n send: (message: unknown) => Promise<void>\n close: () => Promise<void>\n onclose?: () => void\n onerror?: (error: Error) => void\n onmessage?: (message: unknown) => void\n}\n\nexport interface ContextStdioTransportOptions {\n /** Server name, used for `mcp:warn` attribution. */\n name: string\n context: ExecutionContext\n handle: ExecutionHandle\n /** Full command line, run through the context's shell. */\n command: string\n cwd?: string\n env?: Record<string, string>\n hooks?: Hookable<AgentHooks>\n}\n\n/**\n * Build the transport. Throws if the context can't stream — deliberately\n * loudly, because the alternative (quietly spawning on the host) would\n * reintroduce the split-filesystem bug this transport exists to fix, and\n * would do it invisibly.\n */\nexport async function createContextStdioTransport(\n options: ContextStdioTransportOptions,\n): Promise<ContextStdioTransportLike> {\n const { name, context, handle, command, cwd, env, hooks } = options\n\n if (!context.execStream) {\n throw new Error(\n `MCP server \"${name}\" is configured with \\`scope: 'context'\\`, but the `\n + `'${context.type}' execution context does not support live streams `\n + `(\\`execStream\\`). Use \\`scope: 'host'\\` for this server, or switch to a `\n + `context that advertises \\`capabilities.stream\\`.`,\n )\n }\n\n const { ReadBuffer, serializeMessage } = await import('@modelcontextprotocol/sdk/shared/stdio.js')\n\n const readBuffer = new ReadBuffer()\n let stream: Awaited<ReturnType<NonNullable<ExecutionContext['execStream']>>> | null = null\n let closed = false\n\n const transport: ContextStdioTransportLike = {\n __contextScoped: true,\n\n async start() {\n if (stream)\n throw new Error(`MCP context transport for \"${name}\" already started`)\n\n // cwd is defaulted HERE, not left to the context: process and docker\n // fall back to `handle.cwd` on their own, but the sandbox providers\n // forward `cwd` only when set, so their SDK default would win (E2B's\n // `/home/user`, Daytona's PTY login dir). A `scope: 'context'` server\n // without an explicit `cwd` — e.g. server-filesystem rooted at '.' —\n // would then serve the workspace on two contexts and the home\n // directory on the others: the exact silent path divergence this\n // transport exists to close. Redundant-but-harmless on contexts that\n // already default to `handle.cwd`.\n stream = await context.execStream!(handle, command, {\n cwd: cwd ?? handle.cwd,\n ...(env !== undefined ? { env } : {}),\n })\n\n const active = stream\n\n // stdout → framed JSON-RPC. Runs detached from `start()`; awaiting it\n // would never resolve, since the server lives as long as the session.\n void (async () => {\n try {\n for await (const chunk of active.stdout) {\n readBuffer.append(Buffer.from(chunk))\n for (;;) {\n // A malformed frame must not kill the pump: report it and keep\n // reading. Servers that interleave stray output with protocol\n // frames (a PTY-backed context that lost the `stty raw` race,\n // a server logging to stdout) would otherwise wedge the\n // connection permanently on the first bad line.\n let message: unknown\n try {\n message = readBuffer.readMessage()\n }\n catch (err) {\n transport.onerror?.(err instanceof Error ? err : new Error(String(err)))\n continue\n }\n if (message === null)\n break\n transport.onmessage?.(message)\n }\n }\n }\n catch (err) {\n if (!closed)\n transport.onerror?.(err instanceof Error ? err : new Error(String(err)))\n }\n })()\n\n // stderr → `mcp:warn`, when the context provides it separately. A\n // PTY-backed context cannot split it from the terminal stream, so it\n // redirects to a file and may surface it here out-of-band (Daytona\n // polls) or not at all — absence is expected, not an error.\n if (active.stderr) {\n const emitter = createStderrLineEmitter(name, hooks)\n // Streaming decoder for the same reason `ReadBuffer` exists on the\n // stdout side: a per-chunk decode corrupts any multibyte codepoint\n // split across a chunk boundary. Diagnostic-only here, but free to\n // get right.\n const decoder = new TextDecoder('utf-8')\n void (async () => {\n try {\n for await (const chunk of active.stderr!)\n emitter.push(decoder.decode(chunk, { stream: true }))\n }\n catch {\n // Diagnostic channel — a failure here must not surface as a\n // protocol error.\n }\n finally {\n emitter.push(decoder.decode())\n emitter.flush()\n }\n })()\n }\n\n // The child dying is the connection ending. Surface it once.\n void active.exited.then(() => {\n if (closed)\n return\n closed = true\n transport.onclose?.()\n })\n },\n\n async send(message: unknown) {\n if (!stream)\n throw new Error(`MCP context transport for \"${name}\" not started`)\n await stream.write(new TextEncoder().encode(serializeMessage(message as never)))\n },\n\n async close() {\n if (closed) {\n // Still ensure the child is gone: `closed` may have been set by the\n // exit watcher, but an explicit close after a half-dead stream\n // should not leave a process running in the sandbox.\n await stream?.kill()\n return\n }\n closed = true\n readBuffer.clear()\n await stream?.kill()\n transport.onclose?.()\n },\n }\n\n return transport\n}\n"],"mappings":";;;;;;;;;AA6EA,eAAsB,4BACpB,SACoC;CACpC,MAAM,EAAE,MAAM,SAAS,QAAQ,SAAS,KAAK,KAAK,UAAU;CAE5D,IAAI,CAAC,QAAQ,YACX,MAAM,IAAI,MACR,eAAe,KAAK,sDACd,QAAQ,KAAK,2KAGrB;CAGF,MAAM,EAAE,YAAY,qBAAqB,MAAM,OAAO,sBAA4C,CAAA,MAAA,MAAA,EAAA,CAAA;CAElG,MAAM,aAAa,IAAI,WAAW;CAClC,IAAI,SAAkF;CACtF,IAAI,SAAS;CAEb,MAAM,YAAuC;EAC3C,iBAAiB;EAEjB,MAAM,QAAQ;GACZ,IAAI,QACF,MAAM,IAAI,MAAM,8BAA8B,KAAK,kBAAkB;GAWvE,SAA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Q;IAIV,MAAM,QAAQ,KAAK;IACnB;GACF;GACA,SAAS;GACT,WAAW,MAAM;GACjB,MAAM,QAAQ,KAAK;GACnB,UAAU,UAAU;EACtB;CACF;CAEA,OAAO;AACT"}
@@ -1,9 +1,8 @@
1
- import { rm as Logger } from "../index-BgN1T3lk.js";
2
- import { p as ExecResult } from "../isolation-Kfoof0MM.js";
3
- import { t as SandboxProvider } from "../sandbox-BH0WQkXn.js";
1
+ import { tp as Logger } from "../index-BGe1fQT7.js";
2
+ import { m as ExecResult } from "../isolation-D9L650W5.js";
3
+ import { t as SandboxProvider } from "../sandbox-C5dR5DwQ.js";
4
4
  import { Buffer } from "node:buffer";
5
-
6
- //#region src/contexts/daytona.d.ts
5
+ //#region src/contexts/daytona-sdk.d.ts
7
6
  interface DaytonaExecuteResponse {
8
7
  exitCode?: number | null;
9
8
  result?: string | null;
@@ -36,13 +35,16 @@ interface DaytonaPtyHandle {
36
35
  }>;
37
36
  kill?: () => Promise<unknown>;
38
37
  disconnect: () => Promise<unknown>;
38
+ /** Used by terminals only. */
39
+ resize?: (cols: number, rows: number) => Promise<unknown>;
39
40
  }
40
41
  interface DaytonaSandbox {
41
42
  id: string;
42
43
  state?: string;
43
44
  snapshot?: string;
44
45
  process: {
45
- executeCommand: (command: string, cwd?: string, env?: Record<string, string>, timeout?: number) => Promise<DaytonaExecuteResponse>; /** Present in recent SDKs; only `execStream` uses it. */
46
+ executeCommand: (command: string, cwd?: string, env?: Record<string, string>, timeout?: number) => Promise<DaytonaExecuteResponse>;
47
+ /** Present in recent SDKs; only `execStream` uses it. */
46
48
  createPty?: (options: {
47
49
  /**
48
50
  * REQUIRED by the API despite reading like a convenience handle: the
@@ -52,8 +54,15 @@ interface DaytonaSandbox {
52
54
  id: string;
53
55
  cwd?: string;
54
56
  envs?: Record<string, string>;
57
+ cols?: number;
58
+ rows?: number;
55
59
  onData?: (data: Uint8Array) => void;
56
60
  }) => Promise<DaytonaPtyHandle>;
61
+ /** Terminals only: re-attach to a PTY session that outlived the host. */
62
+ connectPty?: (sessionId: string, options: {
63
+ onData: (data: Uint8Array) => void;
64
+ }) => Promise<DaytonaPtyHandle>;
65
+ killPtySession?: (sessionId: string) => Promise<void>;
57
66
  };
58
67
  fs: {
59
68
  /**
@@ -91,6 +100,10 @@ interface DaytonaCreateParams {
91
100
  envVars?: Record<string, string>;
92
101
  [key: string]: unknown;
93
102
  }
103
+ declare function resolveDaytonaEnv(optionEnv: Record<string, string> | undefined, perSpawnEnv: Record<string, string> | undefined): Record<string, string> | undefined;
104
+ declare function normalizeDaytonaExecResult(response: DaytonaExecuteResponse): ExecResult;
105
+ //#endregion
106
+ //#region src/contexts/daytona.d.ts
94
107
  type DaytonaOnDestroy = 'delete' | 'kill' | 'stop' | 'pause' | 'archive' | 'leave';
95
108
  interface DaytonaProviderOptions {
96
109
  /** Daytona API key. Falls back to the `DAYTONA_API_KEY` env var when omitted. */
@@ -165,8 +178,6 @@ interface DaytonaReadinessOptions {
165
178
  /** Sleep between probes — injectable for deterministic tests. */
166
179
  sleep?: (ms: number) => Promise<void>;
167
180
  }
168
- declare function resolveDaytonaEnv(optionEnv: Record<string, string> | undefined, perSpawnEnv: Record<string, string> | undefined): Record<string, string> | undefined;
169
- declare function normalizeDaytonaExecResult(response: DaytonaExecuteResponse): ExecResult;
170
181
  declare function resolveDaytonaCreateParams(sandboxConfig: Record<string, unknown>, options: DaytonaProviderOptions, envVars: Record<string, string> | undefined): DaytonaCreateParams | undefined;
171
182
  declare function waitForDaytonaReady(sandbox: DaytonaSandbox, logger: Logger, opts: DaytonaReadinessOptions): Promise<void>;
172
183
  declare function runDaytonaPregame(sandbox: DaytonaSandbox, logger: Logger, opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"daytona.d.ts","names":[],"sources":["../../src/contexts/daytona.ts"],"mappings":";;;;;;UAgCU,sBAAA;EACR,QAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;EACA,SAAA;IAAc,MAAA;EAAA;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