@sixb/core 0.2.1 → 0.2.3

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 (1247) hide show
  1. package/dist/actions/index.js +60 -54
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/request.d.ts.map +1 -1
  4. package/dist/actions/run/executor.d.ts +0 -2
  5. package/dist/actions/run/executor.d.ts.map +1 -1
  6. package/dist/actions/types/context.d.ts +5 -1
  7. package/dist/actions/types/context.d.ts.map +1 -1
  8. package/dist/agents/cancel.d.ts.map +1 -1
  9. package/dist/agents/execution.d.ts +2 -1
  10. package/dist/agents/execution.d.ts.map +1 -1
  11. package/dist/agents/fork.d.ts.map +1 -1
  12. package/dist/agents/index.d.ts +6 -4
  13. package/dist/agents/index.d.ts.map +1 -1
  14. package/dist/agents/index.js +95 -82
  15. package/dist/agents/index.js.map +1 -1
  16. package/dist/agents/request.d.ts +7 -1
  17. package/dist/agents/request.d.ts.map +1 -1
  18. package/dist/agents/run-artifacts.d.ts +73 -10
  19. package/dist/agents/run-artifacts.d.ts.map +1 -1
  20. package/dist/agents/run-plan.d.ts +15 -1
  21. package/dist/agents/run-plan.d.ts.map +1 -1
  22. package/dist/agents/run-session-http.d.ts.map +1 -1
  23. package/dist/agents/run-session-serve.d.ts.map +1 -1
  24. package/dist/agents/run-session.d.ts +17 -2
  25. package/dist/agents/run-session.d.ts.map +1 -1
  26. package/dist/agents/skills.d.ts +3 -0
  27. package/dist/agents/skills.d.ts.map +1 -1
  28. package/dist/agents/step-limits.d.ts +6 -0
  29. package/dist/agents/step-limits.d.ts.map +1 -1
  30. package/dist/agents/streams/index.js +2 -2
  31. package/dist/agents/streams/internal.js +2 -2
  32. package/dist/agents/streams/protocol.d.ts +8 -2
  33. package/dist/agents/streams/protocol.d.ts.map +1 -1
  34. package/dist/agents/tool-files.d.ts +3 -1
  35. package/dist/agents/tool-files.d.ts.map +1 -1
  36. package/dist/agents/validation.d.ts +1 -1
  37. package/dist/agents/validation.d.ts.map +1 -1
  38. package/dist/agents/web.d.ts +47 -0
  39. package/dist/agents/web.d.ts.map +1 -0
  40. package/dist/artifacts/access.d.ts +37 -17
  41. package/dist/artifacts/access.d.ts.map +1 -1
  42. package/dist/artifacts/canvas-display.d.ts +65 -0
  43. package/dist/artifacts/canvas-display.d.ts.map +1 -0
  44. package/dist/artifacts/canvas.d.ts +6 -1
  45. package/dist/artifacts/canvas.d.ts.map +1 -1
  46. package/dist/artifacts/comment-text.d.ts +19 -0
  47. package/dist/artifacts/comment-text.d.ts.map +1 -0
  48. package/dist/artifacts/comments.d.ts +52 -0
  49. package/dist/artifacts/comments.d.ts.map +1 -0
  50. package/dist/artifacts/errors.d.ts +3 -3
  51. package/dist/artifacts/errors.d.ts.map +1 -1
  52. package/dist/artifacts/events.d.ts +14 -0
  53. package/dist/artifacts/events.d.ts.map +1 -0
  54. package/dist/artifacts/execution.d.ts +129 -22
  55. package/dist/artifacts/execution.d.ts.map +1 -1
  56. package/dist/artifacts/frames/assets.d.ts +12 -1
  57. package/dist/artifacts/frames/assets.d.ts.map +1 -1
  58. package/dist/artifacts/frames/grants.d.ts +8 -5
  59. package/dist/artifacts/frames/grants.d.ts.map +1 -1
  60. package/dist/artifacts/frames/index.d.ts +1 -1
  61. package/dist/artifacts/frames/index.d.ts.map +1 -1
  62. package/dist/artifacts/frames/index.js +32 -964
  63. package/dist/artifacts/frames/index.js.map +4 -8
  64. package/dist/artifacts/frames/kit.d.ts.map +1 -1
  65. package/dist/artifacts/frames/protocol.d.ts +78 -0
  66. package/dist/artifacts/frames/protocol.d.ts.map +1 -1
  67. package/dist/artifacts/frames/runtime.d.ts +17 -7
  68. package/dist/artifacts/frames/runtime.d.ts.map +1 -1
  69. package/dist/artifacts/holders.d.ts +23 -0
  70. package/dist/artifacts/holders.d.ts.map +1 -0
  71. package/dist/artifacts/ids.d.ts +2 -0
  72. package/dist/artifacts/ids.d.ts.map +1 -1
  73. package/dist/artifacts/index.d.ts +6 -4
  74. package/dist/artifacts/index.d.ts.map +1 -1
  75. package/dist/artifacts/index.js +108 -13
  76. package/dist/artifacts/index.js.map +5 -4
  77. package/dist/artifacts/limits.d.ts +24 -3
  78. package/dist/artifacts/limits.d.ts.map +1 -1
  79. package/dist/artifacts/live/board.d.ts +103 -0
  80. package/dist/artifacts/live/board.d.ts.map +1 -0
  81. package/dist/artifacts/live/diff.d.ts +43 -0
  82. package/dist/artifacts/live/diff.d.ts.map +1 -0
  83. package/dist/artifacts/live/document.d.ts +55 -0
  84. package/dist/artifacts/live/document.d.ts.map +1 -0
  85. package/dist/artifacts/live/files.d.ts +16 -0
  86. package/dist/artifacts/live/files.d.ts.map +1 -0
  87. package/dist/artifacts/live/index.d.ts +9 -0
  88. package/dist/artifacts/live/index.d.ts.map +1 -0
  89. package/dist/artifacts/live/index.js +593 -0
  90. package/dist/artifacts/live/index.js.map +10 -0
  91. package/dist/artifacts/live/presence.d.ts +55 -0
  92. package/dist/artifacts/live/presence.d.ts.map +1 -0
  93. package/dist/artifacts/live/protocol.d.ts +109 -0
  94. package/dist/artifacts/live/protocol.d.ts.map +1 -0
  95. package/dist/artifacts/live/protocol.js +21 -0
  96. package/dist/artifacts/live/protocol.js.map +9 -0
  97. package/dist/artifacts/live/server.d.ts +10 -0
  98. package/dist/artifacts/live/server.d.ts.map +1 -0
  99. package/dist/artifacts/live/server.js +86 -0
  100. package/dist/artifacts/live/server.js.map +9 -0
  101. package/dist/artifacts/live/state.d.ts +26 -0
  102. package/dist/artifacts/live/state.d.ts.map +1 -0
  103. package/dist/artifacts/outline.d.ts +11 -0
  104. package/dist/artifacts/outline.d.ts.map +1 -1
  105. package/dist/artifacts/publish/index.d.ts +8 -1
  106. package/dist/artifacts/publish/index.d.ts.map +1 -1
  107. package/dist/artifacts/publish/index.js +67 -39
  108. package/dist/artifacts/publish/index.js.map +1 -1
  109. package/dist/artifacts/publish/merge.d.ts +75 -0
  110. package/dist/artifacts/publish/merge.d.ts.map +1 -0
  111. package/dist/artifacts/publish/previews.d.ts +153 -0
  112. package/dist/artifacts/publish/previews.d.ts.map +1 -0
  113. package/dist/artifacts/publish/publish.d.ts +29 -8
  114. package/dist/artifacts/publish/publish.d.ts.map +1 -1
  115. package/dist/artifacts/publish/query-answers.d.ts +20 -0
  116. package/dist/artifacts/publish/query-answers.d.ts.map +1 -0
  117. package/dist/artifacts/publish/references.d.ts +4 -3
  118. package/dist/artifacts/publish/references.d.ts.map +1 -1
  119. package/dist/artifacts/publish/validate/canvas.d.ts.map +1 -1
  120. package/dist/artifacts/theme.d.ts +5 -1
  121. package/dist/artifacts/theme.d.ts.map +1 -1
  122. package/dist/auth/directory.d.ts +33 -0
  123. package/dist/auth/directory.d.ts.map +1 -0
  124. package/dist/auth/index.js +13 -12
  125. package/dist/auth/index.js.map +1 -1
  126. package/dist/auth/member-events.d.ts +5 -1
  127. package/dist/auth/member-events.d.ts.map +1 -1
  128. package/dist/auth/runtime.d.ts +22 -1
  129. package/dist/auth/runtime.d.ts.map +1 -1
  130. package/dist/auth/strategy.d.ts +2 -2
  131. package/dist/auth/strategy.d.ts.map +1 -1
  132. package/dist/auth/types.d.ts +42 -1
  133. package/dist/auth/types.d.ts.map +1 -1
  134. package/dist/authorization/decision.d.ts +6 -5
  135. package/dist/authorization/decision.d.ts.map +1 -1
  136. package/dist/authorization/event-visibility.d.ts.map +1 -1
  137. package/dist/authorization/index.js +7 -6
  138. package/dist/authorization/index.js.map +1 -1
  139. package/dist/authorization/resolve.d.ts +4 -3
  140. package/dist/authorization/resolve.d.ts.map +1 -1
  141. package/dist/authorization/types.d.ts +5 -5
  142. package/dist/authorization/types.d.ts.map +1 -1
  143. package/dist/blob-storage/index.js +4 -4
  144. package/dist/blob-storage/index.js.map +1 -1
  145. package/dist/bootstrap/index.js +70 -64
  146. package/dist/bootstrap/index.js.map +2 -2
  147. package/dist/broker/in-memory.d.ts.map +1 -1
  148. package/dist/broker/index.js +1 -1
  149. package/dist/broker/types.d.ts +4 -0
  150. package/dist/broker/types.d.ts.map +1 -1
  151. package/dist/{chunk-3x3bebz7.js → chunk-0k3r5kb3.js} +414 -101
  152. package/dist/chunk-0k3r5kb3.js.map +51 -0
  153. package/dist/{chunk-e5wf5vz0.js → chunk-0kgrghqx.js} +13 -1
  154. package/dist/chunk-0kgrghqx.js.map +10 -0
  155. package/dist/{chunk-2pk5hjj9.js → chunk-186k5yz3.js} +1 -1
  156. package/dist/chunk-191jz8a6.js +61 -0
  157. package/dist/chunk-191jz8a6.js.map +10 -0
  158. package/dist/{chunk-mmagke4x.js → chunk-22d3qg4x.js} +2 -2
  159. package/dist/{chunk-mmagke4x.js.map → chunk-22d3qg4x.js.map} +3 -3
  160. package/dist/{chunk-8yzhjawq.js → chunk-26qet7wh.js} +64 -23
  161. package/dist/{chunk-8yzhjawq.js.map → chunk-26qet7wh.js.map} +5 -5
  162. package/dist/{chunk-cb21tx14.js → chunk-2by73sm2.js} +1055 -201
  163. package/dist/chunk-2by73sm2.js.map +75 -0
  164. package/dist/chunk-2c4j899j.js.map +2 -2
  165. package/dist/{chunk-e6xgz4h4.js → chunk-3014rfjz.js} +197 -18
  166. package/dist/chunk-3014rfjz.js.map +21 -0
  167. package/dist/{chunk-nghc7eq0.js → chunk-3723kgba.js} +1 -1
  168. package/dist/chunk-38yvdqzd.js +70 -0
  169. package/dist/chunk-38yvdqzd.js.map +10 -0
  170. package/dist/{chunk-ytzcxtpt.js → chunk-3ba89vm7.js} +1 -1
  171. package/dist/chunk-3hzhcfsv.js +139 -0
  172. package/dist/chunk-3hzhcfsv.js.map +10 -0
  173. package/dist/chunk-3sgvd10b.js +69 -0
  174. package/dist/chunk-3sgvd10b.js.map +10 -0
  175. package/dist/{chunk-djs3hw9p.js → chunk-3zagkr6w.js} +73 -6
  176. package/dist/chunk-3zagkr6w.js.map +21 -0
  177. package/dist/{chunk-fg1db9xx.js → chunk-48c1z8nj.js} +10 -10
  178. package/dist/chunk-48c1z8nj.js.map +10 -0
  179. package/dist/{chunk-rjeeyssy.js → chunk-4j0sagwv.js} +134 -19
  180. package/dist/{chunk-rjeeyssy.js.map → chunk-4j0sagwv.js.map} +11 -10
  181. package/dist/{chunk-qsg8rw04.js → chunk-5qqmndhm.js} +2 -2
  182. package/dist/{chunk-scyq22td.js → chunk-5rqqp8cr.js} +19 -4
  183. package/dist/chunk-5rqqp8cr.js.map +12 -0
  184. package/dist/{chunk-ax10ft8d.js → chunk-6gtxshcc.js} +6 -6
  185. package/dist/{chunk-ax10ft8d.js.map → chunk-6gtxshcc.js.map} +1 -1
  186. package/dist/{chunk-jspskey0.js → chunk-7j4yydm2.js} +67 -45
  187. package/dist/chunk-7j4yydm2.js.map +11 -0
  188. package/dist/{chunk-8wsjr52f.js → chunk-7qe46788.js} +1 -1
  189. package/dist/{chunk-edx8xcsm.js → chunk-7z5rkf0m.js} +29 -6
  190. package/dist/chunk-7z5rkf0m.js.map +13 -0
  191. package/dist/{chunk-23s66j86.js → chunk-855w9nvw.js} +1 -1
  192. package/dist/{chunk-e7v3trpz.js → chunk-8a8k38tz.js} +4 -3
  193. package/dist/chunk-8a8k38tz.js.map +10 -0
  194. package/dist/{chunk-tvbmh7tj.js → chunk-8p7bze4c.js} +14 -10
  195. package/dist/chunk-8p7bze4c.js.map +18 -0
  196. package/dist/{chunk-jftd33rc.js → chunk-8t2ynwg0.js} +105 -9
  197. package/dist/chunk-8t2ynwg0.js.map +11 -0
  198. package/dist/{chunk-qbrmpgvv.js → chunk-8tqnsx3q.js} +1 -1
  199. package/dist/{chunk-s3we74h8.js → chunk-9nsjjd44.js} +38 -5
  200. package/dist/chunk-9nsjjd44.js.map +12 -0
  201. package/dist/{chunk-hz5d43gn.js → chunk-9vsc919v.js} +14 -6
  202. package/dist/chunk-9vsc919v.js.map +10 -0
  203. package/dist/{chunk-waqk73p1.js → chunk-a6fjkcne.js} +185 -341
  204. package/dist/{chunk-waqk73p1.js.map → chunk-a6fjkcne.js.map} +6 -7
  205. package/dist/{chunk-tvefbgvw.js → chunk-az95tsh3.js} +4 -2
  206. package/dist/chunk-az95tsh3.js.map +11 -0
  207. package/dist/{chunk-s038wa5v.js → chunk-b9qfh2ya.js} +1 -1
  208. package/dist/{chunk-5taem5aw.js → chunk-bc3y6gff.js} +13 -4
  209. package/dist/chunk-bc3y6gff.js.map +10 -0
  210. package/dist/{chunk-ks87m383.js → chunk-bkmnd7zq.js} +556 -262
  211. package/dist/chunk-bkmnd7zq.js.map +49 -0
  212. package/dist/chunk-bz5bnjjt.js +358 -0
  213. package/dist/chunk-bz5bnjjt.js.map +12 -0
  214. package/dist/{chunk-7hd2ez3q.js → chunk-c4nrycdy.js} +1 -1
  215. package/dist/{chunk-w976a4me.js → chunk-czct88ht.js} +28 -4
  216. package/dist/chunk-czct88ht.js.map +10 -0
  217. package/dist/{chunk-5kyvrtjh.js → chunk-d9xbwh3h.js} +131 -32
  218. package/dist/chunk-d9xbwh3h.js.map +13 -0
  219. package/dist/{chunk-kfee1h52.js → chunk-dfveegqq.js} +28 -8
  220. package/dist/chunk-dfveegqq.js.map +13 -0
  221. package/dist/{chunk-2g0r46hy.js → chunk-dhkc9b23.js} +15 -2
  222. package/dist/chunk-dhkc9b23.js.map +12 -0
  223. package/dist/chunk-dmnd9ea6.js +106 -0
  224. package/dist/chunk-dmnd9ea6.js.map +10 -0
  225. package/dist/{chunk-nz7815t3.js → chunk-e0hnbb1m.js} +27 -2
  226. package/dist/chunk-e0hnbb1m.js.map +14 -0
  227. package/dist/chunk-e91fmg6t.js +288 -0
  228. package/dist/chunk-e91fmg6t.js.map +11 -0
  229. package/dist/{chunk-z3evap21.js → chunk-e9w4mgdh.js} +314 -225
  230. package/dist/{chunk-z3evap21.js.map → chunk-e9w4mgdh.js.map} +22 -20
  231. package/dist/{chunk-w122ymx4.js → chunk-f6ahf5gf.js} +15 -4
  232. package/dist/{chunk-w122ymx4.js.map → chunk-f6ahf5gf.js.map} +3 -3
  233. package/dist/{chunk-jjmggm9a.js → chunk-fe6r7yhg.js} +1 -1
  234. package/dist/{chunk-165c9wm6.js → chunk-g2ph4873.js} +1 -1
  235. package/dist/chunk-hgj98cbb.js +22 -0
  236. package/dist/chunk-hgj98cbb.js.map +10 -0
  237. package/dist/{chunk-nqnfz3jg.js → chunk-hkaa807g.js} +18 -7
  238. package/dist/{chunk-nqnfz3jg.js.map → chunk-hkaa807g.js.map} +3 -3
  239. package/dist/chunk-hn2r7z41.js.map +3 -3
  240. package/dist/chunk-j0wgh8gv.js +250 -0
  241. package/dist/chunk-j0wgh8gv.js.map +10 -0
  242. package/dist/{chunk-z8fx5cgb.js → chunk-j2zm215x.js} +37 -3
  243. package/dist/chunk-j2zm215x.js.map +12 -0
  244. package/dist/{chunk-j1ny5fwh.js → chunk-k1g14kk3.js} +11 -83
  245. package/dist/{chunk-j1ny5fwh.js.map → chunk-k1g14kk3.js.map} +4 -5
  246. package/dist/{chunk-b7a97n8b.js → chunk-k66rp2hr.js} +7 -7
  247. package/dist/{chunk-b7a97n8b.js.map → chunk-k66rp2hr.js.map} +2 -2
  248. package/dist/chunk-kr6dx38r.js +25 -0
  249. package/dist/chunk-kr6dx38r.js.map +10 -0
  250. package/dist/{chunk-w53trr0c.js → chunk-kv0kvknv.js} +14 -14
  251. package/dist/{chunk-w53trr0c.js.map → chunk-kv0kvknv.js.map} +1 -1
  252. package/dist/chunk-m2jerfef.js +474 -0
  253. package/dist/chunk-m2jerfef.js.map +11 -0
  254. package/dist/chunk-m7b9q5dk.js +234 -0
  255. package/dist/chunk-m7b9q5dk.js.map +12 -0
  256. package/dist/{chunk-escedwyt.js → chunk-mvz89age.js} +6 -1
  257. package/dist/{chunk-escedwyt.js.map → chunk-mvz89age.js.map} +3 -3
  258. package/dist/chunk-mwcqz3e3.js +30 -0
  259. package/dist/chunk-mwcqz3e3.js.map +10 -0
  260. package/dist/chunk-n2ay51px.js +21 -0
  261. package/dist/chunk-n2ay51px.js.map +10 -0
  262. package/dist/{chunk-jk97v21j.js → chunk-n4zzaf6q.js} +3 -2
  263. package/dist/chunk-n4zzaf6q.js.map +10 -0
  264. package/dist/{chunk-cgznz22f.js → chunk-n68vz95m.js} +5 -5
  265. package/dist/{chunk-cgznz22f.js.map → chunk-n68vz95m.js.map} +3 -3
  266. package/dist/{chunk-neftrg0n.js → chunk-p351afzm.js} +14 -14
  267. package/dist/{chunk-neftrg0n.js.map → chunk-p351afzm.js.map} +4 -4
  268. package/dist/chunk-pk539cwv.js +370 -0
  269. package/dist/chunk-pk539cwv.js.map +11 -0
  270. package/dist/{chunk-jbw70d6t.js → chunk-ppxf7gw2.js} +52 -10
  271. package/dist/chunk-ppxf7gw2.js.map +11 -0
  272. package/dist/{chunk-9x8dybsb.js → chunk-pvpq483h.js} +10 -2
  273. package/dist/chunk-pvpq483h.js.map +10 -0
  274. package/dist/{chunk-jhbk10wf.js → chunk-q9nkpr8k.js} +1 -1
  275. package/dist/chunk-qafng88v.js +225 -0
  276. package/dist/chunk-qafng88v.js.map +11 -0
  277. package/dist/chunk-qds484t8.js +1363 -0
  278. package/dist/chunk-qds484t8.js.map +18 -0
  279. package/dist/{chunk-47e09r7z.js → chunk-qttqe1ah.js} +86 -6
  280. package/dist/{chunk-47e09r7z.js.map → chunk-qttqe1ah.js.map} +5 -4
  281. package/dist/{chunk-4zm1k3xj.js → chunk-r2psmn42.js} +1 -1
  282. package/dist/{chunk-31khg3g0.js → chunk-rt9deb92.js} +76 -4
  283. package/dist/{chunk-31khg3g0.js.map → chunk-rt9deb92.js.map} +3 -3
  284. package/dist/{chunk-r1cxq7vv.js → chunk-rtdrm592.js} +2 -2
  285. package/dist/{chunk-t5daew4g.js → chunk-s5n9617r.js} +18 -18
  286. package/dist/{chunk-t5daew4g.js.map → chunk-s5n9617r.js.map} +1 -1
  287. package/dist/{chunk-m3qe54bb.js → chunk-smnt672s.js} +1 -1
  288. package/dist/{chunk-21q0j5f2.js → chunk-stmxh0hv.js} +2 -2
  289. package/dist/{chunk-y2x2935j.js → chunk-sysnvjce.js} +5 -5
  290. package/dist/{chunk-y2x2935j.js.map → chunk-sysnvjce.js.map} +3 -3
  291. package/dist/{chunk-57g0215c.js → chunk-t24yktqr.js} +296 -7
  292. package/dist/{chunk-57g0215c.js.map → chunk-t24yktqr.js.map} +6 -3
  293. package/dist/{chunk-ff5xkv0p.js → chunk-tfzvjdms.js} +1 -1
  294. package/dist/chunk-tqa68kj7.js +1322 -0
  295. package/dist/chunk-tqa68kj7.js.map +25 -0
  296. package/dist/chunk-vtjzwymr.js +37 -0
  297. package/dist/chunk-vtjzwymr.js.map +10 -0
  298. package/dist/{chunk-dz7a4t3a.js → chunk-vzkxqf8h.js} +26 -21
  299. package/dist/{chunk-dz7a4t3a.js.map → chunk-vzkxqf8h.js.map} +8 -8
  300. package/dist/{chunk-6b61s40c.js → chunk-w3t94hm6.js} +1 -1
  301. package/dist/{chunk-t9xyr7y9.js → chunk-w9s23r24.js} +1218 -101
  302. package/dist/chunk-w9s23r24.js.map +30 -0
  303. package/dist/{chunk-9rh8ncs5.js → chunk-wa05txmk.js} +20 -7
  304. package/dist/{chunk-9rh8ncs5.js.map → chunk-wa05txmk.js.map} +3 -3
  305. package/dist/chunk-whbwf3np.js +12 -0
  306. package/dist/chunk-whbwf3np.js.map +10 -0
  307. package/dist/{chunk-agn8d8ys.js → chunk-xtztwpkh.js} +1 -1
  308. package/dist/{chunk-t5608tkq.js → chunk-yv8hv4wq.js} +3 -1
  309. package/dist/{chunk-t5608tkq.js.map → chunk-yv8hv4wq.js.map} +3 -3
  310. package/dist/{chunk-ratj7t3t.js → chunk-z0t4p2sk.js} +465 -76
  311. package/dist/chunk-z0t4p2sk.js.map +47 -0
  312. package/dist/{chunk-0g5nyx0k.js → chunk-zeykm8my.js} +2 -2
  313. package/dist/connectors/builders.d.ts +2 -2
  314. package/dist/connectors/builders.d.ts.map +1 -1
  315. package/dist/connectors/connections/access.d.ts +11 -0
  316. package/dist/connectors/connections/access.d.ts.map +1 -0
  317. package/dist/connectors/connections/contracts.d.ts +6 -1
  318. package/dist/connectors/connections/contracts.d.ts.map +1 -1
  319. package/dist/connectors/connections/internal.js +1 -1
  320. package/dist/connectors/connections/runs.d.ts +13 -0
  321. package/dist/connectors/connections/runs.d.ts.map +1 -1
  322. package/dist/connectors/connections/service.d.ts +25 -0
  323. package/dist/connectors/connections/service.d.ts.map +1 -1
  324. package/dist/connectors/connections/views.d.ts +1 -1
  325. package/dist/connectors/connections/views.d.ts.map +1 -1
  326. package/dist/connectors/execution.d.ts.map +1 -1
  327. package/dist/connectors/index.d.ts +1 -1
  328. package/dist/connectors/index.d.ts.map +1 -1
  329. package/dist/connectors/service.d.ts +3 -0
  330. package/dist/connectors/service.d.ts.map +1 -1
  331. package/dist/connectors/types.d.ts +21 -2
  332. package/dist/connectors/types.d.ts.map +1 -1
  333. package/dist/datasets/execution.d.ts +12 -6
  334. package/dist/datasets/execution.d.ts.map +1 -1
  335. package/dist/datasets/ingest-flush-batch.d.ts +59 -0
  336. package/dist/datasets/ingest-flush-batch.d.ts.map +1 -0
  337. package/dist/datasets/ingest-flush-job.d.ts +33 -0
  338. package/dist/datasets/ingest-flush-job.d.ts.map +1 -0
  339. package/dist/datasets/ingest-flush.d.ts +66 -0
  340. package/dist/datasets/ingest-flush.d.ts.map +1 -0
  341. package/dist/datasets/produced-version.d.ts +21 -0
  342. package/dist/datasets/produced-version.d.ts.map +1 -0
  343. package/dist/datasets/write.d.ts +22 -1
  344. package/dist/datasets/write.d.ts.map +1 -1
  345. package/dist/datasets/write.js +8 -4
  346. package/dist/datasets/write.js.map +1 -1
  347. package/dist/deploy/internal.js +5 -4
  348. package/dist/deploy/internal.js.map +4 -4
  349. package/dist/deploy/types.d.ts +2 -3
  350. package/dist/deploy/types.d.ts.map +1 -1
  351. package/dist/error-reporting/capability.d.ts +8 -2
  352. package/dist/error-reporting/capability.d.ts.map +1 -1
  353. package/dist/error-reporting/internal.d.ts +1 -1
  354. package/dist/error-reporting/internal.d.ts.map +1 -1
  355. package/dist/error-reporting/internal.js +17 -5
  356. package/dist/error-reporting/internal.js.map +1 -1
  357. package/dist/error-reporting/reporter.d.ts.map +1 -1
  358. package/dist/error-reporting/reports.d.ts +55 -0
  359. package/dist/error-reporting/reports.d.ts.map +1 -1
  360. package/dist/error-reporting/types.d.ts +82 -1
  361. package/dist/error-reporting/types.d.ts.map +1 -1
  362. package/dist/errors/catalog.d.ts +5 -0
  363. package/dist/errors/catalog.d.ts.map +1 -1
  364. package/dist/errors/internal.js +1 -1
  365. package/dist/events/definitions.d.ts +4 -0
  366. package/dist/events/definitions.d.ts.map +1 -1
  367. package/dist/events/execution.d.ts +1 -0
  368. package/dist/events/execution.d.ts.map +1 -1
  369. package/dist/events/index.d.ts +1 -1
  370. package/dist/events/index.d.ts.map +1 -1
  371. package/dist/events/index.js +5 -5
  372. package/dist/events/scope.d.ts.map +1 -1
  373. package/dist/events/scope.js +1 -1
  374. package/dist/events/selectors/index.js +2 -2
  375. package/dist/events/types/artifacts.d.ts +38 -0
  376. package/dist/events/types/artifacts.d.ts.map +1 -0
  377. package/dist/events/types/index.d.ts +3 -1
  378. package/dist/events/types/index.d.ts.map +1 -1
  379. package/dist/events/types/users.d.ts +5 -2
  380. package/dist/events/types/users.d.ts.map +1 -1
  381. package/dist/execution/agent.js +61 -55
  382. package/dist/execution/agent.js.map +1 -1
  383. package/dist/execution/authorized-object-reader.d.ts +10 -0
  384. package/dist/execution/authorized-object-reader.d.ts.map +1 -1
  385. package/dist/execution/object-reader-clearance.d.ts +6 -0
  386. package/dist/execution/object-reader-clearance.d.ts.map +1 -1
  387. package/dist/execution/object-reader-security.d.ts +9 -2
  388. package/dist/execution/object-reader-security.d.ts.map +1 -1
  389. package/dist/execution/primitive.js +60 -54
  390. package/dist/execution/primitive.js.map +1 -1
  391. package/dist/execution/request.js +57 -51
  392. package/dist/execution/request.js.map +2 -2
  393. package/dist/http/api-routes.d.ts +1 -1
  394. package/dist/http/api-routes.d.ts.map +1 -1
  395. package/dist/http/index.js +1 -1
  396. package/dist/index.d.ts +12 -10
  397. package/dist/index.d.ts.map +1 -1
  398. package/dist/index.js +101 -93
  399. package/dist/index.js.map +1 -1
  400. package/dist/lake-storage/errors.d.ts +15 -0
  401. package/dist/lake-storage/errors.d.ts.map +1 -1
  402. package/dist/lake-storage/index.d.ts +3 -2
  403. package/dist/lake-storage/index.d.ts.map +1 -1
  404. package/dist/lake-storage/index.js +16 -10
  405. package/dist/lake-storage/index.js.map +1 -1
  406. package/dist/lake-storage/maintenance.d.ts +88 -0
  407. package/dist/lake-storage/maintenance.d.ts.map +1 -0
  408. package/dist/lake-storage/merge.d.ts +3 -1
  409. package/dist/lake-storage/merge.d.ts.map +1 -1
  410. package/dist/lake-storage/source-ordering.d.ts +23 -0
  411. package/dist/lake-storage/source-ordering.d.ts.map +1 -1
  412. package/dist/lake-storage/types.d.ts +10 -0
  413. package/dist/lake-storage/types.d.ts.map +1 -1
  414. package/dist/maintenance/heartbeat.d.ts +5 -0
  415. package/dist/maintenance/heartbeat.d.ts.map +1 -0
  416. package/dist/maintenance/index.d.ts +4 -2
  417. package/dist/maintenance/index.d.ts.map +1 -1
  418. package/dist/maintenance/index.js +515 -0
  419. package/dist/maintenance/index.js.map +16 -0
  420. package/dist/maintenance/lake-retention-status.d.ts +36 -0
  421. package/dist/maintenance/lake-retention-status.d.ts.map +1 -0
  422. package/dist/maintenance/lake-retention.d.ts +84 -0
  423. package/dist/maintenance/lake-retention.d.ts.map +1 -0
  424. package/dist/maintenance/loop.d.ts +95 -0
  425. package/dist/maintenance/loop.d.ts.map +1 -0
  426. package/dist/maintenance/ontology-maintenance.d.ts +17 -16
  427. package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
  428. package/dist/maintenance/passes/cron-pass.d.ts +21 -0
  429. package/dist/maintenance/passes/cron-pass.d.ts.map +1 -0
  430. package/dist/maintenance/passes/directory-pass.d.ts +12 -0
  431. package/dist/maintenance/passes/directory-pass.d.ts.map +1 -0
  432. package/dist/maintenance/passes/ingest-pass.d.ts +26 -0
  433. package/dist/maintenance/passes/ingest-pass.d.ts.map +1 -0
  434. package/dist/maintenance/passes/lake-change-feed.d.ts +38 -0
  435. package/dist/maintenance/passes/lake-change-feed.d.ts.map +1 -0
  436. package/dist/maintenance/passes/lake-retention-pass.d.ts +20 -0
  437. package/dist/maintenance/passes/lake-retention-pass.d.ts.map +1 -0
  438. package/dist/maintenance/passes/ontology-pass.d.ts +8 -0
  439. package/dist/maintenance/passes/ontology-pass.d.ts.map +1 -0
  440. package/dist/maintenance/passes/projections-pass.d.ts +26 -0
  441. package/dist/maintenance/passes/projections-pass.d.ts.map +1 -0
  442. package/dist/maintenance/passes/recovery-pass.d.ts +6 -0
  443. package/dist/maintenance/passes/recovery-pass.d.ts.map +1 -0
  444. package/dist/maintenance/passes/recovery-passes.d.ts +24 -0
  445. package/dist/maintenance/passes/recovery-passes.d.ts.map +1 -0
  446. package/dist/maintenance/passes/runs-pass.d.ts +6 -0
  447. package/dist/maintenance/passes/runs-pass.d.ts.map +1 -0
  448. package/dist/maintenance/passes/triggers-pass.d.ts +41 -0
  449. package/dist/maintenance/passes/triggers-pass.d.ts.map +1 -0
  450. package/dist/maintenance/status.d.ts +19 -0
  451. package/dist/maintenance/status.d.ts.map +1 -0
  452. package/dist/maintenance/types.d.ts +25 -24
  453. package/dist/maintenance/types.d.ts.map +1 -1
  454. package/dist/materialization/model.d.ts +11 -2
  455. package/dist/materialization/model.d.ts.map +1 -1
  456. package/dist/materializer/edits/artifact-refs.d.ts +33 -0
  457. package/dist/materializer/edits/artifact-refs.d.ts.map +1 -0
  458. package/dist/materializer/edits/commit.d.ts.map +1 -1
  459. package/dist/materializer/edits/operations.d.ts +7 -1
  460. package/dist/materializer/edits/operations.d.ts.map +1 -1
  461. package/dist/materializer/edits/plan.d.ts.map +1 -1
  462. package/dist/materializer/execution/work-records.d.ts +6 -0
  463. package/dist/materializer/execution/work-records.d.ts.map +1 -1
  464. package/dist/materializer/index.js +33 -30
  465. package/dist/materializer/index.js.map +1 -1
  466. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  467. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  468. package/dist/materializer/telemetry/plan.d.ts.map +1 -1
  469. package/dist/models/catalog.d.ts +16 -0
  470. package/dist/models/catalog.d.ts.map +1 -1
  471. package/dist/models/definitions.d.ts +1 -1
  472. package/dist/models/definitions.d.ts.map +1 -1
  473. package/dist/models/execution/index.js +36 -33
  474. package/dist/models/execution/index.js.map +1 -1
  475. package/dist/models/execution/model-call-recorder.d.ts +1 -1
  476. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  477. package/dist/models/execution/web-search.d.ts +7 -0
  478. package/dist/models/execution/web-search.d.ts.map +1 -0
  479. package/dist/models/index.d.ts +3 -1
  480. package/dist/models/index.d.ts.map +1 -1
  481. package/dist/models/index.js +5 -3
  482. package/dist/models/index.js.map +1 -1
  483. package/dist/models/language-model.d.ts +12 -0
  484. package/dist/models/language-model.d.ts.map +1 -1
  485. package/dist/models/web-search-model.d.ts +66 -0
  486. package/dist/models/web-search-model.d.ts.map +1 -0
  487. package/dist/objects/artifact-refs.d.ts +5 -0
  488. package/dist/objects/artifact-refs.d.ts.map +1 -0
  489. package/dist/objects/index.js +63 -58
  490. package/dist/objects/index.js.map +1 -1
  491. package/dist/objects/materializer-adapter.d.ts +4 -3
  492. package/dist/objects/materializer-adapter.d.ts.map +1 -1
  493. package/dist/objects/object/upsert-batch.d.ts.map +1 -1
  494. package/dist/objects/object/upsert.d.ts.map +1 -1
  495. package/dist/objects/query/executor.d.ts.map +1 -1
  496. package/dist/objects/query/index.d.ts +1 -0
  497. package/dist/objects/query/index.d.ts.map +1 -1
  498. package/dist/objects/query/index.js +35 -29
  499. package/dist/objects/query/index.js.map +1 -1
  500. package/dist/objects/query/ir.d.ts +3 -1
  501. package/dist/objects/query/ir.d.ts.map +1 -1
  502. package/dist/objects/query/scalar-values.d.ts.map +1 -1
  503. package/dist/objects/query/sort-ties.d.ts +11 -0
  504. package/dist/objects/query/sort-ties.d.ts.map +1 -0
  505. package/dist/objects/runtime-batch.d.ts +2 -0
  506. package/dist/objects/runtime-batch.d.ts.map +1 -1
  507. package/dist/ontology/artifact-ref.d.ts +36 -0
  508. package/dist/ontology/artifact-ref.d.ts.map +1 -0
  509. package/dist/ontology/docs-markdown.d.ts.map +1 -1
  510. package/dist/ontology/index.d.ts +3 -1
  511. package/dist/ontology/index.d.ts.map +1 -1
  512. package/dist/ontology/index.js +8 -5
  513. package/dist/ontology/index.js.map +1 -1
  514. package/dist/ontology/inference/index.d.ts +2 -0
  515. package/dist/ontology/inference/index.d.ts.map +1 -1
  516. package/dist/ontology/internal.js +7 -6
  517. package/dist/ontology/internal.js.map +1 -1
  518. package/dist/ontology/json-schema.d.ts.map +1 -1
  519. package/dist/ontology/primitives.d.ts.map +1 -1
  520. package/dist/ontology/reference-values.d.ts +10 -0
  521. package/dist/ontology/reference-values.d.ts.map +1 -0
  522. package/dist/ontology/refs.d.ts +6 -1
  523. package/dist/ontology/refs.d.ts.map +1 -1
  524. package/dist/ontology/registry.d.ts +9 -1
  525. package/dist/ontology/registry.d.ts.map +1 -1
  526. package/dist/ontology/types.d.ts +2 -1
  527. package/dist/ontology/types.d.ts.map +1 -1
  528. package/dist/ontology/user-ref.d.ts +16 -0
  529. package/dist/ontology/user-ref.d.ts.map +1 -1
  530. package/dist/ontology/validation/normalize.d.ts.map +1 -1
  531. package/dist/ontology/validation/properties.d.ts.map +1 -1
  532. package/dist/ontology/validation/schema.d.ts.map +1 -1
  533. package/dist/pending-tasks.d.ts +17 -0
  534. package/dist/pending-tasks.d.ts.map +1 -0
  535. package/dist/pipelines/index.js +40 -37
  536. package/dist/pipelines/index.js.map +1 -1
  537. package/dist/pipelines/run-dispatch.d.ts +6 -0
  538. package/dist/pipelines/run-dispatch.d.ts.map +1 -1
  539. package/dist/predicates/types.d.ts +4 -0
  540. package/dist/predicates/types.d.ts.map +1 -1
  541. package/dist/projections/builders.d.ts +13 -11
  542. package/dist/projections/builders.d.ts.map +1 -1
  543. package/dist/projections/internal.js +33 -30
  544. package/dist/projections/internal.js.map +1 -1
  545. package/dist/projections/types.d.ts +1 -1
  546. package/dist/projections/types.d.ts.map +1 -1
  547. package/dist/projections/validation.d.ts +2 -2
  548. package/dist/projections/validation.d.ts.map +1 -1
  549. package/dist/queues/in-memory.d.ts +6 -1
  550. package/dist/queues/in-memory.d.ts.map +1 -1
  551. package/dist/queues/index.d.ts +1 -1
  552. package/dist/queues/index.d.ts.map +1 -1
  553. package/dist/queues/index.js +1 -1
  554. package/dist/queues/types.d.ts +55 -2
  555. package/dist/queues/types.d.ts.map +1 -1
  556. package/dist/runtime/create.d.ts +4 -1
  557. package/dist/runtime/create.d.ts.map +1 -1
  558. package/dist/runtime/host.d.ts +22 -5
  559. package/dist/runtime/host.d.ts.map +1 -1
  560. package/dist/runtime/index.d.ts +0 -1
  561. package/dist/runtime/index.d.ts.map +1 -1
  562. package/dist/runtime/internal.d.ts +6 -0
  563. package/dist/runtime/internal.d.ts.map +1 -1
  564. package/dist/runtime/internal.js +57 -36
  565. package/dist/runtime/internal.js.map +1 -1
  566. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  567. package/dist/runtime/sixb.d.ts +6 -1
  568. package/dist/runtime/sixb.d.ts.map +1 -1
  569. package/dist/sandboxes/index.js +8 -7
  570. package/dist/sandboxes/index.js.map +1 -1
  571. package/dist/scheduler/index.d.ts +0 -2
  572. package/dist/scheduler/index.d.ts.map +1 -1
  573. package/dist/scheduler/index.js +3 -6
  574. package/dist/scheduler/index.js.map +1 -1
  575. package/dist/schedules/index.js +9 -11
  576. package/dist/schedules/index.js.map +1 -1
  577. package/dist/security/index.d.ts +1 -0
  578. package/dist/security/index.d.ts.map +1 -1
  579. package/dist/security/internal.js +1 -1
  580. package/dist/security/registry.d.ts +2 -0
  581. package/dist/security/registry.d.ts.map +1 -1
  582. package/dist/security/view-conditions.d.ts.map +1 -1
  583. package/dist/security/visibility-keys.d.ts +19 -0
  584. package/dist/security/visibility-keys.d.ts.map +1 -0
  585. package/dist/shared/backoff.d.ts +12 -0
  586. package/dist/shared/backoff.d.ts.map +1 -0
  587. package/dist/shared/duration.d.ts +3 -0
  588. package/dist/shared/duration.d.ts.map +1 -0
  589. package/dist/shared/params/artifact-refs.d.ts +19 -0
  590. package/dist/shared/params/artifact-refs.d.ts.map +1 -0
  591. package/dist/shares/guest-name.d.ts +8 -0
  592. package/dist/shares/guest-name.d.ts.map +1 -0
  593. package/dist/shares/internal.d.ts +1 -0
  594. package/dist/shares/internal.d.ts.map +1 -1
  595. package/dist/shares/internal.js +74 -33
  596. package/dist/shares/internal.js.map +3 -3
  597. package/dist/shares/session-protocol.d.ts +13 -0
  598. package/dist/shares/session-protocol.d.ts.map +1 -1
  599. package/dist/storage/action-runs/failure.js +2 -2
  600. package/dist/storage/agents/in-memory.d.ts +8 -2
  601. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  602. package/dist/storage/agents/index.d.ts +1 -1
  603. package/dist/storage/agents/index.d.ts.map +1 -1
  604. package/dist/storage/agents/provider.d.ts +8 -2
  605. package/dist/storage/agents/provider.d.ts.map +1 -1
  606. package/dist/storage/agents/provider.js +12 -6
  607. package/dist/storage/agents/provider.js.map +1 -1
  608. package/dist/storage/agents/types.d.ts +42 -2
  609. package/dist/storage/agents/types.d.ts.map +1 -1
  610. package/dist/storage/ai-cost/provider.js +4 -4
  611. package/dist/storage/ai-limits/enforcement.js +4 -4
  612. package/dist/storage/ai-limits/provider.js +2 -2
  613. package/dist/storage/artifacts/errors.d.ts +9 -4
  614. package/dist/storage/artifacts/errors.d.ts.map +1 -1
  615. package/dist/storage/artifacts/in-memory.d.ts +27 -4
  616. package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
  617. package/dist/storage/artifacts/index.d.ts +1 -1
  618. package/dist/storage/artifacts/index.d.ts.map +1 -1
  619. package/dist/storage/artifacts/record.d.ts +39 -2
  620. package/dist/storage/artifacts/record.d.ts.map +1 -1
  621. package/dist/storage/artifacts/types.d.ts +328 -39
  622. package/dist/storage/artifacts/types.d.ts.map +1 -1
  623. package/dist/storage/auth/in-memory/auth-storage.d.ts +2 -1
  624. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  625. package/dist/storage/auth/in-memory/identities.d.ts +4 -0
  626. package/dist/storage/auth/in-memory/identities.d.ts.map +1 -1
  627. package/dist/storage/auth/in-memory/shared.d.ts +3 -1
  628. package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
  629. package/dist/storage/auth/in-memory/users.d.ts.map +1 -1
  630. package/dist/storage/auth/index.d.ts +1 -1
  631. package/dist/storage/auth/index.d.ts.map +1 -1
  632. package/dist/storage/auth/types.d.ts +39 -0
  633. package/dist/storage/auth/types.d.ts.map +1 -1
  634. package/dist/storage/connector-connections/in-memory.d.ts +1 -1
  635. package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
  636. package/dist/storage/connector-connections/index.d.ts +1 -1
  637. package/dist/storage/connector-connections/index.d.ts.map +1 -1
  638. package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
  639. package/dist/storage/connector-connections/provider/shared.d.ts +12 -2
  640. package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -1
  641. package/dist/storage/connector-connections/provider.d.ts +1 -0
  642. package/dist/storage/connector-connections/provider.d.ts.map +1 -1
  643. package/dist/storage/connector-connections/provider.js +23 -7
  644. package/dist/storage/connector-connections/provider.js.map +6 -6
  645. package/dist/storage/connector-connections/types.d.ts +1 -1
  646. package/dist/storage/connector-connections/types.d.ts.map +1 -1
  647. package/dist/storage/dataset-ingest/codec.d.ts +6 -0
  648. package/dist/storage/dataset-ingest/codec.d.ts.map +1 -0
  649. package/dist/storage/dataset-ingest/in-memory.d.ts +28 -0
  650. package/dist/storage/dataset-ingest/in-memory.d.ts.map +1 -0
  651. package/dist/storage/dataset-ingest/index.d.ts +4 -0
  652. package/dist/storage/dataset-ingest/index.d.ts.map +1 -0
  653. package/dist/storage/dataset-ingest/provider.d.ts +157 -0
  654. package/dist/storage/dataset-ingest/provider.d.ts.map +1 -0
  655. package/dist/storage/dataset-ingest/provider.js +17 -0
  656. package/dist/storage/dataset-ingest/provider.js.map +9 -0
  657. package/dist/storage/dataset-ingest/types.d.ts +188 -0
  658. package/dist/storage/dataset-ingest/types.d.ts.map +1 -0
  659. package/dist/storage/file-upload-sessions/provider.js +12 -11
  660. package/dist/storage/file-upload-sessions/provider.js.map +1 -1
  661. package/dist/storage/in-memory/index.d.ts +12 -0
  662. package/dist/storage/in-memory/index.d.ts.map +1 -1
  663. package/dist/storage/index.d.ts +20 -13
  664. package/dist/storage/index.d.ts.map +1 -1
  665. package/dist/storage/index.js +61 -51
  666. package/dist/storage/index.js.map +1 -1
  667. package/dist/storage/internal.d.ts +4 -1
  668. package/dist/storage/internal.d.ts.map +1 -1
  669. package/dist/storage/internal.js +83 -7
  670. package/dist/storage/internal.js.map +4 -3
  671. package/dist/storage/lake-retention-runs/in-memory.d.ts +11 -0
  672. package/dist/storage/lake-retention-runs/in-memory.d.ts.map +1 -0
  673. package/dist/storage/lake-retention-runs/index.d.ts +3 -0
  674. package/dist/storage/lake-retention-runs/index.d.ts.map +1 -0
  675. package/dist/storage/lake-retention-runs/types.d.ts +21 -0
  676. package/dist/storage/lake-retention-runs/types.d.ts.map +1 -0
  677. package/dist/storage/maintenance-heartbeats/in-memory.d.ts +11 -0
  678. package/dist/storage/maintenance-heartbeats/in-memory.d.ts.map +1 -0
  679. package/dist/storage/maintenance-heartbeats/index.d.ts +3 -0
  680. package/dist/storage/maintenance-heartbeats/index.d.ts.map +1 -0
  681. package/dist/storage/maintenance-heartbeats/record.d.ts +11 -0
  682. package/dist/storage/maintenance-heartbeats/record.d.ts.map +1 -0
  683. package/dist/storage/maintenance-heartbeats/types.d.ts +30 -0
  684. package/dist/storage/maintenance-heartbeats/types.d.ts.map +1 -0
  685. package/dist/storage/migrations/types.d.ts +6 -0
  686. package/dist/storage/migrations/types.d.ts.map +1 -1
  687. package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
  688. package/dist/storage/objects/in-memory/storage.d.ts +15 -1
  689. package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
  690. package/dist/storage/objects/index.d.ts +1 -1
  691. package/dist/storage/objects/index.d.ts.map +1 -1
  692. package/dist/storage/objects/query-preparation.d.ts +13 -0
  693. package/dist/storage/objects/query-preparation.d.ts.map +1 -1
  694. package/dist/storage/objects/read-scope.d.ts.map +1 -1
  695. package/dist/storage/objects/types.d.ts +70 -1
  696. package/dist/storage/objects/types.d.ts.map +1 -1
  697. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  698. package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
  699. package/dist/storage/ontology/index.d.ts +1 -1
  700. package/dist/storage/ontology/index.d.ts.map +1 -1
  701. package/dist/storage/ontology/materializations.d.ts +20 -0
  702. package/dist/storage/ontology/materializations.d.ts.map +1 -1
  703. package/dist/storage/ontology/provider-work.d.ts +7 -1
  704. package/dist/storage/ontology/provider-work.d.ts.map +1 -1
  705. package/dist/storage/ontology/provider.js +1 -1
  706. package/dist/storage/pipeline-runs/in-memory.d.ts +8 -2
  707. package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
  708. package/dist/storage/pipeline-runs/index.d.ts +1 -1
  709. package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
  710. package/dist/storage/pipeline-runs/provider.js +1 -1
  711. package/dist/storage/pipeline-runs/transitions.d.ts +2 -2
  712. package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -1
  713. package/dist/storage/pipeline-runs/types.d.ts +26 -6
  714. package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
  715. package/dist/storage/projection-runs/errors.d.ts +6 -0
  716. package/dist/storage/projection-runs/errors.d.ts.map +1 -1
  717. package/dist/storage/projection-runs/in-memory.d.ts +5 -1
  718. package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
  719. package/dist/storage/projection-runs/index.d.ts +2 -2
  720. package/dist/storage/projection-runs/index.d.ts.map +1 -1
  721. package/dist/storage/projection-runs/lifecycle.d.ts +1 -0
  722. package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
  723. package/dist/storage/projection-runs/provider.js +2 -2
  724. package/dist/storage/projection-runs/types.d.ts +16 -0
  725. package/dist/storage/projection-runs/types.d.ts.map +1 -1
  726. package/dist/storage/run-claim.d.ts +132 -0
  727. package/dist/storage/run-claim.d.ts.map +1 -0
  728. package/dist/storage/share-grants/provider.js +3 -3
  729. package/dist/storage/share-sessions/in-memory.d.ts +2 -1
  730. package/dist/storage/share-sessions/in-memory.d.ts.map +1 -1
  731. package/dist/storage/share-sessions/index.d.ts +1 -1
  732. package/dist/storage/share-sessions/index.d.ts.map +1 -1
  733. package/dist/storage/share-sessions/provider.d.ts +1 -1
  734. package/dist/storage/share-sessions/provider.d.ts.map +1 -1
  735. package/dist/storage/share-sessions/provider.js +4 -2
  736. package/dist/storage/share-sessions/provider.js.map +1 -1
  737. package/dist/storage/share-sessions/record.d.ts +2 -1
  738. package/dist/storage/share-sessions/record.d.ts.map +1 -1
  739. package/dist/storage/share-sessions/types.d.ts +17 -1
  740. package/dist/storage/share-sessions/types.d.ts.map +1 -1
  741. package/dist/storage/sync-runs/in-memory.d.ts +10 -2
  742. package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
  743. package/dist/storage/sync-runs/index.d.ts +1 -1
  744. package/dist/storage/sync-runs/index.d.ts.map +1 -1
  745. package/dist/storage/sync-runs/transitions.d.ts +2 -2
  746. package/dist/storage/sync-runs/transitions.d.ts.map +1 -1
  747. package/dist/storage/sync-runs/types.d.ts +29 -3
  748. package/dist/storage/sync-runs/types.d.ts.map +1 -1
  749. package/dist/storage/types.d.ts +12 -6
  750. package/dist/storage/types.d.ts.map +1 -1
  751. package/dist/storage/webhook-runs/in-memory.d.ts +2 -1
  752. package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
  753. package/dist/storage/webhook-runs/index.d.ts +2 -2
  754. package/dist/storage/webhook-runs/index.d.ts.map +1 -1
  755. package/dist/storage/webhook-runs/types.d.ts +33 -2
  756. package/dist/storage/webhook-runs/types.d.ts.map +1 -1
  757. package/dist/storage/workflow-runs/in-memory.d.ts +6 -3
  758. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  759. package/dist/storage/workflow-runs/index.d.ts +1 -1
  760. package/dist/storage/workflow-runs/index.d.ts.map +1 -1
  761. package/dist/storage/workflow-runs/provider.js +12 -11
  762. package/dist/storage/workflow-runs/provider.js.map +1 -1
  763. package/dist/storage/workflow-runs/types.d.ts +11 -28
  764. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  765. package/dist/syncs/index.js +41 -38
  766. package/dist/syncs/index.js.map +1 -1
  767. package/dist/syncs/run-dispatch.d.ts +2 -0
  768. package/dist/syncs/run-dispatch.d.ts.map +1 -1
  769. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  770. package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -1
  771. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  772. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
  773. package/dist/testing/artifact-holders-contract.d.ts +15 -0
  774. package/dist/testing/artifact-holders-contract.d.ts.map +1 -0
  775. package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
  776. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  777. package/dist/testing/broker-contract.d.ts.map +1 -1
  778. package/dist/testing/connector-connection-storage-contract.d.ts +1 -1
  779. package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
  780. package/dist/testing/dataset-ingest-storage-contract.d.ts +11 -0
  781. package/dist/testing/dataset-ingest-storage-contract.d.ts.map +1 -0
  782. package/dist/testing/dataset-sequence-contract.d.ts +1 -1
  783. package/dist/testing/dataset-sequence-contract.d.ts.map +1 -1
  784. package/dist/testing/execution.d.ts.map +1 -1
  785. package/dist/testing/index.d.ts +8 -0
  786. package/dist/testing/index.d.ts.map +1 -1
  787. package/dist/testing/index.js +6497 -3090
  788. package/dist/testing/index.js.map +32 -23
  789. package/dist/testing/lake-retention-run-storage-contract.d.ts +9 -0
  790. package/dist/testing/lake-retention-run-storage-contract.d.ts.map +1 -0
  791. package/dist/testing/maintenance-heartbeat-storage-contract.d.ts +9 -0
  792. package/dist/testing/maintenance-heartbeat-storage-contract.d.ts.map +1 -0
  793. package/dist/testing/object-conditional-read-scope-contract.d.ts.map +1 -1
  794. package/dist/testing/object-query-contract.d.ts.map +1 -1
  795. package/dist/testing/pipeline-execution.d.ts.map +1 -1
  796. package/dist/testing/pipeline-run-read-contract.d.ts +13 -0
  797. package/dist/testing/pipeline-run-read-contract.d.ts.map +1 -0
  798. package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
  799. package/dist/testing/queues-contract.d.ts.map +1 -1
  800. package/dist/testing/run-claim-storage-contract.d.ts +12 -0
  801. package/dist/testing/run-claim-storage-contract.d.ts.map +1 -0
  802. package/dist/testing/run-claim.d.ts +30 -0
  803. package/dist/testing/run-claim.d.ts.map +1 -0
  804. package/dist/testing/run-recovery-contract.d.ts +49 -0
  805. package/dist/testing/run-recovery-contract.d.ts.map +1 -0
  806. package/dist/testing/share-session-storage-contract.d.ts.map +1 -1
  807. package/dist/testing/stored-artifacts.d.ts +10 -0
  808. package/dist/testing/stored-artifacts.d.ts.map +1 -0
  809. package/dist/testing/sync-execution.d.ts.map +1 -1
  810. package/dist/testing/webhook-execution.d.ts +1 -1
  811. package/dist/testing/webhook-execution.d.ts.map +1 -1
  812. package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -1
  813. package/dist/users/execution.d.ts +18 -1
  814. package/dist/users/execution.d.ts.map +1 -1
  815. package/dist/users/index.d.ts +1 -1
  816. package/dist/users/index.d.ts.map +1 -1
  817. package/dist/webhooks/delivery-lease.d.ts +13 -0
  818. package/dist/webhooks/delivery-lease.d.ts.map +1 -0
  819. package/dist/webhooks/internal.d.ts +2 -0
  820. package/dist/webhooks/internal.d.ts.map +1 -1
  821. package/dist/webhooks/internal.js +72 -40
  822. package/dist/webhooks/internal.js.map +5 -4
  823. package/dist/webhooks/run-admission.d.ts.map +1 -1
  824. package/dist/workers/index.d.ts +5 -1
  825. package/dist/workers/index.d.ts.map +1 -1
  826. package/dist/workers/index.js +193 -58
  827. package/dist/workers/index.js.map +8 -7
  828. package/dist/workers/job-ids.d.ts +17 -0
  829. package/dist/workers/job-ids.d.ts.map +1 -0
  830. package/dist/workers/lost-projection-runs.d.ts +26 -0
  831. package/dist/workers/lost-projection-runs.d.ts.map +1 -0
  832. package/dist/workers/lost-runs.d.ts +51 -0
  833. package/dist/workers/lost-runs.d.ts.map +1 -0
  834. package/dist/workers/queue-delivery.d.ts.map +1 -1
  835. package/dist/workers/queue-worker.d.ts +1 -2
  836. package/dist/workers/queue-worker.d.ts.map +1 -1
  837. package/dist/workers/queued-run-dispatch.d.ts +90 -0
  838. package/dist/workers/queued-run-dispatch.d.ts.map +1 -0
  839. package/dist/workers/run-lease.d.ts +25 -0
  840. package/dist/workers/run-lease.d.ts.map +1 -0
  841. package/dist/workers/run-worker.d.ts +95 -0
  842. package/dist/workers/run-worker.d.ts.map +1 -0
  843. package/dist/workflows/index.js +68 -62
  844. package/dist/workflows/index.js.map +1 -1
  845. package/dist/workflows/request.d.ts.map +1 -1
  846. package/dist/workflows/run-dispatch.d.ts +6 -1
  847. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  848. package/package.json +41 -3
  849. package/src/actions/request.ts +24 -7
  850. package/src/actions/run/executor.ts +9 -42
  851. package/src/actions/types/context.ts +8 -3
  852. package/src/agents/README.md +2 -1
  853. package/src/agents/cancel.ts +7 -1
  854. package/src/agents/execution.ts +10 -2
  855. package/src/agents/fork.ts +12 -4
  856. package/src/agents/index.ts +16 -2
  857. package/src/agents/request.ts +42 -31
  858. package/src/agents/run-artifacts.ts +290 -46
  859. package/src/agents/run-plan.ts +31 -0
  860. package/src/agents/run-session-http.ts +19 -12
  861. package/src/agents/run-session-serve.ts +18 -2
  862. package/src/agents/run-session.ts +39 -12
  863. package/src/agents/skills.ts +3 -0
  864. package/src/agents/step-limits.ts +6 -0
  865. package/src/agents/streams/protocol.ts +14 -14
  866. package/src/agents/tool-files.ts +11 -3
  867. package/src/agents/validation.ts +12 -0
  868. package/src/agents/web.ts +218 -0
  869. package/src/artifacts/access.ts +71 -28
  870. package/src/artifacts/canvas-display.ts +160 -0
  871. package/src/artifacts/canvas.ts +26 -1
  872. package/src/artifacts/comment-text.ts +32 -0
  873. package/src/artifacts/comments.ts +275 -0
  874. package/src/artifacts/errors.ts +6 -1
  875. package/src/artifacts/events.ts +58 -0
  876. package/src/artifacts/execution.ts +496 -53
  877. package/src/artifacts/frames/assets.ts +20 -1
  878. package/src/artifacts/frames/grants.ts +31 -10
  879. package/src/artifacts/frames/index.ts +2 -0
  880. package/src/artifacts/frames/kit.ts +8 -5
  881. package/src/artifacts/frames/protocol.ts +149 -0
  882. package/src/artifacts/frames/runtime.ts +317 -29
  883. package/src/artifacts/holders.ts +120 -0
  884. package/src/artifacts/ids.ts +8 -0
  885. package/src/artifacts/index.ts +28 -2
  886. package/src/artifacts/limits.ts +28 -4
  887. package/src/artifacts/live/board.ts +759 -0
  888. package/src/artifacts/live/diff.ts +297 -0
  889. package/src/artifacts/live/document.ts +354 -0
  890. package/src/artifacts/live/files.ts +82 -0
  891. package/src/artifacts/live/index.ts +50 -0
  892. package/src/artifacts/live/presence.ts +144 -0
  893. package/src/artifacts/live/protocol.ts +134 -0
  894. package/src/artifacts/live/server.ts +16 -0
  895. package/src/artifacts/live/state.ts +115 -0
  896. package/src/artifacts/outline.ts +12 -0
  897. package/src/artifacts/publish/index.ts +26 -1
  898. package/src/artifacts/publish/merge.ts +271 -0
  899. package/src/artifacts/publish/previews.ts +485 -0
  900. package/src/artifacts/publish/publish.ts +92 -39
  901. package/src/artifacts/publish/query-answers.ts +85 -0
  902. package/src/artifacts/publish/references.ts +10 -4
  903. package/src/artifacts/publish/validate/canvas.ts +133 -1
  904. package/src/artifacts/theme.ts +9 -1
  905. package/src/auth/directory.ts +166 -0
  906. package/src/auth/member-events.ts +10 -3
  907. package/src/auth/runtime.ts +108 -8
  908. package/src/auth/strategy.ts +3 -1
  909. package/src/auth/types.ts +44 -0
  910. package/src/authorization/decision.ts +6 -5
  911. package/src/authorization/event-visibility.ts +4 -0
  912. package/src/authorization/resolve.ts +9 -11
  913. package/src/authorization/types.ts +5 -5
  914. package/src/broker/in-memory.ts +33 -6
  915. package/src/broker/types.ts +4 -0
  916. package/src/connectors/builders.ts +34 -2
  917. package/src/connectors/connections/access.ts +83 -0
  918. package/src/connectors/connections/contracts.ts +6 -1
  919. package/src/connectors/connections/execution.ts +2 -2
  920. package/src/connectors/connections/runs.ts +93 -7
  921. package/src/connectors/connections/service.ts +208 -41
  922. package/src/connectors/connections/views.ts +11 -4
  923. package/src/connectors/execution.ts +27 -3
  924. package/src/connectors/index.ts +2 -0
  925. package/src/connectors/service.ts +12 -0
  926. package/src/connectors/types.ts +37 -2
  927. package/src/datasets/execution.ts +74 -37
  928. package/src/datasets/ingest-flush-batch.ts +289 -0
  929. package/src/datasets/ingest-flush-job.ts +112 -0
  930. package/src/datasets/ingest-flush.ts +377 -0
  931. package/src/datasets/produced-version.ts +55 -0
  932. package/src/datasets/write.ts +65 -11
  933. package/src/deploy/services.ts +1 -1
  934. package/src/deploy/types.ts +2 -3
  935. package/src/deploy/validation.ts +1 -0
  936. package/src/error-reporting/capability.ts +66 -0
  937. package/src/error-reporting/internal.ts +12 -0
  938. package/src/error-reporting/reporter.ts +11 -35
  939. package/src/error-reporting/reports.ts +167 -0
  940. package/src/error-reporting/types.ts +99 -0
  941. package/src/errors/catalog.ts +6 -0
  942. package/src/events/definitions.ts +14 -0
  943. package/src/events/execution.ts +77 -28
  944. package/src/events/index.ts +3 -0
  945. package/src/events/scope.ts +2 -0
  946. package/src/events/types/artifacts.ts +40 -0
  947. package/src/events/types/index.ts +3 -0
  948. package/src/events/types/users.ts +5 -2
  949. package/src/execution/authorized-object-reader.ts +34 -0
  950. package/src/execution/object-reader-clearance.ts +31 -0
  951. package/src/execution/object-reader-security.ts +37 -22
  952. package/src/http/api-routes.ts +105 -4
  953. package/src/index.ts +24 -4
  954. package/src/lake-storage/errors.ts +21 -0
  955. package/src/lake-storage/index.ts +9 -1
  956. package/src/lake-storage/maintenance.ts +93 -0
  957. package/src/lake-storage/merge.ts +3 -1
  958. package/src/lake-storage/source-ordering.ts +28 -2
  959. package/src/lake-storage/types.ts +14 -0
  960. package/src/maintenance/heartbeat.ts +14 -0
  961. package/src/maintenance/index.ts +5 -3
  962. package/src/maintenance/lake-retention-status.ts +81 -0
  963. package/src/maintenance/lake-retention.ts +347 -0
  964. package/src/maintenance/loop.ts +365 -0
  965. package/src/maintenance/ontology-maintenance.ts +76 -229
  966. package/src/maintenance/passes/cron-pass.ts +217 -0
  967. package/src/maintenance/passes/directory-pass.ts +22 -0
  968. package/src/maintenance/passes/ingest-pass.ts +94 -0
  969. package/src/maintenance/passes/lake-change-feed.ts +112 -0
  970. package/src/maintenance/passes/lake-retention-pass.ts +71 -0
  971. package/src/maintenance/passes/ontology-pass.ts +19 -0
  972. package/src/maintenance/passes/projections-pass.ts +238 -0
  973. package/src/maintenance/passes/recovery-pass.ts +17 -0
  974. package/src/maintenance/passes/recovery-passes.ts +39 -0
  975. package/src/maintenance/passes/runs-pass.ts +12 -0
  976. package/src/maintenance/passes/triggers-pass.ts +332 -0
  977. package/src/maintenance/status.ts +75 -0
  978. package/src/maintenance/types.ts +27 -25
  979. package/src/materialization/model.ts +33 -21
  980. package/src/materializer/README.md +13 -2
  981. package/src/materializer/edits/artifact-refs.ts +140 -0
  982. package/src/materializer/edits/commit.ts +20 -7
  983. package/src/materializer/edits/operations.ts +23 -7
  984. package/src/materializer/edits/plan.ts +2 -0
  985. package/src/materializer/execution/work-records.ts +61 -0
  986. package/src/materializer/projections/replacement-plan.ts +2 -0
  987. package/src/materializer/shared/normalize.ts +14 -0
  988. package/src/materializer/telemetry/plan.ts +2 -0
  989. package/src/models/catalog.ts +52 -3
  990. package/src/models/definitions.ts +2 -0
  991. package/src/models/execution/README.md +22 -2
  992. package/src/models/execution/model-call-recorder.ts +1 -1
  993. package/src/models/execution/web-search.ts +186 -0
  994. package/src/models/index.ts +12 -0
  995. package/src/models/language-model.ts +12 -0
  996. package/src/models/web-search-model.ts +152 -0
  997. package/src/objects/artifact-refs.ts +34 -0
  998. package/src/objects/materializer-adapter.ts +8 -3
  999. package/src/objects/object/upsert-batch.ts +7 -0
  1000. package/src/objects/object/upsert.ts +11 -2
  1001. package/src/objects/query/executor.ts +7 -3
  1002. package/src/objects/query/index.ts +1 -0
  1003. package/src/objects/query/ir.ts +2 -0
  1004. package/src/objects/query/scalar-values.ts +5 -3
  1005. package/src/objects/query/sort-ties.ts +16 -0
  1006. package/src/objects/runtime-batch.ts +8 -1
  1007. package/src/objects/vectors/README.md +4 -4
  1008. package/src/ontology/artifact-ref.ts +83 -0
  1009. package/src/ontology/docs-markdown.ts +17 -0
  1010. package/src/ontology/index.ts +3 -1
  1011. package/src/ontology/inference/index.ts +2 -0
  1012. package/src/ontology/json-schema.ts +13 -0
  1013. package/src/ontology/primitives.ts +14 -0
  1014. package/src/ontology/reference-values.ts +62 -0
  1015. package/src/ontology/refs.ts +7 -1
  1016. package/src/ontology/registry.ts +26 -1
  1017. package/src/ontology/types.ts +2 -0
  1018. package/src/ontology/user-ref.ts +35 -45
  1019. package/src/ontology/validation/normalize.ts +13 -0
  1020. package/src/ontology/validation/properties.ts +9 -0
  1021. package/src/ontology/validation/schema.ts +12 -0
  1022. package/src/pending-tasks.ts +51 -0
  1023. package/src/pipelines/run-dispatch.ts +120 -238
  1024. package/src/predicates/types.ts +2 -1
  1025. package/src/projections/builders.ts +28 -13
  1026. package/src/projections/run-dispatch.ts +1 -1
  1027. package/src/projections/types.ts +1 -1
  1028. package/src/projections/validation.ts +22 -8
  1029. package/src/queues/in-memory.ts +50 -3
  1030. package/src/queues/index.ts +4 -0
  1031. package/src/queues/types.ts +68 -1
  1032. package/src/runtime/create.ts +7 -2
  1033. package/src/runtime/host.ts +118 -13
  1034. package/src/runtime/index.ts +0 -1
  1035. package/src/runtime/internal.ts +13 -0
  1036. package/src/runtime/ontology-mutations.ts +1 -1
  1037. package/src/runtime/resolve-definitions.ts +4 -0
  1038. package/src/runtime/sixb.ts +14 -5
  1039. package/src/scheduler/index.ts +0 -2
  1040. package/src/security/index.ts +1 -0
  1041. package/src/security/registry.ts +2 -0
  1042. package/src/security/view-conditions.ts +4 -3
  1043. package/src/security/visibility-keys.ts +144 -0
  1044. package/src/shared/backoff.ts +34 -0
  1045. package/src/shared/duration.ts +15 -0
  1046. package/src/shared/params/artifact-refs.ts +42 -0
  1047. package/src/shares/compiler.ts +1 -1
  1048. package/src/shares/guest-name.ts +20 -0
  1049. package/src/shares/internal.ts +1 -0
  1050. package/src/shares/session-protocol.ts +63 -0
  1051. package/src/storage/agents/in-memory.ts +29 -2
  1052. package/src/storage/agents/index.ts +2 -0
  1053. package/src/storage/agents/provider.ts +57 -1
  1054. package/src/storage/agents/types.ts +45 -2
  1055. package/src/storage/artifacts/errors.ts +10 -2
  1056. package/src/storage/artifacts/in-memory.ts +579 -96
  1057. package/src/storage/artifacts/index.ts +22 -1
  1058. package/src/storage/artifacts/record.ts +255 -11
  1059. package/src/storage/artifacts/types.ts +343 -40
  1060. package/src/storage/auth/in-memory/auth-storage.ts +42 -5
  1061. package/src/storage/auth/in-memory/identities.ts +16 -0
  1062. package/src/storage/auth/in-memory/shared.ts +15 -0
  1063. package/src/storage/auth/in-memory/users.ts +17 -16
  1064. package/src/storage/auth/index.ts +3 -0
  1065. package/src/storage/auth/types.ts +38 -0
  1066. package/src/storage/connector-connections/in-memory.ts +6 -3
  1067. package/src/storage/connector-connections/index.ts +1 -0
  1068. package/src/storage/connector-connections/provider/connections.ts +2 -2
  1069. package/src/storage/connector-connections/provider/runs.ts +3 -0
  1070. package/src/storage/connector-connections/provider/shared.ts +30 -0
  1071. package/src/storage/connector-connections/provider.ts +4 -0
  1072. package/src/storage/connector-connections/types.ts +1 -0
  1073. package/src/storage/dataset-ingest/codec.ts +90 -0
  1074. package/src/storage/dataset-ingest/in-memory.ts +277 -0
  1075. package/src/storage/dataset-ingest/index.ts +16 -0
  1076. package/src/storage/dataset-ingest/provider.ts +592 -0
  1077. package/src/storage/dataset-ingest/types.ts +191 -0
  1078. package/src/storage/in-memory/index.ts +33 -0
  1079. package/src/storage/index.ts +69 -5
  1080. package/src/storage/internal.ts +20 -0
  1081. package/src/storage/lake-retention-runs/in-memory.ts +22 -0
  1082. package/src/storage/lake-retention-runs/index.ts +2 -0
  1083. package/src/storage/lake-retention-runs/types.ts +19 -0
  1084. package/src/storage/maintenance-heartbeats/in-memory.ts +24 -0
  1085. package/src/storage/maintenance-heartbeats/index.ts +7 -0
  1086. package/src/storage/maintenance-heartbeats/record.ts +50 -0
  1087. package/src/storage/maintenance-heartbeats/types.ts +30 -0
  1088. package/src/storage/migrations/types.ts +6 -0
  1089. package/src/storage/objects/in-memory/query.ts +6 -2
  1090. package/src/storage/objects/in-memory/storage.ts +81 -0
  1091. package/src/storage/objects/index.ts +2 -0
  1092. package/src/storage/objects/query-preparation.ts +59 -1
  1093. package/src/storage/objects/read-scope.ts +109 -2
  1094. package/src/storage/objects/types.ts +59 -1
  1095. package/src/storage/ontology/in-memory/materializations.ts +8 -0
  1096. package/src/storage/ontology/in-memory/replacement-plans.ts +4 -1
  1097. package/src/storage/ontology/index.ts +2 -0
  1098. package/src/storage/ontology/materializations.ts +18 -0
  1099. package/src/storage/ontology/provider-work.ts +39 -0
  1100. package/src/storage/pipeline-runs/in-memory.ts +97 -24
  1101. package/src/storage/pipeline-runs/index.ts +0 -1
  1102. package/src/storage/pipeline-runs/provider.ts +1 -1
  1103. package/src/storage/pipeline-runs/transitions.ts +7 -4
  1104. package/src/storage/pipeline-runs/types.ts +33 -7
  1105. package/src/storage/projection-runs/errors.ts +10 -0
  1106. package/src/storage/projection-runs/in-memory.ts +56 -1
  1107. package/src/storage/projection-runs/index.ts +2 -1
  1108. package/src/storage/projection-runs/lifecycle.ts +9 -1
  1109. package/src/storage/projection-runs/types.ts +20 -1
  1110. package/src/storage/run-claim.ts +224 -0
  1111. package/src/storage/share-sessions/in-memory.ts +21 -0
  1112. package/src/storage/share-sessions/index.ts +1 -0
  1113. package/src/storage/share-sessions/provider.ts +1 -0
  1114. package/src/storage/share-sessions/record.ts +28 -0
  1115. package/src/storage/share-sessions/types.ts +19 -1
  1116. package/src/storage/sync-runs/in-memory.ts +109 -29
  1117. package/src/storage/sync-runs/index.ts +1 -1
  1118. package/src/storage/sync-runs/transitions.ts +7 -4
  1119. package/src/storage/sync-runs/types.ts +36 -3
  1120. package/src/storage/types.ts +15 -5
  1121. package/src/storage/webhook-runs/in-memory.ts +26 -2
  1122. package/src/storage/webhook-runs/index.ts +3 -1
  1123. package/src/storage/webhook-runs/types.ts +44 -3
  1124. package/src/storage/workflow-runs/in-memory.ts +50 -36
  1125. package/src/storage/workflow-runs/index.ts +0 -2
  1126. package/src/storage/workflow-runs/types.ts +18 -30
  1127. package/src/syncs/run-dispatch.ts +118 -239
  1128. package/src/testing/agent-storage-contract.ts +70 -0
  1129. package/src/testing/ai-limit-storage-contract.ts +11 -1
  1130. package/src/testing/ai-model-call-groups-contract.ts +2 -1
  1131. package/src/testing/ai-usage-storage-contract.ts +15 -2
  1132. package/src/testing/artifact-holders-contract.ts +392 -0
  1133. package/src/testing/artifact-storage-contract.ts +1205 -151
  1134. package/src/testing/auth-storage-contract.ts +228 -1
  1135. package/src/testing/broker-contract.ts +56 -0
  1136. package/src/testing/connector-connection-storage-contract.ts +117 -5
  1137. package/src/testing/dataset-ingest-storage-contract.ts +480 -0
  1138. package/src/testing/dataset-sequence-contract.ts +97 -12
  1139. package/src/testing/execution.ts +23 -0
  1140. package/src/testing/index.ts +31 -0
  1141. package/src/testing/lake-retention-run-storage-contract.ts +75 -0
  1142. package/src/testing/maintenance-heartbeat-storage-contract.ts +99 -0
  1143. package/src/testing/object-conditional-read-scope-contract.ts +267 -5
  1144. package/src/testing/object-query-contract.ts +168 -0
  1145. package/src/testing/pipeline-execution.ts +3 -1
  1146. package/src/testing/pipeline-run-read-contract.ts +123 -0
  1147. package/src/testing/projection-run-storage-contract.ts +113 -0
  1148. package/src/testing/queues-contract.ts +112 -0
  1149. package/src/testing/run-claim-storage-contract.ts +736 -0
  1150. package/src/testing/run-claim.ts +69 -0
  1151. package/src/testing/run-recovery-contract.ts +176 -0
  1152. package/src/testing/share-session-storage-contract.ts +43 -0
  1153. package/src/testing/stored-artifacts.ts +43 -0
  1154. package/src/testing/sync-execution.ts +3 -1
  1155. package/src/testing/webhook-execution.ts +7 -2
  1156. package/src/testing/webhook-run-storage-contract.ts +102 -5
  1157. package/src/users/execution.ts +50 -2
  1158. package/src/users/index.ts +1 -0
  1159. package/src/webhooks/delivery-lease.ts +40 -0
  1160. package/src/webhooks/internal.ts +2 -0
  1161. package/src/webhooks/run-admission.ts +22 -9
  1162. package/src/workers/README.md +169 -0
  1163. package/src/workers/index.ts +9 -1
  1164. package/src/workers/job-ids.ts +31 -0
  1165. package/src/workers/lost-projection-runs.ts +114 -0
  1166. package/src/workers/lost-runs.ts +397 -0
  1167. package/src/workers/queue-delivery.ts +2 -14
  1168. package/src/workers/queue-worker.ts +9 -17
  1169. package/src/workers/queued-run-dispatch.ts +308 -0
  1170. package/src/workers/run-lease.ts +46 -0
  1171. package/src/workers/run-worker.ts +312 -0
  1172. package/src/workers/worker.ts +4 -17
  1173. package/src/workflows/request.ts +2 -0
  1174. package/src/workflows/run-dispatch.ts +22 -4
  1175. package/src/workflows/snapshot.ts +1 -0
  1176. package/dist/chunk-2g0r46hy.js.map +0 -12
  1177. package/dist/chunk-3fqxbn31.js +0 -107
  1178. package/dist/chunk-3fqxbn31.js.map +0 -11
  1179. package/dist/chunk-3x3bebz7.js.map +0 -49
  1180. package/dist/chunk-5kyvrtjh.js.map +0 -12
  1181. package/dist/chunk-5taem5aw.js.map +0 -10
  1182. package/dist/chunk-65abf64x.js +0 -13
  1183. package/dist/chunk-65abf64x.js.map +0 -10
  1184. package/dist/chunk-9x8dybsb.js.map +0 -10
  1185. package/dist/chunk-aqyjb86c.js +0 -587
  1186. package/dist/chunk-aqyjb86c.js.map +0 -18
  1187. package/dist/chunk-az47zep4.js +0 -41
  1188. package/dist/chunk-az47zep4.js.map +0 -10
  1189. package/dist/chunk-cb21tx14.js.map +0 -71
  1190. package/dist/chunk-djs3hw9p.js.map +0 -20
  1191. package/dist/chunk-e5wf5vz0.js.map +0 -10
  1192. package/dist/chunk-e6xgz4h4.js.map +0 -21
  1193. package/dist/chunk-e7v3trpz.js.map +0 -10
  1194. package/dist/chunk-edx8xcsm.js.map +0 -13
  1195. package/dist/chunk-epyfm23v.js +0 -299
  1196. package/dist/chunk-epyfm23v.js.map +0 -11
  1197. package/dist/chunk-fb3feg1e.js +0 -298
  1198. package/dist/chunk-fb3feg1e.js.map +0 -12
  1199. package/dist/chunk-fg1db9xx.js.map +0 -10
  1200. package/dist/chunk-h05rg3bx.js +0 -314
  1201. package/dist/chunk-h05rg3bx.js.map +0 -12
  1202. package/dist/chunk-hz5d43gn.js.map +0 -10
  1203. package/dist/chunk-jbw70d6t.js.map +0 -10
  1204. package/dist/chunk-jftd33rc.js.map +0 -11
  1205. package/dist/chunk-jk97v21j.js.map +0 -10
  1206. package/dist/chunk-jspskey0.js.map +0 -10
  1207. package/dist/chunk-kfee1h52.js.map +0 -13
  1208. package/dist/chunk-ks87m383.js.map +0 -44
  1209. package/dist/chunk-kwfhd1g0.js +0 -144
  1210. package/dist/chunk-kwfhd1g0.js.map +0 -13
  1211. package/dist/chunk-nz7815t3.js.map +0 -14
  1212. package/dist/chunk-ratj7t3t.js.map +0 -45
  1213. package/dist/chunk-s3we74h8.js.map +0 -12
  1214. package/dist/chunk-scyq22td.js.map +0 -12
  1215. package/dist/chunk-t9xyr7y9.js.map +0 -22
  1216. package/dist/chunk-tvbmh7tj.js.map +0 -18
  1217. package/dist/chunk-tvefbgvw.js.map +0 -11
  1218. package/dist/chunk-w976a4me.js.map +0 -10
  1219. package/dist/chunk-yw9pyg66.js +0 -143
  1220. package/dist/chunk-yw9pyg66.js.map +0 -11
  1221. package/dist/chunk-z8fx5cgb.js.map +0 -11
  1222. package/dist/scheduler/runtime.d.ts +0 -40
  1223. package/dist/scheduler/runtime.d.ts.map +0 -1
  1224. package/dist/workers/unstarted-run.d.ts +0 -10
  1225. package/dist/workers/unstarted-run.d.ts.map +0 -1
  1226. package/src/scheduler/runtime.ts +0 -214
  1227. package/src/workers/unstarted-run.ts +0 -18
  1228. /package/dist/{chunk-2pk5hjj9.js.map → chunk-186k5yz3.js.map} +0 -0
  1229. /package/dist/{chunk-nghc7eq0.js.map → chunk-3723kgba.js.map} +0 -0
  1230. /package/dist/{chunk-ytzcxtpt.js.map → chunk-3ba89vm7.js.map} +0 -0
  1231. /package/dist/{chunk-qsg8rw04.js.map → chunk-5qqmndhm.js.map} +0 -0
  1232. /package/dist/{chunk-8wsjr52f.js.map → chunk-7qe46788.js.map} +0 -0
  1233. /package/dist/{chunk-23s66j86.js.map → chunk-855w9nvw.js.map} +0 -0
  1234. /package/dist/{chunk-qbrmpgvv.js.map → chunk-8tqnsx3q.js.map} +0 -0
  1235. /package/dist/{chunk-s038wa5v.js.map → chunk-b9qfh2ya.js.map} +0 -0
  1236. /package/dist/{chunk-7hd2ez3q.js.map → chunk-c4nrycdy.js.map} +0 -0
  1237. /package/dist/{chunk-jjmggm9a.js.map → chunk-fe6r7yhg.js.map} +0 -0
  1238. /package/dist/{chunk-165c9wm6.js.map → chunk-g2ph4873.js.map} +0 -0
  1239. /package/dist/{chunk-jhbk10wf.js.map → chunk-q9nkpr8k.js.map} +0 -0
  1240. /package/dist/{chunk-4zm1k3xj.js.map → chunk-r2psmn42.js.map} +0 -0
  1241. /package/dist/{chunk-r1cxq7vv.js.map → chunk-rtdrm592.js.map} +0 -0
  1242. /package/dist/{chunk-m3qe54bb.js.map → chunk-smnt672s.js.map} +0 -0
  1243. /package/dist/{chunk-21q0j5f2.js.map → chunk-stmxh0hv.js.map} +0 -0
  1244. /package/dist/{chunk-ff5xkv0p.js.map → chunk-tfzvjdms.js.map} +0 -0
  1245. /package/dist/{chunk-6b61s40c.js.map → chunk-w3t94hm6.js.map} +0 -0
  1246. /package/dist/{chunk-agn8d8ys.js.map → chunk-xtztwpkh.js.map} +0 -0
  1247. /package/dist/{chunk-0g5nyx0k.js.map → chunk-zeykm8my.js.map} +0 -0
