@sixb/core 0.1.24 → 0.1.26

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 (448) hide show
  1. package/dist/actions/index.js +35 -35
  2. package/dist/agents/attachment-keys.d.ts +25 -0
  3. package/dist/agents/attachment-keys.d.ts.map +1 -0
  4. package/dist/agents/cancel.d.ts +12 -0
  5. package/dist/agents/cancel.d.ts.map +1 -1
  6. package/dist/agents/children.d.ts.map +1 -1
  7. package/dist/agents/dispatch.d.ts +1 -9
  8. package/dist/agents/dispatch.d.ts.map +1 -1
  9. package/dist/agents/execution.d.ts +5 -0
  10. package/dist/agents/execution.d.ts.map +1 -1
  11. package/dist/agents/index.d.ts +31 -6
  12. package/dist/agents/index.d.ts.map +1 -1
  13. package/dist/agents/index.js +154 -66
  14. package/dist/agents/index.js.map +1 -1
  15. package/dist/agents/model-loop.d.ts +3 -5
  16. package/dist/agents/model-loop.d.ts.map +1 -1
  17. package/dist/agents/model-routing.d.ts +4 -1
  18. package/dist/agents/model-routing.d.ts.map +1 -1
  19. package/dist/agents/request.d.ts +9 -1
  20. package/dist/agents/request.d.ts.map +1 -1
  21. package/dist/agents/run-after-finish.d.ts +11 -0
  22. package/dist/agents/run-after-finish.d.ts.map +1 -0
  23. package/dist/agents/run-artifacts.d.ts +56 -0
  24. package/dist/agents/run-artifacts.d.ts.map +1 -0
  25. package/dist/agents/run-events.d.ts +49 -0
  26. package/dist/agents/run-events.d.ts.map +1 -0
  27. package/dist/agents/run-fence.d.ts +38 -0
  28. package/dist/agents/run-fence.d.ts.map +1 -0
  29. package/dist/agents/run-liveness.d.ts +36 -0
  30. package/dist/agents/run-liveness.d.ts.map +1 -0
  31. package/dist/agents/run-plan.d.ts +110 -0
  32. package/dist/agents/run-plan.d.ts.map +1 -0
  33. package/dist/agents/run-session-children.d.ts +89 -0
  34. package/dist/agents/run-session-children.d.ts.map +1 -0
  35. package/dist/agents/run-session-http.d.ts +37 -0
  36. package/dist/agents/run-session-http.d.ts.map +1 -0
  37. package/dist/agents/run-session-serve.d.ts +24 -0
  38. package/dist/agents/run-session-serve.d.ts.map +1 -0
  39. package/dist/agents/run-session-wire.d.ts +31 -0
  40. package/dist/agents/run-session-wire.d.ts.map +1 -0
  41. package/dist/agents/run-session.d.ts +239 -0
  42. package/dist/agents/run-session.d.ts.map +1 -0
  43. package/dist/agents/run-token.d.ts +40 -0
  44. package/dist/agents/run-token.d.ts.map +1 -0
  45. package/dist/agents/run-tools.d.ts +68 -0
  46. package/dist/agents/run-tools.d.ts.map +1 -0
  47. package/dist/agents/run-turn.d.ts +59 -0
  48. package/dist/agents/run-turn.d.ts.map +1 -0
  49. package/dist/agents/streams/index.js +1 -1
  50. package/dist/agents/streams/internal.d.ts +1 -1
  51. package/dist/agents/streams/internal.d.ts.map +1 -1
  52. package/dist/agents/streams/internal.js +2 -4
  53. package/dist/agents/streams/internal.js.map +1 -1
  54. package/dist/agents/streams/protocol.d.ts +1 -96
  55. package/dist/agents/streams/protocol.d.ts.map +1 -1
  56. package/dist/agents/subagent-runs.d.ts +7 -1
  57. package/dist/agents/subagent-runs.d.ts.map +1 -1
  58. package/dist/agents/tool-files.d.ts +34 -0
  59. package/dist/agents/tool-files.d.ts.map +1 -0
  60. package/dist/agents/workflow-node-session.d.ts +99 -0
  61. package/dist/agents/workflow-node-session.d.ts.map +1 -0
  62. package/dist/artifacts/frames/index.js +6 -3
  63. package/dist/artifacts/frames/index.js.map +3 -3
  64. package/dist/artifacts/frames/probe.d.ts.map +1 -1
  65. package/dist/artifacts/index.js.map +1 -1
  66. package/dist/artifacts/publish/index.d.ts +1 -1
  67. package/dist/artifacts/publish/index.d.ts.map +1 -1
  68. package/dist/artifacts/publish/index.js +19 -19
  69. package/dist/auth/index.js +8 -8
  70. package/dist/authorization/index.js +4 -4
  71. package/dist/bootstrap/index.js +45 -43
  72. package/dist/bootstrap/index.js.map +2 -2
  73. package/dist/{chunk-2fn60nvs.js → chunk-06sg8s4z.js} +2 -2
  74. package/dist/{chunk-2fn60nvs.js.map → chunk-06sg8s4z.js.map} +1 -1
  75. package/dist/chunk-07kkp2e1.js.map +1 -1
  76. package/dist/{chunk-9ntbsnke.js → chunk-0bc3w0zq.js} +7 -7
  77. package/dist/{chunk-9ntbsnke.js.map → chunk-0bc3w0zq.js.map} +2 -2
  78. package/dist/{chunk-d2m879s4.js → chunk-0kk2wt0h.js} +27 -27
  79. package/dist/chunk-0kk2wt0h.js.map +12 -0
  80. package/dist/chunk-16a9dmfy.js.map +1 -1
  81. package/dist/chunk-18sk89cg.js.map +2 -2
  82. package/dist/{chunk-3qms4nax.js → chunk-1vg43g9q.js} +20 -20
  83. package/dist/{chunk-3qms4nax.js.map → chunk-1vg43g9q.js.map} +4 -4
  84. package/dist/{chunk-hqsp2sx4.js → chunk-1xvqgg88.js} +31 -33
  85. package/dist/{chunk-hqsp2sx4.js.map → chunk-1xvqgg88.js.map} +6 -6
  86. package/dist/chunk-2adz0h75.js.map +1 -1
  87. package/dist/{chunk-fm62y49k.js → chunk-2pk5hjj9.js} +5 -3
  88. package/dist/{chunk-fm62y49k.js.map → chunk-2pk5hjj9.js.map} +5 -5
  89. package/dist/{chunk-vrf90dkv.js → chunk-2vjnyz1s.js} +1 -1
  90. package/dist/{chunk-vrf90dkv.js.map → chunk-2vjnyz1s.js.map} +1 -1
  91. package/dist/{chunk-4f3ydv7t.js → chunk-315qye3g.js} +1 -1
  92. package/dist/{chunk-4f3ydv7t.js.map → chunk-315qye3g.js.map} +1 -1
  93. package/dist/{chunk-rap5w0x0.js → chunk-31khg3g0.js} +1 -1
  94. package/dist/{chunk-rap5w0x0.js.map → chunk-31khg3g0.js.map} +1 -1
  95. package/dist/chunk-45ngkxkp.js.map +1 -1
  96. package/dist/chunk-48jezz3j.js.map +1 -1
  97. package/dist/{chunk-vr3j63jq.js → chunk-4jq2bg8t.js} +78 -78
  98. package/dist/{chunk-vr3j63jq.js.map → chunk-4jq2bg8t.js.map} +4 -4
  99. package/dist/chunk-4ymrcdbm.js.map +1 -1
  100. package/dist/chunk-58geavnf.js.map +1 -1
  101. package/dist/{chunk-6y0mkhex.js → chunk-59kf345w.js} +2 -2
  102. package/dist/{chunk-6y0mkhex.js.map → chunk-59kf345w.js.map} +1 -1
  103. package/dist/{chunk-3p93tb91.js → chunk-6qn7nmd3.js} +102 -102
  104. package/dist/{chunk-3p93tb91.js.map → chunk-6qn7nmd3.js.map} +4 -4
  105. package/dist/chunk-73j0v4qv.js +355 -0
  106. package/dist/chunk-73j0v4qv.js.map +13 -0
  107. package/dist/{chunk-2gjj5dx3.js → chunk-78ymxrn0.js} +1 -1
  108. package/dist/{chunk-6bkbyer5.js → chunk-7ex2p3zp.js} +3 -3
  109. package/dist/{chunk-6bkbyer5.js.map → chunk-7ex2p3zp.js.map} +1 -1
  110. package/dist/{chunk-5tfev0fv.js → chunk-7hf6tkgs.js} +167 -167
  111. package/dist/{chunk-5tfev0fv.js.map → chunk-7hf6tkgs.js.map} +4 -4
  112. package/dist/{chunk-8z4726jz.js → chunk-7wn5z7mq.js} +10 -10
  113. package/dist/{chunk-8z4726jz.js.map → chunk-7wn5z7mq.js.map} +2 -2
  114. package/dist/{chunk-6n69k945.js → chunk-8mb7mt8n.js} +2 -2
  115. package/dist/chunk-8ncg20rd.js.map +1 -1
  116. package/dist/{chunk-68wghpdf.js → chunk-8v5a54qz.js} +50 -11
  117. package/dist/{chunk-68wghpdf.js.map → chunk-8v5a54qz.js.map} +3 -3
  118. package/dist/{chunk-gqm0b7vd.js → chunk-8v6xzwgr.js} +92 -76
  119. package/dist/{chunk-gqm0b7vd.js.map → chunk-8v6xzwgr.js.map} +6 -6
  120. package/dist/{chunk-m36fw8ft.js → chunk-8wsjr52f.js} +1 -1
  121. package/dist/{chunk-vd1rk42q.js → chunk-8xnz9vvp.js} +4 -4
  122. package/dist/{chunk-vd1rk42q.js.map → chunk-8xnz9vvp.js.map} +1 -1
  123. package/dist/chunk-9mab3dvg.js.map +1 -1
  124. package/dist/chunk-9tc8dxmn.js.map +1 -1
  125. package/dist/chunk-9x8dybsb.js.map +2 -2
  126. package/dist/chunk-a3faa34j.js.map +1 -1
  127. package/dist/{chunk-62a63pr6.js → chunk-axb4ss9a.js} +7 -7
  128. package/dist/{chunk-62a63pr6.js.map → chunk-axb4ss9a.js.map} +2 -2
  129. package/dist/{chunk-z3ryd53f.js → chunk-b6ghvap7.js} +35 -11
  130. package/dist/{chunk-z3ryd53f.js.map → chunk-b6ghvap7.js.map} +3 -3
  131. package/dist/{chunk-sqfvnvqj.js → chunk-c14ap3s9.js} +2 -2
  132. package/dist/{chunk-sqfvnvqj.js.map → chunk-c14ap3s9.js.map} +1 -1
  133. package/dist/{chunk-661ezhks.js → chunk-cbcgs9f7.js} +87 -8
  134. package/dist/chunk-cbcgs9f7.js.map +11 -0
  135. package/dist/chunk-cwdzcv37.js.map +1 -1
  136. package/dist/{chunk-bab05bhg.js → chunk-dgtd0836.js} +1 -1
  137. package/dist/{chunk-1j6j0rht.js → chunk-e24fvw8g.js} +1 -1
  138. package/dist/{chunk-1j6j0rht.js.map → chunk-e24fvw8g.js.map} +1 -1
  139. package/dist/chunk-e5wf5vz0.js.map +1 -1
  140. package/dist/chunk-eptrvnby.js.map +1 -1
  141. package/dist/chunk-ey1nk510.js.map +1 -1
  142. package/dist/{chunk-j936th07.js → chunk-fakrpfy3.js} +58 -58
  143. package/dist/{chunk-j936th07.js.map → chunk-fakrpfy3.js.map} +5 -5
  144. package/dist/chunk-fb3feg1e.js.map +1 -1
  145. package/dist/chunk-ff5xkv0p.js.map +1 -1
  146. package/dist/chunk-fntqb7qy.js.map +1 -1
  147. package/dist/{chunk-7ny9mjgm.js → chunk-ft3w5ahs.js} +1 -1
  148. package/dist/chunk-g663fahq.js.map +1 -1
  149. package/dist/{chunk-cdk3egjj.js → chunk-h1na2cxc.js} +1 -1
  150. package/dist/{chunk-cdk3egjj.js.map → chunk-h1na2cxc.js.map} +1 -1
  151. package/dist/chunk-hn2r7z41.js.map +1 -1
  152. package/dist/{chunk-24bqx0dx.js → chunk-hn76sanm.js} +1 -1
  153. package/dist/{chunk-24bqx0dx.js.map → chunk-hn76sanm.js.map} +1 -1
  154. package/dist/chunk-jmfet9r4.js.map +1 -1
  155. package/dist/{chunk-bnr4a734.js → chunk-jn3ysaf2.js} +24 -22
  156. package/dist/{chunk-bnr4a734.js.map → chunk-jn3ysaf2.js.map} +5 -5
  157. package/dist/{chunk-4y26vs3v.js → chunk-jspskey0.js} +16 -3
  158. package/dist/chunk-jspskey0.js.map +10 -0
  159. package/dist/{chunk-r6szek0x.js → chunk-jt3r6thp.js} +2 -135
  160. package/dist/chunk-jt3r6thp.js.map +10 -0
  161. package/dist/chunk-kfee1h52.js.map +1 -1
  162. package/dist/{chunk-qx00vjrj.js → chunk-kwfhd1g0.js} +23 -23
  163. package/dist/{chunk-qx00vjrj.js.map → chunk-kwfhd1g0.js.map} +4 -4
  164. package/dist/chunk-m427qgq0.js.map +1 -1
  165. package/dist/chunk-mbsbxarb.js.map +1 -1
  166. package/dist/{chunk-et017krg.js → chunk-mdxmt0n3.js} +8657 -8704
  167. package/dist/{chunk-et017krg.js.map → chunk-mdxmt0n3.js.map} +37 -37
  168. package/dist/chunk-mmagke4x.js.map +1 -1
  169. package/dist/{chunk-2x19q6k6.js → chunk-mqx25wwh.js} +319 -154
  170. package/dist/chunk-mqx25wwh.js.map +18 -0
  171. package/dist/chunk-mzx71snp.js.map +1 -1
  172. package/dist/chunk-n8q5j6y5.js.map +1 -1
  173. package/dist/chunk-npcr0228.js.map +1 -1
  174. package/dist/{chunk-m2nevja0.js → chunk-phm3c7b9.js} +1 -1
  175. package/dist/{chunk-m2nevja0.js.map → chunk-phm3c7b9.js.map} +1 -1
  176. package/dist/chunk-qf954wje.js.map +1 -1
  177. package/dist/{chunk-65pyhyas.js → chunk-qgvbxfqv.js} +6 -8
  178. package/dist/{chunk-65pyhyas.js.map → chunk-qgvbxfqv.js.map} +2 -2
  179. package/dist/{chunk-hk38wahh.js → chunk-qst145py.js} +4 -4
  180. package/dist/{chunk-hk38wahh.js.map → chunk-qst145py.js.map} +1 -1
  181. package/dist/{chunk-c844dkwd.js → chunk-qtzftvxa.js} +4 -5
  182. package/dist/{chunk-c844dkwd.js.map → chunk-qtzftvxa.js.map} +2 -2
  183. package/dist/chunk-ratkv4zc.js +3 -0
  184. package/dist/chunk-ratkv4zc.js.map +9 -0
  185. package/dist/{chunk-nzapm6p0.js → chunk-s3we74h8.js} +1 -2
  186. package/dist/chunk-s3we74h8.js.map +12 -0
  187. package/dist/{chunk-0xmt5p5y.js → chunk-t3brw0wd.js} +1 -2
  188. package/dist/{chunk-0xmt5p5y.js.map → chunk-t3brw0wd.js.map} +2 -2
  189. package/dist/chunk-t5608tkq.js.map +1 -1
  190. package/dist/chunk-tdxfsg1c.js.map +1 -1
  191. package/dist/{chunk-1t6k1avb.js → chunk-tnhqtfea.js} +1 -1
  192. package/dist/chunk-vhbw5sqm.js.map +1 -1
  193. package/dist/{chunk-rp9wwk7b.js → chunk-vx4e4zv4.js} +30 -30
  194. package/dist/{chunk-rp9wwk7b.js.map → chunk-vx4e4zv4.js.map} +4 -4
  195. package/dist/chunk-waqk73p1.js.map +1 -1
  196. package/dist/chunk-x0v3jd47.js.map +1 -1
  197. package/dist/{chunk-yecwnwpq.js → chunk-xm8qgbqm.js} +58 -29
  198. package/dist/{chunk-yecwnwpq.js.map → chunk-xm8qgbqm.js.map} +7 -7
  199. package/dist/{chunk-97wr6p2g.js → chunk-y7j6x4h0.js} +8 -8
  200. package/dist/{chunk-97wr6p2g.js.map → chunk-y7j6x4h0.js.map} +4 -4
  201. package/dist/{chunk-xe0732g0.js → chunk-yavhtnac.js} +12 -8
  202. package/dist/{chunk-xe0732g0.js.map → chunk-yavhtnac.js.map} +4 -4
  203. package/dist/chunk-yd00vzqr.js +3394 -0
  204. package/dist/chunk-yd00vzqr.js.map +37 -0
  205. package/dist/{chunk-n9w3n38q.js → chunk-ye5c8016.js} +54 -8
  206. package/dist/chunk-ye5c8016.js.map +23 -0
  207. package/dist/chunk-yw9pyg66.js.map +1 -1
  208. package/dist/{chunk-nydf3dbe.js → chunk-z9mg7wya.js} +37 -20
  209. package/dist/chunk-z9mg7wya.js.map +13 -0
  210. package/dist/chunk-zbc929zg.js.map +1 -1
  211. package/dist/chunk-zhh1jd89.js +290 -0
  212. package/dist/chunk-zhh1jd89.js.map +10 -0
  213. package/dist/connectors/connections/authorizations.d.ts +2 -2
  214. package/dist/connectors/connections/authorizations.d.ts.map +1 -1
  215. package/dist/connectors/connections/service.d.ts.map +1 -1
  216. package/dist/connectors/connections/tokens.d.ts +2 -2
  217. package/dist/connectors/connections/tokens.d.ts.map +1 -1
  218. package/dist/connectors/connections/validation.d.ts +5 -0
  219. package/dist/connectors/connections/validation.d.ts.map +1 -1
  220. package/dist/connectors/types.d.ts +9 -2
  221. package/dist/connectors/types.d.ts.map +1 -1
  222. package/dist/datasets/write.js +3 -3
  223. package/dist/deploy/internal.js +2 -5
  224. package/dist/deploy/internal.js.map +3 -3
  225. package/dist/deploy/types.d.ts +0 -2
  226. package/dist/deploy/types.d.ts.map +1 -1
  227. package/dist/execution/agent.d.ts +2 -2
  228. package/dist/execution/agent.d.ts.map +1 -1
  229. package/dist/execution/agent.js +38 -38
  230. package/dist/execution/agent.js.map +1 -1
  231. package/dist/execution/primitive.js +35 -35
  232. package/dist/execution/request.js +37 -37
  233. package/dist/execution/request.js.map +2 -2
  234. package/dist/http/api-routes.d.ts +12 -11
  235. package/dist/http/api-routes.d.ts.map +1 -1
  236. package/dist/http/index.js +1 -1
  237. package/dist/index.d.ts +3 -3
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +53 -51
  240. package/dist/index.js.map +1 -1
  241. package/dist/lake-storage/index.js +3 -3
  242. package/dist/logging/internal.js +1 -1
  243. package/dist/materializer/index.js +17 -17
  244. package/dist/models/execution/errors.d.ts +5 -0
  245. package/dist/models/execution/errors.d.ts.map +1 -1
  246. package/dist/models/execution/index.d.ts +2 -1
  247. package/dist/models/execution/index.d.ts.map +1 -1
  248. package/dist/models/execution/index.js +55 -50
  249. package/dist/models/execution/index.js.map +1 -1
  250. package/dist/models/execution/model-call-recorder.d.ts +7 -2
  251. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  252. package/dist/models/execution.d.ts.map +1 -1
  253. package/dist/models/language-call.d.ts +51 -0
  254. package/dist/models/language-call.d.ts.map +1 -0
  255. package/dist/objects/index.js +35 -35
  256. package/dist/objects/query/index.js +17 -17
  257. package/dist/ontology/docs-markdown.d.ts.map +1 -1
  258. package/dist/ontology/index.d.ts +1 -1
  259. package/dist/ontology/index.d.ts.map +1 -1
  260. package/dist/ontology/index.js +4 -4
  261. package/dist/ontology/internal.js +8 -275
  262. package/dist/ontology/internal.js.map +3 -4
  263. package/dist/ontology/user-ref.d.ts +21 -3
  264. package/dist/ontology/user-ref.d.ts.map +1 -1
  265. package/dist/pipelines/index.js +19 -19
  266. package/dist/projections/builders.d.ts +13 -2
  267. package/dist/projections/builders.d.ts.map +1 -1
  268. package/dist/projections/index.d.ts +1 -1
  269. package/dist/projections/index.d.ts.map +1 -1
  270. package/dist/projections/internal.js +17 -17
  271. package/dist/projections/types.d.ts +7 -0
  272. package/dist/projections/types.d.ts.map +1 -1
  273. package/dist/projections/validation.d.ts +2 -0
  274. package/dist/projections/validation.d.ts.map +1 -1
  275. package/dist/query.js +2 -2
  276. package/dist/queues/in-memory.d.ts +0 -1
  277. package/dist/queues/in-memory.d.ts.map +1 -1
  278. package/dist/queues/index.d.ts +1 -1
  279. package/dist/queues/index.d.ts.map +1 -1
  280. package/dist/queues/index.js +1 -1
  281. package/dist/queues/types.d.ts +0 -8
  282. package/dist/queues/types.d.ts.map +1 -1
  283. package/dist/runtime/internal.js +23 -23
  284. package/dist/runtime/internal.js.map +1 -1
  285. package/dist/sandboxes/configuration.d.ts +4 -6
  286. package/dist/sandboxes/configuration.d.ts.map +1 -1
  287. package/dist/sandboxes/environment.d.ts.map +1 -1
  288. package/dist/sandboxes/exec.d.ts +5 -3
  289. package/dist/sandboxes/exec.d.ts.map +1 -1
  290. package/dist/sandboxes/guest-credentials.d.ts +61 -0
  291. package/dist/sandboxes/guest-credentials.d.ts.map +1 -0
  292. package/dist/sandboxes/index.d.ts +2 -0
  293. package/dist/sandboxes/index.d.ts.map +1 -1
  294. package/dist/sandboxes/index.js +23 -9
  295. package/dist/sandboxes/index.js.map +1 -1
  296. package/dist/sandboxes/sandbox.d.ts +18 -4
  297. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  298. package/dist/security/internal.js +1 -1
  299. package/dist/security/internal.js.map +1 -1
  300. package/dist/shares/internal.js +17 -17
  301. package/dist/shares/internal.js.map +1 -1
  302. package/dist/storage/agents/in-memory.d.ts +3 -1
  303. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  304. package/dist/storage/agents/index.d.ts +1 -1
  305. package/dist/storage/agents/index.d.ts.map +1 -1
  306. package/dist/storage/agents/provider.d.ts +6 -0
  307. package/dist/storage/agents/provider.d.ts.map +1 -1
  308. package/dist/storage/agents/provider.js +8 -2
  309. package/dist/storage/agents/provider.js.map +1 -1
  310. package/dist/storage/agents/types.d.ts +63 -7
  311. package/dist/storage/agents/types.d.ts.map +1 -1
  312. package/dist/storage/ai-cost/provider.js +2 -2
  313. package/dist/storage/connector-connections/provider.js.map +1 -1
  314. package/dist/storage/file-upload-sessions/provider.js +9 -9
  315. package/dist/storage/index.d.ts +1 -1
  316. package/dist/storage/index.d.ts.map +1 -1
  317. package/dist/storage/index.js +15 -15
  318. package/dist/storage/ontology/provider.js +1 -1
  319. package/dist/storage/share-grants/provider.js +3 -3
  320. package/dist/storage/types.d.ts +1 -1
  321. package/dist/storage/types.d.ts.map +1 -1
  322. package/dist/storage/workflow-runs/provider.js +9 -9
  323. package/dist/syncs/index.js +20 -20
  324. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  325. package/dist/testing/index.d.ts +2 -0
  326. package/dist/testing/index.d.ts.map +1 -1
  327. package/dist/testing/index.js +677 -352
  328. package/dist/testing/index.js.map +9 -7
  329. package/dist/testing/queues-contract.d.ts.map +1 -1
  330. package/dist/testing/sandbox-credentials-contract.d.ts +27 -0
  331. package/dist/testing/sandbox-credentials-contract.d.ts.map +1 -0
  332. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  333. package/dist/testing/users.d.ts +20 -0
  334. package/dist/testing/users.d.ts.map +1 -0
  335. package/dist/users/execution.d.ts +6 -2
  336. package/dist/users/execution.d.ts.map +1 -1
  337. package/dist/users/index.d.ts +1 -1
  338. package/dist/users/index.d.ts.map +1 -1
  339. package/dist/webhooks/internal.js +17 -17
  340. package/dist/webhooks/internal.js.map +1 -1
  341. package/dist/workers/index.js.map +1 -1
  342. package/dist/workflows/index.js +41 -39
  343. package/dist/workflows/index.js.map +1 -1
  344. package/package.json +1 -1
  345. package/src/agents/README.md +136 -0
  346. package/src/agents/attachment-keys.ts +83 -0
  347. package/src/agents/cancel.ts +16 -1
  348. package/src/agents/children.ts +5 -3
  349. package/src/agents/dispatch.ts +6 -58
  350. package/src/agents/execution.ts +18 -0
  351. package/src/agents/index.ts +127 -21
  352. package/src/agents/model-loop.ts +23 -73
  353. package/src/agents/model-routing.ts +7 -2
  354. package/src/agents/request.ts +69 -20
  355. package/src/agents/run-after-finish.ts +133 -0
  356. package/src/agents/run-artifacts.ts +257 -0
  357. package/src/agents/run-events.ts +302 -0
  358. package/src/agents/run-fence.ts +71 -0
  359. package/src/agents/run-liveness.ts +122 -0
  360. package/src/agents/run-plan.ts +316 -0
  361. package/src/agents/run-session-children.ts +303 -0
  362. package/src/agents/run-session-http.ts +397 -0
  363. package/src/agents/run-session-serve.ts +479 -0
  364. package/src/agents/run-session-wire.ts +189 -0
  365. package/src/agents/run-session.ts +802 -0
  366. package/src/agents/run-token.ts +124 -0
  367. package/src/agents/run-tools.ts +180 -0
  368. package/src/agents/run-turn.ts +265 -0
  369. package/src/agents/streams/internal.ts +0 -1
  370. package/src/agents/streams/protocol.ts +0 -292
  371. package/src/agents/subagent-runs.ts +19 -1
  372. package/src/agents/tool-files.ts +225 -0
  373. package/src/agents/workflow-node-session.ts +387 -0
  374. package/src/artifacts/frames/probe.ts +14 -1
  375. package/src/artifacts/publish/index.ts +1 -0
  376. package/src/connectors/connections/authorizations.ts +3 -2
  377. package/src/connectors/connections/service.ts +5 -1
  378. package/src/connectors/connections/tokens.ts +41 -5
  379. package/src/connectors/connections/validation.ts +21 -0
  380. package/src/connectors/types.ts +12 -2
  381. package/src/deploy/types.ts +0 -2
  382. package/src/deploy/validation.ts +1 -4
  383. package/src/execution/agent.ts +2 -2
  384. package/src/execution/authorized-object-reader.ts +28 -1
  385. package/src/http/api-routes.ts +114 -27
  386. package/src/index.ts +3 -1
  387. package/src/models/execution/README.md +15 -1
  388. package/src/models/execution/errors.ts +14 -0
  389. package/src/models/execution/index.ts +2 -1
  390. package/src/models/execution/model-call-recorder.ts +12 -10
  391. package/src/models/execution.ts +9 -11
  392. package/src/models/language-call.ts +247 -0
  393. package/src/ontology/docs-markdown.ts +14 -0
  394. package/src/ontology/index.ts +1 -1
  395. package/src/ontology/user-ref.ts +40 -6
  396. package/src/projections/builders.ts +48 -4
  397. package/src/projections/index.ts +1 -0
  398. package/src/projections/registry.ts +1 -0
  399. package/src/projections/revision.ts +10 -0
  400. package/src/projections/types.ts +8 -0
  401. package/src/projections/validation.ts +52 -6
  402. package/src/queues/in-memory.ts +0 -5
  403. package/src/queues/index.ts +0 -2
  404. package/src/queues/types.ts +0 -13
  405. package/src/runtime/host.ts +1 -1
  406. package/src/sandboxes/README.md +17 -6
  407. package/src/sandboxes/configuration.ts +7 -9
  408. package/src/sandboxes/environment.ts +1 -0
  409. package/src/sandboxes/exec.ts +17 -9
  410. package/src/sandboxes/guest-credentials.ts +262 -0
  411. package/src/sandboxes/index.ts +14 -0
  412. package/src/sandboxes/sandbox.ts +19 -4
  413. package/src/storage/agents/in-memory.ts +53 -0
  414. package/src/storage/agents/index.ts +2 -0
  415. package/src/storage/agents/provider.ts +56 -11
  416. package/src/storage/agents/types.ts +59 -7
  417. package/src/storage/index.ts +2 -0
  418. package/src/storage/types.ts +1 -0
  419. package/src/testing/agent-storage-contract.ts +175 -2
  420. package/src/testing/ai-model-call-groups-contract.ts +0 -1
  421. package/src/testing/index.ts +5 -0
  422. package/src/testing/queues-contract.ts +0 -16
  423. package/src/testing/sandbox-credentials-contract.ts +284 -0
  424. package/src/testing/sandboxes-contract.ts +21 -0
  425. package/src/testing/users.ts +39 -0
  426. package/src/users/execution.ts +33 -7
  427. package/src/users/index.ts +7 -1
  428. package/dist/agents/api-gateway.d.ts +0 -26
  429. package/dist/agents/api-gateway.d.ts.map +0 -1
  430. package/dist/chunk-2x19q6k6.js.map +0 -17
  431. package/dist/chunk-4y26vs3v.js.map +0 -10
  432. package/dist/chunk-661ezhks.js.map +0 -11
  433. package/dist/chunk-d2m879s4.js.map +0 -12
  434. package/dist/chunk-n9w3n38q.js.map +0 -23
  435. package/dist/chunk-nydf3dbe.js.map +0 -13
  436. package/dist/chunk-nzapm6p0.js.map +0 -12
  437. package/dist/chunk-r6szek0x.js.map +0 -10
  438. package/dist/chunk-vabga7fk.js +0 -176
  439. package/dist/chunk-vabga7fk.js.map +0 -12
  440. package/dist/chunk-vpgwq5nf.js +0 -810
  441. package/dist/chunk-vpgwq5nf.js.map +0 -21
  442. package/src/agents/api-gateway.ts +0 -68
  443. /package/dist/{chunk-2gjj5dx3.js.map → chunk-78ymxrn0.js.map} +0 -0
  444. /package/dist/{chunk-6n69k945.js.map → chunk-8mb7mt8n.js.map} +0 -0
  445. /package/dist/{chunk-m36fw8ft.js.map → chunk-8wsjr52f.js.map} +0 -0
  446. /package/dist/{chunk-bab05bhg.js.map → chunk-dgtd0836.js.map} +0 -0
  447. /package/dist/{chunk-7ny9mjgm.js.map → chunk-ft3w5ahs.js.map} +0 -0
  448. /package/dist/{chunk-1t6k1avb.js.map → chunk-tnhqtfea.js.map} +0 -0
