@sixb/core 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (587) hide show
  1. package/dist/actions/index.js +28 -28
  2. package/dist/agents/cancel.d.ts +1 -1
  3. package/dist/agents/cancel.d.ts.map +1 -1
  4. package/dist/agents/child-question.d.ts +35 -2
  5. package/dist/agents/child-question.d.ts.map +1 -1
  6. package/dist/agents/execution.d.ts +35 -3
  7. package/dist/agents/execution.d.ts.map +1 -1
  8. package/dist/agents/ids.d.ts +4 -0
  9. package/dist/agents/ids.d.ts.map +1 -1
  10. package/dist/agents/index.d.ts +9 -7
  11. package/dist/agents/index.d.ts.map +1 -1
  12. package/dist/agents/index.js +59 -33
  13. package/dist/agents/index.js.map +1 -1
  14. package/dist/agents/model-loop.d.ts.map +1 -1
  15. package/dist/agents/queued-turn.d.ts +16 -0
  16. package/dist/agents/queued-turn.d.ts.map +1 -0
  17. package/dist/agents/request.d.ts +79 -1
  18. package/dist/agents/request.d.ts.map +1 -1
  19. package/dist/agents/run-after-finish.d.ts +10 -0
  20. package/dist/agents/run-after-finish.d.ts.map +1 -1
  21. package/dist/agents/run-artifacts.d.ts +0 -38
  22. package/dist/agents/run-artifacts.d.ts.map +1 -1
  23. package/dist/agents/run-events.d.ts +6 -1
  24. package/dist/agents/run-events.d.ts.map +1 -1
  25. package/dist/agents/run-session-children.d.ts +9 -0
  26. package/dist/agents/run-session-children.d.ts.map +1 -1
  27. package/dist/agents/run-session-http.d.ts.map +1 -1
  28. package/dist/agents/run-session-serve.d.ts.map +1 -1
  29. package/dist/agents/run-session.d.ts +14 -1
  30. package/dist/agents/run-session.d.ts.map +1 -1
  31. package/dist/agents/run-turn.d.ts.map +1 -1
  32. package/dist/agents/streams/index.d.ts +1 -1
  33. package/dist/agents/streams/index.d.ts.map +1 -1
  34. package/dist/agents/streams/index.js +1 -1
  35. package/dist/agents/streams/internal.js +1 -1
  36. package/dist/agents/streams/protocol.d.ts +16 -0
  37. package/dist/agents/streams/protocol.d.ts.map +1 -1
  38. package/dist/agents/tool-files.d.ts +1 -1
  39. package/dist/agents/tool-files.d.ts.map +1 -1
  40. package/dist/agents/tool-input-coercion.d.ts +20 -0
  41. package/dist/agents/tool-input-coercion.d.ts.map +1 -0
  42. package/dist/agents/turn-answered.d.ts +7 -0
  43. package/dist/agents/turn-answered.d.ts.map +1 -0
  44. package/dist/agents/validation.d.ts +1 -1
  45. package/dist/agents/validation.d.ts.map +1 -1
  46. package/dist/artifacts/canvas-display.d.ts +3 -5
  47. package/dist/artifacts/canvas-display.d.ts.map +1 -1
  48. package/dist/artifacts/comments.d.ts +14 -3
  49. package/dist/artifacts/comments.d.ts.map +1 -1
  50. package/dist/artifacts/document-fill.d.ts +18 -0
  51. package/dist/artifacts/document-fill.d.ts.map +1 -0
  52. package/dist/artifacts/errors.d.ts +1 -1
  53. package/dist/artifacts/errors.d.ts.map +1 -1
  54. package/dist/artifacts/events.d.ts +3 -2
  55. package/dist/artifacts/events.d.ts.map +1 -1
  56. package/dist/artifacts/execution.d.ts +40 -4
  57. package/dist/artifacts/execution.d.ts.map +1 -1
  58. package/dist/artifacts/frames/assets.d.ts +8 -1
  59. package/dist/artifacts/frames/assets.d.ts.map +1 -1
  60. package/dist/artifacts/frames/document-data.d.ts +98 -0
  61. package/dist/artifacts/frames/document-data.d.ts.map +1 -0
  62. package/dist/artifacts/frames/entries.d.ts +12 -7
  63. package/dist/artifacts/frames/entries.d.ts.map +1 -1
  64. package/dist/artifacts/frames/index.d.ts +2 -1
  65. package/dist/artifacts/frames/index.d.ts.map +1 -1
  66. package/dist/artifacts/frames/index.js +22 -13
  67. package/dist/artifacts/frames/index.js.map +4 -4
  68. package/dist/artifacts/frames/kit.d.ts +15 -0
  69. package/dist/artifacts/frames/kit.d.ts.map +1 -1
  70. package/dist/artifacts/frames/protocol.d.ts +65 -3
  71. package/dist/artifacts/frames/protocol.d.ts.map +1 -1
  72. package/dist/artifacts/frames/runtime.d.ts +32 -5
  73. package/dist/artifacts/frames/runtime.d.ts.map +1 -1
  74. package/dist/artifacts/index.d.ts +4 -2
  75. package/dist/artifacts/index.d.ts.map +1 -1
  76. package/dist/artifacts/index.js +35 -3
  77. package/dist/artifacts/index.js.map +3 -3
  78. package/dist/artifacts/live/blocks.d.ts +62 -0
  79. package/dist/artifacts/live/blocks.d.ts.map +1 -0
  80. package/dist/artifacts/live/board.d.ts +6 -0
  81. package/dist/artifacts/live/board.d.ts.map +1 -1
  82. package/dist/artifacts/live/document.d.ts +12 -0
  83. package/dist/artifacts/live/document.d.ts.map +1 -1
  84. package/dist/artifacts/live/index.d.ts +2 -0
  85. package/dist/artifacts/live/index.d.ts.map +1 -1
  86. package/dist/artifacts/live/index.js +148 -44
  87. package/dist/artifacts/live/index.js.map +3 -3
  88. package/dist/artifacts/live/page.d.ts +49 -0
  89. package/dist/artifacts/live/page.d.ts.map +1 -0
  90. package/dist/artifacts/live/protocol.d.ts +5 -0
  91. package/dist/artifacts/live/protocol.d.ts.map +1 -1
  92. package/dist/artifacts/live/server.d.ts +2 -2
  93. package/dist/artifacts/live/server.d.ts.map +1 -1
  94. package/dist/artifacts/live/server.js +23 -19
  95. package/dist/artifacts/live/server.js.map +1 -1
  96. package/dist/artifacts/live/state.d.ts +4 -1
  97. package/dist/artifacts/live/state.d.ts.map +1 -1
  98. package/dist/artifacts/outline.d.ts +16 -0
  99. package/dist/artifacts/outline.d.ts.map +1 -1
  100. package/dist/artifacts/paper.d.ts +22 -0
  101. package/dist/artifacts/paper.d.ts.map +1 -0
  102. package/dist/artifacts/pdf-job.d.ts +9 -0
  103. package/dist/artifacts/pdf-job.d.ts.map +1 -0
  104. package/dist/artifacts/publish/fields.d.ts +25 -0
  105. package/dist/artifacts/publish/fields.d.ts.map +1 -0
  106. package/dist/artifacts/publish/index.d.ts +2 -1
  107. package/dist/artifacts/publish/index.d.ts.map +1 -1
  108. package/dist/artifacts/publish/index.js +26 -18
  109. package/dist/artifacts/publish/index.js.map +1 -1
  110. package/dist/artifacts/publish/merge.d.ts +5 -5
  111. package/dist/artifacts/publish/merge.d.ts.map +1 -1
  112. package/dist/artifacts/publish/pdf.d.ts +28 -0
  113. package/dist/artifacts/publish/pdf.d.ts.map +1 -0
  114. package/dist/artifacts/publish/previews.d.ts +12 -20
  115. package/dist/artifacts/publish/previews.d.ts.map +1 -1
  116. package/dist/artifacts/publish/publish.d.ts.map +1 -1
  117. package/dist/artifacts/publish/queries.d.ts +6 -1
  118. package/dist/artifacts/publish/queries.d.ts.map +1 -1
  119. package/dist/artifacts/publish/query-answers.d.ts +5 -2
  120. package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
  121. package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
  122. package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
  123. package/dist/artifacts/publish/validate/document.d.ts +5 -3
  124. package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
  125. package/dist/artifacts/queries.d.ts +16 -2
  126. package/dist/artifacts/queries.d.ts.map +1 -1
  127. package/dist/auth/index.js +2 -2
  128. package/dist/authorization/event-visibility.d.ts.map +1 -1
  129. package/dist/authorization/index.js +1 -1
  130. package/dist/blob-storage/index.js +1 -1
  131. package/dist/bootstrap/index.js +38 -38
  132. package/dist/{chunk-tqa68kj7.js → chunk-0hkdtwqk.js} +5 -5
  133. package/dist/{chunk-s5n9617r.js → chunk-0mvjpgvm.js} +5 -5
  134. package/dist/{chunk-k66rp2hr.js → chunk-1yh6jgtz.js} +1 -1
  135. package/dist/{chunk-26qet7wh.js → chunk-5t9gm5tt.js} +4 -4
  136. package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
  137. package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
  138. package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
  139. package/dist/{chunk-hkaa807g.js → chunk-68hm50qh.js} +3 -3
  140. package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
  141. package/dist/chunk-8tv3qd65.js.map +12 -0
  142. package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
  143. package/dist/{chunk-m7b9q5dk.js → chunk-aw1z0gre.js} +4 -4
  144. package/dist/chunk-az95tsh3.js.map +2 -2
  145. package/dist/{chunk-4j0sagwv.js → chunk-b4escq4c.js} +62 -14
  146. package/dist/{chunk-4j0sagwv.js.map → chunk-b4escq4c.js.map} +7 -7
  147. package/dist/chunk-bqr703h4.js +1799 -0
  148. package/dist/chunk-bqr703h4.js.map +13 -0
  149. package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
  150. package/dist/chunk-c29729me.js.map +12 -0
  151. package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
  152. package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
  153. package/dist/{chunk-3014rfjz.js → chunk-ewqn51gr.js} +25 -7
  154. package/dist/{chunk-3014rfjz.js.map → chunk-ewqn51gr.js.map} +3 -3
  155. package/dist/{chunk-7z5rkf0m.js → chunk-ey1p8w68.js} +175 -5
  156. package/dist/chunk-ey1p8w68.js.map +13 -0
  157. package/dist/{chunk-z0t4p2sk.js → chunk-fpf57gca.js} +350 -61
  158. package/dist/chunk-fpf57gca.js.map +47 -0
  159. package/dist/{chunk-kv0kvknv.js → chunk-fzae1jpq.js} +7 -7
  160. package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
  161. package/dist/chunk-fzbhybya.js.map +11 -0
  162. package/dist/{chunk-2by73sm2.js → chunk-gjhrz66x.js} +225 -17
  163. package/dist/{chunk-2by73sm2.js.map → chunk-gjhrz66x.js.map} +5 -5
  164. package/dist/chunk-hn2r7z41.js.map +1 -1
  165. package/dist/{chunk-6gtxshcc.js → chunk-k29n4176.js} +6 -6
  166. package/dist/{chunk-48c1z8nj.js → chunk-k3jh8gsg.js} +10 -2
  167. package/dist/chunk-k3jh8gsg.js.map +10 -0
  168. package/dist/{chunk-w9s23r24.js → chunk-m3qx2pns.js} +751 -93
  169. package/dist/chunk-m3qx2pns.js.map +34 -0
  170. package/dist/{chunk-smnt672s.js → chunk-m9ketb51.js} +20 -4
  171. package/dist/chunk-m9ketb51.js.map +10 -0
  172. package/dist/chunk-mbwsgjn7.js +40 -0
  173. package/dist/chunk-mbwsgjn7.js.map +11 -0
  174. package/dist/{chunk-sysnvjce.js → chunk-naxjka9v.js} +2 -2
  175. package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
  176. package/dist/chunk-nxysqbt0.js.map +10 -0
  177. package/dist/{chunk-vzkxqf8h.js → chunk-paxabbqd.js} +49 -5
  178. package/dist/chunk-paxabbqd.js.map +23 -0
  179. package/dist/{chunk-8tqnsx3q.js → chunk-pc7kra3k.js} +5 -3
  180. package/dist/{chunk-8tqnsx3q.js.map → chunk-pc7kra3k.js.map} +3 -3
  181. package/dist/{chunk-qafng88v.js → chunk-pqvvqc65.js} +4 -4
  182. package/dist/chunk-pvpq483h.js.map +2 -2
  183. package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
  184. package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
  185. package/dist/{chunk-8t2ynwg0.js → chunk-q8d9p0tb.js} +24 -1
  186. package/dist/{chunk-8t2ynwg0.js.map → chunk-q8d9p0tb.js.map} +3 -3
  187. package/dist/{chunk-wa05txmk.js → chunk-qavwr628.js} +49 -5
  188. package/dist/chunk-qavwr628.js.map +12 -0
  189. package/dist/{chunk-bkmnd7zq.js → chunk-rg725hry.js} +174 -30
  190. package/dist/{chunk-bkmnd7zq.js.map → chunk-rg725hry.js.map} +9 -8
  191. package/dist/{chunk-8p7bze4c.js → chunk-s1mqyqmm.js} +3 -3
  192. package/dist/{chunk-p351afzm.js → chunk-s5pj68fa.js} +2 -2
  193. package/dist/{chunk-855w9nvw.js → chunk-vehcr9eb.js} +1 -1
  194. package/dist/{chunk-qds484t8.js → chunk-vs2s3p8n.js} +932 -21
  195. package/dist/chunk-vs2s3p8n.js.map +20 -0
  196. package/dist/chunk-vtjzwymr.js.map +2 -2
  197. package/dist/{chunk-n68vz95m.js → chunk-wqe9shx2.js} +1 -1
  198. package/dist/{chunk-0k3r5kb3.js → chunk-xcrnrpfh.js} +1 -1
  199. package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
  200. package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
  201. package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
  202. package/dist/chunk-xxfj0rr2.js.map +13 -0
  203. package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
  204. package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
  205. package/dist/{chunk-e9w4mgdh.js → chunk-z1njfqqs.js} +589 -53
  206. package/dist/{chunk-e9w4mgdh.js.map → chunk-z1njfqqs.js.map} +14 -11
  207. package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
  208. package/dist/chunk-z4jqb44a.js.map +10 -0
  209. package/dist/{chunk-s7xqfxs9.js → chunk-zft9bzbc.js} +2 -1
  210. package/dist/{chunk-s7xqfxs9.js.map → chunk-zft9bzbc.js.map} +3 -3
  211. package/dist/{chunk-38yvdqzd.js → chunk-zxhym8tr.js} +1 -1
  212. package/dist/connectors/connection-handles.d.ts +9 -0
  213. package/dist/connectors/connection-handles.d.ts.map +1 -0
  214. package/dist/connectors/connections/authorizations.d.ts +9 -0
  215. package/dist/connectors/connections/authorizations.d.ts.map +1 -1
  216. package/dist/connectors/connections/events.d.ts +17 -0
  217. package/dist/connectors/connections/events.d.ts.map +1 -0
  218. package/dist/connectors/connections/runs.d.ts +3 -0
  219. package/dist/connectors/connections/runs.d.ts.map +1 -1
  220. package/dist/connectors/connections/service.d.ts +4 -0
  221. package/dist/connectors/connections/service.d.ts.map +1 -1
  222. package/dist/connectors/execution.d.ts +7 -1
  223. package/dist/connectors/execution.d.ts.map +1 -1
  224. package/dist/connectors/index.d.ts +1 -1
  225. package/dist/connectors/index.d.ts.map +1 -1
  226. package/dist/connectors/types.d.ts +22 -1
  227. package/dist/connectors/types.d.ts.map +1 -1
  228. package/dist/datasets/write.js +1 -1
  229. package/dist/deploy/index.d.ts +1 -1
  230. package/dist/deploy/index.d.ts.map +1 -1
  231. package/dist/deploy/internal.js +3 -2
  232. package/dist/deploy/internal.js.map +3 -3
  233. package/dist/deploy/services.d.ts.map +1 -1
  234. package/dist/deploy/types.d.ts +18 -1
  235. package/dist/deploy/types.d.ts.map +1 -1
  236. package/dist/events/definitions.d.ts +4 -0
  237. package/dist/events/definitions.d.ts.map +1 -1
  238. package/dist/events/execution.d.ts.map +1 -1
  239. package/dist/events/index.d.ts +2 -2
  240. package/dist/events/index.d.ts.map +1 -1
  241. package/dist/events/index.js +3 -3
  242. package/dist/events/outbox-dispatcher.d.ts +7 -0
  243. package/dist/events/outbox-dispatcher.d.ts.map +1 -1
  244. package/dist/events/scope.d.ts +1 -0
  245. package/dist/events/scope.d.ts.map +1 -1
  246. package/dist/events/scope.js +1 -1
  247. package/dist/events/selectors/builder.d.ts +9 -1
  248. package/dist/events/selectors/builder.d.ts.map +1 -1
  249. package/dist/events/selectors/index.d.ts +2 -2
  250. package/dist/events/selectors/index.d.ts.map +1 -1
  251. package/dist/events/selectors/index.js +2 -2
  252. package/dist/events/selectors/predicate.d.ts.map +1 -1
  253. package/dist/events/selectors/types.d.ts +18 -3
  254. package/dist/events/selectors/types.d.ts.map +1 -1
  255. package/dist/events/types/artifacts.d.ts +7 -1
  256. package/dist/events/types/artifacts.d.ts.map +1 -1
  257. package/dist/events/types/connectors.d.ts +32 -0
  258. package/dist/events/types/connectors.d.ts.map +1 -0
  259. package/dist/events/types/index.d.ts +3 -1
  260. package/dist/events/types/index.d.ts.map +1 -1
  261. package/dist/execution/agent.js +28 -28
  262. package/dist/execution/authorization.d.ts +5 -0
  263. package/dist/execution/authorization.d.ts.map +1 -1
  264. package/dist/execution/primitive.js +28 -28
  265. package/dist/execution/request.js +29 -29
  266. package/dist/execution/scopes.d.ts +8 -0
  267. package/dist/execution/scopes.d.ts.map +1 -1
  268. package/dist/execution/script.d.ts +7 -0
  269. package/dist/execution/script.d.ts.map +1 -0
  270. package/dist/execution/types.d.ts +16 -1
  271. package/dist/execution/types.d.ts.map +1 -1
  272. package/dist/http/api-routes.d.ts.map +1 -1
  273. package/dist/http/index.js +1 -1
  274. package/dist/index.d.ts +9 -8
  275. package/dist/index.d.ts.map +1 -1
  276. package/dist/index.js +46 -44
  277. package/dist/index.js.map +1 -1
  278. package/dist/lake-storage/index.js +1 -1
  279. package/dist/lineage/executors.d.ts +1 -1
  280. package/dist/lineage/executors.d.ts.map +1 -1
  281. package/dist/maintenance/index.js +1 -1
  282. package/dist/materialization/event-envelopes.d.ts +3 -3
  283. package/dist/materialization/event-envelopes.d.ts.map +1 -1
  284. package/dist/materialization/events.d.ts +6 -0
  285. package/dist/materialization/events.d.ts.map +1 -1
  286. package/dist/materialization/index.js +1 -1
  287. package/dist/materialization/model.d.ts +6 -0
  288. package/dist/materialization/model.d.ts.map +1 -1
  289. package/dist/materializer/index.js +13 -13
  290. package/dist/materializer/projections/replace.d.ts.map +1 -1
  291. package/dist/materializer/projections/replacement-plan.d.ts +2 -0
  292. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  293. package/dist/materializer/shared/normalize.d.ts +1 -0
  294. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  295. package/dist/models/execution/index.js +12 -12
  296. package/dist/models/language-model.d.ts +6 -0
  297. package/dist/models/language-model.d.ts.map +1 -1
  298. package/dist/models/tools.d.ts +2 -0
  299. package/dist/models/tools.d.ts.map +1 -1
  300. package/dist/objects/index.js +28 -28
  301. package/dist/objects/query/index.js +12 -12
  302. package/dist/pipelines/index.js +18 -18
  303. package/dist/projections/builders.d.ts +7 -1
  304. package/dist/projections/builders.d.ts.map +1 -1
  305. package/dist/projections/index.d.ts +1 -1
  306. package/dist/projections/index.d.ts.map +1 -1
  307. package/dist/projections/internal.js +13 -13
  308. package/dist/projections/types.d.ts +10 -0
  309. package/dist/projections/types.d.ts.map +1 -1
  310. package/dist/projections/validation.d.ts.map +1 -1
  311. package/dist/queues/in-memory.d.ts +2 -1
  312. package/dist/queues/in-memory.d.ts.map +1 -1
  313. package/dist/queues/index.d.ts +1 -1
  314. package/dist/queues/index.d.ts.map +1 -1
  315. package/dist/queues/index.js +1 -1
  316. package/dist/queues/types.d.ts +40 -13
  317. package/dist/queues/types.d.ts.map +1 -1
  318. package/dist/runtime/host.d.ts +13 -0
  319. package/dist/runtime/host.d.ts.map +1 -1
  320. package/dist/runtime/internal.d.ts +1 -0
  321. package/dist/runtime/internal.d.ts.map +1 -1
  322. package/dist/runtime/internal.js +39 -18
  323. package/dist/runtime/internal.js.map +4 -3
  324. package/dist/runtime/resolve-definitions.d.ts +1 -1
  325. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  326. package/dist/runtime/script.d.ts +39 -0
  327. package/dist/runtime/script.d.ts.map +1 -0
  328. package/dist/runtime/sixb.d.ts +2 -2
  329. package/dist/runtime/sixb.d.ts.map +1 -1
  330. package/dist/schedules/builders.d.ts.map +1 -1
  331. package/dist/schedules/index.js +3 -3
  332. package/dist/schedules/runtime.d.ts.map +1 -1
  333. package/dist/schedules/validation.d.ts +2 -0
  334. package/dist/schedules/validation.d.ts.map +1 -1
  335. package/dist/shares/internal.js +12 -12
  336. package/dist/storage/agents/errors.d.ts +1 -1
  337. package/dist/storage/agents/errors.d.ts.map +1 -1
  338. package/dist/storage/agents/in-memory.d.ts +26 -1
  339. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  340. package/dist/storage/agents/index.d.ts +2 -2
  341. package/dist/storage/agents/index.d.ts.map +1 -1
  342. package/dist/storage/agents/provider.d.ts +12 -3
  343. package/dist/storage/agents/provider.d.ts.map +1 -1
  344. package/dist/storage/agents/provider.js +25 -5
  345. package/dist/storage/agents/provider.js.map +1 -1
  346. package/dist/storage/agents/types.d.ts +156 -1
  347. package/dist/storage/agents/types.d.ts.map +1 -1
  348. package/dist/storage/artifacts/in-memory.d.ts +7 -1
  349. package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
  350. package/dist/storage/artifacts/index.d.ts +1 -1
  351. package/dist/storage/artifacts/index.d.ts.map +1 -1
  352. package/dist/storage/artifacts/record.d.ts +2 -1
  353. package/dist/storage/artifacts/record.d.ts.map +1 -1
  354. package/dist/storage/artifacts/types.d.ts +34 -0
  355. package/dist/storage/artifacts/types.d.ts.map +1 -1
  356. package/dist/storage/executions/provider.d.ts +3 -3
  357. package/dist/storage/executions/provider.d.ts.map +1 -1
  358. package/dist/storage/executions/provider.js +1 -1
  359. package/dist/storage/executions/types.d.ts +6 -0
  360. package/dist/storage/executions/types.d.ts.map +1 -1
  361. package/dist/storage/executions/validation.d.ts.map +1 -1
  362. package/dist/storage/file-upload-sessions/provider.js +3 -3
  363. package/dist/storage/index.d.ts +3 -3
  364. package/dist/storage/index.d.ts.map +1 -1
  365. package/dist/storage/index.js +18 -14
  366. package/dist/storage/index.js.map +1 -1
  367. package/dist/storage/internal.d.ts +1 -1
  368. package/dist/storage/internal.d.ts.map +1 -1
  369. package/dist/storage/internal.js +8 -6
  370. package/dist/storage/internal.js.map +2 -2
  371. package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
  372. package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
  373. package/dist/storage/ontology/provider.js +1 -1
  374. package/dist/storage/ontology/replacement-plans.d.ts +8 -0
  375. package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
  376. package/dist/storage/operation-scope.d.ts.map +1 -1
  377. package/dist/storage/operation-scope.js +1 -1
  378. package/dist/storage/workflow-runs/provider.js +3 -3
  379. package/dist/syncs/index.js +19 -19
  380. package/dist/testing/agent-execution.d.ts +3 -0
  381. package/dist/testing/agent-execution.d.ts.map +1 -1
  382. package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
  383. package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
  384. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  385. package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
  386. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  387. package/dist/testing/index.d.ts +1 -0
  388. package/dist/testing/index.d.ts.map +1 -1
  389. package/dist/testing/index.js +5524 -4555
  390. package/dist/testing/index.js.map +10 -9
  391. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  392. package/dist/testing/queues-contract.d.ts.map +1 -1
  393. package/dist/webhooks/connections.d.ts +3 -4
  394. package/dist/webhooks/connections.d.ts.map +1 -1
  395. package/dist/webhooks/index.d.ts +1 -1
  396. package/dist/webhooks/index.d.ts.map +1 -1
  397. package/dist/webhooks/internal.js +16 -49
  398. package/dist/webhooks/internal.js.map +3 -3
  399. package/dist/webhooks/types.d.ts +2 -11
  400. package/dist/webhooks/types.d.ts.map +1 -1
  401. package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
  402. package/dist/workflows/index.js +35 -35
  403. package/package.json +6 -1
  404. package/src/agents/README.md +6 -2
  405. package/src/agents/approval-outcome.ts +2 -2
  406. package/src/agents/cancel.ts +2 -2
  407. package/src/agents/child-question.ts +76 -8
  408. package/src/agents/execution.ts +168 -30
  409. package/src/agents/ids.ts +9 -1
  410. package/src/agents/index.ts +27 -6
  411. package/src/agents/model-loop.ts +3 -1
  412. package/src/agents/queued-turn.ts +46 -0
  413. package/src/agents/request.ts +517 -2
  414. package/src/agents/run-after-finish.ts +259 -2
  415. package/src/agents/run-artifacts.ts +3 -93
  416. package/src/agents/run-events.ts +26 -1
  417. package/src/agents/run-session-children.ts +33 -0
  418. package/src/agents/run-session-http.ts +10 -2
  419. package/src/agents/run-session-serve.ts +3 -8
  420. package/src/agents/run-session.ts +142 -3
  421. package/src/agents/run-turn.ts +8 -0
  422. package/src/agents/streams/index.ts +1 -0
  423. package/src/agents/streams/protocol.ts +41 -1
  424. package/src/agents/tool-files.ts +1 -1
  425. package/src/agents/tool-input-coercion.ts +140 -0
  426. package/src/agents/turn-answered.ts +31 -0
  427. package/src/agents/validation.ts +13 -3
  428. package/src/artifacts/canvas-display.ts +4 -6
  429. package/src/artifacts/comments.ts +70 -17
  430. package/src/artifacts/document-fill.ts +103 -0
  431. package/src/artifacts/errors.ts +2 -0
  432. package/src/artifacts/events.ts +4 -1
  433. package/src/artifacts/execution.ts +265 -31
  434. package/src/artifacts/frames/assets.ts +42 -7
  435. package/src/artifacts/frames/document-data.ts +353 -0
  436. package/src/artifacts/frames/entries.ts +22 -16
  437. package/src/artifacts/frames/grants.ts +2 -2
  438. package/src/artifacts/frames/index.ts +3 -0
  439. package/src/artifacts/frames/kit.ts +102 -0
  440. package/src/artifacts/frames/protocol.ts +96 -3
  441. package/src/artifacts/frames/runtime.ts +709 -19
  442. package/src/artifacts/index.ts +6 -0
  443. package/src/artifacts/live/blocks.ts +889 -0
  444. package/src/artifacts/live/board.ts +195 -42
  445. package/src/artifacts/live/document.ts +170 -5
  446. package/src/artifacts/live/index.ts +7 -0
  447. package/src/artifacts/live/page.ts +807 -0
  448. package/src/artifacts/live/protocol.ts +5 -0
  449. package/src/artifacts/live/server.ts +2 -2
  450. package/src/artifacts/live/state.ts +9 -4
  451. package/src/artifacts/outline.ts +17 -0
  452. package/src/artifacts/paper.ts +173 -0
  453. package/src/artifacts/pdf-job.ts +11 -0
  454. package/src/artifacts/publish/fields.ts +177 -0
  455. package/src/artifacts/publish/index.ts +6 -1
  456. package/src/artifacts/publish/merge.ts +14 -12
  457. package/src/artifacts/publish/pdf.ts +82 -0
  458. package/src/artifacts/publish/previews.ts +24 -34
  459. package/src/artifacts/publish/publish.ts +26 -3
  460. package/src/artifacts/publish/queries.ts +20 -4
  461. package/src/artifacts/publish/query-answers.ts +14 -3
  462. package/src/artifacts/publish/validate/document-html.ts +245 -0
  463. package/src/artifacts/publish/validate/document.ts +34 -3
  464. package/src/artifacts/queries.ts +59 -13
  465. package/src/authorization/event-visibility.ts +13 -0
  466. package/src/connectors/connection-handles.ts +71 -0
  467. package/src/connectors/connections/authorizations.ts +50 -2
  468. package/src/connectors/connections/events.ts +57 -0
  469. package/src/connectors/connections/runs.ts +5 -0
  470. package/src/connectors/connections/service.ts +19 -1
  471. package/src/connectors/execution.ts +30 -2
  472. package/src/connectors/index.ts +3 -0
  473. package/src/connectors/types.ts +29 -1
  474. package/src/deploy/index.ts +1 -0
  475. package/src/deploy/services.ts +1 -0
  476. package/src/deploy/types.ts +26 -1
  477. package/src/events/definitions.ts +14 -0
  478. package/src/events/execution.ts +9 -2
  479. package/src/events/index.ts +8 -0
  480. package/src/events/outbox-dispatcher.ts +12 -2
  481. package/src/events/scope.ts +3 -0
  482. package/src/events/selectors/builder.ts +49 -0
  483. package/src/events/selectors/index.ts +5 -0
  484. package/src/events/selectors/predicate.ts +2 -0
  485. package/src/events/selectors/types.ts +30 -1
  486. package/src/events/types/artifacts.ts +7 -1
  487. package/src/events/types/connectors.ts +36 -0
  488. package/src/events/types/index.ts +7 -0
  489. package/src/execution/authorization.ts +45 -0
  490. package/src/execution/durable.ts +2 -0
  491. package/src/execution/scopes.ts +24 -0
  492. package/src/execution/script.ts +27 -0
  493. package/src/execution/types.ts +7 -1
  494. package/src/http/api-routes.ts +26 -1
  495. package/src/index.ts +21 -2
  496. package/src/lineage/executors.ts +3 -1
  497. package/src/materialization/event-envelopes.ts +10 -5
  498. package/src/materialization/events.ts +2 -0
  499. package/src/materialization/model.ts +6 -0
  500. package/src/materializer/README.md +10 -0
  501. package/src/materializer/projections/replace.ts +42 -1
  502. package/src/materializer/projections/replacement-plan.ts +44 -4
  503. package/src/materializer/shared/normalize.ts +4 -0
  504. package/src/models/language-model.ts +6 -0
  505. package/src/models/tools.ts +2 -0
  506. package/src/projections/builders.ts +20 -0
  507. package/src/projections/index.ts +1 -0
  508. package/src/projections/registry.ts +1 -0
  509. package/src/projections/revision.ts +2 -0
  510. package/src/projections/types.ts +11 -0
  511. package/src/projections/validation.ts +6 -0
  512. package/src/queues/in-memory.ts +5 -0
  513. package/src/queues/index.ts +3 -1
  514. package/src/queues/types.ts +45 -14
  515. package/src/runtime/host.ts +112 -4
  516. package/src/runtime/internal.ts +1 -0
  517. package/src/runtime/resolve-definitions.ts +4 -1
  518. package/src/runtime/script.ts +62 -0
  519. package/src/runtime/sixb.ts +3 -3
  520. package/src/schedules/builders.ts +4 -1
  521. package/src/schedules/runtime.ts +3 -0
  522. package/src/schedules/validation.ts +20 -2
  523. package/src/storage/agents/errors.ts +1 -0
  524. package/src/storage/agents/in-memory.ts +229 -1
  525. package/src/storage/agents/index.ts +16 -0
  526. package/src/storage/agents/provider.ts +284 -2
  527. package/src/storage/agents/types.ts +168 -1
  528. package/src/storage/artifacts/in-memory.ts +32 -1
  529. package/src/storage/artifacts/index.ts +2 -0
  530. package/src/storage/artifacts/record.ts +25 -2
  531. package/src/storage/artifacts/types.ts +37 -0
  532. package/src/storage/executions/provider.ts +22 -2
  533. package/src/storage/executions/types.ts +2 -0
  534. package/src/storage/executions/validation.ts +27 -0
  535. package/src/storage/index.ts +18 -0
  536. package/src/storage/internal.ts +1 -0
  537. package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
  538. package/src/storage/ontology/replacement-plans.ts +6 -0
  539. package/src/storage/operation-scope.ts +1 -0
  540. package/src/testing/agent-execution.ts +45 -2
  541. package/src/testing/agent-inbox-storage-contract.ts +815 -0
  542. package/src/testing/agent-storage-contract.ts +103 -0
  543. package/src/testing/artifact-storage-contract.ts +72 -4
  544. package/src/testing/execution-storage-contract.ts +31 -0
  545. package/src/testing/index.ts +5 -0
  546. package/src/testing/materializer-storage-contract.ts +139 -1
  547. package/src/testing/queues-contract.ts +22 -0
  548. package/src/webhooks/connections.ts +9 -50
  549. package/src/webhooks/index.ts +0 -2
  550. package/src/webhooks/types.ts +2 -13
  551. package/src/workers/queued-run-dispatch.ts +8 -1
  552. package/dist/chunk-48c1z8nj.js.map +0 -10
  553. package/dist/chunk-58geavnf.js +0 -29
  554. package/dist/chunk-58geavnf.js.map +0 -10
  555. package/dist/chunk-7z5rkf0m.js.map +0 -13
  556. package/dist/chunk-9nsjjd44.js.map +0 -12
  557. package/dist/chunk-b9qfh2ya.js.map +0 -11
  558. package/dist/chunk-eptrvnby.js.map +0 -12
  559. package/dist/chunk-f6ahf5gf.js.map +0 -13
  560. package/dist/chunk-m2jerfef.js +0 -474
  561. package/dist/chunk-m2jerfef.js.map +0 -11
  562. package/dist/chunk-n4zzaf6q.js.map +0 -10
  563. package/dist/chunk-qds484t8.js.map +0 -18
  564. package/dist/chunk-smnt672s.js.map +0 -10
  565. package/dist/chunk-vzkxqf8h.js.map +0 -23
  566. package/dist/chunk-w9s23r24.js.map +0 -30
  567. package/dist/chunk-wa05txmk.js.map +0 -11
  568. package/dist/chunk-yv8hv4wq.js.map +0 -10
  569. package/dist/chunk-z0t4p2sk.js.map +0 -47
  570. /package/dist/{chunk-tqa68kj7.js.map → chunk-0hkdtwqk.js.map} +0 -0
  571. /package/dist/{chunk-s5n9617r.js.map → chunk-0mvjpgvm.js.map} +0 -0
  572. /package/dist/{chunk-k66rp2hr.js.map → chunk-1yh6jgtz.js.map} +0 -0
  573. /package/dist/{chunk-26qet7wh.js.map → chunk-5t9gm5tt.js.map} +0 -0
  574. /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
  575. /package/dist/{chunk-hkaa807g.js.map → chunk-68hm50qh.js.map} +0 -0
  576. /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
  577. /package/dist/{chunk-m7b9q5dk.js.map → chunk-aw1z0gre.js.map} +0 -0
  578. /package/dist/{chunk-kv0kvknv.js.map → chunk-fzae1jpq.js.map} +0 -0
  579. /package/dist/{chunk-6gtxshcc.js.map → chunk-k29n4176.js.map} +0 -0
  580. /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
  581. /package/dist/{chunk-qafng88v.js.map → chunk-pqvvqc65.js.map} +0 -0
  582. /package/dist/{chunk-8p7bze4c.js.map → chunk-s1mqyqmm.js.map} +0 -0
  583. /package/dist/{chunk-p351afzm.js.map → chunk-s5pj68fa.js.map} +0 -0
  584. /package/dist/{chunk-855w9nvw.js.map → chunk-vehcr9eb.js.map} +0 -0
  585. /package/dist/{chunk-n68vz95m.js.map → chunk-wqe9shx2.js.map} +0 -0
  586. /package/dist/{chunk-0k3r5kb3.js.map → chunk-xcrnrpfh.js.map} +0 -0
  587. /package/dist/{chunk-38yvdqzd.js.map → chunk-zxhym8tr.js.map} +0 -0