@@ -6,25 +6,26 @@ import {
6
6
  createSixbError2,
7
7
  toSixbFailure2,
8
8
  parseSixbFailure2
9
- } from "./chunk-escedwyt.js";
9
+ } from "./chunk-mvz89age.js";
10
10
  import {
11
11
  vectorSources,
12
12
  hasVectorProfile2,
13
13
  linkTargetObjectTypeIds,
14
14
  linkEndpointObjectTypeIds2,
15
+ viewConditionKeys,
15
16
  paginate,
16
17
  InMemoryAuthStorage2,
17
18
  principalsEqual2
18
- } from "./chunk-3x3bebz7.js";
19
+ } from "./chunk-0k3r5kb3.js";
19
20
  import {
20
21
  ObjectReadLimitExceededError2,
21
22
  snapshotObjectReadExecutionLimits2,
22
23
  assertObjectReadFacetCount2,
23
24
  assertObjectReadOutputWithinLimit2
24
- } from "./chunk-dz7a4t3a.js";
25
+ } from "./chunk-vzkxqf8h.js";
25
26
  import {
26
27
  assertObjectReaderProject2
27
- } from "./chunk-31khg3g0.js";
28
+ } from "./chunk-rt9deb92.js";
28
29
  import {
29
30
  UNIQUE_VALUE_KEY_VERSION,
30
31
  uniquePropertiesOf,
@@ -32,7 +33,7 @@ import {
32
33
  queryScalarKindForSchema,
33
34
  resolvePropertyQueryCapabilities2,
34
35
  resolveQuerySchema
35
- } from "./chunk-djs3hw9p.js";
36
+ } from "./chunk-3zagkr6w.js";
36
37
  import {
37
38
  createEventId2
38
39
  } from "./chunk-zrvhsq7f.js";
