@sixb/core 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/dist/actions/index.js +35 -35
  2. package/dist/agents/attachment-keys.d.ts +25 -0
  3. package/dist/agents/attachment-keys.d.ts.map +1 -0
  4. package/dist/agents/cancel.d.ts +12 -0
  5. package/dist/agents/cancel.d.ts.map +1 -1
  6. package/dist/agents/children.d.ts.map +1 -1
  7. package/dist/agents/dispatch.d.ts +1 -9
  8. package/dist/agents/dispatch.d.ts.map +1 -1
  9. package/dist/agents/execution.d.ts +5 -0
  10. package/dist/agents/execution.d.ts.map +1 -1
  11. package/dist/agents/index.d.ts +31 -6
  12. package/dist/agents/index.d.ts.map +1 -1
  13. package/dist/agents/index.js +154 -66
  14. package/dist/agents/index.js.map +1 -1
  15. package/dist/agents/model-loop.d.ts +3 -5
  16. package/dist/agents/model-loop.d.ts.map +1 -1
  17. package/dist/agents/model-routing.d.ts +4 -1
  18. package/dist/agents/model-routing.d.ts.map +1 -1
  19. package/dist/agents/request.d.ts +9 -1
  20. package/dist/agents/request.d.ts.map +1 -1
  21. package/dist/agents/run-after-finish.d.ts +11 -0
  22. package/dist/agents/run-after-finish.d.ts.map +1 -0
  23. package/dist/agents/run-artifacts.d.ts +56 -0
  24. package/dist/agents/run-artifacts.d.ts.map +1 -0
  25. package/dist/agents/run-events.d.ts +49 -0
  26. package/dist/agents/run-events.d.ts.map +1 -0
  27. package/dist/agents/run-fence.d.ts +38 -0
  28. package/dist/agents/run-fence.d.ts.map +1 -0
  29. package/dist/agents/run-liveness.d.ts +36 -0
  30. package/dist/agents/run-liveness.d.ts.map +1 -0
  31. package/dist/agents/run-plan.d.ts +110 -0
  32. package/dist/agents/run-plan.d.ts.map +1 -0
  33. package/dist/agents/run-session-children.d.ts +89 -0
  34. package/dist/agents/run-session-children.d.ts.map +1 -0
  35. package/dist/agents/run-session-http.d.ts +37 -0
  36. package/dist/agents/run-session-http.d.ts.map +1 -0
  37. package/dist/agents/run-session-serve.d.ts +24 -0
  38. package/dist/agents/run-session-serve.d.ts.map +1 -0
  39. package/dist/agents/run-session-wire.d.ts +31 -0
  40. package/dist/agents/run-session-wire.d.ts.map +1 -0
  41. package/dist/agents/run-session.d.ts +239 -0
  42. package/dist/agents/run-session.d.ts.map +1 -0
  43. package/dist/agents/run-token.d.ts +40 -0
  44. package/dist/agents/run-token.d.ts.map +1 -0
  45. package/dist/agents/run-tools.d.ts +68 -0
  46. package/dist/agents/run-tools.d.ts.map +1 -0
  47. package/dist/agents/run-turn.d.ts +59 -0
  48. package/dist/agents/run-turn.d.ts.map +1 -0
  49. package/dist/agents/streams/index.js +1 -1
  50. package/dist/agents/streams/internal.d.ts +1 -1
  51. package/dist/agents/streams/internal.d.ts.map +1 -1
  52. package/dist/agents/streams/internal.js +2 -4
  53. package/dist/agents/streams/internal.js.map +1 -1
  54. package/dist/agents/streams/protocol.d.ts +1 -96
  55. package/dist/agents/streams/protocol.d.ts.map +1 -1
  56. package/dist/agents/subagent-runs.d.ts +7 -1
  57. package/dist/agents/subagent-runs.d.ts.map +1 -1
  58. package/dist/agents/tool-files.d.ts +34 -0
  59. package/dist/agents/tool-files.d.ts.map +1 -0
  60. package/dist/agents/workflow-node-session.d.ts +99 -0
  61. package/dist/agents/workflow-node-session.d.ts.map +1 -0
  62. package/dist/artifacts/frames/index.js +1 -1
  63. package/dist/artifacts/frames/index.js.map +1 -1
  64. package/dist/artifacts/index.js.map +1 -1
  65. package/dist/artifacts/publish/index.d.ts +1 -1
  66. package/dist/artifacts/publish/index.d.ts.map +1 -1
  67. package/dist/artifacts/publish/index.js +19 -19
  68. package/dist/auth/index.js +8 -8
  69. package/dist/authorization/index.js +4 -4
  70. package/dist/bootstrap/index.js +45 -43
  71. package/dist/bootstrap/index.js.map +2 -2
  72. package/dist/{chunk-2fn60nvs.js → chunk-06sg8s4z.js} +2 -2
  73. package/dist/{chunk-2fn60nvs.js.map → chunk-06sg8s4z.js.map} +1 -1
  74. package/dist/chunk-07kkp2e1.js.map +1 -1
  75. package/dist/{chunk-9ntbsnke.js → chunk-0bc3w0zq.js} +7 -7
  76. package/dist/{chunk-9ntbsnke.js.map → chunk-0bc3w0zq.js.map} +2 -2
  77. package/dist/{chunk-d2m879s4.js → chunk-0kk2wt0h.js} +27 -27
  78. package/dist/chunk-0kk2wt0h.js.map +12 -0
  79. package/dist/chunk-16a9dmfy.js.map +1 -1
  80. package/dist/chunk-18sk89cg.js.map +2 -2
  81. package/dist/{chunk-3qms4nax.js → chunk-1vg43g9q.js} +20 -20
  82. package/dist/{chunk-3qms4nax.js.map → chunk-1vg43g9q.js.map} +4 -4
  83. package/dist/{chunk-hqsp2sx4.js → chunk-1xvqgg88.js} +31 -33
  84. package/dist/{chunk-hqsp2sx4.js.map → chunk-1xvqgg88.js.map} +6 -6
  85. package/dist/chunk-2adz0h75.js.map +1 -1
  86. package/dist/{chunk-fm62y49k.js → chunk-2pk5hjj9.js} +5 -3
  87. package/dist/{chunk-fm62y49k.js.map → chunk-2pk5hjj9.js.map} +5 -5
  88. package/dist/{chunk-vrf90dkv.js → chunk-2vjnyz1s.js} +1 -1
  89. package/dist/{chunk-vrf90dkv.js.map → chunk-2vjnyz1s.js.map} +1 -1
  90. package/dist/{chunk-4f3ydv7t.js → chunk-315qye3g.js} +1 -1
  91. package/dist/{chunk-4f3ydv7t.js.map → chunk-315qye3g.js.map} +1 -1
  92. package/dist/{chunk-rap5w0x0.js → chunk-31khg3g0.js} +1 -1
  93. package/dist/{chunk-rap5w0x0.js.map → chunk-31khg3g0.js.map} +1 -1
  94. package/dist/chunk-45ngkxkp.js.map +1 -1
  95. package/dist/chunk-48jezz3j.js.map +1 -1
  96. package/dist/{chunk-vr3j63jq.js → chunk-4jq2bg8t.js} +78 -78
  97. package/dist/{chunk-vr3j63jq.js.map → chunk-4jq2bg8t.js.map} +4 -4
  98. package/dist/chunk-4ymrcdbm.js.map +1 -1
  99. package/dist/chunk-58geavnf.js.map +1 -1
  100. package/dist/{chunk-6y0mkhex.js → chunk-59kf345w.js} +2 -2
  101. package/dist/{chunk-6y0mkhex.js.map → chunk-59kf345w.js.map} +1 -1
  102. package/dist/{chunk-3p93tb91.js → chunk-6qn7nmd3.js} +102 -102
  103. package/dist/{chunk-3p93tb91.js.map → chunk-6qn7nmd3.js.map} +4 -4
  104. package/dist/chunk-73j0v4qv.js +355 -0
  105. package/dist/chunk-73j0v4qv.js.map +13 -0
  106. package/dist/{chunk-2gjj5dx3.js → chunk-78ymxrn0.js} +1 -1
  107. package/dist/{chunk-6bkbyer5.js → chunk-7ex2p3zp.js} +3 -3
  108. package/dist/{chunk-6bkbyer5.js.map → chunk-7ex2p3zp.js.map} +1 -1
  109. package/dist/{chunk-5tfev0fv.js → chunk-7hf6tkgs.js} +167 -167
  110. package/dist/{chunk-5tfev0fv.js.map → chunk-7hf6tkgs.js.map} +4 -4
  111. package/dist/{chunk-8z4726jz.js → chunk-7wn5z7mq.js} +10 -10
  112. package/dist/{chunk-8z4726jz.js.map → chunk-7wn5z7mq.js.map} +2 -2
  113. package/dist/{chunk-6n69k945.js → chunk-8mb7mt8n.js} +2 -2
  114. package/dist/chunk-8ncg20rd.js.map +1 -1
  115. package/dist/{chunk-68wghpdf.js → chunk-8v5a54qz.js} +50 -11
  116. package/dist/{chunk-68wghpdf.js.map → chunk-8v5a54qz.js.map} +3 -3
  117. package/dist/{chunk-gqm0b7vd.js → chunk-8v6xzwgr.js} +92 -76
  118. package/dist/{chunk-gqm0b7vd.js.map → chunk-8v6xzwgr.js.map} +6 -6
  119. package/dist/{chunk-m36fw8ft.js → chunk-8wsjr52f.js} +1 -1
  120. package/dist/{chunk-vd1rk42q.js → chunk-8xnz9vvp.js} +4 -4
  121. package/dist/{chunk-vd1rk42q.js.map → chunk-8xnz9vvp.js.map} +1 -1
  122. package/dist/chunk-9mab3dvg.js.map +1 -1
  123. package/dist/chunk-9tc8dxmn.js.map +1 -1
  124. package/dist/chunk-9x8dybsb.js.map +2 -2
  125. package/dist/chunk-a3faa34j.js.map +1 -1
  126. package/dist/{chunk-62a63pr6.js → chunk-axb4ss9a.js} +7 -7
  127. package/dist/{chunk-62a63pr6.js.map → chunk-axb4ss9a.js.map} +2 -2
  128. package/dist/{chunk-z3ryd53f.js → chunk-b6ghvap7.js} +35 -11
  129. package/dist/{chunk-z3ryd53f.js.map → chunk-b6ghvap7.js.map} +3 -3
  130. package/dist/{chunk-sqfvnvqj.js → chunk-c14ap3s9.js} +2 -2
  131. package/dist/{chunk-sqfvnvqj.js.map → chunk-c14ap3s9.js.map} +1 -1
  132. package/dist/{chunk-661ezhks.js → chunk-cbcgs9f7.js} +87 -8
  133. package/dist/chunk-cbcgs9f7.js.map +11 -0
  134. package/dist/chunk-cwdzcv37.js.map +1 -1
  135. package/dist/{chunk-bab05bhg.js → chunk-dgtd0836.js} +1 -1
  136. package/dist/{chunk-1j6j0rht.js → chunk-e24fvw8g.js} +1 -1
  137. package/dist/{chunk-1j6j0rht.js.map → chunk-e24fvw8g.js.map} +1 -1
  138. package/dist/chunk-e5wf5vz0.js.map +1 -1
  139. package/dist/chunk-eptrvnby.js.map +1 -1
  140. package/dist/chunk-ey1nk510.js.map +1 -1
  141. package/dist/{chunk-j936th07.js → chunk-fakrpfy3.js} +58 -58
  142. package/dist/{chunk-j936th07.js.map → chunk-fakrpfy3.js.map} +5 -5
  143. package/dist/chunk-fb3feg1e.js.map +1 -1
  144. package/dist/chunk-ff5xkv0p.js.map +1 -1
  145. package/dist/chunk-fntqb7qy.js.map +1 -1
  146. package/dist/{chunk-7ny9mjgm.js → chunk-ft3w5ahs.js} +1 -1
  147. package/dist/chunk-g663fahq.js.map +1 -1
  148. package/dist/{chunk-cdk3egjj.js → chunk-h1na2cxc.js} +1 -1
  149. package/dist/{chunk-cdk3egjj.js.map → chunk-h1na2cxc.js.map} +1 -1
  150. package/dist/chunk-hn2r7z41.js.map +1 -1
  151. package/dist/{chunk-24bqx0dx.js → chunk-hn76sanm.js} +1 -1
  152. package/dist/{chunk-24bqx0dx.js.map → chunk-hn76sanm.js.map} +1 -1
  153. package/dist/chunk-jmfet9r4.js.map +1 -1
  154. package/dist/{chunk-bnr4a734.js → chunk-jn3ysaf2.js} +24 -22
  155. package/dist/{chunk-bnr4a734.js.map → chunk-jn3ysaf2.js.map} +5 -5
  156. package/dist/{chunk-4y26vs3v.js → chunk-jspskey0.js} +16 -3
  157. package/dist/chunk-jspskey0.js.map +10 -0
  158. package/dist/{chunk-r6szek0x.js → chunk-jt3r6thp.js} +2 -135
  159. package/dist/chunk-jt3r6thp.js.map +10 -0
  160. package/dist/chunk-kfee1h52.js.map +1 -1
  161. package/dist/{chunk-qx00vjrj.js → chunk-kwfhd1g0.js} +23 -23
  162. package/dist/{chunk-qx00vjrj.js.map → chunk-kwfhd1g0.js.map} +4 -4
  163. package/dist/chunk-m427qgq0.js.map +1 -1
  164. package/dist/chunk-mbsbxarb.js.map +1 -1
  165. package/dist/{chunk-et017krg.js → chunk-mdxmt0n3.js} +8657 -8704
  166. package/dist/{chunk-et017krg.js.map → chunk-mdxmt0n3.js.map} +37 -37
  167. package/dist/chunk-mmagke4x.js.map +1 -1
  168. package/dist/{chunk-2x19q6k6.js → chunk-mqx25wwh.js} +319 -154
  169. package/dist/chunk-mqx25wwh.js.map +18 -0
  170. package/dist/chunk-mzx71snp.js.map +1 -1
  171. package/dist/chunk-n8q5j6y5.js.map +1 -1
  172. package/dist/chunk-npcr0228.js.map +1 -1
  173. package/dist/{chunk-m2nevja0.js → chunk-phm3c7b9.js} +1 -1
  174. package/dist/{chunk-m2nevja0.js.map → chunk-phm3c7b9.js.map} +1 -1
  175. package/dist/chunk-qf954wje.js.map +1 -1
  176. package/dist/{chunk-65pyhyas.js → chunk-qgvbxfqv.js} +6 -8
  177. package/dist/{chunk-65pyhyas.js.map → chunk-qgvbxfqv.js.map} +2 -2
  178. package/dist/{chunk-hk38wahh.js → chunk-qst145py.js} +4 -4
  179. package/dist/{chunk-hk38wahh.js.map → chunk-qst145py.js.map} +1 -1
  180. package/dist/{chunk-c844dkwd.js → chunk-qtzftvxa.js} +4 -5
  181. package/dist/{chunk-c844dkwd.js.map → chunk-qtzftvxa.js.map} +2 -2
  182. package/dist/chunk-ratkv4zc.js +3 -0
  183. package/dist/chunk-ratkv4zc.js.map +9 -0
  184. package/dist/{chunk-nzapm6p0.js → chunk-s3we74h8.js} +1 -2
  185. package/dist/chunk-s3we74h8.js.map +12 -0
  186. package/dist/{chunk-0xmt5p5y.js → chunk-t3brw0wd.js} +1 -2
  187. package/dist/{chunk-0xmt5p5y.js.map → chunk-t3brw0wd.js.map} +2 -2
  188. package/dist/chunk-t5608tkq.js.map +1 -1
  189. package/dist/chunk-tdxfsg1c.js.map +1 -1
  190. package/dist/{chunk-1t6k1avb.js → chunk-tnhqtfea.js} +1 -1
  191. package/dist/chunk-vhbw5sqm.js.map +1 -1
  192. package/dist/{chunk-rp9wwk7b.js → chunk-vx4e4zv4.js} +30 -30
  193. package/dist/{chunk-rp9wwk7b.js.map → chunk-vx4e4zv4.js.map} +4 -4
  194. package/dist/chunk-waqk73p1.js.map +1 -1
  195. package/dist/chunk-x0v3jd47.js.map +1 -1
  196. package/dist/{chunk-yecwnwpq.js → chunk-xm8qgbqm.js} +58 -29
  197. package/dist/{chunk-yecwnwpq.js.map → chunk-xm8qgbqm.js.map} +7 -7
  198. package/dist/{chunk-97wr6p2g.js → chunk-y7j6x4h0.js} +8 -8
  199. package/dist/{chunk-97wr6p2g.js.map → chunk-y7j6x4h0.js.map} +4 -4
  200. package/dist/{chunk-xe0732g0.js → chunk-yavhtnac.js} +12 -8
  201. package/dist/{chunk-xe0732g0.js.map → chunk-yavhtnac.js.map} +4 -4
  202. package/dist/chunk-yd00vzqr.js +3394 -0
  203. package/dist/chunk-yd00vzqr.js.map +37 -0
  204. package/dist/{chunk-n9w3n38q.js → chunk-ye5c8016.js} +54 -8
  205. package/dist/chunk-ye5c8016.js.map +23 -0
  206. package/dist/chunk-yw9pyg66.js.map +1 -1
  207. package/dist/{chunk-nydf3dbe.js → chunk-z9mg7wya.js} +37 -20
  208. package/dist/chunk-z9mg7wya.js.map +13 -0
  209. package/dist/chunk-zbc929zg.js.map +1 -1
  210. package/dist/chunk-zhh1jd89.js +290 -0
  211. package/dist/chunk-zhh1jd89.js.map +10 -0
  212. package/dist/connectors/connections/authorizations.d.ts +2 -2
  213. package/dist/connectors/connections/authorizations.d.ts.map +1 -1
  214. package/dist/connectors/connections/service.d.ts.map +1 -1
  215. package/dist/connectors/connections/tokens.d.ts +2 -2
  216. package/dist/connectors/connections/tokens.d.ts.map +1 -1
  217. package/dist/connectors/connections/validation.d.ts +5 -0
  218. package/dist/connectors/connections/validation.d.ts.map +1 -1
  219. package/dist/connectors/types.d.ts +9 -2
  220. package/dist/connectors/types.d.ts.map +1 -1
  221. package/dist/datasets/write.js +3 -3
  222. package/dist/deploy/internal.js +2 -5
  223. package/dist/deploy/internal.js.map +3 -3
  224. package/dist/deploy/types.d.ts +0 -2
  225. package/dist/deploy/types.d.ts.map +1 -1
  226. package/dist/execution/agent.d.ts +2 -2
  227. package/dist/execution/agent.d.ts.map +1 -1
  228. package/dist/execution/agent.js +38 -38
  229. package/dist/execution/agent.js.map +1 -1
  230. package/dist/execution/primitive.js +35 -35
  231. package/dist/execution/request.js +37 -37
  232. package/dist/execution/request.js.map +2 -2
  233. package/dist/http/api-routes.d.ts +12 -11
  234. package/dist/http/api-routes.d.ts.map +1 -1
  235. package/dist/http/index.js +1 -1
  236. package/dist/index.d.ts +3 -3
  237. package/dist/index.d.ts.map +1 -1
  238. package/dist/index.js +53 -51
  239. package/dist/index.js.map +1 -1
  240. package/dist/lake-storage/index.js +3 -3
  241. package/dist/logging/internal.js +1 -1
  242. package/dist/materializer/index.js +17 -17
  243. package/dist/models/execution/errors.d.ts +5 -0
  244. package/dist/models/execution/errors.d.ts.map +1 -1
  245. package/dist/models/execution/index.d.ts +2 -1
  246. package/dist/models/execution/index.d.ts.map +1 -1
  247. package/dist/models/execution/index.js +55 -50
  248. package/dist/models/execution/index.js.map +1 -1
  249. package/dist/models/execution/model-call-recorder.d.ts +7 -2
  250. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  251. package/dist/models/execution.d.ts.map +1 -1
  252. package/dist/models/language-call.d.ts +51 -0
  253. package/dist/models/language-call.d.ts.map +1 -0
  254. package/dist/objects/index.js +35 -35
  255. package/dist/objects/query/index.js +17 -17
  256. package/dist/ontology/docs-markdown.d.ts.map +1 -1
  257. package/dist/ontology/index.d.ts +1 -1
  258. package/dist/ontology/index.d.ts.map +1 -1
  259. package/dist/ontology/index.js +4 -4
  260. package/dist/ontology/internal.js +8 -275
  261. package/dist/ontology/internal.js.map +3 -4
  262. package/dist/ontology/user-ref.d.ts +21 -3
  263. package/dist/ontology/user-ref.d.ts.map +1 -1
  264. package/dist/pipelines/index.js +19 -19
  265. package/dist/projections/builders.d.ts +13 -2
  266. package/dist/projections/builders.d.ts.map +1 -1
  267. package/dist/projections/index.d.ts +1 -1
  268. package/dist/projections/index.d.ts.map +1 -1
  269. package/dist/projections/internal.js +17 -17
  270. package/dist/projections/types.d.ts +7 -0
  271. package/dist/projections/types.d.ts.map +1 -1
  272. package/dist/projections/validation.d.ts +2 -0
  273. package/dist/projections/validation.d.ts.map +1 -1
  274. package/dist/query.js +2 -2
  275. package/dist/queues/in-memory.d.ts +0 -1
  276. package/dist/queues/in-memory.d.ts.map +1 -1
  277. package/dist/queues/index.d.ts +1 -1
  278. package/dist/queues/index.d.ts.map +1 -1
  279. package/dist/queues/index.js +1 -1
  280. package/dist/queues/types.d.ts +0 -8
  281. package/dist/queues/types.d.ts.map +1 -1
  282. package/dist/runtime/internal.js +23 -23
  283. package/dist/runtime/internal.js.map +1 -1
  284. package/dist/sandboxes/configuration.d.ts +4 -6
  285. package/dist/sandboxes/configuration.d.ts.map +1 -1
  286. package/dist/sandboxes/environment.d.ts.map +1 -1
  287. package/dist/sandboxes/exec.d.ts +5 -3
  288. package/dist/sandboxes/exec.d.ts.map +1 -1
  289. package/dist/sandboxes/guest-credentials.d.ts +61 -0
  290. package/dist/sandboxes/guest-credentials.d.ts.map +1 -0
  291. package/dist/sandboxes/index.d.ts +2 -0
  292. package/dist/sandboxes/index.d.ts.map +1 -1
  293. package/dist/sandboxes/index.js +23 -9
  294. package/dist/sandboxes/index.js.map +1 -1
  295. package/dist/sandboxes/sandbox.d.ts +18 -4
  296. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  297. package/dist/security/internal.js +1 -1
  298. package/dist/security/internal.js.map +1 -1
  299. package/dist/shares/internal.js +17 -17
  300. package/dist/shares/internal.js.map +1 -1
  301. package/dist/storage/agents/in-memory.d.ts +3 -1
  302. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  303. package/dist/storage/agents/index.d.ts +1 -1
  304. package/dist/storage/agents/index.d.ts.map +1 -1
  305. package/dist/storage/agents/provider.d.ts +6 -0
  306. package/dist/storage/agents/provider.d.ts.map +1 -1
  307. package/dist/storage/agents/provider.js +8 -2
  308. package/dist/storage/agents/provider.js.map +1 -1
  309. package/dist/storage/agents/types.d.ts +63 -7
  310. package/dist/storage/agents/types.d.ts.map +1 -1
  311. package/dist/storage/ai-cost/provider.js +2 -2
  312. package/dist/storage/connector-connections/provider.js.map +1 -1
  313. package/dist/storage/file-upload-sessions/provider.js +9 -9
  314. package/dist/storage/index.d.ts +1 -1
  315. package/dist/storage/index.d.ts.map +1 -1
  316. package/dist/storage/index.js +15 -15
  317. package/dist/storage/ontology/provider.js +1 -1
  318. package/dist/storage/share-grants/provider.js +3 -3
  319. package/dist/storage/types.d.ts +1 -1
  320. package/dist/storage/types.d.ts.map +1 -1
  321. package/dist/storage/workflow-runs/provider.js +9 -9
  322. package/dist/syncs/index.js +20 -20
  323. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  324. package/dist/testing/index.d.ts +2 -0
  325. package/dist/testing/index.d.ts.map +1 -1
  326. package/dist/testing/index.js +677 -352
  327. package/dist/testing/index.js.map +9 -7
  328. package/dist/testing/queues-contract.d.ts.map +1 -1
  329. package/dist/testing/sandbox-credentials-contract.d.ts +27 -0
  330. package/dist/testing/sandbox-credentials-contract.d.ts.map +1 -0
  331. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  332. package/dist/testing/users.d.ts +20 -0
  333. package/dist/testing/users.d.ts.map +1 -0
  334. package/dist/users/execution.d.ts +6 -2
  335. package/dist/users/execution.d.ts.map +1 -1
  336. package/dist/users/index.d.ts +1 -1
  337. package/dist/users/index.d.ts.map +1 -1
  338. package/dist/webhooks/internal.js +17 -17
  339. package/dist/webhooks/internal.js.map +1 -1
  340. package/dist/workers/index.js.map +1 -1
  341. package/dist/workflows/index.js +41 -39
  342. package/dist/workflows/index.js.map +1 -1
  343. package/package.json +1 -1
  344. package/src/agents/README.md +136 -0
  345. package/src/agents/attachment-keys.ts +83 -0
  346. package/src/agents/cancel.ts +16 -1
  347. package/src/agents/children.ts +5 -3
  348. package/src/agents/dispatch.ts +6 -58
  349. package/src/agents/execution.ts +18 -0
  350. package/src/agents/index.ts +127 -21
  351. package/src/agents/model-loop.ts +23 -73
  352. package/src/agents/model-routing.ts +7 -2
  353. package/src/agents/request.ts +69 -20
  354. package/src/agents/run-after-finish.ts +133 -0
  355. package/src/agents/run-artifacts.ts +257 -0
  356. package/src/agents/run-events.ts +302 -0
  357. package/src/agents/run-fence.ts +71 -0
  358. package/src/agents/run-liveness.ts +122 -0
  359. package/src/agents/run-plan.ts +316 -0
  360. package/src/agents/run-session-children.ts +303 -0
  361. package/src/agents/run-session-http.ts +397 -0
  362. package/src/agents/run-session-serve.ts +479 -0
  363. package/src/agents/run-session-wire.ts +189 -0
  364. package/src/agents/run-session.ts +802 -0
  365. package/src/agents/run-token.ts +124 -0
  366. package/src/agents/run-tools.ts +180 -0
  367. package/src/agents/run-turn.ts +265 -0
  368. package/src/agents/streams/internal.ts +0 -1
  369. package/src/agents/streams/protocol.ts +0 -292
  370. package/src/agents/subagent-runs.ts +19 -1
  371. package/src/agents/tool-files.ts +225 -0
  372. package/src/agents/workflow-node-session.ts +387 -0
  373. package/src/artifacts/publish/index.ts +1 -0
  374. package/src/connectors/connections/authorizations.ts +3 -2
  375. package/src/connectors/connections/service.ts +5 -1
  376. package/src/connectors/connections/tokens.ts +41 -5
  377. package/src/connectors/connections/validation.ts +21 -0
  378. package/src/connectors/types.ts +12 -2
  379. package/src/deploy/types.ts +0 -2
  380. package/src/deploy/validation.ts +1 -4
  381. package/src/execution/agent.ts +2 -2
  382. package/src/execution/authorized-object-reader.ts +28 -1
  383. package/src/http/api-routes.ts +114 -27
  384. package/src/index.ts +3 -1
  385. package/src/models/execution/README.md +15 -1
  386. package/src/models/execution/errors.ts +14 -0
  387. package/src/models/execution/index.ts +2 -1
  388. package/src/models/execution/model-call-recorder.ts +12 -10
  389. package/src/models/execution.ts +9 -11
  390. package/src/models/language-call.ts +247 -0
  391. package/src/ontology/docs-markdown.ts +14 -0
  392. package/src/ontology/index.ts +1 -1
  393. package/src/ontology/user-ref.ts +40 -6
  394. package/src/projections/builders.ts +48 -4
  395. package/src/projections/index.ts +1 -0
  396. package/src/projections/registry.ts +1 -0
  397. package/src/projections/revision.ts +10 -0
  398. package/src/projections/types.ts +8 -0
  399. package/src/projections/validation.ts +52 -6
  400. package/src/queues/in-memory.ts +0 -5
  401. package/src/queues/index.ts +0 -2
  402. package/src/queues/types.ts +0 -13
  403. package/src/runtime/host.ts +1 -1
  404. package/src/sandboxes/README.md +17 -6
  405. package/src/sandboxes/configuration.ts +7 -9
  406. package/src/sandboxes/environment.ts +1 -0
  407. package/src/sandboxes/exec.ts +17 -9
  408. package/src/sandboxes/guest-credentials.ts +262 -0
  409. package/src/sandboxes/index.ts +14 -0
  410. package/src/sandboxes/sandbox.ts +19 -4
  411. package/src/storage/agents/in-memory.ts +53 -0
  412. package/src/storage/agents/index.ts +2 -0
  413. package/src/storage/agents/provider.ts +56 -11
  414. package/src/storage/agents/types.ts +59 -7
  415. package/src/storage/index.ts +2 -0
  416. package/src/storage/types.ts +1 -0
  417. package/src/testing/agent-storage-contract.ts +175 -2
  418. package/src/testing/ai-model-call-groups-contract.ts +0 -1
  419. package/src/testing/index.ts +5 -0
  420. package/src/testing/queues-contract.ts +0 -16
  421. package/src/testing/sandbox-credentials-contract.ts +284 -0
  422. package/src/testing/sandboxes-contract.ts +21 -0
  423. package/src/testing/users.ts +39 -0
  424. package/src/users/execution.ts +33 -7
  425. package/src/users/index.ts +7 -1
  426. package/dist/agents/api-gateway.d.ts +0 -26
  427. package/dist/agents/api-gateway.d.ts.map +0 -1
  428. package/dist/chunk-2x19q6k6.js.map +0 -17
  429. package/dist/chunk-4y26vs3v.js.map +0 -10
  430. package/dist/chunk-661ezhks.js.map +0 -11
  431. package/dist/chunk-d2m879s4.js.map +0 -12
  432. package/dist/chunk-n9w3n38q.js.map +0 -23
  433. package/dist/chunk-nydf3dbe.js.map +0 -13
  434. package/dist/chunk-nzapm6p0.js.map +0 -12
  435. package/dist/chunk-r6szek0x.js.map +0 -10
  436. package/dist/chunk-vabga7fk.js +0 -176
  437. package/dist/chunk-vabga7fk.js.map +0 -12
  438. package/dist/chunk-vpgwq5nf.js +0 -810
  439. package/dist/chunk-vpgwq5nf.js.map +0 -21
  440. package/src/agents/api-gateway.ts +0 -68
  441. /package/dist/{chunk-2gjj5dx3.js.map → chunk-78ymxrn0.js.map} +0 -0
  442. /package/dist/{chunk-6n69k945.js.map → chunk-8mb7mt8n.js.map} +0 -0
  443. /package/dist/{chunk-m36fw8ft.js.map → chunk-8wsjr52f.js.map} +0 -0
  444. /package/dist/{chunk-bab05bhg.js.map → chunk-dgtd0836.js.map} +0 -0
  445. /package/dist/{chunk-7ny9mjgm.js.map → chunk-ft3w5ahs.js.map} +0 -0
  446. /package/dist/{chunk-1t6k1avb.js.map → chunk-tnhqtfea.js.map} +0 -0