@@ -419,6 +419,44 @@ export function assertConversationAgentRunSpec(
419
419
  }
420
420
  }
421
421
  assertApprovalModeField(spec.approvalMode, "Conversational Agent run", prefix)
422
+ assertRunsOn(spec.runsOn, "Conversational Agent run", prefix)
423
+ }
424
+
425
+ /** Validate where a thread or turn runs: `computer`, or absent for the cloud. */
426
+ export function assertRunsOn(value: unknown, subject: string, prefix = "Sixb"): void {
427
+ if (value !== undefined && value !== "computer") {
428
+ throw new AgentStorageError(
429
+ "invalid_input",
430
+ `[${prefix}] ${subject} 'runsOn' must be "computer", or absent for the cloud.`
431
+ )
432
+ }
433
+ }
434
+
435
+ /** Validate the id of the computer a thread runs on: the CLI's own, a short non-blank string. */
436
+ export function assertComputerId(value: unknown, prefix = "Sixb"): void {
437
+ if (typeof value !== "string" || value.trim() === "" || value.length > 200) {
438
+ throw new AgentStorageError(
439
+ "invalid_input",
440
+ `[${prefix}] An Agent thread's 'computerId' must be a non-blank string of at most 200 characters.`
441
+ )
442
+ }
443
+ }
444
+
445
+ /** Refuse to assign a computer to a thread that runs in the cloud, or does not exist. */
446
+ export function assertAssignableComputer(
447
+ thread: AgentThreadRecord | null,
448
+ id: string,
449
+ prefix = "Sixb"
450
+ ): asserts thread is AgentThreadRecord {
451
+ if (!thread) {
452
+ throw new AgentStorageError("thread_not_found", `[${prefix}] Agent thread '${id}' not found.`)
453
+ }
454
+ if (thread.runsOn !== "computer") {
455
+ throw new AgentStorageError(
456
+ "invalid_input",
457
+ `[${prefix}] Agent thread '${id}' runs in the cloud: no computer runs its turns.`
458
+ )
459
+ }
422
460
  }