@@ -49,6 +50,8 @@ import {
49
50
  assertAgentThreadComputer2,
50
51
  assertComputerPlace2,
51
52
  assertAgentComputerSession2,
53
+ assertAgentBackgroundCommandRef2,
54
+ withStopRequest2,
52
55
  assertAssignableComputer2,
53
56
  assertMovableToCloud2,
54
57
  assertTurnInThreadPlace2,
@@ -85,7 +88,7 @@ import {
85
88
  assertAgentApprovalCaller2,
86
89
  newAgentApprovalRecord2,
87
90
  agentApprovalMatches2
88
- } from "./chunk-edx8xcsm.js";
91
+ } from "./chunk-7z5rkf0m.js";
89
92
  import {
90
93
  InMemoryAiUsageStorage2,
91
94
  buildAiAccountingOverview,
@@ -94,7 +97,7 @@ import {
94
97
  buildAiModelCallGroups,
95
98
  normalizeAiModelCallCostRecord2,
96
99
  aiModelCallCostMatchesUsage2
97
- } from "./chunk-0g5nyx0k.js";
100
+ } from "./chunk-zeykm8my.js";
98
101
  import {
99
102
  AiLimitStorageError2,
100
103
  aiLimitCalendarMonth2,
@@ -120,14 +123,18 @@ import {
120
123
  cloneAiLimitPolicy2,
121
124
  assertNonBlank2,
122
125
  cloneValidDate2
123
- } from "./chunk-7hd2ez3q.js";
126
+ } from "./chunk-c4nrycdy.js";
127
+ import {
128
+ DurableDatasetIngestStorage2,
129
+ initialDatasetIngestState2
130
+ } from "./chunk-pk539cwv.js";
124
131
  import {
125
132
  isAbandonedFileUploadSession,
126
133
  shouldDeleteFileUploadSession
127
134
  } from "./chunk-h89wz928.js";