@@ -2,7 +2,7 @@ import type { BlobStorage } from "../blob-storage"
2
2
  import type { Broker } from "../broker"
3
3
  import { createSixbError } from "../errors/internal"
4
4
  import type { DomainEventLog } from "../events/service"
5
- import type { AuthorizationRef } from "../execution"
5
+ import type { AuthorizablePrincipal, AuthorizationRef } from "../execution"
6
6
  import {
7
7
  type AgentExecutionHost,
8
8
  bindAgentModelExecution,
@@ -25,6 +25,7 @@ import type { Sixb } from "../runtime/sixb"
25
25
  import type { SecurityDefinitionCatalog } from "../security"
26
26
  import type { Storage } from "../storage"
27
27
  import {
28
+ type AgentInboxItemRecord,
28
29
  type AgentRunRecord,
29
30
  type AgentStorage,
30
31
  AgentStorageError,
@@ -88,6 +89,7 @@ import {
88
89
  readAgentRunContext,
89
90
  readAgentTurnHistory,
90
91
  } from "./run-turn"
92
+ import type { AgentInboxReadMessage } from "./streams"
91
93
  import { subscribeAgentRunCancel } from "./streams/protocol"
92
94
  import { subagentSandboxFiles } from "./subagent-runs"
93
95
  import { conversationThreadId } from "./thread-access"
@@ -127,6 +129,8 @@ export interface AgentRunSession<TRun extends AgentRunRecord = AgentRunRecord> {
127
129
  readonly events: StreamSink
128
130
  /** Approvals that hold the run: they are created by the API its commands call, never here. */
129
131
  readonly heldCalls: AgentRunHeldCalls
132
+ /** Mid-run steers waiting in a conversation turn's inbox. */
133
+ readonly inbox: AgentRunInbox
130
134
  /** A conversation turn's children: spawning them, and reading them and their threads. */
131
135
  readonly children: AgentRunChildren
132
136
  /**
@@ -259,6 +263,18 @@ export interface AgentRunHeldCalls {
259
263
  pausesAfterStep(): Promise<boolean>
260
264
  }
261
265
 
266
+ export interface AgentRunInbox {
267
+ /**
268
+ * Claim unclaimed non-immediate `steer` items of a conversation turn's thread at `stepIndex`:
269
+ * those its requester sent, since the turn runs as them. Answers `[]` on a sub-agent's session,
270
+ * whose parent steers it through `FamilyMailbox`.
271
+ */
272
+ takeSteers(input: {
273
+ readonly stepIndex: number
274
+ readonly afterAnswer?: boolean
275
+ }): Promise<readonly AgentInboxItemRecord[]>
276
+ }
277
+
262
278
  /** How a run ended; the session supplies which run, and its token. */
263
279
  export type AgentRunOutcome = FinishAgentRunInput extends infer Finish
264
280
  ? Finish extends FinishAgentRunInput
@@ -363,6 +379,27 @@ export async function openAgentRunSession<TRun extends AgentRunRecord>(
363
379
  return bound
364
380
  }
365
381
  const runSdk = async () => (await bind()).sixb
382
+
383
+ // Who the turn runs as, read once from its execution, which never changes.
384
+ let requestedBy: Promise<AuthorizablePrincipal | undefined> | undefined
385
+ const requester = () => {
386
+ requestedBy ??= host.storage.executions
387
+ .getById({ projectId: host.projectId, id: run.executionId })
388
+ .then((execution) => {
389
+ if (!execution) {
390
+ throw new Error(
391
+ `[Sixb] Agent run '${run.id}' references missing execution '${run.executionId}'.`
392
+ )
393
+ }
394
+ return execution.requestedBy
395
+ })
396
+ .catch((error: unknown) => {
397
+ requestedBy = undefined
398
+ throw error
399
+ })
400
+ return requestedBy
401
+ }
402
+
366
403
  const cancel = await watchAgentRunCancel(host, [run.id, ...cancelWith])
367
404
  // A cancel recorded on the run reaches a runner the broker's cancel did not: at the claim, and at
368
405
  // each renewal of its lease.
@@ -458,6 +495,35 @@ export async function openAgentRunSession<TRun extends AgentRunRecord>(
458
495
  host.storage.agents.approvals.holdsRun({ projectId: host.projectId, runId: run.id }),
459
496
  pausesAfterStep: () => turnPausesOnHeldCalls(host.storage.agents, run),
460
497
  },
498
+ inbox: {
499
+ async takeSteers({ stepIndex, afterAnswer }) {
500
+ if (run.kind !== "conversation") return []
501
+
502
+ // The turn runs as its requester, so it reads only what they sent: another participant's
503
+ // steer waits for a turn of theirs. A turn nobody requested has no one to steer it.
504
+ const authorPrincipal = await requester()
505
+ if (!authorPrincipal) return []
506
+
507
+ const items = await fenced(run.id, () =>
508
+ agents.inbox.takeSteers({
509
+ projectId: host.projectId,
510
+ threadId: run.threadId,
511
+ runId: run.id,
512
+ executionToken,
513
+ stepIndex,
514
+ ...(afterAnswer ? { afterAnswer: true } : {}),
515
+ authorPrincipal,
516
+ })
517
+ )
518
+
519
+ // Whoever watches sees each message where the turn read it, before the step it answers
520
+ // streams, from what was stored: a runner never says what was sent, or by whom.
521
+ if (items.length > 0) {
522
+ await host.events.publishInboxRead({ run, messages: items.map(inboxReadMessage) })
523
+ }
524
+ return items
525
+ },
526
+ },
461
527
  models: {
462
528
  async language(ref, options) {
463
529
  const key = `${ref.provider}/${ref.modelId}`
@@ -514,6 +580,7 @@ export async function openAgentRunSession<TRun extends AgentRunRecord>(
514
580
  async finish(outcome, messages) {
515
581
  const finished = await finishWithRetries(
516
582
  host.storage,
583
+ run,
517
584
  { ...outcome, ...fence },
518
585
  messages ?? []
519
586
  )
@@ -625,6 +692,13 @@ export async function openAgentRunSession<TRun extends AgentRunRecord>(
625
692
  `[Sixb] Agent run '${run.id}' moves only its own thread's workspace, not '${input.id}'.`
626
693
  )
627
694
  }
695
+ // Recreating or restoring is its owner's choice, never a run's.
696
+ const { action } = input as { readonly action: string }
697
+ if (action !== "acquire" && action !== "replace" && action !== "settle") {
698
+ throw new AgentRunRefusedError(
699
+ `[Sixb] Agent run '${run.id}' cannot ${action} its thread's workspace: only its owner recovers it.`
700
+ )
701
+ }
628
702
  return fenced(run.id, () =>
629
703
  host.storage.agents.threads.transitionSandbox({
630
704
  ...input,
@@ -833,19 +907,27 @@ const FINISH_BACKOFF_MS = [50, 200, 600] as const
833
907
 
834
908
  async function finishWithRetries(
835
909
  storage: AgentRunSessionHost["storage"],
910
+ run: AgentRunRecord,
836
911
  finish: FinishAgentRunInput,
837
912
  messages: readonly AppendAgentMessageInput[]
838
913
  ): Promise<AgentRunRecord> {
839
914
  for (let attempt = 0; ; attempt += 1) {
840
915
  try {
841
- if (messages.length === 0) return await storage.agents.runs.finish(finish)
916
+ if (run.kind !== "conversation" && messages.length === 0) {
917
+ return await storage.agents.runs.finish(finish)
918
+ }
842
919
  return await storage.transaction(async (tx) => {
843
920
  const agents = tx.agents
844
921
  if (!agents) throw new Error("[Sixb] Agent storage is not configured.")
845
- for (const message of messages) await agents.messages.append(message)
922
+ const resolved =
923
+ run.kind === "conversation"
924
+ ? await reconcileClaimedSteers(agents, run, finish.executionToken, messages)
925
+ : messages
926
+ for (const message of resolved) await agents.messages.append(message)
846
927
  return agents.runs.finish(finish)
847
928
  })
848
929
  } catch (error) {
930
+ if (error instanceof AgentRunRefusedError) throw error
849
931
  if (isTerminalOrExecutionGone(error)) throw new AgentExecutionLostError(finish.id)
850
932
  const delay = FINISH_BACKOFF_MS[attempt]
851
933
  if (delay === undefined) throw new AgentFinalizationError(finish.id, { cause: error })
@@ -853,3 +935,60 @@ async function finishWithRetries(
853
935
  }
854
936
  }
855
937
  }
938
+
939
+ async function reconcileClaimedSteers(
940
+ agents: AgentStorage,
941
+ run: ConversationAgentRunRecord,
942
+ executionToken: string,
943
+ messages: readonly AppendAgentMessageInput[]
944
+ ): Promise<readonly AppendAgentMessageInput[]> {
945
+ // A storage without an inbox claims nothing, so every message is the turn's own.
946
+ if (typeof agents.inbox?.consumeClaimed !== "function") return messages
947
+ const userIds = messages.filter((message) => message.role === "user").map((message) => message.id)
948
+ const consumed = await agents.inbox.consumeClaimed({
949
+ projectId: run.projectId,
950
+ threadId: run.threadId,
951
+ runId: run.id,
952
+ executionToken,
953
+ messageIds: userIds,
954
+ })
955
+ const byMessageId = new Map(consumed.map((item) => [item.messageId, item]))
956
+
957
+ return messages.map((message): AppendAgentMessageInput => {
958
+ if (message.role !== "user") return message
959
+ const claimed = byMessageId.get(message.id)
960
+ if (!claimed) {
961
+ throw new AgentRunRefusedError(
962
+ `[Sixb] Agent run '${run.id}' finishes only with user messages from its thread's inbox.`
963
+ )
964
+ }
965
+ const metadata =
966
+ claimed.timeZone || claimed.locale
967
+ ? {
968
+ ...(claimed.timeZone ? { timeZone: claimed.timeZone } : {}),
969
+ ...(claimed.locale ? { locale: claimed.locale } : {}),
970
+ }
971
+ : undefined
972
+ return {
973
+ id: claimed.messageId,
974
+ projectId: claimed.projectId,
975
+ threadId: claimed.threadId,
976
+ runId: null,
977
+ role: "user",
978
+ parts: claimed.parts,
979
+ authorPrincipal: claimed.authorPrincipal,
980
+ createdAt: claimed.createdAt,
981
+ ...(metadata ? { metadata } : {}),
982
+ }
983
+ })
984
+ }
985
+
986
+ /** A message a turn read, as its stream tells whoever watches: the stored item, not the runner. */
987
+ function inboxReadMessage(item: AgentInboxItemRecord): AgentInboxReadMessage {
988
+ return {
989
+ id: item.messageId,
990
+ authorPrincipal: item.authorPrincipal,
991
+ parts: item.parts,
992
+ createdAt: item.createdAt.toISOString(),
993
+ }
994
+ }
@@ -1,4 +1,5 @@
1
1
  import type { Principal, UserPrincipal } from "../auth/types"
2
+ import { isPlainRecord } from "../json"
2
3
  import type {
3
4
  AgentContextCheckpointRecord,
4
5
  AgentMessageRecord,
@@ -280,6 +281,13 @@ async function readSentSettings(
280
281
  const retained = new Set(userMessages.map((message) => message.id))
281
282
  const zones: Record<string, string> = {}
282
283
  const locales: Record<string, string> = {}
284
+ for (const message of userMessages) {
285
+ // A message a turn read mid-run keeps the settings it was rendered with, so a later turn closes
286
+ // it with the same `<sixb_current_time>`.
287
+ const metadata = isPlainRecord(message.metadata) ? message.metadata : undefined
288
+ if (typeof metadata?.timeZone === "string") zones[message.id] = metadata.timeZone
289
+ if (typeof metadata?.locale === "string") locales[message.id] = metadata.locale
290
+ }
283
291
  for (const run of runs) {
284
292
  if (run.kind !== "conversation" || !retained.has(run.triggerMessageId)) continue
285
293
 
@@ -5,6 +5,7 @@ export type {
5
5
  AgentApprovalActivityEvent,
6
6
  AgentCompactionFailureCode,
7
7
  AgentComputerActivityEvent,
8
+ AgentInboxReadMessage,
8
9
  AgentRunActivityEvent,
9
10
  AgentRunControlStreamId,
10
11
  AgentRunFailure,
@@ -1,7 +1,8 @@
1
+ import type { Principal } from "../../auth"
1
2
  import type { Broker, BrokerStreamDefinition } from "../../broker"
2
3
  import { parseSixbFailure } from "../../errors/internal"
3
4
  import type { SixbFailure } from "../../errors/types"
4
- import { isPlainRecord, type JsonValue } from "../../json"
5
+ import { isJsonValue, isPlainRecord, type JsonValue } from "../../json"
5
6
  import { isModelUiChunk, type ModelUiChunk } from "../../models/events"
6
7
  import {
7
8
  AGENT_APPROVAL_STATUSES,
@@ -13,6 +14,7 @@ import {
13
14
  type AgentRunRecord,
14
15
  type ConversationAgentRunRecord,
15
16
  } from "../../storage/agents/types"
17
+ import type { AgentMessagePart } from "../message"
16
18
 
17
19
  export const AGENT_RUN_STREAM_SCHEMA_VERSION = 1 as const
18
20
  export const DEFAULT_AGENT_RUN_STREAM_RETENTION = {
@@ -422,6 +424,18 @@ export const AGENT_COMPACTION_FAILURE_CODES = [
422
424
  ] as const
423
425
  export type AgentCompactionFailureCode = (typeof AGENT_COMPACTION_FAILURE_CODES)[number]
424
426
 
427
+ /**
428
+ * A message a turn read from its thread's inbox as it answered. The conversation holds it as a user
429
+ * message, with this id, where the turn read it: after what the run streamed before this record.
430
+ */
431
+ export interface AgentInboxReadMessage {
432
+ /** The id the message is saved with once the turn ends. */
433
+ readonly id: string
434
+ readonly authorPrincipal: Principal
435
+ readonly parts: readonly AgentMessagePart[]
436
+ readonly createdAt: string
437
+ }
438
+
425
439
  export type AgentRunStreamEvent =
426
440
  | (AgentRunStreamEventBase & {
427
441
  readonly type: "agent.run.started"
@@ -449,6 +463,10 @@ export type AgentRunStreamEvent =
449
463
  readonly chunkIndex: number
450
464
  readonly chunk: ModelUiChunk
451
465
  })
466
+ | (AgentRunStreamEventBase & {
467
+ readonly type: "agent.inbox.read"
468
+ readonly messages: readonly AgentInboxReadMessage[]
469
+ })
452
470
  | (AgentRunStreamEventBase & {
453
471
  readonly type: "agent.message.finalized"
454
472
  readonly messageId: string
@@ -546,6 +564,12 @@ export function isAgentRunStreamEvent(value: unknown): value is AgentRunStreamEv
546
564
  case "agent.ui.chunk":
547
565
  // A chunk type this reader does not know fails here, so a newer producer's chunk is skipped.
548
566
  return Number.isInteger(value.chunkIndex) && isModelUiChunk(value.chunk)
567
+ case "agent.inbox.read":
568
+ return (
569
+ Array.isArray(value.messages) &&
570
+ value.messages.length > 0 &&
571
+ value.messages.every(isAgentInboxReadMessage)
572
+ )
549
573
  case "agent.message.finalized":
550
574
  return typeof value.messageId === "string"
551
575
  case "agent.run.finished":
@@ -559,6 +583,20 @@ export function isAgentRunStreamEvent(value: unknown): value is AgentRunStreamEv
559
583
  }
560
584
  }
561
585
 
586
+ function isAgentInboxReadMessage(value: unknown): value is AgentInboxReadMessage {
587
+ return (
588
+ isPlainRecord(value) &&
589
+ typeof value.id === "string" &&
590
+ isPlainRecord(value.authorPrincipal) &&
591
+ typeof value.authorPrincipal.type === "string" &&
592
+ typeof value.authorPrincipal.id === "string" &&
593
+ Array.isArray(value.parts) &&
594
+ value.parts.every((part) => isPlainRecord(part) && typeof part.type === "string") &&
595
+ isJsonValue(value.parts) &&
596
+ typeof value.createdAt === "string"
597
+ )
598
+ }
599
+
562
600
  function isAgentContextCheckpointReason(value: unknown): value is AgentContextCheckpointReason {
563
601
  return value === "threshold" || value === "overflow"
564
602
  }
@@ -598,6 +636,8 @@ export function agentRunStreamIdempotencyKey(event: AgentRunStreamEvent): string
598
636
  return `${event.runId}:${event.attempt}:compaction:${event.reason}:failed:${event.errorCode}`
599
637
  case "agent.ui.chunk":
600
638
  return `${event.runId}:${event.attempt}:chunk:${event.chunkIndex}`
639
+ case "agent.inbox.read":
640
+ return `${event.runId}:${event.attempt}:inbox:${event.messages.map((message) => message.id).join(",")}:read`
601
641
  case "agent.message.finalized":
602
642
  return `${event.runId}:${event.attempt}:message:${event.messageId}:finalized`
603
643
  case "agent.run.finished":
@@ -14,7 +14,7 @@ import type { AgentToolFilePutInput } from "./types"
14
14
 
15
15
  /** Where a run's sandbox keeps its files, relative to its working directory. */
16
16
  export const SANDBOX_CONTEXT_DIRECTORY = ".sixb/agent"
17
- /** The most a file a tool stores, or one `view_file` reads, may hold: an artifact's file limit. */
17
+ /** The most a file a tool stores, or one `read` shows as itself, may hold: an artifact's file limit. */
18
18
  export const AGENT_FILE_MAX_BYTES = ARTIFACT_LIMITS.maxFileBytes
19
19
  const MAX_FILE_NAME_BYTES = 255
20
20
  const MAX_MEDIA_TYPE_LENGTH = 255
@@ -0,0 +1,140 @@
1
+ import type { JsonObject, JsonValue } from "../json"
2
+
3
+ /**
4
+ * A tool call's arguments as its schema reads them, before the tool's own `parseInput`: the slips
5
+ * models make most, fixed where the schema leaves one reading.
6
+ *
7
+ * ```text
8
+ * null for an optional property that does not allow null left out
9
+ * "42" for a number or an integer, when it fits exactly 42
10
+ * "true" / "false" for a boolean true / false
11
+ * an array as JSON text the array
12
+ * one value for an array [value]
13
+ * ```
14
+ *
15
+ * The `null` is also what a provider's strict mode sends for "nothing" once an adapter rewrites an
16
+ * optional property as required and nullable, so a tool never sees it. Everything else reaches
17
+ * `parseInput` as the model sent it, and a refusal goes back to the model. The call's stored input
18
+ * stays what the model sent, so history replays byte for byte.
19
+ */
20
+ export function coerceToolInput(schema: JsonObject, input: unknown): unknown {
21
+ return coerce(schema, input)
22
+ }
23
+
24
+ function coerce(schema: JsonValue | undefined, value: unknown): unknown {
25
+ if (!isObject(schema)) return value
26
+ const types = schemaTypes(schema)
27
+ if (types.length === 0 || types.some((type) => hasType(value, type))) {
28
+ return coerceInside(schema, value)
29
+ }
30
+
31
+ if (typeof value === "string") {
32
+ const text = value.trim()
33
+ // An integer past what a number holds exactly would change: an id would name its neighbour.
34
+ if (types.includes("integer") && /^-?\d+$/.test(text) && Number.isSafeInteger(Number(text))) {
35
+ return Number(text)
36
+ }
37
+ if (
38
+ types.includes("number") &&
39
+ /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(text) &&
40
+ Number.isFinite(Number(text))
41
+ ) {
42
+ return Number(text)
43
+ }
44
+ if (types.includes("boolean") && (text === "true" || text === "false")) return text === "true"
45
+ if (types.includes("array") && text.startsWith("[")) {
46
+ const parsed = parseJson(text)
47
+ if (Array.isArray(parsed)) return coerceInside(schema, parsed)
48
+ }
49
+ }
50
+ if (types.includes("array") && value !== null && value !== undefined && !Array.isArray(value)) {
51
+ return [coerce(schema.items, value)]
52
+ }
53
+ return value
54
+ }
55
+
56
+ function parseJson(text: string): unknown {
57
+ try {
58
+ return JSON.parse(text)
59
+ } catch {
60
+ return undefined
61
+ }
62
+ }
63
+
64
+ function coerceInside(schema: JsonObject, value: unknown): unknown {
65
+ if (Array.isArray(value)) {
66
+ return isObject(schema.items) ? value.map((item) => coerce(schema.items, item)) : value
67
+ }
68
+ if (!isPlainObject(value) || !isObject(schema.properties)) return value
69
+
70
+ const properties = schema.properties
71
+ const required = new Set(Array.isArray(schema.required) ? schema.required : [])
72
+ const result: Record<string, unknown> = {}
73
+ for (const [key, item] of Object.entries(value)) {
74
+ const property = Object.hasOwn(properties, key) ? properties[key] : undefined
75
+ if (item === null && property !== undefined && !required.has(key) && !allowsNull(property)) {
76
+ continue
77
+ }
78
+ result[key] = property === undefined ? item : coerce(property, item)
79
+ }
80
+ return result
81
+ }
82
+
83
+ /** The schema's own `type`s; a union (`anyOf`, `oneOf`) is read as it is, never coerced into. */
84
+ function schemaTypes(schema: JsonObject): readonly string[] {
85
+ if (typeof schema.type === "string") return [schema.type]
86
+ if (Array.isArray(schema.type)) {
87
+ return schema.type.filter((type): type is string => typeof type === "string")
88
+ }
89
+ return []
90
+ }
91
+
92
+ function allowsNull(schema: JsonValue): boolean {
93
+ if (schema === true) return true
94
+ if (!isObject(schema)) return false
95
+ if (schemaTypes(schema).includes("null")) return true
96
+ if (schema.const === null || (Array.isArray(schema.enum) && schema.enum.includes(null))) {
97
+ return true
98
+ }
99
+ for (const key of ["anyOf", "oneOf"] as const) {
100
+ const variants = schema[key]
101
+ if (Array.isArray(variants) && variants.some(allowsNull)) return true
102
+ }
103
+ // Nothing that narrows it: any value, null included.
104
+ return (
105
+ schemaTypes(schema).length === 0 &&
106
+ schema.anyOf === undefined &&
107
+ schema.oneOf === undefined &&
108
+ schema.enum === undefined &&
109
+ schema.const === undefined
110
+ )
111
+ }
112
+
113
+ function hasType(value: unknown, type: string): boolean {
114
+ switch (type) {
115
+ case "null":
116
+ return value === null
117
+ case "string":
118
+ return typeof value === "string"
119
+ case "boolean":
120
+ return typeof value === "boolean"
121
+ case "number":
122
+ return typeof value === "number"
123
+ case "integer":
124
+ return Number.isInteger(value)
125
+ case "array":
126
+ return Array.isArray(value)
127
+ case "object":
128
+ return isPlainObject(value)
129
+ default:
130
+ return true
131
+ }
132
+ }
133
+
134
+ function isObject(value: JsonValue | undefined): value is JsonObject {
135
+ return typeof value === "object" && value !== null && !Array.isArray(value)
136
+ }
137
+
138
+ function isPlainObject(value: unknown): value is Record<string, unknown> {
139
+ return typeof value === "object" && value !== null && !Array.isArray(value)
140
+ }
@@ -0,0 +1,31 @@
1
+ import { isJsonObject } from "../json"
2
+ import type { AgentRunRecord, AgentStorage } from "../storage/agents"
3
+
4
+ /**
5
+ * Whether the turn answered: it succeeded without asking a question the requester answers next.
6
+ * Only after one does a message queued for later start; after any other end, only one sent now.
7
+ */
8
+ export async function turnAnsweredEveryMessage(
9
+ agents: AgentStorage,
10
+ run: AgentRunRecord
11
+ ): Promise<boolean> {
12
+ if (run.status !== "succeeded") return false
13
+ const { messages } = await agents.messages.list({
14
+ projectId: run.projectId,
15
+ threadId: run.threadId,
16
+ roles: ["assistant"],
17
+ order: "desc",
18
+ limit: 1,
19
+ })
20
+ const answer = messages[0]
21
+ if (!answer || answer.runId !== run.id) return true
22
+ // `ask` answers `{ status: "asked" }`: the requester's next message is their answer, so a message
23
+ // they queued instead is not one.
24
+ return !answer.parts.some(
25
+ (part) =>
26
+ part.type === "tool-call" &&
27
+ part.state === "output-available" &&
28
+ isJsonObject(part.output) &&
29
+ part.output.status === "asked"
30
+ )
31
+ }
@@ -10,18 +10,28 @@ import { AGENT_WEB_TOOL_NAMES } from "./web"
10
10
  const AGENT_TOOL_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/
11
11
  export const AGENT_RESERVED_TOOL_NAMES = [
12
12
  "bash",
13
+ "wait",
14
+ "stop",
15
+ // What `wait` and `stop` were called for a background command: earlier threads hold calls to them.
13
16
  "bash_output",
14
17
  "bash_stop",
15
18
  "read",
19
+ "edit",
20
+ "write",
21
+ "glob",
22
+ "grep",
16
23
  "view_file",
17
24
  "spawn_agent",
18
- "wait_agent",
19
25
  "message_agent",
26
+ // What `wait` was called for sub-agents: earlier threads hold calls to it.
27
+ "wait_agent",
28
+ "ask",
29
+ // What `ask` was called for a sub-agent: earlier threads hold calls to it.
20
30
  "ask_parent",
21
31
  "publish_artifact",
22
- "update_artifact",
23
32
  "open_artifact",
24
- // What `update_artifact` was called: earlier threads hold calls to it.
33
+ // What `publish_artifact` with an id was called: earlier threads hold calls to them.
34
+ "update_artifact",
25
35
  "publish_artifact_version",
26
36
  ...AGENT_WEB_TOOL_NAMES,
27
37
  ] as const
@@ -34,16 +34,14 @@ export function canvasShapeFontSize(width: number, height: number): number {
34
34
  export const SMALL_BOARD_PREVIEW_WIDTH = 480
35
35
 
36
36
  /**
37
- * How the agent worker renders the previews nobody else rendered: `settleMs` after the last write
38
- * that asked, or `graceMs` when the publisher renders its own, as the Agent's layout check does
39
- * within its 120 seconds; each attempt within `timeoutMs`, up to `attempts`, `backoffMs` apart.
37
+ * How the render worker renders a canvas's missing previews: `settleMs` after the last write that
38
+ * asked; each attempt within `timeoutMs`, up to `attempts`, `backoffMs` apart.
40
39
  *
41
40
  * `settleMs` is longer than a live canvas waits between two write-backs (`SAVE_MAX_MS` in the
42
41
  * server's live rooms), so someone typing in a board is rendered once they pause.
43
42
  */
44
43
  export const BOARD_PREVIEW_JOB = {
45
44
  settleMs: 15_000,
46
- graceMs: 180_000,
47
45
  timeoutMs: 5 * 60_000,
48
46
  attempts: 3,
49
47
  backoffMs: 60_000,
@@ -51,11 +49,11 @@ export const BOARD_PREVIEW_JOB = {
51
49
 
52
50
  /**
53
51
  * How long after a canvas version is published a missing board preview is still worth waiting
54
- * for: the job's grace, then every one of its attempts and the waits between them. Past it,
52
+ * for: the job's settling, then every one of its attempts and the waits between them. Past it,
55
53
  * nothing more will come, so the server says so and a viewer stops asking.
56
54
  */
57
55
  export const BOARD_PREVIEW_WAIT_MS =
58
- BOARD_PREVIEW_JOB.graceMs +
56
+ BOARD_PREVIEW_JOB.settleMs +
59
57
  BOARD_PREVIEW_JOB.attempts * BOARD_PREVIEW_JOB.timeoutMs +
60
58
  (BOARD_PREVIEW_JOB.attempts - 1) * BOARD_PREVIEW_JOB.backoffMs
61
59