423
461
 
424
462
  export function isAgentApprovalMode(value: unknown): value is AgentApprovalMode {
@@ -511,16 +549,11 @@ export function assertCreateSubagentRunInput(input: CreateSubagentRunInput, pref
511
549
  `[${prefix}] Subagent spawn key must not exceed 128 characters.`
512
550
  )
513
551
  }
514
- for (const [name, value] of [
515
- ["maxActiveChildren", input.maxActiveChildren],
516
- ["spec.maxSteps", input.spec.maxSteps],
517
- ] as const) {
518
- if (!Number.isSafeInteger(value) || value < 1) {
519
- throw new AgentStorageError(
520
- "invalid_input",
521
- `[${prefix}] Subagent run '${name}' must be a positive safe integer.`
522
- )
523
- }
552
+ if (!Number.isSafeInteger(input.maxActiveChildren) || input.maxActiveChildren < 1) {
553
+ throw new AgentStorageError(
554
+ "invalid_input",
555
+ `[${prefix}] Subagent run 'maxActiveChildren' must be a positive safe integer.`
556
+ )
524
557
  }
525
558
  if (new Set(input.spec.toolNames).size !== input.spec.toolNames.length) {
526
559
  throw new AgentStorageError(
@@ -707,6 +740,17 @@ export function assertSubagentRunResult(
707
740
  `[${prefix}] Subagent run '${runId}' result.filesError must say why it returned no files.`
708
741
  )
709
742
  }
743
+ if (
744
+ result.unread !== undefined &&
745
+ (!paused ||
746
+ !Array.isArray(result.unread) ||
747
+ !result.unread.every((mail) => typeof mail?.id === "string" && typeof mail.text === "string"))
748
+ ) {
749
+ throw new AgentStorageError(
750
+ "invalid_input",
751
+ `[${prefix}] Only a paused subagent run keeps unread mail, each with its id and text: '${runId}'.`
752
+ )
753
+ }
710
754
  }
711
755
 
712
756
  /** Each file a parent and its child exchange: a safe relative path, once, and a valid FileRef. */
@@ -850,9 +894,10 @@ export function assertAgentContextCheckpointAuthority(input: {
850
894
  `[${prefix}] Agent run '${run.id}' does not belong to thread '${create.threadId}'.`
851
895
  )
852
896
  }
897
+ // A run that ended no longer holds its execution, as a reclaimed one does not.
853
898
  if (run.status !== "running") {
854
899
  throw new AgentStorageError(
855
- "invalid_state",
900
+ "execution_lost",
856
901
  `[${prefix}] Agent run '${run.id}' is not running (status '${run.status}').`
857
902
  )
858
903
  }
@@ -90,6 +90,16 @@ export interface AgentThreadRecord {
90
90
  readonly title?: string
91
91
  readonly sandboxParams?: AgentThreadSandboxParams
92
92
  readonly sandboxState?: AgentThreadSandboxState
93
+ /**
94
+ * Where its turns run: on its owner's computer, which claims them, or, when absent, in the cloud.
95
+ * A computer's thread takes turns from its owner alone.
96
+ */
97
+ readonly runsOn?: "computer"
98
+ /**
99
+ * Which of its owner's computers runs a computer's thread: the one that claimed its first turn,
100
+ * or the one it was moved to since. Only that computer claims its turns.
101
+ */
102
+ readonly computerId?: string
93
103
  readonly status: AgentThreadStatus
94
104
  /** Single-flight anchor: the id of the one run currently allowed to write, or `null` when idle. */
95
105
  readonly activeRunId: string | null
@@ -105,6 +115,7 @@ export interface CreateAgentThreadInput {
105
115
  readonly ownerPrincipal: Principal
106
116
  readonly title?: string
107
117
  readonly sandboxParams?: AgentThreadSandboxParams
118
+ readonly runsOn?: "computer"
108
119
  readonly status?: AgentThreadStatus
109
120
  readonly createdAt?: Date
110
121
  readonly updatedAt?: Date
@@ -192,6 +203,15 @@ export interface AddAgentThreadParticipantsInput {
192
203
  readonly addedAt?: Date
193
204
  }
194
205
 
206
+ export interface AssignAgentThreadComputerInput {
207
+ readonly projectId: string
208
+ readonly id: string
209
+ /** The owner's computer that runs the thread's turns from now on. */
210
+ readonly computerId: string
211
+ /** Assign it only to a thread no computer runs yet: a computer assigned already stays. */
212
+ readonly ifUnassigned?: boolean
213
+ }
214
+
195
215
  export interface RemoveAgentThreadParticipantInput {
196
216
  readonly projectId: string
197
217
  readonly threadId: string
@@ -310,6 +330,11 @@ interface AgentRunRecordBase {
310
330
  /** Execution attempts: `0` while queued, `1` on first start, incremented on redelivery. */
311
331
  readonly attempt: number
312
332
  readonly execution?: AgentRunExecution
333
+ /**
334
+ * When someone asked a running run to stop. Its run token stops working at once, and its runner
335
+ * learns of it at its next lease renewal if the broker's cancel never reached it.
336
+ */
337
+ readonly cancelRequestedAt?: Date
313
338
  readonly createdAt: Date
314
339
  readonly startedAt?: Date
315
340
  readonly completedAt?: Date
@@ -340,6 +365,8 @@ export interface ConversationAgentRunSpec {
340
365
  readonly locale?: string
341
366
  /** What the turn may change without asking its requester. Absent on older runs: `auto`. */
342
367
  readonly approvalMode?: AgentApprovalMode
368
+ /** Its thread's `runsOn` when it was asked for: a computer's turn never reaches the agent queue. */
369
+ readonly runsOn?: "computer"
343
370
  }
344
371
 
345
372
  /** Immutable, serialisable child configuration captured before dispatch. */
@@ -352,14 +379,8 @@ export interface SubagentRunSpec {
352
379
  readonly task: string
353
380
  /** Project tools available when the child was admitted. Runtime tools are injected separately. */
354
381
  readonly toolNames: readonly string[]
355
- readonly maxSteps: number
356
382
  /** The parent turn's mode, copied when the child was admitted. Absent: `auto`. */
357
383
  readonly approvalMode?: AgentApprovalMode
358
- /**
359
- * ISO time the parent turn times out at. The child's wall clock ends there, so its wait in the
360
- * queue counts against it. Absent on children admitted before it: the worker's turn timeout.
361
- */
362
- readonly deadline?: string
363
384
  /** The parent turn's requester settings. Absent uses the project's. */
364
385
  readonly timeZone?: string
365
386
  readonly locale?: string
@@ -382,6 +403,11 @@ export interface SubagentRunResult {
382
403
  readonly files?: readonly SubagentRunFile[]
383
404
  /** Why none of what it wrote under `out/` came back, and what to do about it. */
384
405
  readonly filesError?: string
406
+ /**
407
+ * What its parent sent a paused child that it had not read: the run that continues it reads it
408
+ * first.
409
+ */
410
+ readonly unread?: readonly { readonly id: string; readonly text: string }[]
385
411
  }
386
412
 
387
413
  export interface SubagentRunRecord extends AgentRunRecordBase {
@@ -390,7 +416,7 @@ export interface SubagentRunRecord extends AgentRunRecordBase {
390
416
  readonly threadId: string
391
417
  /** The message of its thread that started the run. */
392
418
  readonly triggerMessageId: string
393
- /** The conversation turn the child runs under: its deadline, mode and cancellation. */
419
+ /** The conversation turn the child runs under: its mode and cancellation. */
394
420
  readonly parentRunId: string
395
421
  /** Stable parent-selected key that makes repeated tool execution idempotent. */
396
422
  readonly spawnKey: string
@@ -451,6 +477,11 @@ export interface ReclaimAgentRunInput {
451
477
  readonly id: string
452
478
  readonly projectId: string
453
479
  readonly execution: AgentRunExecution
480
+ /**
481
+ * Take the run over only if the lease last recorded on it ran out by then, checked in the same
482
+ * write: a renewal that lands first keeps it its runner's. Otherwise `invalid_state`.
483
+ */
484
+ readonly ifLapsedBy?: Date
454
485
  }
455
486
 
456
487
  export interface ConfirmAgentRunExecutionOwnershipInput {
@@ -461,6 +492,12 @@ export interface ConfirmAgentRunExecutionOwnershipInput {
461
492
  readonly queueLeaseExpiresAt: Date
462
493
  }
463
494
 
495
+ export interface RequestAgentRunCancelInput {
496
+ readonly id: string
497
+ readonly projectId: string
498
+ readonly at?: Date
499
+ }
500
+
464
501
  export type FinishAgentRunInput =
465
502
  | {
466
503
  readonly id: string
@@ -561,6 +598,11 @@ export interface DeleteAgentMessagesByRunInput {
561
598
  readonly projectId: string
562
599
  readonly threadId: string
563
600
  readonly runId: string
601
+ /**
602
+ * The run that deletes them, when one does: refused with `execution_lost` unless it still runs
603
+ * under this token, checked in the same transaction as the delete.
604
+ */
605
+ readonly fence?: { readonly runId: string; readonly executionToken: string }
564
606
  }
565
607
 
566
608
  export interface ListAgentMessagesInput {
@@ -659,6 +701,11 @@ export interface AgentThreadStore {
659
701
  ): Promise<readonly AgentThreadParticipantRecord[]>
660
702
  /** Whether the user took part until now. */
661
703
  removeParticipant(input: RemoveAgentThreadParticipantInput): Promise<boolean>
704
+ /**
705
+ * Name which of its owner's computers runs a computer's thread, and return the thread after. A
706
+ * cloud thread runs on none, and is refused.
707
+ */
708
+ assignComputer(input: AssignAgentThreadComputerInput): Promise<AgentThreadRecord>
662
709
  /** The participants of these threads, oldest first, then by user id and thread id. */
663
710
  listParticipants(
664
711
  input: ListAgentThreadParticipantsInput
@@ -688,6 +735,11 @@ export interface AgentRunStore {
688
735
  * Implementations must fence by token and must never move the expiration backwards.
689
736
  */
690
737
  confirmExecutionOwnership(input: ConfirmAgentRunExecutionOwnershipInput): Promise<AgentRunRecord>
738
+ /**
739
+ * Record that a running run was asked to stop, keeping the first time it was. A run in any other
740
+ * state is returned as it is: a queued one is cancelled with `finishQueued`.
741
+ */
742
+ requestCancel(input: RequestAgentRunCancelInput): Promise<AgentRunRecord>
691
743
  /**
692
744
  * Finalize a run and release the thread's `activeRunId`. `finishReason: "awaiting_approval"`
693
745
  * needs a call the run holds (see `approvals.holdsRun`). A turn that ends any other way cancels
@@ -123,6 +123,7 @@ export type {
123
123
  AgentThreadStatus,
124
124
  AgentThreadStore,
125
125
  AppendAgentMessageInput,
126
+ AssignAgentThreadComputerInput,
126
127
  ConfirmAgentRunExecutionOwnershipInput,
127
128
  ConversationAgentRunRecord,
128
129
  ConversationAgentRunSpec,
@@ -154,6 +155,7 @@ export type {
154
155
  RemoveAgentThreadParticipantInput,
155
156
  RequestAgentApprovalInput,
156
157
  RequestAgentApprovalResult,
158
+ RequestAgentRunCancelInput,
157
159
  SaveAgentMemoryInput,
158
160
  SaveAgentMemoryResult,
159
161
  SettleAgentApprovalsInput,
@@ -69,6 +69,7 @@ export type {
69
69
  ListAgentThreadsInput,
70
70
  ListAgentThreadsResult,
71
71
  ReclaimAgentRunInput,
72
+ RequestAgentRunCancelInput,
72
73
  StartAgentRunInput,
73
74
  SubagentRunFile,
74
75
  SubagentRunRecord,
@@ -165,7 +165,6 @@ function subagentInput(
165
165
  reasoning: "medium",
166
166
  task: "Research the open orders.",
167
167
  toolNames: ["search_orders"],
168
- maxSteps: 25,
169
168
  files: [{ path: "reports/orders.csv", fileRef: testFileRef("orders.csv") }],
170
169
  },
171
170
  thread: { id: `thread_${id}`, create: true },
@@ -750,6 +749,74 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
750
749
  })
751
750
  })
752
751
 
752
+ test("keeps a thread that runs on its owner's computer, and its turns' place", async () => {
753
+ await withStorage(async (storage, fixture) => {
754
+ const thread = await storage.threads.create(threadInput({ runsOn: "computer" }))
755
+ expect(thread.runsOn).toBe("computer")
756
+ await expect(storage.threads.getById({ projectId, id: thread.id })).resolves.toMatchObject({
757
+ runsOn: "computer",
758
+ })
759
+ const cloud = await storage.threads.create(threadInput({ id: "thr_cloud" }))
760
+ expect(cloud).not.toHaveProperty("runsOn")
761
+
762
+ const spec = { model: { provider: "test", modelId: "large" }, runsOn: "computer" as const }
763
+ await createRun(storage, fixture, runInput({ id: "run_1", spec }))
764
+ expect((await storage.runs.getById({ projectId, id: "run_1" }))?.spec).toEqual(spec)
765
+ await expectAgentError(
766
+ createRun(
767
+ storage,
768
+ fixture,
769
+ runInput({
770
+ id: "run_2",
771
+ threadId: "thr_cloud",
772
+ spec: { ...spec, runsOn: "laptop" } as unknown as ConversationAgentRunSpec,
773
+ })
774
+ ),
775
+ "invalid_input"
776
+ )
777
+ })
778
+ })
779
+
780
+ // Guard proof: drop `ifUnassigned` from a store's assignComputer; the second claim takes the
781
+ // thread from the laptop that runs it.
782
+ test("names the computer a computer's thread runs on, which only a move changes", async () => {
783
+ await withStorage(async (storage) => {
784
+ await storage.threads.create(threadInput({ runsOn: "computer" }))
785
+ await storage.threads.create(threadInput({ id: "thr_cloud" }))
786
+ const thread = { projectId, id: "thr_1" }
787
+
788
+ // The first claim names the computer; a later one from elsewhere keeps it.
789
+ await expect(
790
+ storage.threads.assignComputer({ ...thread, computerId: "laptop", ifUnassigned: true })
791
+ ).resolves.toMatchObject({ computerId: "laptop" })
792
+ await expect(
793
+ storage.threads.assignComputer({ ...thread, computerId: "desktop", ifUnassigned: true })
794
+ ).resolves.toMatchObject({ computerId: "laptop" })
795
+
796
+ // A move names another.
797
+ await storage.threads.assignComputer({ ...thread, computerId: "desktop" })
798
+ await expect(storage.threads.getById(thread)).resolves.toMatchObject({
799
+ computerId: "desktop",
800
+ })
801
+
802
+ await expectAgentError(
803
+ storage.threads.assignComputer({ projectId, id: "thr_cloud", computerId: "laptop" }),
804
+ "invalid_input"
805
+ )
806
+ await expectAgentError(
807
+ storage.threads.assignComputer({ projectId, id: "thr_none", computerId: "laptop" }),
808
+ "thread_not_found"
809
+ )
810
+ await expectAgentError(
811
+ storage.threads.assignComputer({ ...thread, computerId: " " }),
812
+ "invalid_input"
813
+ )
814
+ expect(await storage.threads.getById({ projectId, id: "thr_cloud" })).not.toHaveProperty(
815
+ "computerId"
816
+ )
817
+ })
818
+ })
819
+
753
820
  test("reads several threads at once, in the order asked", async () => {
754
821
  await withStorage(async (storage) => {
755
822
  const first = await storage.threads.create(threadInput())
@@ -1646,6 +1713,17 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
1646
1713
  }),
1647
1714
  "invalid_input"
1648
1715
  )
1716
+ // Only a paused child keeps mail it never read, for the run that continues it.
1717
+ await expectAgentError(
1718
+ storage.runs.finish({
1719
+ projectId,
1720
+ id: "child_1",
1721
+ executionToken: "child_token",
1722
+ status: "succeeded",
1723
+ result: { text: "Three open orders.", unread: [{ id: "m1", text: "Skip Globex." }] },
1724
+ }),
1725
+ "invalid_input"
1726
+ )
1649
1727
 
1650
1728
  await expectAgentError(
1651
1729
  storage.runs.finish({
@@ -1767,10 +1845,21 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
1767
1845
  })
1768
1846
  expect(older.execution?.queueLeaseExpiresAt.toISOString()).toBe("2026-06-23T10:03:00.000Z")
1769
1847
 
1848
+ // A takeover conditioned on a lapse that a renewal moved past leaves the run to its runner.
1849
+ await expectAgentError(
1850
+ storage.runs.reclaim({
1851
+ projectId,
1852
+ id: "run_1",
1853
+ execution: execution("exec_2", at("2026-06-23T10:04:00.000Z")),
1854
+ ifLapsedBy: at("2026-06-23T10:02:59.000Z"),
1855
+ }),
1856
+ "invalid_state"
1857
+ )
1770
1858
  const reclaimed = await storage.runs.reclaim({
1771
1859
  projectId,
1772
1860
  id: "run_1",
1773
1861
  execution: execution("exec_2", at("2026-06-23T10:04:00.000Z")),
1862
+ ifLapsedBy: at("2026-06-23T10:03:00.000Z"),
1774
1863
  })
1775
1864
  expect(reclaimed).toMatchObject({ status: "running", attempt: 2 })
1776
1865
  expect(reclaimed.execution?.token).toBe("exec_2")
@@ -1795,6 +1884,59 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
1795
1884
  })
1796
1885
  })
1797
1886
 
1887
+ test("records a running run's cancel once, survives a reclaim, and leaves other states", async () => {
1888
+ await withStorage(async (storage, fixture) => {
1889
+ await storage.threads.create(threadInput())
1890
+ const queued = await createRun(storage, fixture, runInput({ id: "run_queued" }))
1891
+ expect(
1892
+ (await storage.runs.requestCancel({ projectId, id: queued.id })).cancelRequestedAt
1893
+ ).toBeUndefined()
1894
+
1895
+ await storage.threads.create(threadInput({ id: "thread_2" }))
1896
+ await createAndStartRun(
1897
+ storage,
1898
+ fixture,
1899
+ runInput({
1900
+ id: "run_1",
1901
+ threadId: "thread_2",
1902
+ execution: execution("exec_1", at("2026-06-23T10:02:00.000Z")),
1903
+ })
1904
+ )
1905
+ const first = await storage.runs.requestCancel({
1906
+ projectId,
1907
+ id: "run_1",
1908
+ at: at("2026-06-23T10:01:00.000Z"),
1909
+ })
1910
+ expect(first.cancelRequestedAt?.toISOString()).toBe("2026-06-23T10:01:00.000Z")
1911
+ const again = await storage.runs.requestCancel({
1912
+ projectId,
1913
+ id: "run_1",
1914
+ at: at("2026-06-23T10:01:30.000Z"),
1915
+ })
1916
+ expect(again.cancelRequestedAt?.toISOString()).toBe("2026-06-23T10:01:00.000Z")
1917
+
1918
+ // The renewal a runner makes reads it back, and a reclaim keeps it.
1919
+ const renewed = await storage.runs.confirmExecutionOwnership({
1920
+ projectId,
1921
+ id: "run_1",
1922
+ executionToken: "exec_1",
1923
+ queueLeaseExpiresAt: at("2026-06-23T10:03:00.000Z"),
1924
+ })
1925
+ expect(renewed.cancelRequestedAt?.toISOString()).toBe("2026-06-23T10:01:00.000Z")
1926
+ const reclaimed = await storage.runs.reclaim({
1927
+ projectId,
1928
+ id: "run_1",
1929
+ execution: execution("exec_2", at("2026-06-23T10:04:00.000Z")),
1930
+ })
1931
+ expect(reclaimed.cancelRequestedAt?.toISOString()).toBe("2026-06-23T10:01:00.000Z")
1932
+
1933
+ await expectAgentError(
1934
+ storage.runs.requestCancel({ projectId, id: "run_missing" }),
1935
+ "run_not_found"
1936
+ )
1937
+ })
1938
+ })
1939
+
1798
1940
  test("does not alias stored run records to callers", async () => {
1799
1941
  await withStorage(async (storage, fixture) => {
1800
1942
  await storage.threads.create(threadInput())
@@ -2168,6 +2310,37 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
2168
2310
  })
2169
2311
  })
2170
2312
 
2313
+ // Guard proof: drop the fence check from deleteByRunId; the stale token deletes the message.
2314
+ test("deletes a run's messages for a fencing run only while it runs under its token", async () => {
2315
+ await withStorage(async (storage, fixture) => {
2316
+ await storage.threads.create(threadInput())
2317
+ await createAndStartRun(
2318
+ storage,
2319
+ fixture,
2320
+ runInput({ id: "run_1", execution: execution("exec_1") })
2321
+ )
2322
+ await storage.messages.append({
2323
+ id: "msg_asst_1",
2324
+ projectId,
2325
+ threadId: "thr_1",
2326
+ runId: "run_1",
2327
+ role: "assistant",
2328
+ parts: [{ type: "text", text: "Hi." }],
2329
+ })
2330
+ const remove = (executionToken: string) =>
2331
+ storage.messages.deleteByRunId({
2332
+ projectId,
2333
+ threadId: "thr_1",
2334
+ runId: "run_1",
2335
+ fence: { runId: "run_1", executionToken },
2336
+ })
2337
+
2338
+ await expectAgentError(remove("exec_stale"), "execution_lost")
2339
+ expect(await storage.messages.getById({ projectId, id: "msg_asst_1" })).not.toBeNull()
2340
+ await expect(remove("exec_1")).resolves.toBe(1)
2341
+ })
2342
+ })
2343
+
2171
2344
  // Guard proof: make `countsAsThreadMessage` return true; the thread, its fork and the count
2172
2345
  // after a run's messages go read 2, 2 and 2.
2173
2346
  test("counts only the messages the conversation shows", async () => {
@@ -2426,7 +2599,7 @@ export function runAgentStorageContractSuite<TStorage extends AgentStorageContra
2426
2599
  executionToken: "exec_2",
2427
2600
  status: "failed",
2428
2601
  })
2429
- await expectAgentError(storage.checkpoints.create(checkpointInput()), "invalid_state")
2602
+ await expectAgentError(storage.checkpoints.create(checkpointInput()), "execution_lost")
2430
2603
  expect(await storage.checkpoints.getLatest({ projectId, threadId: "thr_1" })).toBeNull()
2431
2604
  })
2432
2605
  })
@@ -448,7 +448,6 @@ async function seed(storage: AiModelCallGroupsContractStorage) {
448
448
  model: { provider: "child-provider", modelId: "small" },
449
449
  task: "Research",
450
450
  toolNames: [],
451
- maxSteps: 25,
452
451
  },
453
452
  thread: { id: "child_thread", create: true },
454
453
  trigger: { id: "child_task", parts: [{ type: "text", text: "Research" }] },
@@ -154,6 +154,10 @@ export {
154
154
  type QueueContractSuiteOptions,
155
155
  runQueueContractSuite,
156
156
  } from "./queues-contract"
157
+ export {
158
+ runSandboxCredentialsContractSuite,
159
+ type SandboxCredentialsContractSuiteOptions,
160
+ } from "./sandbox-credentials-contract"
157
161
  export {
158
162
  runSandboxesContractSuite,
159
163
  type SandboxesContractCapabilities,
@@ -178,6 +182,7 @@ export {
178
182
  runUniqueValuesContractSuite,
179
183
  type UniqueValuesContractProvider,
180
184
  } from "./unique-values-contract"
185
+ export { seedTestUsers, type TestUser } from "./users"
181
186
  export { startTestWebhookRun } from "./webhook-execution"
182
187
  export {
183
188
  runWebhookRunStorageContractSuite,
@@ -388,15 +388,6 @@ export function runQueueContractSuite(label: string, options: QueueContractSuite
388
388
  },
389
389
  ],
390
390
  })
391
- await queues.agentChildren.enqueue({
392
- projectId: "project-a",
393
- jobs: [
394
- {
395
- type: "agent.subagent-run.requested",
396
- payload: { runId: "child-run-1" },
397
- },
398
- ],
399
- })
400
391
 
401
392
  const crossLane = await queues.pipelines.claim({
402
393
  projectId: "project-a",
@@ -418,11 +409,6 @@ export function runQueueContractSuite(label: string, options: QueueContractSuite
418
409
  workerId: "agent-worker-1",
419
410
  limit: 10,
420
411
  })
421
- const childLane = await queues.agentChildren.claim({
422
- projectId: "project-a",
423
- workerId: "child-agent-worker-1",
424
- limit: 10,
425
- })
426
412
  const sameLane = await queues.syncRuns.claim({
427
413
  projectId: "project-a",
428
414
  workerId: "sync-worker-1",
@@ -440,8 +426,6 @@ export function runQueueContractSuite(label: string, options: QueueContractSuite
440
426
  type: "agent.run.requested",
441
427
  payload: { runId: "agent-run-1" },
442
428
  })
443
- expect(childLane).toHaveLength(1)
444
- expect(childLane[0]?.job.payload.runId).toBe("child-run-1")
445
429
  expect(sameLane).toHaveLength(1)
446
430
  })
447
431
  })