128
135
  import {
129
136
  DurableFileUploadSessions2
130
- } from "./chunk-23s66j86.js";
137
+ } from "./chunk-855w9nvw.js";
131
138
  import {
132
139
  actionSubjectsEqual,
133
140
  normalizeRecordActionRunInput2,
@@ -139,6 +146,8 @@ import {
139
146
  planActivityAppend2,
140
147
  activityCalendarDays2,
141
148
  activityDay,
149
+ turnUndoable2,
150
+ othersCommented2,
142
151
  artifactStateBytes2,
143
152
  checkArtifactStateWrite2,
144
153
  artifactStorageErrors2,
@@ -149,7 +158,11 @@ import {
149
158
  canFinishSyncRun2,
150
159
  createTransactionStorageProxy2,
151
160
  throwNestedStorageTransaction2
152
- } from "./chunk-e6xgz4h4.js";
161
+ } from "./chunk-3014rfjz.js";
162
+ import {
163
+ ARTIFACT_RESTORE_POINTS2,
164
+ ARTIFACT_COMMENT_LIMITS2
165
+ } from "./chunk-9vsc919v.js";
153
166
  import {
154
167
  ExecutionStorageError2,
155
168
  prepareExecutionRecord2,
@@ -210,7 +223,7 @@ import {
210
223
  assertSourceStagedRow2,
211
224
  isExactStagingManifest2,
212
225
  sourceConflict2
213
- } from "./chunk-nz7815t3.js";
226
+ } from "./chunk-e0hnbb1m.js";
214
227
  import {
215
228
  createStorageOperationScope2,
216
229
  createOperationScopedFacade2,
@@ -220,10 +233,17 @@ import {
220
233
  createObjectOperationScope2,
221
234
  createWorkflowRunOperationScope2
222
235
  } from "./chunk-s7xqfxs9.js";
236
+ import {
237
+ planRunClaim2,
238
+ selectLostRuns,
239
+ laterLease2,
240
+ holdsRun2,
241
+ mayFinishRun2
242
+ } from "./chunk-3sgvd10b.js";
223
243
  import {
224
244
  PipelineRunError2,
225
245
  assertPipelineRunExecution2
226
- } from "./chunk-mmagke4x.js";
246
+ } from "./chunk-22d3qg4x.js";
227
247
  import {
228
248
  projectionRunObjectTypesVisible2
229
249
  } from "./chunk-hn2r7z41.js";
@@ -254,7 +274,7 @@ import {
254
274
  assertProjectionMissingTarget2,
255
275
  requireTelemetryProjectionRun2,
256
276
  assertProjectionRunDurableExecution2
257
- } from "./chunk-scyq22td.js";
277
+ } from "./chunk-5rqqp8cr.js";
258
278
  import {
259
279
  SyncRunError2,
260
280
  assertSyncRunExecution2
@@ -267,7 +287,7 @@ import {
267
287
  WorkflowRunError2,
268
288
  assertWorkflowRunExecution2,
269
289
  assertWorkflowAgentNodeRunExecution2
270
- } from "./chunk-neftrg0n.js";
290
+ } from "./chunk-p351afzm.js";
271
291
  import {
272
292
  ShareGrantStorageError2,
273
293
  normalizeShareGrantCreate2,
@@ -276,26 +296,30 @@ import {
276
296
  normalizeListShareGrantsInput2,
277
297
  normalizeRevokeShareGrantInput2,
278
298
  cloneShareGrantRecord2
279
- } from "./chunk-2pk5hjj9.js";
299
+ } from "./chunk-186k5yz3.js";
280
300
  import {
281
301
  ShareSessionStorageError2,
282
302
  normalizeShareSessionCreate2,
283
303
  parseShareSessionRecord2,
284
304
  normalizeGetShareSessionByIdInput2,
285
305
  normalizeRenewShareSessionIfValidInput2,
306
+ normalizeSetShareSessionGuestNameInput2,
286
307
  normalizeRevokeShareSessionInput2,
287
308
  cloneShareSessionRecord2
288
- } from "./chunk-z8fx5cgb.js";
289
- import {
290
- ActionRunError2
291
- } from "./chunk-3gbefjg5.js";
309
+ } from "./chunk-j2zm215x.js";
292
310
  import {
293
311
  ConnectorConnectionStorageError2,
294
312
  CONNECTOR_CONNECTION_RUN_FAILURE_CODES2
295
313
  } from "./chunk-2c4j899j.js";
314
+ import {
315
+ ActionRunError2
316
+ } from "./chunk-3gbefjg5.js";
296
317
  import {
297
318
  assertPinnedDatasetWatermark2
298
319
  } from "./chunk-n8q5j6y5.js";
