@animalabs/agent-framework 0.23.3 → 0.24.1

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 (355) hide show
  1. package/README.md +212 -42
  2. package/dist/src/agent.d.ts +65 -9
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +98 -12
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/api/server.d.ts.map +1 -1
  7. package/dist/src/api/server.js +14 -12
  8. package/dist/src/api/server.js.map +1 -1
  9. package/dist/src/clock-rows.d.ts +115 -0
  10. package/dist/src/clock-rows.d.ts.map +1 -0
  11. package/dist/src/clock-rows.js +222 -0
  12. package/dist/src/clock-rows.js.map +1 -0
  13. package/dist/src/code-execution/engine.d.ts +177 -0
  14. package/dist/src/code-execution/engine.d.ts.map +1 -0
  15. package/dist/src/code-execution/engine.js +494 -0
  16. package/dist/src/code-execution/engine.js.map +1 -0
  17. package/dist/src/code-execution/index.d.ts +5 -10
  18. package/dist/src/code-execution/index.d.ts.map +1 -1
  19. package/dist/src/code-execution/index.js +5 -9
  20. package/dist/src/code-execution/index.js.map +1 -1
  21. package/dist/src/code-execution/isolate/calls.d.ts +114 -0
  22. package/dist/src/code-execution/isolate/calls.d.ts.map +1 -0
  23. package/dist/src/code-execution/isolate/calls.js +145 -0
  24. package/dist/src/code-execution/isolate/calls.js.map +1 -0
  25. package/dist/src/code-execution/isolate/child-entry.d.ts +2 -0
  26. package/dist/src/code-execution/isolate/child-entry.d.ts.map +1 -0
  27. package/dist/src/code-execution/isolate/child-entry.js +5 -0
  28. package/dist/src/code-execution/isolate/child-entry.js.map +1 -0
  29. package/dist/src/code-execution/isolate/child-main.d.ts +26 -0
  30. package/dist/src/code-execution/isolate/child-main.d.ts.map +1 -0
  31. package/dist/src/code-execution/isolate/child-main.js +132 -0
  32. package/dist/src/code-execution/isolate/child-main.js.map +1 -0
  33. package/dist/src/code-execution/isolate/child.d.ts +44 -0
  34. package/dist/src/code-execution/isolate/child.d.ts.map +1 -0
  35. package/dist/src/code-execution/isolate/child.js +315 -0
  36. package/dist/src/code-execution/isolate/child.js.map +1 -0
  37. package/dist/src/code-execution/isolate/frames.d.ts +80 -0
  38. package/dist/src/code-execution/isolate/frames.d.ts.map +1 -0
  39. package/dist/src/code-execution/isolate/frames.js +210 -0
  40. package/dist/src/code-execution/isolate/frames.js.map +1 -0
  41. package/dist/src/code-execution/isolate/output.d.ts +68 -0
  42. package/dist/src/code-execution/isolate/output.d.ts.map +1 -0
  43. package/dist/src/code-execution/isolate/output.js +143 -0
  44. package/dist/src/code-execution/isolate/output.js.map +1 -0
  45. package/dist/src/code-execution/isolate/prelude.d.ts +109 -0
  46. package/dist/src/code-execution/isolate/prelude.d.ts.map +1 -0
  47. package/dist/src/code-execution/isolate/prelude.js +401 -0
  48. package/dist/src/code-execution/isolate/prelude.js.map +1 -0
  49. package/dist/src/code-execution/isolate/protocol.d.ts +151 -0
  50. package/dist/src/code-execution/isolate/protocol.d.ts.map +1 -0
  51. package/dist/src/code-execution/isolate/protocol.js +150 -0
  52. package/dist/src/code-execution/isolate/protocol.js.map +1 -0
  53. package/dist/src/code-execution/isolate/render.d.ts +57 -0
  54. package/dist/src/code-execution/isolate/render.d.ts.map +1 -0
  55. package/dist/src/code-execution/isolate/render.js +214 -0
  56. package/dist/src/code-execution/isolate/render.js.map +1 -0
  57. package/dist/src/code-execution/isolate/runner.d.ts +250 -0
  58. package/dist/src/code-execution/isolate/runner.d.ts.map +1 -0
  59. package/dist/src/code-execution/isolate/runner.js +854 -0
  60. package/dist/src/code-execution/isolate/runner.js.map +1 -0
  61. package/dist/src/code-execution/isolate/scripts.d.ts +175 -0
  62. package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -0
  63. package/dist/src/code-execution/isolate/scripts.js +357 -0
  64. package/dist/src/code-execution/isolate/scripts.js.map +1 -0
  65. package/dist/src/code-execution/quickjs.wasm +0 -0
  66. package/dist/src/code-execution/tool-definition.d.ts +93 -43
  67. package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
  68. package/dist/src/code-execution/tool-definition.js +176 -142
  69. package/dist/src/code-execution/tool-definition.js.map +1 -1
  70. package/dist/src/deadline-timer.d.ts +3 -0
  71. package/dist/src/deadline-timer.d.ts.map +1 -1
  72. package/dist/src/deadline-timer.js +1 -1
  73. package/dist/src/deadline-timer.js.map +1 -1
  74. package/dist/src/framework.d.ts +1120 -457
  75. package/dist/src/framework.d.ts.map +1 -1
  76. package/dist/src/framework.js +4635 -2505
  77. package/dist/src/framework.js.map +1 -1
  78. package/dist/src/gate/event-gate.d.ts +28 -4
  79. package/dist/src/gate/event-gate.d.ts.map +1 -1
  80. package/dist/src/gate/event-gate.js +89 -13
  81. package/dist/src/gate/event-gate.js.map +1 -1
  82. package/dist/src/held-writes.d.ts +16 -3
  83. package/dist/src/held-writes.d.ts.map +1 -1
  84. package/dist/src/held-writes.js +16 -3
  85. package/dist/src/held-writes.js.map +1 -1
  86. package/dist/src/index.d.ts +8 -6
  87. package/dist/src/index.d.ts.map +1 -1
  88. package/dist/src/index.js +10 -8
  89. package/dist/src/index.js.map +1 -1
  90. package/dist/src/mcpl/channel-registry.d.ts +483 -115
  91. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  92. package/dist/src/mcpl/channel-registry.js +1735 -425
  93. package/dist/src/mcpl/channel-registry.js.map +1 -1
  94. package/dist/src/mcpl/conversation-router.d.ts +19 -39
  95. package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
  96. package/dist/src/mcpl/conversation-router.js +27 -59
  97. package/dist/src/mcpl/conversation-router.js.map +1 -1
  98. package/dist/src/mcpl/convert-block.d.ts.map +1 -1
  99. package/dist/src/mcpl/convert-block.js +9 -5
  100. package/dist/src/mcpl/convert-block.js.map +1 -1
  101. package/dist/src/mcpl/inbound-source.d.ts +50 -0
  102. package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
  103. package/dist/src/mcpl/inbound-source.js +130 -0
  104. package/dist/src/mcpl/inbound-source.js.map +1 -1
  105. package/dist/src/mcpl/index.d.ts +2 -1
  106. package/dist/src/mcpl/index.d.ts.map +1 -1
  107. package/dist/src/mcpl/index.js +3 -2
  108. package/dist/src/mcpl/index.js.map +1 -1
  109. package/dist/src/mcpl/log-value.d.ts +6 -0
  110. package/dist/src/mcpl/log-value.d.ts.map +1 -1
  111. package/dist/src/mcpl/log-value.js +8 -0
  112. package/dist/src/mcpl/log-value.js.map +1 -1
  113. package/dist/src/mcpl/modern-connection.d.ts +15 -6
  114. package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
  115. package/dist/src/mcpl/modern-connection.js +168 -53
  116. package/dist/src/mcpl/modern-connection.js.map +1 -1
  117. package/dist/src/mcpl/prose-grammar.d.ts +4 -5
  118. package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
  119. package/dist/src/mcpl/prose-grammar.js +4 -5
  120. package/dist/src/mcpl/prose-grammar.js.map +1 -1
  121. package/dist/src/mcpl/protocol-family.d.ts +97 -10
  122. package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
  123. package/dist/src/mcpl/protocol-family.js +174 -17
  124. package/dist/src/mcpl/protocol-family.js.map +1 -1
  125. package/dist/src/mcpl/push-coalescer.d.ts +132 -14
  126. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  127. package/dist/src/mcpl/push-coalescer.js +227 -50
  128. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  129. package/dist/src/mcpl/push-handler.d.ts +9 -20
  130. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  131. package/dist/src/mcpl/push-handler.js +7 -49
  132. package/dist/src/mcpl/push-handler.js.map +1 -1
  133. package/dist/src/mcpl/reference-fetcher.d.ts +2 -2
  134. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  135. package/dist/src/mcpl/reference-fetcher.js +4 -4
  136. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  137. package/dist/src/mcpl/server-connection.d.ts +50 -21
  138. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  139. package/dist/src/mcpl/server-connection.js +158 -74
  140. package/dist/src/mcpl/server-connection.js.map +1 -1
  141. package/dist/src/mcpl/tags.d.ts +24 -0
  142. package/dist/src/mcpl/tags.d.ts.map +1 -1
  143. package/dist/src/mcpl/tags.js +33 -0
  144. package/dist/src/mcpl/tags.js.map +1 -1
  145. package/dist/src/mcpl/tool-result-normalize.d.ts +2 -1
  146. package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
  147. package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
  148. package/dist/src/mcpl/transport.d.ts +55 -7
  149. package/dist/src/mcpl/transport.d.ts.map +1 -1
  150. package/dist/src/mcpl/transport.js +163 -34
  151. package/dist/src/mcpl/transport.js.map +1 -1
  152. package/dist/src/mcpl/types.d.ts +22 -6
  153. package/dist/src/mcpl/types.d.ts.map +1 -1
  154. package/dist/src/mcpl/types.js.map +1 -1
  155. package/dist/src/module-registry.d.ts +4 -2
  156. package/dist/src/module-registry.d.ts.map +1 -1
  157. package/dist/src/module-registry.js +100 -13
  158. package/dist/src/module-registry.js.map +1 -1
  159. package/dist/src/modules/discord/index.d.ts.map +1 -1
  160. package/dist/src/modules/discord/index.js +8 -13
  161. package/dist/src/modules/discord/index.js.map +1 -1
  162. package/dist/src/modules/history/index.d.ts.map +1 -1
  163. package/dist/src/modules/history/index.js +27 -4
  164. package/dist/src/modules/history/index.js.map +1 -1
  165. package/dist/src/modules/history/semantic.d.ts +15 -3
  166. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  167. package/dist/src/modules/history/semantic.js +27 -5
  168. package/dist/src/modules/history/semantic.js.map +1 -1
  169. package/dist/src/modules/index.d.ts +1 -1
  170. package/dist/src/modules/index.d.ts.map +1 -1
  171. package/dist/src/modules/index.js.map +1 -1
  172. package/dist/src/modules/unknown-tool.d.ts +4 -1
  173. package/dist/src/modules/unknown-tool.d.ts.map +1 -1
  174. package/dist/src/modules/unknown-tool.js +4 -1
  175. package/dist/src/modules/unknown-tool.js.map +1 -1
  176. package/dist/src/modules/workspace/branch-intent.d.ts +3 -1
  177. package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
  178. package/dist/src/modules/workspace/branch-intent.js +3 -1
  179. package/dist/src/modules/workspace/branch-intent.js.map +1 -1
  180. package/dist/src/modules/workspace/edit-plan.d.ts +265 -0
  181. package/dist/src/modules/workspace/edit-plan.d.ts.map +1 -0
  182. package/dist/src/modules/workspace/edit-plan.js +794 -0
  183. package/dist/src/modules/workspace/edit-plan.js.map +1 -0
  184. package/dist/src/modules/workspace/edit-text.d.ts +117 -0
  185. package/dist/src/modules/workspace/edit-text.d.ts.map +1 -0
  186. package/dist/src/modules/workspace/edit-text.js +584 -0
  187. package/dist/src/modules/workspace/edit-text.js.map +1 -0
  188. package/dist/src/modules/workspace/effects.d.ts +5 -4
  189. package/dist/src/modules/workspace/effects.d.ts.map +1 -1
  190. package/dist/src/modules/workspace/effects.js +78 -25
  191. package/dist/src/modules/workspace/effects.js.map +1 -1
  192. package/dist/src/modules/workspace/index.d.ts +493 -62
  193. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  194. package/dist/src/modules/workspace/index.js +2216 -652
  195. package/dist/src/modules/workspace/index.js.map +1 -1
  196. package/dist/src/modules/workspace/observe.d.ts +213 -38
  197. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  198. package/dist/src/modules/workspace/observe.js +416 -36
  199. package/dist/src/modules/workspace/observe.js.map +1 -1
  200. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  201. package/dist/src/modules/workspace/reconcile.js +15 -8
  202. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  203. package/dist/src/modules/workspace/text.d.ts +32 -0
  204. package/dist/src/modules/workspace/text.d.ts.map +1 -0
  205. package/dist/src/modules/workspace/text.js +67 -0
  206. package/dist/src/modules/workspace/text.js.map +1 -0
  207. package/dist/src/modules/workspace/types.d.ts +210 -6
  208. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  209. package/dist/src/modules/workspace/types.js.map +1 -1
  210. package/dist/src/modules/workspace/watcher.d.ts +3 -2
  211. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  212. package/dist/src/modules/workspace/watcher.js.map +1 -1
  213. package/dist/src/operator-log.d.ts +52 -24
  214. package/dist/src/operator-log.d.ts.map +1 -1
  215. package/dist/src/operator-log.js.map +1 -1
  216. package/dist/src/recovery/discord-awareness-outbox.d.ts +496 -72
  217. package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
  218. package/dist/src/recovery/discord-awareness-outbox.js +1196 -289
  219. package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
  220. package/dist/src/recovery/offline-branch.d.ts +26 -1
  221. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  222. package/dist/src/recovery/offline-branch.js +164 -39
  223. package/dist/src/recovery/offline-branch.js.map +1 -1
  224. package/dist/src/recovery/recover-cli.js +23 -4
  225. package/dist/src/recovery/recover-cli.js.map +1 -1
  226. package/dist/src/send-tools.d.ts +11 -0
  227. package/dist/src/send-tools.d.ts.map +1 -0
  228. package/dist/src/send-tools.js +11 -0
  229. package/dist/src/send-tools.js.map +1 -0
  230. package/dist/src/timezone.d.ts +4 -2
  231. package/dist/src/timezone.d.ts.map +1 -1
  232. package/dist/src/timezone.js +4 -2
  233. package/dist/src/timezone.js.map +1 -1
  234. package/dist/src/tool-image-ledger.d.ts +46 -7
  235. package/dist/src/tool-image-ledger.d.ts.map +1 -1
  236. package/dist/src/tool-image-ledger.js +60 -7
  237. package/dist/src/tool-image-ledger.js.map +1 -1
  238. package/dist/src/tool-result-guard.d.ts +14 -11
  239. package/dist/src/tool-result-guard.d.ts.map +1 -1
  240. package/dist/src/tool-result-guard.js +17 -14
  241. package/dist/src/tool-result-guard.js.map +1 -1
  242. package/dist/src/tool-result-history.d.ts +3 -2
  243. package/dist/src/tool-result-history.d.ts.map +1 -1
  244. package/dist/src/tool-result-history.js +3 -2
  245. package/dist/src/tool-result-history.js.map +1 -1
  246. package/dist/src/tune-out/coordinator.d.ts +21 -0
  247. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  248. package/dist/src/tune-out/coordinator.js +142 -40
  249. package/dist/src/tune-out/coordinator.js.map +1 -1
  250. package/dist/src/types/agent.d.ts +31 -6
  251. package/dist/src/types/agent.d.ts.map +1 -1
  252. package/dist/src/types/events.d.ts +66 -9
  253. package/dist/src/types/events.d.ts.map +1 -1
  254. package/dist/src/types/framework.d.ts +69 -62
  255. package/dist/src/types/framework.d.ts.map +1 -1
  256. package/dist/src/types/module.d.ts +40 -8
  257. package/dist/src/types/module.d.ts.map +1 -1
  258. package/dist/src/types/trace.d.ts +111 -10
  259. package/dist/src/types/trace.d.ts.map +1 -1
  260. package/dist/src/usage/types.d.ts +16 -0
  261. package/dist/src/usage/types.d.ts.map +1 -1
  262. package/dist/src/usage/usage-tracker.d.ts +14 -1
  263. package/dist/src/usage/usage-tracker.d.ts.map +1 -1
  264. package/dist/src/usage/usage-tracker.js +81 -41
  265. package/dist/src/usage/usage-tracker.js.map +1 -1
  266. package/package.json +6 -8
  267. package/src/agent.ts +99 -12
  268. package/src/api/server.ts +14 -12
  269. package/src/clock-rows.ts +302 -0
  270. package/src/code-execution/engine.ts +595 -0
  271. package/src/code-execution/index.ts +5 -17
  272. package/src/code-execution/isolate/calls.ts +199 -0
  273. package/src/code-execution/isolate/child-entry.ts +5 -0
  274. package/src/code-execution/isolate/child-main.ts +132 -0
  275. package/src/code-execution/isolate/child.ts +327 -0
  276. package/src/code-execution/isolate/frames.ts +209 -0
  277. package/src/code-execution/isolate/output.ts +161 -0
  278. package/src/code-execution/isolate/prelude.ts +409 -0
  279. package/src/code-execution/isolate/protocol.ts +240 -0
  280. package/src/code-execution/isolate/render.ts +230 -0
  281. package/src/code-execution/isolate/runner.ts +911 -0
  282. package/src/code-execution/isolate/scripts.ts +479 -0
  283. package/src/code-execution/quickjs.wasm +0 -0
  284. package/src/code-execution/quickjs.wasm.LICENSES +149 -0
  285. package/src/code-execution/tool-definition.ts +236 -167
  286. package/src/deadline-timer.ts +1 -1
  287. package/src/framework.ts +4978 -2671
  288. package/src/gate/event-gate.ts +79 -17
  289. package/src/held-writes.ts +17 -3
  290. package/src/index.ts +32 -22
  291. package/src/mcpl/channel-registry.ts +1892 -471
  292. package/src/mcpl/conversation-router.ts +26 -72
  293. package/src/mcpl/convert-block.ts +9 -5
  294. package/src/mcpl/inbound-source.ts +131 -0
  295. package/src/mcpl/index.ts +4 -2
  296. package/src/mcpl/log-value.ts +9 -0
  297. package/src/mcpl/modern-connection.ts +162 -53
  298. package/src/mcpl/prose-grammar.ts +4 -5
  299. package/src/mcpl/protocol-family.ts +200 -22
  300. package/src/mcpl/push-coalescer.ts +306 -62
  301. package/src/mcpl/push-handler.ts +12 -54
  302. package/src/mcpl/reference-fetcher.ts +4 -4
  303. package/src/mcpl/server-connection.ts +180 -79
  304. package/src/mcpl/tags.ts +36 -0
  305. package/src/mcpl/tool-result-normalize.ts +2 -1
  306. package/src/mcpl/transport.ts +162 -33
  307. package/src/mcpl/types.ts +23 -6
  308. package/src/module-registry.ts +92 -13
  309. package/src/modules/discord/index.ts +8 -13
  310. package/src/modules/history/index.ts +25 -3
  311. package/src/modules/history/semantic.ts +29 -6
  312. package/src/modules/index.ts +1 -0
  313. package/src/modules/unknown-tool.ts +4 -1
  314. package/src/modules/workspace/branch-intent.ts +3 -1
  315. package/src/modules/workspace/edit-plan.ts +954 -0
  316. package/src/modules/workspace/edit-text.ts +618 -0
  317. package/src/modules/workspace/effects.ts +70 -19
  318. package/src/modules/workspace/index.ts +2293 -650
  319. package/src/modules/workspace/observe.ts +465 -56
  320. package/src/modules/workspace/reconcile.ts +14 -7
  321. package/src/modules/workspace/text.ts +68 -0
  322. package/src/modules/workspace/types.ts +211 -6
  323. package/src/modules/workspace/watcher.ts +3 -2
  324. package/src/operator-log.ts +47 -19
  325. package/src/recovery/discord-awareness-outbox.ts +1500 -356
  326. package/src/recovery/offline-branch.ts +189 -55
  327. package/src/recovery/recover-cli.ts +25 -4
  328. package/src/send-tools.ts +11 -0
  329. package/src/timezone.ts +4 -2
  330. package/src/tool-image-ledger.ts +62 -8
  331. package/src/tool-result-guard.ts +18 -15
  332. package/src/tool-result-history.ts +3 -2
  333. package/src/tune-out/coordinator.ts +166 -45
  334. package/src/types/agent.ts +32 -6
  335. package/src/types/events.ts +66 -9
  336. package/src/types/framework.ts +69 -62
  337. package/src/types/module.ts +40 -8
  338. package/src/types/trace.ts +121 -15
  339. package/src/usage/types.ts +16 -0
  340. package/src/usage/usage-tracker.ts +86 -43
  341. package/dist/src/code-execution/py-runner.d.ts +0 -191
  342. package/dist/src/code-execution/py-runner.d.ts.map +0 -1
  343. package/dist/src/code-execution/py-runner.js +0 -655
  344. package/dist/src/code-execution/py-runner.js.map +0 -1
  345. package/dist/src/code-execution/runtime-py.d.ts +0 -50
  346. package/dist/src/code-execution/runtime-py.d.ts.map +0 -1
  347. package/dist/src/code-execution/runtime-py.js +0 -677
  348. package/dist/src/code-execution/runtime-py.js.map +0 -1
  349. package/dist/src/mcpl/prose-stream-router.d.ts +0 -88
  350. package/dist/src/mcpl/prose-stream-router.d.ts.map +0 -1
  351. package/dist/src/mcpl/prose-stream-router.js +0 -291
  352. package/dist/src/mcpl/prose-stream-router.js.map +0 -1
  353. package/src/code-execution/py-runner.ts +0 -791
  354. package/src/code-execution/runtime-py.ts +0 -677
  355. package/src/mcpl/prose-stream-router.ts +0 -268