@@ -6,7 +6,7 @@
6
6
  "import { parseSixbFailure } from \"../../errors/internal\"\nimport type { SixbFailure } from \"../../errors/types\"\nimport type {\n ProjectionMaterializationIdentity,\n ProjectionRunTerminalDecision,\n} from \"../../materialization/model\"\nimport type {\n ProjectionKind,\n ProjectionRunFailureCode,\n ProjectionTarget,\n} from \"../../projections/types\"\nimport { PROJECTION_RUN_FAILURE_CODES } from \"../../projections/types\"\nimport { ProjectionRunError } from \"./errors\"\nimport type {\n AdvanceProjectionTelemetryCheckpointInput,\n FailProjectionRunEnqueueInput,\n FinishProjectionRunInput,\n ProjectionMissingTarget,\n ProjectionRunClaim,\n ProjectionRunProgress,\n ProjectionRunRecord,\n ProjectionRunStatus,\n ProjectionTelemetryCheckpoint,\n QueueProjectionRunInput,\n StartOrReclaimProjectionRunInput,\n TelemetryProjectionRunRecord,\n} from \"./types\"\nimport { PROJECTION_RUN_PROGRESS_KEYS, zeroProjectionRunProgress } from \"./types\"\n\nexport type StoredProjectionRunRecord = ProjectionRunRecord & {\n readonly executionToken?: string\n}\n\nexport interface PersistedProjectionRunRecord {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly projectionId: string\n readonly projectionKind: ProjectionKind\n readonly protocol?: \"replacement\" | \"telemetry\"\n readonly datasetId: string\n readonly datasetVersionId: string\n readonly datasetVersionCreatedAt?: string\n readonly ontologyRevision?: string\n readonly projectionRevision?: string\n readonly ownershipHash?: string\n readonly objectTypeId?: string\n readonly sourceObjectTypeId?: string\n readonly targetObjectTypeId?: string\n readonly status: ProjectionRunStatus\n readonly queuedAt: Date\n readonly startedAt?: Date\n readonly finishedAt?: Date\n readonly attempt: number\n readonly executionToken?: string\n readonly fixedBatchSize?: number\n readonly nextBatchOrdinal?: number\n readonly nextRowOffset?: number\n readonly inputExhausted?: boolean\n readonly missingTargetObjectTypeId?: string\n readonly missingTargetObjectId?: string\n readonly missingTargetBatchOrdinal?: number\n readonly missingTargetFirstSeenAt?: Date\n readonly progress: ProjectionRunProgress\n readonly error?: unknown\n}\n\nexport interface ProjectionTelemetryAdvance {\n readonly progress: ProjectionRunProgress\n readonly checkpoint: ProjectionTelemetryCheckpoint\n}\n\nexport interface ProjectionRunFinishPlan {\n readonly status: Exclude<ProjectionRunStatus, \"queued\" | \"running\">\n readonly finishedAt: Date\n readonly progress: ProjectionRunProgress\n readonly inputExhausted?: true\n readonly error?: SixbFailure<ProjectionRunFailureCode>\n}\n\n// ── Scalar and identity validation ──────────────────────────\n\nexport function assertProjectionRunNonEmpty(value: string, fieldName: string): void {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} must not be empty.`)\n }\n}\n\nexport function assertProjectionRunCounter(value: number, fieldName: string): void {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a non-negative safe integer.`\n )\n }\n}\n\nexport function assertProjectionRunListWindow(value: number | undefined, fieldName: string): void {\n if (value !== undefined && (!Number.isSafeInteger(value) || value < 0)) {\n throw new ProjectionRunError(`[Sixb] Projection run list ${fieldName} must be >= 0.`)\n }\n}\n\nexport function addProjectionRunCounter(left: number, right: number, fieldName: string): number {\n const result = left + right\n if (!Number.isSafeInteger(result)) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} exceeds safe integer range.`)\n }\n return result\n}\n\nexport function assertProjectionRunIdentity(identity: ProjectionMaterializationIdentity): void {\n assertProjectionRunNonEmpty(identity.projectionId, \"projectionId\")\n if (!isProjectionKind(identity.projectionKind)) {\n throw new ProjectionRunError(\n \"[Sixb] Projection run projectionKind must be 'object', 'link', or 'telemetry'.\"\n )\n }\n if (identity.protocol !== \"replacement\" && identity.protocol !== \"telemetry\") {\n throw new ProjectionRunError(\n \"[Sixb] Projection run protocol must be 'replacement' or 'telemetry'.\"\n )\n }\n assertProjectionRunNonEmpty(identity.datasetVersion.datasetId, \"datasetId\")\n assertProjectionRunNonEmpty(identity.datasetVersion.versionId, \"datasetVersionId\")\n assertCanonicalTimestamp(identity.datasetVersion.createdAt, \"datasetVersionCreatedAt\")\n assertProjectionRunNonEmpty(identity.ontologyRevision, \"ontologyRevision\")\n assertProjectionRunNonEmpty(identity.projectionRevision, \"projectionRevision\")\n assertProjectionRunNonEmpty(identity.ownershipHash, \"ownershipHash\")\n if ((identity.protocol === \"telemetry\") !== (identity.projectionKind === \"telemetry\")) {\n throw new ProjectionRunError(\n `[Sixb] Projection run protocol '${identity.protocol}' is incompatible with kind '${identity.projectionKind}'.`\n )\n }\n}\n\nexport function assertProjectionRunIdentityMatches(\n record: Pick<ProjectionRunRecord, \"id\" | \"identity\">,\n identity: ProjectionMaterializationIdentity\n): void {\n if (projectionRunIdentitiesEqual(record.identity, identity)) return\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' materialization identity does not match.`\n )\n}\n\nexport function assertProjectionRunTargetMatches(\n record: Pick<ProjectionRunRecord, \"id\" | \"target\">,\n target: ProjectionTarget\n): void {\n if (projectionTargetsEqual(record.target, target)) return\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' target object types do not match.`\n )\n}\n\nexport function assertProjectionRunStartInput(input: StartOrReclaimProjectionRunInput): void {\n assertProjectionRunNonEmpty(input.id, \"id\")\n assertProjectionRunNonEmpty(input.projectId, \"projectId\")\n assertProjectionRunIdentityAndTarget(input)\n if (input.startedAt) assertProjectionRunDate(input.startedAt, \"startedAt\")\n}\n\nexport function assertProjectionRunQueueInput(input: QueueProjectionRunInput): void {\n assertProjectionRunNonEmpty(input.id, \"id\")\n assertProjectionRunNonEmpty(input.projectId, \"projectId\")\n assertProjectionRunNonEmpty(input.executionId, \"executionId\")\n assertProjectionRunIdentityAndTarget(input)\n if (input.queuedAt) assertProjectionRunDate(input.queuedAt, \"queuedAt\")\n}\n\nfunction assertProjectionRunIdentityAndTarget(\n input: QueueProjectionRunInput | StartOrReclaimProjectionRunInput\n): void {\n assertProjectionRunIdentity(input.identity)\n assertProjectionTarget(input.identity.projectionKind, input.target)\n if (input.identity.projectionKind === \"telemetry\") {\n const telemetry = input as ProjectionRunIdentityInput<\"telemetry\">\n assertPositiveCounter(telemetry.fixedBatchSize, \"fixedBatchSize\")\n } else if (input.fixedBatchSize !== undefined) {\n throw new ProjectionRunError(\n \"[Sixb] Replacement projection runs cannot declare a telemetry fixedBatchSize.\"\n )\n }\n}\n\nexport function planProjectionRunReclaim(\n record: StoredProjectionRunRecord,\n input: StartOrReclaimProjectionRunInput\n): { readonly attempt: number } {\n if (record.status !== \"queued\" && record.status !== \"running\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' cannot start from status '${record.status}'.`\n )\n }\n assertProjectionRunIdentityMatches(record, input.identity)\n assertProjectionRunTargetMatches(record, input.target)\n if (record.telemetryCheckpoint?.fixedBatchSize !== input.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${input.id}' fixed batch size does not match.`\n )\n }\n return { attempt: record.status === \"queued\" ? 1 : nextProjectionRunAttempt(record.attempt) }\n}\n\n// ── Lifecycle transitions ───────────────────────────────────\n\nexport function createProjectionRunRecord(\n input: QueueProjectionRunInput,\n now: Date = new Date()\n): ProjectionRunRecord {\n assertProjectionRunQueueInput(input)\n const base = {\n id: input.id,\n projectId: input.projectId,\n executionId: input.executionId,\n status: \"queued\" as const,\n attempt: 0,\n progress: zeroProjectionRunProgress(),\n queuedAt: new Date(input.queuedAt ?? now),\n }\n switch (input.identity.projectionKind) {\n case \"object\": {\n const object = input as ProjectionRunAdmission<\"object\">\n return { ...base, identity: object.identity, target: object.target }\n }\n case \"link\": {\n const link = input as ProjectionRunAdmission<\"link\">\n return { ...base, identity: link.identity, target: link.target }\n }\n case \"telemetry\": {\n const telemetry = input as ProjectionRunAdmission<\"telemetry\">\n return {\n ...base,\n identity: telemetry.identity,\n target: telemetry.target,\n telemetryCheckpoint: {\n fixedBatchSize: telemetry.fixedBatchSize,\n nextBatchOrdinal: 0,\n nextRowOffset: 0,\n inputExhausted: false,\n },\n }\n }\n }\n}\n\nexport function assertProjectionRunRunning(\n record: Pick<ProjectionRunRecord, \"id\" | \"projectId\" | \"status\">\n): void {\n if (record.status === \"running\") return\n if (record.status !== \"queued\") {\n throw new ProjectionRunError(`[Sixb] Projection run '${record.id}' is already terminal.`)\n }\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' for project '${record.projectId}' is not running.`\n )\n}\n\nexport function assertProjectionRunAttempt(\n record: StoredProjectionRunRecord,\n input: {\n readonly id: string\n readonly executionToken: string\n readonly identity: ProjectionMaterializationIdentity\n }\n): asserts record is StoredProjectionRunRecord & { readonly executionToken: string } {\n assertProjectionRunNonEmpty(input.executionToken, \"executionToken\")\n assertProjectionRunIdentity(input.identity)\n assertProjectionRunRunning(record)\n assertProjectionRunIdentityMatches(record, input.identity)\n if (record.executionToken !== input.executionToken) {\n throw staleProjectionRunExecution(input.id)\n }\n}\n\nexport function nextProjectionRunAttempt(current: number): number {\n assertProjectionRunCounter(current, \"attempt\")\n return addProjectionRunCounter(current, 1, \"attempt\")\n}\n\nexport function mergeProjectionRunProgress(\n current: ProjectionRunProgress,\n patch: Partial<ProjectionRunProgress>\n): ProjectionRunProgress {\n const progress = { ...current }\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n const value = patch[key]\n if (value === undefined) continue\n assertProjectionRunCounter(value, key)\n if (value < (current[key] ?? 0)) {\n throw new ProjectionRunError(`[Sixb] Projection run ${key} must not decrease.`)\n }\n progress[key] = value\n }\n assertProjectionRunProgress(progress)\n return progress\n}\n\nexport function assertGenericProgressDoesNotAdvanceTelemetry(\n record: Pick<ProjectionRunRecord, \"id\" | \"identity\" | \"progress\">,\n patch: Partial<ProjectionRunProgress>\n): void {\n if (record.identity.protocol !== \"telemetry\") return\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n if (patch[key] !== undefined && patch[key] !== record.progress[key]) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' progress can only advance with its checkpoint.`\n )\n }\n }\n}\n\nexport function advanceProjectionTelemetry(\n record: ProjectionRunRecord,\n input: AdvanceProjectionTelemetryCheckpointInput\n): ProjectionTelemetryAdvance {\n const telemetry = requireTelemetryProjectionRun(record)\n const checkpoint = telemetry.telemetryCheckpoint\n assertProjectionRunCounter(input.batchOrdinal, \"batchOrdinal\")\n assertPositiveCounter(input.batchRowCount, \"batchRowCount\")\n assertProjectionRunCounter(input.batchRowsSkipped, \"batchRowsSkipped\")\n if (input.batchRowsSkipped > input.batchRowCount) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' skipped rows exceed its batch row count.`\n )\n }\n if (input.batchOrdinal !== checkpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' expected batch ordinal ${checkpoint.nextBatchOrdinal}, got ${input.batchOrdinal}.`\n )\n }\n if (input.batchRowCount > checkpoint.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' batch exceeds its fixed size.`\n )\n }\n if (!input.inputExhausted && input.batchRowCount !== checkpoint.fixedBatchSize) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot advance past a partial non-final batch.`\n )\n }\n if (checkpoint.inputExhausted) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' has already exhausted its input.`\n )\n }\n\n const nextRowOffset = addProjectionRunCounter(\n checkpoint.nextRowOffset,\n input.batchRowCount,\n \"nextRowOffset\"\n )\n return {\n progress: {\n sourceRowsRead: nextRowOffset,\n sourceRowsSkipped: addProjectionRunCounter(\n telemetry.progress.sourceRowsSkipped,\n input.batchRowsSkipped,\n \"sourceRowsSkipped\"\n ),\n },\n checkpoint: {\n ...checkpoint,\n nextBatchOrdinal: addProjectionRunCounter(checkpoint.nextBatchOrdinal, 1, \"nextBatchOrdinal\"),\n nextRowOffset,\n inputExhausted: input.inputExhausted,\n },\n }\n}\n\nexport function planProjectionRunFinish(\n record: ProjectionRunRecord,\n input: FinishProjectionRunInput,\n now: Date = new Date()\n): ProjectionRunFinishPlan {\n assertFinishDecision(record, input)\n const patch = input.progress ?? {}\n assertGenericProgressDoesNotAdvanceTelemetry(record, patch)\n const progress = mergeProjectionRunProgress(record.progress, patch)\n const finishedAt = new Date(input.finishedAt ?? now)\n assertProjectionRunDate(finishedAt, \"finishedAt\")\n return {\n status: input.status,\n finishedAt,\n progress,\n ...(input.status === \"succeeded\" && input.protocol === \"telemetry\"\n ? { inputExhausted: true as const }\n : {}),\n ...(input.status === \"succeeded\" || input.error === undefined\n ? {}\n : { error: parseSixbFailure(input.error, PROJECTION_RUN_FAILURE_CODES) }),\n }\n}\n\nexport function finishProjectionRunRecord(\n record: StoredProjectionRunRecord,\n input: FinishProjectionRunInput,\n now: Date = new Date()\n): StoredProjectionRunRecord {\n const plan = planProjectionRunFinish(record, input, now)\n const terminal = {\n executionToken: undefined,\n status: plan.status,\n finishedAt: plan.finishedAt,\n progress: plan.progress,\n error: plan.error,\n }\n if (plan.inputExhausted) {\n const telemetry = requireTelemetryProjectionRun(record)\n return {\n ...telemetry,\n ...terminal,\n telemetryCheckpoint: { ...telemetry.telemetryCheckpoint, inputExhausted: true },\n }\n }\n return { ...record, ...terminal }\n}\n\nexport function failProjectionRunEnqueue(\n record: StoredProjectionRunRecord,\n input: FailProjectionRunEnqueueInput,\n now: Date = new Date()\n): StoredProjectionRunRecord {\n if (record.status !== \"queued\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' cannot fail enqueue from status '${record.status}'.`\n )\n }\n const error = parseSixbFailure(input.error, PROJECTION_RUN_FAILURE_CODES)\n if (error.code !== \"queue.enqueue_failed\") {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' enqueue failure must use code 'queue.enqueue_failed'.`\n )\n }\n const finishedAt = new Date(input.finishedAt ?? now)\n assertProjectionRunDate(finishedAt, \"finishedAt\")\n return {\n ...record,\n status: \"failed\",\n finishedAt,\n error,\n }\n}\n\n/** Validates the failure of an attempt that leaves its run running, before it is stored. */\nexport function parseProjectionAttemptFailure(\n record: Pick<ProjectionRunRecord, \"id\" | \"projectId\" | \"status\">,\n error: SixbFailure<ProjectionRunFailureCode>\n): SixbFailure<ProjectionRunFailureCode> {\n assertProjectionRunRunning(record)\n return parseSixbFailure(error, PROJECTION_RUN_FAILURE_CODES)\n}\n\nexport function canRequeueProjectionRunAfterEnqueueFailure(\n record: ProjectionRunRecord,\n input: QueueProjectionRunInput\n): boolean {\n return (\n record.status === \"failed\" &&\n record.error?.code === \"queue.enqueue_failed\" &&\n record.error.retryable &&\n record.executionId === input.executionId &&\n projectionRunIdentitiesEqual(record.identity, input.identity) &&\n projectionTargetsEqual(record.target, input.target) &&\n record.telemetryCheckpoint?.fixedBatchSize === input.fixedBatchSize\n )\n}\n\n/**\n * Statuses of a run that still stands to replace its projection's source. A later run in one of\n * them makes an earlier run stale; a failed or cancelled one replaces nothing.\n */\nexport const SUPERSEDING_PROJECTION_RUN_STATUSES = [\n \"queued\",\n \"running\",\n \"succeeded\",\n] as const satisfies readonly ProjectionRunStatus[]\n\n/**\n * Whether `newer` makes `run` stale. Dataset version timestamps are canonical UTC ISO strings, so\n * they order as text; SQL adapters compare them under a binary collation for the same reason.\n */\nexport function projectionRunSupersedes(\n newer: ProjectionRunRecord,\n run: ProjectionRunRecord\n): boolean {\n return (\n run.identity.protocol === \"replacement\" &&\n newer.identity.protocol === \"replacement\" &&\n newer.projectId === run.projectId &&\n newer.identity.projectionId === run.identity.projectionId &&\n newer.identity.datasetVersion.createdAt > run.identity.datasetVersion.createdAt &&\n (SUPERSEDING_PROJECTION_RUN_STATUSES as readonly ProjectionRunStatus[]).includes(newer.status)\n )\n}\n\n// ── Persistence mapping ─────────────────────────────────────\n\nexport function restoreProjectionRun(row: PersistedProjectionRunRecord): StoredProjectionRunRecord {\n assertProjectionRunNonEmpty(row.id, \"id\")\n assertProjectionRunNonEmpty(row.projectId, \"projectId\")\n assertProjectionRunNonEmpty(row.executionId, \"executionId\")\n assertProjectionRunCounter(row.attempt, \"attempt\")\n assertProjectionRunProgress(row.progress)\n assertValidDate(row.queuedAt, \"queuedAt\")\n if (row.startedAt) assertValidDate(row.startedAt, \"startedAt\")\n if (row.finishedAt) assertValidDate(row.finishedAt, \"finishedAt\")\n assertPersistedLifecycle(row)\n\n const identity = restoreIdentity(row)\n const base = {\n id: row.id,\n projectId: row.projectId,\n executionId: row.executionId,\n identity,\n status: row.status,\n queuedAt: new Date(row.queuedAt),\n startedAt: row.startedAt ? new Date(row.startedAt) : undefined,\n finishedAt: row.finishedAt ? new Date(row.finishedAt) : undefined,\n attempt: row.attempt,\n progress: { ...row.progress },\n error:\n row.error === undefined\n ? undefined\n : parseSixbFailure(row.error, PROJECTION_RUN_FAILURE_CODES),\n executionToken: row.executionToken,\n }\n\n if (identity.projectionKind === \"link\") {\n if (!row.sourceObjectTypeId || !row.targetObjectTypeId || row.objectTypeId) {\n throw invalidProjectionRunTarget(row.id)\n }\n assertNoCheckpoint(row)\n return {\n ...base,\n identity,\n target: {\n sourceObjectTypeId: row.sourceObjectTypeId,\n targetObjectTypeId: row.targetObjectTypeId,\n },\n }\n }\n if (!row.objectTypeId || row.sourceObjectTypeId || row.targetObjectTypeId) {\n throw invalidProjectionRunTarget(row.id)\n }\n if (identity.projectionKind === \"telemetry\") {\n const telemetryCheckpoint = restoreCheckpoint(row)\n if (row.progress.sourceRowsRead !== telemetryCheckpoint.nextRowOffset) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' progress does not match its checkpoint.`\n )\n }\n if (row.status === \"succeeded\" && !telemetryCheckpoint.inputExhausted) {\n throw incompleteProjectionRun(row.id)\n }\n const missingTarget = restoreMissingTarget(row, telemetryCheckpoint)\n return {\n ...base,\n identity,\n target: { objectTypeId: row.objectTypeId },\n telemetryCheckpoint,\n ...(missingTarget ? { missingTarget } : {}),\n }\n }\n assertNoCheckpoint(row)\n return { ...base, identity, target: { objectTypeId: row.objectTypeId } }\n}\n\nexport function publicProjectionRunRecord(record: StoredProjectionRunRecord): ProjectionRunRecord {\n const cloned = structuredClone(record)\n Reflect.deleteProperty(cloned, \"executionToken\")\n return cloned\n}\n\nexport function createProjectionRunClaim(record: StoredProjectionRunRecord): ProjectionRunClaim {\n assertProjectionRunRunning(record)\n const executionToken = requireProjectionRunExecutionToken(record)\n return {\n run: publicProjectionRunRecord(record),\n execution: { projectionRunId: record.id, executionToken },\n }\n}\n\nexport function requireProjectionRunExecutionToken(record: StoredProjectionRunRecord): string {\n if (record.executionToken) return record.executionToken\n throw incompleteProjectionRun(record.id)\n}\n\nexport function staleProjectionRunExecution(id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' execution token is stale.`,\n \"execution-lost\"\n )\n}\n\nexport function projectionRunNotFound(projectId: string, id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' not found for project '${projectId}'.`\n )\n}\n\nexport function immutableDatasetVersionConflict(\n identity: ProjectionMaterializationIdentity\n): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Dataset version '${identity.datasetVersion.versionId}' reused an immutable dataset version id with different metadata.`\n )\n}\n\n// ── Private helpers ─────────────────────────────────────────\n\nfunction assertPositiveCounter(value: number, fieldName: string): void {\n if (!Number.isSafeInteger(value) || value <= 0) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a positive safe integer.`\n )\n }\n}\n\nfunction assertCanonicalTimestamp(value: string, fieldName: string): void {\n const milliseconds = Date.parse(value)\n if (!Number.isFinite(milliseconds) || new Date(milliseconds).toISOString() !== value) {\n throw new ProjectionRunError(\n `[Sixb] Projection run ${fieldName} must be a canonical UTC timestamp.`\n )\n }\n}\n\nfunction assertValidDate(value: Date, fieldName: string): void {\n if (!Number.isFinite(value.getTime())) {\n throw new ProjectionRunError(`[Sixb] Projection run persisted ${fieldName} is invalid.`)\n }\n}\n\nfunction assertPersistedLifecycle(row: PersistedProjectionRunRecord): void {\n const hasError = row.error !== undefined\n\n if (row.status === \"queued\") {\n if (\n row.attempt !== 0 ||\n row.startedAt !== undefined ||\n row.finishedAt !== undefined ||\n row.executionToken !== undefined ||\n hasError\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n\n if (row.status === \"running\") {\n if (\n row.attempt < 1 ||\n row.startedAt === undefined ||\n row.finishedAt !== undefined ||\n row.executionToken === undefined\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n\n if (row.finishedAt === undefined || row.executionToken !== undefined) {\n throw incompleteProjectionRun(row.id)\n }\n if (row.error !== undefined) {\n const failure = parseSixbFailure(row.error, PROJECTION_RUN_FAILURE_CODES)\n if (failure.code === \"queue.enqueue_failed\") {\n if (\n !failure.retryable ||\n row.status !== \"failed\" ||\n row.attempt !== 0 ||\n row.startedAt !== undefined\n ) {\n throw incompleteProjectionRun(row.id)\n }\n return\n }\n }\n if (\n row.attempt < 1 ||\n row.startedAt === undefined ||\n ((row.status === \"succeeded\" || row.status === \"superseded\") && hasError) ||\n (row.status === \"superseded\" && row.protocol !== \"replacement\")\n ) {\n throw incompleteProjectionRun(row.id)\n }\n}\n\nfunction assertProjectionRunDate(value: Date, fieldName: string): void {\n if (!Number.isFinite(value.getTime())) {\n throw new ProjectionRunError(`[Sixb] Projection run ${fieldName} is invalid.`)\n }\n}\n\nfunction isProjectionRunTerminalStatus(\n status: unknown\n): status is ProjectionRunFinishPlan[\"status\"] {\n return (\n status === \"succeeded\" ||\n status === \"failed\" ||\n status === \"cancelled\" ||\n status === \"superseded\"\n )\n}\n\nfunction isProjectionKind(value: unknown): value is ProjectionKind {\n return value === \"object\" || value === \"link\" || value === \"telemetry\"\n}\n\nfunction assertProjectionTarget(kind: ProjectionKind, target: ProjectionTarget): void {\n if (kind === \"link\") {\n if (!(\"sourceObjectTypeId\" in target)) {\n throw new ProjectionRunError(\n \"[Sixb] Link projection runs must declare source and target object types.\"\n )\n }\n assertProjectionRunNonEmpty(target.sourceObjectTypeId, \"sourceObjectTypeId\")\n assertProjectionRunNonEmpty(target.targetObjectTypeId, \"targetObjectTypeId\")\n return\n }\n if (!(\"objectTypeId\" in target)) {\n throw new ProjectionRunError(\n \"[Sixb] Object and telemetry projection runs must declare one object type.\"\n )\n }\n assertProjectionRunNonEmpty(target.objectTypeId, \"objectTypeId\")\n}\n\nfunction projectionRunIdentitiesEqual(\n left: ProjectionMaterializationIdentity,\n right: ProjectionMaterializationIdentity\n): boolean {\n return (\n left.projectionId === right.projectionId &&\n left.projectionKind === right.projectionKind &&\n left.protocol === right.protocol &&\n left.datasetVersion.datasetId === right.datasetVersion.datasetId &&\n left.datasetVersion.versionId === right.datasetVersion.versionId &&\n left.datasetVersion.createdAt === right.datasetVersion.createdAt &&\n left.ontologyRevision === right.ontologyRevision &&\n left.projectionRevision === right.projectionRevision &&\n left.ownershipHash === right.ownershipHash\n )\n}\n\nfunction projectionTargetsEqual(left: ProjectionTarget, right: ProjectionTarget): boolean {\n if (\"sourceObjectTypeId\" in left || \"sourceObjectTypeId\" in right) {\n return (\n \"sourceObjectTypeId\" in left &&\n \"sourceObjectTypeId\" in right &&\n left.sourceObjectTypeId === right.sourceObjectTypeId &&\n left.targetObjectTypeId === right.targetObjectTypeId\n )\n }\n return left.objectTypeId === right.objectTypeId\n}\n\nfunction assertProjectionRunProgress(progress: ProjectionRunProgress): void {\n for (const key of PROJECTION_RUN_PROGRESS_KEYS) {\n assertProjectionRunCounter(\n key === \"sourceChangesRead\" ? (progress[key] ?? 0) : progress[key],\n key\n )\n }\n if (progress.sourceRowsSkipped > progress.sourceRowsRead) {\n throw new ProjectionRunError(\n \"[Sixb] Projection run sourceRowsSkipped must not exceed sourceRowsRead.\"\n )\n }\n}\n\nfunction assertFinishDecision(\n record: ProjectionRunRecord,\n input: ProjectionRunTerminalDecision\n): void {\n if (!isProjectionRunTerminalStatus(input.status)) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' finish status must be terminal.`\n )\n }\n if (input.protocol !== \"replacement\" && input.protocol !== \"telemetry\") {\n throw new ProjectionRunError(`[Sixb] Projection run '${record.id}' finish protocol is invalid.`)\n }\n if (input.protocol !== record.identity.protocol) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' finish protocol does not match its identity.`\n )\n }\n if (input.status === \"superseded\" && input.protocol !== \"replacement\") {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot be superseded.`\n )\n }\n const inputExhausted = \"inputExhausted\" in input ? input.inputExhausted : undefined\n if (input.status === \"succeeded\" && input.protocol === \"telemetry\") {\n if (inputExhausted === true) return\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot succeed before input exhaustion.`\n )\n }\n if (inputExhausted !== undefined) {\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' contains telemetry-only completion metadata.`\n )\n }\n}\n\nfunction restoreIdentity(row: PersistedProjectionRunRecord): ProjectionMaterializationIdentity {\n if (\n !row.protocol ||\n !row.datasetVersionCreatedAt ||\n !row.ontologyRevision ||\n !row.projectionRevision ||\n !row.ownershipHash\n ) {\n throw incompleteProjectionRun(row.id)\n }\n const identity = {\n projectionId: row.projectionId,\n projectionKind: row.projectionKind,\n protocol: row.protocol,\n datasetVersion: {\n datasetId: row.datasetId,\n versionId: row.datasetVersionId,\n createdAt: row.datasetVersionCreatedAt,\n },\n ontologyRevision: row.ontologyRevision,\n projectionRevision: row.projectionRevision,\n ownershipHash: row.ownershipHash,\n } as ProjectionMaterializationIdentity\n assertProjectionRunIdentity(identity)\n return identity\n}\n\nfunction restoreCheckpoint(row: PersistedProjectionRunRecord): ProjectionTelemetryCheckpoint {\n if (\n row.fixedBatchSize === undefined ||\n row.nextBatchOrdinal === undefined ||\n row.nextRowOffset === undefined ||\n row.inputExhausted === undefined\n ) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' has incomplete checkpoint state.`\n )\n }\n assertPositiveCounter(row.fixedBatchSize, \"fixedBatchSize\")\n assertProjectionRunCounter(row.nextBatchOrdinal, \"nextBatchOrdinal\")\n assertProjectionRunCounter(row.nextRowOffset, \"nextRowOffset\")\n return {\n fixedBatchSize: row.fixedBatchSize,\n nextBatchOrdinal: row.nextBatchOrdinal,\n nextRowOffset: row.nextRowOffset,\n inputExhausted: row.inputExhausted,\n }\n}\n\n/**\n * A wait is either fully persisted or absent. A partially written one would read as \"waiting since\n * the epoch\" or \"waiting for nothing\", and both would decide a run's fate.\n */\nfunction restoreMissingTarget(\n row: PersistedProjectionRunRecord,\n checkpoint: ProjectionTelemetryCheckpoint\n): ProjectionMissingTarget | undefined {\n const columns = [\n row.missingTargetObjectTypeId,\n row.missingTargetObjectId,\n row.missingTargetBatchOrdinal,\n row.missingTargetFirstSeenAt,\n ]\n if (columns.every((column) => column === undefined)) return undefined\n if (\n row.missingTargetObjectTypeId === undefined ||\n row.missingTargetObjectId === undefined ||\n row.missingTargetBatchOrdinal === undefined ||\n row.missingTargetFirstSeenAt === undefined\n ) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' has a partially persisted missing target.`\n )\n }\n const missingTarget: ProjectionMissingTarget = {\n objectTypeId: row.missingTargetObjectTypeId,\n objectId: row.missingTargetObjectId,\n batchOrdinal: row.missingTargetBatchOrdinal,\n firstSeenAt: new Date(row.missingTargetFirstSeenAt),\n }\n assertValidDate(missingTarget.firstSeenAt, \"missingTarget.firstSeenAt\")\n assertProjectionRunCounter(missingTarget.batchOrdinal, \"missingTarget.batchOrdinal\")\n if (missingTarget.batchOrdinal !== checkpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' is waiting on a batch it has already passed.`\n )\n }\n if (missingTarget.objectTypeId !== row.objectTypeId) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${row.id}' is waiting on an object type it does not write.`\n )\n }\n return missingTarget\n}\n\nfunction assertNoCheckpoint(row: PersistedProjectionRunRecord): void {\n if (\n row.fixedBatchSize === undefined &&\n row.nextBatchOrdinal === undefined &&\n row.nextRowOffset === undefined &&\n row.inputExhausted === undefined\n ) {\n return\n }\n throw new ProjectionRunError(\n `[Sixb] Replacement projection run '${row.id}' contains a telemetry checkpoint.`\n )\n}\n\nfunction incompleteProjectionRun(id: string): ProjectionRunError {\n return new ProjectionRunError(\n `[Sixb] Projection run '${id}' has incomplete materialization state.`\n )\n}\n\nfunction invalidProjectionRunTarget(id: string): ProjectionRunError {\n return new ProjectionRunError(`[Sixb] Projection run '${id}' has an invalid target.`)\n}\n\n/**\n * Validates a wait before it is stored, so every adapter refuses the same shapes and the SQL\n * `CHECK` behind them never has to be the thing that catches it.\n *\n * The ordinal has to be the batch the run is actually stuck on: anchored to a stale one, a wait\n * would survive the progress that resolved it and fail a run that is working. The object type\n * has to be the one this run writes, since that is the only type its telemetry can reference.\n */\nexport function assertProjectionMissingTarget(\n record: TelemetryProjectionRunRecord,\n missingTarget: ProjectionMissingTarget\n): ProjectionMissingTarget {\n assertProjectionRunNonEmpty(missingTarget.objectTypeId, \"missingTarget.objectTypeId\")\n assertProjectionRunNonEmpty(missingTarget.objectId, \"missingTarget.objectId\")\n assertProjectionRunCounter(missingTarget.batchOrdinal, \"missingTarget.batchOrdinal\")\n if (Number.isNaN(missingTarget.firstSeenAt.getTime())) {\n throw new ProjectionRunError(\"[Sixb] Projection run missingTarget.firstSeenAt is invalid.\")\n }\n if (missingTarget.objectTypeId !== record.target.objectTypeId) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot wait on '${missingTarget.objectTypeId}'; it writes '${record.target.objectTypeId}'.`\n )\n }\n if (missingTarget.batchOrdinal !== record.telemetryCheckpoint.nextBatchOrdinal) {\n throw new ProjectionRunError(\n `[Sixb] Telemetry projection run '${record.id}' cannot wait on batch ${missingTarget.batchOrdinal}; it is at ${record.telemetryCheckpoint.nextBatchOrdinal}.`\n )\n }\n return missingTarget\n}\n\nexport function requireTelemetryProjectionRun<TRecord extends ProjectionRunRecord>(\n record: TRecord\n): TRecord & TelemetryProjectionRunRecord {\n if (isTelemetryProjectionRun(record)) return record as TRecord & TelemetryProjectionRunRecord\n throw new ProjectionRunError(\n `[Sixb] Projection run '${record.id}' does not have a telemetry checkpoint.`\n )\n}\n\ntype ProjectionRunIdentityInput<TKind extends ProjectionKind> = Extract<\n QueueProjectionRunInput | StartOrReclaimProjectionRunInput,\n { readonly identity: { readonly projectionKind: TKind } }\n>\n\ntype ProjectionRunAdmission<TKind extends ProjectionKind> = Extract<\n QueueProjectionRunInput,\n { readonly identity: { readonly projectionKind: TKind } }\n>\n\nfunction isTelemetryProjectionRun(\n record: ProjectionRunRecord\n): record is TelemetryProjectionRunRecord {\n return record.identity.projectionKind === \"telemetry\"\n}\n",
