@sixb/core 0.1.0 → 0.1.2

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 (1196) hide show
  1. package/README.md +54 -23
  2. package/dist/actions/commit-edits.d.ts +0 -2
  3. package/dist/actions/commit-edits.d.ts.map +1 -1
  4. package/dist/actions/execution.d.ts +21 -0
  5. package/dist/actions/execution.d.ts.map +1 -0
  6. package/dist/actions/index.d.ts +1 -1
  7. package/dist/actions/index.d.ts.map +1 -1
  8. package/dist/actions/index.js +34 -23
  9. package/dist/actions/index.js.map +1 -1
  10. package/dist/actions/registry.d.ts +16 -7
  11. package/dist/actions/registry.d.ts.map +1 -1
  12. package/dist/actions/request.d.ts +3 -2
  13. package/dist/actions/request.d.ts.map +1 -1
  14. package/dist/actions/run-dispatch.d.ts +21 -0
  15. package/dist/actions/run-dispatch.d.ts.map +1 -0
  16. package/dist/actions/types/context.d.ts +2 -2
  17. package/dist/actions/types/context.d.ts.map +1 -1
  18. package/dist/actions/validation.d.ts +1 -1
  19. package/dist/actions/validation.d.ts.map +1 -1
  20. package/dist/actions/worker.js +4 -4
  21. package/dist/actions/worker.js.map +1 -1
  22. package/dist/agents/adapters.d.ts +10 -0
  23. package/dist/agents/adapters.d.ts.map +1 -1
  24. package/dist/agents/authority.d.ts +31 -0
  25. package/dist/agents/authority.d.ts.map +1 -0
  26. package/dist/agents/builders.d.ts +8 -1
  27. package/dist/agents/builders.d.ts.map +1 -1
  28. package/dist/agents/context.js +2 -2
  29. package/dist/agents/dispatch.d.ts.map +1 -1
  30. package/dist/agents/errors.d.ts +16 -1
  31. package/dist/agents/errors.d.ts.map +1 -1
  32. package/dist/agents/execution.d.ts +45 -0
  33. package/dist/agents/execution.d.ts.map +1 -0
  34. package/dist/agents/index.d.ts +10 -10
  35. package/dist/agents/index.d.ts.map +1 -1
  36. package/dist/agents/index.js +81 -14
  37. package/dist/agents/index.js.map +1 -1
  38. package/dist/agents/prompt.d.ts.map +1 -1
  39. package/dist/agents/request.d.ts +6 -2
  40. package/dist/agents/request.d.ts.map +1 -1
  41. package/dist/agents/streams.d.ts +29 -3
  42. package/dist/agents/streams.d.ts.map +1 -1
  43. package/dist/agents/streams.js +22 -3
  44. package/dist/agents/streams.js.map +1 -1
  45. package/dist/agents/tool-definition.d.ts +9 -0
  46. package/dist/agents/tool-definition.d.ts.map +1 -0
  47. package/dist/agents/types.d.ts +64 -0
  48. package/dist/agents/types.d.ts.map +1 -1
  49. package/dist/agents/validation.d.ts +16 -3
  50. package/dist/agents/validation.d.ts.map +1 -1
  51. package/dist/auth/attribution.d.ts +17 -0
  52. package/dist/auth/attribution.d.ts.map +1 -0
  53. package/dist/auth/index.d.ts +1 -0
  54. package/dist/auth/index.d.ts.map +1 -1
  55. package/dist/auth/index.js +9 -5
  56. package/dist/auth/index.js.map +1 -1
  57. package/dist/auth/runtime.d.ts +4 -4
  58. package/dist/auth/runtime.d.ts.map +1 -1
  59. package/dist/authorization/decision.d.ts +24 -11
  60. package/dist/authorization/decision.d.ts.map +1 -1
  61. package/dist/authorization/grant-kinds.d.ts +2 -1
  62. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  63. package/dist/authorization/index.d.ts +1 -1
  64. package/dist/authorization/index.d.ts.map +1 -1
  65. package/dist/authorization/index.js +8 -4
  66. package/dist/authorization/index.js.map +1 -1
  67. package/dist/blob-storage/browser.js +3 -2
  68. package/dist/blob-storage/browser.js.map +1 -1
  69. package/dist/blob-storage/execution.d.ts +16 -0
  70. package/dist/blob-storage/execution.d.ts.map +1 -0
  71. package/dist/blob-storage/index.js +4 -3
  72. package/dist/blob-storage/index.js.map +1 -1
  73. package/dist/blob-storage/validation.d.ts.map +1 -1
  74. package/dist/bootstrap/discovery.d.ts +90 -24
  75. package/dist/bootstrap/discovery.d.ts.map +1 -1
  76. package/dist/bootstrap/index.d.ts +2 -1
  77. package/dist/bootstrap/index.d.ts.map +1 -1
  78. package/dist/bootstrap/index.js +59 -59
  79. package/dist/bootstrap/index.js.map +1 -1
  80. package/dist/broker/in-memory.d.ts.map +1 -1
  81. package/dist/broker/index.js +2 -2
  82. package/dist/broker/types.d.ts +5 -0
  83. package/dist/broker/types.d.ts.map +1 -1
  84. package/dist/chunk-0172wgm9.js +333 -0
  85. package/dist/chunk-0172wgm9.js.map +11 -0
  86. package/dist/chunk-0k4avqr2.js +317 -0
  87. package/dist/chunk-0k4avqr2.js.map +11 -0
  88. package/dist/chunk-0mbx247x.js +2922 -0
  89. package/dist/chunk-0mbx247x.js.map +43 -0
  90. package/dist/chunk-34bqh420.js +1168 -0
  91. package/dist/chunk-34bqh420.js.map +23 -0
  92. package/dist/{chunk-mx84y05q.js → chunk-3j7573mj.js} +2 -2
  93. package/dist/{chunk-mx84y05q.js.map → chunk-3j7573mj.js.map} +2 -2
  94. package/dist/{chunk-45tw90k7.js → chunk-4gz41why.js} +1 -1
  95. package/dist/chunk-4x43bkbp.js +55 -0
  96. package/dist/chunk-4x43bkbp.js.map +11 -0
  97. package/dist/{chunk-xqbtf4wn.js → chunk-57r1cpxx.js} +3 -2
  98. package/dist/{chunk-xqbtf4wn.js.map → chunk-57r1cpxx.js.map} +3 -3
  99. package/dist/chunk-57zpb99z.js +194 -0
  100. package/dist/chunk-57zpb99z.js.map +10 -0
  101. package/dist/{chunk-dhmj53mx.js → chunk-5egfka8j.js} +13 -33
  102. package/dist/chunk-5egfka8j.js.map +15 -0
  103. package/dist/chunk-5gd7tpv6.js +28 -0
  104. package/dist/chunk-5gd7tpv6.js.map +11 -0
  105. package/dist/{chunk-867jxh7c.js → chunk-5sz8ta9r.js} +6 -295
  106. package/dist/chunk-5sz8ta9r.js.map +16 -0
  107. package/dist/chunk-62c7t4jc.js +27 -0
  108. package/dist/chunk-62c7t4jc.js.map +11 -0
  109. package/dist/{chunk-8r8cw2xw.js → chunk-63te770v.js} +40 -5
  110. package/dist/{chunk-8r8cw2xw.js.map → chunk-63te770v.js.map} +3 -3
  111. package/dist/chunk-663csy96.js +34 -0
  112. package/dist/chunk-663csy96.js.map +10 -0
  113. package/dist/{chunk-xz5g49bp.js → chunk-6gjqgd3d.js} +3 -1
  114. package/dist/chunk-6gjqgd3d.js.map +11 -0
  115. package/dist/chunk-7pc8b818.js +128 -0
  116. package/dist/chunk-7pc8b818.js.map +13 -0
  117. package/dist/{chunk-f2b5e2gf.js → chunk-85j5ybfj.js} +18 -3
  118. package/dist/{chunk-f2b5e2gf.js.map → chunk-85j5ybfj.js.map} +3 -3
  119. package/dist/{chunk-vj723r3p.js → chunk-8b55ygje.js} +1 -1
  120. package/dist/chunk-8m5ejdpn.js +33 -0
  121. package/dist/chunk-8m5ejdpn.js.map +10 -0
  122. package/dist/chunk-8ryen3p3.js +118 -0
  123. package/dist/chunk-8ryen3p3.js.map +10 -0
  124. package/dist/chunk-979ww6b3.js +298 -0
  125. package/dist/chunk-979ww6b3.js.map +12 -0
  126. package/dist/{chunk-ya6brh8a.js → chunk-9t8f5xfx.js} +10 -5
  127. package/dist/chunk-9t8f5xfx.js.map +11 -0
  128. package/dist/{chunk-r65yscvk.js → chunk-a31h57d5.js} +131 -13
  129. package/dist/chunk-a31h57d5.js.map +13 -0
  130. package/dist/chunk-bct7hmfc.js +402 -0
  131. package/dist/chunk-bct7hmfc.js.map +14 -0
  132. package/dist/chunk-bh6k3nc6.js +164 -0
  133. package/dist/chunk-bh6k3nc6.js.map +12 -0
  134. package/dist/{chunk-t72dvahb.js → chunk-bhxaq2nn.js} +61 -44
  135. package/dist/chunk-bhxaq2nn.js.map +12 -0
  136. package/dist/{chunk-jdwx7vzs.js → chunk-c6qd89g5.js} +240 -143
  137. package/dist/chunk-c6qd89g5.js.map +15 -0
  138. package/dist/{chunk-2s6sydsh.js → chunk-ckxfnx7f.js} +294 -4
  139. package/dist/chunk-ckxfnx7f.js.map +13 -0
  140. package/dist/chunk-cy0n5dms.js +27 -0
  141. package/dist/chunk-cy0n5dms.js.map +11 -0
  142. package/dist/chunk-dsrkgtnh.js +50 -0
  143. package/dist/chunk-dsrkgtnh.js.map +10 -0
  144. package/dist/{chunk-50kv63vj.js → chunk-dysw7nsm.js} +118 -26
  145. package/dist/chunk-dysw7nsm.js.map +14 -0
  146. package/dist/chunk-ezake7g1.js +32 -0
  147. package/dist/chunk-ezake7g1.js.map +11 -0
  148. package/dist/{chunk-yxss87qa.js → chunk-f2rt4vkh.js} +48 -29
  149. package/dist/chunk-f2rt4vkh.js.map +14 -0
  150. package/dist/{chunk-q4qzq0ea.js → chunk-fmx1sz2h.js} +117 -56
  151. package/dist/chunk-fmx1sz2h.js.map +15 -0
  152. package/dist/chunk-g9t3kdtx.js +90 -0
  153. package/dist/chunk-g9t3kdtx.js.map +10 -0
  154. package/dist/{chunk-c3zd880g.js → chunk-ghteq96b.js} +8 -8
  155. package/dist/{chunk-c3zd880g.js.map → chunk-ghteq96b.js.map} +4 -4
  156. package/dist/chunk-h9kxd41f.js +271 -0
  157. package/dist/chunk-h9kxd41f.js.map +11 -0
  158. package/dist/chunk-htq0qh7z.js +59 -0
  159. package/dist/chunk-htq0qh7z.js.map +11 -0
  160. package/dist/{chunk-dcgrzj1t.js → chunk-jaj13078.js} +121 -9
  161. package/dist/chunk-jaj13078.js.map +38 -0
  162. package/dist/{chunk-t358gywy.js → chunk-k9pts48t.js} +81 -58
  163. package/dist/chunk-k9pts48t.js.map +35 -0
  164. package/dist/chunk-n8herkry.js +3294 -0
  165. package/dist/chunk-n8herkry.js.map +35 -0
  166. package/dist/chunk-nf4r78r4.js +44 -0
  167. package/dist/chunk-nf4r78r4.js.map +10 -0
  168. package/dist/{chunk-2gpr6jsz.js → chunk-nnyp53zt.js} +14 -34
  169. package/dist/chunk-nnyp53zt.js.map +13 -0
  170. package/dist/chunk-nten49ta.js +404 -0
  171. package/dist/chunk-nten49ta.js.map +12 -0
  172. package/dist/chunk-qvybnnpe.js +137 -0
  173. package/dist/chunk-qvybnnpe.js.map +10 -0
  174. package/dist/{chunk-tsk2bxs3.js → chunk-rnshztfq.js} +13 -13
  175. package/dist/{chunk-tsk2bxs3.js.map → chunk-rnshztfq.js.map} +3 -3
  176. package/dist/chunk-sa4340y1.js +607 -0
  177. package/dist/chunk-sa4340y1.js.map +14 -0
  178. package/dist/{chunk-yvef9xwc.js → chunk-st4xgxey.js} +583 -251
  179. package/dist/chunk-st4xgxey.js.map +45 -0
  180. package/dist/{chunk-1vffvydj.js → chunk-t8t39h7v.js} +6 -6
  181. package/dist/chunk-t8t39h7v.js.map +10 -0
  182. package/dist/chunk-t9xghkva.js +28 -0
  183. package/dist/chunk-t9xghkva.js.map +10 -0
  184. package/dist/chunk-vp1vc6ee.js +35 -0
  185. package/dist/chunk-vp1vc6ee.js.map +11 -0
  186. package/dist/{chunk-p6r5g77m.js → chunk-vybf6pkp.js} +1 -1
  187. package/dist/{chunk-wj01s5hr.js → chunk-wtmzkcht.js} +4 -3
  188. package/dist/chunk-wtmzkcht.js.map +11 -0
  189. package/dist/{chunk-v5c085yp.js → chunk-xhy826cz.js} +3 -2
  190. package/dist/chunk-xhy826cz.js.map +10 -0
  191. package/dist/chunk-xkthy56g.js +33 -0
  192. package/dist/chunk-xkthy56g.js.map +11 -0
  193. package/dist/{chunk-aebzcsxr.js → chunk-ys1nse2v.js} +2178 -382
  194. package/dist/chunk-ys1nse2v.js.map +56 -0
  195. package/dist/{chunk-5yny9z0e.js → chunk-z3zp0bj1.js} +1 -1
  196. package/dist/chunk-zcnhxkvd.js +7 -0
  197. package/dist/chunk-zcnhxkvd.js.map +10 -0
  198. package/dist/chunk-zg9yryhz.js +252 -0
  199. package/dist/chunk-zg9yryhz.js.map +12 -0
  200. package/dist/chunk-zqqz8052.js +3 -0
  201. package/dist/{storage/projection-runs/lifecycle.js.map → chunk-zqqz8052.js.map} +1 -1
  202. package/dist/{chunk-4pycxcj3.js → chunk-zqysyfjt.js} +6 -9
  203. package/dist/{chunk-4pycxcj3.js.map → chunk-zqysyfjt.js.map} +3 -3
  204. package/dist/connectors/builders.d.ts +2 -1
  205. package/dist/connectors/builders.d.ts.map +1 -1
  206. package/dist/connectors/connections/authorizations.d.ts +64 -0
  207. package/dist/connectors/connections/authorizations.d.ts.map +1 -0
  208. package/dist/connectors/connections/capability.d.ts +7 -0
  209. package/dist/connectors/connections/capability.d.ts.map +1 -0
  210. package/dist/connectors/connections/command-context.d.ts +23 -0
  211. package/dist/connectors/connections/command-context.d.ts.map +1 -0
  212. package/dist/connectors/connections/contracts.d.ts +127 -0
  213. package/dist/connectors/connections/contracts.d.ts.map +1 -0
  214. package/dist/connectors/connections/credential-codec.d.ts +15 -0
  215. package/dist/connectors/connections/credential-codec.d.ts.map +1 -0
  216. package/dist/connectors/connections/credential-mutations.d.ts +63 -0
  217. package/dist/connectors/connections/credential-mutations.d.ts.map +1 -0
  218. package/dist/connectors/connections/execution.d.ts +20 -0
  219. package/dist/connectors/connections/execution.d.ts.map +1 -0
  220. package/dist/connectors/connections/internal.d.ts +5 -0
  221. package/dist/connectors/connections/internal.d.ts.map +1 -0
  222. package/dist/connectors/connections/internal.js +16 -0
  223. package/dist/connectors/connections/internal.js.map +9 -0
  224. package/dist/connectors/connections/provider-operation.d.ts +7 -0
  225. package/dist/connectors/connections/provider-operation.d.ts.map +1 -0
  226. package/dist/connectors/connections/request.d.ts +84 -0
  227. package/dist/connectors/connections/request.d.ts.map +1 -0
  228. package/dist/connectors/connections/runs.d.ts +51 -0
  229. package/dist/connectors/connections/runs.d.ts.map +1 -0
  230. package/dist/connectors/connections/service.d.ts +52 -0
  231. package/dist/connectors/connections/service.d.ts.map +1 -0
  232. package/dist/connectors/connections/storage-boundary.d.ts +3 -0
  233. package/dist/connectors/connections/storage-boundary.d.ts.map +1 -0
  234. package/dist/connectors/connections/tokens.d.ts +32 -0
  235. package/dist/connectors/connections/tokens.d.ts.map +1 -0
  236. package/dist/connectors/connections/validation.d.ts +27 -0
  237. package/dist/connectors/connections/validation.d.ts.map +1 -0
  238. package/dist/connectors/connections/views.d.ts +7 -0
  239. package/dist/connectors/connections/views.d.ts.map +1 -0
  240. package/dist/connectors/credentials.d.ts +25 -0
  241. package/dist/connectors/credentials.d.ts.map +1 -0
  242. package/dist/connectors/errors.d.ts +35 -3
  243. package/dist/connectors/errors.d.ts.map +1 -1
  244. package/dist/connectors/execution.d.ts +19 -0
  245. package/dist/connectors/execution.d.ts.map +1 -0
  246. package/dist/connectors/index.d.ts +5 -3
  247. package/dist/connectors/index.d.ts.map +1 -1
  248. package/dist/connectors/service.d.ts +23 -0
  249. package/dist/connectors/service.d.ts.map +1 -0
  250. package/dist/connectors/types.d.ts +94 -2
  251. package/dist/connectors/types.d.ts.map +1 -1
  252. package/dist/datasets/builders.d.ts +18 -5
  253. package/dist/datasets/builders.d.ts.map +1 -1
  254. package/dist/datasets/changes.d.ts +18 -0
  255. package/dist/datasets/changes.d.ts.map +1 -0
  256. package/dist/datasets/execution.d.ts +8 -0
  257. package/dist/datasets/execution.d.ts.map +1 -0
  258. package/dist/datasets/index.d.ts +3 -1
  259. package/dist/datasets/index.d.ts.map +1 -1
  260. package/dist/datasets/types.d.ts +2 -0
  261. package/dist/datasets/types.d.ts.map +1 -1
  262. package/dist/datasets/validation.d.ts.map +1 -1
  263. package/dist/error-reporting/capability.d.ts +4 -49
  264. package/dist/error-reporting/capability.d.ts.map +1 -1
  265. package/dist/error-reporting/internal.d.ts +2 -2
  266. package/dist/error-reporting/internal.d.ts.map +1 -1
  267. package/dist/error-reporting/internal.js +10 -4
  268. package/dist/error-reporting/internal.js.map +1 -1
  269. package/dist/error-reporting/reporter.d.ts +4 -1
  270. package/dist/error-reporting/reporter.d.ts.map +1 -1
  271. package/dist/error-reporting/reports.d.ts +64 -0
  272. package/dist/error-reporting/reports.d.ts.map +1 -0
  273. package/dist/error-reporting/types.d.ts +88 -34
  274. package/dist/error-reporting/types.d.ts.map +1 -1
  275. package/dist/errors/catalog.d.ts +141 -0
  276. package/dist/errors/catalog.d.ts.map +1 -0
  277. package/dist/errors/internal.d.ts +68 -0
  278. package/dist/errors/internal.d.ts.map +1 -0
  279. package/dist/errors/internal.js +29 -0
  280. package/dist/errors/internal.js.map +9 -0
  281. package/dist/errors/types.d.ts +20 -0
  282. package/dist/errors/types.d.ts.map +1 -0
  283. package/dist/events/definitions.d.ts +0 -1
  284. package/dist/events/definitions.d.ts.map +1 -1
  285. package/dist/events/execution.d.ts +13 -0
  286. package/dist/events/execution.d.ts.map +1 -0
  287. package/dist/events/index.d.ts +3 -2
  288. package/dist/events/index.d.ts.map +1 -1
  289. package/dist/events/index.js +10 -8
  290. package/dist/events/index.js.map +1 -1
  291. package/dist/events/outbox-dispatcher.d.ts +4 -2
  292. package/dist/events/outbox-dispatcher.d.ts.map +1 -1
  293. package/dist/events/{runtime.d.ts → service.d.ts} +13 -14
  294. package/dist/events/service.d.ts.map +1 -0
  295. package/dist/events/types/pipelines.d.ts +4 -1
  296. package/dist/events/types/pipelines.d.ts.map +1 -1
  297. package/dist/events/types/syncs.d.ts +3 -0
  298. package/dist/events/types/syncs.d.ts.map +1 -1
  299. package/dist/events/types/workflows.d.ts +4 -2
  300. package/dist/events/types/workflows.d.ts.map +1 -1
  301. package/dist/execution/agent.d.ts +42 -0
  302. package/dist/execution/agent.d.ts.map +1 -0
  303. package/dist/execution/agent.js +70 -0
  304. package/dist/execution/agent.js.map +9 -0
  305. package/dist/execution/authorization.d.ts +60 -0
  306. package/dist/execution/authorization.d.ts.map +1 -0
  307. package/dist/execution/dispatch.d.ts +8 -0
  308. package/dist/execution/dispatch.d.ts.map +1 -0
  309. package/dist/execution/durable.d.ts +37 -0
  310. package/dist/execution/durable.d.ts.map +1 -0
  311. package/dist/execution/index.d.ts +2 -0
  312. package/dist/execution/index.d.ts.map +1 -0
  313. package/dist/execution/primitive.d.ts +21 -0
  314. package/dist/execution/primitive.d.ts.map +1 -0
  315. package/dist/execution/primitive.js +88 -0
  316. package/dist/execution/primitive.js.map +10 -0
  317. package/dist/execution/request.d.ts +38 -0
  318. package/dist/execution/request.d.ts.map +1 -0
  319. package/dist/execution/request.js +97 -0
  320. package/dist/execution/request.js.map +10 -0
  321. package/dist/execution/scopes.d.ts +30 -0
  322. package/dist/execution/scopes.d.ts.map +1 -0
  323. package/dist/execution/types.d.ts +111 -0
  324. package/dist/execution/types.d.ts.map +1 -0
  325. package/dist/http/api-routes.d.ts.map +1 -1
  326. package/dist/http/index.js +1 -1
  327. package/dist/index.d.ts +35 -18
  328. package/dist/index.d.ts.map +1 -1
  329. package/dist/index.js +142 -111
  330. package/dist/index.js.map +1 -1
  331. package/dist/json.d.ts +8 -2
  332. package/dist/json.d.ts.map +1 -1
  333. package/dist/lake-storage/definition-updates.d.ts.map +1 -1
  334. package/dist/lake-storage/in-memory.d.ts +15 -1
  335. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  336. package/dist/lake-storage/index.d.ts +3 -1
  337. package/dist/lake-storage/index.d.ts.map +1 -1
  338. package/dist/lake-storage/index.js +15 -7
  339. package/dist/lake-storage/index.js.map +1 -1
  340. package/dist/lake-storage/merge-validation.d.ts +10 -0
  341. package/dist/lake-storage/merge-validation.d.ts.map +1 -0
  342. package/dist/lake-storage/merge.d.ts +32 -0
  343. package/dist/lake-storage/merge.d.ts.map +1 -0
  344. package/dist/lake-storage/types.d.ts +3 -1
  345. package/dist/lake-storage/types.d.ts.map +1 -1
  346. package/dist/logging/execution.d.ts +9 -0
  347. package/dist/logging/execution.d.ts.map +1 -0
  348. package/dist/logging/index.d.ts +1 -1
  349. package/dist/logging/index.d.ts.map +1 -1
  350. package/dist/logging/index.js +8 -8
  351. package/dist/logging/index.js.map +1 -1
  352. package/dist/logging/{runtime.d.ts → service.d.ts} +7 -7
  353. package/dist/logging/{runtime.d.ts.map → service.d.ts.map} +1 -1
  354. package/dist/logging/types.js +2 -2
  355. package/dist/materialization/events.d.ts +1 -0
  356. package/dist/materialization/events.d.ts.map +1 -1
  357. package/dist/materialization/index.d.ts +1 -1
  358. package/dist/materialization/index.d.ts.map +1 -1
  359. package/dist/materialization/index.js +2 -2
  360. package/dist/materialization/model.d.ts +26 -17
  361. package/dist/materialization/model.d.ts.map +1 -1
  362. package/dist/materializer/edits/commit.d.ts +2 -1
  363. package/dist/materializer/edits/commit.d.ts.map +1 -1
  364. package/dist/materializer/edits/load-state.d.ts +1 -1
  365. package/dist/materializer/edits/load-state.d.ts.map +1 -1
  366. package/dist/materializer/edits/operations.d.ts +1 -13
  367. package/dist/materializer/edits/operations.d.ts.map +1 -1
  368. package/dist/materializer/edits/plan.d.ts +2 -1
  369. package/dist/materializer/edits/plan.d.ts.map +1 -1
  370. package/dist/materializer/edits/working-state.d.ts +36 -8
  371. package/dist/materializer/edits/working-state.d.ts.map +1 -1
  372. package/dist/materializer/effective/build-events.d.ts +1 -0
  373. package/dist/materializer/effective/build-events.d.ts.map +1 -1
  374. package/dist/materializer/effective/diff.d.ts +7 -0
  375. package/dist/materializer/effective/diff.d.ts.map +1 -1
  376. package/dist/materializer/effective/load-state.d.ts +0 -2
  377. package/dist/materializer/effective/load-state.d.ts.map +1 -1
  378. package/dist/materializer/effective/resolve.d.ts +17 -2
  379. package/dist/materializer/effective/resolve.d.ts.map +1 -1
  380. package/dist/materializer/execution/commit-lifecycle.d.ts +2 -2
  381. package/dist/materializer/execution/commit-lifecycle.d.ts.map +1 -1
  382. package/dist/materializer/execution/plan-stream.d.ts.map +1 -1
  383. package/dist/materializer/execution/scope.d.ts +26 -0
  384. package/dist/materializer/execution/scope.d.ts.map +1 -0
  385. package/dist/materializer/execution/work-executor.d.ts.map +1 -1
  386. package/dist/materializer/execution/work-records.d.ts +6 -5
  387. package/dist/materializer/execution/work-records.d.ts.map +1 -1
  388. package/dist/materializer/index.d.ts +2 -2
  389. package/dist/materializer/index.d.ts.map +1 -1
  390. package/dist/materializer/index.js +30 -18
  391. package/dist/materializer/index.js.map +1 -1
  392. package/dist/materializer/materializer.d.ts +37 -5
  393. package/dist/materializer/materializer.d.ts.map +1 -1
  394. package/dist/materializer/projections/finish-run.d.ts +2 -1
  395. package/dist/materializer/projections/finish-run.d.ts.map +1 -1
  396. package/dist/materializer/projections/replace.d.ts +2 -1
  397. package/dist/materializer/projections/replace.d.ts.map +1 -1
  398. package/dist/materializer/projections/replacement-plan.d.ts +1 -0
  399. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  400. package/dist/materializer/shared/batching.d.ts.map +1 -1
  401. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  402. package/dist/materializer/telemetry/append.d.ts +2 -1
  403. package/dist/materializer/telemetry/append.d.ts.map +1 -1
  404. package/dist/materializer/telemetry/plan.d.ts +7 -1
  405. package/dist/materializer/telemetry/plan.d.ts.map +1 -1
  406. package/dist/objects/action/request.d.ts +3 -3
  407. package/dist/objects/action/request.d.ts.map +1 -1
  408. package/dist/objects/context/index.d.ts +1 -1
  409. package/dist/objects/context/index.d.ts.map +1 -1
  410. package/dist/objects/context/types.d.ts +5 -0
  411. package/dist/objects/context/types.d.ts.map +1 -1
  412. package/dist/objects/execution.d.ts +100 -0
  413. package/dist/objects/execution.d.ts.map +1 -0
  414. package/dist/objects/index.js +37 -24
  415. package/dist/objects/index.js.map +1 -1
  416. package/dist/objects/materializer-adapter.d.ts +1 -1
  417. package/dist/objects/materializer-adapter.d.ts.map +1 -1
  418. package/dist/objects/query/executor.d.ts +3 -8
  419. package/dist/objects/query/executor.d.ts.map +1 -1
  420. package/dist/objects/query/index.d.ts +2 -2
  421. package/dist/objects/query/index.d.ts.map +1 -1
  422. package/dist/objects/query/index.js +9 -13
  423. package/dist/objects/query/index.js.map +1 -1
  424. package/dist/objects/query/planner.d.ts +0 -3
  425. package/dist/objects/query/planner.d.ts.map +1 -1
  426. package/dist/objects/sdk/object-handle.d.ts +2 -2
  427. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  428. package/dist/objects/sdk/object-set.d.ts +2 -0
  429. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  430. package/dist/objects/sdk/runtime-query-executor.d.ts +2 -0
  431. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  432. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  433. package/dist/objects/service/action-service.d.ts +3 -2
  434. package/dist/objects/service/action-service.d.ts.map +1 -1
  435. package/dist/objects/service/list-service.d.ts +1 -1
  436. package/dist/objects/telemetry/history.d.ts +2 -0
  437. package/dist/objects/telemetry/history.d.ts.map +1 -1
  438. package/dist/objects/telemetry/write-batch.d.ts.map +1 -1
  439. package/dist/ontology/index.d.ts +1 -1
  440. package/dist/ontology/index.d.ts.map +1 -1
  441. package/dist/ontology/index.js +5 -5
  442. package/dist/ontology/internal.js +7 -6
  443. package/dist/ontology/internal.js.map +3 -3
  444. package/dist/ontology/registry.d.ts +15 -2
  445. package/dist/ontology/registry.d.ts.map +1 -1
  446. package/dist/ontology/validation/normalize.d.ts.map +1 -1
  447. package/dist/pipelines/execution.d.ts +19 -0
  448. package/dist/pipelines/execution.d.ts.map +1 -0
  449. package/dist/pipelines/index.d.ts +1 -0
  450. package/dist/pipelines/index.d.ts.map +1 -1
  451. package/dist/pipelines/index.js +66 -0
  452. package/dist/pipelines/index.js.map +9 -0
  453. package/dist/pipelines/request.d.ts +6 -9
  454. package/dist/pipelines/request.d.ts.map +1 -1
  455. package/dist/pipelines/run-dispatch.d.ts +47 -0
  456. package/dist/pipelines/run-dispatch.d.ts.map +1 -0
  457. package/dist/projections/builders.d.ts +0 -2
  458. package/dist/projections/builders.d.ts.map +1 -1
  459. package/dist/projections/capability.d.ts +7 -0
  460. package/dist/projections/capability.d.ts.map +1 -0
  461. package/dist/projections/execution.d.ts +19 -0
  462. package/dist/projections/execution.d.ts.map +1 -0
  463. package/dist/projections/index.d.ts +3 -1
  464. package/dist/projections/index.d.ts.map +1 -1
  465. package/dist/projections/internal.d.ts +4 -10
  466. package/dist/projections/internal.d.ts.map +1 -1
  467. package/dist/projections/internal.js +42 -6
  468. package/dist/projections/internal.js.map +1 -1
  469. package/dist/projections/ownership.d.ts +2 -2
  470. package/dist/projections/ownership.d.ts.map +1 -1
  471. package/dist/projections/registry.d.ts +21 -11
  472. package/dist/projections/registry.d.ts.map +1 -1
  473. package/dist/projections/revision.d.ts +2 -2
  474. package/dist/projections/revision.d.ts.map +1 -1
  475. package/dist/projections/run-dispatch.d.ts +37 -0
  476. package/dist/projections/run-dispatch.d.ts.map +1 -0
  477. package/dist/projections/run-id.d.ts +3 -0
  478. package/dist/projections/run-id.d.ts.map +1 -0
  479. package/dist/projections/types.d.ts +3 -0
  480. package/dist/projections/types.d.ts.map +1 -1
  481. package/dist/projections/validation.d.ts +2 -2
  482. package/dist/projections/validation.d.ts.map +1 -1
  483. package/dist/queues/in-memory.d.ts +11 -10
  484. package/dist/queues/in-memory.d.ts.map +1 -1
  485. package/dist/queues/index.d.ts +1 -1
  486. package/dist/queues/index.d.ts.map +1 -1
  487. package/dist/queues/index.js +1 -1
  488. package/dist/queues/types.d.ts +52 -42
  489. package/dist/queues/types.d.ts.map +1 -1
  490. package/dist/rules/execution.d.ts +14 -0
  491. package/dist/rules/execution.d.ts.map +1 -0
  492. package/dist/rules/index.d.ts +1 -1
  493. package/dist/rules/index.d.ts.map +1 -1
  494. package/dist/rules/validation.d.ts +1 -2
  495. package/dist/rules/validation.d.ts.map +1 -1
  496. package/dist/runtime/ai-usage.d.ts +8 -0
  497. package/dist/runtime/ai-usage.d.ts.map +1 -0
  498. package/dist/runtime/create.d.ts +7 -5
  499. package/dist/runtime/create.d.ts.map +1 -1
  500. package/dist/runtime/definitions.d.ts +35 -0
  501. package/dist/runtime/definitions.d.ts.map +1 -0
  502. package/dist/runtime/host.d.ts +123 -0
  503. package/dist/runtime/host.d.ts.map +1 -0
  504. package/dist/runtime/index.d.ts +6 -5
  505. package/dist/runtime/index.d.ts.map +1 -1
  506. package/dist/runtime/internal.d.ts +4 -0
  507. package/dist/runtime/internal.d.ts.map +1 -1
  508. package/dist/runtime/internal.js +6 -2
  509. package/dist/runtime/internal.js.map +1 -1
  510. package/dist/runtime/ontology-mutations.d.ts +4 -2
  511. package/dist/runtime/ontology-mutations.d.ts.map +1 -1
  512. package/dist/runtime/resolve-definitions.d.ts +42 -0
  513. package/dist/runtime/resolve-definitions.d.ts.map +1 -0
  514. package/dist/runtime/sixb.d.ts +43 -219
  515. package/dist/runtime/sixb.d.ts.map +1 -1
  516. package/dist/runtime/types.d.ts +16 -216
  517. package/dist/runtime/types.d.ts.map +1 -1
  518. package/dist/scheduler/index.d.ts +1 -1
  519. package/dist/scheduler/index.d.ts.map +1 -1
  520. package/dist/scheduler/index.js +3 -6
  521. package/dist/scheduler/index.js.map +1 -1
  522. package/dist/scheduler/runtime.d.ts +7 -2
  523. package/dist/scheduler/runtime.d.ts.map +1 -1
  524. package/dist/schedules/execution.d.ts +6 -0
  525. package/dist/schedules/execution.d.ts.map +1 -0
  526. package/dist/schedules/index.js +9 -7
  527. package/dist/schedules/index.js.map +1 -1
  528. package/dist/schedules/types.d.ts +1 -3
  529. package/dist/schedules/types.d.ts.map +1 -1
  530. package/dist/security/every.d.ts +4 -1
  531. package/dist/security/every.d.ts.map +1 -1
  532. package/dist/security/grants.d.ts +4 -1
  533. package/dist/security/grants.d.ts.map +1 -1
  534. package/dist/security/index.d.ts +3 -1
  535. package/dist/security/index.d.ts.map +1 -1
  536. package/dist/security/registry.d.ts +42 -0
  537. package/dist/security/registry.d.ts.map +1 -0
  538. package/dist/security/types.d.ts +7 -12
  539. package/dist/security/types.d.ts.map +1 -1
  540. package/dist/security/validation.d.ts +2 -0
  541. package/dist/security/validation.d.ts.map +1 -1
  542. package/dist/storage/action-runs/failure.d.ts +7 -0
  543. package/dist/storage/action-runs/failure.d.ts.map +1 -0
  544. package/dist/storage/action-runs/failure.js +14 -0
  545. package/dist/storage/action-runs/failure.js.map +9 -0
  546. package/dist/storage/action-runs/idempotency.d.ts.map +1 -1
  547. package/dist/storage/action-runs/in-memory.d.ts +3 -1
  548. package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
  549. package/dist/storage/action-runs/index.d.ts +2 -1
  550. package/dist/storage/action-runs/index.d.ts.map +1 -1
  551. package/dist/storage/action-runs/provider.d.ts +10 -0
  552. package/dist/storage/action-runs/provider.d.ts.map +1 -0
  553. package/dist/storage/action-runs/provider.js +13 -0
  554. package/dist/storage/action-runs/provider.js.map +9 -0
  555. package/dist/storage/action-runs/types.d.ts +37 -18
  556. package/dist/storage/action-runs/types.d.ts.map +1 -1
  557. package/dist/storage/agents/errors.d.ts +1 -1
  558. package/dist/storage/agents/errors.d.ts.map +1 -1
  559. package/dist/storage/agents/in-memory.d.ts +4 -1
  560. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  561. package/dist/storage/agents/index.d.ts +2 -2
  562. package/dist/storage/agents/index.d.ts.map +1 -1
  563. package/dist/storage/agents/provider.d.ts +10 -0
  564. package/dist/storage/agents/provider.d.ts.map +1 -0
  565. package/dist/storage/agents/provider.js +17 -0
  566. package/dist/storage/agents/provider.js.map +9 -0
  567. package/dist/storage/agents/types.d.ts +13 -22
  568. package/dist/storage/agents/types.d.ts.map +1 -1
  569. package/dist/storage/ai-usage/errors.d.ts +8 -0
  570. package/dist/storage/ai-usage/errors.d.ts.map +1 -0
  571. package/dist/storage/ai-usage/in-memory.d.ts +28 -0
  572. package/dist/storage/ai-usage/in-memory.d.ts.map +1 -0
  573. package/dist/storage/ai-usage/index.d.ts +8 -0
  574. package/dist/storage/ai-usage/index.d.ts.map +1 -0
  575. package/dist/storage/ai-usage/record.d.ts +6 -0
  576. package/dist/storage/ai-usage/record.d.ts.map +1 -0
  577. package/dist/storage/ai-usage/types.d.ts +89 -0
  578. package/dist/storage/ai-usage/types.d.ts.map +1 -0
  579. package/dist/storage/ai-usage/usage.d.ts +11 -0
  580. package/dist/storage/ai-usage/usage.d.ts.map +1 -0
  581. package/dist/storage/auth/types.d.ts +1 -0
  582. package/dist/storage/auth/types.d.ts.map +1 -1
  583. package/dist/storage/connector-connections/errors.d.ts +12 -0
  584. package/dist/storage/connector-connections/errors.d.ts.map +1 -0
  585. package/dist/storage/connector-connections/in-memory.d.ts +81 -0
  586. package/dist/storage/connector-connections/in-memory.d.ts.map +1 -0
  587. package/dist/storage/connector-connections/index.d.ts +7 -0
  588. package/dist/storage/connector-connections/index.d.ts.map +1 -0
  589. package/dist/storage/connector-connections/provider/authorizations.d.ts +20 -0
  590. package/dist/storage/connector-connections/provider/authorizations.d.ts.map +1 -0
  591. package/dist/storage/connector-connections/provider/connections.d.ts +17 -0
  592. package/dist/storage/connector-connections/provider/connections.d.ts.map +1 -0
  593. package/dist/storage/connector-connections/provider/runs.d.ts +14 -0
  594. package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -0
  595. package/dist/storage/connector-connections/provider/shared.d.ts +74 -0
  596. package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -0
  597. package/dist/storage/connector-connections/provider.d.ts +49 -0
  598. package/dist/storage/connector-connections/provider.d.ts.map +1 -0
  599. package/dist/storage/connector-connections/provider.js +1025 -0
  600. package/dist/storage/connector-connections/provider.js.map +14 -0
  601. package/dist/storage/connector-connections/types.d.ts +402 -0
  602. package/dist/storage/connector-connections/types.d.ts.map +1 -0
  603. package/dist/storage/executions/errors.d.ts +8 -0
  604. package/dist/storage/executions/errors.d.ts.map +1 -0
  605. package/dist/storage/executions/in-memory.d.ts +21 -0
  606. package/dist/storage/executions/in-memory.d.ts.map +1 -0
  607. package/dist/storage/executions/index.d.ts +5 -0
  608. package/dist/storage/executions/index.d.ts.map +1 -0
  609. package/dist/storage/executions/provider.d.ts +29 -0
  610. package/dist/storage/executions/provider.d.ts.map +1 -0
  611. package/dist/storage/executions/provider.js +208 -0
  612. package/dist/storage/executions/provider.js.map +10 -0
  613. package/dist/storage/executions/run-link.d.ts +24 -0
  614. package/dist/storage/executions/run-link.d.ts.map +1 -0
  615. package/dist/storage/executions/types.d.ts +62 -0
  616. package/dist/storage/executions/types.d.ts.map +1 -0
  617. package/dist/storage/executions/validation.d.ts +13 -0
  618. package/dist/storage/executions/validation.d.ts.map +1 -0
  619. package/dist/storage/in-memory/index.d.ts +20 -5
  620. package/dist/storage/in-memory/index.d.ts.map +1 -1
  621. package/dist/storage/index.d.ts +28 -17
  622. package/dist/storage/index.d.ts.map +1 -1
  623. package/dist/storage/index.js +90 -27
  624. package/dist/storage/index.js.map +1 -1
  625. package/dist/storage/ontology/commits.d.ts +1 -0
  626. package/dist/storage/ontology/commits.d.ts.map +1 -1
  627. package/dist/storage/ontology/in-memory/index.d.ts +1 -0
  628. package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
  629. package/dist/storage/ontology/in-memory/materializations-state.d.ts +3 -2
  630. package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
  631. package/dist/storage/ontology/in-memory/materializations-work.d.ts +2 -2
  632. package/dist/storage/ontology/in-memory/materializations-work.d.ts.map +1 -1
  633. package/dist/storage/ontology/in-memory/materializations.d.ts +3 -1
  634. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  635. package/dist/storage/ontology/in-memory/shared-state.d.ts +7 -2
  636. package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
  637. package/dist/storage/ontology/index.d.ts +3 -2
  638. package/dist/storage/ontology/index.d.ts.map +1 -1
  639. package/dist/storage/ontology/materializations.d.ts +50 -5
  640. package/dist/storage/ontology/materializations.d.ts.map +1 -1
  641. package/dist/storage/ontology/outbox.d.ts +8 -2
  642. package/dist/storage/ontology/outbox.d.ts.map +1 -1
  643. package/dist/storage/ontology/provider-work.d.ts.map +1 -1
  644. package/dist/storage/ontology/provider.d.ts +5 -22
  645. package/dist/storage/ontology/provider.d.ts.map +1 -1
  646. package/dist/storage/ontology/provider.js +6 -7
  647. package/dist/storage/ontology/provider.js.map +1 -1
  648. package/dist/storage/operation-scope.d.ts.map +1 -1
  649. package/dist/storage/operation-scope.js +1 -1
  650. package/dist/storage/pipeline-runs/idempotency.d.ts +3 -0
  651. package/dist/storage/pipeline-runs/idempotency.d.ts.map +1 -0
  652. package/dist/storage/pipeline-runs/in-memory.d.ts +5 -1
  653. package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
  654. package/dist/storage/pipeline-runs/index.d.ts +3 -1
  655. package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
  656. package/dist/storage/pipeline-runs/provider.d.ts +10 -0
  657. package/dist/storage/pipeline-runs/provider.d.ts.map +1 -0
  658. package/dist/storage/pipeline-runs/provider.js +11 -0
  659. package/dist/storage/pipeline-runs/provider.js.map +9 -0
  660. package/dist/storage/pipeline-runs/types.d.ts +30 -14
  661. package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
  662. package/dist/storage/projection-runs/in-memory.d.ts +8 -3
  663. package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
  664. package/dist/storage/projection-runs/index.d.ts +2 -2
  665. package/dist/storage/projection-runs/index.d.ts.map +1 -1
  666. package/dist/storage/projection-runs/lifecycle.d.ts +14 -8
  667. package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
  668. package/dist/storage/projection-runs/provider.d.ts +13 -0
  669. package/dist/storage/projection-runs/provider.d.ts.map +1 -0
  670. package/dist/storage/projection-runs/{lifecycle.js → provider.js} +15 -4
  671. package/dist/storage/projection-runs/provider.js.map +9 -0
  672. package/dist/storage/projection-runs/types.d.ts +28 -11
  673. package/dist/storage/projection-runs/types.d.ts.map +1 -1
  674. package/dist/storage/run-listing.d.ts +8 -9
  675. package/dist/storage/run-listing.d.ts.map +1 -1
  676. package/dist/storage/sync-runs/idempotency.d.ts +3 -0
  677. package/dist/storage/sync-runs/idempotency.d.ts.map +1 -0
  678. package/dist/storage/sync-runs/in-memory.d.ts +5 -1
  679. package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
  680. package/dist/storage/sync-runs/index.d.ts +3 -1
  681. package/dist/storage/sync-runs/index.d.ts.map +1 -1
  682. package/dist/storage/sync-runs/provider.d.ts +10 -0
  683. package/dist/storage/sync-runs/provider.d.ts.map +1 -0
  684. package/dist/storage/sync-runs/provider.js +11 -0
  685. package/dist/storage/sync-runs/provider.js.map +9 -0
  686. package/dist/storage/sync-runs/types.d.ts +35 -14
  687. package/dist/storage/sync-runs/types.d.ts.map +1 -1
  688. package/dist/storage/types.d.ts +20 -15
  689. package/dist/storage/types.d.ts.map +1 -1
  690. package/dist/storage/webhook-runs/errors.d.ts +3 -0
  691. package/dist/storage/webhook-runs/errors.d.ts.map +1 -1
  692. package/dist/storage/webhook-runs/in-memory.d.ts +13 -1
  693. package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
  694. package/dist/storage/webhook-runs/index.d.ts +3 -2
  695. package/dist/storage/webhook-runs/index.d.ts.map +1 -1
  696. package/dist/storage/webhook-runs/provider.d.ts +10 -0
  697. package/dist/storage/webhook-runs/provider.d.ts.map +1 -0
  698. package/dist/storage/webhook-runs/provider.js +11 -0
  699. package/dist/storage/webhook-runs/provider.js.map +9 -0
  700. package/dist/storage/webhook-runs/types.d.ts +37 -11
  701. package/dist/storage/webhook-runs/types.d.ts.map +1 -1
  702. package/dist/storage/workflow-runs/in-memory.d.ts +6 -2
  703. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  704. package/dist/storage/workflow-runs/index.d.ts +2 -1
  705. package/dist/storage/workflow-runs/index.d.ts.map +1 -1
  706. package/dist/storage/workflow-runs/provider.d.ts +19 -0
  707. package/dist/storage/workflow-runs/provider.d.ts.map +1 -0
  708. package/dist/storage/workflow-runs/provider.js +19 -0
  709. package/dist/storage/workflow-runs/provider.js.map +9 -0
  710. package/dist/storage/workflow-runs/types.d.ts +30 -30
  711. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  712. package/dist/syncs/builders.d.ts +11 -3
  713. package/dist/syncs/builders.d.ts.map +1 -1
  714. package/dist/syncs/execution.d.ts +18 -0
  715. package/dist/syncs/execution.d.ts.map +1 -0
  716. package/dist/syncs/index.d.ts +3 -1
  717. package/dist/syncs/index.d.ts.map +1 -1
  718. package/dist/syncs/index.js +65 -0
  719. package/dist/syncs/index.js.map +9 -0
  720. package/dist/syncs/request.d.ts +6 -16
  721. package/dist/syncs/request.d.ts.map +1 -1
  722. package/dist/syncs/run-dispatch.d.ts +47 -0
  723. package/dist/syncs/run-dispatch.d.ts.map +1 -0
  724. package/dist/syncs/sources.d.ts +8 -0
  725. package/dist/syncs/sources.d.ts.map +1 -0
  726. package/dist/syncs/types.d.ts +34 -22
  727. package/dist/syncs/types.d.ts.map +1 -1
  728. package/dist/syncs/validation.d.ts +14 -0
  729. package/dist/syncs/validation.d.ts.map +1 -0
  730. package/dist/testing/action-execution.d.ts +12 -0
  731. package/dist/testing/action-execution.d.ts.map +1 -0
  732. package/dist/testing/agent-execution.d.ts +14 -0
  733. package/dist/testing/agent-execution.d.ts.map +1 -0
  734. package/dist/testing/agent-storage-contract.d.ts +10 -3
  735. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  736. package/dist/testing/ai-usage-storage-contract.d.ts +13 -0
  737. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -0
  738. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  739. package/dist/testing/broker-contract.d.ts.map +1 -1
  740. package/dist/testing/connector-connection-storage-contract.d.ts +16 -0
  741. package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -0
  742. package/dist/testing/execution-storage-contract.d.ts +15 -0
  743. package/dist/testing/execution-storage-contract.d.ts.map +1 -0
  744. package/dist/testing/execution.d.ts +23 -0
  745. package/dist/testing/execution.d.ts.map +1 -0
  746. package/dist/testing/index.d.ts +13 -0
  747. package/dist/testing/index.d.ts.map +1 -1
  748. package/dist/testing/index.js +4270 -1484
  749. package/dist/testing/index.js.map +27 -14
  750. package/dist/testing/lake-merge-storage-contract.d.ts +7 -0
  751. package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -0
  752. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  753. package/dist/testing/materializer-fixture.d.ts +2 -2
  754. package/dist/testing/materializer-fixture.d.ts.map +1 -1
  755. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  756. package/dist/testing/ontology-contract-fixture.d.ts +1 -0
  757. package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
  758. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  759. package/dist/testing/pipeline-execution.d.ts +16 -0
  760. package/dist/testing/pipeline-execution.d.ts.map +1 -0
  761. package/dist/testing/projection-execution.d.ts +20 -0
  762. package/dist/testing/projection-execution.d.ts.map +1 -0
  763. package/dist/testing/projection-run-storage-contract.d.ts +9 -4
  764. package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
  765. package/dist/testing/queues-contract.d.ts.map +1 -1
  766. package/dist/testing/sync-execution.d.ts +16 -0
  767. package/dist/testing/sync-execution.d.ts.map +1 -0
  768. package/dist/testing/webhook-execution.d.ts +12 -0
  769. package/dist/testing/webhook-execution.d.ts.map +1 -0
  770. package/dist/testing/webhook-run-storage-contract.d.ts +11 -0
  771. package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -0
  772. package/dist/testing/workflow-execution.d.ts +23 -0
  773. package/dist/testing/workflow-execution.d.ts.map +1 -0
  774. package/dist/webhooks/index.d.ts +2 -1
  775. package/dist/webhooks/index.d.ts.map +1 -1
  776. package/dist/webhooks/internal.d.ts +2 -0
  777. package/dist/webhooks/internal.d.ts.map +1 -0
  778. package/dist/webhooks/internal.js +150 -0
  779. package/dist/webhooks/internal.js.map +10 -0
  780. package/dist/webhooks/registry.d.ts +18 -4
  781. package/dist/webhooks/registry.d.ts.map +1 -1
  782. package/dist/webhooks/run-admission.d.ts +25 -0
  783. package/dist/webhooks/run-admission.d.ts.map +1 -0
  784. package/dist/webhooks/types.d.ts +8 -5
  785. package/dist/webhooks/types.d.ts.map +1 -1
  786. package/dist/workers/index.js +18 -19
  787. package/dist/workers/index.js.map +4 -4
  788. package/dist/workers/queue-delivery.d.ts +7 -7
  789. package/dist/workers/queue-delivery.d.ts.map +1 -1
  790. package/dist/workers/queue-worker.d.ts +30 -11
  791. package/dist/workers/queue-worker.d.ts.map +1 -1
  792. package/dist/workflows/execution.d.ts +49 -0
  793. package/dist/workflows/execution.d.ts.map +1 -0
  794. package/dist/workflows/failure.d.ts +28 -0
  795. package/dist/workflows/failure.d.ts.map +1 -0
  796. package/dist/workflows/index.d.ts +4 -2
  797. package/dist/workflows/index.d.ts.map +1 -1
  798. package/dist/workflows/index.js +63 -35
  799. package/dist/workflows/index.js.map +1 -1
  800. package/dist/workflows/request.d.ts +2 -1
  801. package/dist/workflows/request.d.ts.map +1 -1
  802. package/dist/workflows/run-dispatch.d.ts +59 -0
  803. package/dist/workflows/run-dispatch.d.ts.map +1 -0
  804. package/dist/workflows/types.d.ts +38 -8
  805. package/dist/workflows/types.d.ts.map +1 -1
  806. package/package.json +107 -5
  807. package/src/actions/commit-edits.ts +0 -3
  808. package/src/actions/execution.ts +83 -0
  809. package/src/actions/index.ts +1 -1
  810. package/src/actions/registry.ts +22 -10
  811. package/src/actions/request.ts +55 -177
  812. package/src/actions/run-dispatch.ts +276 -0
  813. package/src/actions/types/context.ts +2 -4
  814. package/src/actions/validation.ts +2 -2
  815. package/src/agents/adapters.ts +8 -12
  816. package/src/agents/authority.ts +189 -0
  817. package/src/agents/builders.ts +53 -3
  818. package/src/agents/dispatch.ts +1 -6
  819. package/src/agents/errors.ts +24 -0
  820. package/src/agents/execution.ts +254 -0
  821. package/src/agents/index.ts +37 -5
  822. package/src/agents/prompt.ts +17 -5
  823. package/src/agents/request.ts +153 -13
  824. package/src/agents/streams.ts +150 -3
  825. package/src/agents/tool-definition.ts +93 -0
  826. package/src/agents/types.ts +99 -0
  827. package/src/agents/validation.ts +289 -5
  828. package/src/auth/attribution.ts +48 -0
  829. package/src/auth/index.ts +1 -0
  830. package/src/auth/runtime.ts +5 -5
  831. package/src/authorization/decision.ts +75 -14
  832. package/src/authorization/grant-kinds.ts +9 -0
  833. package/src/authorization/index.ts +2 -0
  834. package/src/blob-storage/execution.ts +78 -0
  835. package/src/blob-storage/validation.ts +2 -10
  836. package/src/bootstrap/discovery.ts +88 -268
  837. package/src/bootstrap/index.ts +2 -13
  838. package/src/broker/in-memory.ts +8 -1
  839. package/src/broker/types.ts +5 -0
  840. package/src/connectors/builders.ts +37 -2
  841. package/src/connectors/connections/authorizations.ts +646 -0
  842. package/src/connectors/connections/capability.ts +59 -0
  843. package/src/connectors/connections/command-context.ts +98 -0
  844. package/src/connectors/connections/contracts.ts +208 -0
  845. package/src/connectors/connections/credential-codec.ts +48 -0
  846. package/src/connectors/connections/credential-mutations.ts +574 -0
  847. package/src/connectors/connections/execution.ts +138 -0
  848. package/src/connectors/connections/internal.ts +17 -0
  849. package/src/connectors/connections/provider-operation.ts +41 -0
  850. package/src/connectors/connections/request.ts +447 -0
  851. package/src/connectors/connections/runs.ts +702 -0
  852. package/src/connectors/connections/service.ts +644 -0
  853. package/src/connectors/connections/storage-boundary.ts +13 -0
  854. package/src/connectors/connections/tokens.ts +292 -0
  855. package/src/connectors/connections/validation.ts +316 -0
  856. package/src/connectors/connections/views.ts +37 -0
  857. package/src/connectors/credentials.ts +149 -0
  858. package/src/connectors/errors.ts +111 -3
  859. package/src/connectors/execution.ts +157 -0
  860. package/src/connectors/index.ts +26 -2
  861. package/src/connectors/service.ts +142 -0
  862. package/src/connectors/types.ts +156 -7
  863. package/src/datasets/builders.ts +49 -5
  864. package/src/datasets/changes.ts +13 -0
  865. package/src/datasets/execution.ts +24 -0
  866. package/src/datasets/index.ts +3 -0
  867. package/src/datasets/types.ts +5 -0
  868. package/src/datasets/validation.ts +53 -11
  869. package/src/error-reporting/capability.ts +33 -106
  870. package/src/error-reporting/internal.ts +3 -1
  871. package/src/error-reporting/reporter.ts +19 -3
  872. package/src/error-reporting/reports.ts +172 -0
  873. package/src/error-reporting/types.ts +97 -43
  874. package/src/errors/catalog.ts +149 -0
  875. package/src/errors/internal.ts +322 -0
  876. package/src/errors/types.ts +21 -0
  877. package/src/events/definitions.ts +0 -4
  878. package/src/events/execution.ts +45 -0
  879. package/src/events/index.ts +15 -14
  880. package/src/events/outbox-dispatcher.ts +53 -18
  881. package/src/events/{runtime.ts → service.ts} +19 -23
  882. package/src/events/types/pipelines.ts +4 -1
  883. package/src/events/types/syncs.ts +3 -0
  884. package/src/events/types/workflows.ts +4 -2
  885. package/src/execution/agent.ts +130 -0
  886. package/src/execution/authorization.ts +409 -0
  887. package/src/execution/dispatch.ts +7 -0
  888. package/src/execution/durable.ts +193 -0
  889. package/src/execution/index.ts +12 -0
  890. package/src/execution/primitive.ts +50 -0
  891. package/src/execution/request.ts +109 -0
  892. package/src/execution/scopes.ts +198 -0
  893. package/src/execution/types.ts +113 -0
  894. package/src/http/api-routes.ts +42 -7
  895. package/src/index.ts +127 -10
  896. package/src/json.ts +11 -8
  897. package/src/lake-storage/definition-updates.ts +21 -0
  898. package/src/lake-storage/in-memory.ts +284 -2
  899. package/src/lake-storage/index.ts +14 -0
  900. package/src/lake-storage/merge-validation.ts +117 -0
  901. package/src/lake-storage/merge.ts +35 -0
  902. package/src/lake-storage/types.ts +3 -1
  903. package/src/logging/execution.ts +28 -0
  904. package/src/logging/index.ts +4 -4
  905. package/src/logging/{runtime.ts → service.ts} +7 -7
  906. package/src/materialization/events.ts +1 -0
  907. package/src/materialization/index.ts +2 -0
  908. package/src/materialization/model.ts +30 -18
  909. package/src/materializer/README.md +9 -13
  910. package/src/materializer/edits/commit.ts +85 -28
  911. package/src/materializer/edits/load-state.ts +79 -16
  912. package/src/materializer/edits/operations.ts +72 -36
  913. package/src/materializer/edits/plan.ts +95 -22
  914. package/src/materializer/edits/working-state.ts +86 -55
  915. package/src/materializer/effective/build-events.ts +2 -0
  916. package/src/materializer/effective/diff.ts +22 -0
  917. package/src/materializer/effective/load-state.ts +0 -31
  918. package/src/materializer/effective/resolve.ts +62 -0
  919. package/src/materializer/execution/commit-lifecycle.ts +9 -1
  920. package/src/materializer/execution/plan-stream.ts +33 -9
  921. package/src/materializer/execution/scope.ts +95 -0
  922. package/src/materializer/execution/work-executor.ts +6 -2
  923. package/src/materializer/execution/work-records.ts +39 -6
  924. package/src/materializer/index.ts +9 -1
  925. package/src/materializer/materializer.ts +67 -5
  926. package/src/materializer/projections/finish-run.ts +29 -11
  927. package/src/materializer/projections/replace.ts +55 -22
  928. package/src/materializer/projections/replacement-plan.ts +37 -7
  929. package/src/materializer/shared/batching.ts +4 -1
  930. package/src/materializer/shared/normalize.ts +0 -19
  931. package/src/materializer/telemetry/append.ts +57 -26
  932. package/src/materializer/telemetry/plan.ts +15 -6
  933. package/src/objects/action/request.ts +5 -5
  934. package/src/objects/context/index.ts +1 -0
  935. package/src/objects/context/types.ts +6 -0
  936. package/src/objects/execution.ts +346 -0
  937. package/src/objects/materializer-adapter.ts +1 -23
  938. package/src/objects/query/executor.ts +15 -29
  939. package/src/objects/query/index.ts +1 -2
  940. package/src/objects/query/planner.ts +0 -6
  941. package/src/objects/sdk/object-handle.ts +2 -2
  942. package/src/objects/sdk/object-set.ts +17 -7
  943. package/src/objects/sdk/runtime-query-executor.ts +9 -2
  944. package/src/objects/sdk/telemetry-channel.ts +5 -1
  945. package/src/objects/service/action-service.ts +5 -2
  946. package/src/objects/service/list-service.ts +1 -1
  947. package/src/objects/telemetry/history.ts +8 -3
  948. package/src/objects/telemetry/write-batch.ts +0 -2
  949. package/src/ontology/index.ts +6 -1
  950. package/src/ontology/json-schema.ts +2 -1
  951. package/src/ontology/registry.ts +16 -2
  952. package/src/ontology/validation/normalize.ts +9 -15
  953. package/src/pipelines/execution.ts +105 -0
  954. package/src/pipelines/index.ts +7 -0
  955. package/src/pipelines/request.ts +32 -26
  956. package/src/pipelines/run-dispatch.ts +308 -0
  957. package/src/projections/builders.ts +0 -9
  958. package/src/projections/capability.ts +37 -0
  959. package/src/projections/execution.ts +85 -0
  960. package/src/projections/index.ts +2 -1
  961. package/src/projections/internal.ts +17 -60
  962. package/src/projections/ownership.ts +2 -2
  963. package/src/projections/registry.ts +26 -11
  964. package/src/projections/revision.ts +7 -5
  965. package/src/projections/run-dispatch.ts +497 -0
  966. package/src/projections/run-id.ts +20 -0
  967. package/src/projections/types.ts +12 -0
  968. package/src/projections/validation.ts +3 -3
  969. package/src/queues/in-memory.ts +37 -11
  970. package/src/queues/index.ts +9 -2
  971. package/src/queues/types.ts +70 -45
  972. package/src/rules/execution.ts +49 -0
  973. package/src/rules/index.ts +0 -1
  974. package/src/rules/validation.ts +2 -6
  975. package/src/runtime/ai-usage.ts +17 -0
  976. package/src/runtime/create.ts +28 -68
  977. package/src/runtime/definitions.ts +44 -0
  978. package/src/runtime/host.ts +377 -0
  979. package/src/runtime/index.ts +5 -13
  980. package/src/runtime/internal.ts +12 -0
  981. package/src/runtime/ontology-mutations.ts +5 -3
  982. package/src/runtime/resolve-definitions.ts +238 -0
  983. package/src/runtime/sixb.ts +95 -807
  984. package/src/runtime/types.ts +17 -290
  985. package/src/scheduler/index.ts +1 -1
  986. package/src/scheduler/runtime.ts +37 -6
  987. package/src/schedules/execution.ts +14 -0
  988. package/src/schedules/types.ts +0 -8
  989. package/src/security/every.ts +4 -0
  990. package/src/security/grants.ts +13 -1
  991. package/src/security/index.ts +3 -1
  992. package/src/security/registry.ts +107 -0
  993. package/src/security/types.ts +8 -12
  994. package/src/security/validation.ts +7 -0
  995. package/src/storage/action-runs/failure.ts +64 -0
  996. package/src/storage/action-runs/idempotency.ts +3 -1
  997. package/src/storage/action-runs/in-memory.ts +39 -9
  998. package/src/storage/action-runs/index.ts +3 -0
  999. package/src/storage/action-runs/provider.ts +25 -0
  1000. package/src/storage/action-runs/types.ts +61 -27
  1001. package/src/storage/agents/errors.ts +1 -0
  1002. package/src/storage/agents/in-memory.ts +49 -11
  1003. package/src/storage/agents/index.ts +2 -1
  1004. package/src/storage/agents/provider.ts +27 -0
  1005. package/src/storage/agents/types.ts +19 -19
  1006. package/src/storage/ai-usage/errors.ts +13 -0
  1007. package/src/storage/ai-usage/in-memory.ts +162 -0
  1008. package/src/storage/ai-usage/index.ts +21 -0
  1009. package/src/storage/ai-usage/record.ts +74 -0
  1010. package/src/storage/ai-usage/types.ts +102 -0
  1011. package/src/storage/ai-usage/usage.ts +104 -0
  1012. package/src/storage/auth/types.ts +1 -0
  1013. package/src/storage/connector-connections/errors.ts +24 -0
  1014. package/src/storage/connector-connections/in-memory.ts +1377 -0
  1015. package/src/storage/connector-connections/index.ts +66 -0
  1016. package/src/storage/connector-connections/provider/authorizations.ts +446 -0
  1017. package/src/storage/connector-connections/provider/connections.ts +291 -0
  1018. package/src/storage/connector-connections/provider/runs.ts +369 -0
  1019. package/src/storage/connector-connections/provider/shared.ts +342 -0
  1020. package/src/storage/connector-connections/provider.ts +219 -0
  1021. package/src/storage/connector-connections/types.ts +546 -0
  1022. package/src/storage/executions/errors.ts +21 -0
  1023. package/src/storage/executions/in-memory.ts +75 -0
  1024. package/src/storage/executions/index.ts +16 -0
  1025. package/src/storage/executions/provider.ts +292 -0
  1026. package/src/storage/executions/run-link.ts +70 -0
  1027. package/src/storage/executions/types.ts +49 -0
  1028. package/src/storage/executions/validation.ts +370 -0
  1029. package/src/storage/in-memory/index.ts +50 -16
  1030. package/src/storage/index.ts +155 -15
  1031. package/src/storage/ontology/commits.ts +1 -0
  1032. package/src/storage/ontology/in-memory/index.ts +2 -0
  1033. package/src/storage/ontology/in-memory/materializations-finalization.ts +2 -1
  1034. package/src/storage/ontology/in-memory/materializations-state.ts +10 -0
  1035. package/src/storage/ontology/in-memory/materializations-work.ts +2 -1
  1036. package/src/storage/ontology/in-memory/materializations.ts +131 -9
  1037. package/src/storage/ontology/in-memory/outbox.ts +1 -1
  1038. package/src/storage/ontology/in-memory/shared-state.ts +12 -1
  1039. package/src/storage/ontology/index.ts +6 -0
  1040. package/src/storage/ontology/materializations.ts +50 -4
  1041. package/src/storage/ontology/outbox.ts +13 -2
  1042. package/src/storage/ontology/provider-header-validation.ts +1 -0
  1043. package/src/storage/ontology/provider-work.ts +33 -14
  1044. package/src/storage/ontology/provider.ts +72 -52
  1045. package/src/storage/operation-scope.ts +1 -0
  1046. package/src/storage/pipeline-runs/idempotency.ts +14 -0
  1047. package/src/storage/pipeline-runs/in-memory.ts +88 -8
  1048. package/src/storage/pipeline-runs/index.ts +5 -1
  1049. package/src/storage/pipeline-runs/provider.ts +25 -0
  1050. package/src/storage/pipeline-runs/types.ts +37 -14
  1051. package/src/storage/projection-runs/in-memory.ts +93 -24
  1052. package/src/storage/projection-runs/index.ts +4 -0
  1053. package/src/storage/projection-runs/lifecycle.ts +165 -36
  1054. package/src/storage/projection-runs/provider.ts +34 -0
  1055. package/src/storage/projection-runs/types.ts +34 -11
  1056. package/src/storage/run-listing.ts +22 -13
  1057. package/src/storage/sync-runs/idempotency.ts +18 -0
  1058. package/src/storage/sync-runs/in-memory.ts +92 -9
  1059. package/src/storage/sync-runs/index.ts +5 -1
  1060. package/src/storage/sync-runs/provider.ts +25 -0
  1061. package/src/storage/sync-runs/types.ts +44 -15
  1062. package/src/storage/types.ts +45 -17
  1063. package/src/storage/webhook-runs/errors.ts +14 -0
  1064. package/src/storage/webhook-runs/in-memory.ts +84 -9
  1065. package/src/storage/webhook-runs/index.ts +5 -1
  1066. package/src/storage/webhook-runs/provider.ts +30 -0
  1067. package/src/storage/webhook-runs/types.ts +52 -11
  1068. package/src/storage/workflow-runs/in-memory.ts +91 -55
  1069. package/src/storage/workflow-runs/index.ts +2 -0
  1070. package/src/storage/workflow-runs/provider.ts +70 -0
  1071. package/src/storage/workflow-runs/types.ts +38 -25
  1072. package/src/syncs/builders.ts +33 -15
  1073. package/src/syncs/execution.ts +78 -0
  1074. package/src/syncs/index.ts +14 -0
  1075. package/src/syncs/request.ts +32 -43
  1076. package/src/syncs/run-dispatch.ts +312 -0
  1077. package/src/syncs/sources.ts +20 -0
  1078. package/src/syncs/types.ts +75 -25
  1079. package/src/syncs/validation.ts +77 -0
  1080. package/src/testing/action-execution.ts +61 -0
  1081. package/src/testing/agent-execution.ts +81 -0
  1082. package/src/testing/agent-storage-contract.ts +158 -63
  1083. package/src/testing/ai-usage-storage-contract.ts +528 -0
  1084. package/src/testing/auth-storage-contract.ts +17 -1
  1085. package/src/testing/broker-contract.ts +16 -1
  1086. package/src/testing/connector-connection-storage-contract.ts +1052 -0
  1087. package/src/testing/execution-storage-contract.ts +435 -0
  1088. package/src/testing/execution.ts +48 -0
  1089. package/src/testing/index.ts +56 -0
  1090. package/src/testing/lake-merge-storage-contract.ts +302 -0
  1091. package/src/testing/lake-storage-contract.ts +23 -0
  1092. package/src/testing/materializer-fixture.ts +11 -3
  1093. package/src/testing/materializer-storage-contract.ts +213 -11
  1094. package/src/testing/ontology-contract-fixture.ts +35 -2
  1095. package/src/testing/ontology-storage-contract.ts +75 -14
  1096. package/src/testing/pipeline-execution.ts +64 -0
  1097. package/src/testing/projection-execution.ts +98 -0
  1098. package/src/testing/projection-run-storage-contract.ts +215 -29
  1099. package/src/testing/queues-contract.ts +40 -51
  1100. package/src/testing/sync-execution.ts +61 -0
  1101. package/src/testing/webhook-execution.ts +47 -0
  1102. package/src/testing/webhook-run-storage-contract.ts +240 -0
  1103. package/src/testing/workflow-execution.ts +77 -0
  1104. package/src/webhooks/index.ts +2 -1
  1105. package/src/webhooks/internal.ts +5 -0
  1106. package/src/webhooks/registry.ts +60 -36
  1107. package/src/webhooks/run-admission.ts +172 -0
  1108. package/src/webhooks/types.ts +8 -5
  1109. package/src/workers/queue-delivery.ts +25 -22
  1110. package/src/workers/queue-worker.ts +62 -32
  1111. package/src/workflows/execution.ts +292 -0
  1112. package/src/workflows/failure.ts +63 -0
  1113. package/src/workflows/index.ts +10 -1
  1114. package/src/workflows/request.ts +39 -118
  1115. package/src/workflows/run-dispatch.ts +359 -0
  1116. package/src/workflows/snapshot.ts +1 -10
  1117. package/src/workflows/types.ts +39 -8
  1118. package/dist/actions/runtime.d.ts +0 -11
  1119. package/dist/actions/runtime.d.ts.map +0 -1
  1120. package/dist/agents/runtime.d.ts +0 -41
  1121. package/dist/agents/runtime.d.ts.map +0 -1
  1122. package/dist/chunk-0fygrz37.js +0 -354
  1123. package/dist/chunk-0fygrz37.js.map +0 -17
  1124. package/dist/chunk-0psb6kdw.js +0 -989
  1125. package/dist/chunk-0psb6kdw.js.map +0 -15
  1126. package/dist/chunk-1vffvydj.js.map +0 -10
  1127. package/dist/chunk-2gpr6jsz.js.map +0 -13
  1128. package/dist/chunk-2s6sydsh.js.map +0 -12
  1129. package/dist/chunk-50kv63vj.js.map +0 -12
  1130. package/dist/chunk-590dejbp.js +0 -49
  1131. package/dist/chunk-590dejbp.js.map +0 -10
  1132. package/dist/chunk-867jxh7c.js.map +0 -19
  1133. package/dist/chunk-aebzcsxr.js.map +0 -48
  1134. package/dist/chunk-btpe64e4.js +0 -554
  1135. package/dist/chunk-btpe64e4.js.map +0 -13
  1136. package/dist/chunk-dcgrzj1t.js.map +0 -36
  1137. package/dist/chunk-dhmj53mx.js.map +0 -16
  1138. package/dist/chunk-hsv43v58.js +0 -1390
  1139. package/dist/chunk-hsv43v58.js.map +0 -21
  1140. package/dist/chunk-jdwx7vzs.js.map +0 -14
  1141. package/dist/chunk-k25jm1x5.js +0 -102
  1142. package/dist/chunk-k25jm1x5.js.map +0 -10
  1143. package/dist/chunk-k41ajtz7.js +0 -352
  1144. package/dist/chunk-k41ajtz7.js.map +0 -13
  1145. package/dist/chunk-k6j72mtt.js +0 -9
  1146. package/dist/chunk-k6j72mtt.js.map +0 -10
  1147. package/dist/chunk-nvamz5dv.js +0 -819
  1148. package/dist/chunk-nvamz5dv.js.map +0 -21
  1149. package/dist/chunk-pv1yad91.js +0 -1165
  1150. package/dist/chunk-pv1yad91.js.map +0 -27
  1151. package/dist/chunk-q4qzq0ea.js.map +0 -14
  1152. package/dist/chunk-r65yscvk.js.map +0 -11
  1153. package/dist/chunk-t358gywy.js.map +0 -34
  1154. package/dist/chunk-t72dvahb.js.map +0 -12
  1155. package/dist/chunk-v5c085yp.js.map +0 -10
  1156. package/dist/chunk-wj01s5hr.js.map +0 -11
  1157. package/dist/chunk-wxhdnwh4.js +0 -37
  1158. package/dist/chunk-wxhdnwh4.js.map +0 -10
  1159. package/dist/chunk-xz5g49bp.js.map +0 -11
  1160. package/dist/chunk-ya6brh8a.js.map +0 -11
  1161. package/dist/chunk-yvef9xwc.js.map +0 -44
  1162. package/dist/chunk-yxss87qa.js.map +0 -14
  1163. package/dist/connectors/runtime.d.ts +0 -13
  1164. package/dist/connectors/runtime.d.ts.map +0 -1
  1165. package/dist/events/runtime.d.ts.map +0 -1
  1166. package/dist/objects/contexts.d.ts +0 -45
  1167. package/dist/objects/contexts.d.ts.map +0 -1
  1168. package/dist/objects/helpers.d.ts +0 -7
  1169. package/dist/objects/helpers.d.ts.map +0 -1
  1170. package/dist/runtime/scoped.d.ts +0 -158
  1171. package/dist/runtime/scoped.d.ts.map +0 -1
  1172. package/dist/security/runtime.d.ts +0 -16
  1173. package/dist/security/runtime.d.ts.map +0 -1
  1174. package/dist/storage/webhook-deliveries/in-memory.d.ts +0 -18
  1175. package/dist/storage/webhook-deliveries/in-memory.d.ts.map +0 -1
  1176. package/dist/storage/webhook-deliveries/index.d.ts +0 -3
  1177. package/dist/storage/webhook-deliveries/index.d.ts.map +0 -1
  1178. package/dist/storage/webhook-deliveries/types.d.ts +0 -43
  1179. package/dist/storage/webhook-deliveries/types.d.ts.map +0 -1
  1180. package/dist/workflows/runtime.d.ts +0 -33
  1181. package/dist/workflows/runtime.d.ts.map +0 -1
  1182. package/src/actions/runtime.ts +0 -31
  1183. package/src/agents/runtime.ts +0 -124
  1184. package/src/connectors/runtime.ts +0 -100
  1185. package/src/objects/contexts.ts +0 -64
  1186. package/src/objects/helpers.ts +0 -18
  1187. package/src/runtime/scoped.ts +0 -436
  1188. package/src/security/runtime.ts +0 -101
  1189. package/src/storage/webhook-deliveries/in-memory.ts +0 -108
  1190. package/src/storage/webhook-deliveries/index.ts +0 -9
  1191. package/src/storage/webhook-deliveries/types.ts +0 -41
  1192. package/src/workflows/runtime.ts +0 -68
  1193. /package/dist/{chunk-45tw90k7.js.map → chunk-4gz41why.js.map} +0 -0
  1194. /package/dist/{chunk-vj723r3p.js.map → chunk-8b55ygje.js.map} +0 -0
  1195. /package/dist/{chunk-p6r5g77m.js.map → chunk-vybf6pkp.js.map} +0 -0
  1196. /package/dist/{chunk-5yny9z0e.js.map → chunk-z3zp0bj1.js.map} +0 -0