@@ -7,10 +7,13 @@ function snapshotUsage(usage: SessionUsage): SessionUsage {
7
7
  };
8
8
  }
9
9
 
10
+ /** Add one count into a tally. `mixedCurrencies`: what's added is itself a
11
+ * tally in which two currencies met, as a stored entry being folded can be. */
10
12
  function accumulateUsage(
11
13
  target: SessionUsage,
12
14
  tokens: { inputTokens: number; outputTokens: number; cacheCreationTokens: number; cacheReadTokens: number },
13
- estimatedCost?: { total: number; currency: string }
15
+ estimatedCost?: { total: number; currency: string },
16
+ mixedCurrencies = false,
14
17
  ): void {
15
18
  // A provider's usage can lack a count (membrane 0.5.87's Bedrock stream
16
19
  // takes a message_delta's output count as reported); adding it would make
@@ -20,14 +23,16 @@ function accumulateUsage(
20
23
  target.outputTokens += count(tokens.outputTokens);
21
24
  target.cacheCreationTokens += count(tokens.cacheCreationTokens);
22
25
  target.cacheReadTokens += count(tokens.cacheReadTokens);
26
+ // Costs in two currencies can't be summed, and a cost counted after they
27
+ // met is only part of this tally's, so once they meet the cost stays absent.
28
+ if (target.mixedCurrencies) return;
29
+ if (mixedCurrencies || (estimatedCost && target.estimatedCost && target.estimatedCost.currency !== estimatedCost.currency)) {
30
+ target.estimatedCost = undefined;
31
+ target.mixedCurrencies = true;
32
+ return;
33
+ }
23
34
  if (estimatedCost) {
24
- if (!target.estimatedCost) {
25
- target.estimatedCost = { total: 0, currency: estimatedCost.currency };
26
- } else if (target.estimatedCost.currency !== estimatedCost.currency) {
27
- // Mixed currencies — drop cost tracking rather than produce garbage
28
- target.estimatedCost = undefined;
29
- return;
30
- }
35
+ target.estimatedCost ??= { total: 0, currency: estimatedCost.currency };
31
36
  target.estimatedCost.total += estimatedCost.total;
32
37
  }
33
38
  }
@@ -47,18 +52,35 @@ function parseUsage(raw: unknown): SessionUsage | null {
47
52
  outputTokens,
48
53
  cacheCreationTokens: typeof o.cacheCreationTokens === 'number' ? o.cacheCreationTokens : 0,
49
54
  cacheReadTokens: typeof o.cacheReadTokens === 'number' ? o.cacheReadTokens : 0,
50
- estimatedCost: o.estimatedCost && typeof o.estimatedCost === 'object'
51
- ? { total: (o.estimatedCost as any).total, currency: (o.estimatedCost as any).currency }
52
- : undefined,
55
+ ...(o.mixedCurrencies === true
56
+ ? { mixedCurrencies: true as const }
57
+ : {
58
+ estimatedCost: o.estimatedCost && typeof o.estimatedCost === 'object'
59
+ ? { total: (o.estimatedCost as any).total, currency: (o.estimatedCost as any).currency }
60
+ : undefined,
61
+ }),
53
62
  };
54
63
  }