7
7
  "import type { ExecutionStorage } from \"../executions\"\nimport { findPrimitiveRunExecution } from \"../executions/run-link\"\nimport { ProjectionRunError } from \"./errors\"\n\nexport * from \"./lifecycle\"\n\n/** Validate the semantic link between a durable Projection run and its immutable execution. */\nexport async function assertProjectionRunDurableExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n readonly projectionId: string\n readonly datasetId: string\n readonly datasetVersionId: string\n}): Promise<void> {\n const execution = await findPrimitiveRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n primitive: { kind: \"projection\", id: input.projectionId, runId: input.runId },\n sourceTypes: [\"datasetVersion\"],\n })\n if (\n !execution ||\n execution.source.type !== \"datasetVersion\" ||\n execution.source.datasetId !== input.datasetId ||\n execution.source.versionId !== input.datasetVersionId\n ) {\n throw new ProjectionRunError(\n `[Sixb] Execution '${input.executionId}' does not authorize Projection run '${input.runId}'.`\n )\n }\n}\n"
8
8
  ],
9
- "mappings": ";;;;;;;;;;;;;;;;;AAQO,MAAM,4BAA2B,8BAA6B;AAAA,EAC1D,OAAO;AAAA,EAEhB,WAAW,CAAC,SAAiB,OAAoC,mBAAmB;AAAA,IAClF,MAAM,MAAM,OAAO;AAAA;AAEvB;;;ACoEO,SAAS,4BAA2B,CAAC,OAAe,WAAy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AC9E,MAAM,IAAI,oBACR,oCAAoC,OAAO,4BAA4B,cAAc,0BAA0B,OAAO,oBAAoB,mBAC5I;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,8BAAkE,CAChF,QACwC;AAAA,EACxC,IAAI,yBAAyB,MAAM;AAAA,IAAG,OAAO;AAAA,EAC7C,MAAM,IAAI,oBACR,0BAA0B,OAAO,2CACnC;AAAA;AAaF,SAAS,wBAAwB,CAC/B,QACwC;AAAA,EACxC,OAAO,OAAO,SAAS,mBAAmB;AAAA;;;AC78BrC,eAAe,oCAAmC,CAAC,OAQxC;AAAA,EAChB,MAAM,YAAY,MAAM,0BAA0B;AAAA,IAChD,YAAY,MAAM;AAAA,IAClB,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,WAAW,EAAE,MAAM,cAAc,IAAI,MAAM,cAAc,OAAO,MAAM,MAAM;AAAA,IAC5E,aAAa,CAAC,gBAAgB;AAAA,EAChC,CAAC;AAAA,EACD,IACE,CAAC,aACD,UAAU,OAAO,SAAS,oBAC1B,UAAU,OAAO,cAAc,MAAM,aACrC,UAAU,OAAO,cAAc,MAAM,kBACrC;AAAA,IACA,MAAM,IAAI,oBACR,qBAAqB,MAAM,mDAAmD,MAAM,SACtF;AAAA,EACF;AAAA;",
10
10
  "debugId": "9F76147C7312E1A964756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -4,7 +4,7 @@ import {