@@ -1,21 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/webhooks/errors.ts", "../src/webhooks/builders.ts", "../src/webhooks/connector.ts", "../src/webhooks/registry.ts", "../src/webhooks/unverified.ts", "../src/runtime/create.ts", "../src/runtime/sixb.ts", "../src/connectors/runtime.ts", "../src/maintenance/ontology-maintenance.ts", "../src/security/runtime.ts", "../src/runtime/scoped.ts", "../src/runtime/storage-readiness.ts"],
4
- "sourcesContent": [
5
- "export class WebhookValidationError extends Error {\n readonly name = \"WebhookValidationError\"\n}\n",
6
- "import { WebhookValidationError } from \"./errors\"\nimport type {\n WebhookBodyParser,\n WebhookBodySchema,\n WebhookDefinition,\n WebhookHandlerContext,\n WebhookHandlerResult,\n WebhookIdempotencyKeyResolver,\n WebhookVerifyContext,\n} from \"./types\"\n\ntype WebhookHandler<TBody, TClient> = (\n ctx: WebhookHandlerContext<TBody, TClient>\n) => Promise<WebhookHandlerResult> | WebhookHandlerResult\n\ntype WebhookVerifyHandler = (ctx: WebhookVerifyContext) => Promise<void> | void\n\ninterface WebhookDraft<TBody> {\n readonly id: string\n readonly method: \"POST\"\n readonly body: WebhookBodyParser<TBody>\n readonly verify?: WebhookVerifyHandler\n readonly idempotencyKey?: WebhookIdempotencyKeyResolver<TBody>\n}\n\n/** Define an inbound webhook owned by a connector adapter. */\nexport function defineWebhook(id: string): WebhookMethodBuilder {\n assertNonEmpty(id, \"Webhook id\")\n return new WebhookMethodBuilder(id)\n}\n\nexport class WebhookMethodBuilder<TClient = unknown> {\n constructor(private readonly id: string) {}\n\n post(): WebhookBodyBuilder<TClient> {\n return new WebhookBodyBuilder(this.id, \"POST\")\n }\n}\n\nexport class WebhookBodyBuilder<TClient = unknown> {\n constructor(\n private readonly id: string,\n private readonly method: \"POST\"\n ) {}\n\n /**\n * Decode JSON and keep the handler body as unknown.\n *\n * Prefer `.json(schema)` for provider payloads that have a known shape.\n */\n json(): WebhookBuilder<unknown, TClient>\n /** Decode JSON, validate or normalize it at runtime, and infer the handler body. */\n json<TBody>(schema: WebhookBodySchema<TBody>): WebhookBuilder<TBody, TClient>\n json<TBody>(schema?: WebhookBodySchema<TBody>): WebhookBuilder<TBody | unknown, TClient> {\n if (schema !== undefined && typeof schema.parse !== \"function\") {\n throw new WebhookValidationError(\"[Sixb] Webhook JSON schema must provide parse(value).\")\n }\n\n return new WebhookBuilder({\n id: this.id,\n method: this.method,\n body: {\n format: \"json\",\n parse(value: unknown) {\n return schema ? schema.parse(value) : value\n },\n },\n })\n }\n\n text(): WebhookBuilder<string, TClient> {\n return new WebhookBuilder({\n id: this.id,\n method: this.method,\n body: {\n format: \"text\",\n parse(value: unknown) {\n if (typeof value !== \"string\") {\n throw new Error(\"Expected webhook body to be text.\")\n }\n\n return value\n },\n },\n })\n }\n\n raw(): WebhookBuilder<Uint8Array, TClient> {\n return new WebhookBuilder({\n id: this.id,\n method: this.method,\n body: {\n format: \"raw\",\n parse(value: unknown) {\n if (!(value instanceof Uint8Array)) {\n throw new Error(\"Expected webhook body to be raw bytes.\")\n }\n\n return value\n },\n },\n })\n }\n}\n\nexport class WebhookBuilder<TBody, TClient = unknown> {\n constructor(private readonly draft: WebhookDraft<TBody>) {}\n\n verify(verify: WebhookVerifyHandler): WebhookBuilder<TBody, TClient> {\n if (typeof verify !== \"function\") {\n throw new WebhookValidationError(\"[Sixb] Webhook verify must be a function.\")\n }\n\n return new WebhookBuilder({\n ...this.draft,\n verify,\n })\n }\n\n idempotencyKey(resolver: WebhookIdempotencyKeyResolver<TBody>): WebhookBuilder<TBody, TClient> {\n if (typeof resolver !== \"function\") {\n throw new WebhookValidationError(\"[Sixb] Webhook idempotencyKey must be a function.\")\n }\n\n return new WebhookBuilder({\n ...this.draft,\n idempotencyKey: resolver,\n })\n }\n\n handle<TNextClient = TClient>(\n handle: WebhookHandler<TBody, TNextClient>\n ): WebhookDefinition<TBody, TNextClient> {\n if (typeof handle !== \"function\") {\n throw new WebhookValidationError(\"[Sixb] Webhook handle must be a function.\")\n }\n\n return {\n kind: \"webhook\",\n id: this.draft.id,\n method: this.draft.method,\n body: this.draft.body,\n idempotencyKey: this.draft.idempotencyKey,\n verify: this.draft.verify,\n handle,\n }\n }\n}\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new WebhookValidationError(`[Sixb] ${field} must not be empty.`)\n }\n}\n",
7
- "import type { ConnectorAdapter } from \"../connectors/types\"\nimport type { WebhookDefinition } from \"./types\"\n\nexport interface WebhookConnectorClient {\n readonly kind: \"webhook\"\n}\n\n/** Connector adapter for inbound-only integrations that expose no outbound client. */\nexport function webhookConnector(options: {\n readonly webhooks: readonly WebhookDefinition<unknown, WebhookConnectorClient>[]\n}): ConnectorAdapter<\"webhook\", WebhookConnectorClient> {\n return {\n type: \"webhook\",\n webhooks: options.webhooks,\n connect() {\n return { kind: \"webhook\" }\n },\n }\n}\n",
8
- "import type { ConnectorDefinition } from \"../connectors/types\"\nimport { WebhookValidationError } from \"./errors\"\nimport type { RegisteredWebhook, WebhookDefinition } from \"./types\"\n\nexport function registerWebhooks(connectors: readonly ConnectorDefinition[]): {\n readonly webhooks: readonly RegisteredWebhook[]\n} {\n const registered: RegisteredWebhook[] = []\n const routes = new Map<string, RegisteredWebhook>()\n\n for (const connector of connectors) {\n const webhooks = connector.adapter.webhooks ?? []\n if (!Array.isArray(webhooks)) {\n throw new WebhookValidationError(\n `[Sixb] Connector '${connector.id}' webhooks must be an array when provided.`\n )\n }\n\n const ids = new Set<string>()\n for (const webhook of webhooks) {\n assertValidWebhook(connector.id, webhook)\n\n if (ids.has(webhook.id)) {\n throw new WebhookValidationError(\n `[Sixb] Duplicate webhook id '${webhook.id}' for connector '${connector.id}'.`\n )\n }\n ids.add(webhook.id)\n\n const route = webhookRoute(connector.id, webhook.id)\n const duplicate = routes.get(route)\n if (duplicate) {\n throw new WebhookValidationError(\n `[Sixb] Duplicate webhook route '${route}' for connectors '${duplicate.connector.id}' and '${connector.id}'.`\n )\n }\n\n const registeredWebhook = {\n connector,\n webhook,\n route,\n } satisfies RegisteredWebhook\n\n routes.set(route, registeredWebhook)\n registered.push(registeredWebhook)\n }\n }\n\n return {\n webhooks: registered,\n }\n}\n\nexport function webhookRoute(connectorId: string, webhookId: string): string {\n return `/api/webhooks/${connectorId}/${webhookId}`\n}\n\nfunction assertValidWebhook(\n connectorId: string,\n webhook: unknown\n): asserts webhook is WebhookDefinition {\n if (!isRecord(webhook)) {\n throw new WebhookValidationError(`[Sixb] Connector '${connectorId}' has an invalid webhook.`)\n }\n\n if (webhook.kind !== \"webhook\") {\n throw new WebhookValidationError(\n `[Sixb] Connector '${connectorId}' webhook must be created with defineWebhook(...).`\n )\n }\n\n if (typeof webhook.id !== \"string\" || !webhook.id.trim()) {\n throw new WebhookValidationError(\n `[Sixb] Connector '${connectorId}' webhook id must not be empty.`\n )\n }\n\n if (webhook.method !== \"POST\") {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' must use method POST.`\n )\n }\n\n if (!isRecord(webhook.body)) {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' body is required.`\n )\n }\n\n if (\n webhook.body.format !== \"json\" &&\n webhook.body.format !== \"text\" &&\n webhook.body.format !== \"raw\"\n ) {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' body format must be json, text, or raw.`\n )\n }\n\n if (typeof webhook.body.parse !== \"function\") {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' body parser must provide parse(value).`\n )\n }\n\n if (webhook.verify !== undefined && typeof webhook.verify !== \"function\") {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' verify must be a function.`\n )\n }\n\n if (webhook.idempotencyKey !== undefined && typeof webhook.idempotencyKey !== \"function\") {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' idempotencyKey must be a function.`\n )\n }\n\n if (typeof webhook.handle !== \"function\") {\n throw new WebhookValidationError(\n `[Sixb] Webhook '${connectorId}/${webhook.id}' handle must be a function.`\n )\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n",
9
- "/**\n * How a webhook is allowed to treat the credential its provider sends.\n *\n * A union, so no value carries neither branch. `resolveWebhookVerification` covers the path\n * where the credential arrives as `TCredential | undefined` from the environment, which no type\n * can narrow. Generic because a credential is not always a signing secret: PandaDoc resolves a\n * shared key, Pipedrive compares a username and password.\n */\nexport type WebhookVerification<TCredential = string> =\n | { readonly credential: TCredential; readonly allowUnverified?: never }\n | {\n readonly credential?: never\n /**\n * Accept deliveries this webhook cannot verify. Without a credential the route accepts\n * requests from anyone who can reach it, so it has to be asked for.\n */\n readonly allowUnverified: true\n }\n\n/**\n * How to name a webhook, and its options, in a message about its verification.\n *\n * The options are part of the subject because a connector has two entry points with different\n * names for the same thing: a message fixed to one sends half the callers to an option their\n * API does not have.\n */\nexport interface WebhookVerificationSubject {\n /** The connector, as it appears in its own message prefix — `SixbGitHub`, `SixbMercury`. */\n readonly connector: string\n /** What this webhook checks when a credential is configured, as a noun phrase. */\n readonly verifies: string\n /** The option carrying the credential, written as the caller would type it. */\n readonly credentialOption: string\n /** The option that accepts unverified deliveries, written as the caller would type it. */\n readonly allowOption: string\n}\n\nexport class UnverifiedWebhookError extends Error {\n readonly name = \"UnverifiedWebhookError\"\n}\n\n/**\n * Narrows a credential that may be absent into a {@link WebhookVerification}, or refuses.\n *\n * Returns the union so a caller spreads the result into the builder instead of deciding again.\n * Refusing is the point: a missing credential used to mean `.verify()` returned early and the\n * route accepted anything that reached it. Throwing here fails `createSixb()` instead, so the\n * API role never starts open.\n */\nexport function resolveWebhookVerification<TCredential>(\n subject: WebhookVerificationSubject,\n options: { readonly credential?: TCredential; readonly allowUnverified?: boolean }\n): WebhookVerification<TCredential> {\n if (options.credential) return { credential: options.credential }\n\n if (!options.allowUnverified) {\n throw new UnverifiedWebhookError(\n `[${subject.connector}] This webhook has no credential, so ${subject.verifies} cannot be ` +\n `checked and the route would accept unverified requests from anyone who can reach it. ` +\n `Set ${subject.credentialOption}, or pass ${subject.allowOption} to accept that.`\n )\n }\n\n return { allowUnverified: true }\n}\n\n/**\n * Announces a webhook whose author chose to accept unverified deliveries. Called where the\n * webhook is defined, not inside `verify()`: once per boot is a fact, once per request is noise.\n */\nexport function warnUnverifiedWebhook<TCredential>(\n subject: WebhookVerificationSubject,\n verification: WebhookVerification<TCredential>\n): void {\n if (verification.credential) return\n\n console.warn(\n `[${subject.connector}] ${subject.allowOption}, so ${subject.verifies} is not checked ` +\n `and this route accepts unverified requests from anyone who can reach it. ` +\n `Set ${subject.credentialOption} before exposing it.`\n )\n}\n",
10
- "import { resolve } from \"node:path\"\nimport type { ActionDefinition } from \"../actions\"\nimport type { AgentDefinition } from \"../agents\"\nimport type { SixbAuthConfig } from \"../auth\"\nimport type { BlobStorage } from \"../blob-storage\"\nimport {\n discoverActions,\n discoverAgents,\n discoverConnectors,\n discoverDatasets,\n discoverGroups,\n discoverMembershipPolicies,\n discoverOntologySources,\n discoverPipelines,\n discoverProjections,\n discoverRoles,\n discoverRules,\n discoverSchedules,\n discoverSyncs,\n discoverWorkflows,\n} from \"../bootstrap\"\nimport type { Broker } from \"../broker\"\nimport type { ConnectorDefinition } from \"../connectors/types\"\nimport type { DatasetDefinition } from \"../datasets\"\nimport type { SixbErrorHandler } from \"../error-reporting/types\"\nimport type { LakeStorage } from \"../lake-storage\"\nimport type { LoggerProvider, ObservabilityOptions } from \"../logging\"\nimport type { OntologyMaintenanceOptions } from \"../maintenance\"\nimport type { PipelineDefinition } from \"../pipelines/types\"\nimport type { ProjectionDefinition } from \"../projections/types\"\nimport type { Queues } from \"../queues\"\nimport type { RuleDefinition } from \"../rules\"\nimport type { SandboxFactory } from \"../sandboxes\"\nimport type { ScheduleDefinition } from \"../schedules\"\nimport type { GroupDefinition, MembershipPolicyDefinition, RoleDefinition } from \"../security\"\nimport type { Storage } from \"../storage\"\nimport type { SyncDefinition } from \"../syncs\"\nimport type { WorkflowDefinition } from \"../workflows\"\nimport { RuntimeError } from \"./errors\"\nimport { Sixb } from \"./sixb\"\nimport type { OntologySource } from \"./types\"\n\nexport interface CreateSixbOptions {\n id?: string\n broker: Broker\n storage: Storage\n lakeStorage: LakeStorage\n blobStorage: BlobStorage\n queues: Queues\n sandboxes?: SandboxFactory\n /** Optional process-level output provider. Omit for broker-only logging. */\n logger?: LoggerProvider\n /** Broker capture controls, independent from the output provider. */\n observability?: ObservabilityOptions\n /** Observes runtime failures without changing their outcome. */\n onError?: SixbErrorHandler\n /** Recovery and retention settings. The runtime constructor never starts maintenance timers. */\n ontologyMaintenance?: OntologyMaintenanceOptions\n ontologies?: readonly OntologySource[]\n actions?: readonly ActionDefinition[]\n /** Agent definitions to register in addition to auto-discovered `agents/` exports. */\n agents?: readonly AgentDefinition[]\n datasets?: readonly DatasetDefinition[]\n /** Connector definitions to register in addition to auto-discovered `connectors/` exports. */\n connectors?: readonly ConnectorDefinition[]\n schedules?: readonly ScheduleDefinition[]\n syncs?: readonly SyncDefinition[]\n pipelines?: readonly PipelineDefinition[]\n projections?: readonly ProjectionDefinition[]\n rules?: readonly RuleDefinition[]\n workflows?: readonly WorkflowDefinition[]\n groups?: readonly GroupDefinition[]\n roles?: readonly RoleDefinition[]\n membershipPolicies?: readonly MembershipPolicyDefinition[]\n auth?: SixbAuthConfig\n projectRoot?: string\n}\n\n/**\n * Create a Sixb runtime using convention-based discovery.\n *\n * Sixb auto-discovers exported definitions from `ontology/`, `actions/`, `datasets/`,\n * `connectors/`, `syncs/`, `schedules/`, `pipelines/`, `projections/`,\n * `rules/`, `workflows/`, `agents/`, and `security/{groups,roles,policies}/`\n * relative to `projectRoot`.\n */\nexport async function createSixb(\n options: CreateSixbOptions\n): Promise<Sixb<readonly OntologySource[]>> {\n const projectRoot = resolve(options.projectRoot ?? process.cwd())\n\n const discovered = await discoverOntologySources(projectRoot)\n const allSources = [...(options.ontologies ?? []), ...discovered]\n\n if (allSources.length === 0) {\n throw new RuntimeError(\n \"No ontology found. Create an 'ontology/' folder or pass 'ontologies' to createSixb().\"\n )\n }\n\n const [\n actions,\n projections,\n schedules,\n syncs,\n connectors,\n pipelines,\n datasets,\n rules,\n workflows,\n groups,\n roles,\n membershipPolicies,\n agents,\n ] = await Promise.all([\n discoverActions(projectRoot),\n discoverProjections(projectRoot),\n discoverSchedules(projectRoot),\n discoverSyncs(projectRoot),\n discoverConnectors(projectRoot),\n discoverPipelines(projectRoot),\n discoverDatasets(projectRoot),\n discoverRules(projectRoot),\n discoverWorkflows(projectRoot),\n discoverGroups(projectRoot),\n discoverRoles(projectRoot),\n discoverMembershipPolicies(projectRoot),\n discoverAgents(projectRoot),\n ])\n\n // Explicit definitions come first so local setup can override ordering while duplicate ids are\n // still rejected by the Sixb constructor. Every family merges — `actions` and `projections` used to\n // *replace* discovery instead, silently and undocumented.\n return new Sixb<readonly OntologySource[]>({\n id: options.id,\n ontology: allSources,\n broker: options.broker,\n storage: options.storage,\n lakeStorage: options.lakeStorage,\n blobStorage: options.blobStorage,\n queues: options.queues,\n sandboxes: options.sandboxes,\n logger: options.logger,\n observability: options.observability,\n onError: options.onError,\n ontologyMaintenance: options.ontologyMaintenance,\n projectRoot,\n actions: [...(options.actions ?? []), ...actions],\n datasets: [...(options.datasets ?? []), ...datasets],\n connectors: [...(options.connectors ?? []), ...connectors],\n schedules: [...(options.schedules ?? []), ...schedules],\n syncs: [...(options.syncs ?? []), ...syncs],\n pipelines: [...(options.pipelines ?? []), ...pipelines],\n projections: [...(options.projections ?? []), ...projections],\n rules: [...(options.rules ?? []), ...rules],\n workflows: [...(options.workflows ?? []), ...workflows],\n groups: [...(options.groups ?? []), ...groups],\n roles: [...(options.roles ?? []), ...roles],\n membershipPolicies: [...(options.membershipPolicies ?? []), ...membershipPolicies],\n agents: [...(options.agents ?? []), ...agents],\n auth: options.auth,\n })\n}\n",
11
- "/**\n * Sixb is the main runtime entry point.\n *\n * It provides a typed API (`objects(MyType)`) returning ObjectSet with full compile-time inference.\n * For direct runtime access (broker records, events, storage, queued work), use\n * `sixb.broker`, `sixb.events`, `sixb.storage`, and `sixb.queues`.\n */\n\nimport { resolve } from \"node:path\"\nimport { ActionRegistry, ActionsRuntime } from \"../actions\"\nimport type {\n RequestActionAndWaitInput,\n RequestActionInput,\n RequestActionResult,\n} from \"../actions/request\"\nimport {\n requestAction as requestRuntimeAction,\n requestActionAndWait as requestRuntimeActionAndWait,\n} from \"../actions/request\"\nimport type { ActionDefinition } from \"../actions/types\"\nimport type { AgentDefinition, RequestAgentRunInput, RequestAgentRunResult } from \"../agents\"\nimport { AgentsRuntime, validateAgentGroupReferences } from \"../agents\"\nimport {\n AuthRuntime,\n AuthRuntimeError,\n isMagicLinkAuthStrategy,\n isOidcAuthStrategy,\n type SixbAuthConfig,\n} from \"../auth\"\nimport type { AuthorizationContext } from \"../authorization\"\nimport type { BlobStorage } from \"../blob-storage\"\nimport type { Broker } from \"../broker\"\nimport { ConnectorRuntime } from \"../connectors/runtime\"\nimport type { ConnectorAdapter, ConnectorClient, ConnectorDefinition } from \"../connectors/types\"\nimport type { DatasetDefinition } from \"../datasets/types\"\nimport { assertDatasetDefinition } from \"../datasets/validation\"\nimport {\n attachSixbErrorReporter,\n reportEventDeliveryFailure,\n shareSixbErrorReporter,\n} from \"../error-reporting/capability\"\nimport type { SixbErrorHandler } from \"../error-reporting/types\"\nimport { type DomainEventLog, EventsRuntime, OntologyOutboxDispatcher } from \"../events\"\nimport type { LakeStorage } from \"../lake-storage\"\nimport { type LoggerProvider, LogsRuntime, type ObservabilityOptions } from \"../logging\"\nimport {\n OntologyMaintenance,\n type OntologyMaintenanceHandle,\n type OntologyMaintenanceOptions,\n type OntologyOperationalStatus,\n type SixbReadiness,\n} from \"../maintenance\"\nimport { createOntologyMaterializer } from \"../materializer\"\nimport { createObjectSet, objectService } from \"../objects\"\nimport {\n assertObjectTypeRegistered,\n type ObjectType,\n OntologyRegistry,\n type ValueType,\n} from \"../ontology\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport { PipelineError } from \"../pipelines\"\nimport {\n type PipelineRunRequestResult,\n type RequestPipelineRunInput,\n requestPipelineRun,\n} from \"../pipelines/request\"\nimport type { PipelineDefinition } from \"../pipelines/types\"\nimport { registerProjectionRegistry } from \"../projections/internal\"\nimport { ProjectionRegistry } from \"../projections/registry\"\nimport type {\n LinkProjectionDefinition,\n ObjectProjectionDefinition,\n ProjectionDefinition,\n TelemetryProjectionDefinition,\n} from \"../projections/types\"\nimport type { Queues } from \"../queues\"\nimport type { RuleDefinition } from \"../rules\"\nimport { validateRulesAtStartup } from \"../rules\"\nimport type { SandboxFactory } from \"../sandboxes\"\nimport { SchedulerRuntime } from \"../scheduler\"\nimport type { ScheduleDefinition } from \"../schedules\"\nimport { validateSchedulesAtStartup } from \"../schedules\"\nimport type {\n GroupDefinition,\n MembershipPolicyDefinition,\n RoleDefinition,\n SecurityRegistry,\n} from \"../security\"\nimport { createRuntimeSecurityRegistry } from \"../security/runtime\"\nimport type { ActionRunRecord, ObjectRow, Storage } from \"../storage\"\nimport type { SyncDefinition } from \"../syncs\"\nimport { SyncValidationError } from \"../syncs\"\nimport {\n type RequestSyncRunInput,\n requestSyncRun,\n type SyncRunRequestResult,\n} from \"../syncs/request\"\nimport type { RegisteredWebhook } from \"../webhooks\"\nimport { registerWebhooks, WebhookValidationError, webhookRoute } from \"../webhooks\"\nimport type {\n RequestWorkflowRunInput,\n WorkflowDefinition,\n WorkflowRunRequestResult,\n} from \"../workflows\"\nimport { validateWorkflowsAtStartup, WorkflowsRuntime } from \"../workflows\"\nimport { RuntimeError } from \"./errors\"\nimport {\n createOntologyMutationRuntime,\n registerOntologyMutationRuntime,\n} from \"./ontology-mutations\"\nimport { createScopedSixb, type ScopedSixb } from \"./scoped\"\nimport { StorageReadiness } from \"./storage-readiness\"\nimport type {\n BatchItemResult,\n ListResult,\n ObjectSet,\n OntologySource,\n RegisteredObjectType,\n RegisteredValueTypes,\n SixbInstance,\n SixbRuntimeContext,\n} from \"./types\"\n\nexport interface SixbOptions<TOntologySources extends readonly OntologySource[]> {\n id?: string\n ontology: TOntologySources\n broker: Broker\n storage: Storage\n lakeStorage: LakeStorage\n blobStorage: BlobStorage\n queues: Queues\n sandboxes?: SandboxFactory\n /** Optional process-level output provider. Omit for broker-only logging. */\n logger?: LoggerProvider\n /** Broker capture controls, independent from the output provider. */\n observability?: ObservabilityOptions\n /** Observes runtime failures without changing their outcome. */\n onError?: SixbErrorHandler\n /** Recovery and retention settings. The runtime constructor never starts maintenance timers. */\n ontologyMaintenance?: OntologyMaintenanceOptions\n projectRoot?: string\n actions?: readonly ActionDefinition[]\n datasets?: readonly DatasetDefinition[]\n /** Connector definitions registered with this runtime. */\n connectors?: readonly ConnectorDefinition[]\n schedules?: readonly ScheduleDefinition[]\n syncs?: readonly SyncDefinition[]\n pipelines?: readonly PipelineDefinition[]\n projections?: readonly ProjectionDefinition[]\n rules?: readonly RuleDefinition[]\n workflows?: readonly WorkflowDefinition[]\n agents?: readonly AgentDefinition[]\n groups?: readonly GroupDefinition[]\n roles?: readonly RoleDefinition[]\n membershipPolicies?: readonly MembershipPolicyDefinition[]\n auth?: SixbAuthConfig\n}\n\nexport class Sixb<TOntologySources extends readonly OntologySource[]>\n implements SixbInstance<TOntologySources>\n{\n readonly projectId: string\n private readonly ontologySources: TOntologySources\n private readonly datasetsById = new Map<string, DatasetDefinition>()\n private readonly schedulesById = new Map<string, ScheduleDefinition>()\n private readonly syncsById = new Map<string, SyncDefinition>()\n private readonly pipelinesById = new Map<string, PipelineDefinition>()\n private readonly rulesById = new Map<string, RuleDefinition>()\n private readonly connectorRuntime: ConnectorRuntime\n private readonly webhooksByRoute = new Map<string, RegisteredWebhook>()\n private readonly webhooks: readonly RegisteredWebhook[]\n private readonly runtimeContext: SixbRuntimeContext\n private readonly committedFacts: OntologyOutboxDispatcher\n private readonly eventsRuntime: EventsRuntime\n private readonly ontologyMaintenance: OntologyMaintenance\n private readonly storageReadiness: StorageReadiness\n private readonly projectionRegistry: ProjectionRegistry\n readonly ontology: OntologyRegistry\n readonly actionRegistry: ActionRegistry\n readonly actions: ActionsRuntime\n readonly workflows: WorkflowsRuntime\n readonly agents: AgentsRuntime\n readonly broker: Broker\n readonly events: DomainEventLog\n readonly logs: LogsRuntime\n readonly storage: Storage\n readonly lakeStorage: LakeStorage\n readonly blobStorage: BlobStorage\n readonly queues: Queues\n readonly sandboxes?: SandboxFactory\n readonly projectRoot: string\n readonly rules: readonly RuleDefinition[]\n readonly security: SecurityRegistry\n readonly auth: AuthRuntime\n private schedulerRuntime: SchedulerRuntime | null = null\n\n constructor(options: SixbOptions<TOntologySources>) {\n attachSixbErrorReporter(this, options.onError)\n this.projectId = options.id ?? \"default\"\n this.ontologySources = options.ontology\n this.broker = options.broker\n // `host: this` is how `events.emit()` reaches the reporter attached at the top of this constructor.\n this.eventsRuntime = new EventsRuntime({\n projectId: this.projectId,\n broker: this.broker,\n host: this,\n })\n this.events = this.eventsRuntime\n this.logs = new LogsRuntime({\n projectId: this.projectId,\n broker: this.broker,\n logger: options.logger,\n observability: options.observability?.logs,\n })\n this.storage = options.storage\n this.storageReadiness = new StorageReadiness(this.storage)\n this.lakeStorage = options.lakeStorage\n this.blobStorage = options.blobStorage\n this.queues = options.queues\n this.sandboxes = options.sandboxes\n this.projectRoot = resolve(options.projectRoot ?? process.cwd())\n this.rules = options.rules ?? []\n // Ontology and actions resolve first so every later registry (security,\n // rules, workflows, projections) can validate its references against them.\n this.ontology = new OntologyRegistry({ sources: this.ontologySources })\n this.actionRegistry = new ActionRegistry(options.actions ?? [], this.ontology)\n const registeredActionIds = new Set(this.actionRegistry.list().map((action) => action.id))\n const agents = options.agents ?? []\n this.security = createRuntimeSecurityRegistry({\n groups: options.groups ?? [],\n roles: options.roles ?? [],\n membershipPolicies: options.membershipPolicies ?? [],\n objectTypeIds: new Set(this.ontology.getObjectTypesById().keys()),\n datasetIds: new Set((options.datasets ?? []).map((dataset) => dataset.id)),\n actionIds: registeredActionIds,\n workflowIds: new Set((options.workflows ?? []).map((workflow) => workflow.id)),\n syncIds: new Set((options.syncs ?? []).map((sync) => sync.id)),\n pipelineIds: new Set((options.pipelines ?? []).map((pipeline) => pipeline.id)),\n agentIds: new Set(agents.map((agent) => agent.id)),\n getSubTypes: (objectTypeId) => this.ontology.listSubTypes(objectTypeId),\n })\n this.auth = new AuthRuntime({\n projectId: this.projectId,\n storage: this.storage,\n security: this.security,\n config: options.auth,\n })\n validateAuthStrategySecurityReferences(this.auth.getStrategy(), this.security)\n this.connectorRuntime = new ConnectorRuntime(this.projectId, options.connectors ?? [])\n const connectors = this.connectorRuntime.list()\n assertWebhookDeliveryStorage(connectors, this.storage)\n this.webhooks = registerWebhooks(connectors).webhooks\n\n for (const registered of this.webhooks) {\n this.webhooksByRoute.set(registered.route, registered)\n }\n\n // Register datasets first so sync and pipeline definitions can be validated\n // against the runtime dataset registry during startup.\n for (const dataset of options.datasets ?? []) {\n assertDatasetDefinition(dataset, (message) => new RuntimeError(message))\n\n if (this.datasetsById.has(dataset.id)) {\n throw new RuntimeError(`Duplicate dataset id: ${dataset.id}`)\n }\n\n this.datasetsById.set(dataset.id, dataset)\n }\n\n for (const schedule of options.schedules ?? []) {\n if (this.schedulesById.has(schedule.id)) {\n throw new RuntimeError(`Duplicate schedule id: ${schedule.id}`)\n }\n this.schedulesById.set(schedule.id, schedule)\n }\n\n for (const sync of options.syncs ?? []) {\n if (this.syncsById.has(sync.id)) {\n throw new RuntimeError(`Duplicate sync id: ${sync.id}`)\n }\n\n const dataset = this.datasetsById.get(sync.target.dataset.id)\n if (!dataset) {\n throw new RuntimeError(\n `Sync '${sync.id}' targets unknown dataset '${sync.target.dataset.id}'. Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n this.syncsById.set(sync.id, sync)\n }\n\n for (const pipeline of options.pipelines ?? []) {\n if (this.pipelinesById.has(pipeline.id)) {\n throw new RuntimeError(`Duplicate pipeline id: ${pipeline.id}`)\n }\n\n if (pipeline.graph.nodes.length === 0) {\n throw new RuntimeError(`Pipeline '${pipeline.id}' must contain at least one step.`)\n }\n\n const stepIds = new Set<string>()\n for (const node of pipeline.graph.nodes) {\n const { step } = node\n if (stepIds.has(step.id)) {\n throw new RuntimeError(\n `Pipeline '${pipeline.id}' contains duplicate step id '${step.id}'.`\n )\n }\n stepIds.add(step.id)\n\n for (const [inputName, dataset] of Object.entries(step.inputs)) {\n if (!this.datasetsById.has(dataset.id)) {\n throw new RuntimeError(\n `Pipeline '${pipeline.id}' step '${step.id}' input '${inputName}' references unknown dataset '${dataset.id}'. Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n }\n\n if (!this.datasetsById.has(step.output.id)) {\n throw new RuntimeError(\n `Pipeline '${pipeline.id}' step '${step.id}' outputs unknown dataset '${step.output.id}'. Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n }\n\n this.pipelinesById.set(pipeline.id, pipeline)\n }\n\n // Rules validate against the resolved ontology so inherited properties and\n // links are available before checking predicate references.\n validateRulesAtStartup(this.rules, this.ontology)\n for (const rule of this.rules) {\n this.rulesById.set(rule.id, rule)\n }\n\n validateSchedulesAtStartup([...this.schedulesById.values()], this.ontology, {\n registeredRuleIds: new Set(this.rulesById.keys()),\n registeredActionIds,\n registeredDatasetIds: new Set(this.datasetsById.keys()),\n registeredSyncIds: new Set(this.syncsById.keys()),\n registeredPipelineIds: new Set(this.pipelinesById.keys()),\n })\n for (const sync of this.syncsById.values()) {\n validateScheduleReferences(\"Sync\", sync.id, sync.triggers, this.schedulesById)\n }\n for (const pipeline of this.pipelinesById.values()) {\n validateScheduleReferences(\"Pipeline\", pipeline.id, pipeline.triggers, this.schedulesById)\n }\n\n const workflows = validateWorkflowsAtStartup({\n workflows: options.workflows ?? [],\n registeredSchedules: this.schedulesById,\n registeredActionIds,\n registeredAgentIds: new Set(agents.map((agent) => agent.id)),\n })\n\n const workflowIds = new Set<string>()\n for (const workflow of workflows) {\n if (workflowIds.has(workflow.id)) {\n throw new RuntimeError(`Duplicate workflow id: ${workflow.id}`)\n }\n workflowIds.add(workflow.id)\n }\n\n this.projectionRegistry = new ProjectionRegistry({\n projections: options.projections ?? [],\n ontology: this.ontology,\n datasetsById: this.datasetsById,\n })\n registerProjectionRegistry(this, this.projectionRegistry)\n\n const materializer = createOntologyMaterializer({\n projectId: this.projectId,\n ontology: this.ontology,\n projections: this.projectionRegistry,\n storage: this.storage,\n })\n this.committedFacts = new OntologyOutboxDispatcher({\n projectId: this.projectId,\n storage: this.storage,\n events: this.eventsRuntime,\n onDeliveryFailure: (error, failure) =>\n reportEventDeliveryFailure(this, error, {\n projectId: this.projectId,\n ...failure,\n }),\n })\n this.ontologyMaintenance = new OntologyMaintenance({\n projectId: this.projectId,\n storage: this.storage,\n dispatcher: this.committedFacts,\n options: options.ontologyMaintenance,\n })\n\n this.runtimeContext = {\n projectId: this.projectId,\n ontology: this.ontology,\n actionRegistry: this.actionRegistry,\n events: this.events,\n storage: this.storage,\n lakeStorage: this.lakeStorage,\n blobStorage: this.blobStorage,\n queues: this.queues,\n sandboxes: this.sandboxes,\n rules: this.rules,\n }\n registerProjectionRegistry(this.runtimeContext, this.projectionRegistry)\n const ontologyMutations = createOntologyMutationRuntime({\n materializer,\n notifyCommittedFacts: () => this.committedFacts.notify(),\n })\n registerOntologyMutationRuntime(this, ontologyMutations)\n registerOntologyMutationRuntime(this.runtimeContext, ontologyMutations)\n shareSixbErrorReporter(this, this.runtimeContext)\n this.actions = new ActionsRuntime(this.runtimeContext)\n this.workflows = new WorkflowsRuntime(this.runtimeContext, workflows)\n\n const agentIds = new Set<string>()\n for (const agent of agents) {\n if (agentIds.has(agent.id)) {\n throw new RuntimeError(`Duplicate agent id: ${agent.id}`)\n }\n agentIds.add(agent.id)\n }\n validateAgentGroupReferences(agents, this.security)\n this.agents = new AgentsRuntime(this.runtimeContext, agents)\n }\n\n get id(): string {\n return this.projectId\n }\n\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return this.ontology.listObjectTypes()\n }\n\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.ontology.getObjectTypeById(objectTypeId)\n }\n\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n return this.ontology.resolveObjectType(objectTypeId)\n }\n\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.ontology.getValueTypesById()\n }\n\n listActions(): readonly ActionDefinition[] {\n return this.actionRegistry.list()\n }\n\n getActionById(actionId: string): ActionDefinition | null {\n return this.actionRegistry.getById(actionId)\n }\n\n listGlobalActions(): readonly ActionDefinition[] {\n return this.actionRegistry.getGlobalActions()\n }\n\n listActionsForType(objectType: ObjectType): readonly ActionDefinition[] {\n return this.actionRegistry.getActionsForType(objectType)\n }\n\n listDatasets(): readonly DatasetDefinition[] {\n return [...this.datasetsById.values()]\n }\n\n getDatasetById(datasetId: string): DatasetDefinition | null {\n return this.datasetsById.get(datasetId) ?? null\n }\n\n listSyncs(): readonly SyncDefinition[] {\n return [...this.syncsById.values()]\n }\n\n getSyncById(syncId: string): SyncDefinition | null {\n return this.syncsById.get(syncId) ?? null\n }\n\n listPipelines(): readonly PipelineDefinition[] {\n return [...this.pipelinesById.values()]\n }\n\n getPipelineById(pipelineId: string): PipelineDefinition | null {\n return this.pipelinesById.get(pipelineId) ?? null\n }\n\n // ── Starting work ─────────────────────────────────────────\n // Every verb is `request*` because everything here is queued, never run inline. `requestActionAndWait`\n // is the one that waits, and says so.\n\n requestAction(input: RequestActionInput): Promise<RequestActionResult> {\n return requestRuntimeAction(this.runtimeContext, input)\n }\n\n requestActionAndWait(input: RequestActionAndWaitInput): Promise<ActionRunRecord> {\n return requestRuntimeActionAndWait(this.runtimeContext, input)\n }\n\n requestWorkflowRun(input: RequestWorkflowRunInput): Promise<WorkflowRunRequestResult> {\n return this.workflows.requestById(input)\n }\n\n async requestSyncRun(input: RequestSyncRunInput): Promise<SyncRunRequestResult> {\n const sync = this.getSyncById(input.syncId)\n if (!sync) {\n throw new SyncValidationError(`[Sixb] Unknown sync '${input.syncId}'`)\n }\n return requestSyncRun(this.runtimeContext, sync, input)\n }\n\n async requestPipelineRun(input: RequestPipelineRunInput): Promise<PipelineRunRequestResult> {\n const pipeline = this.getPipelineById(input.pipelineId)\n if (!pipeline) {\n throw new PipelineError(`[Sixb] Unknown pipeline '${input.pipelineId}'`)\n }\n return requestPipelineRun(this.runtimeContext, pipeline, input)\n }\n\n requestAgentRun(input: RequestAgentRunInput): Promise<RequestAgentRunResult> {\n return this.agents.request(input)\n }\n\n listSchedules(): readonly ScheduleDefinition[] {\n return [...this.schedulesById.values()]\n }\n\n getScheduleById(scheduleId: string): ScheduleDefinition | null {\n return this.schedulesById.get(scheduleId) ?? null\n }\n\n listRules(): readonly RuleDefinition[] {\n return [...this.rulesById.values()]\n }\n\n getRuleById(ruleId: string): RuleDefinition | null {\n return this.rulesById.get(ruleId) ?? null\n }\n\n /** All connector definitions registered with this runtime. */\n listConnectors(): readonly ConnectorDefinition[] {\n return this.connectorRuntime.list()\n }\n\n /** Lookup a registered connector definition by id. */\n getConnectorById(connectorId: string): ConnectorDefinition | null {\n return this.connectorRuntime.getById(connectorId)\n }\n\n /** All webhook endpoints registered through connector adapters. */\n listWebhooks(): readonly RegisteredWebhook[] {\n return this.webhooks\n }\n\n /** Lookup a registered connector webhook by connector id and webhook id. */\n getWebhookById(connectorId: string, webhookId: string): RegisteredWebhook | null {\n return this.webhooksByRoute.get(webhookRoute(connectorId, webhookId)) ?? null\n }\n\n /**\n * Resolve a connector definition to a connected client.\n *\n * Connector definitions are inert. This method performs lazy connection and\n * reuses the same connected client for subsequent calls.\n */\n connector<TAdapter extends ConnectorAdapter>(\n definition: ConnectorDefinition<string, TAdapter>\n ): Promise<ConnectorClient<TAdapter>> {\n return this.connectorRuntime.connect(definition)\n }\n\n async startScheduler(): Promise<void> {\n if (this.schedulerRuntime || this.schedulesById.size === 0) return\n\n const runtime = new SchedulerRuntime({\n schedules: this.listSchedules(),\n events: this.eventsRuntime,\n })\n\n await runtime.start()\n this.schedulerRuntime = runtime\n }\n\n async stopScheduler(): Promise<void> {\n if (!this.schedulerRuntime) return\n\n const runtime = this.schedulerRuntime\n this.schedulerRuntime = null\n await runtime.stop()\n }\n\n /** Start the API-owned recovery and retention loop. Embedded runtimes opt in explicitly. */\n startOntologyMaintenance(): Promise<OntologyMaintenanceHandle> {\n this.storageReadiness.startSchemaValidation()\n return this.ontologyMaintenance.start()\n }\n\n getOntologyOperationalStatus(): OntologyOperationalStatus {\n return this.ontologyMaintenance.getOperationalStatus()\n }\n\n async checkReadiness(): Promise<SixbReadiness> {\n return this.storageReadiness.check()\n }\n\n /** Disconnect all currently connected connector clients. */\n async disconnectConnectors(): Promise<void> {\n await this.connectorRuntime.disconnectAll()\n }\n\n /** Flush and close the configured process logger provider. */\n async closeLogger(): Promise<void> {\n await this.logs.close()\n }\n\n /** Close the runtime broker provider if it owns external resources. */\n async closeBroker(): Promise<void> {\n await this.committedFacts.stop()\n await this.ontologyMaintenance.stop()\n await this.broker.close?.()\n }\n\n /**\n * Derive a principal-scoped SDK from this runtime.\n *\n * The scoped surface is default-deny: operations run only when covered by\n * the context's grants. This raw runtime stays privileged for trusted\n * system code (startup, syncs, projections, workers, webhooks, tests).\n */\n as(context: AuthorizationContext): ScopedSixb<TOntologySources> {\n return createScopedSixb<TOntologySources>(\n { ...this.runtimeContext, authorization: context },\n {\n datasets: {\n list: () => this.listDatasets(),\n getById: (datasetId) => this.getDatasetById(datasetId),\n },\n syncs: {\n list: () => this.listSyncs(),\n getById: (syncId) => this.getSyncById(syncId),\n },\n pipelines: {\n list: () => this.listPipelines(),\n getById: (pipelineId) => this.getPipelineById(pipelineId),\n },\n workflows: this.workflows,\n agents: this.agents,\n }\n )\n }\n\n objects<TObjectType extends RegisteredObjectType<TOntologySources>>(\n objectType: TObjectType\n ): ObjectSet<\n TObjectType,\n RegisteredValueTypes<TOntologySources>,\n RegisteredObjectType<TOntologySources>\n > {\n assertObjectTypeRegistered(this.ontology.getObjectTypesById(), objectType)\n\n return createObjectSet<\n TObjectType,\n RegisteredObjectType<TOntologySources>,\n RegisteredValueTypes<TOntologySources>\n >({ ...this.runtimeContext, objectType })\n }\n\n async upsertObject(\n objectTypeId: string,\n properties: Record<string, unknown>\n ): Promise<ObjectRow> {\n return objectService.upsertObject(this.runtimeContext, objectTypeId, properties)\n }\n\n async upsertObjectBatch(\n objectTypeId: string,\n items: readonly { properties: Record<string, unknown> }[]\n ): Promise<readonly BatchItemResult<ObjectRow>[]> {\n return objectService.upsertObjectBatch(this.runtimeContext, objectTypeId, items)\n }\n\n async upsertLinkBatch(\n items: readonly {\n objectTypeId: string\n sourceId: string\n linkId: string\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n }[]\n ): Promise<readonly BatchItemResult<void>[]> {\n return objectService.upsertLinkBatch(this.runtimeContext, items)\n }\n\n async appendTelemetry(\n objectTypeId: string,\n items: readonly { id: string; properties: Record<string, unknown>; at?: Date }[]\n ): Promise<void> {\n await objectService.appendTelemetry(this.runtimeContext, objectTypeId, items)\n }\n\n async upsertLink(\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n ): Promise<void> {\n await objectService.upsertLink(this.runtimeContext, objectTypeId, sourceId, linkId, target)\n }\n\n async removeLink(\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string }\n ): Promise<void> {\n await objectService.removeLink(this.runtimeContext, objectTypeId, sourceId, linkId, target)\n }\n\n getPrimaryPropertyId(objectTypeId: string): string {\n return this.ontology.getPrimaryPropertyId(objectTypeId)\n }\n\n listObjectProjections(): readonly ObjectProjectionDefinition[] {\n return this.projectionRegistry.listObjectProjections()\n }\n\n listLinkProjections(): readonly LinkProjectionDefinition[] {\n return this.projectionRegistry.listLinkProjections()\n }\n\n listTelemetryProjections(): readonly TelemetryProjectionDefinition[] {\n return this.projectionRegistry.listTelemetryProjections()\n }\n\n getProjectionById(projectionId: string): ProjectionDefinition | null {\n return this.projectionRegistry.getProjectionById(projectionId)\n }\n\n /**\n * Global list for cross-type queries (e.g., dashboards, search).\n * Use sixb.objects(Type).query().where(...).list() for type-safe property filtering.\n */\n async list(params: {\n objectTypeIds?: readonly string[]\n idPrefix?: string\n idSuffix?: string\n updatedAfter?: Date\n updatedBefore?: Date\n createdAfter?: Date\n createdBefore?: Date\n limit?: number\n offset?: number\n orderBy?: \"createdAt\" | \"updatedAt\" | \"primaryId\"\n order?: \"asc\" | \"desc\"\n }): Promise<ListResult<ObjectRow>> {\n return objectService.listObjects(this.runtimeContext, params)\n }\n\n listSubTypes(objectTypeId: string): string[] {\n return this.ontology.listSubTypes(objectTypeId)\n }\n\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n return this.ontology.isValidLinkTarget(expected, actual)\n }\n}\n\nfunction validateScheduleReferences(\n consumerKind: \"Sync\" | \"Pipeline\",\n consumerId: string,\n references: readonly { readonly scheduleId: string }[],\n schedulesById: ReadonlyMap<string, ScheduleDefinition>\n): void {\n for (const reference of references) {\n if (!schedulesById.has(reference.scheduleId)) {\n throw new RuntimeError(\n `${consumerKind} '${consumerId}' references unknown schedule '${reference.scheduleId}'. Add it to 'schedules' in createSixb() or export it from 'schedules/'.`\n )\n }\n }\n}\n\nfunction validateAuthStrategySecurityReferences(\n strategy: ReturnType<AuthRuntime[\"getStrategy\"]>,\n security: SecurityRegistry\n): void {\n if (!isMagicLinkAuthStrategy(strategy) && !isOidcAuthStrategy(strategy)) {\n return\n }\n\n for (const groupId of strategy.bootstrapGroupIds ?? []) {\n if (!security.getGroupById(groupId)) {\n throw new AuthRuntimeError(\n \"invalid_auth_config\",\n `[Sixb] Auth bootstrapGroups references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`\n )\n }\n }\n}\n\nfunction assertWebhookDeliveryStorage(\n connectors: readonly ConnectorDefinition[],\n storage: Storage\n): void {\n if (storage.webhookDeliveries !== undefined) {\n return\n }\n\n for (const connector of connectors) {\n const webhooks = connector.adapter.webhooks\n if (!Array.isArray(webhooks)) {\n continue\n }\n\n if (webhooks.some((webhook) => webhook.idempotencyKey !== undefined)) {\n throw new WebhookValidationError(\n \"[Sixb] Webhook idempotency requires storage.webhookDeliveries to be configured.\"\n )\n }\n }\n}\n",
12
- "import { ConnectorError, ConnectorNotFoundError } from \"./errors\"\nimport type { ConnectorAdapter, ConnectorClient, ConnectorDefinition } from \"./types\"\n\ntype ConnectorConnectionState = {\n controller: AbortController\n clientPromise: Promise<unknown>\n}\n\nexport class ConnectorRuntime {\n private readonly definitionsById = new Map<string, ConnectorDefinition>()\n private readonly connectionStates = new Map<ConnectorDefinition, ConnectorConnectionState>()\n\n constructor(\n private readonly projectId: string,\n definitions: readonly ConnectorDefinition[]\n ) {\n for (const definition of definitions) {\n if (this.definitionsById.has(definition.id)) {\n throw new ConnectorError(`Duplicate connector id: ${definition.id}`)\n }\n\n this.definitionsById.set(definition.id, definition)\n }\n }\n\n list(): readonly ConnectorDefinition[] {\n return [...this.definitionsById.values()]\n }\n\n getById(id: string): ConnectorDefinition | null {\n return this.definitionsById.get(id) ?? null\n }\n\n async connect<TAdapter extends ConnectorAdapter>(\n definition: ConnectorDefinition<string, TAdapter>\n ): Promise<ConnectorClient<TAdapter>> {\n const registeredDefinition = this.definitionsById.get(definition.id)\n\n if (!registeredDefinition) {\n throw new ConnectorNotFoundError(definition.id)\n }\n\n if (registeredDefinition !== definition) {\n throw new ConnectorError(\n `Connector '${definition.id}' is not the registered definition instance.`\n )\n }\n\n let state = this.connectionStates.get(definition)\n if (!state) {\n const controller = new AbortController()\n const clientPromise = Promise.resolve(\n definition.adapter.connect({\n projectId: this.projectId,\n connectorId: definition.id,\n signal: controller.signal,\n })\n )\n\n state = { controller, clientPromise }\n this.connectionStates.set(definition, state)\n }\n\n try {\n return (await state.clientPromise) as ConnectorClient<TAdapter>\n } catch (error) {\n if (this.connectionStates.get(definition) === state) {\n this.connectionStates.delete(definition)\n }\n throw error\n }\n }\n\n async disconnectAll(): Promise<void> {\n const activeConnections = [...this.connectionStates.entries()]\n this.connectionStates.clear()\n\n for (const [definition, state] of activeConnections) {\n await this.disconnectState(definition, state)\n }\n }\n\n private async disconnectState(\n definition: ConnectorDefinition,\n state: ConnectorConnectionState\n ): Promise<void> {\n state.controller.abort()\n\n let client: unknown\n try {\n client = await state.clientPromise\n } catch {\n return\n }\n\n if (typeof definition.adapter.disconnect === \"function\") {\n await definition.adapter.disconnect(client as never)\n }\n }\n}\n",
13
- "import type { OntologyOutboxDispatcher } from \"../events\"\nimport type { Storage } from \"../storage\"\nimport type {\n OntologyMaintenanceCleanupSnapshot,\n OntologyMaintenanceHandle,\n OntologyMaintenanceOptions,\n OntologyMaintenanceSnapshot,\n OntologyOperationalStatus,\n} from \"./types\"\n\nconst DEFAULT_INTERVAL_MS = 60_000\nconst DEFAULT_RETENTION_MS = 24 * 60 * 60_000\nconst DEFAULT_CLEANUP_LIMIT = 1_000\nconst DEFAULT_SHUTDOWN_TIMEOUT_MS = 30_000\nconst DEGRADED_ATTEMPT_THRESHOLD = 3\nconst DEGRADED_FAILURE_THRESHOLD = 2\n\ninterface OntologyMaintenanceDependencies {\n readonly projectId: string\n readonly storage: Storage\n readonly dispatcher: OntologyOutboxDispatcher\n readonly options?: OntologyMaintenanceOptions\n readonly now?: () => Date\n readonly onError?: (error: unknown) => void\n}\n\n/** API-owned catch-up, retention, and operational snapshot lifecycle. */\nexport class OntologyMaintenance {\n private readonly projectId: string\n private readonly storage: Storage\n private readonly dispatcher: OntologyOutboxDispatcher\n private readonly intervalMs: number\n private readonly publishedOutboxRetentionMs: number\n private readonly terminalSourceRetentionMs: number\n private readonly cleanupLimit: number\n private readonly shutdownTimeoutMs: number\n private readonly now: () => Date\n private readonly onError: (error: unknown) => void\n private readonly owners = new Set<symbol>()\n private timer: ReturnType<typeof setTimeout> | null = null\n private pass: Promise<void> | null = null\n private stopping: Promise<void> | null = null\n private snapshot: OntologyMaintenanceSnapshot\n\n constructor(dependencies: OntologyMaintenanceDependencies) {\n assertNonblank(dependencies.projectId, \"projectId\")\n const options = dependencies.options ?? {}\n this.projectId = dependencies.projectId\n this.storage = dependencies.storage\n this.dispatcher = dependencies.dispatcher\n this.intervalMs = positiveInteger(options.intervalMs ?? DEFAULT_INTERVAL_MS, \"intervalMs\")\n this.publishedOutboxRetentionMs = nonnegativeInteger(\n options.publishedOutboxRetentionMs ?? DEFAULT_RETENTION_MS,\n \"publishedOutboxRetentionMs\"\n )\n this.terminalSourceRetentionMs = nonnegativeInteger(\n options.terminalSourceRetentionMs ?? DEFAULT_RETENTION_MS,\n \"terminalSourceRetentionMs\"\n )\n this.cleanupLimit = positiveInteger(\n options.cleanupLimit ?? DEFAULT_CLEANUP_LIMIT,\n \"cleanupLimit\"\n )\n this.shutdownTimeoutMs = nonnegativeInteger(\n options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS,\n \"shutdownTimeoutMs\"\n )\n this.now = dependencies.now ?? (() => new Date())\n this.onError =\n dependencies.onError ??\n ((error) => console.error(\"[Sixb] Ontology maintenance error:\", error))\n this.snapshot = emptySnapshot(this.intervalMs)\n }\n\n /** Acquires maintenance ownership and starts catch-up without blocking the host from listening. */\n async start(): Promise<OntologyMaintenanceHandle> {\n if (this.stopping) await this.stopping\n const owner = Symbol(\"ontology-maintenance-owner\")\n const startsHosting = this.owners.size === 0\n this.owners.add(owner)\n if (startsHosting) this.startHostedPass()\n\n let released = false\n return {\n stop: async () => {\n if (released) return\n released = true\n this.owners.delete(owner)\n if (this.owners.size === 0) await this.stopLoop()\n },\n }\n }\n\n /** Runs one coalesced pass. Exposed for deterministic hosting and tests. */\n runNow(): Promise<void> {\n this.pass ??= this.runPass().finally(() => {\n this.pass = null\n })\n return this.pass\n }\n\n /** Force-stops every owner; used during provider shutdown. */\n async stop(): Promise<void> {\n this.owners.clear()\n await this.stopLoop()\n }\n\n getSnapshot(): OntologyMaintenanceSnapshot {\n return structuredClone(this.snapshot)\n }\n\n getOperationalStatus(): OntologyOperationalStatus {\n const snapshot = this.getSnapshot()\n const lastActivityAt = latestTimestamp(snapshot.lastStartedAt, snapshot.lastCompletedAt)\n const overdue =\n lastActivityAt !== null &&\n this.now().getTime() - Date.parse(lastActivityAt) > this.intervalMs * 2\n const oldestPendingAt = snapshot.outbox?.oldestPendingAt ?? null\n const pendingTooLong =\n oldestPendingAt !== null &&\n this.now().getTime() - Date.parse(oldestPendingAt) > this.intervalMs * 2\n const repeatedlyFailing = (snapshot.outbox?.maxAttempts ?? 0) >= DEGRADED_ATTEMPT_THRESHOLD\n const degraded =\n snapshot.consecutiveFailures >= DEGRADED_FAILURE_THRESHOLD ||\n repeatedlyFailing ||\n pendingTooLong ||\n overdue\n return { status: degraded ? \"degraded\" : \"ok\", maintenance: snapshot }\n }\n\n private startHostedPass(): void {\n void this.runNow()\n .catch((error) => this.reportError(error))\n .finally(() => this.scheduleNextPass())\n }\n\n private async runPass(): Promise<void> {\n const started = this.now()\n this.snapshot = { ...this.snapshot, running: true, lastStartedAt: started.toISOString() }\n\n const failures: unknown[] = []\n await captureFailure(() => this.dispatcher.drain(), failures)\n const cleanup = await this.cleanupExpiredRows(started, failures)\n const { outbox, terminalSources } = await this.readOperationalSummaries(failures)\n this.completePass({ started, failures, cleanup, outbox, terminalSources })\n }\n\n private async cleanupExpiredRows(\n started: Date,\n failures: unknown[]\n ): Promise<OntologyMaintenanceCleanupSnapshot> {\n const publishedOutboxRowsDeleted = await captureFailure(\n () =>\n this.storage.ontology.outbox.purgePublished({\n projectId: this.projectId,\n publishedBefore: new Date(\n started.getTime() - this.publishedOutboxRetentionMs\n ).toISOString(),\n limit: this.cleanupLimit,\n }),\n failures,\n 0\n )\n const terminalSources = await captureFailure(\n () =>\n this.storage.ontology.sources.cleanupTerminal({\n projectId: this.projectId,\n terminalBefore: new Date(\n started.getTime() - this.terminalSourceRetentionMs\n ).toISOString(),\n limit: this.cleanupLimit,\n }),\n failures,\n { rowsDeleted: 0, materializationsDeleted: 0 }\n )\n\n return {\n publishedOutboxRowsDeleted,\n terminalSourceRowsDeleted: terminalSources.rowsDeleted,\n terminalSourceMaterializationsDeleted: terminalSources.materializationsDeleted,\n }\n }\n\n private async readOperationalSummaries(failures: unknown[]): Promise<{\n readonly outbox: OntologyMaintenanceSnapshot[\"outbox\"]\n readonly terminalSources: OntologyMaintenanceSnapshot[\"terminalSources\"]\n }> {\n const outbox = await captureFailure(\n () => this.storage.ontology.outbox.summarize({ projectId: this.projectId }),\n failures,\n this.snapshot.outbox\n )\n const terminalSummary = await captureFailure(\n () => this.storage.ontology.sources.summarizeTerminal({ projectId: this.projectId }),\n failures,\n this.snapshot.terminalSources\n )\n return { outbox, terminalSources: terminalSummary }\n }\n\n private completePass(input: {\n readonly started: Date\n readonly failures: readonly unknown[]\n readonly cleanup: OntologyMaintenanceCleanupSnapshot\n readonly outbox: OntologyMaintenanceSnapshot[\"outbox\"]\n readonly terminalSources: OntologyMaintenanceSnapshot[\"terminalSources\"]\n }): void {\n const completed = this.now()\n const failure =\n input.failures.length > 0\n ? new AggregateError(input.failures, \"Maintenance pass failed.\")\n : null\n this.snapshot = {\n running: false,\n intervalMs: this.intervalMs,\n lastStartedAt: input.started.toISOString(),\n lastCompletedAt: completed.toISOString(),\n lastDurationMs: Math.max(0, completed.getTime() - input.started.getTime()),\n consecutiveFailures: failure ? this.snapshot.consecutiveFailures + 1 : 0,\n lastError: failure ? errorMessage(failure) : null,\n outbox: input.outbox,\n terminalSources: input.terminalSources,\n cleanup: input.cleanup,\n }\n if (failure) this.reportError(failure)\n }\n\n private scheduleNextPass(): void {\n if (this.owners.size === 0 || this.timer !== null) return\n this.timer = setTimeout(() => {\n this.timer = null\n if (this.owners.size === 0) return\n void this.runNow()\n .catch((error) => this.reportError(error))\n .finally(() => this.scheduleNextPass())\n }, this.intervalMs)\n this.timer.unref?.()\n }\n\n private stopLoop(): Promise<void> {\n if (this.stopping) return this.stopping\n if (this.timer !== null) {\n clearTimeout(this.timer)\n this.timer = null\n }\n const activePass = this.pass ?? Promise.resolve()\n const stopping = settlesWithin(activePass, this.shutdownTimeoutMs).then((settled) => {\n if (!settled) {\n this.reportError(\n new Error(`[Sixb] Ontology maintenance did not stop within ${this.shutdownTimeoutMs}ms.`)\n )\n }\n })\n this.stopping = stopping.finally(() => {\n this.stopping = null\n })\n return this.stopping\n }\n\n private reportError(error: unknown): void {\n try {\n this.onError(error)\n } catch {\n // Maintenance failures stay observable without escaping into runtime lifecycle code.\n }\n }\n}\n\nfunction emptySnapshot(intervalMs: number): OntologyMaintenanceSnapshot {\n return {\n running: false,\n intervalMs,\n lastStartedAt: null,\n lastCompletedAt: null,\n lastDurationMs: null,\n consecutiveFailures: 0,\n lastError: null,\n outbox: null,\n terminalSources: null,\n cleanup: null,\n }\n}\n\nfunction positiveInteger(value: number, name: string): number {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`[Sixb] Ontology maintenance ${name} must be a positive integer.`)\n }\n return value\n}\n\nfunction nonnegativeInteger(value: number, name: string): number {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`[Sixb] Ontology maintenance ${name} must be a nonnegative integer.`)\n }\n return value\n}\n\nfunction assertNonblank(value: string, name: string): void {\n if (value.trim().length === 0) {\n throw new Error(`[Sixb] Ontology maintenance ${name} must not be blank.`)\n }\n}\n\nfunction errorMessage(error: unknown): string {\n if (error instanceof AggregateError) {\n return [...error.errors].map(errorMessage).join(\" | \").slice(0, 2_000)\n }\n const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error)\n return message.slice(0, 2_000)\n}\n\nfunction latestTimestamp(left: string | null, right: string | null): string | null {\n if (left === null) return right\n if (right === null) return left\n return Date.parse(left) >= Date.parse(right) ? left : right\n}\n\nasync function settlesWithin(promise: Promise<void>, timeoutMs: number): Promise<boolean> {\n let timer: ReturnType<typeof setTimeout> | undefined\n const timedOut = new Promise<false>((resolve) => {\n timer = setTimeout(() => resolve(false), timeoutMs)\n })\n const result = await Promise.race([\n promise.then(\n () => true as const,\n () => true as const\n ),\n timedOut,\n ])\n if (timer !== undefined) clearTimeout(timer)\n return result\n}\n\nasync function captureFailure(run: () => Promise<void>, failures: unknown[]): Promise<void>\nasync function captureFailure<T>(\n run: () => Promise<T>,\n failures: unknown[],\n fallback: T\n): Promise<T>\nasync function captureFailure<T>(\n run: () => Promise<T>,\n failures: unknown[],\n fallback?: T\n): Promise<T | undefined> {\n try {\n return await run()\n } catch (error) {\n failures.push(error)\n return fallback\n }\n}\n",
14
- "import { type ResolvedRole, resolveRoleGrants } from \"../authorization\"\nimport { APPLICATION_IDS } from \"./applications\"\nimport type {\n GroupDefinition,\n MembershipPolicyDefinition,\n RoleDefinition,\n SecurityRegistry,\n} from \"./types\"\nimport { validateSecurityDefinitionsAtStartup } from \"./validation\"\n\nclass RuntimeSecurityRegistry implements SecurityRegistry {\n constructor(\n private readonly groupsById: ReadonlyMap<string, GroupDefinition>,\n private readonly rolesById: ReadonlyMap<string, RoleDefinition>,\n private readonly membershipPoliciesById: ReadonlyMap<string, MembershipPolicyDefinition>,\n private readonly resolvedRoles: readonly ResolvedRole[]\n ) {}\n\n listGroups(): readonly GroupDefinition[] {\n return [...this.groupsById.values()]\n }\n\n getGroupById(groupId: string): GroupDefinition | null {\n return this.groupsById.get(groupId) ?? null\n }\n\n listRoles(): readonly RoleDefinition[] {\n return [...this.rolesById.values()]\n }\n\n getRoleById(roleId: string): RoleDefinition | null {\n return this.rolesById.get(roleId) ?? null\n }\n\n listResolvedRoles(): readonly ResolvedRole[] {\n return this.resolvedRoles\n }\n\n listMembershipPolicies(): readonly MembershipPolicyDefinition[] {\n return [...this.membershipPoliciesById.values()]\n }\n\n getMembershipPolicyById(policyId: string): MembershipPolicyDefinition | null {\n return this.membershipPoliciesById.get(policyId) ?? null\n }\n}\n\nexport function createRuntimeSecurityRegistry(input: {\n readonly groups?: readonly GroupDefinition[]\n readonly roles?: readonly RoleDefinition[]\n readonly membershipPolicies?: readonly MembershipPolicyDefinition[]\n readonly applicationIds?: ReadonlySet<string>\n readonly objectTypeIds?: ReadonlySet<string>\n readonly datasetIds?: ReadonlySet<string>\n readonly actionIds?: ReadonlySet<string>\n readonly workflowIds?: ReadonlySet<string>\n readonly syncIds?: ReadonlySet<string>\n readonly pipelineIds?: ReadonlySet<string>\n readonly agentIds?: ReadonlySet<string>\n readonly getSubTypes?: (objectTypeId: string) => readonly string[]\n}): SecurityRegistry {\n const securityDefinitions = validateSecurityDefinitionsAtStartup({\n groups: input.groups ?? [],\n roles: input.roles ?? [],\n membershipPolicies: input.membershipPolicies ?? [],\n applicationIds: input.applicationIds ?? APPLICATION_IDS,\n objectTypeIds: input.objectTypeIds,\n datasetIds: input.datasetIds,\n actionIds: input.actionIds,\n workflowIds: input.workflowIds,\n syncIds: input.syncIds,\n pipelineIds: input.pipelineIds,\n agentIds: input.agentIds,\n observableIds: new Set([\"logs\"]),\n })\n\n const universe = {\n applicationIds: input.applicationIds ?? APPLICATION_IDS,\n objectTypeIds: input.objectTypeIds ?? new Set<string>(),\n datasetIds: input.datasetIds ?? new Set<string>(),\n actionIds: input.actionIds ?? new Set<string>(),\n workflowIds: input.workflowIds ?? new Set<string>(),\n syncIds: input.syncIds ?? new Set<string>(),\n pipelineIds: input.pipelineIds ?? new Set<string>(),\n agentIds: input.agentIds ?? new Set<string>(),\n observableIds: new Set([\"logs\"]),\n getSubTypes: input.getSubTypes ?? (() => []),\n }\n const resolvedRoles = securityDefinitions.roles.map((role) => ({\n id: role.id,\n grantedToGroupIds: role.grantedToGroupIds,\n grants: resolveRoleGrants(role, universe),\n }))\n\n return new RuntimeSecurityRegistry(\n securityDefinitions.groupsById,\n securityDefinitions.rolesById,\n securityDefinitions.membershipPoliciesById,\n resolvedRoles\n )\n}\n",
15
- "/**\n * Scoped SDK surface returned by `sixb.as(context)`.\n *\n * The scoped types are masks over the full SDK types — derived from the same\n * declarations, never copies — so signatures cannot drift and new surface area\n * stays hidden until its grants are enforceable end to end. The runtime values\n * are the same factories running over an authorization-carrying runtime\n * context; leaf asserts and query planning enforce the grants.\n */\n\nimport type {\n ActionDefinition,\n RequestActionAndWaitInput,\n RequestActionInput,\n RequestActionResult,\n} from \"../actions\"\nimport {\n requestAction as requestRuntimeAction,\n requestActionAndWait as requestRuntimeActionAndWait,\n} from \"../actions/request\"\nimport type {\n AgentDefinition,\n AgentsRuntime,\n RequestAgentRunInput,\n RequestAgentRunResult,\n ScopedListAgentThreadsInput,\n} from \"../agents\"\nimport {\n type AuthorizationContext,\n type AuthzRequest,\n assertAuthorized,\n canViewEvent,\n isAllowed,\n} from \"../authorization\"\nimport type { DatasetDefinition } from \"../datasets\"\nimport type { EventsReadInput, StoredDomainEvent } from \"../events\"\nimport { createObjectSet, objectService } from \"../objects\"\nimport type { ListObjectsParams } from \"../objects/service\"\nimport type { ValueType } from \"../ontology\"\nimport { assertObjectTypeRegistered } from \"../ontology\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { PipelineDefinition } from \"../pipelines\"\nimport { PipelineError } from \"../pipelines\"\nimport {\n type PipelineRunRequestResult,\n type RequestPipelineRunInput,\n requestPipelineRun,\n} from \"../pipelines/request\"\nimport type { ObjectRow } from \"../storage\"\nimport type { ActionRunRecord } from \"../storage/action-runs\"\nimport type { AgentThreadRecord, ListAgentThreadsResult } from \"../storage/agents\"\nimport type { SyncDefinition } from \"../syncs\"\nimport { SyncValidationError } from \"../syncs\"\nimport {\n type RequestSyncRunInput,\n requestSyncRun,\n type SyncRunRequestResult,\n} from \"../syncs/request\"\nimport type {\n RequestWorkflowRunInput,\n WorkflowDefinition,\n WorkflowRunRequestResult,\n WorkflowsRuntime,\n} from \"../workflows\"\nimport type {\n ListResult,\n ObjectByIdHandle,\n ObjectSet,\n OntologySource,\n RegisteredObjectType,\n RegisteredValueTypes,\n SixbInstance,\n SixbRuntimeContext,\n} from \"./types\"\n\n// Scoped members are indexed accesses of the full SDK types rather than\n// `Pick`s: signatures stay single-sourced (no drift), while indexed access\n// stays lazy — mapped types would eagerly materialize every method's deep\n// query/telemetry conditionals and blow the instantiation depth limit.\nexport interface ScopedObjectByIdHandle<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n> {\n get: ObjectByIdHandle<TObjectType, TValueTypes>[\"get\"]\n requestAction: ObjectByIdHandle<TObjectType, TValueTypes>[\"requestAction\"]\n requestActionAndWait: ObjectByIdHandle<TObjectType, TValueTypes>[\"requestActionAndWait\"]\n /** Requires `edit:object` on this type and `view:object` on the link target. */\n link: ObjectByIdHandle<TObjectType, TValueTypes>[\"link\"]\n /** Requires `edit:object` on this type and `view:object` on the link target. */\n unlink: ObjectByIdHandle<TObjectType, TValueTypes>[\"unlink\"]\n /** Requires `edit:object`. */\n delete: ObjectByIdHandle<TObjectType, TValueTypes>[\"delete\"]\n /** Requires `edit:object`. */\n restore: ObjectByIdHandle<TObjectType, TValueTypes>[\"restore\"]\n /** `append()` requires `append:telemetry`; `history()` requires `view:object`. */\n telemetry: ObjectByIdHandle<TObjectType, TValueTypes>[\"telemetry\"]\n // `listLinks` stays off this surface: its rows name target types that no read grant covers.\n}\n\nexport interface ScopedObjectSet<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n TRegisteredObjectTypes extends ObjectTypeWithPropertyTokens = TObjectType,\n> {\n get: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"get\"]\n list: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"list\"]\n query: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"query\"]\n requestAction: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"requestAction\"]\n requestActionAndWait: ObjectSet<\n TObjectType,\n TValueTypes,\n TRegisteredObjectTypes\n >[\"requestActionAndWait\"]\n /** Requires `view:object` and `edit:object`. */\n upsert: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"upsert\"]\n /** Requires `edit:object` on this type and `view:object` on the link target. */\n upsertLink: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"upsertLink\"]\n /** Requires `edit:object` on this type and `view:object` on the link target. */\n removeLink: ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>[\"removeLink\"]\n /** Requires `append:telemetry` — and notably not `view:object`. */\n appendTelemetryBatch: ObjectSet<\n TObjectType,\n TValueTypes,\n TRegisteredObjectTypes\n >[\"appendTelemetryBatch\"]\n\n /** Bind read, write, and action operations to a specific object id. */\n byId(id: string): ScopedObjectByIdHandle<TObjectType, TValueTypes>\n}\n\n/**\n * Principal-scoped runtime surface.\n *\n * Exposes only operations whose grants are enforceable end to end (`can.view`, `can.edit`,\n * `can.append`, `can.apply`, `can.run`, `can.observe`). Infra handles, lifecycle, auth\n * administration, and `listLinks` stay on the privileged runtime.\n */\nexport interface ScopedSixb<TOntologySources extends readonly OntologySource[]> {\n /** The authorization context this SDK instance enforces. */\n readonly authorization: AuthorizationContext\n\n /** Type-safe ObjectSet narrowed to grant-enforceable operations. */\n objects<TObjectType extends RegisteredObjectType<TOntologySources>>(\n objectType: TObjectType\n ): ScopedObjectSet<\n TObjectType,\n RegisteredValueTypes<TOntologySources>,\n RegisteredObjectType<TOntologySources>\n >\n\n /** Cross-type listing narrowed to the principal's viewable object types. */\n list(params: ListObjectsParams): Promise<ListResult<ObjectRow>>\n\n /** Get an object by type id and primary id (server / dynamic contexts). */\n getObject(objectTypeId: string, primaryId: string): Promise<ObjectRow | null>\n\n /**\n * The primary property of a type the principal may view.\n *\n * Asserts before it looks the type up, which is the whole point of having it here: the privileged\n * lookup answers \"unknown type\" for an unregistered id and a primary property for a registered\n * one, so a caller that reaches it before any grant check can tell the two apart. Every other\n * ontology read is grant-filtered — `listObjectTypes` returns only viewable types — and this\n * matches them.\n */\n getPrimaryPropertyId: SixbInstance<TOntologySources>[\"getPrimaryPropertyId\"]\n\n // The string-based write entry points, indexed off the full runtime rather than restated, so the\n // surface that now carries authorization cannot drift from the one it delegates to.\n /** Upsert an object by type id. Requires `view:object` and `edit:object`. */\n upsertObject: SixbInstance<TOntologySources>[\"upsertObject\"]\n /** Batch upsert objects of one type. Requires `view:object` and `edit:object`. */\n upsertObjectBatch: SixbInstance<TOntologySources>[\"upsertObjectBatch\"]\n /** Create or update a link. Requires `edit:object` on the source, `view:object` on the target. */\n upsertLink: SixbInstance<TOntologySources>[\"upsertLink\"]\n /** Batch upsert links. Asserted for every item before anything commits. */\n upsertLinkBatch: SixbInstance<TOntologySources>[\"upsertLinkBatch\"]\n /** Remove a link. Requires `edit:object` on the source, `view:object` on the target. */\n removeLink: SixbInstance<TOntologySources>[\"removeLink\"]\n /** Append telemetry. Requires `append:telemetry` — and notably not `view:object`. */\n appendTelemetry: SixbInstance<TOntologySources>[\"appendTelemetry\"]\n\n /** Dataset definitions the principal may view. */\n listDatasets(): readonly DatasetDefinition[]\n\n /** Look up a viewable dataset definition; null hides ungranted datasets. */\n getDatasetById(datasetId: string): DatasetDefinition | null\n\n /** Action definitions the principal may apply. */\n listActions(): readonly ActionDefinition[]\n\n /** Look up an applicable action definition; null hides ungranted actions. */\n getActionById(actionId: string): ActionDefinition | null\n\n /** Request an action by id (server / dynamic contexts). Requires `can.apply`. */\n requestAction(input: RequestActionInput): Promise<RequestActionResult>\n\n /** Request an action by id and wait for the run to settle. Requires `can.apply`. */\n requestActionAndWait(input: RequestActionAndWaitInput): Promise<ActionRunRecord>\n\n /** Workflow definitions the principal may run. */\n listWorkflows(): readonly WorkflowDefinition[]\n\n /** Look up a runnable workflow definition; null hides workflows the principal cannot run. */\n getWorkflowById(workflowId: string): WorkflowDefinition | null\n\n /** Queue a workflow run. Requires `can.run`. */\n requestWorkflowRun(input: RequestWorkflowRunInput): Promise<WorkflowRunRequestResult>\n\n /** Sync definitions the principal may run. */\n listSyncs(): readonly SyncDefinition[]\n\n /** Look up a runnable sync definition; null hides syncs the principal cannot run. */\n getSyncById(syncId: string): SyncDefinition | null\n\n /** Queue a sync run. Requires `can.run`. */\n requestSyncRun(input: RequestSyncRunInput): Promise<SyncRunRequestResult>\n\n /** Pipeline definitions the principal may run. */\n listPipelines(): readonly PipelineDefinition[]\n\n /** Look up a runnable pipeline definition; null hides pipelines the principal cannot run. */\n getPipelineById(pipelineId: string): PipelineDefinition | null\n\n /** Queue a pipeline run. Requires `can.run`. */\n requestPipelineRun(input: RequestPipelineRunInput): Promise<PipelineRunRequestResult>\n\n /** Agent definitions the principal may run. */\n listAgents(): readonly AgentDefinition[]\n\n /** Look up a runnable agent definition; null hides agents the principal cannot run. */\n getAgentById(agentId: string): AgentDefinition | null\n\n /** Request an agent turn. Requires `can.run`. */\n requestAgentRun(input: RequestAgentRunInput): Promise<RequestAgentRunResult>\n\n /** List agent threads the principal owns and may run (owner + `run:agent` filtered). */\n listThreads(input?: ScopedListAgentThreadsInput): Promise<ListAgentThreadsResult>\n\n /** Read one agent thread the principal owns and may run; null hides inaccessible threads. */\n getThread(threadId: string): Promise<AgentThreadRecord | null>\n\n /** Read the domain events the principal is allowed to see (derived from grants). */\n readEvents(input?: EventsReadInput): Promise<readonly StoredDomainEvent[]>\n}\n\nexport function createScopedSixb<TOntologySources extends readonly OntologySource[]>(\n runtime: SixbRuntimeContext & { readonly authorization: AuthorizationContext },\n deps: {\n readonly datasets: {\n readonly list: () => readonly DatasetDefinition[]\n readonly getById: (datasetId: string) => DatasetDefinition | null\n }\n readonly syncs: {\n readonly list: () => readonly SyncDefinition[]\n readonly getById: (syncId: string) => SyncDefinition | null\n }\n readonly pipelines: {\n readonly list: () => readonly PipelineDefinition[]\n readonly getById: (pipelineId: string) => PipelineDefinition | null\n }\n readonly workflows: WorkflowsRuntime\n readonly agents: AgentsRuntime\n }\n): ScopedSixb<TOntologySources> {\n const canListAction = (action: ActionDefinition) =>\n isAllowed(runtime.authorization, { kind: \"action.apply\", actionId: action.id }) &&\n (action.binding.kind === \"global\" ||\n isAllowed(runtime.authorization, {\n kind: \"object.view\",\n objectTypeId: action.binding.objectType.id,\n }))\n\n // A scoped catalog narrows a definition source to what the principal may see.\n // The run/view grant doubles as catalog visibility: a definition the principal\n // cannot run/view is not worth surfacing, and hiding it also hides the\n // (possibly ungranted) resources its shape references.\n const scopedCatalog = <T extends { readonly id: string }>(\n source: { list(): readonly T[]; getById(id: string): T | null },\n toRequest: (id: string) => AuthzRequest\n ) => {\n const allowed = (id: string) => isAllowed(runtime.authorization, toRequest(id))\n return {\n list: () => source.list().filter((item) => allowed(item.id)),\n getById: (id: string) => {\n const item = source.getById(id)\n return item && allowed(id) ? item : null\n },\n }\n }\n\n const datasets = scopedCatalog(deps.datasets, (datasetId) => ({\n kind: \"dataset.view\",\n datasetId,\n }))\n const syncs = scopedCatalog(deps.syncs, (syncId) => ({ kind: \"sync.run\", syncId }))\n const pipelines = scopedCatalog(deps.pipelines, (pipelineId) => ({\n kind: \"pipeline.run\",\n pipelineId,\n }))\n const workflows = scopedCatalog(deps.workflows, (workflowId) => ({\n kind: \"workflow.run\",\n workflowId,\n }))\n const agents = scopedCatalog(deps.agents, (agentId) => ({ kind: \"agent.run\", agentId }))\n\n const scoped = {\n authorization: runtime.authorization,\n\n objects<TObjectType extends RegisteredObjectType<TOntologySources>>(objectType: TObjectType) {\n assertObjectTypeRegistered(runtime.ontology.getObjectTypesById(), objectType)\n\n return createObjectSet<\n TObjectType,\n RegisteredObjectType<TOntologySources>,\n RegisteredValueTypes<TOntologySources>\n >({ ...runtime, objectType })\n },\n\n list: (params: ListObjectsParams) => objectService.listObjects(runtime, params),\n\n getObject: async (objectTypeId: string, primaryId: string) => {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n return runtime.storage.objects.getByPrimaryId({\n projectId: runtime.projectId,\n objectTypeId,\n primaryId,\n })\n },\n\n getPrimaryPropertyId: (objectTypeId: string) => {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n return runtime.ontology.getPrimaryPropertyId(objectTypeId)\n },\n\n // Same delegation as the privileged runtime's own methods; the leaves assert the grants off\n // `runtime.authorization`, which is present here by construction.\n upsertObject: (objectTypeId: string, properties: Record<string, unknown>) =>\n objectService.upsertObject(runtime, objectTypeId, properties),\n\n upsertObjectBatch: (\n objectTypeId: string,\n items: readonly { properties: Record<string, unknown> }[]\n ) => objectService.upsertObjectBatch(runtime, objectTypeId, items),\n\n upsertLink: (\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n ) => objectService.upsertLink(runtime, objectTypeId, sourceId, linkId, target),\n\n upsertLinkBatch: (\n items: readonly {\n objectTypeId: string\n sourceId: string\n linkId: string\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n }[]\n ) => objectService.upsertLinkBatch(runtime, items),\n\n removeLink: (\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string }\n ) => objectService.removeLink(runtime, objectTypeId, sourceId, linkId, target),\n\n appendTelemetry: (\n objectTypeId: string,\n items: readonly { id: string; properties: Record<string, unknown>; at?: Date }[]\n ) => objectService.appendTelemetry(runtime, objectTypeId, items),\n\n listDatasets: datasets.list,\n getDatasetById: datasets.getById,\n\n listActions: () => runtime.actionRegistry.list().filter((action) => canListAction(action)),\n\n getActionById: (actionId: string) => {\n const action = runtime.actionRegistry.getById(actionId)\n return action && canListAction(action) ? action : null\n },\n\n requestAction: (input: RequestActionInput) => requestRuntimeAction(runtime, input),\n\n // Gated by the same `can.apply` assertion: `requestActionAndWait` requests through\n // `requestAction` and then only reads the run it just created.\n requestActionAndWait: (input: RequestActionAndWaitInput) =>\n requestRuntimeActionAndWait(runtime, input),\n\n listWorkflows: workflows.list,\n getWorkflowById: workflows.getById,\n\n requestWorkflowRun: (input: RequestWorkflowRunInput) =>\n deps.workflows.requestByIdAs(runtime, input),\n\n listSyncs: syncs.list,\n getSyncById: syncs.getById,\n requestSyncRun: async (input: RequestSyncRunInput) => {\n // Resolve against the full registry, not the grant-filtered one: an existing sync the caller\n // may not run has to report \"forbidden\", the same as `requestAction`. Only a genuinely unknown\n // id is \"unknown\". `requestSyncRun` asserts the grant.\n const sync = deps.syncs.getById(input.syncId)\n if (!sync) throw new SyncValidationError(`[Sixb] Unknown sync '${input.syncId}'`)\n return requestSyncRun(runtime, sync, input)\n },\n\n listPipelines: pipelines.list,\n getPipelineById: pipelines.getById,\n requestPipelineRun: async (input: RequestPipelineRunInput) => {\n const pipeline = deps.pipelines.getById(input.pipelineId)\n if (!pipeline) throw new PipelineError(`[Sixb] Unknown pipeline '${input.pipelineId}'`)\n return requestPipelineRun(runtime, pipeline, input)\n },\n\n listAgents: agents.list,\n getAgentById: agents.getById,\n requestAgentRun: (input: RequestAgentRunInput) => deps.agents.requestAs(runtime, input),\n listThreads: (input?: ScopedListAgentThreadsInput) => deps.agents.listThreadsAs(runtime, input),\n getThread: (threadId: string) => deps.agents.getThreadAs(runtime, threadId),\n\n // No standalone events grant: the stream is filtered to events whose\n // subject the principal may view/apply/run. `limit` applies before this\n // filter, so a page may return fewer events than requested — acceptable for\n // a best-effort recent log (storage-level filtering is the planned fix).\n readEvents: async (input?: EventsReadInput) => {\n const events = await runtime.events.read(input)\n return events.filter((event) => canViewEvent(runtime.authorization, event))\n },\n }\n\n // Boundary cast: checking the literal against ScopedSixb<TOntologySources>\n // triggers excessively deep ObjectSet instantiation (same constraint noted\n // on SixbInstance). The mask only hides members of the full SDK values.\n return scoped as unknown as ScopedSixb<TOntologySources>\n}\n",
16
- "import type { SixbReadiness } from \"../maintenance\"\nimport { checkStorageSchema, isMigrationCapableStorage, type Storage } from \"../storage\"\n\nconst DEFAULT_SCHEMA_RETRY_DELAY_MS = 60_000\n\ntype SchemaReadiness =\n | { readonly status: \"unchecked\" | \"checking\" }\n | { readonly status: \"valid\" }\n | { readonly status: \"invalid\"; readonly reason: string; readonly retryAt: number }\n\ninterface StorageReadinessOptions {\n readonly schemaRetryDelayMs?: number\n readonly now?: () => Date\n}\n\n/** Caches the process schema invariant while keeping each readiness probe lock-free. */\nexport class StorageReadiness {\n private schema: SchemaReadiness\n private readonly schemaRetryDelayMs: number\n private readonly now: () => Date\n\n constructor(\n private readonly storage: Storage,\n options: StorageReadinessOptions = {}\n ) {\n this.schemaRetryDelayMs = positiveInteger(\n options.schemaRetryDelayMs ?? DEFAULT_SCHEMA_RETRY_DELAY_MS,\n \"schemaRetryDelayMs\"\n )\n this.now = options.now ?? (() => new Date())\n this.schema = isMigrationCapableStorage(storage) ? { status: \"unchecked\" } : { status: \"valid\" }\n }\n\n startSchemaValidation(): void {\n if (this.schema.status === \"checking\" || this.schema.status === \"valid\") return\n if (this.schema.status === \"invalid\" && this.now().getTime() < this.schema.retryAt) return\n this.schema = { status: \"checking\" }\n void this.validateSchema()\n }\n\n async check(): Promise<SixbReadiness> {\n try {\n await this.storage.ping()\n } catch {\n return {\n status: \"unready\",\n storage: { reachable: false, schemaValid: false },\n reason: \"Storage is unreachable.\",\n }\n }\n\n this.startSchemaValidation()\n if (this.schema.status === \"valid\") {\n return { status: \"ready\", storage: { reachable: true, schemaValid: true } }\n }\n\n return {\n status: \"unready\",\n storage: { reachable: true, schemaValid: false },\n reason:\n this.schema.status === \"invalid\"\n ? this.schema.reason\n : \"Storage schema validation is in progress.\",\n }\n }\n\n private async validateSchema(): Promise<void> {\n // Shared with `sixb check`, so the panel an author reads before deploying and the\n // `/ready` a load balancer polls after cannot disagree about what \"usable\" means.\n const result = await checkStorageSchema(this.storage)\n\n this.schema = result.ok\n ? { status: \"valid\" }\n : this.invalidSchema(result.reason ?? \"Storage schema is not usable.\")\n }\n\n private invalidSchema(reason: string): SchemaReadiness {\n return {\n status: \"invalid\",\n reason,\n retryAt: this.now().getTime() + this.schemaRetryDelayMs,\n }\n }\n}\n\nfunction positiveInteger(value: number, name: string): number {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`[Sixb] Storage readiness ${name} must be a positive integer.`)\n }\n return value\n}\n"
17
- ],
18
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,+BAA+B,MAAM;AAAA,EACvC,OAAO;AAClB;;;ACwBO,SAAS,aAAa,CAAC,IAAkC;AAAA,EAC9D,eAAe,IAAI,YAAY;AAAA,EAC/B,OAAO,IAAI,qBAAqB,EAAE;AAAA;AAAA;AAG7B,MAAM,qBAAwC;AAAA,EACtB;AAAA,EAA7B,WAAW,CAAkB,IAAY;AAAA,IAAZ;AAAA;AAAA,EAE7B,IAAI,GAAgC;AAAA,IAClC,OAAO,IAAI,mBAAmB,KAAK,IAAI,MAAM;AAAA;AAEjD;AAAA;AAEO,MAAM,mBAAsC;AAAA,EAE9B;AAAA,EACA;AAAA,EAFnB,WAAW,CACQ,IACA,QACjB;AAAA,IAFiB;AAAA,IACA;AAAA;AAAA,EAWnB,IAAW,CAAC,QAA6E;AAAA,IACvF,IAAI,WAAW,aAAa,OAAO,OAAO,UAAU,YAAY;AAAA,MAC9D,MAAM,IAAI,uBAAuB,uDAAuD;AAAA,IAC1F;AAAA,IAEA,OAAO,IAAI,eAAe;AAAA,MACxB,IAAI,KAAK;AAAA,MACT,QAAQ,KAAK;AAAA,MACb,MAAM;AAAA,QACJ,QAAQ;AAAA,QACR,KAAK,CAAC,OAAgB;AAAA,UACpB,OAAO,SAAS,OAAO,MAAM,KAAK,IAAI;AAAA;AAAA,MAE1C;AAAA,IACF,CAAC;AAAA;AAAA,EAGH,IAAI,GAAoC;AAAA,IACtC,OAAO,IAAI,eA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,GAAG,QAAQ;AAAA,IACnD,YAAY,CAAC,GAAI,QAAQ,cAAc,CAAC,GAAI,GAAG,UAAU;AAAA,IACzD,WAAW,CAAC,GAAI,QAAQ,aAAa,CAAC,GAAI,GAAG,SAAS;AAAA,IACtD,OAAO,CAAC,GAAI,QAAQ,SAAS,CAAC,GAAI,GAAG,KAAK;AAAA,IAC1C,WAAW,CAAC,GAAI,QAAQ,aAAa,CAAC,GAAI,GAAG,SAAS;AAAA,IACtD,aAAa,CAAC,GAAI,QAAQ,eAAe,CAAC,GAAI,GAAG,WAAW;AAAA,IAC5D,OAAO,CAAC,GAAI,QAAQ,SAAS,CAAC,GAAI,GAAG,KAAK;AAAA,IAC1C,WAAW,CAAC,GAAI,QAAQ,aAAa,CAAC,GAAI,GAAG,SAAS;AAAA,IACtD,QAAQ,CAAC,GAAI,QAAQ,UAAU,CAAC,GAAI,GAAG,MAAM;AAAA,IAC7C,OAAO,CAAC,GAAI,QAAQ,SAAS,CAAC,GAAI,GAAG,KAAK;AAAA,IAC1C,oBAAoB,CAAC,GAAI,QAAQ,sBAAsB,CAAC,GAAI,GAAG,kBAAkB;AAAA,IACjF,QAAQ,CAAC,GAAI,QAAQ,UAAU,CAAC,GAAI,GAAG,MAAM;AAAA,IAC7C,MAAM,QAAQ;AAAA,EAChB,CAAC;AAAA;",
19
- "debugId": "1140B1FB403AF17D64756E2164756E21",
20
- "names": []
21
- }
@@ -1,14 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/actions/errors.ts", "../src/actions/validation.ts", "../src/objects/action/errors.ts", "../src/actions/run-id.ts", "../src/actions/request.ts"],
4
- "sourcesContent": [
5
- "export class ActionDefinitionError extends Error {\n readonly name = \"ActionDefinitionError\"\n}\n\nexport class ActionEditCommitError extends Error {\n readonly name = \"ActionEditCommitError\"\n}\n\nexport function missingActionMutationMessage(actionId: string): string {\n return `Action \"${actionId}\" must declare .writeback(...) or .edits(...).`\n}\n\nexport function effectsWithoutEditsMessage(actionId: string): string {\n return `Action \"${actionId}\" cannot declare .effects(...) without .edits(...).`\n}\n",
6
- "import type { JsonValue } from \"../json\"\nimport { type SchemaOrRef, type ValueType, validateSchemaOrRefValue } from \"../ontology\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { Schema } from \"../ontology/types\"\nimport { coerceSchemaValueToTyped, normalizeSchemaValue } from \"../ontology/validation\"\nimport type { ActionRunParams } from \"../storage/action-runs\"\nimport { ActionDefinitionError } from \"./errors\"\nimport type {\n ActionDefinition,\n ActionParamsConfig,\n ActionSubject,\n GlobalActionDefinition,\n ObjectActionDefinition,\n} from \"./types\"\n\ninterface ActionValidationRuntime {\n readonly ontology: {\n getValueTypesById(): ReadonlyMap<string, ValueType>\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens\n }\n readonly actionRegistry: {\n getActionsForType(objectType: ObjectTypeWithPropertyTokens): readonly ObjectActionDefinition[]\n }\n}\n\nexport function assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new ActionDefinitionError(`Action ${field} must not be empty.`)\n }\n}\n\nexport function isActionDefinition(value: unknown): value is ActionDefinition {\n const binding = (value as { binding?: { kind?: unknown } } | null)?.binding\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { kind?: unknown }).kind === \"action\" &&\n (binding?.kind === \"global\" || binding?.kind === \"object\")\n )\n}\n\nexport function isGlobalActionDefinition(value: ActionDefinition): value is GlobalActionDefinition {\n return value.binding.kind === \"global\"\n}\n\nexport function isObjectActionDefinition(value: ActionDefinition): value is ObjectActionDefinition {\n return value.binding.kind === \"object\"\n}\n\nexport function normalizeActionParams(\n runtime: Pick<ActionValidationRuntime, \"ontology\">,\n paramsConfig: ActionParamsConfig,\n params: Record<string, unknown>,\n pathPrefix: string\n): ActionRunParams {\n const knownParamIds = new Set(Object.keys(paramsConfig))\n const normalized: Record<string, JsonValue> = {}\n\n for (const paramId of Object.keys(params)) {\n if (!knownParamIds.has(paramId)) {\n throw new OntologyValidationError(`Unknown param '${paramId}' for action '${pathPrefix}'`)\n }\n }\n\n for (const [paramId, paramDef] of Object.entries(paramsConfig)) {\n const value = params[paramId]\n\n if (value === undefined) {\n if (paramDef.required) {\n throw new OntologyValidationError(\n `Missing required param '${paramId}' for action '${pathPrefix}'`\n )\n }\n continue\n }\n\n if (value === null) {\n if (!paramDef.nullable) {\n throw new OntologyValidationError(\n `[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`\n )\n }\n normalized[paramId] = null\n continue\n }\n\n validateSchemaOrRefValue(\n paramDef.schema,\n value,\n `${pathPrefix}.${paramId}`,\n runtime.ontology.getValueTypesById()\n )\n\n normalized[paramId] = normalizeSchemaOrRefValue(\n paramDef.schema,\n value,\n `${pathPrefix}.${paramId}`,\n runtime.ontology.getValueTypesById()\n )\n }\n\n return normalized\n}\n\n/**\n * Re-hydrate stored action params for the handler-facing surface. Params are\n * normalized to JSON (e.g. `date`/`timestamp` -> ISO string) for storage; action\n * handler types promise `Date` for those, so this converts them back before the\n * handler runs. `objectRef` params pass through unchanged.\n */\nexport function coerceActionParamsToTyped(\n paramsConfig: ActionParamsConfig,\n params: Record<string, unknown>,\n valueTypesById: ReadonlyMap<string, ValueType>\n): Record<string, unknown> {\n const coerced: Record<string, unknown> = { ...params }\n\n for (const [paramId, paramDef] of Object.entries(paramsConfig)) {\n const value = params[paramId]\n if (value === undefined) continue\n\n const schema = paramDef.schema\n if (typeof schema === \"object\" && schema !== null && schema.type === \"objectRef\") {\n continue\n }\n\n coerced[paramId] = coerceSchemaValueToTyped(schema as Schema, value, valueTypesById)\n }\n\n return coerced\n}\n\nexport function validateActionSubject(action: ActionDefinition, subject: ActionSubject): void {\n if (isGlobalActionDefinition(action) && subject.kind !== \"none\") {\n throw new OntologyValidationError(`Action '${action.id}' does not accept an object subject.`)\n }\n}\n\nexport function resolveObjectActionSubject(params: {\n readonly runtime: ActionValidationRuntime\n readonly action: ObjectActionDefinition\n readonly subject: ActionSubject\n}): ObjectTypeWithPropertyTokens {\n const { runtime, action, subject } = params\n\n if (subject.kind !== \"object\") {\n throw new OntologyValidationError(`Action '${action.id}' requires an object subject.`)\n }\n\n const objectType = runtime.ontology.resolveObjectType(subject.objectTypeId)\n if (!actionAppliesToObjectType(runtime, action, objectType)) {\n throw new OntologyValidationError(\n `Action '${action.id}' is not valid for object type '${objectType.id}'.`\n )\n }\n\n return objectType\n}\n\nfunction actionAppliesToObjectType(\n runtime: Pick<ActionValidationRuntime, \"actionRegistry\">,\n action: ObjectActionDefinition,\n objectType: ObjectTypeWithPropertyTokens\n): boolean {\n return runtime.actionRegistry\n .getActionsForType(objectType)\n .some((candidate) => candidate.id === action.id)\n}\n\nfunction normalizeSchemaOrRefValue(\n schema: SchemaOrRef,\n value: unknown,\n path: string,\n valueTypesById: ReadonlyMap<string, ValueType>\n): JsonValue {\n if (typeof schema === \"object\" && schema !== null && schema.type === \"objectRef\") {\n const refValue = value as { objectTypeId: string; primaryId: string }\n return {\n objectTypeId: refValue.objectTypeId,\n primaryId: refValue.primaryId,\n }\n }\n\n return normalizeSchemaValue(schema as Schema, value, path, valueTypesById)\n}\n",
7
- "import type { ActionSubject } from \"../../actions\"\nimport type { ActionRunFailure } from \"../../storage\"\n\nexport class ActionValidationError extends Error {\n readonly name = \"ActionValidationError\"\n readonly actionId: string\n readonly subject: ActionSubject\n readonly primaryId?: string\n\n constructor(message: string, params: { actionId: string; subject: ActionSubject }) {\n super(message)\n this.actionId = params.actionId\n this.subject = params.subject\n this.primaryId = params.subject.kind === \"object\" ? params.subject.primaryId : undefined\n }\n}\n\nexport class ActionRunFailedError extends Error {\n readonly name = \"ActionRunFailedError\"\n readonly runId: string\n readonly actionId: string\n readonly subject: ActionSubject\n readonly objectTypeId?: string\n readonly primaryId?: string\n readonly error: ActionRunFailure\n readonly finishedAt: string\n\n constructor(payload: {\n runId: string\n actionId: string\n subject: ActionSubject\n error: ActionRunFailure\n finishedAt: string\n }) {\n super(payload.error.message)\n this.runId = payload.runId\n this.actionId = payload.actionId\n this.subject = payload.subject\n this.objectTypeId = payload.subject.kind === \"object\" ? payload.subject.objectTypeId : undefined\n this.primaryId = payload.subject.kind === \"object\" ? payload.subject.primaryId : undefined\n this.error = payload.error\n this.finishedAt = payload.finishedAt\n }\n}\n\nexport class ActionRunTimeoutError extends Error {\n readonly name = \"ActionRunTimeoutError\"\n readonly runId: string\n readonly timeoutMs: number\n\n constructor(params: { runId: string; timeoutMs: number }) {\n super(`Action run '${params.runId}' did not finish within ${params.timeoutMs}ms.`)\n this.runId = params.runId\n this.timeoutMs = params.timeoutMs\n }\n}\n",
8
- "import { randomUUID } from \"node:crypto\"\nimport { OntologyValidationError } from \"../ontology/errors\"\n\nexport function createActionRunId(runId: string | undefined): string {\n if (runId !== undefined) {\n if (!runId.trim()) {\n throw new OntologyValidationError(\"[Sixb] Action run id must not be empty\")\n }\n return runId\n }\n\n return `act_${randomUUID()}`\n}\n\nexport function createActionRunIdempotencyKey(projectId: string, runId: string): string {\n return `action:${projectId}:${runId}`\n}\n",
9
- "import { assertAuthorized } from \"../authorization\"\nimport { reportRunFailure } from \"../error-reporting/capability\"\nimport { ActionRunTimeoutError } from \"../objects/action/errors\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport {\n ActionRunError,\n type ActionRunParams,\n type ActionRunRecord,\n type ActionRunStorage,\n actionRunParamsEqual,\n actionSubjectsEqual,\n isTerminalActionRun,\n} from \"../storage\"\nimport { createActionRunId, createActionRunIdempotencyKey } from \"./run-id\"\nimport type { ActionDefinition, ActionSubject } from \"./types\"\nimport {\n isObjectActionDefinition,\n normalizeActionParams,\n resolveObjectActionSubject,\n validateActionSubject,\n} from \"./validation\"\n\nexport interface RequestActionResult {\n readonly runId: string\n readonly queuedAt: string\n readonly jobId?: string\n readonly created: boolean\n}\n\nexport interface RequestActionOptions {\n readonly runId?: string\n readonly signal?: AbortSignal\n}\n\nexport interface RequestActionAndWaitOptions extends RequestActionOptions {\n readonly timeoutMs?: number\n readonly onRequested?: (runId: string) => void | Promise<void>\n}\n\nexport interface RequestActionInput {\n readonly actionId: string\n readonly subject?: ActionSubject\n readonly params?: Record<string, unknown>\n readonly runId?: string\n readonly signal?: AbortSignal\n}\n\nexport interface RequestActionAndWaitInput extends RequestActionInput {\n readonly timeoutMs?: number\n readonly onRequested?: (runId: string) => void | Promise<void>\n}\n\nexport interface WaitForActionRunInput {\n readonly runId: string\n readonly timeoutMs?: number\n readonly signal?: AbortSignal\n}\n\nconst DEFAULT_ACTION_WAIT_TIMEOUT_MS = 60_000\nconst DEFAULT_ACTION_WAIT_POLL_MS = 1_000\n\nfunction clearTimer(timer: ReturnType<typeof setTimeout> | undefined): void {\n if (timer) {\n clearTimeout(timer)\n }\n}\n\nfunction getActionDefinition(runtime: SixbRuntimeContext, actionId: string): ActionDefinition {\n const action = runtime.actionRegistry.getById(actionId)\n if (!action) {\n throw new OntologyValidationError(`Unknown action '${actionId}'`)\n }\n return action\n}\n\nexport async function requestAction(\n runtime: SixbRuntimeContext,\n input: RequestActionInput\n): Promise<RequestActionResult> {\n const actionRuns = requireActionRunStorage(runtime)\n const action = getActionDefinition(runtime, input.actionId)\n const actionId = action.id\n const rawParams: Record<string, unknown> = input.params ?? {}\n const subject: ActionSubject = input.subject ?? { kind: \"none\" }\n\n assertAuthorized(runtime, { kind: \"action.apply\", actionId })\n if (action.binding.kind === \"object\") {\n // Object actions also require visibility of the subject's object type.\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId: action.binding.objectType.id })\n }\n\n validateActionSubject(action, subject)\n\n let pathPrefix = action.id\n let objectType: ObjectTypeWithPropertyTokens | null = null\n\n if (isObjectActionDefinition(action)) {\n objectType = resolveObjectActionSubject({ runtime, action, subject })\n pathPrefix = `${objectType.id}.${action.id}`\n }\n\n const actionParams = normalizeActionParams(runtime, action.params, rawParams, pathPrefix)\n\n const runId = createActionRunId(input.runId)\n const existing = await actionRuns.getById({ projectId: runtime.projectId, id: runId })\n if (existing) {\n assertExistingRunMatchesRequest(existing, {\n actionId,\n subject,\n params: actionParams,\n })\n if (isRetryableEnqueueFailure(existing)) {\n const queuedAt = new Date()\n await actionRuns.queue({\n projectId: runtime.projectId,\n id: runId,\n actionId,\n subject,\n params: actionParams,\n idempotencyKey: existing.idempotencyKey,\n queuedAt,\n })\n return enqueueActionRunJob(runtime, {\n actionRuns,\n actionId,\n subject,\n params: actionParams,\n runId,\n queuedAt,\n created: false,\n })\n }\n return {\n runId,\n queuedAt: existing.queuedAt.toISOString(),\n created: false,\n }\n }\n\n const queuedAt = new Date()\n const idempotencyKey = createActionRunIdempotencyKey(runtime.projectId, runId)\n\n await actionRuns.queue({\n projectId: runtime.projectId,\n id: runId,\n actionId,\n subject,\n params: actionParams,\n idempotencyKey,\n queuedAt,\n })\n\n return enqueueActionRunJob(runtime, {\n actionRuns,\n actionId,\n subject,\n params: actionParams,\n runId,\n queuedAt,\n created: true,\n })\n}\n\nasync function enqueueActionRunJob(\n runtime: SixbRuntimeContext,\n params: {\n readonly actionRuns: ActionRunStorage\n readonly actionId: string\n readonly subject: ActionSubject\n readonly params: ActionRunParams\n readonly runId: string\n readonly queuedAt: Date\n readonly created: boolean\n }\n): Promise<RequestActionResult> {\n let jobId: string | undefined\n try {\n const [job] = await runtime.queues.actions.enqueue({\n projectId: runtime.projectId,\n jobs: [\n {\n type: \"action.run.requested\",\n payload: {\n actionId: params.actionId,\n runId: params.runId,\n },\n },\n ],\n })\n jobId = job?.id\n } catch (error) {\n const failed = await params.actionRuns.finish({\n projectId: runtime.projectId,\n id: params.runId,\n status: \"failed\",\n phase: \"enqueue\",\n error: toActionRunFailure(error, \"enqueue\"),\n })\n reportRunFailure(runtime, error, {\n projectId: runtime.projectId,\n occurredAt: failed.finishedAt,\n run: {\n kind: \"action\",\n runId: params.runId,\n actionId: params.actionId,\n },\n })\n throw error\n }\n\n // The run is persisted and the job is queued, so the request has succeeded and the caller must not\n // be told otherwise. `emit` keeps that promise and still escalates the lost trigger edge.\n await runtime.events.emit(\n {\n events: [\n {\n type: \"action.requested\",\n payload: {\n actionId: params.actionId,\n subject: params.subject,\n params: params.params,\n runId: params.runId,\n },\n },\n ],\n },\n { source: \"Sixb\" }\n )\n\n return {\n runId: params.runId,\n queuedAt: params.queuedAt.toISOString(),\n ...(jobId ? { jobId } : {}),\n created: params.created,\n }\n}\n\nexport async function requestActionAndWait(\n runtime: SixbRuntimeContext,\n input: RequestActionAndWaitInput\n): Promise<ActionRunRecord> {\n const runId = createActionRunId(input.runId)\n\n await requestAction(runtime, {\n ...input,\n runId,\n })\n await input.onRequested?.(runId)\n\n return waitForActionRun(runtime, {\n runId,\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n })\n}\n\nexport async function waitForActionRun(\n runtime: SixbRuntimeContext,\n input: WaitForActionRunInput\n): Promise<ActionRunRecord> {\n const actionRuns = requireActionRunStorage(runtime)\n const timeoutMs = input.timeoutMs ?? DEFAULT_ACTION_WAIT_TIMEOUT_MS\n const signal = input.signal\n const startedAt = Date.now()\n\n if (signal?.aborted) {\n throw signal.reason ?? new Error(\"aborted\")\n }\n\n return new Promise<ActionRunRecord>((resolve, reject) => {\n let timer: ReturnType<typeof setTimeout> | undefined\n let pollTimer: ReturnType<typeof setTimeout> | undefined\n let unsubscribe: (() => void) | undefined\n let settled = false\n let checking = false\n\n const cleanup = () => {\n if (settled) return\n settled = true\n clearTimer(timer)\n clearTimer(pollTimer)\n unsubscribe?.()\n signal?.removeEventListener(\"abort\", onAbort)\n }\n\n const rejectWith = (error: unknown) => {\n cleanup()\n reject(error)\n }\n\n const schedulePoll = () => {\n if (!settled && !pollTimer) {\n pollTimer = setTimeout(() => {\n pollTimer = undefined\n void check()\n }, DEFAULT_ACTION_WAIT_POLL_MS)\n }\n }\n\n const check = async () => {\n if (settled || checking) {\n return\n }\n checking = true\n try {\n const record = await actionRuns.getById({\n projectId: runtime.projectId,\n id: input.runId,\n })\n if (record && isTerminalActionRun(record)) {\n cleanup()\n resolve(record)\n return\n }\n schedulePoll()\n } catch (error) {\n rejectWith(error)\n } finally {\n checking = false\n }\n }\n\n const onAbort = () => {\n rejectWith(signal?.reason ?? new Error(\"aborted\"))\n }\n\n timer = setTimeout(\n () => {\n rejectWith(new ActionRunTimeoutError({ runId: input.runId, timeoutMs }))\n },\n Math.max(0, timeoutMs - (Date.now() - startedAt))\n )\n\n if (signal) {\n signal.addEventListener(\"abort\", onAbort, { once: true })\n }\n\n runtime.events\n .subscribe({ types: [\"action.completed\", \"action.failed\"] }, (events) => {\n if (\n events.some(\n (event) =>\n (event.type === \"action.completed\" || event.type === \"action.failed\") &&\n event.payload.runId === input.runId\n )\n ) {\n void check()\n }\n })\n .then((unsubscribeEvents) => {\n unsubscribe = unsubscribeEvents\n void check()\n })\n .catch(rejectWith)\n })\n}\n\nfunction requireActionRunStorage(runtime: SixbRuntimeContext): ActionRunStorage {\n const actionRuns = runtime.storage.actionRuns\n if (!actionRuns) {\n throw new ActionRunError(\"[Sixb] Action run storage is not configured.\")\n }\n return actionRuns\n}\n\nfunction assertExistingRunMatchesRequest(\n existing: ActionRunRecord,\n request: {\n readonly actionId: string\n readonly subject: ActionSubject\n readonly params: ActionRunParams\n }\n): void {\n const matches =\n existing.actionId === request.actionId &&\n actionSubjectsEqual(existing.subject, request.subject) &&\n actionRunParamsEqual(existing.params, request.params)\n\n if (!matches) {\n throw new ActionRunError(\n `[Sixb] Action run '${existing.id}' already exists with a different request payload.`\n )\n }\n}\n\nfunction isRetryableEnqueueFailure(record: ActionRunRecord): boolean {\n return record.status === \"failed\" && record.phase === \"enqueue\"\n}\n\nfunction toActionRunFailure(\n error: unknown,\n phase: \"enqueue\"\n): { name?: string; message: string; phase: \"enqueue\" } {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n phase,\n }\n }\n return {\n message: String(error),\n phase,\n }\n}\n"
10
- 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ERSION = 1;
4
- var DEFAULT_AGENT_RUN_STREAM_RETENTION = {
5
- maxAgeMs: 2 * 60 * 60 * 1000,
6
- maxRecords: 5000
7
- };
8
- function agentRunStreamId(runId) {
9
- return `agents.runs.${runId}`;
10
- }
11
- function agentRunStreamDefinition(runId) {
12
- return {
13
- id: agentRunStreamId(runId),
14
- retention: DEFAULT_AGENT_RUN_STREAM_RETENTION
15
- };
16
- }
17
- function agentRunControlStreamId(runId) {
18
- return `agents.runs.${runId}.control`;
19
- }
20
- var AGENT_RUN_CANCEL_RECORD = "agent.run.cancel";
21
- var AGENT_RUN_CONTROL_RETENTION = { maxAgeMs: 30 * 60 * 1000, maxRecords: 16 };
22
- function agentRunControlStreamDefinition(runId) {
23
- return { id: agentRunControlStreamId(runId), retention: AGENT_RUN_CONTROL_RETENTION };
24
- }
25
- async function publishAgentRunCancel(broker, params) {
26
- await broker.ensureStream({
27
- projectId: params.projectId,
28
- stream: agentRunControlStreamDefinition(params.runId)
29
- });
30
- await broker.append({
31
- projectId: params.projectId,
32
- streamId: agentRunControlStreamId(params.runId),
33
- records: [
34
- { name: AGENT_RUN_CANCEL_RECORD, key: params.runId, payload: { runId: params.runId } }
35
- ]
36
- });
37
- }
38
- async function subscribeAgentRunCancel(broker, params, onCancel) {
39
- await broker.ensureStream({
40
- projectId: params.projectId,
41
- stream: agentRunControlStreamDefinition(params.runId)
42
- });
43
- return broker.subscribe({
44
- projectId: params.projectId,
45
- streamId: agentRunControlStreamId(params.runId),
46
- from: "earliest",
47
- names: [AGENT_RUN_CANCEL_RECORD]
48
- }, () => onCancel());
49
- }
50
- function agentRunFinishedEvent(run, occurredAt = new Date) {
51
- if (run.status === "queued" || run.status === "running") {
52
- throw new Error(`[Sixb] Agent run '${run.id}' is not terminal (status '${run.status}'), so it has no finished event.`);
53
- }
54
- return {
55
- schemaVersion: AGENT_RUN_STREAM_SCHEMA_VERSION,
56
- type: "agent.run.finished",
57
- projectId: run.projectId,
58
- runId: run.id,
59
- threadId: run.threadId,
60
- agentId: run.agentId,
61
- attempt: run.attempt,
62
- status: run.status,
63
- ...run.finishReason === undefined ? {} : { finishReason: run.finishReason },
64
- ...run.error === undefined ? {} : { error: run.error },
65
- occurredAt: occurredAt.toISOString()
66
- };
67
- }
68
- function agentRunStreamIdempotencyKey(event) {
69
- switch (event.type) {
70
- case "agent.run.started":
71
- return `${event.runId}:${event.attempt}:started`;
72
- case "agent.ui.chunk":
73
- return `${event.runId}:${event.attempt}:chunk:${event.chunkIndex}`;
74
- case "agent.message.finalized":
75
- return `${event.runId}:${event.attempt}:message:${event.messageId}:finalized`;
76
- case "agent.run.finished":
77
- return `${event.runId}:${event.attempt}:finished:${event.status}`;
78
- }
79
- }
80
- async function publishAgentRunFinished(broker, run) {
81
- const event = agentRunFinishedEvent(run);
82
- await broker.ensureStream({
83
- projectId: run.projectId,
84
- stream: agentRunStreamDefinition(run.id)
85
- });
86
- await broker.append({
87
- projectId: run.projectId,
88
- streamId: agentRunStreamId(run.id),
89
- records: [
90
- {
91
- name: event.type,
92
- key: event.runId,
93
- payload: JSON.parse(JSON.stringify(event)),
94
- idempotencyKey: agentRunStreamIdempotencyKey(event)
95
- }
96
- ]
97
- });
98
- }
99
-
100
- export { AGENT_RUN_STREAM_SCHEMA_VERSION, DEFAULT_AGENT_RUN_STREAM_RETENTION, agentRunStreamId, agentRunStreamDefinition, agentRunControlStreamId, AGENT_RUN_CANCEL_RECORD, agentRunControlStreamDefinition, publishAgentRunCancel, subscribeAgentRunCancel, agentRunFinishedEvent, agentRunStreamIdempotencyKey, publishAgentRunFinished };
101
-
102
- //# debugId=4CDD69998B98C82964756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/agents/streams.ts"],
4
- "sourcesContent": [
5
- "import type { Broker, BrokerStreamDefinition } from \"../broker\"\nimport type { JsonValue } from \"../json\"\nimport type { AgentRunRecord } from \"../storage/agents/types\"\n\nexport const AGENT_RUN_STREAM_SCHEMA_VERSION = 1 as const\nexport const DEFAULT_AGENT_RUN_STREAM_RETENTION = {\n maxAgeMs: 2 * 60 * 60 * 1000, // 2 hours\n maxRecords: 5_000,\n} as const\n\nexport type AgentRunStreamId = `agents.runs.${string}`\n\nexport function agentRunStreamId(runId: string): AgentRunStreamId {\n return `agents.runs.${runId}`\n}\n\nexport function agentRunStreamDefinition(runId: string): BrokerStreamDefinition {\n return {\n id: agentRunStreamId(runId),\n retention: DEFAULT_AGENT_RUN_STREAM_RETENTION,\n }\n}\n\ninterface AgentRunStreamEventBase {\n readonly schemaVersion: typeof AGENT_RUN_STREAM_SCHEMA_VERSION\n readonly projectId: string\n readonly runId: string\n readonly threadId: string\n readonly agentId: string\n readonly attempt: number\n readonly occurredAt: string\n}\n\n// ── Control stream (worker-inbound) ─────────────────────────────────────────────────────────────\n//\n// A per-run channel the API layer publishes to and the worker subscribes to — the reverse direction\n// of the event stream above. It carries only a cancel signal, and is addressed by `runId` (not a run\n// record), so a cancel works even before the worker has reserved the run. Kept separate from the\n// event stream so control records never reach the browser client.\n\nexport type AgentRunControlStreamId = `agents.runs.${string}.control`\n\nexport function agentRunControlStreamId(runId: string): AgentRunControlStreamId {\n return `agents.runs.${runId}.control`\n}\n\n/** The only control record: a request to stop the run. */\nexport const AGENT_RUN_CANCEL_RECORD = \"agent.run.cancel\"\n\n// A cancel only needs to outlive the queue wait plus one turn, so retention is short and tiny.\nconst AGENT_RUN_CONTROL_RETENTION = { maxAgeMs: 30 * 60 * 1000, maxRecords: 16 } as const\n\nexport function agentRunControlStreamDefinition(runId: string): BrokerStreamDefinition {\n return { id: agentRunControlStreamId(runId), retention: AGENT_RUN_CONTROL_RETENTION }\n}\n\n/**\n * Signal a run to stop. Publishing is addressed by `runId`, so it works whether the run is queued,\n * reserved, or being drained — the worker picks the record up when it subscribes.\n */\nexport async function publishAgentRunCancel(\n broker: Broker,\n params: { readonly projectId: string; readonly runId: string }\n): Promise<void> {\n await broker.ensureStream({\n projectId: params.projectId,\n stream: agentRunControlStreamDefinition(params.runId),\n })\n await broker.append({\n projectId: params.projectId,\n streamId: agentRunControlStreamId(params.runId),\n records: [\n { name: AGENT_RUN_CANCEL_RECORD, key: params.runId, payload: { runId: params.runId } },\n ],\n })\n}\n\n/**\n * Watch a run's control stream and invoke `onCancel` when a cancel arrives. Reads from `earliest` so\n * a cancel published before the worker subscribed (a run stopped while still queued) is still seen.\n * Returns the unsubscribe handle.\n */\nexport async function subscribeAgentRunCancel(\n broker: Broker,\n params: { readonly projectId: string; readonly runId: string },\n onCancel: () => void\n): Promise<() => void> {\n await broker.ensureStream({\n projectId: params.projectId,\n stream: agentRunControlStreamDefinition(params.runId),\n })\n return broker.subscribe(\n {\n projectId: params.projectId,\n streamId: agentRunControlStreamId(params.runId),\n from: \"earliest\",\n names: [AGENT_RUN_CANCEL_RECORD],\n },\n () => onCancel()\n )\n}\n\nexport type AgentRunStreamEvent =\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.run.started\"\n readonly modelId?: string\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.ui.chunk\"\n readonly chunkIndex: number\n readonly chunk: JsonValue\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.message.finalized\"\n readonly messageId: string\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.run.finished\"\n readonly status: \"succeeded\" | \"failed\" | \"cancelled\"\n readonly finishReason?: string\n readonly error?: string\n })\n\nexport type AgentRunFinishedEvent = Extract<AgentRunStreamEvent, { type: \"agent.run.finished\" }>\n\n// ── Record construction ──────────────────────────────────────────────────────────────────────────\n//\n// The wire format of run stream records — event shape, record name/key, and the idempotency-key\n// vocabulary — is owned here so every producer (the worker's stream sink, the server's queued\n// cancellation) shares one definition and cannot drift.\n\n/** Build the terminal stream event for a finished run. Throws if the run is not terminal. */\nexport function agentRunFinishedEvent(\n run: AgentRunRecord,\n occurredAt: Date = new Date()\n): AgentRunFinishedEvent {\n if (run.status === \"queued\" || run.status === \"running\") {\n throw new Error(\n `[Sixb] Agent run '${run.id}' is not terminal (status '${run.status}'), so it has no finished event.`\n )\n }\n return {\n schemaVersion: AGENT_RUN_STREAM_SCHEMA_VERSION,\n type: \"agent.run.finished\",\n projectId: run.projectId,\n runId: run.id,\n threadId: run.threadId,\n agentId: run.agentId,\n attempt: run.attempt,\n status: run.status,\n ...(run.finishReason === undefined ? {} : { finishReason: run.finishReason }),\n ...(run.error === undefined ? {} : { error: run.error }),\n occurredAt: occurredAt.toISOString(),\n }\n}\n\n/** Single owner of the idempotency-key vocabulary for agent run stream records. */\nexport function agentRunStreamIdempotencyKey(event: AgentRunStreamEvent): string {\n switch (event.type) {\n case \"agent.run.started\":\n return `${event.runId}:${event.attempt}:started`\n case \"agent.ui.chunk\":\n return `${event.runId}:${event.attempt}:chunk:${event.chunkIndex}`\n case \"agent.message.finalized\":\n return `${event.runId}:${event.attempt}:message:${event.messageId}:finalized`\n case \"agent.run.finished\":\n return `${event.runId}:${event.attempt}:finished:${event.status}`\n }\n}\n\n/**\n * Ensure the run's stream and append its terminal record — mirrors {@link publishAgentRunCancel}.\n * Used where a terminal transition happens outside the worker (e.g. cancelling a queued run).\n */\nexport async function publishAgentRunFinished(broker: Broker, run: AgentRunRecord): Promise<void> {\n const event = agentRunFinishedEvent(run)\n await broker.ensureStream({\n projectId: run.projectId,\n stream: agentRunStreamDefinition(run.id),\n })\n await broker.append({\n projectId: run.projectId,\n streamId: agentRunStreamId(run.id),\n records: [\n {\n name: event.type,\n key: event.runId,\n // The event is built from JSON primitives only, so the round-trip is a safe narrowing.\n payload: JSON.parse(JSON.stringify(event)) as JsonValue,\n idempotencyKey: agentRunStreamIdempotencyKey(event),\n },\n ],\n })\n}\n"
6
- ],
7
- "mappings": ";;AAIO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAAA,EAChD,UAAU,IAAI,KAAK,KAAK;AAAA,EACxB,YAAY;AACd;AAIO,SAAS,gBAAgB,CAAC,OAAiC;AAAA,EAChE,OAAO,eAAe;AAAA;AAGjB,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