55
64
 
56
65
  export interface PersistedUsageState {
57
66
  totals: SessionUsage;
58
- byAgent: Array<{ agentName: string; usage: SessionUsage; inferenceCount: number }>;
67
+ byAgent: Array<{ agentName: string; usage: SessionUsage; inferenceCount: number; ephemeral?: true }>;
59
68
  inferenceCount: number;
60
69
  }
61
70
 
71
+ /** The name the entry for every ephemeral agent's usage together goes by. */
72
+ export const EPHEMERAL_USAGE_NAME = 'ephemeral agents';
73
+
74
+ type Tally = { usage: SessionUsage; inferenceCount: number };
75
+
76
+ const emptyUsage = (): SessionUsage => ({ inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 });
77
+
78
+ /** Add one tally's stored usage and inference count into another. */
79
+ function addTally(target: Tally, usage: SessionUsage, inferenceCount: number): void {
80
+ accumulateUsage(target.usage, usage, usage.estimatedCost, usage.mixedCurrencies === true);
81
+ target.inferenceCount += inferenceCount;
82
+ }
83
+
62
84
  /** What keeps a stored usage record from restoring, or undefined when it
63
85
  * restores: it must be an object whose totals are token counts and whose
64
86
  * byAgent, if it has one, is a list. Its per-agent entries are checked one
@@ -72,22 +94,30 @@ export function persistedUsageProblem(value: unknown): 'not a record' | 'totals'
72
94
  }
73
95
 
74
96
  export class UsageTracker {
75
- private totals: SessionUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
76
- private byAgent: Map<string, { usage: SessionUsage; inferenceCount: number }> = new Map();
97
+ private totals: SessionUsage = emptyUsage();
98
+ private byAgent: Map<string, Tally> = new Map();
99
+ /** Every ephemeral agent's usage together, kept apart from byAgent so an
100
+ * agent named EPHEMERAL_USAGE_NAME has an entry of its own. */
101
+ private ephemeral: Tally | undefined;
77
102
  private inferenceCount = 0;