4
4
  validatePrimaryProperties2,
5
5
  validatePropertyDefinitions2,
6
6
  validateQueryMetadata2
7
- } from "./chunk-65pyhyas.js";
7
+ } from "./chunk-qgvbxfqv.js";
8
8
  import {
9
9
  markingIdsFrom
10
10
  } from "./chunk-73v685wb.js";
@@ -6,7 +6,7 @@
6
6
  "/**\n * Standalone ontology registry — owns all type state and resolution logic.\n *\n * Zero infrastructure dependencies: imports only from the `ontology/` module.\n * Other modules depend on its read-only catalog instead of coupling to the full\n * `Sixb` facade.\n */\n\nimport {\n formatUnknownObjectTypeMessage,\n OntologyNotFoundError,\n OntologyValidationError,\n} from \"./errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport { type UniquePropertyDefinition, uniquePropertiesOf } from \"./unique-values\"\nimport {\n validatePrimaryProperties,\n validatePropertyDefinitions,\n validateQueryMetadata,\n} from \"./validation\"\nimport { snapshotVectorProfiles } from \"./vector-profiles\"\n\n// ── Input types ──────────────────────────────────────────────\n\n/** Typed wrapper used by `createSixb` to register full ontology documents. */\nexport type OntologyDocumentInput = {\n readonly id: string\n readonly version: string\n readonly objectTypes: readonly ObjectTypeWithPropertyTokens[]\n readonly valueTypes?: readonly ValueType[]\n}\n\n/**\n * Runtime accepts either full ontology documents or individual object types.\n * This keeps setup flexible while preserving strict typing.\n */\nexport type OntologySource = ObjectTypeWithPropertyTokens | OntologyDocumentInput\n\nexport interface OntologyRegistryOptions {\n readonly sources: readonly OntologySource[]\n}\n\n/** Read-only access to the host's validated ontology definitions and type graph. */\nexport interface OntologyDefinitionCatalog {\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[]\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens\n getPrimaryPropertyId(objectTypeId: string): string\n listSubTypes(objectTypeId: string): string[]\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[]\n isValidLinkTarget(expected: string | string[], actual: string): boolean\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens>\n getValueTypesById(): ReadonlyMap<string, ValueType>\n getPrimaryByTypeId(): ReadonlyMap<string, string>\n}\n\n// ── Private helpers ──────────────────────────────────────────\n\nfunction isOntologyDocumentSource(\n source: OntologySource\n): source is Exclude<OntologySource, ObjectTypeWithPropertyTokens> {\n return \"objectTypes\" in source\n}\n\n/**\n * Recursively walk a schema tree and collect ValueTypes discovered\n * via `valueTypeRef` nodes that carry a `_resolved` schema.\n *\n * This enables auto-registration: when codegen emits `valueTypeRef(VT)`,\n * it stores the resolved schema (and the semantic type, if any) inline. We\n * extract them here so the runtime `valueTypesById` registry is populated\n * without requiring users to pass ValueTypes explicitly. Unit validation reads\n * the semantic type from that registry, so dropping it would make a\n * unit-bearing value type reject every unit.\n */\nfunction extractValueTypesFromSchema(\n schema: Schema,\n collected: Map<string, ValueType>,\n seen: Set<string>\n): void {\n if (typeof schema === \"string\") return\n\n if (schema.type === \"valueTypeRef\") {\n if (schema._resolved && !seen.has(schema.valueTypeId)) {\n seen.add(schema.valueTypeId)\n const localName = schema.valueTypeId.includes(\":\")\n ? schema.valueTypeId.slice(schema.valueTypeId.indexOf(\":\") + 1)\n : schema.valueTypeId\n collected.set(schema.valueTypeId, {\n id: schema.valueTypeId,\n name: localName,\n schema: schema._resolved,\n ...(schema._semanticType === undefined ? {} : { semanticType: schema._semanticType }),\n })\n extractValueTypesFromSchema(schema._resolved, collected, seen)\n }\n return\n }\n\n if (schema.type === \"object\") {\n for (const field of Object.values(schema.properties)) {\n extractValueTypesFromSchema(field.schema, collected, seen)\n }\n return\n }\n\n if (schema.type === \"array\") {\n extractValueTypesFromSchema(schema.items, collected, seen)\n return\n }\n\n if (schema.type === \"map\") {\n extractValueTypesFromSchema(schema.valueSchema, collected, seen)\n }\n}\n\nfunction collectOntology(sources: readonly OntologySource[]): {\n objectTypes: ObjectTypeWithPropertyTokens[]\n valueTypes: ValueType[]\n} {\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n const seenObjectTypes = new Set<ObjectTypeWithPropertyTokens>()\n\n for (const source of sources) {\n if (isOntologyDocumentSource(source)) {\n for (const ot of source.objectTypes) {\n if (!seenObjectTypes.has(ot)) {\n seenObjectTypes.add(ot)\n objectTypes.push(ot)\n }\n }\n valueTypes.push(...(source.valueTypes ?? []))\n } else {\n if (!seenObjectTypes.has(source)) {\n seenObjectTypes.add(source)\n objectTypes.push(source)\n }\n }\n }\n\n // Auto-discover ValueTypes embedded in ObjectType schemas via _resolved.\n // Explicit ValueTypes (from OntologyDocumentInput) take priority.\n const explicitIds = new Set(valueTypes.map((vt) => vt.id))\n const discovered = new Map<string, ValueType>()\n\n for (const objectType of objectTypes) {\n for (const property of objectType.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n for (const linkDef of objectType.links) {\n if (linkDef.properties) {\n for (const property of linkDef.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n }\n }\n }\n\n valueTypes.push(...discovered.values())\n\n return { objectTypes, valueTypes }\n}\n\n// ── OntologyRegistry ─────────────────────────────────────────\n\n/**\n * Self-contained registry for ontology types.\n *\n * Holds all object types, value types, the subtype graph, and the primary\n * property mapping. Validates inheritance chains and flattens inherited\n * properties at construction time.\n *\n * Exposes read-only accessors so consumers never mutate ontology state.\n */\nexport class OntologyRegistry implements OntologyDefinitionCatalog {\n private readonly objectTypesById = new Map<string, ObjectTypeWithPropertyTokens>()\n private readonly valueTypesById = new Map<string, ValueType>()\n private readonly subTypesById = new Map<string, Set<string>>()\n private readonly primaryByTypeId: Map<string, string>\n private readonly uniqueByTypeId = new Map<string, readonly UniquePropertyDefinition[]>()\n\n constructor(options: OntologyRegistryOptions) {\n const { objectTypes, valueTypes } = collectOntology(options.sources)\n\n for (const objectType of objectTypes) {\n if (this.objectTypesById.has(objectType.id)) {\n throw new OntologyValidationError(`Duplicate object type id: ${objectType.id}`)\n }\n this.objectTypesById.set(objectType.id, objectType)\n }\n\n for (const valueType of valueTypes) {\n if (this.valueTypesById.has(valueType.id)) {\n throw new OntologyValidationError(`Duplicate value type id: ${valueType.id}`)\n }\n this.valueTypesById.set(valueType.id, valueType)\n }\n\n this.validateAndBuildExtendsRegistry()\n this.resolveInheritedProperties()\n validatePropertyDefinitions(this.objectTypesById, this.valueTypesById)\n validateQueryMetadata(this.objectTypesById, this.valueTypesById)\n for (const [id, type] of this.objectTypesById) {\n if (type.search?.vectors)\n this.objectTypesById.set(id, {\n ...type,\n search: { ...type.search, vectors: snapshotVectorProfiles(type.search.vectors) },\n })\n }\n this.primaryByTypeId = validatePrimaryProperties(this.objectTypesById)\n this.indexUniqueProperties()\n }\n\n // ── Public read API ──────────────────────────────────────\n\n /** All registered object types. */\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return [...this.objectTypesById.values()]\n }\n\n /** Lookup an object type by id. Returns `null` if not found. */\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.objectTypesById.get(objectTypeId) ?? null\n }\n\n /**\n * Lookup an object type by id, throwing if it does not exist.\n *\n * Use this when the caller requires the type to exist and should fail\n * loudly on unknown types (e.g., write operations receiving a type id).\n */\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n const objectType = this.objectTypesById.get(objectTypeId)\n if (!objectType) {\n throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n }\n return objectType\n }\n\n /** Get the primary property id for a given object type. Throws if unknown. */\n getPrimaryPropertyId(objectTypeId: string): string {\n const id = this.primaryByTypeId.get(objectTypeId)\n if (!id) throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n return id\n }\n\n /** The unique properties of a type, its inherited ones included. Empty for an unknown type. */\n listUniqueProperties(objectTypeId: string): readonly UniquePropertyDefinition[] {\n return this.uniqueByTypeId.get(objectTypeId) ?? []\n }\n\n /** Collect all transitive sub-types of the given object type id. */\n listSubTypes(objectTypeId: string): string[] {\n const result: string[] = []\n const collect = (typeId: string): void => {\n const children = this.subTypesById.get(typeId)\n if (!children) return\n for (const childId of children) {\n result.push(childId)\n collect(childId)\n }\n }\n collect(objectTypeId)\n return result\n }\n\n /** Get the structural extends chain from root ancestor to the provided type. */\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[] {\n const chain: ObjectTypeWithPropertyTokens[] = []\n let current: ObjectTypeWithPropertyTokens | null = this.resolveObjectType(objectType.id)\n const seen = new Set<string>()\n\n while (current) {\n if (seen.has(current.id)) {\n throw new OntologyValidationError(\n `Circular extends chain detected while resolving ancestors for \"${objectType.id}\".`\n )\n }\n seen.add(current.id)\n chain.push(current)\n current = current.extends ? this.resolveObjectType(current.extends) : null\n }\n\n return chain.reverse()\n }\n\n /**\n * Check whether `actual` is a valid target for a link expecting `expected`.\n *\n * Supports wildcard `\"*\"`, single concrete types, and arrays. A type\n * matches if it equals the expected type or is a transitive subtype.\n */\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n if (expected === \"*\") return true\n const types = Array.isArray(expected) ? expected : [expected]\n if (types.includes(\"*\")) return true\n for (const type of types) {\n if (actual === type || this.listSubTypes(type).includes(actual)) return true\n }\n return false\n }\n\n // ── Map accessors (read-only views) ──────────────────────\n\n /** Read-only view of all object types by id. */\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens> {\n return this.objectTypesById\n }\n\n /** Read-only view of all value types by id. */\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.valueTypesById\n }\n\n /** Read-only view of primary property ids by object type id. */\n getPrimaryByTypeId(): ReadonlyMap<string, string> {\n return this.primaryByTypeId\n }\n\n // ── Private initialization ───────────────────────────────\n\n /** Every write consults the unique properties of its type: resolve their kinds once. */\n private indexUniqueProperties(): void {\n for (const [typeId, objectType] of this.objectTypesById) {\n const unique = uniquePropertiesOf(objectType, this.valueTypesById)\n if (unique.length > 0) this.uniqueByTypeId.set(typeId, unique)\n }\n }\n\n /**\n * Build the subtype graph from `extends` and `parents` declarations.\n *\n * Validates that parent types exist and detects circular `extends` chains.\n */\n private validateAndBuildExtendsRegistry(): void {\n const resolving = new Set<string>()\n const resolved = new Set<string>()\n\n const registerChild = (parentId: string, childId: string): void => {\n let children = this.subTypesById.get(parentId)\n if (!children) {\n children = new Set()\n this.subTypesById.set(parentId, children)\n }\n children.add(childId)\n }\n\n const visit = (typeId: string, chain: string[]): void => {\n if (resolved.has(typeId)) return\n\n const objectType = this.objectTypesById.get(typeId)\n if (!objectType || !objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n const parentId = objectType.extends\n\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" extends unknown type \"${parentId}\". If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n\n if (resolving.has(typeId)) {\n throw new OntologyValidationError(\n `Circular extends chain detected: ${[...chain, typeId].join(\" → \")}`\n )\n }\n\n resolving.add(typeId)\n visit(parentId, [...chain, typeId])\n\n registerChild(parentId, typeId)\n\n resolving.delete(typeId)\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n visit(typeId, [])\n }\n\n for (const [typeId, objectType] of this.objectTypesById) {\n if (!objectType.parents) continue\n for (const parentId of objectType.parents) {\n if (parentId === objectType.extends) continue\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" lists unknown parent \"${parentId}\" in parents. If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n registerChild(parentId, typeId)\n }\n }\n }\n\n /**\n * For types with string `extends`, merge parent properties/links\n * and rebuild tokens. Idempotent: no-op if already flattened (codegen case).\n */\n private resolveInheritedProperties(): void {\n const resolved = new Set<string>()\n\n const resolve = (typeId: string): void => {\n if (resolved.has(typeId)) return\n const objectType = this.objectTypesById.get(typeId)!\n\n if (!objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n resolve(objectType.extends)\n const parent = this.objectTypesById.get(objectType.extends)!\n\n const mergeById = <T extends { id: string }>(\n parentItems: readonly T[],\n childItems: readonly T[]\n ): T[] => {\n const childIds = new Set(childItems.map((item) => item.id))\n const fromParent = parentItems.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...childItems]\n }\n\n const mergedProperties = mergeById(parent.properties, objectType.properties)\n const mergedLinks = mergeById(parent.links, objectType.links)\n\n const changed =\n mergedProperties.length !== objectType.properties.length ||\n mergedLinks.length !== objectType.links.length\n\n if (changed) {\n const merged: ObjectType = {\n ...objectType,\n properties: mergedProperties,\n links: mergedLinks,\n }\n const withTokens: ObjectTypeWithPropertyTokens = {\n ...merged,\n p: createPropertyTokenMap(merged),\n }\n ;(withTokens as ObjectTypeWithPropertyTokens & { l: unknown }).l =\n createLinkTokenMap(merged)\n this.objectTypesById.set(typeId, withTokens)\n }\n\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n resolve(typeId)\n }\n }\n}\n",