320
+ import {
321
+ sameConnectorConnectionOwner
322
+ } from "./chunk-pvpq483h.js";
299
323
  import {
300
324
  MaterializationValidationError2,
301
325
  UniqueValueViolationError2,
@@ -307,10 +331,11 @@ import {
307
331
  import {
308
332
  AGENT_RUN_FAILURE_CODES2,
309
333
  AGENT_TOKEN_RATE_SAMPLES2
310
- } from "./chunk-jk97v21j.js";
334
+ } from "./chunk-n4zzaf6q.js";
311
335
  import {
312
336
  cloneJsonValue2,
313
- stableJsonStringify2
337
+ stableJsonStringify2,
338
+ compareStrings
314
339
  } from "./chunk-wy0qdqfm.js";
315
340
  // src/storage/action-runs/in-memory.ts
316
341
  var runDirectly = async (run) => run();
@@ -1318,7 +1343,22 @@ class InMemoryAgentComputerSessionStore {
1318
1343
  sessions = new Map;
1319
1344
  async hold(input) {
1320
1345
  assertAgentComputerSession2(input);
1321
- this.sessions.set(sessionKey(input), clone(input));
1346
+ const { backgroundCommands, ...session } = input;
1347
+ const stopRequests = this.sessions.get(sessionKey(input))?.stopRequests;
1348
+ this.sessions.set(sessionKey(input), clone({
1349
+ ...session,
1350
+ ...backgroundCommands?.length ? { backgroundCommands } : {},
1351
+ ...stopRequests?.length ? { stopRequests } : {}
1352
+ }));
1353
+ }
1354
+ async requestStop(input) {
1355
+ assertAgentBackgroundCommandRef2(input.command);
1356
+ const held = this.sessions.get(sessionKey(input));
1357
+ if (!held)
1358
+ return null;
1359
+ const next = { ...held, stopRequests: withStopRequest2(held.stopRequests ?? [], input.command) };
1360
+ this.sessions.set(sessionKey(input), clone(next));
1361
+ return clone(next);
1322
1362
  }
1323
1363
  async release(input) {
1324
1364
  const held = this.sessions.get(sessionKey(input)) ?? null;
@@ -2077,7 +2117,7 @@ class InMemoryConnectorConnectionStorage2 {
2077
2117
  if (input.connectionRunId !== undefined) {
2078
2118
  const run = this.connectionRuns.get(input.connectionRunId);
2079
2119
  const existingAttempt = this.findAuthorizationAttemptByConnectionRunId(input.connectionRunId);
2080
- if (!run || existingAttempt || run.projectId !== input.projectId || run.connectorId !== input.connectorId || run.status !== "waiting" || run.waitingFor !== "provider_authorization" || run.slot !== input.slot || run.initiatedByExecutionId !== input.initiatedByExecutionId) {
2120
+ if (!run || existingAttempt || run.projectId !== input.projectId || run.connectorId !== input.connectorId || run.status !== "waiting" || run.waitingFor !== "provider_authorization" || !sameConnectorConnectionOwner(run.owner, input.owner) || run.slot !== input.slot || run.initiatedByExecutionId !== input.initiatedByExecutionId) {
2081
2121
  throw new ConnectorConnectionStorageError2("attempt_conflict", "[Sixb] Connector authorization attempt does not match its connection run.");
2082
2122
  }
2083
2123
  }
@@ -2174,7 +2214,7 @@ class InMemoryConnectorConnectionStorage2 {
2174
2214
  return null;
2175
2215
  }
2176
2216
  const run = this.connectionRuns.get(attempt.connectionRunId);
2177
- if (!run || run.projectId !== input.projectId || run.connectorId !== attempt.connectorId || run.status !== "waiting" || run.waitingFor !== "provider_authorization" || run.slot !== attempt.slot || run.initiatedByExecutionId !== attempt.initiatedByExecutionId) {
2217
+ if (!run || run.projectId !== input.projectId || run.connectorId !== attempt.connectorId || run.status !== "waiting" || run.waitingFor !== "provider_authorization" || !sameConnectorConnectionOwner(run.owner, attempt.owner) || run.slot !== attempt.slot || run.initiatedByExecutionId !== attempt.initiatedByExecutionId) {
2178
2218
  return null;
2179
2219
  }
2180
2220
  const now = this.now();
@@ -2588,7 +2628,7 @@ class InMemoryConnectorConnectionStorage2 {
2588
2628
  }
2589
2629
  const existing = this.findConnectionRecord(input);
2590
2630
  const sameAccount = existing?.account.id === account.id;
2591
- if (existing && !sameAccount && !input.replace) {
2631
+ if (existing?.status === "connected" && !sameAccount && !input.replace) {
2592
2632
  throw new ConnectorConnectionStorageError2("connection_conflict", `[Sixb] Connector slot '${input.slot}' is already connected to another account; explicit replacement is required.`);
2593
2633
  }
2594
2634
  if (!existing && this.connections.has(input.id)) {
@@ -2647,7 +2687,7 @@ class InMemoryConnectorConnectionStorage2 {
2647
2687
  authorization: structuredClone(updatedAuthorization),
2648
2688
  ...revocationPendingAuthorizationId === undefined ? {} : { revocationPendingAuthorizationId },
2649
2689
  created: existing === undefined,
2650
- replaced: existing !== undefined && !sameAccount
2690
+ replaced: existing?.status === "connected" && !sameAccount
2651
2691
  };
2652
2692
  }
2653
2693
  async getConnection(input) {
@@ -2743,7 +2783,7 @@ class InMemoryConnectorConnectionStorage2 {
2743
2783
  }
2744
2784
  findConnectionRecord(input) {
2745
2785
  for (const connection of this.connections.values()) {
2746
- if (connection.projectId === input.projectId && connection.connectorId === input.connectorId && connection.owner.type === input.owner.type && connection.slot === input.slot) {
2786
+ if (connection.projectId === input.projectId && connection.connectorId === input.connectorId && sameConnectorConnectionOwner(connection.owner, input.owner) && connection.slot === input.slot) {
2747
2787
  return connection;
2748
2788
  }
2749
2789
  }
@@ -2880,6 +2920,165 @@ function applyStagedCredentials(record, staged, now, input) {
2880
2920
  updatedAt: now
2881
2921
  };
2882
2922
  }
2923
+ // src/storage/dataset-ingest/in-memory.ts
2924
+ class InMemoryDatasetIngestStorage2 extends DurableDatasetIngestStorage2 {
2925
+ data;
2926
+ constructor() {
2927
+ const data = { nextId: 1n, deliveries: new Map, states: new Map };
2928
+ super(new InMemoryDatasetIngestBackend(data));
2929
+ this.data = data;
2930
+ }
2931
+ snapshot() {
2932
+ return structuredClone(this.data);
2933
+ }
2934
+ restore(snapshot) {
2935
+ const copy = structuredClone(snapshot);
2936
+ this.data.nextId = copy.nextId;
2937
+ replaceEntries(this.data.deliveries, copy.deliveries);
2938
+ replaceEntries(this.data.states, copy.states);
2939
+ }
2940
+ }
2941
+
2942
+ class InMemoryDatasetIngestBackend {
2943
+ persistence;
2944
+ tail = Promise.resolve();
2945
+ constructor(data) {
2946
+ this.persistence = new InMemoryDatasetIngestPersistence(data);
2947
+ }
2948
+ read(run) {
2949
+ return run(this.persistence);
2950
+ }
2951
+ transaction(run) {
2952
+ const result = this.tail.then(() => run(this.persistence));
2953
+ this.tail = result.catch(() => {
2954
+ return;
2955
+ });
2956
+ return result;
2957
+ }
2958
+ }
2959
+
2960
+ class InMemoryDatasetIngestPersistence {
2961
+ data;
2962
+ constructor(data) {
2963
+ this.data = data;
2964
+ }
2965
+ async now() {
2966
+ return new Date;
2967
+ }
2968
+ async lockState(projectId, datasetId) {
2969
+ return this.data.states.get(stateKey(projectId, datasetId)) ?? initialDatasetIngestState2(datasetId);
2970
+ }
2971
+ async writeState(projectId, state) {
2972
+ this.data.states.set(stateKey(projectId, state.datasetId), state);
2973
+ }
2974
+ async insertDelivery(projectId, record) {
2975
+ const id = this.data.nextId;
2976
+ this.data.nextId += 1n;
2977
+ this.data.deliveries.set(id, { ...record, projectId, id, flushId: null });
2978
+ return id.toString();
2979
+ }
2980
+ async listUntaken(projectId, datasetId, limit) {
2981
+ return this.deliveriesOf(projectId, datasetId).filter((delivery) => delivery.flushId === null && !delivery.rejection).slice(0, limit).map(toDelivery);
2982
+ }
2983
+ async take(projectId, datasetId, deliveryIds, flushId) {
2984
+ for (const id of deliveryIds) {
2985
+ const delivery = this.data.deliveries.get(BigInt(id));
2986
+ if (delivery?.projectId === projectId && delivery.datasetId === datasetId) {
2987
+ this.data.deliveries.set(delivery.id, { ...delivery, flushId });
2988
+ }
2989
+ }
2990
+ }
2991
+ async listFlush(projectId, datasetId, flushId) {
2992
+ return this.flushOf(projectId, datasetId, flushId).map(toDelivery);
2993
+ }
2994
+ async readFlush(projectId, datasetId, flushId, page) {
2995
+ const afterId = page.afterId === null ? 0n : BigInt(page.afterId);
2996
+ return this.flushOf(projectId, datasetId, flushId).filter((delivery) => delivery.id > afterId).slice(0, page.limit).map((delivery) => ({ delivery: toDelivery(delivery), changes: delivery.changes }));
2997
+ }
2998
+ async deleteFlush(projectId, datasetId, flushId) {
2999
+ for (const delivery of this.flushOf(projectId, datasetId, flushId)) {
3000
+ this.data.deliveries.delete(delivery.id);
3001
+ }
3002
+ }
3003
+ async rejectDelivery(projectId, datasetId, flushId, deliveryId, rejection) {
3004
+ for (const delivery of this.flushOf(projectId, datasetId, flushId)) {
3005
+ if (delivery.id.toString() === deliveryId) {
3006
+ this.data.deliveries.set(delivery.id, { ...delivery, flushId: null, rejection });
3007
+ }
3008
+ }
3009
+ }
3010
+ async listRejected(projectId, datasetId, limit) {
3011
+ const records = [];
3012
+ for (const stored of this.data.deliveries.values()) {
3013
+ if (stored.projectId !== projectId || !stored.rejection)
3014
+ continue;
3015
+ if (datasetId !== undefined && stored.datasetId !== datasetId)
3016
+ continue;
3017
+ records.push({ delivery: toDelivery(stored), ...stored.rejection, changes: stored.changes });
3018
+ }
3019
+ return records.sort((left, right) => right.rejectedAt.getTime() - left.rejectedAt.getTime()).slice(0, limit);
3020
+ }
3021
+ async deleteRejected(projectId, before) {
3022
+ for (const delivery of [...this.data.deliveries.values()]) {
3023
+ if (delivery.projectId === projectId && delivery.rejection && delivery.rejection.rejectedAt < before) {
3024
+ this.data.deliveries.delete(delivery.id);
3025
+ }
3026
+ }
3027
+ }
3028
+ async listStates(projectId, datasetIds) {
3029
+ const wanted = datasetIds === undefined ? null : new Set(datasetIds);
3030
+ return [...this.data.states.entries()].filter(([key]) => key.startsWith(`${projectId}\x00`)).map(([, state]) => state).filter((state) => wanted === null || wanted.has(state.datasetId));
3031
+ }
3032
+ async countPending(projectId, datasetIds) {
3033
+ const wanted = datasetIds === undefined ? null : new Set(datasetIds);
3034
+ const counts = new Map;
3035
+ for (const delivery of this.data.deliveries.values()) {
3036
+ if (delivery.projectId !== projectId)
3037
+ continue;
3038
+ if (wanted !== null && !wanted.has(delivery.datasetId))
3039
+ continue;
3040
+ const current = counts.get(delivery.datasetId) ?? {
3041
+ datasetId: delivery.datasetId,
3042
+ pendingDeliveries: 0,
3043
+ pendingChanges: 0,
3044
+ oldestReceivedAt: null,
3045
+ rejectedDeliveries: 0
3046
+ };
3047
+ counts.set(delivery.datasetId, delivery.rejection ? { ...current, rejectedDeliveries: current.rejectedDeliveries + 1 } : {
3048
+ ...current,
3049
+ pendingDeliveries: current.pendingDeliveries + 1,
3050
+ pendingChanges: current.pendingChanges + delivery.changeCount,
3051
+ oldestReceivedAt: current.oldestReceivedAt && current.oldestReceivedAt <= delivery.receivedAt ? current.oldestReceivedAt : delivery.receivedAt
3052
+ });
3053
+ }
3054
+ return [...counts.values()];
3055
+ }
3056
+ deliveriesOf(projectId, datasetId) {
3057
+ return [...this.data.deliveries.values()].filter((delivery) => delivery.projectId === projectId && delivery.datasetId === datasetId).sort((left, right) => left.id < right.id ? -1 : 1);
3058
+ }
3059
+ flushOf(projectId, datasetId, flushId) {
3060
+ return this.deliveriesOf(projectId, datasetId).filter((delivery) => delivery.flushId === flushId);
3061
+ }
3062
+ }
3063
+ function toDelivery(stored) {
3064
+ return {
3065
+ id: stored.id.toString(),
3066
+ datasetId: stored.datasetId,
3067
+ executionId: stored.executionId,
3068
+ correlationId: stored.correlationId,
3069
+ receivedAt: stored.receivedAt,
3070
+ changeCount: stored.changeCount,
3071
+ definitionHash: stored.definitionHash
3072
+ };
3073
+ }
3074
+ function stateKey(projectId, datasetId) {
3075
+ return `${projectId}\x00${datasetId}`;
3076
+ }
3077
+ function replaceEntries(target, source) {
3078
+ target.clear();
3079
+ for (const [key, value] of source)
3080
+ target.set(key, value);
3081
+ }
2883
3082
  // src/storage/file-upload-sessions/in-memory.ts
2884
3083
  class InMemoryFileUploadSessions2 extends DurableFileUploadSessions2 {
2885
3084
  sessionsById;
@@ -3183,11 +3382,18 @@ class InMemoryArtifactStorage {
3183
3382
  artifacts = new Map;
3184
3383
  frameGrants = new Map;
3185
3384
  state = new Map;
3385
+ boardPreviews = new Map;
3186
3386
  async create(input) {
3187
3387
  const key = artifactKey(input.projectId, input.id);
3188
3388
  if (this.artifacts.has(key))
3189
3389
  throw artifactStorageErrors2.exists(input.id);
3190
- const version = versionRecord(input.projectId, input.id, 1, input.version);
3390
+ const content = input.version;
3391
+ const version = versionRecord(input.projectId, input.id, {
3392
+ version: 1,
3393
+ revision: 1,
3394
+ content,
3395
+ createdAt: content.updatedAt
3396
+ });
3191
3397
  const record = {
3192
3398
  projectId: input.projectId,
3193
3399
  id: input.id,
@@ -3195,16 +3401,22 @@ class InMemoryArtifactStorage {
3195
3401
  title: version.title,
3196
3402
  owner: { ...input.owner },
3197
3403
  latestVersion: 1,
3198
- createdAt: new Date(version.createdAt),
3199
- updatedAt: new Date(version.createdAt)
3404
+ revision: 1,
3405
+ createdAt: new Date(content.updatedAt),
3406
+ updatedAt: new Date(content.updatedAt),
3407
+ ...input.document ? { document: { file: structuredClone(input.document), revision: 1 } } : {}
3200
3408
  };
3201
- this.artifacts.set(key, {
3409
+ const stored = turnWrote(sharedIn({
3202
3410
  record,
3203
3411
  versions: [version],
3204
3412
  nextVersion: 2,
3205
- threads: sharedIn(new Map, version)
3206
- });
3207
- return published(record, version);
3413
+ threads: new Map,
3414
+ restorePoints: [],
3415
+ turnWrites: new Map,
3416
+ comments: []
3417
+ }, content, input.turnRunId), input.turnRunId, { created: true });
3418
+ this.artifacts.set(key, stored);
3419
+ return published(stored);
3208
3420
  }
3209
3421
  async publish(input) {
3210
3422
  const key = artifactKey(input.projectId, input.artifactId);
@@ -3214,27 +3426,121 @@ class InMemoryArtifactStorage {
3214
3426
  if (stored.record.kind !== input.kind) {
3215
3427
  throw artifactStorageErrors2.kindMismatch(input.artifactId, stored.record.kind, input.kind);
3216
3428
  }
3217
- const latest = stored.versions.find((candidate) => candidate.version === stored.record.latestVersion);
3218
- if (input.baseVersion !== undefined && latest && latest.version !== input.baseVersion) {
3219
- throw artifactStorageErrors2.moved(input.artifactId, input.baseVersion, {
3220
- version: latest.version,
3221
- author: structuredClone(latest.author)
3429
+ assertBase(stored, input.baseRevision);
3430
+ const { turnRunId } = input;
3431
+ const firstOfTurn = turnRunId !== undefined && !stored.turnWrites.has(turnRunId);
3432
+ const kept = firstOfTurn ? withRestorePoint(stored, {
3433
+ reason: "turn",
3434
+ turnRunId,
3435
+ createdAt: input.version.updatedAt
3436
+ }) : stored;
3437
+ const next = turnWrote(sharedIn(written(kept, input.version, input.document), input.version, turnRunId), turnRunId, { created: false });
3438
+ this.artifacts.set(key, next);
3439
+ return published(next);
3440
+ }
3441
+ async freeze(input) {
3442
+ const key = artifactKey(input.projectId, input.artifactId);
3443
+ const stored = this.artifacts.get(key);
3444
+ if (!stored)
3445
+ throw artifactStorageErrors2.notFound(input.artifactId);
3446
+ const latest = latestOf(stored);
3447
+ if (latest.frozenAt)
3448
+ return published(stored);
3449
+ assertBase(stored, input.baseRevision);
3450
+ const revision = stored.record.revision + 1;
3451
+ const frozen = {
3452
+ ...latest,
3453
+ revision,
3454
+ frozenAt: new Date(input.frozenAt),
3455
+ frozenBy: structuredClone(input.frozenBy)
3456
+ };
3457
+ const { document } = stored.record;
3458
+ const next = {
3459
+ ...stored,
3460
+ record: {
3461
+ ...stored.record,
3462
+ revision,
3463
+ updatedAt: new Date(input.frozenAt),
3464
+ ...document?.revision === stored.record.revision ? { document: { ...document, revision } } : {}
3465
+ },
3466
+ versions: [...stored.versions.slice(0, -1), frozen]
3467
+ };
3468
+ this.artifacts.set(key, next);
3469
+ return published(next);
3470
+ }
3471
+ async listRestorePoints(input) {
3472
+ const stored = this.artifacts.get(artifactKey(input.projectId, input.id));
3473
+ return structuredClone([...stored?.restorePoints ?? []]);
3474
+ }
3475
+ async getRestorePoint(input) {
3476
+ const stored = this.artifacts.get(artifactKey(input.projectId, input.artifactId));
3477
+ const point = stored?.restorePoints.find((each) => each.revision === input.revision);
3478
+ return point ? structuredClone(point) : null;
3479
+ }
3480
+ async restoreTo(input) {
3481
+ const key = artifactKey(input.projectId, input.artifactId);
3482
+ const stored = this.artifacts.get(key);
3483
+ if (!stored)
3484
+ throw artifactStorageErrors2.notFound(input.artifactId);
3485
+ const point = stored.restorePoints.find((each) => each.revision === input.revision);
3486
+ if (!point)
3487
+ throw artifactStorageErrors2.restorePointNotFound(input.artifactId, input.revision);
3488
+ assertBase(stored, input.baseRevision);
3489
+ const kept = withRestorePoint(stored, { reason: "restore", createdAt: input.restoredAt });
3490
+ const next = written(kept, {
3491
+ title: point.title,
3492
+ entry: point.entry,
3493
+ files: point.files,
3494
+ outline: point.outline,
3495
+ references: point.references,
3496
+ author: input.author,
3497
+ updatedAt: input.restoredAt
3498
+ }, input.document);
3499
+ this.artifacts.set(key, next);
3500
+ return published(next);
3501
+ }
3502
+ async listTurnWrites(input) {
3503
+ const writes = [];
3504
+ for (const stored of this.artifacts.values()) {
3505
+ if (stored.record.projectId !== input.projectId)
3506
+ continue;
3507
+ const write = stored.turnWrites.get(input.turnRunId);
3508
+ if (write)
3509
+ writes.push(structuredClone(write));
3510
+ }
3511
+ return writes.sort((left, right) => left.artifactId < right.artifactId ? -1 : 1);
3512
+ }
3513
+ async undoTurnWrites(input) {
3514
+ const { turnRunId } = input;
3515
+ const restored = [];
3516
+ const deleted = [];
3517
+ for (const [key, stored] of this.artifacts) {
3518
+ if (stored.record.projectId !== input.projectId)
3519
+ continue;
3520
+ const write = stored.turnWrites.get(turnRunId);
3521
+ if (!write)
3522
+ continue;
3523
+ const revision = stored.record.revision;
3524
+ if (write.created && turnUndoable2({ write, revision }) && !othersCommented2(stored.comments, input)) {
3525
+ this.deleteArtifact(key);
3526
+ deleted.push(stored.record.id);
3527
+ continue;
3528
+ }
3529
+ const point = stored.restorePoints.find((each) => each.turnRunId === turnRunId);
3530
+ const target = point && stored.versions.find((each) => each.version === point.version);
3531
+ const untouched = !write.created && turnUndoable2({
3532
+ write,
3533
+ revision,
3534
+ ...point ? { point } : {},
3535
+ ...target ? { target: { frozen: target.frozenAt !== undefined } } : {}
3222
3536
  });
3537
+ const undone = untouched && point ? undo(stored, point, input.documents?.[stored.record.id]) : null;
3538
+ const next = forgetTurn(undone ?? stored, turnRunId, { undone: undone !== null });
3539
+ this.artifacts.set(key, next);
3540
+ if (undone)
3541
+ restored.push(published(next));
3223
3542
  }
3224
- const version = versionRecord(input.projectId, input.artifactId, stored.nextVersion, input.version);
3225
- const record = {
3226
- ...stored.record,
3227
- title: version.title,
3228
- latestVersion: version.version,
3229
- updatedAt: new Date(version.createdAt)
3230
- };
3231
- this.artifacts.set(key, {
3232
- record,
3233
- versions: [...stored.versions, version],
3234
- nextVersion: stored.nextVersion + 1,
3235
- threads: sharedIn(stored.threads, version)
3236
- });
3237
- return published(record, version);
3543
+ return { restored, deleted };
3238
3544
  }
3239
3545
  async get(input) {
3240
3546
  const stored = this.artifacts.get(artifactKey(input.projectId, input.id));
@@ -3268,13 +3574,20 @@ class InMemoryArtifactStorage {
3268
3574
  if (this.artifacts.has(key))
3269
3575
  throw artifactStorageErrors2.exists(input.id);
3270
3576
  const record = { ...source.record, id: input.id, owner: { ...input.owner } };
3271
- const versions = source.versions.map(({ origin: _origin, ...version }) => structuredClone({ ...version, artifactId: input.id }));
3577
+ const versions = source.versions.map(({ origin: _origin, ...version }) => {
3578
+ const copied = structuredClone({ ...version, artifactId: input.id });
3579
+ const outline = input.outlineOf?.(copied);
3580
+ return outline ? { ...copied, outline: structuredClone(outline) } : copied;
3581
+ });
3272
3582
  const sharedAt = new Date(input.copiedAt ?? new Date);
3273
3583
  this.artifacts.set(key, {
3274
3584
  record,
3275
3585
  versions,
3276
3586
  nextVersion: source.nextVersion,
3277
- threads: new Map([[input.threadId, { sharedAt, copied: true }]])
3587
+ threads: new Map([[input.threadId, { sharedAt, copied: true }]]),
3588
+ restorePoints: [],
3589
+ turnWrites: new Map,
3590
+ comments: []
3278
3591
  });
3279
3592
  return structuredClone(record);
3280
3593
  }
@@ -3284,8 +3597,8 @@ class InMemoryArtifactStorage {
3284
3597
  for (const stored of this.artifacts.values()) {
3285
3598
  if (stored.record.projectId !== input.projectId)
3286
3599
  continue;
3287
- const latest = stored.versions.find((candidate) => candidate.version === stored.record.latestVersion);
3288
- if (latest?.references.some((reference) => refersTo(reference.address, prefix))) {
3600
+ const latest = latestOf(stored);
3601
+ if (latest.references.some((reference) => refersTo(reference.address, prefix))) {
3289
3602
  referencing.push(structuredClone(latest));
3290
3603
  }
3291
3604
  }
@@ -3314,14 +3627,14 @@ class InMemoryArtifactStorage {
3314
3627
  return deleted;
3315
3628
  }
3316
3629
  async getState(input) {
3317
- const entry = this.state.get(stateKey(input))?.get(input.key);
3630
+ const entry = this.state.get(stateKey2(input))?.get(input.key);
3318
3631
  return entry ? structuredClone(entry) : null;
3319
3632
  }
3320
3633
  async setState(input) {
3321
3634
  if (!this.artifacts.has(artifactKey(input.projectId, input.artifactId))) {
3322
3635
  throw artifactStorageErrors2.notFound(input.artifactId);
3323
3636
  }
3324
- const kept = this.state.get(stateKey(input)) ?? new Map;
3637
+ const kept = this.state.get(stateKey2(input)) ?? new Map;
3325
3638
  const others = [...kept.values()].filter((entry) => entry.key !== input.key);
3326
3639
  const sizeBytes = artifactStateBytes2(input.value);
3327
3640
  checkArtifactStateWrite2({
@@ -3338,61 +3651,120 @@ class InMemoryArtifactStorage {
3338
3651
  sizeBytes,
3339
3652
  updatedAt: new Date(input.updatedAt)
3340
3653
  });
3341
- this.state.set(stateKey(input), kept);
3654
+ this.state.set(stateKey2(input), kept);
3342
3655
  }
3343
3656
  async deleteState(input) {
3344
- return this.state.get(stateKey(input))?.delete(input.key) ?? false;
3657
+ return this.state.get(stateKey2(input))?.delete(input.key) ?? false;
3345
3658
  }
3346
3659
  async listState(input) {
3347
- const kept = [...this.state.get(stateKey(input))?.values() ?? []];
3660
+ const kept = [...this.state.get(stateKey2(input))?.values() ?? []];
3348
3661
  return structuredClone(kept.sort((left, right) => left.key < right.key ? -1 : 1));
3349
3662
  }
3350
3663
  async clearState(input) {
3351
- const count = this.state.get(stateKey(input))?.size ?? 0;
3352
- this.state.delete(stateKey(input));
3664
+ const count = this.state.get(stateKey2(input))?.size ?? 0;
3665
+ this.state.delete(stateKey2(input));
3353
3666
  return count;
3354
3667
  }
3355
- async delete(input) {
3356
- return this.deleteArtifact(artifactKey(input.projectId, input.id));
3668
+ async listBoardPreviews(input) {
3669
+ const keys = new Set(input.renderKeys);
3670
+ const kept = [...this.boardPreviews.values()].filter((preview) => preview.projectId === input.projectId && keys.has(preview.renderKey));
3671
+ const order = (preview) => `${preview.renderKey}\x00${preview.theme}\x00${preview.size}`;
3672
+ return structuredClone(kept.sort((left, right) => order(left) < order(right) ? -1 : 1));
3357
3673
  }
3358
- async deleteVersionsByOrigin(input) {
3359
- let deleted = 0;
3360
- for (const [key, stored] of this.artifacts) {
3361
- if (stored.record.projectId !== input.projectId)
3362
- continue;
3363
- const remaining = stored.versions.filter((version) => version.origin?.runId !== input.runId);
3364
- if (remaining.length === stored.versions.length)
3365
- continue;
3366
- deleted += stored.versions.length - remaining.length;
3367
- const latest = remaining.at(-1);
3368
- if (!latest) {
3369
- this.deleteArtifact(key);
3674
+ async putBoardPreviews(input) {
3675
+ for (const preview of input.previews) {
3676
+ const key = `${input.projectId}\x00${preview.renderKey}\x00${preview.theme}\x00${preview.size}`;
3677
+ if (this.boardPreviews.has(key))
3370
3678
  continue;
3679
+ this.boardPreviews.set(key, structuredClone({ projectId: input.projectId, ...preview }));
3680
+ }
3681
+ }
3682
+ async createComment(input) {
3683
+ const key = artifactKey(input.projectId, input.artifactId);
3684
+ const stored = this.artifacts.get(key);
3685
+ if (!stored)
3686
+ throw artifactStorageErrors2.notFound(input.artifactId);
3687
+ if (input.parentId !== undefined) {
3688
+ const parent = stored.comments.find((each) => each.id === input.parentId);
3689
+ if (!parent || parent.parentId !== undefined) {
3690
+ throw artifactStorageErrors2.commentNotFound(input.artifactId, input.parentId);
3371
3691
  }
3372
- const threadId = stored.versions.find((version) => version.origin?.runId === input.runId)?.origin?.threadId;
3373
- const threads = new Map(stored.threads);
3374
- if (threadId && !threads.get(threadId)?.copied && !remaining.some((version) => version.origin?.threadId === threadId)) {
3375
- threads.delete(threadId);
3376
- }
3377
- this.artifacts.set(key, {
3378
- ...stored,
3379
- record: {
3380
- ...stored.record,
3381
- title: latest.title,
3382
- latestVersion: latest.version,
3383
- updatedAt: new Date(latest.createdAt)
3384
- },
3385
- versions: remaining,
3386
- threads
3387
- });
3388
3692
  }
3389
- return deleted;
3693
+ if (stored.comments.length >= ARTIFACT_COMMENT_LIMITS2.maxComments) {
3694
+ throw artifactStorageErrors2.commentsFull(input.artifactId);
3695
+ }
3696
+ const guests = stored.comments.filter((each) => each.author.type === "guest").length;
3697
+ if (input.author.type === "guest" && guests >= ARTIFACT_COMMENT_LIMITS2.maxGuestComments) {
3698
+ throw artifactStorageErrors2.guestCommentsFull(input.artifactId);
3699
+ }
3700
+ const comment = structuredClone({
3701
+ projectId: input.projectId,
3702
+ artifactId: input.artifactId,
3703
+ id: input.id,
3704
+ ...input.parentId === undefined ? {} : { parentId: input.parentId },
3705
+ anchor: {
3706
+ ...input.anchor.board === undefined ? {} : { board: input.anchor.board },
3707
+ ...input.anchor.element === undefined ? {} : { element: input.anchor.element },
3708
+ ...input.anchor.label === undefined ? {} : { label: input.anchor.label },
3709
+ ...input.anchor.point === undefined ? {} : { point: { x: input.anchor.point.x, y: input.anchor.point.y } },
3710
+ revision: input.anchor.revision
3711
+ },
3712
+ body: input.body,
3713
+ author: input.author.type === "guest" ? { type: "guest", id: input.author.id, name: input.author.name } : { type: input.author.type, id: input.author.id },
3714
+ ...input.origin ? { origin: { threadId: input.origin.threadId, runId: input.origin.runId } } : {},
3715
+ createdAt: input.createdAt
3716
+ });
3717
+ this.artifacts.set(key, { ...stored, comments: [...stored.comments, comment] });
3718
+ return structuredClone(comment);
3719
+ }
3720
+ async getComment(input) {
3721
+ const stored = this.artifacts.get(artifactKey(input.projectId, input.artifactId));
3722
+ const comment = stored?.comments.find((each) => each.id === input.id);
3723
+ return comment ? structuredClone(comment) : null;
3724
+ }
3725
+ async listComments(input) {
3726
+ const stored = this.artifacts.get(artifactKey(input.projectId, input.id));
3727
+ const ordered = [...stored?.comments ?? []].sort((left, right) => left.createdAt.getTime() - right.createdAt.getTime());
3728
+ return structuredClone(ordered);
3729
+ }
3730
+ async resolveComment(input) {
3731
+ const key = artifactKey(input.projectId, input.artifactId);
3732
+ const stored = this.artifacts.get(key);
3733
+ const comment = stored?.comments.find((each) => each.id === input.id);
3734
+ if (!stored || !comment)
3735
+ return null;
3736
+ const { resolvedAt: _at, resolvedBy: _by, ...open } = comment;
3737
+ const next = input.resolved ? {
3738
+ ...open,
3739
+ resolvedAt: new Date(input.resolved.at),
3740
+ resolvedBy: structuredClone(input.resolved.by)
3741
+ } : open;
3742
+ this.artifacts.set(key, {
3743
+ ...stored,
3744
+ comments: stored.comments.map((each) => each.id === input.id ? next : each)
3745
+ });
3746
+ return structuredClone(next);
3747
+ }
3748
+ async deleteComment(input) {
3749
+ const key = artifactKey(input.projectId, input.artifactId);
3750
+ const stored = this.artifacts.get(key);
3751
+ if (!stored?.comments.some((each) => each.id === input.id))
3752
+ return false;
3753
+ this.artifacts.set(key, {
3754
+ ...stored,
3755
+ comments: stored.comments.filter((each) => each.id !== input.id && each.parentId !== input.id)
3756
+ });
3757
+ return true;
3758
+ }
3759
+ async delete(input) {
3760
+ return this.deleteArtifact(artifactKey(input.projectId, input.id));
3390
3761
  }
3391
3762
  snapshot() {
3392
3763
  return structuredClone({
3393
3764
  artifacts: this.artifacts,
3394
3765
  frameGrants: this.frameGrants,
3395
- state: this.state
3766
+ state: this.state,
3767
+ boardPreviews: this.boardPreviews
3396
3768
  });
3397
3769
  }
3398
3770
  restore(snapshot) {
@@ -3400,6 +3772,7 @@ class InMemoryArtifactStorage {
3400
3772
  this.artifacts = new Map(restored.artifacts);
3401
3773
  this.frameGrants = new Map(restored.frameGrants);
3402
3774
  this.state = new Map([...restored.state].map(([key, kept]) => [key, new Map(kept)]));
3775
+ this.boardPreviews = new Map(restored.boardPreviews);
3403
3776
  }
3404
3777
  deleteArtifact(key) {
3405
3778
  for (const [grantKey, grant] of this.frameGrants) {
@@ -3413,22 +3786,170 @@ class InMemoryArtifactStorage {
3413
3786
  return this.artifacts.delete(key);
3414
3787
  }
3415
3788
  }
3416
- function versionRecord(projectId, artifactId, version, input) {
3417
- return structuredClone({ ...input, projectId, artifactId, version });
3789
+ function latestOf(stored) {
3790
+ const latest = stored.versions.at(-1);
3791
+ if (!latest)
3792
+ throw new Error(`[Sixb] Artifact '${stored.record.id}' has no version.`);
3793
+ return latest;
3794
+ }
3795
+ function assertBase(stored, baseRevision) {
3796
+ if (baseRevision === undefined || baseRevision === stored.record.revision)
3797
+ return;
3798
+ const latest = latestOf(stored);
3799
+ throw artifactStorageErrors2.moved(stored.record.id, baseRevision, {
3800
+ version: latest.version,
3801
+ revision: latest.revision,
3802
+ author: structuredClone(latest.author),
3803
+ ...latest.frozenBy ? { frozenBy: structuredClone(latest.frozenBy) } : {}
3804
+ });
3805
+ }
3806
+ function versionRecord(projectId, artifactId, input) {
3807
+ const { content } = input;
3808
+ return structuredClone({
3809
+ projectId,
3810
+ artifactId,
3811
+ version: input.version,
3812
+ revision: input.revision,
3813
+ title: content.title,
3814
+ entry: content.entry,
3815
+ files: content.files,
3816
+ outline: content.outline,
3817
+ references: content.references,
3818
+ author: content.author,
3819
+ ...content.origin ? { origin: content.origin } : {},
3820
+ createdAt: input.createdAt,
3821
+ updatedAt: content.updatedAt
3822
+ });
3823
+ }
3824
+ function written(stored, content, document) {
3825
+ const { record } = stored;
3826
+ const latest = latestOf(stored);
3827
+ const revision = record.revision + 1;
3828
+ const opens = latest.frozenAt !== undefined;
3829
+ const version = versionRecord(record.projectId, record.id, {
3830
+ version: opens ? stored.nextVersion : latest.version,
3831
+ revision,
3832
+ content,
3833
+ createdAt: opens ? content.updatedAt : latest.createdAt
3834
+ });
3835
+ return {
3836
+ ...stored,
3837
+ record: {
3838
+ ...record,
3839
+ title: version.title,
3840
+ latestVersion: version.version,
3841
+ revision,
3842
+ updatedAt: new Date(content.updatedAt),
3843
+ ...document ? { document: { file: structuredClone(document), revision } } : {}
3844
+ },
3845
+ versions: opens ? [...stored.versions, version] : [...stored.versions.slice(0, -1), version],
3846
+ nextVersion: opens ? stored.nextVersion + 1 : stored.nextVersion
3847
+ };
3848
+ }
3849
+ function withRestorePoint(stored, input) {
3850
+ const {
3851
+ projectId,
3852
+ artifactId,
3853
+ version,
3854
+ revision,
3855
+ frozenAt,
3856
+ frozenBy: _frozenBy,
3857
+ createdAt: _,
3858
+ ...content
3859
+ } = latestOf(stored);
3860
+ const point = structuredClone({
3861
+ projectId,
3862
+ artifactId,
3863
+ revision,
3864
+ version,
3865
+ frozen: frozenAt !== undefined,
3866
+ ...content,
3867
+ reason: input.reason,
3868
+ ...input.turnRunId === undefined ? {} : { turnRunId: input.turnRunId },
3869
+ createdAt: input.createdAt
3870
+ });
3871
+ return {
3872
+ ...stored,
3873
+ restorePoints: [point, ...stored.restorePoints].slice(0, ARTIFACT_RESTORE_POINTS2)
3874
+ };
3418
3875
  }
3419
- function sharedIn(threads, version) {
3420
- const threadId = version.origin?.threadId;
3421
- if (!threadId || threads.has(threadId))
3422
- return threads;
3423
- return new Map(threads).set(threadId, { sharedAt: new Date(version.createdAt), copied: false });
3876
+ function undo(stored, point, document) {
3877
+ const versions = stored.versions.filter((version) => version.version <= point.version);
3878
+ const target = versions.at(-1);
3879
+ if (target?.version !== point.version)
3880
+ return null;
3881
+ const revision = stored.record.revision + 1;
3882
+ const version = point.frozen ? { ...target, revision } : versionRecord(target.projectId, target.artifactId, {
3883
+ version: target.version,
3884
+ revision,
3885
+ content: {
3886
+ title: point.title,
3887
+ entry: point.entry,
3888
+ files: point.files,
3889
+ outline: point.outline,
3890
+ references: point.references,
3891
+ author: point.author,
3892
+ ...point.origin ? { origin: point.origin } : {},
3893
+ updatedAt: point.updatedAt
3894
+ },
3895
+ createdAt: target.createdAt
3896
+ });
3897
+ const { record } = stored;
3898
+ return {
3899
+ ...stored,
3900
+ record: {
3901
+ ...record,
3902
+ title: version.title,
3903
+ latestVersion: version.version,
3904
+ revision,
3905
+ updatedAt: new Date(Math.max(point.updatedAt.getTime(), target.frozenAt?.getTime() ?? 0)),
3906
+ ...document ? { document: { file: structuredClone(document), revision } } : {}
3907
+ },
3908
+ versions: [...versions.slice(0, -1), version]
3909
+ };
3910
+ }
3911
+ function forgetTurn(stored, turnRunId, { undone }) {
3912
+ const turnWrites = new Map(stored.turnWrites);
3913
+ turnWrites.delete(turnRunId);
3914
+ return {
3915
+ ...stored,
3916
+ restorePoints: undone ? stored.restorePoints.filter((point) => point.turnRunId !== turnRunId) : stored.restorePoints,
3917
+ turnWrites,
3918
+ threads: undone ? new Map([...stored.threads].filter(([, link]) => link.copied || link.linkedByRunId !== turnRunId)) : stored.threads
3919
+ };
3920
+ }
3921
+ function sharedIn(stored, content, turnRunId) {
3922
+ const threadId = content.origin?.threadId;
3923
+ if (!threadId || stored.threads.has(threadId))
3924
+ return stored;
3925
+ const link = {
3926
+ sharedAt: new Date(content.updatedAt),
3927
+ copied: false,
3928
+ ...turnRunId === undefined ? {} : { linkedByRunId: turnRunId }
3929
+ };
3930
+ return { ...stored, threads: new Map(stored.threads).set(threadId, link) };
3931
+ }
3932
+ function turnWrote(stored, turnRunId, { created }) {
3933
+ if (turnRunId === undefined)
3934
+ return stored;
3935
+ const earlier = stored.turnWrites.get(turnRunId);
3936
+ const write = {
3937
+ artifactId: stored.record.id,
3938
+ created: earlier?.created ?? created,
3939
+ revision: stored.record.revision,
3940
+ writes: (earlier?.writes ?? 0) + 1
3941
+ };
3942
+ const others = [...stored.turnWrites].filter(([turn]) => turn !== turnRunId);
3943
+ const kept = [[turnRunId, write], ...others].sort(([, left], [, right]) => right.revision - left.revision).slice(0, ARTIFACT_RESTORE_POINTS2);
3944
+ return { ...stored, turnWrites: new Map(kept) };
3424
3945
  }
3425
- function published(record, version) {
3426
- return structuredClone({ artifact: record, version });
3946
+ function published(stored) {
3947
+ return structuredClone({ artifact: stored.record, version: latestOf(stored) });
3427
3948
  }
3428
3949
  function artifactKey(projectId, id) {
3429
3950
  return `${projectId}\x00${id}`;
3430
3951
  }
3431
- function stateKey(scope) {
3952
+ function stateKey2(scope) {
3432
3953
  return `${artifactKey(scope.projectId, scope.artifactId)}\x00${scope.principal.type}\x00${scope.principal.id}`;
3433
3954
  }
3434
3955
  function refersTo(address, prefix) {
@@ -3569,6 +4090,40 @@ class InMemoryFileDownloadGrantStorage {
3569
4090
  function rowKey(projectId, id) {
3570
4091
  return `${projectId}\x00${id}`;
3571
4092
  }
4093
+ // src/storage/lake-retention-runs/in-memory.ts
4094
+ class InMemoryLakeRetentionRunStorage {
4095
+ rows = new Map;
4096
+ async record(run) {
4097
+ this.rows.set(run.projectId, structuredClone(run));
4098
+ }
4099
+ async getLast(input) {
4100
+ const row = this.rows.get(input.projectId);
4101
+ return row ? structuredClone(row) : null;
4102
+ }
4103
+ snapshot() {
4104
+ return structuredClone(this.rows);
4105
+ }
4106
+ restore(snapshot) {
4107
+ this.rows = structuredClone(new Map(snapshot));
4108
+ }
4109
+ }
4110
+ // src/storage/maintenance-heartbeats/in-memory.ts
4111
+ class InMemoryMaintenanceHeartbeatStorage {
4112
+ rows = new Map;
4113
+ async record(heartbeat) {
4114
+ this.rows.set(`${heartbeat.projectId}\x00${heartbeat.owner}`, structuredClone(heartbeat));
4115
+ }
4116
+ async list(input) {
4117
+ const rows = [...this.rows.values()].filter((row) => row.projectId === input.projectId);
4118
+ return structuredClone(rows);
4119
+ }
4120
+ snapshot() {
4121
+ return structuredClone(this.rows);
4122
+ }
4123
+ restore(snapshot) {
4124
+ this.rows = structuredClone(new Map(snapshot));
4125
+ }
4126
+ }
3572
4127
  // src/storage/objects/keys.ts
3573
4128
  function objectBatchKey2(objectTypeId, primaryId) {
3574
4129
  return JSON.stringify([objectTypeId, primaryId]);
@@ -3602,7 +4157,7 @@ function compareQueryScalarValues(left, right, scalarKind) {
3602
4157
  switch (scalarKind) {
3603
4158
  case "string":
3604
4159
  case "uuid":
3605
- return typeof left === "string" && typeof right === "string" ? compareStrings(left, right) : Number.NaN;
4160
+ return typeof left === "string" && typeof right === "string" ? compareStrings2(left, right) : Number.NaN;
3606
4161
  case "boolean":
3607
4162
  return typeof left === "boolean" && typeof right === "boolean" ? Number(left) - Number(right) : Number.NaN;
3608
4163
  case "integer":
@@ -3614,6 +4169,7 @@ function compareQueryScalarValues(left, right, scalarKind) {
3614
4169
  case "timestamp":
3615
4170
  return compareTemporalValues(left, right);
3616
4171
  case "userRef":
4172
+ case "artifactRef":
3617
4173
  return Number.NaN;
3618
4174
  }
3619
4175
  }
@@ -3626,13 +4182,13 @@ function queryScalarValuesEqual(left, right, scalarKind) {
3626
4182
  const comparison = compareTemporalValues(left, right);
3627
4183
  return !Number.isNaN(comparison) && comparison === 0;
3628
4184
  }
3629
- if (scalarKind === "userRef")
3630
- return userRefsEqual(left, right);
4185
+ if (scalarKind === "userRef" || scalarKind === "artifactRef")
4186
+ return refsEqual(left, right);
3631
4187
  if (scalarKind !== undefined)
3632
4188
  return Object.is(left, right);
3633
4189
  return runtimeValuesEqual(left, right);
3634
4190
  }
3635
- function userRefsEqual(left, right) {
4191
+ function refsEqual(left, right) {
3636
4192
  if (left === null || right === null)
3637
4193
  return left === right;
3638
4194
  return isRecord(left) && isRecord(right) && left.type === right.type && typeof left.id === "string" && left.id === right.id;
@@ -3644,7 +4200,7 @@ function compareRuntimeValues(left, right) {
3644
4200
  if (typeof left === "number" && typeof right === "number")
3645
4201
  return left - right;
3646
4202
  if (typeof left === "string" && typeof right === "string")
3647
- return compareStrings(left, right);
4203
+ return compareStrings2(left, right);
3648
4204
  if (typeof left === "boolean" && typeof right === "boolean") {
3649
4205
  return Number(left) - Number(right);
3650
4206
  }
@@ -3677,7 +4233,7 @@ function dateTime(value) {
3677
4233
  }
3678
4234
  return null;
3679
4235
  }
3680
- function compareStrings(left, right) {
4236
+ function compareStrings2(left, right) {
3681
4237
  if (left === right)
3682
4238
  return 0;
3683
4239
  const length = Math.min(left.length, right.length);
@@ -3752,7 +4308,7 @@ function objectRowKey(projectId, objectTypeId) {
3752
4308
  function objectRowProjectPrefix(projectId) {
3753
4309
  return `[${JSON.stringify(projectId)},`;
3754
4310
  }
3755
- function compareStrings2(left, right) {
4311
+ function compareStrings3(left, right) {
3756
4312
  if (left < right)
3757
4313
  return -1;
3758
4314
  if (left > right)
@@ -3781,6 +4337,12 @@ function rowIdentityKeyParts(objectTypeId, primaryId) {
3781
4337
  return objectBatchKey2(objectTypeId, primaryId);
3782
4338
  }
3783
4339
 
4340
+ // src/objects/query/sort-ties.ts
4341
+ function sortTieDirection2(fields) {
4342
+ const last = fields.filter((field) => field.kind === "property").at(-1);
4343
+ return last?.direction === "desc" ? "desc" : "asc";
4344
+ }
4345
+
3784
4346
  // src/storage/objects/in-memory/query.ts
3785
4347
  var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
3786
4348
  queryObjects: true,
@@ -3837,7 +4399,8 @@ var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
3837
4399
  decimal: { equality: true, ordering: true },
3838
4400
  date: { equality: true, ordering: true },
3839
4401
  timestamp: { equality: true, ordering: true },
3840
- userRef: { equality: true }
4402
+ userRef: { equality: true },
4403
+ artifactRef: { equality: true }
3841
4404
  },
3842
4405
  limits: {
3843
4406
  totalCount: true,
@@ -3963,7 +4526,7 @@ function evaluateRefs(refs, source) {
3963
4526
  seen.add(key);
3964
4527
  const row = source.getObject(ref.objectTypeId, ref.primaryId);
3965
4528
  return row ? [row] : [];
3966
- }).sort((left, right) => compareStrings2(left.objectTypeId, right.objectTypeId) || compareStrings2(left.primaryId, right.primaryId)).map((row, order) => ({ row, score: 0, order }));
4529
+ }).sort((left, right) => compareStrings3(left.objectTypeId, right.objectTypeId) || compareStrings3(left.primaryId, right.primaryId)).map((row, order) => ({ row, score: 0, order }));
3967
4530
  return completeEvaluation(entries);
3968
4531
  }
3969
4532
  function evaluateSet(op, inputs, source) {
@@ -4096,13 +4659,15 @@ function vectorSimilarity(actual, expected) {
4096
4659
  return dot / (Math.sqrt(actualNorm) * Math.sqrt(expectedNorm));
4097
4660
  }
4098
4661
  function sortEntries(entries, fields) {
4662
+ const ties = sortTieDirection2(fields);
4099
4663
  return [...entries].sort((left, right) => {
4100
4664
  for (const field of fields) {
4101
4665
  const comparison = compareSortField(left, right, field);
4102
4666
  if (comparison !== 0)
4103
4667
  return comparison;
4104
4668
  }
4105
- return left.order - right.order || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
4669
+ const tie = left.order - right.order || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
4670
+ return ties === "desc" ? -tie : tie;
4106
4671
  });
4107
4672
  }
4108
4673
  function compareSortField(left, right, field) {
@@ -4633,6 +5198,7 @@ class InMemoryObjectStorage {
4633
5198
  links = new Map;
4634
5199
  uniqueValues = new Map;
4635
5200
  uniqueProperties = new Map;
5201
+ artifactHolders = new Map;
4636
5202
  vectorReader;
4637
5203
  constructor() {
4638
5204
  materializerAdapters.set(this, {
@@ -4683,6 +5249,20 @@ class InMemoryObjectStorage {
4683
5249
  },
4684
5250
  markUniquePropertyPrepared: (input) => {
4685
5251
  this.uniqueProperties.set(uniquePropertyKey(input.projectId, input.objectTypeId, input.propertyId), { ...input });
5252
+ },
5253
+ deleteArtifactHolder: (projectId, value) => {
5254
+ const key = artifactHoldersKey(projectId, value.artifactId);
5255
+ const holders = this.artifactHolders.get(key);
5256
+ holders?.delete(artifactHolderKey(value));
5257
+ if (holders?.size === 0)
5258
+ this.artifactHolders.delete(key);
5259
+ },
5260
+ insertArtifactHolder: (projectId, value) => {
5261
+ const key = artifactHoldersKey(projectId, value.artifactId);
5262
+ const holders = this.artifactHolders.get(key) ?? new Map;
5263
+ this.artifactHolders.set(key, holders);
5264
+ const { objectTypeId, primaryId, propertyId } = value;
5265
+ holders.set(artifactHolderKey(value), { objectTypeId, primaryId, propertyId });
4686
5266
  }
4687
5267
  });
4688
5268
  }
@@ -4691,7 +5271,8 @@ class InMemoryObjectStorage {
4691
5271
  rows: cloneObjectBuckets(this.rows),
4692
5272
  links: cloneLinkBuckets(this.links),
4693
5273
  uniqueValues: cloneUniqueValues(this.uniqueValues),
4694
- uniqueProperties: new Map(this.uniqueProperties)
5274
+ uniqueProperties: new Map(this.uniqueProperties),
5275
+ artifactHolders: cloneArtifactHolders(this.artifactHolders)
4695
5276
  };
4696
5277
  }
4697
5278
  restore(snapshot) {
@@ -4711,6 +5292,10 @@ class InMemoryObjectStorage {
4711
5292
  for (const [key, prepared] of snapshot.uniqueProperties) {
4712
5293
  this.uniqueProperties.set(key, prepared);
4713
5294
  }
5295
+ this.artifactHolders.clear();
5296
+ for (const [key, holders] of cloneArtifactHolders(snapshot.artifactHolders)) {
5297
+ this.artifactHolders.set(key, holders);
5298
+ }
4714
5299
  }
4715
5300
  uniqueHolder(projectId, value) {
4716
5301
  return this.uniqueValues.get(uniquePropertyKey(projectId, value.objectTypeId, value.propertyId))?.get(value.valueKey);
@@ -4932,7 +5517,7 @@ class InMemoryObjectStorage {
4932
5517
  async listByPrimaryIdPage(params) {
4933
5518
  assertReconciliationPageLimit(params.limit);
4934
5519
  const bucket = this.rows.get(objectRowKey(params.projectId, params.objectTypeId));
4935
- const rows = [...bucket?.values() ?? []].filter((row) => !params.afterPrimaryId || compareStrings2(row.primaryId, params.afterPrimaryId) > 0).sort((left, right) => compareStrings2(left.primaryId, right.primaryId)).slice(0, params.limit + 1);
5520
+ const rows = [...bucket?.values() ?? []].filter((row) => !params.afterPrimaryId || compareStrings3(row.primaryId, params.afterPrimaryId) > 0).sort((left, right) => compareStrings3(left.primaryId, right.primaryId)).slice(0, params.limit + 1);
4936
5521
  const hasMore = rows.length > params.limit;
4937
5522
  const objects = rows.slice(0, params.limit).map((row) => structuredClone(row));
4938
5523
  const last = objects.at(-1);
@@ -4941,6 +5526,19 @@ class InMemoryObjectStorage {
4941
5526
  ...hasMore && last ? { nextPrimaryId: last.primaryId } : {}
4942
5527
  };
4943
5528
  }
5529
+ async listArtifactHolders(params) {
5530
+ assertArtifactHolderPageLimit(params.limit);
5531
+ const { after } = params;
5532
+ const holders = [
5533
+ ...this.artifactHolders.get(artifactHoldersKey(params.projectId, params.artifactId))?.values() ?? []
5534
+ ].filter((holder) => !after || compareArtifactHolders(holder, after) > 0).sort(compareArtifactHolders).slice(0, params.limit + 1);
5535
+ const page = holders.slice(0, params.limit).map((holder) => ({ ...holder }));
5536
+ const last = page.at(-1);
5537
+ return {
5538
+ holders: page,
5539
+ ...holders.length > params.limit && last ? { next: { ...last } } : {}
5540
+ };
5541
+ }
4944
5542
  async list(params) {
4945
5543
  let allRows = [];
4946
5544
  if (params.objectTypeId) {
@@ -5019,6 +5617,23 @@ function cloneObjectBuckets(rows) {
5019
5617
  function uniquePropertyKey(projectId, objectTypeId, propertyId) {
5020
5618
  return JSON.stringify([projectId, objectTypeId, propertyId]);
5021
5619
  }
5620
+ function artifactHoldersKey(projectId, artifactId) {
5621
+ return JSON.stringify([projectId, artifactId]);
5622
+ }
5623
+ function artifactHolderKey(holder) {
5624
+ return JSON.stringify([holder.objectTypeId, holder.primaryId, holder.propertyId]);
5625
+ }
5626
+ function compareArtifactHolders(left, right) {
5627
+ return compareStrings3(left.objectTypeId, right.objectTypeId) || compareStrings3(left.primaryId, right.primaryId) || compareStrings3(left.propertyId, right.propertyId);
5628
+ }
5629
+ function assertArtifactHolderPageLimit(limit) {
5630
+ if (!Number.isSafeInteger(limit) || limit <= 0) {
5631
+ throw new Error("Artifact holder page limit must be a positive safe integer.");
5632
+ }
5633
+ }
5634
+ function cloneArtifactHolders(holders) {
5635
+ return new Map([...holders].map(([key, rows]) => [key, new Map(rows)]));
5636
+ }
5022
5637
  function cloneUniqueValues(values) {
5023
5638
  return new Map([...values].map(([key, holders]) => [key, new Map(holders)]));
5024
5639
  }
@@ -5813,6 +6428,8 @@ function touchPlanItem(touches, item) {
5813
6428
  return;
5814
6429
  case "unique-value-release":
5815
6430
  case "unique-value-claim":
6431
+ case "artifact-holder-delete":
6432
+ case "artifact-holder-insert":
5816
6433
  return;
5817
6434
  }
5818
6435
  }
@@ -6641,6 +7258,14 @@ class InMemoryOntologyMaterializationStorage {
6641
7258
  write("unique.claim", () => {
6642
7259
  getInMemoryObjectMaterializerAdapter(this.objects).claimUniqueValue(projectId, item);
6643
7260
  });
7261
+ for (const item of chunk.artifactHolders.deletes)
7262
+ write("artifact-holder.delete", () => {
7263
+ getInMemoryObjectMaterializerAdapter(this.objects).deleteArtifactHolder(projectId, item);
7264
+ });
7265
+ for (const item of chunk.artifactHolders.inserts)
7266
+ write("artifact-holder.insert", () => {
7267
+ getInMemoryObjectMaterializerAdapter(this.objects).insertArtifactHolder(projectId, item);
7268
+ });
6644
7269
  for (const item of chunk.timeseries.pointUpserts)
6645
7270
  write("timeseries.point.upsert", () => {
6646
7271
  this.assertPoint(item.expected, projectId);
@@ -7898,6 +8523,8 @@ class InMemoryPipelineRunStorage2 {
7898
8523
  const next = {
7899
8524
  ...existing,
7900
8525
  status: "queued",
8526
+ attempt: 0,
8527
+ execution: undefined,
7901
8528
  queuedAt,
7902
8529
  startedAt: undefined,
7903
8530
  finishedAt: undefined,
@@ -7913,37 +8540,65 @@ class InMemoryPipelineRunStorage2 {
7913
8540
  executionId: input.executionId,
7914
8541
  pipelineId: input.pipelineId,
7915
8542
  status: "queued",
8543
+ attempt: 0,
7916
8544
  queuedAt
7917
8545
  };
7918
8546
  this.runs.set(key, cloneRecord(record));
7919
8547
  return cloneRecord(record);
7920
8548
  }
7921
- async start(input) {
7922
- const key = storageKey(input.projectId, input.id);
7923
- const existing = this.runs.get(key);
7924
- if (!existing) {
7925
- throw new PipelineRunError2(`[Sixb] Pipeline run '${input.id}' not found for project '${input.projectId}'.`);
7926
- }
7927
- if (existing.status !== "queued") {
7928
- throw new PipelineRunError2(`[Sixb] Pipeline run '${input.id}' cannot start from status '${existing.status}'.`);
7929
- }
7930
- const next = {
8549
+ async startOrReclaim(input) {
8550
+ const existing = this.requireExistingPipelineRun(input.projectId, input.id);
8551
+ const plan = planRunClaim2(cloneRecord(existing), input);
8552
+ if (!plan.take)
8553
+ return plan.claim;
8554
+ const { outcome, startedAt, attempt, execution } = plan;
8555
+ const run = this.writeRun({
7931
8556
  ...existing,
7932
8557
  status: "running",
7933
- startedAt: new Date(input.startedAt ?? new Date),
8558
+ startedAt,
8559
+ attempt,
8560
+ execution,
7934
8561
  error: undefined
7935
- };
7936
- this.runs.set(key, cloneRecord(next));
7937
- return cloneRecord(next);
8562
+ });
8563
+ return { outcome, run };
8564
+ }
8565
+ async confirmExecutionOwnership(input) {
8566
+ const existing = this.requireHeldPipelineRun(input.projectId, input.id, input.executionToken);
8567
+ return this.writeRun({
8568
+ ...existing,
8569
+ execution: {
8570
+ token: input.executionToken,
8571
+ queueLeaseExpiresAt: laterLease2(existing.execution?.queueLeaseExpiresAt, input.queueLeaseExpiresAt)
8572
+ }
8573
+ });
8574
+ }
8575
+ async listLost(input) {
8576
+ return selectLostRuns(this.runs.values(), input).map((run) => cloneRecord(run));
8577
+ }
8578
+ async releaseExecution(input) {
8579
+ const existing = this.runs.get(storageKey(input.projectId, input.id));
8580
+ if (existing?.status !== "running" || existing.execution?.token !== input.executionToken)
8581
+ return;
8582
+ this.writeRun({
8583
+ ...existing,
8584
+ execution: {
8585
+ token: input.executionToken,
8586
+ queueLeaseExpiresAt: new Date(input.releasedAt ?? new Date)
8587
+ },
8588
+ attempt: input.spentAttempt ? existing.attempt : existing.attempt - 1
8589
+ });
7938
8590
  }
7939
8591
  async finish(input) {
7940
8592
  const existing = this.requireExistingPipelineRun(input.projectId, input.id);
7941
8593
  if (!canFinishPipelineRun2(existing.status, input)) {
7942
8594
  throw new PipelineRunError2(`[Sixb] Pipeline run '${input.id}' cannot finish from status '${existing.status}'.`);
7943
8595
  }
8596
+ if (!mayFinishRun2(existing, input))
8597
+ throw staleExecution(input.id);
7944
8598
  const base = {
7945
8599
  ...existing,
7946
8600
  status: input.status,
8601
+ execution: undefined,
7947
8602
  finishedAt: new Date(input.finishedAt ?? new Date)
7948
8603
  };
7949
8604
  const next = input.status === "succeeded" ? {
@@ -7955,16 +8610,18 @@ class InMemoryPipelineRunStorage2 {
7955
8610
  output: undefined,
7956
8611
  error: normalizeError(input.error)
7957
8612
  };
7958
- this.runs.set(storageKey(input.projectId, input.id), cloneRecord(next));
7959
- return cloneRecord(next);
8613
+ return this.writeRun(next);
7960
8614
  }
7961
8615
  async startStep(input) {
7962
8616
  const pipelineRun = this.requireRunningPipelineRun(input.projectId, input.pipelineRunId);
8617
+ if (!holdsRun2(pipelineRun, input.executionToken))
8618
+ throw staleExecution(input.pipelineRunId);
7963
8619
  if (pipelineRun.pipelineId !== input.pipelineId) {
7964
8620
  throw new PipelineRunError2(`[Sixb] Pipeline step run '${input.id}' pipeline '${input.pipelineId}' does not match pipeline run '${input.pipelineRunId}' pipeline '${pipelineRun.pipelineId}'.`);
7965
8621
  }
7966
8622
  const key = storageKey(input.projectId, input.id);
7967
- if (this.steps.has(key)) {
8623
+ const earlier = this.steps.get(key);
8624
+ if (earlier && earlier.status !== "running") {
7968
8625
  throw new PipelineRunError2(`[Sixb] Pipeline step run '${input.id}' already exists for project '${input.projectId}'.`);
7969
8626
  }
7970
8627
  const record = {
@@ -7976,7 +8633,7 @@ class InMemoryPipelineRunStorage2 {
7976
8633
  datasetId: input.datasetId,
7977
8634
  mode: input.mode,
7978
8635
  status: "running",
7979
- startedAt: new Date(input.startedAt ?? new Date),
8636
+ startedAt: earlier?.startedAt ?? new Date(input.startedAt ?? new Date),
7980
8637
  inputs: cloneRecord(input.inputs)
7981
8638
  };
7982
8639
  this.steps.set(key, cloneRecord(record));
@@ -7985,6 +8642,10 @@ class InMemoryPipelineRunStorage2 {
7985
8642
  async finishStep(input) {
7986
8643
  assertNonNegativeInteger(input.rowsWritten, "rowsWritten");
7987
8644
  const existing = this.requireRunningStepRun(input.projectId, input.id);
8645
+ const pipelineRun = this.requireExistingPipelineRun(input.projectId, existing.pipelineRunId);
8646
+ if (!holdsRun2(pipelineRun, input.executionToken)) {
8647
+ throw staleExecution(existing.pipelineRunId);
8648
+ }
7988
8649
  if (input.status === "succeeded" && input.output.datasetId !== existing.datasetId) {
7989
8650
  throw new PipelineRunError2(`[Sixb] Pipeline step run '${input.id}' output dataset '${input.output.datasetId}' does not match '${existing.datasetId}'.`);
7990
8651
  }
@@ -8034,7 +8695,7 @@ class InMemoryPipelineRunStorage2 {
8034
8695
  };
8035
8696
  }
8036
8697
  async listLatestByPipelineIds(input) {
8037
- const runs = latestStartedAtByOwnerId([...this.runs.values()].filter((record) => record.projectId === input.projectId), input.pipelineIds, (record) => record.pipelineId);
8698
+ const runs = latestStartedAtByOwnerId([...this.runs.values()].filter((record) => record.projectId === input.projectId && record.status !== input.excludedStatus), input.pipelineIds, (record) => record.pipelineId);
8038
8699
  return {
8039
8700
  runs: runs.map(cloneRecord)
8040
8701
  };
@@ -8049,7 +8710,7 @@ class InMemoryPipelineRunStorage2 {
8049
8710
  }
8050
8711
  const order = input.order ?? "desc";
8051
8712
  const statuses = toStatusSet(input.statuses);
8052
- const filtered = [...this.steps.values()].filter((record) => record.projectId === input.projectId).filter((record) => input.pipelineRunId ? record.pipelineRunId === input.pipelineRunId : true).filter((record) => input.pipelineId ? record.pipelineId === input.pipelineId : true).filter((record) => input.stepId ? record.stepId === input.stepId : true).filter((record) => input.datasetId ? record.datasetId === input.datasetId : true).filter((record) => matchesRunListDateFilters(record, {
8713
+ const filtered = [...this.steps.values()].filter((record) => record.projectId === input.projectId).filter((record) => input.pipelineRunId ? record.pipelineRunId === input.pipelineRunId : true).filter((record) => input.pipelineRunIds?.includes(record.pipelineRunId) ?? true).filter((record) => input.pipelineId ? record.pipelineId === input.pipelineId : true).filter((record) => input.stepId ? record.stepId === input.stepId : true).filter((record) => input.datasetId ? record.datasetId === input.datasetId : true).filter((record) => matchesRunListDateFilters(record, {
8053
8714
  statuses,
8054
8715
  startedAfter: input.startedAfter,
8055
8716
  startedBefore: input.startedBefore
@@ -8068,6 +8729,17 @@ class InMemoryPipelineRunStorage2 {
8068
8729
  }
8069
8730
  return record;
8070
8731
  }
8732
+ requireHeldPipelineRun(projectId, id, token) {
8733
+ const existing = this.requireExistingPipelineRun(projectId, id);
8734
+ if (existing.status !== "running" || existing.execution?.token !== token) {
8735
+ throw staleExecution(id);
8736
+ }
8737
+ return existing;
8738
+ }
8739
+ writeRun(run) {
8740
+ this.runs.set(storageKey(run.projectId, run.id), cloneRecord(run));
8741
+ return cloneRecord(run);
8742
+ }
8071
8743
  requireRunningPipelineRun(projectId, id) {
8072
8744
  const record = this.requireExistingPipelineRun(projectId, id);
8073
8745
  if (record.status !== "running") {
@@ -8086,6 +8758,9 @@ class InMemoryPipelineRunStorage2 {
8086
8758
  return record;
8087
8759
  }
8088
8760
  }
8761
+ function staleExecution(id) {
8762
+ return new PipelineRunError2(`[Sixb] Execution token is no longer current on pipeline run '${id}'.`);
8763
+ }
8089
8764
  // src/storage/projection-runs/in-memory.ts
8090
8765
  import { randomUUID } from "crypto";
8091
8766
  var runDirectly3 = async (run) => run();
@@ -8153,7 +8828,8 @@ class InMemoryProjectionRunStorage2 {
8153
8828
  ...existing,
8154
8829
  status: "running",
8155
8830
  attempt,
8156
- executionToken: randomUUID(),
8831
+ executionToken: input.execution?.token ?? randomUUID(),
8832
+ queueLeaseExpiresAt: input.execution?.queueLeaseExpiresAt,
8157
8833
  startedAt: existing.startedAt ?? new Date(input.startedAt ?? new Date),
8158
8834
  finishedAt: undefined
8159
8835
  };
@@ -8161,6 +8837,36 @@ class InMemoryProjectionRunStorage2 {
8161
8837
  return createProjectionRunClaim2(record);
8162
8838
  });
8163
8839
  }
8840
+ async confirmExecutionOwnership(input) {
8841
+ return this.runRootOperation(() => {
8842
+ const key = projectionRunKey(input.projectId, input.id);
8843
+ const existing = this.rows.get(key);
8844
+ if (!existing)
8845
+ throw projectionRunNotFound2(input.projectId, input.id);
8846
+ if (existing.status !== "running" || existing.executionToken !== input.executionToken) {
8847
+ throw staleProjectionRunExecution2(input.id);
8848
+ }
8849
+ const record = {
8850
+ ...existing,
8851
+ queueLeaseExpiresAt: laterLease2(existing.queueLeaseExpiresAt, input.queueLeaseExpiresAt)
8852
+ };
8853
+ this.rows.set(key, structuredClone(record));
8854
+ return publicProjectionRunRecord2(record);
8855
+ });
8856
+ }
8857
+ async listLapsed(input) {
8858
+ return this.runRootOperation(() => [...this.rows.values()].filter((run) => run.projectId === input.projectId && run.status === "running" && run.queueLeaseExpiresAt !== undefined && run.queueLeaseExpiresAt.getTime() <= input.lapsedBy.getTime()).sort((left, right) => (left.queueLeaseExpiresAt?.getTime() ?? 0) - (right.queueLeaseExpiresAt?.getTime() ?? 0)).slice(0, input.limit).map((run) => structuredClone(run)));
8859
+ }
8860
+ async releaseExecution(input) {
8861
+ return this.runRootOperation(() => {
8862
+ const key = projectionRunKey(input.projectId, input.id);
8863
+ const existing = this.rows.get(key);
8864
+ if (existing?.status !== "running" || existing.executionToken !== input.executionToken)
8865
+ return;
8866
+ const queueLeaseExpiresAt = new Date(input.releasedAt ?? new Date);
8867
+ this.rows.set(key, structuredClone({ ...existing, queueLeaseExpiresAt }));
8868
+ });
8869
+ }
8164
8870
  async failEnqueue(input) {
8165
8871
  return this.runRootOperation(() => {
8166
8872
  const key = projectionRunKey(input.projectId, input.id);
@@ -8318,7 +9024,7 @@ class InMemoryProjectionRunStorage2 {
8318
9024
  }
8319
9025
  }
8320
9026
  // src/storage/rules/in-memory.ts
8321
- function stateKey2(params) {
9027
+ function stateKey3(params) {
8322
9028
  return JSON.stringify([
8323
9029
  params.projectId,
8324
9030
  params.ruleId,
@@ -8364,12 +9070,12 @@ class InMemoryRulesStorage2 {
8364
9070
  }
8365
9071
  }
8366
9072
  async getActive(params) {
8367
- const record = this.active.get(stateKey2(params));
9073
+ const record = this.active.get(stateKey3(params));
8368
9074
  return record ? cloneRuleStateRecord(record) : null;
8369
9075
  }
8370
9076
  async getActiveBatch(params) {
8371
9077
  return params.items.flatMap((item) => {
8372
- const record = this.active.get(stateKey2({ projectId: params.projectId, ...item }));
9078
+ const record = this.active.get(stateKey3({ projectId: params.projectId, ...item }));
8373
9079
  return record ? [cloneRuleStateRecord(record)] : [];
8374
9080
  });
8375
9081
  }
@@ -8412,10 +9118,10 @@ class InMemoryRulesStorage2 {
8412
9118
  subject: structuredClone(event.payload.subject),
8413
9119
  triggeredAt: event.payload.triggeredAt
8414
9120
  };
8415
- this.active.set(stateKey2(record), cloneRuleStateRecord(record));
9121
+ this.active.set(stateKey3(record), cloneRuleStateRecord(record));
8416
9122
  }
8417
9123
  async applyResolved(event) {
8418
- this.active.delete(stateKey2({
9124
+ this.active.delete(stateKey3({
8419
9125
  projectId: event.projectId,
8420
9126
  ruleId: event.payload.ruleId,
8421
9127
  subject: event.payload.subject
@@ -8537,6 +9243,17 @@ class InMemoryShareSessionStorage2 {
8537
9243
  this.rows.set(key, updated);
8538
9244
  return cloneShareSessionRecord2(updated);
8539
9245
  }
9246
+ async setGuestName(input) {
9247
+ const normalized = normalizeSetShareSessionGuestNameInput2(input);
9248
+ const key = rowKey3(normalized.projectId, normalized.id);
9249
+ const current = this.rows.get(key);
9250
+ if (!current || current.grantId !== normalized.grantId || current.revokedAt !== undefined || current.expiresAt.getTime() <= normalized.now.getTime() || current.absoluteExpiresAt.getTime() <= normalized.now.getTime()) {
9251
+ return null;
9252
+ }
9253
+ const updated = { ...current, guestName: normalized.name };
9254
+ this.rows.set(key, updated);
9255
+ return cloneShareSessionRecord2(updated);
9256
+ }
8540
9257
  async revoke(input) {
8541
9258
  const normalized = normalizeRevokeShareSessionInput2(input);
8542
9259
  const key = rowKey3(normalized.projectId, normalized.id);
@@ -8618,6 +9335,9 @@ class InMemorySyncRunStorage2 {
8618
9335
  const next = {
8619
9336
  ...existing,
8620
9337
  status: "queued",
9338
+ attempt: 0,
9339
+ execution: undefined,
9340
+ commitPreparedAt: undefined,
8621
9341
  queuedAt,
8622
9342
  startedAt: undefined,
8623
9343
  finishedAt: undefined,
@@ -8637,6 +9357,7 @@ class InMemorySyncRunStorage2 {
8637
9357
  datasetId: input.datasetId,
8638
9358
  mode: input.mode,
8639
9359
  status: "queued",
9360
+ attempt: 0,
8640
9361
  queuedAt,
8641
9362
  expectedLatestVersionId: input.expectedLatestVersionId,
8642
9363
  commitMessage: input.commitMessage
@@ -8644,33 +9365,65 @@ class InMemorySyncRunStorage2 {
8644
9365
  this.rows.set(key, structuredClone(record));
8645
9366
  return cloneSyncRunRecord(record);
8646
9367
  }
8647
- async start(input) {
8648
- const key = syncRunKey(input.projectId, input.id);
8649
- const existing = this.rows.get(key);
8650
- if (!existing) {
8651
- throw new SyncRunError2(`[Sixb] Sync run '${input.id}' not found for project '${input.projectId}'.`);
8652
- }
8653
- if (existing.status !== "queued") {
8654
- throw new SyncRunError2(`[Sixb] Sync run '${input.id}' cannot start from status '${existing.status}'.`);
8655
- }
8656
- const next = {
9368
+ async startOrReclaim(input) {
9369
+ const existing = this.requireRun(input.projectId, input.id);
9370
+ const sibling = [...this.rows.values()].find((run) => run.projectId === input.projectId && run.syncId === existing.syncId && run.id !== existing.id && run.status === "running");
9371
+ const plan = planRunClaim2(cloneSyncRunRecord(existing), input, sibling);
9372
+ if (!plan.take)
9373
+ return plan.claim;
9374
+ const { outcome, startedAt, attempt, execution } = plan;
9375
+ const run = this.write({
8657
9376
  ...existing,
8658
9377
  status: "running",
8659
- startedAt: new Date(input.startedAt ?? new Date),
9378
+ startedAt,
9379
+ attempt,
9380
+ execution,
8660
9381
  error: undefined
8661
- };
8662
- this.rows.set(key, structuredClone(next));
8663
- return cloneSyncRunRecord(next);
9382
+ });
9383
+ return { outcome, run };
9384
+ }
9385
+ async confirmExecutionOwnership(input) {
9386
+ const existing = this.requireHeldRun(input.projectId, input.id, input.executionToken);
9387
+ return this.write({
9388
+ ...existing,
9389
+ execution: {
9390
+ token: input.executionToken,
9391
+ queueLeaseExpiresAt: laterLease2(existing.execution?.queueLeaseExpiresAt, input.queueLeaseExpiresAt)
9392
+ }
9393
+ });
9394
+ }
9395
+ async listLost(input) {
9396
+ return selectLostRuns(this.rows.values(), input).map((run) => structuredClone(run));
9397
+ }
9398
+ async releaseExecution(input) {
9399
+ const existing = this.rows.get(syncRunKey(input.projectId, input.id));
9400
+ if (existing?.status !== "running" || existing.execution?.token !== input.executionToken)
9401
+ return;
9402
+ this.write({
9403
+ ...existing,
9404
+ execution: {
9405
+ token: input.executionToken,
9406
+ queueLeaseExpiresAt: new Date(input.releasedAt ?? new Date)
9407
+ },
9408
+ attempt: input.spentAttempt ? existing.attempt : existing.attempt - 1
9409
+ });
9410
+ }
9411
+ async prepareCommit(input) {
9412
+ const existing = this.requireHeldRun(input.projectId, input.id, input.executionToken);
9413
+ return this.write({
9414
+ ...existing,
9415
+ rowsRead: input.rowsRead,
9416
+ checkpoint: normalizeCheckpoint(input.checkpoint),
9417
+ commitPreparedAt: new Date(input.preparedAt ?? new Date)
9418
+ });
8664
9419
  }
8665
9420
  async finish(input) {
8666
- const key = syncRunKey(input.projectId, input.id);
8667
- const existing = this.rows.get(key);
8668
- if (!existing) {
8669
- throw new SyncRunError2(`[Sixb] Sync run '${input.id}' not found for project '${input.projectId}'.`);
8670
- }
9421
+ const existing = this.requireRun(input.projectId, input.id);
8671
9422
  if (!canFinishSyncRun2(existing.status, input)) {
8672
9423
  throw new SyncRunError2(`[Sixb] Sync run '${input.id}' cannot finish from status '${existing.status}'.`);
8673
9424
  }
9425
+ if (!mayFinishRun2(existing, input))
9426
+ throw staleExecution2(input.id);
8674
9427
  if (input.status === "succeeded") {
8675
9428
  if (input.output && input.output.datasetId !== existing.datasetId) {
8676
9429
  throw new SyncRunError2(`[Sixb] Sync run '${input.id}' output dataset '${input.output.datasetId}' does not match '${existing.datasetId}'.`);
@@ -8682,6 +9435,7 @@ class InMemorySyncRunStorage2 {
8682
9435
  const base = {
8683
9436
  ...existing,
8684
9437
  status: input.status,
9438
+ execution: undefined,
8685
9439
  finishedAt: new Date(input.finishedAt ?? new Date)
8686
9440
  };
8687
9441
  const next = input.status === "succeeded" ? {
@@ -8697,8 +9451,7 @@ class InMemorySyncRunStorage2 {
8697
9451
  error: normalizeError2(input.error),
8698
9452
  checkpoint: undefined
8699
9453
  };
8700
- this.rows.set(key, structuredClone(next));
8701
- return cloneSyncRunRecord(next);
9454
+ return this.write(next);
8702
9455
  }
8703
9456
  async getById(params) {
8704
9457
  const record = this.rows.get(syncRunKey(params.projectId, params.id));
@@ -8733,6 +9486,27 @@ class InMemorySyncRunStorage2 {
8733
9486
  runs: runs.map(cloneSyncRunRecord)
8734
9487
  };
8735
9488
  }
9489
+ requireRun(projectId, id) {
9490
+ const existing = this.rows.get(syncRunKey(projectId, id));
9491
+ if (!existing) {
9492
+ throw new SyncRunError2(`[Sixb] Sync run '${id}' not found for project '${projectId}'.`);
9493
+ }
9494
+ return existing;
9495
+ }
9496
+ requireHeldRun(projectId, id, token) {
9497
+ const existing = this.requireRun(projectId, id);
9498
+ if (existing.status !== "running" || existing.execution?.token !== token) {
9499
+ throw staleExecution2(id);
9500
+ }
9501
+ return existing;
9502
+ }
9503
+ write(run) {
9504
+ this.rows.set(syncRunKey(run.projectId, run.id), structuredClone(run));
9505
+ return cloneSyncRunRecord(run);
9506
+ }
9507
+ }
9508
+ function staleExecution2(id) {
9509
+ return new SyncRunError2(`[Sixb] Execution token is no longer current on sync run '${id}'.`);
8736
9510
  }
8737
9511
  // src/storage/webhook-runs/types.ts
8738
9512
  var WEBHOOK_RUN_FAILURE_CODES2 = [
@@ -8740,8 +9514,14 @@ var WEBHOOK_RUN_FAILURE_CODES2 = [
8740
9514
  "webhook.delivery_failed",
8741
9515
  "webhook.delivery_rejected"
8742
9516
  ];
8743
- function canRetryWebhookRun2(run) {
8744
- return run.status === "failed" && run.error?.retryable === true;
9517
+ var WEBHOOK_RUN_LEASE_MS2 = 60000;
9518
+ function canRetryWebhookRun2(run, now = new Date) {
9519
+ if (run.status === "failed")
9520
+ return run.error?.retryable === true;
9521
+ if (run.status !== "running")
9522
+ return false;
9523
+ const leaseExpiresAt = run.execution?.leaseExpiresAt.getTime() ?? run.startedAt.getTime() + WEBHOOK_RUN_LEASE_MS2;
9524
+ return leaseExpiresAt <= now.getTime();
8745
9525
  }
8746
9526
 
8747
9527
  // src/storage/webhook-runs/in-memory.ts
@@ -8779,6 +9559,7 @@ class InMemoryWebhookRunStorage2 {
8779
9559
  connectorId: input.connectorId,
8780
9560
  webhookId: input.webhookId,
8781
9561
  status: "running",
9562
+ execution: input.execution,
8782
9563
  method: input.method,
8783
9564
  route: input.route,
8784
9565
  startedAt: new Date(input.startedAt ?? new Date),
@@ -8791,13 +9572,15 @@ class InMemoryWebhookRunStorage2 {
8791
9572
  }
8792
9573
  async restart(input) {
8793
9574
  const existing = this.requireWebhookRun(input.projectId, input.id);
8794
- if (!canRetryWebhookRun2(existing)) {
9575
+ const startedAt = new Date(input.startedAt ?? new Date);
9576
+ if (!canRetryWebhookRun2(existing, startedAt)) {
8795
9577
  throw new WebhookRunError2(`[Sixb] Webhook run '${input.id}' cannot restart from status '${existing.status}'.`, "invalid_transition");
8796
9578
  }
8797
9579
  const next = {
8798
9580
  ...existing,
8799
9581
  status: "running",
8800
- startedAt: new Date(input.startedAt ?? new Date),
9582
+ execution: input.execution,
9583
+ startedAt,
8801
9584
  finishedAt: undefined,
8802
9585
  responseStatus: undefined,
8803
9586
  error: undefined
@@ -8805,11 +9588,25 @@ class InMemoryWebhookRunStorage2 {
8805
9588
  this.runs.set(storageKey(input.projectId, input.id), cloneRecord(next));
8806
9589
  return cloneRecord(next);
8807
9590
  }
9591
+ async renewLease(input) {
9592
+ const key = storageKey(input.projectId, input.id);
9593
+ const existing = this.runs.get(key);
9594
+ if (existing?.status !== "running" || existing.execution?.token !== input.executionToken) {
9595
+ return false;
9596
+ }
9597
+ const execution = { token: input.executionToken, leaseExpiresAt: input.leaseExpiresAt };
9598
+ this.runs.set(key, cloneRecord({ ...existing, execution }));
9599
+ return true;
9600
+ }
8808
9601
  async finish(input) {
8809
9602
  const existing = this.requireRunningWebhookRun(input.projectId, input.id);
9603
+ if (existing.execution?.token !== input.executionToken) {
9604
+ throw new WebhookRunError2(`[Sixb] Execution token is no longer current on webhook run '${input.id}'.`, "invalid_transition");
9605
+ }
8810
9606
  const next = {
8811
9607
  ...existing,
8812
9608
  status: input.status,
9609
+ execution: undefined,
8813
9610
  finishedAt: new Date(input.finishedAt ?? new Date),
8814
9611
  responseStatus: input.responseStatus,
8815
9612
  error: input.status === "failed" ? parseSixbFailure2(input.error, WEBHOOK_RUN_FAILURE_CODES2) : undefined
@@ -9075,27 +9872,45 @@ class InMemoryWorkflowRunStorage2 {
9075
9872
  this.runs.set(key, cloneRecord(record));
9076
9873
  return cloneRecord(record);
9077
9874
  }
9078
- async start(input) {
9079
- const key = storageKey(input.projectId, input.id);
9080
- const existing = this.runs.get(key);
9081
- if (!existing || existing.status !== "queued") {
9082
- throw new WorkflowRunError2(existing ? `[Sixb] Workflow run '${input.id}' cannot start from status '${existing.status}'.` : `[Sixb] Workflow run '${input.id}' not found for project '${input.projectId}'.`);
9083
- }
9084
- const next = {
9875
+ async startOrReclaim(input) {
9876
+ const existing = this.requireExistingWorkflowRun(input.projectId, input.id);
9877
+ const plan = planRunClaim2(cloneRecord(existing), input);
9878
+ if (!plan.take)
9879
+ return plan.claim;
9880
+ const { outcome, startedAt, attempt, execution } = plan;
9881
+ const run = {
9085
9882
  ...existing,
9086
9883
  status: "running",
9087
- startedAt: new Date(input.startedAt ?? new Date),
9884
+ startedAt,
9088
9885
  finishedAt: undefined,
9089
- error: undefined,
9090
- attempt: existing.attempt + 1,
9091
- execution: input.execution ? cloneRecord(input.execution) : undefined
9886
+ attempt,
9887
+ execution: cloneRecord(execution),
9888
+ error: undefined
9092
9889
  };
9093
- this.runs.set(key, cloneRecord(next));
9094
- return cloneRecord(next);
9890
+ this.runs.set(storageKey(input.projectId, input.id), cloneRecord(run));
9891
+ return { outcome, run: cloneRecord(run) };
9892
+ }
9893
+ async listLost(input) {
9894
+ return selectLostRuns(this.runs.values(), input).map((run) => cloneRecord(run));
9895
+ }
9896
+ async releaseExecution(input) {
9897
+ const existing = this.runs.get(storageKey(input.projectId, input.id));
9898
+ if (existing?.status !== "running" || existing.execution?.token !== input.executionToken)
9899
+ return;
9900
+ const next = {
9901
+ ...existing,
9902
+ execution: {
9903
+ token: input.executionToken,
9904
+ queueLeaseExpiresAt: new Date(input.releasedAt ?? new Date)
9905
+ },
9906
+ attempt: input.spentAttempt ? existing.attempt : existing.attempt - 1
9907
+ };
9908
+ this.runs.set(storageKey(input.projectId, input.id), cloneRecord(next));
9095
9909
  }
9096
9910
  async finish(input) {
9097
9911
  const existing = this.requireFinishableWorkflowRun(input);
9098
- this.assertRecordExecutionOwnership(existing, input.executionToken);
9912
+ if (!mayFinishRun2(existing, input))
9913
+ throw this.staleExecution(existing.id);
9099
9914
  const base = {
9100
9915
  ...existing,
9101
9916
  status: input.status,
@@ -9134,22 +9949,12 @@ class InMemoryWorkflowRunStorage2 {
9134
9949
  status: "running",
9135
9950
  finishedAt: undefined,
9136
9951
  error: undefined,
9137
- attempt: existing.attempt + 1,
9952
+ attempt: 1,
9138
9953
  execution: input.execution ? cloneRecord(input.execution) : undefined
9139
9954
  };
9140
9955
  this.runs.set(storageKey(input.projectId, input.id), cloneRecord(next));
9141
9956
  return cloneRecord(next);
9142
9957
  }
9143
- async reclaim(input) {
9144
- const existing = this.requireRunningWorkflowRun(input.projectId, input.id);
9145
- const next = {
9146
- ...existing,
9147
- attempt: existing.attempt + 1,
9148
- execution: cloneRecord(input.execution)
9149
- };
9150
- this.runs.set(storageKey(input.projectId, input.id), cloneRecord(next));
9151
- return cloneRecord(next);
9152
- }
9153
9958
  async confirmExecutionOwnership(input) {
9154
9959
  const existing = this.requireRunningWorkflowRun(input.projectId, input.id);
9155
9960
  this.assertRecordExecutionOwnership(existing, input.executionToken);
@@ -9248,9 +10053,11 @@ class InMemoryWorkflowRunStorage2 {
9248
10053
  this.assertRecordExecutionOwnership(this.requireExistingWorkflowRun(projectId, id), token);
9249
10054
  }
9250
10055
  assertRecordExecutionOwnership(record, token) {
9251
- if (record.execution?.token !== token) {
9252
- throw new WorkflowRunError2(`[Sixb] Execution token is no longer current on workflow run '${record.id}'.`);
9253
- }
10056
+ if (!holdsRun2(record, token))
10057
+ throw this.staleExecution(record.id);
10058
+ }
10059
+ staleExecution(id) {
10060
+ return new WorkflowRunError2(`[Sixb] Execution token is no longer current on workflow run '${id}'.`);
9254
10061
  }
9255
10062
  }
9256
10063
 
@@ -9599,7 +10406,10 @@ class InMemoryStorage2 {
9599
10406
  webhookRunStorage = new InMemoryWebhookRunStorage2(this.executionStorage);
9600
10407
  rulesStorage = new InMemoryRulesStorage2;
9601
10408
  fileUploadSessionStorage = new InMemoryFileUploadSessions2;
10409
+ datasetIngestStorage = new InMemoryDatasetIngestStorage2;
9602
10410
  fileDownloadGrantStorage = new InMemoryFileDownloadGrantStorage;
10411
+ maintenanceHeartbeatStorage = new InMemoryMaintenanceHeartbeatStorage;
10412
+ lakeRetentionRunStorage = new InMemoryLakeRetentionRunStorage;
9603
10413
  connectorConnectionStorage;
9604
10414
  activityStorage = new InMemoryActivityStorage;
9605
10415
  auth;
@@ -9620,7 +10430,10 @@ class InMemoryStorage2 {
9620
10430
  shareGrants;
9621
10431
  shareSessions;
9622
10432
  fileUploadSessions;
10433
+ datasetIngest;
9623
10434
  fileDownloadGrants;
10435
+ maintenanceHeartbeats;
10436
+ lakeRetentionRuns;
9624
10437
  connectorConnections;
9625
10438
  activity;
9626
10439
  constructor(options = {}) {
@@ -9646,7 +10459,10 @@ class InMemoryStorage2 {
9646
10459
  this.shareGrants = createOperationScopedFacade2(this.shareGrantStorage, scope);
9647
10460
  this.shareSessions = createOperationScopedFacade2(this.shareSessionStorage, scope);
9648
10461
  this.fileUploadSessions = createOperationScopedFacade2(this.fileUploadSessionStorage, scope);
10462
+ this.datasetIngest = createOperationScopedFacade2(this.datasetIngestStorage, scope);
9649
10463
  this.fileDownloadGrants = createOperationScopedFacade2(this.fileDownloadGrantStorage, scope);
10464
+ this.maintenanceHeartbeats = createOperationScopedFacade2(this.maintenanceHeartbeatStorage, scope);
10465
+ this.lakeRetentionRuns = createOperationScopedFacade2(this.lakeRetentionRunStorage, scope);
9650
10466
  this.connectorConnections = createOperationScopedFacade2(this.connectorConnectionStorage, scope);
9651
10467
  this.activity = createOperationScopedFacade2(this.activityStorage, scope);
9652
10468
  this.ontologyStorage = new InMemoryOntologyStorage(this.objectStorage, this.timeseriesStorage, {
@@ -9809,7 +10625,10 @@ class InMemoryStorage2 {
9809
10625
  shareGrants: this.shareGrantStorage,
9810
10626
  shareSessions: this.shareSessionStorage,
9811
10627
  fileUploadSessions: this.fileUploadSessionStorage,
10628
+ datasetIngest: this.datasetIngestStorage,
9812
10629
  fileDownloadGrants: this.fileDownloadGrantStorage,
10630
+ maintenanceHeartbeats: this.maintenanceHeartbeatStorage,
10631
+ lakeRetentionRuns: this.lakeRetentionRunStorage,
9813
10632
  connectorConnections: this.connectorConnectionStorage,
9814
10633
  activity: this.activityStorage,
9815
10634
  ping: async () => {
@@ -9843,7 +10662,10 @@ class InMemoryStorage2 {
9843
10662
  shareGrants: this.shareGrantStorage.snapshot(),
9844
10663
  shareSessions: this.shareSessionStorage.snapshot(),
9845
10664
  fileUploadSessions: this.fileUploadSessionStorage.snapshot(),
10665
+ datasetIngest: this.datasetIngestStorage.snapshot(),
9846
10666
  fileDownloadGrants: this.fileDownloadGrantStorage.snapshot(),
10667
+ maintenanceHeartbeats: this.maintenanceHeartbeatStorage.snapshot(),
10668
+ lakeRetentionRuns: this.lakeRetentionRunStorage.snapshot(),
9847
10669
  connectorConnections: this.connectorConnectionStorage.snapshot(),
9848
10670
  activity: this.activityStorage.snapshot()
9849
10671
  };
@@ -9870,7 +10692,10 @@ class InMemoryStorage2 {
9870
10692
  this.shareGrantStorage.restore(snapshot.shareGrants);
9871
10693
  this.shareSessionStorage.restore(snapshot.shareSessions);
9872
10694
  this.fileUploadSessionStorage.restore(snapshot.fileUploadSessions);
10695
+ this.datasetIngestStorage.restore(snapshot.datasetIngest);
9873
10696
  this.fileDownloadGrantStorage.restore(snapshot.fileDownloadGrants);
10697
+ this.maintenanceHeartbeatStorage.restore(snapshot.maintenanceHeartbeats);
10698
+ this.lakeRetentionRunStorage.restore(snapshot.lakeRetentionRuns);
9874
10699
  this.connectorConnectionStorage.restore(snapshot.connectorConnections);
9875
10700
  this.activityStorage.restore(snapshot.activity);
9876
10701
  }
@@ -9884,6 +10709,7 @@ async function prepareObjectQueries2(input) {
9884
10709
  throw new Error("[Sixb] This storage provider does not support object query preparation");
9885
10710
  }
9886
10711
  const values = input.ontology.getValueTypesById();
10712
+ const visibility = viewConditionKeysByType(input.security, input.ontology);
9887
10713
  const objectTypes = input.ontology.listObjectTypes().map((type) => ({
9888
10714
  objectTypeId: type.id,
9889
10715
  properties: type.properties.filter((property) => property.mode !== "telemetry" && !property.primary).map((property) => {
@@ -9901,9 +10727,37 @@ async function prepareObjectQueries2(input) {
9901
10727
  links: type.links.map((link) => ({
9902
10728
  linkId: link.id,
9903
10729
  targetObjectTypeIds: linkTargetObjectTypeIds(link.targetObjectTypeId, input.ontology)
9904
- }))
10730
+ })),
10731
+ ...visibility ? { visibility: visibility.get(type.id) ?? [] } : {}
9905
10732
  }));
9906
- return input.storage.prepareObjectQueries({ projectId: input.projectId, objectTypes });
10733
+ const result = await input.storage.prepareObjectQueries({
10734
+ projectId: input.projectId,
10735
+ objectTypes
10736
+ });
10737
+ const unindexed = (input.security?.listViewConditions() ?? []).filter((condition) => !viewConditionKeys(condition.predicate)).map((condition) => `Role '${condition.roleId}': can.view(${condition.objectTypeId}).where(...) negates currentUser() or needs it twice at once, so members' reads check every object.`);
10738
+ return unindexed.length > 0 ? { ...result, warnings: [...result.warnings, ...unindexed] } : result;
10739
+ }
10740
+ function viewConditionKeysByType(security, ontology) {
10741
+ if (!security)
10742
+ return;
10743
+ const keysByType = new Map;
10744
+ for (const condition of security.listViewConditions()) {
10745
+ const keys = viewConditionKeys(condition.predicate);
10746
+ if (!keys)
10747
+ continue;
10748
+ for (const objectTypeId of [
10749
+ condition.objectTypeId,
10750
+ ...ontology.listSubTypes(condition.objectTypeId)
10751
+ ]) {
10752
+ const typeKeys = keysByType.get(objectTypeId) ?? new Map;
10753
+ typeKeys.set(JSON.stringify(keys), keys);
10754
+ keysByType.set(objectTypeId, typeKeys);
10755
+ }
10756
+ }
10757
+ return new Map([...keysByType].map(([objectTypeId, keys]) => [
10758
+ objectTypeId,
10759
+ [...keys].sort(([left], [right]) => compareStrings(left, right)).map(([, value]) => value)
10760
+ ]));
9907
10761
  }
9908
10762
 
9909
10763
  // src/storage/migrations/prepare-unique-properties.ts
@@ -10226,6 +11080,6 @@ var VECTOR_INDEXING_FAILURE_CODES2 = [
10226
11080
  "vector.outcome_unknown",
10227
11081
  "internal.unexpected"
10228
11082
  ];
10229
- export { InMemoryActionRunStorage2, AGENT_MESSAGE_CONTENT_VERSION2, InMemoryAgentStorage2, AiCostStorageError2, InMemoryAiCostStorage2, InMemoryAiLimitStorage2, InMemoryConnectorConnectionStorage2, InMemoryFileUploadSessions2, objectBatchKey2, linkBatchKey2, objectLinkCursor2, compareQueryScalarValues, matchesPredicate, PIPELINE_RUN_FAILURE_CODES2, InMemoryPipelineRunStorage2, InMemoryProjectionRunStorage2, InMemoryRulesStorage2, InMemoryShareGrantStorage2, InMemoryShareSessionStorage2, SYNC_RUN_FAILURE_CODES2, InMemorySyncRunStorage2, WEBHOOK_RUN_FAILURE_CODES2, canRetryWebhookRun2, InMemoryWebhookRunStorage2, WorkflowInterventionError2, InMemoryWorkflowInterventionStorage2, WORKFLOW_RUN_FAILURE_CODES2, InMemoryWorkflowRunStorage2, InMemoryWorkflowNodeRunStorage2, InMemoryWorkflowAgentNodeRunStorage2, InMemoryStorage2, prepareObjectQueries2, isMigrationCapableStorage2, migrateStorage2, checkStorageSchema2, step2, defineMigrations2, runMigrationSet2, describeMigrationHistory2, VECTOR_INDEXING_FAILURE_CODES2 };
11083
+ export { InMemoryActionRunStorage2, AGENT_MESSAGE_CONTENT_VERSION2, InMemoryAgentStorage2, AiCostStorageError2, InMemoryAiCostStorage2, InMemoryAiLimitStorage2, InMemoryConnectorConnectionStorage2, InMemoryDatasetIngestStorage2, InMemoryFileUploadSessions2, objectBatchKey2, linkBatchKey2, objectLinkCursor2, compareQueryScalarValues, matchesPredicate, sortTieDirection2, PIPELINE_RUN_FAILURE_CODES2, InMemoryPipelineRunStorage2, InMemoryProjectionRunStorage2, InMemoryRulesStorage2, InMemoryShareGrantStorage2, InMemoryShareSessionStorage2, SYNC_RUN_FAILURE_CODES2, InMemorySyncRunStorage2, WEBHOOK_RUN_FAILURE_CODES2, WEBHOOK_RUN_LEASE_MS2, canRetryWebhookRun2, InMemoryWebhookRunStorage2, WorkflowInterventionError2, InMemoryWorkflowInterventionStorage2, WORKFLOW_RUN_FAILURE_CODES2, InMemoryWorkflowRunStorage2, InMemoryWorkflowNodeRunStorage2, InMemoryWorkflowAgentNodeRunStorage2, InMemoryStorage2, prepareObjectQueries2, isMigrationCapableStorage2, migrateStorage2, checkStorageSchema2, step2, defineMigrations2, runMigrationSet2, describeMigrationHistory2, VECTOR_INDEXING_FAILURE_CODES2 };
10230
11084
 
10231
- //# debugId=6329531EEFE0AEE564756E2164756E21
11085
+ //# debugId=26430E748C66628B64756E2164756E21