78
103
  private emitTrace: (event: UsageUpdatedEvent) => void;
79
104
 
105
+ /** `wasEphemeral` names the stored unmarked entries that belong in the
106
+ * shared entry, such as an ephemeral agent's own from before ephemeral
107
+ * agents shared one: each restores into the shared entry instead. A stored
108
+ * entry marked ephemeral restores into it whatever its name. */
80
109
  constructor(opts: {
81
110
  emitTrace: (event: UsageUpdatedEvent) => void;
82
111
  restored?: PersistedUsageState;
112
+ wasEphemeral?: (agentName: string) => boolean;
83
113
  }) {
84
114
  this.emitTrace = opts.emitTrace;
85
115
  if (opts.restored) {
86
- this.restoreFrom(opts.restored);
116
+ this.restoreFrom(opts.restored, opts.wasEphemeral ?? (() => false));
87
117
  }
88
118
  }
89
119
 
90
- private restoreFrom(state: PersistedUsageState): void {
120
+ private restoreFrom(state: PersistedUsageState, wasEphemeral: (agentName: string) => boolean): void {
91
121
  const totals = parseUsage(state.totals);
92
122
  if (!totals) return;
93
123
  this.totals = totals;
@@ -95,36 +125,43 @@ export class UsageTracker {
95
125
  if (Array.isArray(state.byAgent)) {
96
126
  for (const item of state.byAgent as unknown[]) {
97
127
  if (!item || typeof item !== 'object') continue;
98
- const entry = item as { agentName?: unknown; usage?: unknown; inferenceCount?: unknown };
128
+ const entry = item as { agentName?: unknown; usage?: unknown; inferenceCount?: unknown; ephemeral?: unknown };
99
129
  const usage = parseUsage(entry.usage);
100
130
  if (usage && typeof entry.agentName === 'string') {
101
- this.byAgent.set(entry.agentName, {
102
- usage,
103
- inferenceCount: typeof entry.inferenceCount === 'number' ? entry.inferenceCount : 0,
104
- });
131
+ const inferenceCount = typeof entry.inferenceCount === 'number' ? entry.inferenceCount : 0;
132
+ if (entry.ephemeral === true || wasEphemeral(entry.agentName)) {
133
+ this.ephemeral ??= { usage: emptyUsage(), inferenceCount: 0 };
134
+ addTally(this.ephemeral, usage, inferenceCount);
135
+ } else {
136
+ this.byAgent.set(entry.agentName, { usage, inferenceCount });
137
+ }
105
138
  }
106
139
  }
107
140
  }
141
+ // The totals count every entry's inferences, so stored entries whose
142
+ // costs are in two currencies, or one where two met, mean two met in the
143
+ // totals too. A record written before mixedCurrencies shows it only so.
144
+ const tallies = [...this.byAgent.values(), ...(this.ephemeral ? [this.ephemeral] : [])].map((tally) => tally.usage);
145
+ const currencies = new Set(tallies.flatMap((usage) => (usage.estimatedCost ? [usage.estimatedCost.currency] : [])));
146
+ if (this.totals.estimatedCost) currencies.add(this.totals.estimatedCost.currency);
147
+ if (!this.totals.mixedCurrencies && (currencies.size > 1 || tallies.some((usage) => usage.mixedCurrencies))) {
148
+ this.totals.estimatedCost = undefined;
149
+ this.totals.mixedCurrencies = true;
150
+ }
108
151
  }
109
152
 
110
153
  toJSON(): PersistedUsageState {
111
- return {
112
- totals: snapshotUsage(this.totals),
113
- byAgent: [...this.byAgent.entries()].map(([name, data]) => ({
114
- agentName: name,
115
- usage: snapshotUsage(data.usage),
116
- inferenceCount: data.inferenceCount,
117
- })),
118
- inferenceCount: this.inferenceCount,
119
- };
154
+ return this.getSnapshot();
120
155
  }
121
156
 
157
+ /** `ephemeral`: the agent is an ephemeral one, whose usage counts in the
158
+ * shared entry; the trace still names the agent. */
122
159
  onInferenceCompleted(agentName: string, usage: {
123
160
  inputTokens: number;
124
161
  outputTokens: number;
125
162
  cacheCreationTokens?: number;
126
163
  cacheReadTokens?: number;
127
- }, estimatedCost?: { total: number; currency: string }): void {
164
+ }, estimatedCost?: { total: number; currency: string }, ephemeral = false): void {
128
165
  const tokens = {
129
166
  inputTokens: usage.inputTokens,
130
167
  outputTokens: usage.outputTokens,
@@ -135,10 +172,11 @@ export class UsageTracker {
135
172
  accumulateUsage(this.totals, tokens, estimatedCost);
136
173
  this.inferenceCount++;
137
174
 
138
- let agent = this.byAgent.get(agentName);
175
+ let agent = ephemeral ? this.ephemeral : this.byAgent.get(agentName);
139
176
  if (!agent) {
140
- agent = { usage: { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 }, inferenceCount: 0 };
141
- this.byAgent.set(agentName, agent);
177
+ agent = { usage: emptyUsage(), inferenceCount: 0 };
178
+ if (ephemeral) this.ephemeral = agent;
179
+ else this.byAgent.set(agentName, agent);
142
180
  }
143
181
  accumulateUsage(agent.usage, tokens, estimatedCost);
144
182
  agent.inferenceCount++;
@@ -152,14 +190,19 @@ export class UsageTracker {
152
190
  }
153
191
 
154
192
  getSnapshot(): SessionUsageSnapshot {
155
- return {
156
- totals: snapshotUsage(this.totals),
157
- byAgent: [...this.byAgent.entries()].map(([name, data]) => ({
158
- agentName: name,
159
- usage: snapshotUsage(data.usage),
160
- inferenceCount: data.inferenceCount,
161
- })),
162
- inferenceCount: this.inferenceCount,
163
- };
193
+ const byAgent: SessionUsageSnapshot['byAgent'] = [...this.byAgent.entries()].map(([name, data]) => ({
194
+ agentName: name,
195
+ usage: snapshotUsage(data.usage),
196
+ inferenceCount: data.inferenceCount,
197
+ }));
198
+ if (this.ephemeral) {
199
+ byAgent.push({
200
+ agentName: EPHEMERAL_USAGE_NAME,
201
+ usage: snapshotUsage(this.ephemeral.usage),
202
+ inferenceCount: this.ephemeral.inferenceCount,
203
+ ephemeral: true,
204
+ });
205
+ }
206
+ return { totals: snapshotUsage(this.totals), byAgent, inferenceCount: this.inferenceCount };
164
207
  }
165
208
  }
@@ -1,191 +0,0 @@
1
- /**
2
- * PyRunner — subprocess lifecycle + protocol driver for the client-side
3
- * programmatic tool calling (`code_execution`) runtime.
4
- *
5
- * One runner per agent. The interpreter is spawned lazily on first exec,
6
- * persists between execs (script globals survive — container-reuse
7
- * semantics), and is reclaimed after an idle period, mirroring the managed
8
- * runtime's ~5-minute container reclaim.
9
- *
10
- * This is a ROBUSTNESS boundary, not a security sandbox — same doctrine as
11
- * GateScript: the agent already has broader host access through its tools.
12
- * What this class guarantees is liveness: a wedged or runaway script cannot
13
- * hang the agent turn (cancel + SIGINT -> grace -> SIGKILL -> respawn) and a crashed
14
- * interpreter surfaces as a tool result, never as an unhandled rejection.
15
- */
16
- export interface InjectedTool {
17
- /** Python identifier the tool is bound to (sanitized, `--` -> `__`). */
18
- pyName: string;
19
- /** Exact framework tool name, sent back on tool_call ops. */
20
- toolName: string;
21
- }
22
- export interface ExecResult {
23
- stdout: string;
24
- stderr: string;
25
- returnCode: number;
26
- /** Set when the host killed the script (deadline / abort / crash). */
27
- aborted?: boolean;
28
- /** Background execs: rolling tail of interleaved stdout+stderr (for the
29
- * crash/finish envelope; the full journal is in the log file). */
30
- tail?: string;
31
- }
32
- /** Per-exec options for background (daemon) scripts. */
33
- export interface BackgroundExecOptions {
34
- /** Absolute path for the line-buffered stdout+stderr journal (null: tail only). */
35
- logPath: string | null;
36
- /**
37
- * Called on each wake_agent() from the script. Resolve with null to ack
38
- * (deliver), or an error string to refuse (raises RuntimeError in-script).
39
- * May resolve late — rate limiting backpressures inside wake_agent().
40
- */
41
- onWake: (line: number, payload: unknown) => Promise<string | null>;
42
- /** Overrides the runner's scriptTimeoutMs (background lifetime). */
43
- lifetimeMs: number;
44
- }
45
- /**
46
- * An inner tool call's result as the script gets it. `text` is the string
47
- * its await returns, and the runner sets `.is_error` on that string from
48
- * `isError`. With `structuredJson`, `text` is the JSON object a structured
49
- * result reaches a script as, in any of its forms, and `.structured` reads
50
- * its `structuredContent`, None for a form that holds none, such as one past
51
- * the size cap; without it, `.structured` is None.
52
- */
53
- export interface ScriptToolResult {
54
- text: string;
55
- isError: boolean;
56
- structuredJson?: boolean;
57
- }
58
- /**
59
- * Resolves inner tool calls. Must never reject — map errors to results; a
60
- * rejection reaches the script as an `Error: …` result. A plain string is
61
- * the result's text with nothing said about it, so the script's
62
- * `.is_error` and `.structured` are None.
63
- */
64
- export type ScriptToolCallHandler = (toolName: string, args: Record<string, unknown>) => Promise<string | ScriptToolResult>;
65
- export interface PyRunnerOptions {
66
- pythonPath?: string;
67
- /** Per-tool-call timeout surfaced as TimeoutError inside the script. */
68
- toolCallTimeoutMs?: number;
69
- /** Whole-script deadline; exceeded -> cancel, grace, kill. */
70
- scriptTimeoutMs?: number;
71
- /** How long a script gets to stop after its deadline before the interpreter is killed (default 10s). */
72
- cancelGraceMs?: number;
73
- /** Idle interpreter reclaim (state lost), mirroring container reclaim. */
74
- idleReclaimMs?: number;
75
- onToolCall: ScriptToolCallHandler;
76
- /** Log prefix, typically the agent name. */
77
- label?: string;
78
- /** Variables for the interpreter beyond what it inherits, such as
79
- * PYTHONPATH or a venv's. It inherits only what stdio MCPL children do
80
- * (CHILD_ENV_ALLOWLIST and LC_*, CA bundles and proxy variables among
81
- * them, and a proxy URL can carry credentials), then these, then
82
- * PYTHONUNBUFFERED and PYTHONIOENCODING, which the runner sets last.
83
- * Like the allowlist, this limits what the model's code inherits, not
84
- * what a process running as the same user can read. */
85
- env?: Record<string, string>;
86
- /** Pass the host's whole environment instead of the allowlist, as before
87
- * `env` existed. That hands every host variable, provider keys included,
88
- * to the model's code and to every subprocess a script starts; listing
89
- * what scripts need in `env` is the safer route. */
90
- inheritEnv?: boolean;
91
- }
92
- /** The longest delay Node's timers honour (~24.8 days); a longer one fires after ~1 ms. */
93
- export declare const MAX_TIMER_MS = 2147483647;
94
- /** A time limit for a message: "45s", "10 min", "2.5 h". */
95
- export declare function formatLimit(ms: number): string;
96
- export declare class PyRunner {
97
- private readonly pythonPath;
98
- private readonly toolCallTimeoutMs;
99
- private readonly scriptTimeoutMs;
100
- private readonly cancelGraceMs;
101
- private readonly idleReclaimMs;
102
- private readonly onToolCall;
103
- private readonly label;
104
- private readonly envOptions;
105
- private onWake;
106
- private child;
107
- private childReady;
108
- private reader;
109
- private runtimeDir;
110
- private pending;
111
- private idleTimer;
112
- private execCounter;
113
- private disposed;
114
- constructor(options: PyRunnerOptions);
115
- get busy(): boolean;
116
- /**
117
- * Run one script. Tools are (re-)injected before every exec so the
118
- * interpreter always reflects the current tool surface (list_changed etc.).
119
- * Never rejects: every failure mode resolves to an ExecResult.
120
- *
121
- * With `background` options the exec is a daemon: output journals to the
122
- * log file, wake_agent() is available in-script, and the deadline is the
123
- * background lifetime. A background runner should be DEDICATED to that one
124
- * script (the framework creates one per background script).
125
- *
126
- * `opts.deadlineMs` replaces the runner's scriptTimeoutMs for this exec (a
127
- * per-call time limit); a background exec uses its `lifetimeMs` instead.
128
- * `opts.ceilingMs` is the longest limit the deployment allows this kind of
129
- * script: a script stopped at its limit is offered a longer one only below
130
- * it. Without it, the stop doesn't say whether a longer limit would help.
131
- * `opts.backgroundCeilingMs`, for a foreground exec, is the longest a
132
- * background script may run: one stopped at its ceiling is offered
133
- * background mode when that is longer.
134
- */
135
- exec(code: string, tools: InjectedTool[], background?: BackgroundExecOptions, opts?: {
136
- deadlineMs?: number;
137
- ceilingMs?: number;
138
- backgroundCeilingMs?: number;
139
- }): Promise<ExecResult>;
140
- /**
141
- * Abort the runner's script (its turn ended or is reset to run again, or the
142
- * agent was reset or stopped), whether it's running or still waiting for its
143
- * interpreter to start; a waiting script then never runs. The exec settles
144
- * at once, and the interpreter is reclaimed, a starting one too: after an
145
- * abort its state is suspect (a script died midway), and the next exec gets
146
- * a fresh one.
147
- */
148
- abort(reason: string): void;
149
- dispose(): void;
150
- private ensureChild;
151
- private readyResolver;
152
- /** Fails the readiness of an interpreter that is still starting (see reclaim). */
153
- private readyFailer;
154
- private handleLine;
155
- private settlePending;
156
- /**
157
- * Answer the interpreter that asked. Call and wake ids restart in every
158
- * interpreter, so an answer that outlives its interpreter (the script was
159
- * aborted, killed or crashed, or the interpreter reclaimed) would resolve
160
- * the same id in the one that replaced it, inside another script: drop it.
161
- */
162
- private reply;
163
- private send;
164
- /**
165
- * SIGINT the interpreter: blocking code in the running script raises
166
- * KeyboardInterrupt. Not on Windows, where Node's kill() ends the process
167
- * outright; there the cancel op and the kill grace remain.
168
- * process.kill rather than child.kill, which would mark the child `killed`:
169
- * a killed child gets no more protocol messages and is respawned on the
170
- * next exec, losing the interpreter state this keeps.
171
- */
172
- private interruptChild;
173
- /** Kill interpreter + clean temp dir. State is lost (by design). */
174
- private reclaim;
175
- private teardownChild;
176
- private armIdleTimer;
177
- private clearIdleTimer;
178
- }
179
- /**
180
- * Map framework tool names to python identifiers: `--` (the framework's
181
- * prefix separator) becomes `__`, and every remaining character that is not
182
- * valid in a python identifier becomes `_` (fleet reality: module and server
183
- * ids contain single hyphens — `mcpl-admin`, `dog-events` — found live on
184
- * the first canary run, 2026-07-26). A leading digit gets a `_` prefix.
185
- *
186
- * Names that sanitize to nothing, or that collide after sanitization, are
187
- * skipped loudly — a skipped tool is unreachable from scripts (the
188
- * exact-name tools[...] dict is built from this same list).
189
- */
190
- export declare function buildInjectedTools(toolNames: string[], log?: (message: string) => void): InjectedTool[];
191
- //# sourceMappingURL=py-runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"py-runner.d.ts","sourceRoot":"","sources":["../../../src/code-execution/py-runner.ts"],"names":[],"mappings":"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"}