7
7
  "/**\n * Builder helpers for ontology modeling.\n *\n * These functions provide shorthand for constructing `ObjectType`, `ValueType`,\n * `Interface`, `Property`, `ObjectLink`, and `EnumSchema` values with sensible\n * defaults so you can focus on the semantics rather than boilerplate.\n *\n * ```ts\n * import { defineObjectType, prop, link, stringEnum } from \"@sixb/core\"\n *\n * const thermostat = defineObjectType({\n * id: \"thermostat\",\n * name: \"Thermostat\",\n * properties: [\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * }),\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"])),\n * ],\n * links: [\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" }),\n * ],\n * })\n * ```\n */\n\nimport { markingIdsFrom } from \"../security/builders\"\nimport type { MarkingDefinition } from \"../security/types\"\nimport type { ObjectTypeWithPropertyTokens, ObjectTypeWithTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type {\n EnumSchema,\n Interface,\n LinkCardinality,\n ObjectLink,\n ObjectLinkTargetMetadata,\n ObjectType,\n ObjectVectorSearchProfile,\n Ontology,\n Property,\n PropertyMode,\n PropertyQueryMetadata,\n Schema,\n ValueType,\n ValueTypeRefSchema,\n} from \"./types\"\nimport type { QuantitativeTypeId } from \"./units\"\n\ntype NameFromOptions<TId extends string, TOptions> = TOptions extends {\n name: infer TName extends string\n}\n ? TName\n : TId\n\n/**\n * Preserve literal option values when an option key is provided.\n *\n * Why this exists:\n * - `prop(\"x\", \"string\", { required: true })` should keep `required` as literal `true`\n * (not widen to `boolean`) so downstream inference can treat the field as required.\n */\ntype FieldFromOptions<TOptions, TKey extends string, TFallback> =\n TOptions extends Record<TKey, infer TValue>\n ? { [K in TKey]: TValue }\n : { [K in TKey]?: TFallback }\n\nconst selfLinkTargetObjectTypeId = \"__sixb.self__\"\ntype SelfLinkTargetObjectTypeId = typeof selfLinkTargetObjectTypeId\n\ntype NormalizeSelfLink<TObjectTypeId extends string, TLink> = TLink extends {\n targetObjectTypeId: SelfLinkTargetObjectTypeId\n}\n ? Omit<TLink, \"targetObjectTypeId\"> & { targetObjectTypeId: TObjectTypeId }\n : TLink\n\ntype NormalizeSelfLinks<TObjectTypeId extends string, TLinks extends readonly ObjectLink[]> = {\n -readonly [K in keyof TLinks]: NormalizeSelfLink<TObjectTypeId, TLinks[K]>\n}\n\n// ── Extends type utilities ───────────────────────────────────\n\n/**\n * Merge parent + child collections by id. Uses built-in `Exclude` on\n * the element union — no recursion, no \"excessively deep\" errors.\n */\ntype MergedCollection<\n TParent extends readonly { id: string }[],\n TChild extends readonly { id: string }[],\n> = Array<Exclude<TParent[number], { id: TChild[number][\"id\"] }> | TChild[number]>\n\n/**\n * Extract child's own collection, normalized as a mutable tuple. Falls back to [].\n */\ntype OwnCollection<TInput, TKey extends string, TItem> =\n TInput extends Record<TKey, infer T extends readonly TItem[]> ? [...T] : []\n\ntype OwnLinks<TInput> = TInput extends { id: infer TObjectTypeId extends string }\n ? TInput extends Record<\"links\", infer TLinks extends readonly ObjectLink[]>\n ? NormalizeSelfLinks<TObjectTypeId, TLinks>\n : []\n : []\n\n/**\n * Merge two arrays by id: parent items first, child items override by id.\n */\nfunction mergeById<T extends { id: string }>(parent: readonly T[], child: readonly T[]): T[] {\n const childIds = new Set(child.map((item) => item.id))\n const fromParent = parent.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...child]\n}\n\n// ── Object Type ─────────────────────────────────────────────\n\ntype DefineObjectTypeBase = Omit<ObjectType, \"properties\" | \"links\" | \"extends\" | \"parents\">\n\n/**\n * Structural constraint for the `extends` field.\n *\n * We require only the data needed for merge (id + collections), not the\n * full `ObjectTypeWithTokens<ObjectType>`. The latter requires\n * `LinkTokenMap<ObjectType>` with a `{ [id: string]: LinkToken }` index\n * signature, which is incompatible with the literal-keyed maps produced by\n * concrete `defineObjectType()` calls.\n */\ntype DefineObjectTypeInput = DefineObjectTypeBase & {\n extends?:\n | string\n | {\n readonly id: string\n readonly properties: readonly Property[]\n readonly links: readonly ObjectLink[]\n }\n parents?: readonly string[]\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\n/**\n * Normalize `parents` from readonly tuple to mutable `string[] | undefined`.\n */\ntype NormalizeParents<TInput> = TInput extends { parents: infer P extends readonly string[] }\n ? { parents: [...P] }\n : { parents?: undefined }\n\ntype DefineObjectTypeResult<TInput extends DefineObjectTypeInput> = Omit<\n TInput,\n \"properties\" | \"links\" | \"extends\" | \"parents\"\n> &\n (TInput extends {\n extends: infer TParent extends {\n id: string\n properties: readonly Property[]\n links: readonly ObjectLink[]\n }\n }\n ? NormalizeParents<TInput> & {\n extends: TParent[\"id\"]\n properties: MergedCollection<\n TParent[\"properties\"],\n OwnCollection<TInput, \"properties\", Property>\n >\n links: MergedCollection<TParent[\"links\"], OwnLinks<TInput>>\n }\n : TInput extends { extends: infer TParentId extends string }\n ? {\n extends: TParentId\n parents: string[]\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n }\n : NormalizeParents<TInput> & {\n extends: undefined\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n })\n\ntype DefineObjectTypeWithTokensResult<TInput extends DefineObjectTypeInput> = ObjectTypeWithTokens<\n DefineObjectTypeResult<TInput>\n>\n\n/**\n * Define an object type with sensible defaults.\n *\n * `properties` and `links` default to `[]` so you can define\n * a bare object type with just `id` and `name`.\n */\nexport function defineObjectType<const TInput extends DefineObjectTypeInput>(\n input: TInput\n): DefineObjectTypeWithTokensResult<TInput>\nexport function defineObjectType(input: DefineObjectTypeInput): ObjectTypeWithTokens<ObjectType> {\n const ext = input.extends\n\n const ownProperties = input.properties ? [...input.properties] : []\n const ownLinks = input.links\n ? input.links.map((link) => normalizeSelfLinkTarget(input.id, link))\n : []\n\n let extendsId: string | undefined\n let parentIds: string[] | undefined\n let properties: Property[]\n let links: ObjectLink[]\n\n if (typeof ext === \"string\") {\n // Pre-flattened: string extends — no merge, properties/links taken as-is\n extendsId = ext\n parentIds = [ext, ...(input.parents ?? []).filter((id) => id !== ext)]\n properties = ownProperties\n links = ownLinks\n } else if (ext != null) {\n // Object extends — merge parent collections\n extendsId = ext.id\n parentIds = [ext.id, ...(input.parents ?? []).filter((id) => id !== ext.id)]\n properties = mergeById(ext.properties, ownProperties)\n links = mergeById([...ext.links], ownLinks)\n } else {\n // No extends\n extendsId = undefined\n parentIds = input.parents ? [...input.parents] : undefined\n properties = ownProperties\n links = ownLinks\n }\n\n const objectType: ObjectType = {\n id: input.id,\n name: input.name,\n description: input.description,\n quantityKind: input.quantityKind,\n seeAlso: input.seeAlso,\n extends: extendsId,\n parents: parentIds,\n implements: input.implements,\n properties,\n links,\n search: input.search,\n query: input.query,\n }\n\n return {\n ...objectType,\n l: createLinkTokenMap(objectType),\n p: createPropertyTokenMap(objectType),\n }\n}\n\nfunction normalizeSelfLinkTarget(objectTypeId: string, link: ObjectLink): ObjectLink {\n if (link.targetObjectTypeId !== selfLinkTargetObjectTypeId) {\n return link\n }\n\n return {\n ...link,\n targetObjectTypeId: objectTypeId,\n }\n}\n\n// ── Ontology ────────────────────────────────────────────────\n\ntype DefineOntologyBase = Omit<Ontology, \"objectTypes\" | \"valueTypes\" | \"interfaces\">\n\ntype DefineOntologyInput = DefineOntologyBase & {\n objectTypes?: readonly ObjectType[]\n valueTypes?: readonly ValueType[]\n interfaces?: readonly Interface[]\n}\n\ntype DefineOntologyResult<TInput extends DefineOntologyInput> = Omit<\n TInput,\n \"objectTypes\" | \"valueTypes\" | \"interfaces\"\n> & {\n objectTypes: TInput extends { objectTypes: infer TObjectTypes extends readonly ObjectType[] }\n ? [...TObjectTypes]\n : []\n valueTypes: TInput extends { valueTypes: infer TValueTypes extends readonly ValueType[] }\n ? [...TValueTypes]\n : []\n interfaces: TInput extends { interfaces: infer TInterfaces extends readonly Interface[] }\n ? [...TInterfaces]\n : []\n}\n\n/**\n * Define a complete ontology document.\n *\n * `objectTypes`, `valueTypes`, and `interfaces` default to `[]`.\n */\nexport function defineOntology<const TInput extends DefineOntologyInput>(\n input: TInput\n): DefineOntologyResult<TInput>\nexport function defineOntology(input: DefineOntologyInput): Ontology {\n return {\n ...input,\n objectTypes: input.objectTypes ? [...input.objectTypes] : [],\n valueTypes: input.valueTypes ? [...input.valueTypes] : [],\n interfaces: input.interfaces ? [...input.interfaces] : [],\n }\n}\n\n// ── Value Type ──────────────────────────────────────────────\n\n/**\n * Define a reusable value type.\n *\n * Identity function for type inference and discoverability — the `define*`\n * prefix makes it easy to find all ontology builders.\n */\nexport function defineValueType<const TValueType extends ValueType>(input: TValueType): TValueType {\n return input\n}\n\n// ── Interface ───────────────────────────────────────────────\n\ntype DefineInterfaceBase = Omit<Interface, \"properties\" | \"links\">\n\ntype DefineInterfaceInput = DefineInterfaceBase & {\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\ntype DefineInterfaceResult<TInput extends DefineInterfaceInput> = Omit<\n TInput,\n \"properties\" | \"links\"\n> & {\n properties: TInput extends { properties: infer TProperties extends readonly Property[] }\n ? [...TProperties]\n : []\n links: TInput extends { links: infer TLinks extends readonly ObjectLink[] } ? [...TLinks] : []\n}\n\n/**\n * Define a reusable interface contract.\n *\n * `properties` and `links` default to `[]`.\n */\nexport function defineInterface<const TInput extends DefineInterfaceInput>(\n input: TInput\n): DefineInterfaceResult<TInput>\nexport function defineInterface(input: DefineInterfaceInput): Interface {\n return {\n ...input,\n properties: input.properties ? [...input.properties] : [],\n links: input.links ? [...input.links] : [],\n }\n}\n\n// ── Property shorthand ──────────────────────────────────────\n\ntype PropertyOptions = {\n name?: string\n description?: string\n required?: boolean\n nullable?: boolean\n primary?: true\n /** At most one object of the type holds each value. */\n unique?: true\n mode?: PropertyMode\n semanticType?: QuantitativeTypeId\n query?: PropertyQueryMetadata\n /** Readers need a clearance for every marking to receive this property's value. */\n markings?: readonly MarkingDefinition[]\n}\n\n/** The property records marking ids; only a declared, non-empty list marks it. */\ntype MarkingsFromOptions<TOptions> = TOptions extends {\n markings: readonly [MarkingDefinition, ...MarkingDefinition[]]\n}\n ? { markings: readonly string[] }\n : { markings?: readonly string[] }\n\ntype PropertyResult<\n TId extends string,\n TSchema extends Schema,\n TOptions extends PropertyOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n schema: TSchema\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"required\", boolean> &\n FieldFromOptions<TOptions, \"nullable\", boolean> &\n FieldFromOptions<TOptions, \"primary\", true> &\n FieldFromOptions<TOptions, \"unique\", true> &\n FieldFromOptions<TOptions, \"mode\", PropertyMode> &\n FieldFromOptions<TOptions, \"semanticType\", QuantitativeTypeId> &\n FieldFromOptions<TOptions, \"query\", PropertyQueryMetadata> &\n MarkingsFromOptions<TOptions>\n\n/**\n * Shorthand for creating a {@link Property}.\n *\n * `name` defaults to `id` — override via `options.name` when you need\n * a separate display name.\n *\n * ```ts\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * })\n * ```\n */\n// Overloads keep option literals (e.g. `required: true`, `mode: \"telemetry\"`) intact.\nexport function prop<const TId extends string, const TSchema extends Schema>(\n id: TId,\n schema: TSchema\n): PropertyResult<TId, TSchema, undefined>\nexport function prop<\n const TId extends string,\n const TSchema extends Schema,\n const TOptions extends PropertyOptions,\n>(id: TId, schema: TSchema, options: TOptions): PropertyResult<TId, TSchema, TOptions>\nexport function prop(id: string, schema: Schema, options?: PropertyOptions): Property {\n // Most properties carry no markings: skip the rest copy that only exists to drop the key.\n if (!options || withoutMarkingsKey(options)) {\n return { id, name: options?.name ?? id, schema, ...options }\n }\n\n const { markings, ...rest } = options\n return {\n id,\n name: options?.name ?? id,\n schema,\n ...rest,\n ...(markings && markings.length > 0\n ? { markings: markingIdsFrom(markings, `Property '${id}' markings`) }\n : {}),\n }\n}\n\nfunction withoutMarkingsKey(\n options: PropertyOptions\n): options is PropertyOptions & { markings?: undefined } {\n return !(\"markings\" in options)\n}\n\n// ── Link shorthand ──────────────────────────────────────────\n\n/**\n * Runtime check: does a value look like an ObjectType?\n *\n * Discriminates ObjectType from LinkOptions by checking for `properties` and `links`\n * arrays — ObjectType always has them, LinkOptions never does.\n */\nfunction isObjectTypeLike(value: unknown): value is ObjectType {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Array.isArray((value as Record<string, unknown>).properties) &&\n Array.isArray((value as Record<string, unknown>).links)\n )\n}\n\ntype LinkOptions = {\n name?: string\n description?: string\n cardinality?: LinkCardinality\n properties?: Property[]\n}\n\ntype LinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n targetObjectTypeId: TTargetObjectTypeId\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"cardinality\", LinkCardinality> &\n FieldFromOptions<TOptions, \"properties\", Property[]>\n\nexport type DirectLinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n TTarget,\n> = LinkResult<TId, TTargetObjectTypeId, TOptions> & ObjectLinkTargetMetadata<TTarget>\n\ntype ObjectTypeIdArray<TTargets extends readonly ObjectType[]> = Array<TTargets[number][\"id\"]>\n/** Keep profile names without carrying provider types through every linked declaration. */\nexport type DirectLinkTarget<\n TId extends string,\n TName extends string,\n TProperties extends Property[],\n TVectorProfiles extends string = never,\n> = ObjectTypeWithPropertyTokens<\n {\n id: TId\n name: TName\n properties: TProperties\n links: ObjectLink[]\n } & ([TVectorProfiles] extends [never]\n ? unknown\n : { search: { vectors: Record<TVectorProfiles, ObjectVectorSearchProfile> } })\n>\n\ntype DirectLinkTargetFor<TTarget extends ObjectType> = TTarget extends ObjectTypeWithPropertyTokens\n ? DirectLinkTarget<\n TTarget[\"id\"],\n TTarget[\"name\"],\n TTarget[\"properties\"],\n TTarget extends { search: { vectors: infer TProfiles } }\n ? Extract<keyof TProfiles, string>\n : never\n >\n : TTarget\n\n/**\n * Shorthand for creating an {@link ObjectLink}.\n *\n * `link(...)` accepts direct ObjectType targets and preserves their type for\n * query authoring. Use `link.ref(...)` for id-only references, `link.self(...)`\n * for recursive links, and `link.any(...)` for wildcard links.\n *\n * ```ts\n * // ObjectType target — extracts .id at runtime and preserves the target type\n * link(\"controls\", HVACZone, { cardinality: \"one\" })\n *\n * // Id target — resolved by the generated ontology type manifest\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" })\n *\n * // Self target — normalized to the source object type id by defineObjectType()\n * link.self(\"parent\", { cardinality: \"one\" })\n *\n * // Multiple targets\n * link(\"rel\", [TypeA, TypeB])\n *\n * // Wildcard — accepts any target type\n * link.any(\"anything\")\n * link.any(\"anything\", { cardinality: \"many\" })\n * ```\n */\ninterface LinkCallable {\n <const TId extends string, const TTarget extends ObjectType>(\n id: TId,\n target: TTarget\n ): DirectLinkResult<TId, TTarget[\"id\"], undefined, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTarget extends ObjectType, const TOptions extends LinkOptions>(\n id: TId,\n target: TTarget,\n options: TOptions\n ): DirectLinkResult<TId, TTarget[\"id\"], TOptions, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTargets extends readonly ObjectType[]>(\n id: TId,\n targets: TTargets\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n undefined,\n DirectLinkTargetFor<TTargets[number]>\n >\n\n <\n const TId extends string,\n const TTargets extends readonly ObjectType[],\n const TOptions extends LinkOptions,\n >(\n id: TId,\n targets: TTargets,\n options: TOptions\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n TOptions,\n DirectLinkTargetFor<TTargets[number]>\n >\n}\n\ninterface LinkBuilder extends LinkCallable {\n ref: typeof linkRef\n self: typeof linkSelf\n any: typeof linkAny\n}\n\nconst linkImpl = ((\n id: string,\n targetOrTargets: ObjectType | readonly ObjectType[],\n options?: LinkOptions\n): ObjectLink => {\n if (Array.isArray(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.map((target) => target.id),\n ...options,\n }\n }\n\n if (isObjectTypeLike(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.id,\n ...options,\n }\n }\n\n throw new Error(\n `[Sixb] link(\"${id}\", ...) requires an ObjectType target. Use link.ref(...) for id references, link.self(...) for self-links, or link.any(...) for wildcard links.`\n )\n}) as LinkCallable\n\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n>(id: TId, targetObjectTypeId: TTargetObjectTypeId): LinkResult<TId, TTargetObjectTypeId, undefined>\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n const TOptions extends LinkOptions,\n>(\n id: TId,\n targetObjectTypeId: TTargetObjectTypeId,\n options: TOptions\n): LinkResult<TId, TTargetObjectTypeId, TOptions>\nfunction linkRef(\n id: string,\n targetObjectTypeId: string | readonly string[],\n options?: LinkOptions\n): ObjectLink {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId:\n typeof targetObjectTypeId === \"string\" ? targetObjectTypeId : [...targetObjectTypeId],\n ...options,\n }\n}\n\nfunction linkSelf<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: selfLinkTargetObjectTypeId,\n ...options,\n } as LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions>\n}\n\nfunction linkAny<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, \"*\", TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: \"*\",\n ...options,\n } as LinkResult<TId, \"*\", TOptions>\n}\n\nexport const link: LinkBuilder = Object.assign(linkImpl, {\n ref: linkRef,\n self: linkSelf,\n any: linkAny,\n})\n\n// ── ValueType ref shorthand ─────────────────────────────────\n\n/**\n * Create a value-type reference schema.\n *\n * ```ts\n * prop(\"azimuth\", valueTypeRef(\"bsh:AzimuthShape\"))\n * prop(\"area\", valueTypeRef(AreaShape)) // self-contained, no tuple needed\n * ```\n */\n// 1. String id only (existing behavior, no resolution)\nexport function valueTypeRef<const TId extends string>(\n valueTypeId: TId\n): ValueTypeRefSchema & { valueTypeId: TId }\n// 2. ValueType object (concise, self-contained: carries the schema and the semantic type)\nexport function valueTypeRef<const TVT extends ValueType>(\n valueType: TVT\n): TVT extends { semanticType: infer TSemanticType extends QuantitativeTypeId }\n ? {\n type: \"valueTypeRef\"\n valueTypeId: TVT[\"id\"]\n _resolved: TVT[\"schema\"]\n _semanticType: TSemanticType\n }\n : { type: \"valueTypeRef\"; valueTypeId: TVT[\"id\"]; _resolved: TVT[\"schema\"] }\n// 3. String id + explicit schema (escape hatch)\nexport function valueTypeRef<const TId extends string, const TResolved extends Schema>(\n valueTypeId: TId,\n resolved: TResolved\n): { type: \"valueTypeRef\"; valueTypeId: TId; _resolved: TResolved }\n// Implementation\nexport function valueTypeRef(\n idOrValueType: string | ValueType,\n resolved?: Schema\n): ValueTypeRefSchema {\n if (typeof idOrValueType === \"string\") {\n if (resolved !== undefined) {\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType, _resolved: resolved }\n }\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType }\n }\n return {\n type: \"valueTypeRef\",\n valueTypeId: idOrValueType.id,\n _resolved: idOrValueType.schema,\n ...(idOrValueType.semanticType === undefined\n ? {}\n : { _semanticType: idOrValueType.semanticType }),\n }\n}\n\n// ── Enum helpers ────────────────────────────────────────────\n\n/**\n * Create a string enum schema.\n *\n * ```ts\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"]))\n * ```\n */\nexport function stringEnum<const V extends readonly string[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"string\", values: [...values] }\n}\n\n/**\n * Create an integer enum schema.\n *\n * ```ts\n * prop(\"fanSpeed\", integerEnum([1, 2, 3]))\n * ```\n */\nexport function integerEnum<const V extends readonly number[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"integer\", values: [...values] }\n}\n"
8
8
  ],
9
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAGO,SAAS,sBAAsB,CACpC,UACqD;AAAA,EACrD,MAAM,WAAsD,OAAO,OAAO,IAAI;AAAA,EAC9E,YAAY,MAAM,sBAAsB,OAAO,QAAQ,QAAQ,GAAG;AAAA,IAChE,QAAQ,YAAY,SAAS,eAAe,kBAAkB;AAAA,IAC9D,SAAS,QAAQ,OAAO,OAAO;AAAA,MAC7B,QAAQ,OAAO,OAAO,CAAC,GAAG,kBAAkB,MAAM,CAAC;AAAA,MACnD,OAAO,OAAO,OAAO;AAAA,QACnB;AAAA,QACA;AAAA,QACA,YAAY,OAAO,OAAO;AAAA,UACxB,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA,YAAY,WAAW;AAAA,aACnB,WAAW,YAAY,EAAE,WAAW,WAAW,UAAU,IAAI,CAAC;AAAA,aAC9D,WAAW,iBACX;AAAA,YACE,gBAAgB,OAAO,OAAO;AAAA,cAC5B,MAAM,WAAW,eAAe;AAAA,iBAC5B,WAAW,eAAe,YAAY,Y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M,SAAS,QAAQ;AAAA,IACvB,oBAAoB;AAAA,OACjB;AAAA,EACL;AAAA;AAGF,SAAS,OAGR,CAAC,IAAS,SAAoD;AAAA,EAC7D,OAAO;AAAA,IACL;AAAA,IACA,MAAM,SAAS,QAAQ;AAAA,IACvB,oBAAoB;AAAA,OACjB;AAAA,EACL;AAAA;AAGK,IAAM,QAAoB,OAAO,OAAO,UAAU;AAAA,EACvD,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AACP,CAAC;AAiCM,SAAS,aAAY,CAC1B,eACA,UACoB;AAAA,EACpB,IAAI,OAAO,kBAAkB,UAAU;AAAA,IACrC,IAAI,aAAa,WAAW;AAAA,MAC1B,OAAO,EAAE,MAAM,gBAAgB,aAAa,eAAe,WAAW,SAAS;AAAA,IACjF;AAAA,IACA,OAAO,EAAE,MAAM,gBAAgB,aAAa,cAAc;AAAA,EAC5D;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa,cAAc;AAAA,IAC3B,WAAW,cAAc;AAAA,OACrB,cAAc,iBAAiB,YAC/B,CAAC,IACD,EAAE,eAAe,cAAc,aAAa;AAAA,EAClD;AAAA;AAYK,SAAS,WAA6C,CAC3D,QAGA;AAAA,EACA,OAAO,EAAE,MAAM,QAAQ,WAAW,UAAU,QAAQ,CAAC,GAAG,MAAM,EAAE;AAAA;AAU3D,SAAS,YAA8C,CAC5D,QAGA;AAAA,EACA,OAAO,EAAE,MAAM,QAAQ,WAAW,WAAW,QAAQ,CAAC,GAAG,MAAM,EAAE;AAAA;",
10
10
  "debugId": "DCA83C0C43B81F8864756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -2,7 +2,7 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/projections/types.ts", "../src/storage/projection-runs/types.ts"],
4
4
  "sourcesContent": [
5
- "import type { SixbErrorCode } from \"../errors/types\"\n\n/** Error codes a projection run can persist and expose through its public contract. */\nexport const PROJECTION_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"runtime.cancelled\",\n \"queue.enqueue_failed\",\n \"projection.execution_failed\",\n \"storage.unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type ProjectionRunFailureCode = (typeof PROJECTION_RUN_FAILURE_CODES)[number]\n\n/**\n * Lowered, serializable definition interfaces for projection DSL.\n *\n * These are the runtime-inspectable data structures that projection builders\n * lower into. They use plain string ids (no tokens, no methods) so they can\n * be stored, serialized, and introspected by tooling.\n */\n\n/**\n * Describes how a foreign key column in a dataset resolves to a link target.\n *\n * The source can be either a projected source property or a raw dataset field.\n * Its value equals the target object's primary property value, creating an\n * implicit link between source and target.\n *\n * `targetObjectTypeId` declares the concrete target type for this projection.\n * It must be the same type or a subtype (via `extends`) of the link's declared\n * target at the ontology level. Validation of the subtype relationship happens\n * at Sixb startup (Increment 7), not at DSL build time.\n */\nexport interface ForeignKeyDescriptor {\n readonly linkId: string\n /** Object property holding the target id. Mutually exclusive with sourceField. */\n readonly sourcePropertyId?: string\n /** Dataset column holding the target id. Mutually exclusive with sourcePropertyId. */\n readonly sourceField?: string\n readonly targetObjectTypeId: string\n}\n\n/** Resolves competing source-projection and managed-edit values for projected properties. */\nexport type SourceEditConflictResolution =\n | { readonly strategy: \"editsWin\" }\n | { readonly strategy: \"mostRecent\"; readonly sourceTimestamp: string }\n\n/**\n * Lowered, serializable definition for projecting a dataset into object instances.\n *\n * Each row contributes one complete object root to an authoritative replacement snapshot, with\n * properties mapped from dataset columns to object type properties. Duplicate roots are rejected.\n * FK links are resolved from source property or dataset field values to target object primary\n * values.\n */\nexport interface ObjectProjectionDefinition {\n readonly _tag: \"ObjectProjectionDefinition\"\n readonly id: string\n readonly objectTypeId: string\n readonly datasetId: string\n /** Maps object type property id -> dataset column name. */\n readonly properties: Readonly<Record<string, string>>\n /** Maps link id -> FK descriptor. Empty `{}` when no FK links are projected. */\n readonly links: Readonly<Record<string, ForeignKeyDescriptor>>\n /** Defaults to `editsWin` when omitted by a legacy lowered definition. */\n readonly conflictResolution?: SourceEditConflictResolution\n}\n\n/**\n * Lowered, serializable definition for projecting a join dataset into link instances.\n *\n * Each row in the join dataset contributes one complete link root to an authoritative replacement\n * snapshot, identified by its source, link id, and target. Duplicate roots are rejected.\n */\nexport interface LinkProjectionDefinition {\n readonly _tag: \"LinkProjectionDefinition\"\n readonly id: string\n readonly linkId: string\n readonly sourceObjectTypeId: string\n readonly targetObjectTypeId: string\n readonly datasetId: string\n /** Dataset column holding the source object's primary property value. */\n readonly sourceField: string\n /** Dataset column holding the target object's primary property value. */\n readonly targetField: string\n}\n\n/** Dataset columns that produce one telemetry property value. */\nexport interface TelemetryProjectionPropertyMapping {\n /** Dataset column holding the telemetry value. */\n readonly valueField: string\n /** Dataset column holding the telemetry unit, when the property requires one. */\n readonly unitField?: string\n}\n\n/**\n * Lowered, serializable definition for projecting dataset rows into telemetry history.\n *\n * Each row shares one target object id and observation timestamp, then contributes up to one\n * telemetry point for every mapped property. A property-token projection is lowered to the same\n * shape with one entry, so execution and ownership have one canonical contract.\n */\nexport interface TelemetryProjectionDefinition {\n readonly _tag: \"TelemetryProjectionDefinition\"\n readonly id: string\n readonly objectTypeId: string\n readonly datasetId: string\n /** Dataset column holding the target object's primary id. */\n readonly objectIdField: string\n /** Dataset column holding the telemetry observation timestamp. */\n readonly atField: string\n /** Maps telemetry property id -> value and optional unit dataset columns. */\n readonly properties: Readonly<Record<string, TelemetryProjectionPropertyMapping>>\n}\n\n/** Union of all projection definition types. */\nexport type ProjectionDefinition =\n | ObjectProjectionDefinition\n | LinkProjectionDefinition\n | TelemetryProjectionDefinition\n\nexport interface ProjectionOwnership {\n readonly objects: readonly {\n readonly objectTypeId: string\n readonly existence: boolean\n readonly propertyIds: readonly string[]\n }[]\n readonly links: readonly {\n readonly sourceObjectTypeId: string\n readonly linkId: string\n }[]\n readonly telemetry: readonly {\n readonly objectTypeId: string\n readonly propertyId: string\n }[]\n}\n\n/** Canonical correlation between a projection kind and its materialization protocol. */\nexport type ProjectionProtocolIdentity =\n | { readonly projectionKind: \"object\"; readonly protocol: \"replacement\" }\n | { readonly projectionKind: \"link\"; readonly protocol: \"replacement\" }\n | { readonly projectionKind: \"telemetry\"; readonly protocol: \"telemetry\" }\n\nexport type ProjectionKind = ProjectionProtocolIdentity[\"projectionKind\"]\n\nexport interface ObjectProjectionTarget {\n readonly objectTypeId: string\n}\n\nexport interface LinkProjectionTarget {\n readonly sourceObjectTypeId: string\n readonly targetObjectTypeId: string\n}\n\nexport interface ProjectionTargetByKind {\n readonly object: ObjectProjectionTarget\n readonly link: LinkProjectionTarget\n readonly telemetry: ObjectProjectionTarget\n}\n\n/** Object types affected by one projection, correlated with its projection kind. */\nexport type ProjectionTarget<TKind extends ProjectionKind = ProjectionKind> =\n ProjectionTargetByKind[TKind]\n\n/**\n * Frozen semantic identity used to dispatch one registered projection.\n *\n * Dataset version metadata is attached only when a committed dataset event is routed. Keeping the\n * registry-owned fields together prevents the orchestrator from recomputing ontology semantics.\n */\nexport type ProjectionDispatchDescriptor = ProjectionDispatchDescriptorBase &\n ProjectionProtocolIdentity\n\ninterface ProjectionDispatchDescriptorBase {\n readonly projectionId: string\n readonly datasetId: string\n readonly ontologyRevision: string\n readonly projectionRevision: string\n readonly ownershipHash: string\n}\n\nexport interface ResolvedProjection<TDefinition extends ProjectionDefinition> {\n readonly projectionId: string\n readonly datasetId: string\n /** The part of the ontology this projection reads; see `computeProjectionOntologyRevision`. */\n readonly ontologyRevision: string\n readonly projectionRevision: string\n readonly ownershipHash: string\n readonly ownership: ProjectionOwnership\n readonly definition: TDefinition\n}\n",
5
+ "import type { SixbErrorCode } from \"../errors/types\"\n\n/** Error codes a projection run can persist and expose through its public contract. */\nexport const PROJECTION_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"runtime.cancelled\",\n \"queue.enqueue_failed\",\n \"projection.execution_failed\",\n \"storage.unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type ProjectionRunFailureCode = (typeof PROJECTION_RUN_FAILURE_CODES)[number]\n\n/**\n * Lowered, serializable definition interfaces for projection DSL.\n *\n * These are the runtime-inspectable data structures that projection builders\n * lower into. They use plain string ids (no tokens, no methods) so they can\n * be stored, serialized, and introspected by tooling.\n */\n\n/**\n * Describes how a foreign key column in a dataset resolves to a link target.\n *\n * The source can be either a projected source property or a raw dataset field.\n * Its value equals the target object's primary property value, creating an\n * implicit link between source and target.\n *\n * `targetObjectTypeId` declares the concrete target type for this projection.\n * It must be the same type or a subtype (via `extends`) of the link's declared\n * target at the ontology level. Validation of the subtype relationship happens\n * at Sixb startup (Increment 7), not at DSL build time.\n */\nexport interface ForeignKeyDescriptor {\n readonly linkId: string\n /** Object property holding the target id. Mutually exclusive with sourceField. */\n readonly sourcePropertyId?: string\n /** Dataset column holding the target id. Mutually exclusive with sourcePropertyId. */\n readonly sourceField?: string\n readonly targetObjectTypeId: string\n}\n\n/** What a column mapped to a `ref.user()` property identifies its member by. */\nexport type ProjectionUserKey = \"email\"\n\n/** Resolves competing source-projection and managed-edit values for projected properties. */\nexport type SourceEditConflictResolution =\n | { readonly strategy: \"editsWin\" }\n | { readonly strategy: \"mostRecent\"; readonly sourceTimestamp: string }\n\n/**\n * Lowered, serializable definition for projecting a dataset into object instances.\n *\n * Each row contributes one complete object root to an authoritative replacement snapshot, with\n * properties mapped from dataset columns to object type properties. Duplicate roots are rejected.\n * FK links are resolved from source property or dataset field values to target object primary\n * values.\n */\nexport interface ObjectProjectionDefinition {\n readonly _tag: \"ObjectProjectionDefinition\"\n readonly id: string\n readonly objectTypeId: string\n readonly datasetId: string\n /** Maps object type property id -> dataset column name. */\n readonly properties: Readonly<Record<string, string>>\n /**\n * The `ref.user()` properties whose column names a member: property id -> what the column holds.\n * The property stores that member's reference. Omitted when the projection maps no users.\n */\n readonly users?: Readonly<Record<string, ProjectionUserKey>>\n /** Maps link id -> FK descriptor. Empty `{}` when no FK links are projected. */\n readonly links: Readonly<Record<string, ForeignKeyDescriptor>>\n /** Defaults to `editsWin` when omitted by a legacy lowered definition. */\n readonly conflictResolution?: SourceEditConflictResolution\n}\n\n/**\n * Lowered, serializable definition for projecting a join dataset into link instances.\n *\n * Each row in the join dataset contributes one complete link root to an authoritative replacement\n * snapshot, identified by its source, link id, and target. Duplicate roots are rejected.\n */\nexport interface LinkProjectionDefinition {\n readonly _tag: \"LinkProjectionDefinition\"\n readonly id: string\n readonly linkId: string\n readonly sourceObjectTypeId: string\n readonly targetObjectTypeId: string\n readonly datasetId: string\n /** Dataset column holding the source object's primary property value. */\n readonly sourceField: string\n /** Dataset column holding the target object's primary property value. */\n readonly targetField: string\n}\n\n/** Dataset columns that produce one telemetry property value. */\nexport interface TelemetryProjectionPropertyMapping {\n /** Dataset column holding the telemetry value. */\n readonly valueField: string\n /** Dataset column holding the telemetry unit, when the property requires one. */\n readonly unitField?: string\n}\n\n/**\n * Lowered, serializable definition for projecting dataset rows into telemetry history.\n *\n * Each row shares one target object id and observation timestamp, then contributes up to one\n * telemetry point for every mapped property. A property-token projection is lowered to the same\n * shape with one entry, so execution and ownership have one canonical contract.\n */\nexport interface TelemetryProjectionDefinition {\n readonly _tag: \"TelemetryProjectionDefinition\"\n readonly id: string\n readonly objectTypeId: string\n readonly datasetId: string\n /** Dataset column holding the target object's primary id. */\n readonly objectIdField: string\n /** Dataset column holding the telemetry observation timestamp. */\n readonly atField: string\n /** Maps telemetry property id -> value and optional unit dataset columns. */\n readonly properties: Readonly<Record<string, TelemetryProjectionPropertyMapping>>\n}\n\n/** Union of all projection definition types. */\nexport type ProjectionDefinition =\n | ObjectProjectionDefinition\n | LinkProjectionDefinition\n | TelemetryProjectionDefinition\n\nexport interface ProjectionOwnership {\n readonly objects: readonly {\n readonly objectTypeId: string\n readonly existence: boolean\n readonly propertyIds: readonly string[]\n }[]\n readonly links: readonly {\n readonly sourceObjectTypeId: string\n readonly linkId: string\n }[]\n readonly telemetry: readonly {\n readonly objectTypeId: string\n readonly propertyId: string\n }[]\n}\n\n/** Canonical correlation between a projection kind and its materialization protocol. */\nexport type ProjectionProtocolIdentity =\n | { readonly projectionKind: \"object\"; readonly protocol: \"replacement\" }\n | { readonly projectionKind: \"link\"; readonly protocol: \"replacement\" }\n | { readonly projectionKind: \"telemetry\"; readonly protocol: \"telemetry\" }\n\nexport type ProjectionKind = ProjectionProtocolIdentity[\"projectionKind\"]\n\nexport interface ObjectProjectionTarget {\n readonly objectTypeId: string\n}\n\nexport interface LinkProjectionTarget {\n readonly sourceObjectTypeId: string\n readonly targetObjectTypeId: string\n}\n\nexport interface ProjectionTargetByKind {\n readonly object: ObjectProjectionTarget\n readonly link: LinkProjectionTarget\n readonly telemetry: ObjectProjectionTarget\n}\n\n/** Object types affected by one projection, correlated with its projection kind. */\nexport type ProjectionTarget<TKind extends ProjectionKind = ProjectionKind> =\n ProjectionTargetByKind[TKind]\n\n/**\n * Frozen semantic identity used to dispatch one registered projection.\n *\n * Dataset version metadata is attached only when a committed dataset event is routed. Keeping the\n * registry-owned fields together prevents the orchestrator from recomputing ontology semantics.\n */\nexport type ProjectionDispatchDescriptor = ProjectionDispatchDescriptorBase &\n ProjectionProtocolIdentity\n\ninterface ProjectionDispatchDescriptorBase {\n readonly projectionId: string\n readonly datasetId: string\n readonly ontologyRevision: string\n readonly projectionRevision: string\n readonly ownershipHash: string\n}\n\nexport interface ResolvedProjection<TDefinition extends ProjectionDefinition> {\n readonly projectionId: string\n readonly datasetId: string\n /** The part of the ontology this projection reads; see `computeProjectionOntologyRevision`. */\n readonly ontologyRevision: string\n readonly projectionRevision: string\n readonly ownershipHash: string\n readonly ownership: ProjectionOwnership\n readonly definition: TDefinition\n}\n",
6
6
  "import type { SixbFailure } from \"../../errors/types\"\nimport type {\n PinnedDatasetVersion,\n ProjectionExecution,\n ProjectionMaterializationIdentity,\n ProjectionRunTerminalDecision,\n} from \"../../materialization/model\"\nimport type {\n LinkProjectionTarget,\n ObjectProjectionTarget,\n ProjectionKind,\n ProjectionRunFailureCode,\n ProjectionTarget,\n} from \"../../projections/types\"\n\nexport type { ProjectionRunFailureCode } from \"../../projections/types\"\nexport { PROJECTION_RUN_FAILURE_CODES } from \"../../projections/types\"\n\n/**\n * `superseded` ends a replacement run whose output would be stale on arrival: a run of the same\n * projection pinned to a later dataset version exists and has not failed. Telemetry runs append\n * readings rather than replace a source, so none is ever superseded.\n */\nexport type ProjectionRunStatus =\n | \"queued\"\n | \"running\"\n | \"succeeded\"\n | \"failed\"\n | \"cancelled\"\n | \"superseded\"\n\nexport interface ProjectionRunProgress {\n /** Physical immutable-version rows consumed, before normalization or semantic materialization. */\n readonly sourceRowsRead: number\n /** Physical rows intentionally skipped because a required mapped value was blank. */\n readonly sourceRowsSkipped: number\n /** Maximum complete change records consumed by one incremental attempt; not a recovery cursor. */\n readonly sourceChangesRead?: number\n}\n\nconst progressKeyFlags: Record<keyof ProjectionRunProgress, true> = {\n sourceRowsRead: true,\n sourceRowsSkipped: true,\n sourceChangesRead: true,\n}\n\nexport const PROJECTION_RUN_PROGRESS_KEYS = Object.keys(\n progressKeyFlags\n) as readonly (keyof ProjectionRunProgress)[]\n\nexport function zeroProjectionRunProgress(): ProjectionRunProgress {\n return { sourceRowsRead: 0, sourceRowsSkipped: 0 }\n}\n\nexport interface ProjectionTelemetryCheckpoint {\n readonly fixedBatchSize: number\n readonly nextBatchOrdinal: number\n readonly nextRowOffset: number\n readonly inputExhausted: boolean\n}\n\n/**\n * The object a telemetry batch is waiting for, and when this run first found it missing.\n *\n * A projection's dataset can legitimately be materialized before the objects it references, so\n * the run waits instead of failing. The wait needs a start, and the run has no other durable one:\n * `startedAt` is when the run began, which on a batched projection is long before the batch that\n * cannot commit, and `attempt` counts every reclaim including the ones an unreachable queue caused.\n *\n * Cleared by any committed batch, so a run that is making progress never carries a stale wait.\n */\nexport interface ProjectionMissingTarget {\n readonly objectTypeId: string\n readonly objectId: string\n /** The batch that could not commit because of it. */\n readonly batchOrdinal: number\n readonly firstSeenAt: Date\n}\n\ninterface ProjectionRunRecordBase {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly status: ProjectionRunStatus\n readonly attempt: number\n readonly progress: ProjectionRunProgress\n readonly queuedAt: Date\n readonly startedAt?: Date\n readonly finishedAt?: Date\n /**\n * The run's most recent failure, read with its status: on a `running` run, why its last attempt\n * failed while the queue retries it; on a `failed` or `cancelled` run, why it ended. Cleared when\n * the run succeeds or is superseded, so a present error always describes something current.\n */\n readonly error?: SixbFailure<ProjectionRunFailureCode>\n}\n\ntype ProjectionIdentity<TKind extends ProjectionKind> = Extract<\n ProjectionMaterializationIdentity,\n { readonly projectionKind: TKind }\n>\n\nexport type ObjectProjectionRunRecord = ProjectionRunRecordBase & {\n readonly identity: ProjectionIdentity<\"object\">\n readonly target: ObjectProjectionTarget\n readonly telemetryCheckpoint?: never\n readonly missingTarget?: never\n}\n\nexport type LinkProjectionRunRecord = ProjectionRunRecordBase & {\n readonly identity: ProjectionIdentity<\"link\">\n readonly target: LinkProjectionTarget\n readonly telemetryCheckpoint?: never\n readonly missingTarget?: never\n}\n\nexport type TelemetryProjectionRunRecord = ProjectionRunRecordBase & {\n readonly identity: ProjectionIdentity<\"telemetry\">\n readonly target: ObjectProjectionTarget\n readonly telemetryCheckpoint: ProjectionTelemetryCheckpoint\n /**\n * Only telemetry carries this: `MaterializationObjectNotFoundError` is raised by telemetry\n * validation alone, and only a batched protocol has a checkpoint to anchor the wait to.\n */\n readonly missingTarget?: ProjectionMissingTarget\n}\n\n/** Durable projection lifecycle state. The execution token is deliberately returned separately. */\nexport type ProjectionRunRecord =\n | ObjectProjectionRunRecord\n | LinkProjectionRunRecord\n | TelemetryProjectionRunRecord\n\nexport function projectionRunObjectTypesVisible(\n run: ProjectionRunRecord,\n canView: (objectTypeId: string) => boolean\n): boolean {\n const target: ProjectionTarget = run.target\n if (\"sourceObjectTypeId\" in target) {\n return canView(target.sourceObjectTypeId) && canView(target.targetObjectTypeId)\n }\n return canView(target.objectTypeId)\n}\n\ninterface ProjectionRunAdmissionBase {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly queuedAt?: Date\n}\n\nexport type QueueProjectionRunInput =\n | (ProjectionRunAdmissionBase & {\n readonly identity: ProjectionIdentity<\"object\">\n readonly target: ObjectProjectionRunRecord[\"target\"]\n readonly fixedBatchSize?: never\n })\n | (ProjectionRunAdmissionBase & {\n readonly identity: ProjectionIdentity<\"link\">\n readonly target: LinkProjectionRunRecord[\"target\"]\n readonly fixedBatchSize?: never\n })\n | (ProjectionRunAdmissionBase & {\n readonly identity: ProjectionIdentity<\"telemetry\">\n readonly target: TelemetryProjectionRunRecord[\"target\"]\n readonly fixedBatchSize: number\n })\n\nexport type StartOrReclaimProjectionRunInput = QueueProjectionRunInput extends infer TInput\n ? TInput extends QueueProjectionRunInput\n ? Omit<TInput, \"executionId\" | \"queuedAt\"> & { readonly startedAt?: Date }\n : never\n : never\n\nexport interface FailProjectionRunEnqueueInput {\n readonly id: string\n readonly projectId: string\n readonly finishedAt?: Date\n readonly error: SixbFailure<ProjectionRunFailureCode>\n}\n\nexport interface ProjectionRunClaim {\n readonly run: ProjectionRunRecord\n readonly execution: ProjectionExecution\n}\n\nexport interface LockProjectionRunForMaterializationInput {\n readonly id: string\n readonly projectId: string\n readonly executionToken: string\n readonly identity: ProjectionMaterializationIdentity\n}\n\nexport interface UpdateProjectionRunInput extends LockProjectionRunForMaterializationInput {\n readonly progress: Partial<ProjectionRunProgress>\n}\n\nexport type FinishProjectionRunInput = ProjectionRunTerminalDecision &\n LockProjectionRunForMaterializationInput & {\n readonly finishedAt?: Date\n readonly progress?: Partial<ProjectionRunProgress>\n }\n\nexport interface AdvanceProjectionTelemetryCheckpointInput\n extends LockProjectionRunForMaterializationInput {\n /** Must equal the run's current nextBatchOrdinal. */\n readonly batchOrdinal: number\n /** Physical dataset rows consumed by this batch, including skipped rows. */\n readonly batchRowCount: number\n /** Physical rows intentionally skipped inside this batch. */\n readonly batchRowsSkipped: number\n /** True when this batch consumed the final row of the immutable dataset version. */\n readonly inputExhausted: boolean\n}\n\nexport interface RecordProjectionMissingTargetInput\n extends LockProjectionRunForMaterializationInput {\n readonly missingTarget: ProjectionMissingTarget\n}\n\nexport interface RecordProjectionAttemptFailureInput\n extends LockProjectionRunForMaterializationInput {\n readonly error: SixbFailure<ProjectionRunFailureCode>\n}\n\nexport interface FindSupersedingProjectionRunInput {\n readonly projectId: string\n /** The run that may be superseded. */\n readonly id: string\n}\n\nexport interface ListProjectionRunsInput {\n readonly projectId: string\n readonly projectionId?: string\n readonly projectionKind?: ProjectionKind\n readonly datasetId?: string\n readonly datasetVersionId?: string\n /**\n * Viewable object type ids. A run is included only if every target type is present. Omit for an\n * unrestricted internal execution; an empty set matches no runs.\n */\n readonly objectTypeIds?: readonly string[]\n readonly statuses?: readonly ProjectionRunStatus[]\n /** Runs whose recorded `error` has one of these codes; an empty set matches no runs. */\n readonly errorCodes?: readonly ProjectionRunFailureCode[]\n readonly startedAfter?: Date\n readonly startedBefore?: Date\n readonly limit?: number\n readonly offset?: number\n readonly order?: \"asc\" | \"desc\"\n}\n\nexport interface ListProjectionRunsResult {\n readonly runs: readonly ProjectionRunRecord[]\n readonly hasMore: boolean\n readonly total: number\n}\n\nexport interface ListLatestProjectionRunsInput {\n readonly projectId: string\n readonly projectionIds: readonly string[]\n}\n\nexport interface ListLatestProjectionRunsResult {\n readonly runs: readonly ProjectionRunRecord[]\n}\n\nexport interface ProjectionRunStorage {\n queue(input: QueueProjectionRunInput): Promise<ProjectionRunRecord>\n startOrReclaim(input: StartOrReclaimProjectionRunInput): Promise<ProjectionRunClaim>\n failEnqueue(input: FailProjectionRunEnqueueInput): Promise<ProjectionRunRecord>\n /** Transactionally fences the current execution before ontology materialization writes. */\n lockForMaterialization(\n input: LockProjectionRunForMaterializationInput\n ): Promise<ProjectionRunRecord>\n /** Updates physical source progress only. */\n update(input: UpdateProjectionRunInput): Promise<ProjectionRunRecord>\n /**\n * Advances telemetry progress atomically with the corresponding ontology commit.\n *\n * Clears any recorded missing target: a batch that commits is a batch that was not waiting.\n */\n advanceTelemetryCheckpoint(\n input: AdvanceProjectionTelemetryCheckpointInput\n ): Promise<TelemetryProjectionRunRecord>\n /** Records the object a telemetry batch is waiting for, so the wait has a durable start. */\n recordMissingTarget(\n input: RecordProjectionMissingTargetInput\n ): Promise<TelemetryProjectionRunRecord>\n /**\n * Records the failure of the current attempt as the `error` of a run that stays `running` to be\n * retried. Fenced like every other write: a delivery that lost the run cannot overwrite the\n * failure of the one that holds it now. A reclaim keeps it until the run ends.\n */\n recordAttemptFailure(input: RecordProjectionAttemptFailureInput): Promise<ProjectionRunRecord>\n /** Telemetry success also records the worker's EOF observation atomically. */\n finish(input: FinishProjectionRunInput): Promise<ProjectionRunRecord>\n /**\n * The newest replacement run of the same projection that makes this one stale: pinned to a\n * later dataset version, and queued, running, or succeeded. A failed or cancelled run replaces\n * nothing, so it supersedes nothing either. Null for a telemetry run.\n */\n findSupersedingRun(input: FindSupersedingProjectionRunInput): Promise<ProjectionRunRecord | null>\n getById(params: { projectId: string; id: string }): Promise<ProjectionRunRecord | null>\n list(input: ListProjectionRunsInput): Promise<ListProjectionRunsResult>\n /** Superseded runs are skipped: the run that superseded them is the one that matters. */\n listLatestByProjectionIds(\n input: ListLatestProjectionRunsInput\n ): Promise<ListLatestProjectionRunsResult>\n}\n\nexport type {\n LinkProjectionTarget,\n ObjectProjectionTarget,\n PinnedDatasetVersion,\n ProjectionExecution,\n ProjectionKind,\n ProjectionMaterializationIdentity,\n ProjectionTarget,\n}\n"
7
7
  ],
8
8
  "mappings": ";;AAGO,IAAM,gCAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AC+BA,IAAM,mBAA8D;AAAA,EAClE,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB;AAEO,IAAM,gCAA+B,OAAO,KACjD,gBACF;AAEO,SAAS,0BAAyB,GAA0B;AAAA,EACjE,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE;AAAA;AAkF5C,SAAS,gCAA+B,CAC7C,KACA,SACS;AAAA,EACT,MAAM,SAA2B,IAAI;AAAA,EACrC,IAAI,wBAAwB,QAAQ;AAAA,IAClC,OAAO,QAAQ,OAAO,kBAAkB,KAAK,QAAQ,OAAO,kBAAkB;AAAA,EAChF;AAAA,EACA,OAAO,QAAQ,OAAO,YAAY;AAAA;",
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  principalsEqual2
4
- } from "./chunk-gqm0b7vd.js";
4
+ } from "./chunk-8v6xzwgr.js";
5
5
  import {
6
6
  createFileUploadId2,
7
7
  isFileUploadSessionExpired,
@@ -5,7 +5,7 @@
5
5
  "/**\n * Transport-agnostic reasons a file upload session operation can fail. Mapping a\n * reason to an HTTP status (or any other transport) is the responsibility of the\n * boundary that surfaces it, not of core.\n */\nexport type FileUploadSessionErrorReason =\n | \"not_found\"\n | \"expired\"\n | \"already_completed\"\n | \"already_aborted\"\n\n/**\n * Error for file upload session invariants and invalid state transitions.\n */\nexport class FileUploadSessionError extends Error {\n readonly name = \"FileUploadSessionError\"\n\n constructor(\n readonly reason: FileUploadSessionErrorReason,\n message: string\n ) {\n super(message)\n }\n}\n",
6
6
  "import { type Principal, principalsEqual } from \"../../auth\"\nimport type { FileRef, SignedBlobUploadPart } from \"../../blob-storage\"\nimport { FileUploadSessionError } from \"./errors\"\nimport type {\n CreateFileUploadSessionInput,\n FileUploadSession,\n FileUploadSessionStore,\n FileUploadStatus,\n FileUploadStrategy,\n ListAbandonedFileUploadSessionsInput,\n} from \"./types\"\nimport {\n createFileUploadId,\n isFileUploadSessionExpired,\n isTerminalFileUploadSessionExpired,\n} from \"./utils\"\n\nexport { fileUploadSessionReapAt } from \"./utils\"\n\n/** Database-specific row access used by the shared upload session state machine. */\nexport interface FileUploadSessionPersistence {\n now(): Promise<Date>\n /** Returns false when the id already exists. */\n insert(session: FileUploadSession): Promise<boolean>\n /** Inside `transaction`, must lock the row until the transaction ends. */\n get(uploadId: string): Promise<FileUploadSession | null>\n update(session: FileUploadSession): Promise<void>\n /** The project's `pending` rows holding a provider upload, `expires_at <= now`, oldest first. */\n listAbandoned(input: ListAbandonedFileUploadSessionsInput): Promise<readonly FileUploadSession[]>\n /** Deletes rows whose persisted `fileUploadSessionReapAt` is `<= now`. */\n deleteReapable(now: Date): Promise<number>\n}\n\n/** Transaction and lock boundary supplied by a concrete durable storage provider. */\nexport interface FileUploadSessionPersistenceBackend {\n read<T>(run: (persistence: FileUploadSessionPersistence) => Promise<T>): Promise<T>\n transaction<T>(run: (persistence: FileUploadSessionPersistence) => Promise<T>): Promise<T>\n}\n\n/**\n * Shared durable implementation of the upload session lifecycle. Concrete providers own SQL,\n * transactions and database time; every transition and retention rule lives here so SQLite,\n * PostgreSQL and the in-memory reference cannot drift semantically.\n *\n * Every method is `async`: a storage's operation-scoped facade serializes only async methods, and\n * a plain Promise-returning method would bypass it and join whatever SQLite transaction is open.\n */\nexport class DurableFileUploadSessions implements FileUploadSessionStore {\n constructor(private readonly backend: FileUploadSessionPersistenceBackend) {}\n\n async create(input: CreateFileUploadSessionInput): Promise<FileUploadSession> {\n return this.backend.transaction(async (persistence) => {\n const session: FileUploadSession = {\n id: input.id ?? createFileUploadId(),\n projectId: input.projectId,\n principal: input.principal,\n strategy: input.strategy,\n status: \"pending\",\n ...(input.fileName === undefined ? {} : { fileName: input.fileName }),\n ...(input.mediaType === undefined ? {} : { mediaType: input.mediaType }),\n ...(input.logicalPath === undefined ? {} : { logicalPath: input.logicalPath }),\n ...(input.expectedSizeBytes === undefined\n ? {}\n : { expectedSizeBytes: input.expectedSizeBytes }),\n ...(input.expectedDigest === undefined ? {} : { expectedDigest: input.expectedDigest }),\n ...(input.providerUpload === undefined ? {} : { providerUpload: input.providerUpload }),\n signedParts: [],\n createdAt: await persistence.now(),\n expiresAt: input.expiresAt,\n }\n\n if (!(await persistence.insert(session))) {\n throw new Error(`[Sixb] File upload session '${session.id}' already exists.`)\n }\n return session\n })\n }\n\n async getForPrincipal(uploadId: string, principal: Principal): Promise<FileUploadSession> {\n return this.backend.read(async (persistence) => {\n const session = await persistence.get(uploadId)\n if (!session || !principalsEqual(session.principal, principal)) {\n throw new FileUploadSessionError(\"not_found\", \"File upload session not found.\")\n }\n\n const nowMs = (await persistence.now()).getTime()\n if (isFileUploadSessionExpired(session, nowMs)) {\n throw new FileUploadSessionError(\"expired\", \"File upload session has expired.\")\n }\n if (isTerminalFileUploadSessionExpired(session, nowMs)) {\n throw new FileUploadSessionError(\"not_found\", \"File upload session not found.\")\n }\n return session\n })\n }\n\n async markUploaded(uploadId: string, fileRef: FileRef): Promise<FileUploadSession> {\n return this.transition(uploadId, (session) => ({ ...session, fileRef }))\n }\n\n async addSignedPart(uploadId: string, part: SignedBlobUploadPart): Promise<FileUploadSession> {\n return this.transition(uploadId, (session) => ({\n ...session,\n signedParts: [\n ...session.signedParts.filter((candidate) => candidate.partNumber !== part.partNumber),\n part,\n ].sort((left, right) => left.partNumber - right.partNumber),\n }))\n }\n\n async complete(uploadId: string, fileRef: FileRef): Promise<FileUploadSession> {\n return this.transition(uploadId, (session, now) => ({\n ...session,\n status: \"completed\",\n fileRef,\n completedAt: now,\n }))\n }\n\n async abort(uploadId: string): Promise<FileUploadSession> {\n return this.transition(uploadId, (session, now) => ({\n ...session,\n status: \"aborted\",\n abortedAt: now,\n }))\n }\n\n async listAbandoned(\n input: ListAbandonedFileUploadSessionsInput\n ): Promise<readonly FileUploadSession[]> {\n if (input.projectId.trim().length === 0) {\n throw new Error(\"[Sixb] File upload session listAbandoned projectId must not be blank.\")\n }\n if (!Number.isSafeInteger(input.limit) || input.limit <= 0) {\n throw new Error(\"[Sixb] File upload session listAbandoned limit must be a positive integer.\")\n }\n return this.backend.read((persistence) => persistence.listAbandoned(input))\n }\n\n async cleanupExpired(now?: Date): Promise<number> {\n return this.backend.transaction(async (persistence) =>\n persistence.deleteReapable(now ?? (await persistence.now()))\n )\n }\n\n private transition(\n uploadId: string,\n next: (session: FileUploadSession, now: Date) => FileUploadSession\n ): Promise<FileUploadSession> {\n return this.backend.transaction(async (persistence) => {\n const session = await persistence.get(uploadId)\n if (!session) {\n throw new FileUploadSessionError(\"not_found\", \"File upload session not found.\")\n }\n if (session.status !== \"pending\") {\n throw new FileUploadSessionError(\n session.status === \"completed\" ? \"already_completed\" : \"already_aborted\",\n `File upload session is already ${session.status}.`\n )\n }\n\n const updated = next(session, await persistence.now())\n await persistence.update(updated)\n return updated\n })\n }\n}\n\nconst STRATEGIES: readonly FileUploadStrategy[] = [\"server\", \"direct-put\", \"multipart\"]\nconst STATUSES: readonly FileUploadStatus[] = [\"pending\", \"completed\", \"aborted\"]\nconst PRINCIPAL_TYPES: readonly Principal[\"type\"][] = [\"user\", \"serviceAccount\", \"system\"]\n\n/**\n * Rebuilds a session from a provider row. JSON columns may arrive parsed (jsonb) or as text\n * (SQLite); nested `expiresAt` values are revived and every other nested field passes through,\n * so blob providers can extend `providerUpload` without a migration. Fails closed on corruption.\n */\nexport function parseFileUploadSessionRow(row: {\n readonly [column: string]: unknown\n}): FileUploadSession {\n const id = text(row.id, \"id\", String(row.id))\n const strategy = text(row.strategy, \"strategy\", id) as FileUploadStrategy\n const status = text(row.status, \"status\", id) as FileUploadStatus\n if (!STRATEGIES.includes(strategy)) throw corrupt(id, `unknown strategy '${strategy}'`)\n if (!STATUSES.includes(status)) throw corrupt(id, `unknown status '${status}'`)\n const principalType = text(row.ownerPrincipalType, \"ownerPrincipalType\", id)\n if (!PRINCIPAL_TYPES.includes(principalType as Principal[\"type\"])) {\n throw corrupt(id, `unknown owner principal type '${principalType}'`)\n }\n\n const providerUpload = json(row.providerUpload)\n const fileRef = json(row.fileRef)\n const signedParts = json(row.signedParts)\n if (!Array.isArray(signedParts)) throw corrupt(id, \"signedParts is not an array\")\n\n const optional = <T>(key: string, value: T | null | undefined) =>\n value === null || value === undefined ? {} : { [key]: value }\n\n return {\n id,\n projectId: text(row.projectId, \"projectId\", id),\n principal: {\n type: principalType as Principal[\"type\"],\n id: text(row.ownerPrincipalId, \"ownerPrincipalId\", id),\n },\n strategy,\n status,\n ...optional(\"fileName\", row.fileName as string | null),\n ...optional(\"mediaType\", row.mediaType as string | null),\n ...optional(\"logicalPath\", row.logicalPath as string | null),\n ...optional(\n \"expectedSizeBytes\",\n row.expectedSizeBytes === null || row.expectedSizeBytes === undefined\n ? null\n : Number(row.expectedSizeBytes)\n ),\n ...optional(\"expectedDigest\", row.expectedDigest as string | null),\n ...optional(\n \"providerUpload\",\n providerUpload === null ? null : withExpiresAt(providerUpload, id)\n ),\n signedParts: signedParts.map((part) => withExpiresAt(part, id)) as SignedBlobUploadPart[],\n ...optional(\"fileRef\", fileRef as FileRef | null),\n createdAt: date(row.createdAt, \"createdAt\", id),\n expiresAt: date(row.expiresAt, \"expiresAt\", id),\n ...optional(\n \"completedAt\",\n row.completedAt == null ? null : date(row.completedAt, \"completedAt\", id)\n ),\n ...optional(\"abortedAt\", row.abortedAt == null ? null : date(row.abortedAt, \"abortedAt\", id)),\n } as FileUploadSession\n}\n\nfunction json(value: unknown): unknown {\n return typeof value === \"string\" ? JSON.parse(value) : (value ?? null)\n}\n\nfunction withExpiresAt<T>(value: unknown, id: string): T {\n if (typeof value !== \"object\" || value === null)\n throw corrupt(id, \"nested record is not an object\")\n const record = value as Record<string, unknown>\n return { ...record, expiresAt: date(record.expiresAt, \"nested expiresAt\", id) } as T\n}\n\nfunction text(value: unknown, column: string, id: string): string {\n if (typeof value !== \"string\" || value.length === 0) throw corrupt(id, `${column} is not text`)\n return value\n}\n\nfunction date(value: unknown, column: string, id: string): Date {\n const parsed = value instanceof Date || typeof value === \"string\" ? new Date(value) : null\n if (!parsed || !Number.isFinite(parsed.getTime())) throw corrupt(id, `${column} is not a date`)\n return parsed\n}\n\nfunction corrupt(id: string, reason: string): Error {\n return new Error(`[Sixb] Stored file upload session '${id}' is invalid: ${reason}.`)\n}\n"
7
7
  ],
8
- "mapp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,GAAG,sBAAsB;AAAA,EAC9F,OAAO;AAAA;AAGT,SAAS,OAAO,CAAC,IAAY,QAAuB;AAAA,EAClD,OAAO,IAAI,MAAM,sCAAsC,mBAAmB,SAAS;AAAA;",
9
9
  "debugId": "612366C739B9FA8F64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -5,7 +5,7 @@
5
5
  "/**\n * Base error for sync-run storage operations. Callers can use this to catch\n * domain-specific failures without relying on message text.\n */\nexport class SyncRunError extends Error {\n readonly name = \"SyncRunError\"\n}\n",
6
6
  "import type { ExecutionStorage } from \"../executions\"\nimport { findPrimitiveRunExecution } from \"../executions/run-link\"\nimport { SyncRunError } from \"./errors\"\n\n/** Validate the semantic link between a durable Sync run and its immutable execution. */\nexport async function assertSyncRunExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n readonly syncId: string\n}): Promise<void> {\n const execution = await findPrimitiveRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n primitive: { kind: \"sync\", id: input.syncId, runId: input.runId },\n sourceTypes: [\"execution\", \"schedule\", \"event\"],\n })\n if (!execution) {\n throw new SyncRunError(\n `[Sixb] Execution '${input.executionId}' does not authorize Sync run '${input.runId}'.`\n )\n }\n}\n"
7
7
  ],
8
- "mappings": ";;;;;;AAIO,MAAM,sBAAqB,MAAM;AAAA,EAC7B,OAAO;AAClB;;;ACDA,eAAsB,uBAAsB,CAAC,OAM3B;AAAA,EAChB,MAAM,YAAY,MAAM,0BAA0B;AAAA,IAChD,YAAY,MAAM;AAAA,IAClB,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,WAAW,EAAE,MAAM,QAAQ,IAAI,MAAM,QAAQ,OAAO,MAAM,MAAM;AAAA,IAChE,aAAa,CAAC,aAAa,YAAY,OAAO;AAAA,EAChD,CAAC;AAAA,EACD,IAAI,CAAC,WAAW;AAAA,IACd,MAAM,IAAI,cACR,qBAAqB,MAAM,6CAA6C,MAAM,SAChF;AAAA,EACF;AAAA;",
8
+ "mappings": ";;;;;;AAIO,MAAM,sBAAqB,MAAM;AAAA,EAC7B,OAAO;AAClB;;;ACDO,eAAe,uBAAsB,CAAC,OAM3B;AAAA,EAChB,MAAM,YAAY,MAAM,0BAA0B;AAAA,IAChD,YAAY,MAAM;AAAA,IAClB,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,WAAW,EAAE,MAAM,QAAQ,IAAI,MAAM,QAAQ,OAAO,MAAM,MAAM;AAAA,IAChE,aAAa,CAAC,aAAa,YAAY,OAAO;AAAA,EAChD,CAAC;AAAA,EACD,IAAI,CAAC,WAAW;AAAA,IACd,MAAM,IAAI,cACR,qBAAqB,MAAM,6CAA6C,MAAM,SAChF;AAAA,EACF;AAAA;",
9
9
  "debugId": "652EDC2936F1661664756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,22 +1,13 @@
1
1
  // @bun
2
2
  import {
3
- assertPredicateShape,
4
- createPropertyPredicateBuilder,
5
- createLinkPredicateBuilder,
6
- allPredicates,
7
- anyPredicates,
8
- notPredicate,
9
- isScheduleDefinition2
10
- } from "./chunk-fntqb7qy.js";
3
+ isProjectionDefinition2
4
+ } from "./chunk-ye5c8016.js";
11
5
  import {
12
6
  isActionDefinition2,
13
7
  ShareDefinitionError2,
14
8
  isShareDefinition,
15
9
  snapshotShareDefinition
16
- } from "./chunk-gqm0b7vd.js";
17
- import {
18
- isProjectionDefinition2
19
- } from "./chunk-n9w3n38q.js";
10
+ } from "./chunk-8v6xzwgr.js";
20
11
  import {
21
12
  isMarkingDefinition,
22
13
  isGroupDefinition,
@@ -25,19 +16,28 @@ import {
25
16
  } from "./chunk-73v685wb.js";
26
17
  import {
27
18
  isWorkflowDefinition2
28
- } from "./chunk-et017krg.js";
19
+ } from "./chunk-mdxmt0n3.js";
29
20
  import {
30
21
  isDatasetDefinition2
31
- } from "./chunk-c844dkwd.js";
22
+ } from "./chunk-qtzftvxa.js";
32
23
  import {
33
24
  isPipelineDefinition2
34
- } from "./chunk-m2nevja0.js";
25
+ } from "./chunk-phm3c7b9.js";
26
+ import {
27
+ assertPredicateShape,
28
+ createPropertyPredicateBuilder,
29
+ createLinkPredicateBuilder,
30
+ allPredicates,
31
+ anyPredicates,
32
+ notPredicate,
33
+ isScheduleDefinition2
34
+ } from "./chunk-fntqb7qy.js";
35
35
  import {
36
36
  isSyncDefinition2
37
- } from "./chunk-rp9wwk7b.js";
37
+ } from "./chunk-vx4e4zv4.js";
38
38
  import {
39
39
  compileShareAccessPlan
40
- } from "./chunk-6bkbyer5.js";
40
+ } from "./chunk-7ex2p3zp.js";
41
41
  import {
42
42
  isConnectorDefinition
43
43
  } from "./chunk-9x8dybsb.js";
@@ -302,6 +302,12 @@ function instructionsError(message) {
302
302
  return new RuntimeError2(`[Sixb] ${PROJECT_INSTRUCTIONS_FILE} ${message}`);
303
303
  }
304
304
 
305
+ // src/bootstrap/discovery.ts
306
+ import { AsyncLocalStorage } from "async_hooks";
307
+ import { readdir as readdir2 } from "fs/promises";
308
+ import { join as join2, relative as relative2, resolve, sep as sep2 } from "path";
309
+ import { pathToFileURL } from "url";
310
+
305
311
  // src/rules/errors.ts
306
312
  class RuleError extends Error {
307
313
  name = "RuleError";
@@ -473,10 +479,6 @@ function invalid(message) {
473
479
  return new ShareDefinitionError2(`[Sixb] ${message}`);
474
480
  }
475
481
  // src/bootstrap/discovery.ts
476
- import { AsyncLocalStorage } from "async_hooks";
477
- import { readdir as readdir2 } from "fs/promises";
478
- import { join as join2, relative as relative2, resolve, sep as sep2 } from "path";
479
- import { pathToFileURL } from "url";
480
482
  var moduleExtensions = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
481
483
  async function discoverOntologySources(projectRoot) {
482
484
  const loadedModules = await loadFamilyModules(projectRoot, "ontology", ["ontology"]);
@@ -728,4 +730,4 @@ function isValueType(value) {
728
730
 
729
731
  export { isAgentContextPath2, discoverOntologyFiles, discoverAgentSkills, discoverProjectInstructions, RuleValidationError2, isRuleDefinition2, validateRulesAtStartup, defineRule2, validateSharesAtStartup, discoverOntologySources, withProjectModules2, listProjectModules2, discoverProjectDefinitions2, listOntologyModuleFiles };
730
732
 
731
- //# debugId=48F9C010B9D4ADBD64756E2164756E21
733
+ //# debugId=C0E0FC0FB52FF59864756E2164756E21