@sixb/core 0.1.7 → 0.1.9

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 (999) hide show
  1. package/dist/actions/delegated-admission.d.ts +24 -0
  2. package/dist/actions/delegated-admission.d.ts.map +1 -0
  3. package/dist/actions/descriptor.d.ts +29 -0
  4. package/dist/actions/descriptor.d.ts.map +1 -0
  5. package/dist/actions/execution.d.ts +5 -5
  6. package/dist/actions/execution.d.ts.map +1 -1
  7. package/dist/actions/index.js +78 -84
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/actions/request.d.ts.map +1 -1
  10. package/dist/actions/run-authorization.d.ts +20 -0
  11. package/dist/actions/run-authorization.d.ts.map +1 -0
  12. package/dist/actions/run-dispatch.d.ts +3 -1
  13. package/dist/actions/run-dispatch.d.ts.map +1 -1
  14. package/dist/actions/types/context.d.ts +2 -0
  15. package/dist/actions/types/context.d.ts.map +1 -1
  16. package/dist/actions/validation.d.ts +1 -1
  17. package/dist/actions/validation.d.ts.map +1 -1
  18. package/dist/actions/worker.js +33 -37
  19. package/dist/actions/worker.js.map +2 -2
  20. package/dist/agents/adapters.d.ts +8 -125
  21. package/dist/agents/adapters.d.ts.map +1 -1
  22. package/dist/agents/authority.d.ts +1 -1
  23. package/dist/agents/authority.d.ts.map +1 -1
  24. package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
  25. package/dist/agents/context/entries.d.ts.map +1 -0
  26. package/dist/agents/context/index.d.ts +4 -0
  27. package/dist/agents/context/index.d.ts.map +1 -0
  28. package/dist/agents/context/index.js +19 -0
  29. package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
  30. package/dist/agents/context-model.d.ts +1 -1
  31. package/dist/agents/context-model.d.ts.map +1 -1
  32. package/dist/agents/context-resolution.d.ts +1 -1
  33. package/dist/agents/context-resolution.d.ts.map +1 -1
  34. package/dist/agents/errors.d.ts +0 -9
  35. package/dist/agents/errors.d.ts.map +1 -1
  36. package/dist/agents/execution.d.ts.map +1 -1
  37. package/dist/agents/identity.d.ts +3 -0
  38. package/dist/agents/identity.d.ts.map +1 -0
  39. package/dist/agents/index.d.ts +7 -7
  40. package/dist/agents/index.d.ts.map +1 -1
  41. package/dist/agents/index.js +193 -205
  42. package/dist/agents/index.js.map +1 -1
  43. package/dist/agents/message.d.ts +5 -6
  44. package/dist/agents/message.d.ts.map +1 -1
  45. package/dist/agents/model-loop.d.ts +4 -0
  46. package/dist/agents/model-loop.d.ts.map +1 -1
  47. package/dist/agents/request.d.ts +1 -1
  48. package/dist/agents/request.d.ts.map +1 -1
  49. package/dist/agents/streams/index.d.ts +4 -0
  50. package/dist/agents/streams/index.d.ts.map +1 -0
  51. package/dist/agents/streams/index.js +20 -0
  52. package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
  53. package/dist/agents/streams/internal.d.ts +3 -0
  54. package/dist/agents/streams/internal.d.ts.map +1 -0
  55. package/dist/agents/streams/internal.js +40 -0
  56. package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
  57. package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
  58. package/dist/agents/streams/protocol.d.ts.map +1 -0
  59. package/dist/agents/tool-definition.d.ts +0 -1
  60. package/dist/agents/tool-definition.d.ts.map +1 -1
  61. package/dist/agents/types.d.ts +1 -1
  62. package/dist/agents/types.d.ts.map +1 -1
  63. package/dist/agents/validation.d.ts +0 -4
  64. package/dist/agents/validation.d.ts.map +1 -1
  65. package/dist/ai-usage/execution.d.ts.map +1 -1
  66. package/dist/auth/index.d.ts +0 -1
  67. package/dist/auth/index.d.ts.map +1 -1
  68. package/dist/auth/index.js +96 -105
  69. package/dist/auth/index.js.map +1 -1
  70. package/dist/auth/strategy.js +8 -9
  71. package/dist/auth/strategy.js.map +1 -1
  72. package/dist/authorization/decision.d.ts +10 -2
  73. package/dist/authorization/decision.d.ts.map +1 -1
  74. package/dist/authorization/grant-kinds.d.ts +2 -1
  75. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  76. package/dist/authorization/index.d.ts +1 -1
  77. package/dist/authorization/index.d.ts.map +1 -1
  78. package/dist/authorization/index.js +51 -53
  79. package/dist/authorization/index.js.map +1 -1
  80. package/dist/blob-storage/browser.js +15 -17
  81. package/dist/blob-storage/browser.js.map +1 -1
  82. package/dist/blob-storage/index.js +36 -38
  83. package/dist/blob-storage/index.js.map +1 -1
  84. package/dist/bootstrap/discovery.d.ts +20 -1
  85. package/dist/bootstrap/discovery.d.ts.map +1 -1
  86. package/dist/bootstrap/index.d.ts +2 -2
  87. package/dist/bootstrap/index.d.ts.map +1 -1
  88. package/dist/bootstrap/index.js +79 -81
  89. package/dist/bootstrap/index.js.map +1 -1
  90. package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
  91. package/dist/broker/index.js +8 -10
  92. package/dist/broker/index.js.map +1 -1
  93. package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
  94. package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
  95. package/dist/{chunk-3fqt22c4.js → chunk-0w35wavj.js} +360 -168
  96. package/dist/chunk-0w35wavj.js.map +14 -0
  97. package/dist/chunk-0y39rgsb.js +43 -0
  98. package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
  99. package/dist/{chunk-hdz94br2.js → chunk-17kfctj6.js} +23 -13
  100. package/dist/chunk-17kfctj6.js.map +10 -0
  101. package/dist/{chunk-e4rvtvpw.js → chunk-1enhpacz.js} +418 -233
  102. package/dist/chunk-1enhpacz.js.map +34 -0
  103. package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
  104. package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
  105. package/dist/{chunk-7ds9620f.js → chunk-38zv5rkr.js} +24 -8
  106. package/dist/chunk-38zv5rkr.js.map +10 -0
  107. package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
  108. package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
  109. package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
  110. package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
  111. package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
  112. package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
  113. package/dist/chunk-3frsnm7x.js +32 -0
  114. package/dist/chunk-3frsnm7x.js.map +11 -0
  115. package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
  116. package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
  117. package/dist/{chunk-qv38twt8.js → chunk-52hbv0ak.js} +192 -171
  118. package/dist/{chunk-qv38twt8.js.map → chunk-52hbv0ak.js.map} +6 -6
  119. package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
  120. package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
  121. package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
  122. package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
  123. package/dist/chunk-653vwrzr.js +39 -0
  124. package/dist/chunk-653vwrzr.js.map +10 -0
  125. package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
  126. package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
  127. package/dist/chunk-7apz6hg4.js +50 -0
  128. package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
  129. package/dist/chunk-7bs40fe1.js +218 -0
  130. package/dist/{chunk-08twe8m6.js.map → chunk-7bs40fe1.js.map} +3 -3
  131. package/dist/chunk-7zgecwy1.js +113 -0
  132. package/dist/chunk-7zgecwy1.js.map +10 -0
  133. package/dist/{chunk-tn7xcs2n.js → chunk-860dwwy0.js} +93 -30
  134. package/dist/chunk-860dwwy0.js.map +14 -0
  135. package/dist/chunk-8vj0rjgs.js +165 -0
  136. package/dist/chunk-8vj0rjgs.js.map +15 -0
  137. package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
  138. package/dist/chunk-92vk7gta.js.map +10 -0
  139. package/dist/{chunk-gbrpsx4m.js → chunk-93csa55g.js} +72 -16
  140. package/dist/chunk-93csa55g.js.map +11 -0
  141. package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
  142. package/dist/chunk-98cw09sw.js.map +10 -0
  143. package/dist/chunk-9qsh3p5y.js +111 -0
  144. package/dist/chunk-9qsh3p5y.js.map +11 -0
  145. package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
  146. package/dist/{chunk-z2sery1b.js → chunk-9vx5e9g1.js} +68 -28
  147. package/dist/chunk-9vx5e9g1.js.map +11 -0
  148. package/dist/{chunk-9aehf39w.js → chunk-an5tt9y0.js} +353 -353
  149. package/dist/{chunk-9aehf39w.js.map → chunk-an5tt9y0.js.map} +2 -2
  150. package/dist/{chunk-x0qhkqje.js → chunk-ap0g1g74.js} +37 -37
  151. package/dist/{chunk-x0qhkqje.js.map → chunk-ap0g1g74.js.map} +2 -2
  152. package/dist/chunk-awbhdqyc.js +252 -0
  153. package/dist/chunk-awbhdqyc.js.map +10 -0
  154. package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
  155. package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
  156. package/dist/chunk-br3k6qbf.js +436 -0
  157. package/dist/chunk-br3k6qbf.js.map +12 -0
  158. package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
  159. package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
  160. package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
  161. package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
  162. package/dist/chunk-d62kjtbg.js +7 -0
  163. package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
  164. package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
  165. package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
  166. package/dist/{chunk-atmkaf60.js → chunk-dmn70ztd.js} +30 -34
  167. package/dist/chunk-dmn70ztd.js.map +11 -0
  168. package/dist/chunk-dz5h08xv.js +1887 -0
  169. package/dist/chunk-dz5h08xv.js.map +25 -0
  170. package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
  171. package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
  172. package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
  173. package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
  174. package/dist/{chunk-ha58tjtt.js → chunk-emyyk7dx.js} +59 -55
  175. package/dist/{chunk-ha58tjtt.js.map → chunk-emyyk7dx.js.map} +3 -3
  176. package/dist/{chunk-3kv70xwp.js → chunk-ey1nk510.js} +18 -2
  177. package/dist/chunk-ey1nk510.js.map +10 -0
  178. package/dist/chunk-f0rwz2vh.js +152 -0
  179. package/dist/chunk-f0rwz2vh.js.map +11 -0
  180. package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
  181. package/dist/chunk-f4w3yp4f.js.map +12 -0
  182. package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
  183. package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
  184. package/dist/{chunk-rre42skh.js → chunk-g00bfdq6.js} +729 -296
  185. package/dist/{chunk-rre42skh.js.map → chunk-g00bfdq6.js.map} +11 -7
  186. package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
  187. package/dist/chunk-g53f0e4j.js.map +15 -0
  188. package/dist/chunk-g6cke204.js +124 -0
  189. package/dist/chunk-g6cke204.js.map +10 -0
  190. package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
  191. package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
  192. package/dist/chunk-h1gfhhbh.js +602 -0
  193. package/dist/chunk-h1gfhhbh.js.map +18 -0
  194. package/dist/chunk-h3v76ams.js +32 -0
  195. package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
  196. package/dist/chunk-hpr1r6av.js +4006 -0
  197. package/dist/chunk-hpr1r6av.js.map +44 -0
  198. package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
  199. package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
  200. package/dist/{chunk-rp1mvzb4.js → chunk-jjy0fhrn.js} +40 -35
  201. package/dist/{chunk-rp1mvzb4.js.map → chunk-jjy0fhrn.js.map} +3 -3
  202. package/dist/{chunk-4nxeacx7.js → chunk-jmfet9r4.js} +6 -6
  203. package/dist/{chunk-4nxeacx7.js.map → chunk-jmfet9r4.js.map} +2 -2
  204. package/dist/{chunk-64sr682n.js → chunk-k3cqkkn2.js} +61 -55
  205. package/dist/chunk-k3cqkkn2.js.map +12 -0
  206. package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
  207. package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
  208. package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
  209. package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
  210. package/dist/{chunk-qjycjdj6.js → chunk-m3z3x9v0.js} +106 -65
  211. package/dist/{chunk-qjycjdj6.js.map → chunk-m3z3x9v0.js.map} +3 -3
  212. package/dist/{chunk-6ed5bwnd.js → chunk-mjbk2djy.js} +2092 -1714
  213. package/dist/chunk-mjbk2djy.js.map +57 -0
  214. package/dist/{chunk-5jcdmjam.js → chunk-mmagke4x.js} +6 -6
  215. package/dist/{chunk-5jcdmjam.js.map → chunk-mmagke4x.js.map} +2 -2
  216. package/dist/chunk-mrp7k0pw.js +147 -0
  217. package/dist/chunk-mrp7k0pw.js.map +10 -0
  218. package/dist/{chunk-d63tybny.js → chunk-ms2tmn1k.js} +139 -139
  219. package/dist/{chunk-d63tybny.js.map → chunk-ms2tmn1k.js.map} +2 -2
  220. package/dist/{chunk-xdpwpkha.js → chunk-ppytyr6w.js} +156 -179
  221. package/dist/{chunk-xdpwpkha.js.map → chunk-ppytyr6w.js.map} +3 -5
  222. package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
  223. package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
  224. package/dist/{chunk-qjzp9xyb.js → chunk-pr2h4bv4.js} +33 -35
  225. package/dist/chunk-pr2h4bv4.js.map +12 -0
  226. package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
  227. package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
  228. package/dist/{chunk-agsvg9ar.js → chunk-qf954wje.js} +6 -6
  229. package/dist/{chunk-agsvg9ar.js.map → chunk-qf954wje.js.map} +2 -2
  230. package/dist/{chunk-wjgm6jjt.js → chunk-qhcpj9wc.js} +166 -132
  231. package/dist/chunk-qhcpj9wc.js.map +14 -0
  232. package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
  233. package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
  234. package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
  235. package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
  236. package/dist/{chunk-2b5qtban.js → chunk-r4tfx1sf.js} +142 -89
  237. package/dist/chunk-r4tfx1sf.js.map +15 -0
  238. package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
  239. package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
  240. package/dist/chunk-s3csryxe.js +152 -0
  241. package/dist/chunk-s3csryxe.js.map +11 -0
  242. package/dist/chunk-s670k14v.js +60 -0
  243. package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
  244. package/dist/chunk-skz0hst3.js +788 -0
  245. package/dist/chunk-skz0hst3.js.map +19 -0
  246. package/dist/chunk-v4jbb3rs.js +403 -0
  247. package/dist/chunk-v4jbb3rs.js.map +10 -0
  248. package/dist/{chunk-d2ndstdf.js → chunk-vf691g1r.js} +61 -59
  249. package/dist/{chunk-d2ndstdf.js.map → chunk-vf691g1r.js.map} +2 -2
  250. package/dist/{chunk-1kamz6j0.js → chunk-vsj3mdfj.js} +8 -8
  251. package/dist/{chunk-1kamz6j0.js.map → chunk-vsj3mdfj.js.map} +2 -2
  252. package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
  253. package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
  254. package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
  255. package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
  256. package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
  257. package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
  258. package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
  259. package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
  260. package/dist/chunk-x9v4cx1d.js +139 -0
  261. package/dist/chunk-x9v4cx1d.js.map +10 -0
  262. package/dist/{chunk-kt81c11h.js → chunk-xfbydgzy.js} +27 -27
  263. package/dist/{chunk-kt81c11h.js.map → chunk-xfbydgzy.js.map} +2 -2
  264. package/dist/{chunk-vjjv9mrb.js → chunk-xyr8kppc.js} +22 -22
  265. package/dist/{chunk-vjjv9mrb.js.map → chunk-xyr8kppc.js.map} +3 -3
  266. package/dist/chunk-ypbtykv6.js +1537 -0
  267. package/dist/chunk-ypbtykv6.js.map +19 -0
  268. package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
  269. package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
  270. package/dist/{chunk-xc7hq65b.js → chunk-z30bv4ga.js} +80 -33
  271. package/dist/chunk-z30bv4ga.js.map +11 -0
  272. package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
  273. package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
  274. package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
  275. package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
  276. package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
  277. package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
  278. package/dist/chunk-z8fx5cgb.js +159 -0
  279. package/dist/chunk-z8fx5cgb.js.map +11 -0
  280. package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
  281. package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
  282. package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
  283. package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
  284. package/dist/connectors/connections/internal.js +9 -10
  285. package/dist/connectors/connections/internal.js.map +1 -1
  286. package/dist/datasets/builders.d.ts +11 -2
  287. package/dist/datasets/builders.d.ts.map +1 -1
  288. package/dist/datasets/changes.d.ts +14 -4
  289. package/dist/datasets/changes.d.ts.map +1 -1
  290. package/dist/datasets/execution.d.ts +15 -1
  291. package/dist/datasets/execution.d.ts.map +1 -1
  292. package/dist/datasets/index.d.ts +1 -0
  293. package/dist/datasets/index.d.ts.map +1 -1
  294. package/dist/datasets/sequence.d.ts +7 -0
  295. package/dist/datasets/sequence.d.ts.map +1 -0
  296. package/dist/datasets/types.d.ts +1 -0
  297. package/dist/datasets/types.d.ts.map +1 -1
  298. package/dist/datasets/validation.d.ts.map +1 -1
  299. package/dist/datasets/write.d.ts +37 -0
  300. package/dist/datasets/write.d.ts.map +1 -0
  301. package/dist/datasets/write.js +13 -0
  302. package/dist/datasets/write.js.map +9 -0
  303. package/dist/edits/index.js +7 -8
  304. package/dist/edits/index.js.map +1 -1
  305. package/dist/error-reporting/internal.js +22 -24
  306. package/dist/error-reporting/internal.js.map +1 -1
  307. package/dist/errors/internal.d.ts +1 -1
  308. package/dist/errors/internal.d.ts.map +1 -1
  309. package/dist/errors/internal.js +22 -24
  310. package/dist/errors/internal.js.map +1 -1
  311. package/dist/errors/redaction.d.ts +8 -0
  312. package/dist/errors/redaction.d.ts.map +1 -0
  313. package/dist/errors/types.d.ts +4 -0
  314. package/dist/errors/types.d.ts.map +1 -1
  315. package/dist/events/execution.d.ts.map +1 -1
  316. package/dist/events/index.js +60 -63
  317. package/dist/events/index.js.map +1 -1
  318. package/dist/events/scope.js +4 -5
  319. package/dist/events/scope.js.map +1 -1
  320. package/dist/events/selectors/index.js +9 -10
  321. package/dist/events/selectors/index.js.map +1 -1
  322. package/dist/events/types/datasets.d.ts +2 -6
  323. package/dist/events/types/datasets.d.ts.map +1 -1
  324. package/dist/execution/agent.d.ts +3 -3
  325. package/dist/execution/agent.d.ts.map +1 -1
  326. package/dist/execution/agent.js +70 -75
  327. package/dist/execution/agent.js.map +1 -1
  328. package/dist/execution/authorization.d.ts +58 -20
  329. package/dist/execution/authorization.d.ts.map +1 -1
  330. package/dist/execution/authorized-object-reader.d.ts +69 -0
  331. package/dist/execution/authorized-object-reader.d.ts.map +1 -0
  332. package/dist/execution/durable.d.ts +1 -0
  333. package/dist/execution/durable.d.ts.map +1 -1
  334. package/dist/execution/index.d.ts +1 -1
  335. package/dist/execution/index.d.ts.map +1 -1
  336. package/dist/execution/primitive.d.ts +2 -0
  337. package/dist/execution/primitive.d.ts.map +1 -1
  338. package/dist/execution/primitive.js +63 -64
  339. package/dist/execution/primitive.js.map +3 -3
  340. package/dist/execution/request.d.ts +12 -0
  341. package/dist/execution/request.d.ts.map +1 -1
  342. package/dist/execution/request.js +97 -71
  343. package/dist/execution/request.js.map +3 -3
  344. package/dist/execution/scopes.d.ts +16 -0
  345. package/dist/execution/scopes.d.ts.map +1 -1
  346. package/dist/execution/types.d.ts +9 -0
  347. package/dist/execution/types.d.ts.map +1 -1
  348. package/dist/http/api-routes.d.ts +2 -0
  349. package/dist/http/api-routes.d.ts.map +1 -1
  350. package/dist/http/index.js +10 -11
  351. package/dist/http/index.js.map +1 -1
  352. package/dist/index.d.ts +21 -14
  353. package/dist/index.d.ts.map +1 -1
  354. package/dist/index.js +455 -463
  355. package/dist/index.js.map +1 -1
  356. package/dist/lake-storage/definition-updates.d.ts.map +1 -1
  357. package/dist/lake-storage/errors.d.ts +5 -1
  358. package/dist/lake-storage/errors.d.ts.map +1 -1
  359. package/dist/lake-storage/in-memory.d.ts +1 -0
  360. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  361. package/dist/lake-storage/index.d.ts +6 -1
  362. package/dist/lake-storage/index.d.ts.map +1 -1
  363. package/dist/lake-storage/index.js +40 -27
  364. package/dist/lake-storage/index.js.map +1 -1
  365. package/dist/lake-storage/merge-validation.d.ts.map +1 -1
  366. package/dist/lake-storage/merge.d.ts +13 -2
  367. package/dist/lake-storage/merge.d.ts.map +1 -1
  368. package/dist/lake-storage/source-ordering.d.ts +19 -0
  369. package/dist/lake-storage/source-ordering.d.ts.map +1 -0
  370. package/dist/lake-storage/sql-transforms.d.ts +2 -1
  371. package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
  372. package/dist/lake-storage/types.d.ts +10 -5
  373. package/dist/lake-storage/types.d.ts.map +1 -1
  374. package/dist/lake-storage/version-inputs.d.ts +4 -0
  375. package/dist/lake-storage/version-inputs.d.ts.map +1 -0
  376. package/dist/logging/index.d.ts +3 -4
  377. package/dist/logging/index.d.ts.map +1 -1
  378. package/dist/logging/index.js +18 -40
  379. package/dist/logging/index.js.map +1 -1
  380. package/dist/logging/internal.d.ts +5 -0
  381. package/dist/logging/internal.d.ts.map +1 -0
  382. package/dist/logging/internal.js +43 -0
  383. package/dist/logging/internal.js.map +9 -0
  384. package/dist/materialization/index.js +46 -49
  385. package/dist/materialization/index.js.map +1 -1
  386. package/dist/materializer/index.js +137 -142
  387. package/dist/materializer/index.js.map +1 -1
  388. package/dist/models/errors.d.ts +4 -0
  389. package/dist/models/errors.d.ts.map +1 -1
  390. package/dist/models/execution/binding.d.ts +9 -0
  391. package/dist/models/execution/binding.d.ts.map +1 -0
  392. package/dist/models/execution/errors.d.ts +9 -0
  393. package/dist/models/execution/errors.d.ts.map +1 -0
  394. package/dist/models/execution/index.d.ts +11 -0
  395. package/dist/models/execution/index.d.ts.map +1 -0
  396. package/dist/models/execution/index.js +55 -0
  397. package/dist/models/execution/index.js.map +9 -0
  398. package/dist/models/execution/model-call-accounting.d.ts +17 -0
  399. package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
  400. package/dist/models/execution/model-call-admission.d.ts +47 -0
  401. package/dist/models/execution/model-call-admission.d.ts.map +1 -0
  402. package/dist/models/execution/model-call-limits.d.ts +15 -0
  403. package/dist/models/execution/model-call-limits.d.ts.map +1 -0
  404. package/dist/models/execution/model-call-recorder.d.ts +40 -0
  405. package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
  406. package/dist/models/execution/model-call-recovery.d.ts +12 -0
  407. package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
  408. package/dist/models/execution/recovery-queue.d.ts +5 -0
  409. package/dist/models/execution/recovery-queue.d.ts.map +1 -0
  410. package/dist/models/execution/types.d.ts +44 -0
  411. package/dist/models/execution/types.d.ts.map +1 -0
  412. package/dist/models/execution/usage.d.ts +5 -0
  413. package/dist/models/execution/usage.d.ts.map +1 -0
  414. package/dist/models/execution.d.ts +6 -0
  415. package/dist/models/execution.d.ts.map +1 -0
  416. package/dist/models/generation-types.d.ts +40 -0
  417. package/dist/models/generation-types.d.ts.map +1 -0
  418. package/dist/models/index.d.ts +1 -0
  419. package/dist/models/index.d.ts.map +1 -1
  420. package/dist/models/index.js +42 -43
  421. package/dist/models/index.js.map +1 -1
  422. package/dist/models/language-model.d.ts +3 -0
  423. package/dist/models/language-model.d.ts.map +1 -1
  424. package/dist/models/output.d.ts +5 -0
  425. package/dist/models/output.d.ts.map +1 -0
  426. package/dist/models/resolve.d.ts +4 -0
  427. package/dist/models/resolve.d.ts.map +1 -0
  428. package/dist/objects/authorized-ontology-view.d.ts +25 -0
  429. package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
  430. package/dist/objects/execution.d.ts +1 -1
  431. package/dist/objects/execution.d.ts.map +1 -1
  432. package/dist/objects/index.js +75 -84
  433. package/dist/objects/index.js.map +1 -1
  434. package/dist/objects/link/authorization.d.ts +2 -7
  435. package/dist/objects/link/authorization.d.ts.map +1 -1
  436. package/dist/objects/query/executor.d.ts +4 -2
  437. package/dist/objects/query/executor.d.ts.map +1 -1
  438. package/dist/objects/query/index.js +67 -73
  439. package/dist/objects/query/index.js.map +1 -1
  440. package/dist/objects/query/links.d.ts +22 -1
  441. package/dist/objects/query/links.d.ts.map +1 -1
  442. package/dist/objects/query/selected-read-admission.d.ts +27 -0
  443. package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
  444. package/dist/objects/query/validate.d.ts +60 -2
  445. package/dist/objects/query/validate.d.ts.map +1 -1
  446. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  447. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  448. package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
  449. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  450. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  451. package/dist/objects/service/list-service.d.ts +2 -3
  452. package/dist/objects/service/list-service.d.ts.map +1 -1
  453. package/dist/objects/telemetry/history.d.ts +8 -6
  454. package/dist/objects/telemetry/history.d.ts.map +1 -1
  455. package/dist/objects/telemetry/index.d.ts +2 -2
  456. package/dist/objects/telemetry/index.d.ts.map +1 -1
  457. package/dist/objects/telemetry/workload.d.ts +11 -0
  458. package/dist/objects/telemetry/workload.d.ts.map +1 -0
  459. package/dist/ontology/index.d.ts +2 -2
  460. package/dist/ontology/index.d.ts.map +1 -1
  461. package/dist/ontology/index.js +61 -111
  462. package/dist/ontology/index.js.map +1 -1
  463. package/dist/ontology/inference/index.d.ts +2 -1
  464. package/dist/ontology/inference/index.d.ts.map +1 -1
  465. package/dist/ontology/internal.d.ts +7 -1
  466. package/dist/ontology/internal.d.ts.map +1 -1
  467. package/dist/ontology/internal.js +65 -121
  468. package/dist/ontology/internal.js.map +3 -4
  469. package/dist/ontology/json-schema.d.ts +10 -6
  470. package/dist/ontology/json-schema.d.ts.map +1 -1
  471. package/dist/ontology/link-path-selection.d.ts +35 -0
  472. package/dist/ontology/link-path-selection.d.ts.map +1 -0
  473. package/dist/ontology/refs.d.ts +2 -0
  474. package/dist/ontology/refs.d.ts.map +1 -1
  475. package/dist/ontology/tokens.d.ts +2 -1
  476. package/dist/ontology/tokens.d.ts.map +1 -1
  477. package/dist/pipelines/execution.d.ts.map +1 -1
  478. package/dist/pipelines/index.js +57 -63
  479. package/dist/pipelines/index.js.map +1 -1
  480. package/dist/pipelines/request.d.ts.map +1 -1
  481. package/dist/projections/execution.d.ts.map +1 -1
  482. package/dist/projections/internal.js +58 -64
  483. package/dist/projections/internal.js.map +1 -1
  484. package/dist/projections/run-dispatch.d.ts.map +1 -1
  485. package/dist/query.d.ts +0 -1
  486. package/dist/query.d.ts.map +1 -1
  487. package/dist/query.js +11 -15
  488. package/dist/query.js.map +1 -1
  489. package/dist/queues/index.d.ts +2 -1
  490. package/dist/queues/index.d.ts.map +1 -1
  491. package/dist/queues/index.js +6 -7
  492. package/dist/queues/index.js.map +1 -1
  493. package/dist/queues/types.d.ts +3 -20
  494. package/dist/queues/types.d.ts.map +1 -1
  495. package/dist/rules/execution.d.ts.map +1 -1
  496. package/dist/rules/internal.js +4 -5
  497. package/dist/rules/internal.js.map +1 -1
  498. package/dist/runtime/create.d.ts +6 -2
  499. package/dist/runtime/create.d.ts.map +1 -1
  500. package/dist/runtime/definitions.d.ts +2 -0
  501. package/dist/runtime/definitions.d.ts.map +1 -1
  502. package/dist/runtime/host.d.ts +4 -1
  503. package/dist/runtime/host.d.ts.map +1 -1
  504. package/dist/runtime/internal.d.ts +1 -0
  505. package/dist/runtime/internal.d.ts.map +1 -1
  506. package/dist/runtime/internal.js +13 -14
  507. package/dist/runtime/internal.js.map +1 -1
  508. package/dist/runtime/resolve-definitions.d.ts +2 -0
  509. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  510. package/dist/runtime/sixb.d.ts +6 -0
  511. package/dist/runtime/sixb.d.ts.map +1 -1
  512. package/dist/runtime/types.d.ts +3 -0
  513. package/dist/runtime/types.d.ts.map +1 -1
  514. package/dist/sandboxes/errors.d.ts +4 -0
  515. package/dist/sandboxes/errors.d.ts.map +1 -1
  516. package/dist/sandboxes/index.d.ts +2 -2
  517. package/dist/sandboxes/index.d.ts.map +1 -1
  518. package/dist/sandboxes/index.js +14 -13
  519. package/dist/sandboxes/index.js.map +1 -1
  520. package/dist/sandboxes/sandbox.d.ts +35 -7
  521. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  522. package/dist/scheduler/index.js +9 -10
  523. package/dist/scheduler/index.js.map +1 -1
  524. package/dist/schedules/execution.d.ts +2 -1
  525. package/dist/schedules/execution.d.ts.map +1 -1
  526. package/dist/schedules/index.js +31 -33
  527. package/dist/schedules/index.js.map +1 -1
  528. package/dist/security/every.d.ts +4 -1
  529. package/dist/security/every.d.ts.map +1 -1
  530. package/dist/security/grants.d.ts +7 -2
  531. package/dist/security/grants.d.ts.map +1 -1
  532. package/dist/security/index.d.ts +1 -1
  533. package/dist/security/index.d.ts.map +1 -1
  534. package/dist/security/registry.d.ts +1 -0
  535. package/dist/security/registry.d.ts.map +1 -1
  536. package/dist/security/types.d.ts +7 -1
  537. package/dist/security/types.d.ts.map +1 -1
  538. package/dist/security/validation.d.ts +2 -0
  539. package/dist/security/validation.d.ts.map +1 -1
  540. package/dist/shares/access-plan.d.ts +22 -0
  541. package/dist/shares/access-plan.d.ts.map +1 -0
  542. package/dist/shares/builders.d.ts +14 -0
  543. package/dist/shares/builders.d.ts.map +1 -0
  544. package/dist/shares/compiler.d.ts +14 -0
  545. package/dist/shares/compiler.d.ts.map +1 -0
  546. package/dist/shares/errors.d.ts +4 -0
  547. package/dist/shares/errors.d.ts.map +1 -0
  548. package/dist/shares/execution.d.ts +57 -0
  549. package/dist/shares/execution.d.ts.map +1 -0
  550. package/dist/shares/index.d.ts +10 -0
  551. package/dist/shares/index.d.ts.map +1 -0
  552. package/dist/shares/internal.d.ts +3 -0
  553. package/dist/shares/internal.d.ts.map +1 -0
  554. package/dist/shares/internal.js +231 -0
  555. package/dist/shares/internal.js.map +10 -0
  556. package/dist/shares/intersection.d.ts +9 -0
  557. package/dist/shares/intersection.d.ts.map +1 -0
  558. package/dist/shares/session-protocol.d.ts +41 -0
  559. package/dist/shares/session-protocol.d.ts.map +1 -0
  560. package/dist/shares/types.d.ts +51 -0
  561. package/dist/shares/types.d.ts.map +1 -0
  562. package/dist/shares/validation.d.ts +11 -0
  563. package/dist/shares/validation.d.ts.map +1 -0
  564. package/dist/storage/action-runs/failure.js +7 -9
  565. package/dist/storage/action-runs/failure.js.map +1 -1
  566. package/dist/storage/action-runs/provider.js +4 -8
  567. package/dist/storage/action-runs/provider.js.map +1 -1
  568. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  569. package/dist/storage/agents/provider.js +26 -30
  570. package/dist/storage/agents/provider.js.map +1 -1
  571. package/dist/storage/agents/types.d.ts +0 -3
  572. package/dist/storage/agents/types.d.ts.map +1 -1
  573. package/dist/storage/ai-cost/attribution.d.ts +4 -0
  574. package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
  575. package/dist/storage/ai-cost/groups.d.ts +3 -0
  576. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  577. package/dist/storage/ai-cost/provider.d.ts +1 -0
  578. package/dist/storage/ai-cost/provider.d.ts.map +1 -1
  579. package/dist/storage/ai-cost/provider.js +30 -143
  580. package/dist/storage/ai-cost/provider.js.map +3 -4
  581. package/dist/storage/ai-cost/types.d.ts +15 -0
  582. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  583. package/dist/storage/ai-limits/enforcement.js +14 -16
  584. package/dist/storage/ai-limits/enforcement.js.map +1 -1
  585. package/dist/storage/ai-limits/provider.js +56 -57
  586. package/dist/storage/ai-limits/provider.js.map +1 -1
  587. package/dist/storage/auth/in-memory.d.ts +1 -1
  588. package/dist/storage/auth/in-memory.d.ts.map +1 -1
  589. package/dist/storage/connector-connections/provider.js +34 -36
  590. package/dist/storage/connector-connections/provider.js.map +2 -2
  591. package/dist/storage/executions/in-memory.d.ts +3 -0
  592. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  593. package/dist/storage/executions/provider.d.ts +6 -2
  594. package/dist/storage/executions/provider.d.ts.map +1 -1
  595. package/dist/storage/executions/provider.js +35 -12
  596. package/dist/storage/executions/provider.js.map +3 -3
  597. package/dist/storage/executions/run-link.d.ts +7 -0
  598. package/dist/storage/executions/run-link.d.ts.map +1 -1
  599. package/dist/storage/executions/types.d.ts +6 -2
  600. package/dist/storage/executions/types.d.ts.map +1 -1
  601. package/dist/storage/executions/validation.d.ts +8 -0
  602. package/dist/storage/executions/validation.d.ts.map +1 -1
  603. package/dist/storage/in-memory/index.d.ts +8 -0
  604. package/dist/storage/in-memory/index.d.ts.map +1 -1
  605. package/dist/storage/index.d.ts +14 -9
  606. package/dist/storage/index.d.ts.map +1 -1
  607. package/dist/storage/index.js +221 -227
  608. package/dist/storage/index.js.map +1 -1
  609. package/dist/storage/internal.d.ts +10 -0
  610. package/dist/storage/internal.d.ts.map +1 -0
  611. package/dist/storage/internal.js +47 -0
  612. package/dist/storage/internal.js.map +9 -0
  613. package/dist/storage/objects/execution-limits.d.ts +25 -0
  614. package/dist/storage/objects/execution-limits.d.ts.map +1 -0
  615. package/dist/storage/objects/guard.d.ts +16 -0
  616. package/dist/storage/objects/guard.d.ts.map +1 -0
  617. package/dist/storage/objects/in-memory/index.d.ts +3 -0
  618. package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
  619. package/dist/storage/objects/in-memory/keys.d.ts +10 -0
  620. package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
  621. package/dist/storage/objects/in-memory/query.d.ts +31 -0
  622. package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
  623. package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
  624. package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
  625. package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
  626. package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
  627. package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
  628. package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
  629. package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
  630. package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
  631. package/dist/storage/objects/index.d.ts +4 -1
  632. package/dist/storage/objects/index.d.ts.map +1 -1
  633. package/dist/storage/objects/keys.d.ts +1 -1
  634. package/dist/storage/objects/keys.d.ts.map +1 -1
  635. package/dist/storage/objects/read-scope.d.ts +25 -0
  636. package/dist/storage/objects/read-scope.d.ts.map +1 -0
  637. package/dist/storage/objects/types.d.ts +114 -22
  638. package/dist/storage/objects/types.d.ts.map +1 -1
  639. package/dist/storage/ontology/provider.js +105 -109
  640. package/dist/storage/ontology/provider.js.map +1 -1
  641. package/dist/storage/operation-scope.d.ts +3 -0
  642. package/dist/storage/operation-scope.d.ts.map +1 -1
  643. package/dist/storage/operation-scope.js +18 -17
  644. package/dist/storage/operation-scope.js.map +1 -1
  645. package/dist/storage/pipeline-runs/provider.js +4 -6
  646. package/dist/storage/pipeline-runs/provider.js.map +1 -1
  647. package/dist/storage/projection-runs/provider.js +66 -70
  648. package/dist/storage/projection-runs/provider.js.map +1 -1
  649. package/dist/storage/share-grants/errors.d.ts +8 -0
  650. package/dist/storage/share-grants/errors.d.ts.map +1 -0
  651. package/dist/storage/share-grants/in-memory.d.ts +11 -0
  652. package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
  653. package/dist/storage/share-grants/index.d.ts +5 -0
  654. package/dist/storage/share-grants/index.d.ts.map +1 -0
  655. package/dist/storage/share-grants/provider.d.ts +4 -0
  656. package/dist/storage/share-grants/provider.d.ts.map +1 -0
  657. package/dist/storage/share-grants/provider.js +22 -0
  658. package/dist/storage/share-grants/provider.js.map +9 -0
  659. package/dist/storage/share-grants/record.d.ts +11 -0
  660. package/dist/storage/share-grants/record.d.ts.map +1 -0
  661. package/dist/storage/share-grants/types.d.ts +97 -0
  662. package/dist/storage/share-grants/types.d.ts.map +1 -0
  663. package/dist/storage/share-sessions/errors.d.ts +8 -0
  664. package/dist/storage/share-sessions/errors.d.ts.map +1 -0
  665. package/dist/storage/share-sessions/in-memory.d.ts +14 -0
  666. package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
  667. package/dist/storage/share-sessions/index.d.ts +5 -0
  668. package/dist/storage/share-sessions/index.d.ts.map +1 -0
  669. package/dist/storage/share-sessions/provider.d.ts +3 -0
  670. package/dist/storage/share-sessions/provider.d.ts.map +1 -0
  671. package/dist/storage/share-sessions/provider.js +19 -0
  672. package/dist/storage/share-sessions/provider.js.map +9 -0
  673. package/dist/storage/share-sessions/record.d.ts +8 -0
  674. package/dist/storage/share-sessions/record.d.ts.map +1 -0
  675. package/dist/storage/share-sessions/types.d.ts +50 -0
  676. package/dist/storage/share-sessions/types.d.ts.map +1 -0
  677. package/dist/storage/sync-runs/provider.js +4 -6
  678. package/dist/storage/sync-runs/provider.js.map +1 -1
  679. package/dist/storage/transaction.d.ts +2 -1
  680. package/dist/storage/transaction.d.ts.map +1 -1
  681. package/dist/storage/types.d.ts +8 -0
  682. package/dist/storage/types.d.ts.map +1 -1
  683. package/dist/storage/webhook-runs/provider.js +4 -6
  684. package/dist/storage/webhook-runs/provider.js.map +1 -1
  685. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  686. package/dist/storage/workflow-runs/provider.js +13 -18
  687. package/dist/storage/workflow-runs/provider.js.map +1 -1
  688. package/dist/storage/workflow-runs/types.d.ts +0 -3
  689. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  690. package/dist/syncs/execution.d.ts.map +1 -1
  691. package/dist/syncs/index.js +55 -62
  692. package/dist/syncs/index.js.map +1 -1
  693. package/dist/syncs/request.d.ts.map +1 -1
  694. package/dist/testing/action-execution.d.ts +4 -1
  695. package/dist/testing/action-execution.d.ts.map +1 -1
  696. package/dist/testing/agent-execution.d.ts +1 -0
  697. package/dist/testing/agent-execution.d.ts.map +1 -1
  698. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  699. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  700. package/dist/testing/dataset-sequence-contract.d.ts +4 -0
  701. package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
  702. package/dist/testing/effective-storage-contract.d.ts.map +1 -1
  703. package/dist/testing/execution-storage-contract.d.ts +4 -0
  704. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  705. package/dist/testing/execution.d.ts +1 -0
  706. package/dist/testing/execution.d.ts.map +1 -1
  707. package/dist/testing/index.d.ts +3 -0
  708. package/dist/testing/index.d.ts.map +1 -1
  709. package/dist/testing/index.js +3087 -1328
  710. package/dist/testing/index.js.map +17 -13
  711. package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
  712. package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
  713. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  714. package/dist/testing/object-read-scope-contract.d.ts +22 -0
  715. package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
  716. package/dist/testing/share-grant-storage-contract.d.ts +10 -0
  717. package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
  718. package/dist/testing/share-session-storage-contract.d.ts +9 -0
  719. package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
  720. package/dist/testing/workflow-execution.d.ts +1 -0
  721. package/dist/testing/workflow-execution.d.ts.map +1 -1
  722. package/dist/webhooks/internal.js +51 -56
  723. package/dist/webhooks/internal.js.map +2 -2
  724. package/dist/workers/index.js +11 -13
  725. package/dist/workers/index.js.map +2 -2
  726. package/dist/workflows/execution.d.ts.map +1 -1
  727. package/dist/workflows/failure.d.ts +2 -0
  728. package/dist/workflows/failure.d.ts.map +1 -1
  729. package/dist/workflows/index.js +135 -140
  730. package/dist/workflows/index.js.map +1 -1
  731. package/dist/workflows/request.d.ts.map +1 -1
  732. package/dist/workflows/run-dispatch.d.ts +0 -1
  733. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  734. package/dist/workflows/types.d.ts +2 -0
  735. package/dist/workflows/types.d.ts.map +1 -1
  736. package/package.json +72 -30
  737. package/src/actions/delegated-admission.ts +72 -0
  738. package/src/actions/descriptor.ts +58 -0
  739. package/src/actions/execution.ts +99 -24
  740. package/src/actions/request.ts +136 -19
  741. package/src/actions/run-authorization.ts +53 -0
  742. package/src/actions/run-dispatch.ts +10 -7
  743. package/src/actions/types/context.ts +2 -0
  744. package/src/actions/validation.ts +2 -1
  745. package/src/agents/adapters.ts +34 -429
  746. package/src/agents/authority.ts +3 -4
  747. package/src/agents/{context.ts → context/entries.ts} +4 -4
  748. package/src/agents/context/index.ts +15 -0
  749. package/src/agents/context-model.ts +1 -1
  750. package/src/agents/context-resolution.ts +2 -5
  751. package/src/agents/errors.ts +0 -10
  752. package/src/agents/execution.ts +13 -5
  753. package/src/agents/identity.ts +4 -0
  754. package/src/agents/index.ts +5 -24
  755. package/src/agents/message.ts +5 -6
  756. package/src/agents/model-loop.ts +62 -6
  757. package/src/agents/request.ts +27 -29
  758. package/src/agents/streams/index.ts +18 -0
  759. package/src/agents/streams/internal.ts +19 -0
  760. package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
  761. package/src/agents/tool-definition.ts +0 -19
  762. package/src/agents/types.ts +1 -1
  763. package/src/agents/validation.ts +9 -72
  764. package/src/ai-usage/execution.ts +4 -11
  765. package/src/auth/index.ts +0 -1
  766. package/src/authorization/decision.ts +29 -14
  767. package/src/authorization/grant-kinds.ts +10 -0
  768. package/src/authorization/index.ts +1 -0
  769. package/src/bootstrap/discovery.ts +84 -24
  770. package/src/bootstrap/index.ts +8 -1
  771. package/src/bootstrap/ontology-type-manifest.ts +12 -6
  772. package/src/datasets/builders.ts +23 -2
  773. package/src/datasets/changes.ts +16 -4
  774. package/src/datasets/execution.ts +76 -5
  775. package/src/datasets/index.ts +1 -0
  776. package/src/datasets/sequence.ts +77 -0
  777. package/src/datasets/types.ts +1 -0
  778. package/src/datasets/validation.ts +26 -0
  779. package/src/datasets/write.ts +240 -0
  780. package/src/errors/internal.ts +90 -10
  781. package/src/errors/redaction.ts +98 -0
  782. package/src/errors/types.ts +4 -0
  783. package/src/events/execution.ts +57 -7
  784. package/src/events/types/datasets.ts +2 -6
  785. package/src/execution/agent.ts +6 -7
  786. package/src/execution/authorization.ts +470 -90
  787. package/src/execution/authorized-object-reader.ts +695 -0
  788. package/src/execution/durable.ts +21 -3
  789. package/src/execution/index.ts +1 -0
  790. package/src/execution/primitive.ts +5 -1
  791. package/src/execution/request.ts +66 -13
  792. package/src/execution/scopes.ts +36 -6
  793. package/src/execution/types.ts +8 -0
  794. package/src/http/api-routes.ts +45 -0
  795. package/src/index.ts +56 -33
  796. package/src/lake-storage/definition-updates.ts +9 -0
  797. package/src/lake-storage/errors.ts +6 -1
  798. package/src/lake-storage/in-memory.ts +53 -17
  799. package/src/lake-storage/index.ts +10 -1
  800. package/src/lake-storage/merge-validation.ts +12 -2
  801. package/src/lake-storage/merge.ts +40 -2
  802. package/src/lake-storage/source-ordering.ts +95 -0
  803. package/src/lake-storage/sql-transforms.ts +2 -1
  804. package/src/lake-storage/types.ts +10 -5
  805. package/src/lake-storage/version-inputs.ts +14 -0
  806. package/src/logging/index.ts +2 -33
  807. package/src/logging/internal.ts +43 -0
  808. package/src/models/errors.ts +12 -0
  809. package/src/models/execution/binding.ts +29 -0
  810. package/src/models/execution/errors.ts +18 -0
  811. package/src/models/execution/index.ts +26 -0
  812. package/src/models/execution/model-call-accounting.ts +211 -0
  813. package/src/models/execution/model-call-admission.ts +127 -0
  814. package/src/models/execution/model-call-limits.ts +135 -0
  815. package/src/models/execution/model-call-recorder.ts +235 -0
  816. package/src/models/execution/model-call-recovery.ts +125 -0
  817. package/src/models/execution/recovery-queue.ts +31 -0
  818. package/src/models/execution/types.ts +58 -0
  819. package/src/models/execution/usage.ts +23 -0
  820. package/src/models/execution.ts +207 -0
  821. package/src/models/generation-types.ts +50 -0
  822. package/src/models/index.ts +8 -0
  823. package/src/models/language-model.ts +3 -0
  824. package/src/models/output.ts +45 -0
  825. package/src/models/resolve.ts +27 -0
  826. package/src/objects/authorized-ontology-view.ts +512 -0
  827. package/src/objects/execution.ts +99 -144
  828. package/src/objects/link/authorization.ts +3 -2
  829. package/src/objects/query/executor.ts +45 -34
  830. package/src/objects/query/links.ts +84 -25
  831. package/src/objects/query/selected-read-admission.ts +310 -0
  832. package/src/objects/query/validate.ts +353 -36
  833. package/src/objects/sdk/object-handle.ts +2 -8
  834. package/src/objects/sdk/object-set.ts +10 -11
  835. package/src/objects/sdk/runtime-query-executor.ts +8 -28
  836. package/src/objects/sdk/telemetry-channel.ts +11 -7
  837. package/src/objects/service/list-service.ts +15 -29
  838. package/src/objects/telemetry/history.ts +297 -17
  839. package/src/objects/telemetry/index.ts +2 -2
  840. package/src/objects/telemetry/workload.ts +79 -0
  841. package/src/ontology/index.ts +7 -2
  842. package/src/ontology/inference/index.ts +4 -1
  843. package/src/ontology/internal.ts +35 -1
  844. package/src/ontology/json-schema.ts +13 -12
  845. package/src/ontology/link-path-selection.ts +193 -0
  846. package/src/ontology/refs.ts +19 -0
  847. package/src/ontology/tokens.ts +15 -8
  848. package/src/pipelines/execution.ts +30 -7
  849. package/src/pipelines/request.ts +5 -0
  850. package/src/projections/execution.ts +72 -11
  851. package/src/projections/run-dispatch.ts +7 -12
  852. package/src/query.ts +0 -1
  853. package/src/queues/index.ts +4 -2
  854. package/src/queues/types.ts +6 -25
  855. package/src/rules/execution.ts +20 -8
  856. package/src/runtime/create.ts +7 -2
  857. package/src/runtime/definitions.ts +2 -0
  858. package/src/runtime/host.ts +27 -7
  859. package/src/runtime/internal.ts +1 -0
  860. package/src/runtime/resolve-definitions.ts +9 -0
  861. package/src/runtime/sixb.ts +27 -2
  862. package/src/runtime/types.ts +3 -0
  863. package/src/sandboxes/errors.ts +5 -0
  864. package/src/sandboxes/index.ts +3 -0
  865. package/src/sandboxes/sandbox.ts +35 -7
  866. package/src/schedules/execution.ts +24 -2
  867. package/src/security/every.ts +4 -0
  868. package/src/security/grants.ts +45 -3
  869. package/src/security/index.ts +1 -0
  870. package/src/security/registry.ts +3 -0
  871. package/src/security/types.ts +8 -0
  872. package/src/security/validation.ts +3 -0
  873. package/src/shares/access-plan.ts +225 -0
  874. package/src/shares/builders.ts +381 -0
  875. package/src/shares/compiler.ts +359 -0
  876. package/src/shares/errors.ts +3 -0
  877. package/src/shares/execution.ts +394 -0
  878. package/src/shares/index.ts +28 -0
  879. package/src/shares/internal.ts +9 -0
  880. package/src/shares/intersection.ts +178 -0
  881. package/src/shares/session-protocol.ts +258 -0
  882. package/src/shares/types.ts +76 -0
  883. package/src/shares/validation.ts +40 -0
  884. package/src/storage/agents/in-memory.ts +0 -3
  885. package/src/storage/agents/types.ts +0 -3
  886. package/src/storage/ai-cost/analytics.ts +1 -1
  887. package/src/storage/ai-cost/attribution.ts +15 -0
  888. package/src/storage/ai-cost/groups.ts +5 -1
  889. package/src/storage/ai-cost/provider.ts +1 -0
  890. package/src/storage/ai-cost/types.ts +7 -0
  891. package/src/storage/auth/in-memory.ts +1 -1
  892. package/src/storage/executions/in-memory.ts +13 -10
  893. package/src/storage/executions/provider.ts +34 -1
  894. package/src/storage/executions/run-link.ts +29 -0
  895. package/src/storage/executions/types.ts +6 -2
  896. package/src/storage/executions/validation.ts +78 -1
  897. package/src/storage/in-memory/index.ts +37 -3
  898. package/src/storage/index.ts +54 -29
  899. package/src/storage/internal.ts +20 -0
  900. package/src/storage/objects/execution-limits.ts +283 -0
  901. package/src/storage/objects/guard.ts +55 -0
  902. package/src/storage/objects/in-memory/index.ts +2 -0
  903. package/src/storage/objects/in-memory/keys.ts +46 -0
  904. package/src/storage/objects/in-memory/query.ts +754 -0
  905. package/src/storage/objects/in-memory/read-scope.ts +211 -0
  906. package/src/storage/objects/in-memory/read-source.ts +10 -0
  907. package/src/storage/objects/in-memory/selected-reader.ts +252 -0
  908. package/src/storage/objects/in-memory/storage.ts +589 -0
  909. package/src/storage/objects/index.ts +21 -0
  910. package/src/storage/objects/keys.ts +1 -1
  911. package/src/storage/objects/read-scope.ts +672 -0
  912. package/src/storage/objects/types.ts +123 -19
  913. package/src/storage/operation-scope.ts +16 -0
  914. package/src/storage/share-grants/errors.ts +14 -0
  915. package/src/storage/share-grants/in-memory.ts +107 -0
  916. package/src/storage/share-grants/index.ts +14 -0
  917. package/src/storage/share-grants/provider.ts +11 -0
  918. package/src/storage/share-grants/record.ts +347 -0
  919. package/src/storage/share-grants/types.ts +112 -0
  920. package/src/storage/share-sessions/errors.ts +14 -0
  921. package/src/storage/share-sessions/in-memory.ts +105 -0
  922. package/src/storage/share-sessions/index.ts +11 -0
  923. package/src/storage/share-sessions/provider.ts +9 -0
  924. package/src/storage/share-sessions/record.ts +176 -0
  925. package/src/storage/share-sessions/types.ts +57 -0
  926. package/src/storage/transaction.ts +14 -2
  927. package/src/storage/types.ts +27 -0
  928. package/src/storage/workflow-runs/in-memory.ts +0 -2
  929. package/src/storage/workflow-runs/types.ts +0 -3
  930. package/src/syncs/execution.ts +25 -5
  931. package/src/syncs/request.ts +5 -0
  932. package/src/testing/action-execution.ts +9 -2
  933. package/src/testing/agent-execution.ts +3 -0
  934. package/src/testing/agent-storage-contract.ts +0 -5
  935. package/src/testing/ai-model-call-groups-contract.ts +74 -2
  936. package/src/testing/dataset-sequence-contract.ts +373 -0
  937. package/src/testing/effective-storage-contract.ts +34 -0
  938. package/src/testing/execution-storage-contract.ts +138 -1
  939. package/src/testing/execution.ts +6 -0
  940. package/src/testing/index.ts +16 -0
  941. package/src/testing/lake-merge-storage-contract.ts +3 -0
  942. package/src/testing/lake-storage-contract.ts +58 -0
  943. package/src/testing/object-read-scope-contract.ts +939 -0
  944. package/src/testing/share-grant-storage-contract.ts +325 -0
  945. package/src/testing/share-session-storage-contract.ts +235 -0
  946. package/src/testing/workflow-execution.ts +4 -0
  947. package/src/workflows/execution.ts +53 -14
  948. package/src/workflows/failure.ts +62 -1
  949. package/src/workflows/request.ts +5 -9
  950. package/src/workflows/run-dispatch.ts +0 -3
  951. package/src/workflows/types.ts +2 -0
  952. package/src/workflows/validation.ts +1 -1
  953. package/dist/agents/context.d.ts.map +0 -1
  954. package/dist/agents/context.js +0 -23
  955. package/dist/agents/streams.d.ts.map +0 -1
  956. package/dist/agents/streams.js +0 -55
  957. package/dist/chunk-08m3b6w8.js +0 -32
  958. package/dist/chunk-08twe8m6.js +0 -218
  959. package/dist/chunk-2b5qtban.js.map +0 -14
  960. package/dist/chunk-2xns679x.js.map +0 -11
  961. package/dist/chunk-37wk412q.js +0 -1370
  962. package/dist/chunk-37wk412q.js.map +0 -23
  963. package/dist/chunk-3fqt22c4.js.map +0 -14
  964. package/dist/chunk-3kv70xwp.js.map +0 -10
  965. package/dist/chunk-407j3msh.js +0 -60
  966. package/dist/chunk-64sr682n.js.map +0 -12
  967. package/dist/chunk-6ed5bwnd.js.map +0 -57
  968. package/dist/chunk-7ds9620f.js.map +0 -10
  969. package/dist/chunk-7y0f6rf1.js.map +0 -10
  970. package/dist/chunk-atmkaf60.js.map +0 -11
  971. package/dist/chunk-c15dr03f.js +0 -43
  972. package/dist/chunk-d8qkxt2v.js.map +0 -10
  973. package/dist/chunk-dqn23610.js +0 -72
  974. package/dist/chunk-dqn23610.js.map +0 -11
  975. package/dist/chunk-e4rvtvpw.js.map +0 -34
  976. package/dist/chunk-gbrpsx4m.js.map +0 -11
  977. package/dist/chunk-h0knpbz5.js +0 -2486
  978. package/dist/chunk-h0knpbz5.js.map +0 -38
  979. package/dist/chunk-hdz94br2.js.map +0 -10
  980. package/dist/chunk-jq43kdvk.js +0 -50
  981. package/dist/chunk-n2arzn6e.js +0 -1745
  982. package/dist/chunk-n2arzn6e.js.map +0 -20
  983. package/dist/chunk-p03r0h5s.js.map +0 -16
  984. package/dist/chunk-qjzp9xyb.js.map +0 -12
  985. package/dist/chunk-tn7xcs2n.js.map +0 -13
  986. package/dist/chunk-wjgm6jjt.js.map +0 -13
  987. package/dist/chunk-xc7hq65b.js.map +0 -10
  988. package/dist/chunk-y35ma3mj.js +0 -551
  989. package/dist/chunk-y35ma3mj.js.map +0 -15
  990. package/dist/chunk-y64skrwp.js +0 -19
  991. package/dist/chunk-z2sery1b.js.map +0 -11
  992. package/dist/chunk-zcnhxkvd.js +0 -7
  993. package/dist/logging/types.js +0 -27
  994. package/dist/logging/types.js.map +0 -9
  995. package/dist/storage/objects/in-memory.d.ts.map +0 -1
  996. package/src/storage/objects/in-memory.ts +0 -1241
  997. /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
  998. /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
  999. /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/objects/action/request.ts", "../src/objects/errors.ts", "../src/objects/materializer-adapter.ts", "../src/objects/link/authorization.ts", "../src/objects/link/remove.ts", "../src/objects/link/endpoints.ts", "../src/objects/link/upsert.ts", "../src/objects/runtime-batch.ts", "../src/objects/link/upsert-batch.ts", "../src/objects/object/delete.ts", "../src/objects/object/upsert.ts", "../src/objects/object/upsert-batch.ts", "../src/objects/telemetry/write-batch.ts", "../src/objects/telemetry/append-batch.ts", "../src/objects/telemetry/history.ts", "../src/objects/context/resolve.ts", "../src/objects/sdk/telemetry-channel.ts", "../src/objects/sdk/object-handle.ts", "../src/objects/sdk/runtime-query-executor.ts", "../src/objects/sdk/object-set.ts", "../src/objects/service/action-service.ts", "../src/objects/service/link-service.ts", "../src/objects/service/list-service.ts", "../src/objects/service/object-service.ts", "../src/objects/service/telemetry-service.ts"],
4
+ "sourcesContent": [
5
+ "/**\n * Compatibility leaf operation: request an action on an object.\n *\n * The canonical action request path lives in `actions/request.ts`; object-bound\n * helpers delegate here by supplying an object subject.\n */\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n type RequestActionResult,\n requestAction as requestRuntimeAction,\n requestActionAndWait as requestRuntimeActionAndWait,\n} from \"../../actions/request\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport type { ExecutionObjectContext } from \"../context\"\n\nexport type { RequestActionAndWaitOptions, RequestActionOptions }\n\nexport async function requestAction(\n ctx: ExecutionObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionOptions\n }\n): Promise<RequestActionResult> {\n return requestRuntimeAction(ctx, ctx.execution, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n signal: params.options?.signal,\n })\n}\n\nexport async function requestActionAndWait(\n ctx: ExecutionObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionAndWaitOptions\n }\n): Promise<ActionRunRecord> {\n return requestRuntimeActionAndWait(ctx, ctx.execution, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n timeoutMs: params.options?.timeoutMs,\n signal: params.options?.signal,\n onRequested: params.options?.onRequested,\n })\n}\n",
6
+ "/**\n * Error for runtime invariants and failures specific to the objects module\n * (e.g., unexpected event results after appending an object/link event).\n */\nexport class ObjectError extends Error {\n readonly name = \"ObjectError\"\n}\n",
7
+ "/**\n * Runtime translation onto the ontology Materializer.\n *\n * Every typed and dynamic object/link mutation lowers to canonical Materializer operations here and\n * every Materializer result is mapped back to the public runtime shapes. The adapter owns no\n * ontology semantics: authority classification, effective resolution, validation, and event\n * construction all happen inside the Materializer's single commit.\n */\n\nimport { randomUUID } from \"node:crypto\"\nimport type { JsonValue } from \"../json\"\nimport type {\n EditCommitResult,\n EffectiveObjectSnapshot,\n MaterializationItemError,\n OntologyEditOperation,\n OntologyLinkRef,\n OntologyObjectRef,\n OntologyOperationOutcome,\n} from \"../materialization/model\"\nimport { normalizeJsonProperties } from \"../materializer\"\nimport type { ObjectLink, ValueType } from \"../ontology\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport {\n assertKnownProperties,\n assertLinkTargetType,\n normalizeLinkProperties,\n normalizeObjectProperties,\n validateLinkProperties,\n validateObjectProperties,\n} from \"../ontology/validation\"\nimport { getOntologyMutationRuntime } from \"../runtime/ontology-mutations\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport type { ObjectRow } from \"../storage\"\nimport { ObjectError } from \"./errors\"\n\n/** The runtime pieces one commit needs. */\nexport type RuntimeMaterializerContext = Pick<SixbRuntimeContext, \"projectId\" | \"storage\">\n\n/** One caller-supplied batch item, lowered to the operations it contributes. */\nexport interface RuntimeBatchGroup {\n /** Position in the caller's input array; item errors are reported against it. */\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeBatchCommit {\n readonly commit: EditCommitResult | null\n /** Outcomes per input position, in the order the item's operations were submitted. */\n readonly outcomes: ReadonlyMap<number, readonly OntologyOperationOutcome[]>\n}\n\n/**\n * Commits ordered operations as one atomic runtime commit.\n *\n * A fresh request id per call keeps each runtime mutation its own commit; the Materializer's\n * idempotency replay then only collapses a retry of the very same request.\n */\nexport async function commitRuntimeOperations(\n ctx: RuntimeMaterializerContext,\n operations: readonly OntologyEditOperation[]\n): Promise<EditCommitResult> {\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"atomic\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n operations,\n expectedObjects: [],\n expectedLinks: [],\n expectedLinkScopes: [],\n })\n return commit\n}\n\n/**\n * Commits grouped batch operations as one ordered continue-mode transaction.\n *\n * Successful items apply against one evolving authority state while semantic failures are recorded\n * per item. Provider, serialization, and CAS failures still roll the whole transaction back.\n *\n * An item that lowers to several operations is declared as one operation group so the Materializer\n * rolls the whole item back rather than committing the operations that ran before the failure.\n */\nexport async function commitRuntimeBatch(\n ctx: RuntimeMaterializerContext,\n groups: readonly RuntimeBatchGroup[]\n): Promise<RuntimeBatchCommit> {\n const operations = groups.flatMap((group) => group.operations)\n if (operations.length === 0) {\n return { commit: null, outcomes: new Map() }\n }\n\n const operationGroups = groups\n .filter((group) => group.operations.length > 1)\n .map((group) => group.operations.map((operation) => operation.id))\n\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"continue\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n operations,\n ...(operationGroups.length > 0 ? { operationGroups } : {}),\n })\n\n const byId = new Map(commit.outcomes.map((outcome) => [outcome.id, outcome]))\n const outcomes = new Map<number, readonly OntologyOperationOutcome[]>()\n for (const group of groups) {\n outcomes.set(\n group.index,\n group.operations.map((operation) => requireOutcome(byId, operation.id))\n )\n }\n return { commit, outcomes }\n}\n\n/**\n * Assigns the canonical operation id for one batch item.\n *\n * Ids derive from the caller's original ordinal so outcomes map back to input positions even when\n * earlier items failed local validation and never reached the Materializer.\n */\nexport function runtimeOperationId(index: number, subOrdinal = 0): string {\n return subOrdinal === 0 ? `op:${index}` : `op:${index}.${subOrdinal}`\n}\n\nexport interface NormalizedRuntimeObject {\n readonly primaryId: string\n /** Managed authority values; identity lives in the object ref, never in the properties. */\n readonly properties: Readonly<Record<string, JsonValue>>\n}\n\n/**\n * Validates and normalizes one runtime object input at the SDK/service boundary.\n *\n * Shape and value-type errors surface here so a batch can report them against the caller's original\n * position. Authority classification, required-property enforcement, and cardinality stay in the\n * Materializer, which validates the resolved effective object instead of the request.\n */\nexport function normalizeRuntimeObject(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly primaryPropertyId: string\n readonly properties: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): NormalizedRuntimeObject {\n const { objectType, primaryPropertyId, properties, valueTypesById } = input\n assertKnownProperties(objectType, properties)\n validateObjectProperties(objectType, properties, valueTypesById)\n\n const primaryValue = properties[primaryPropertyId]\n if (primaryValue === undefined || primaryValue === null) {\n throw new OntologyValidationError(\n `[Sixb] Missing primary property '${primaryPropertyId}' in upsert for '${objectType.id}'`\n )\n }\n\n const normalized = normalizeObjectProperties(\n objectType.properties,\n properties,\n valueTypesById,\n objectType.id\n )\n const { [primaryPropertyId]: _identity, ...managed } = normalized\n return {\n primaryId: String(primaryValue),\n properties: normalizeJsonProperties(managed, `${objectType.id} properties`),\n }\n}\n\n/**\n * Validates and normalizes one runtime link input.\n *\n * Managed link authority carries the complete property set, so required link properties must be\n * present in the request rather than inherited from the stored edge.\n */\nexport function normalizeRuntimeLink(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly linkDefinition: ObjectLink\n readonly linkId: string\n readonly targetTypeId: string\n readonly properties?: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n readonly isValidLinkTarget: (expected: string | string[], actual: string) => boolean\n}): Readonly<Record<string, JsonValue>> | undefined {\n const { objectType, linkDefinition, linkId, targetTypeId, properties, valueTypesById } = input\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, input.isValidLinkTarget)\n validateLinkProperties(objectType, linkDefinition, properties, undefined, valueTypesById)\n const normalized = normalizeLinkProperties(objectType, linkDefinition, properties, valueTypesById)\n if (normalized === undefined) return undefined\n return normalizeJsonProperties(normalized, `${objectType.id}.${linkId} properties`)\n}\n\nexport function objectUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n readonly properties: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.upsert\", ref: input.ref, properties: input.properties }\n}\n\nexport function objectDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.delete\", ref: input.ref }\n}\n\nexport function objectRestoreOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.restore\", ref: input.ref }\n}\n\nexport function linkUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n readonly properties?: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return {\n id: input.id,\n kind: \"link.upsert\",\n ref: input.ref,\n ...(input.properties !== undefined ? { properties: input.properties } : {}),\n }\n}\n\nexport function linkDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"link.delete\", ref: input.ref }\n}\n\n/** Reads the outcomes one batch item produced; the commit returns one per submitted operation. */\nexport function requireItemOutcomes(\n commit: RuntimeBatchCommit,\n index: number\n): readonly OntologyOperationOutcome[] {\n const outcomes = commit.outcomes.get(index)\n if (!outcomes || outcomes.length === 0) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for batch item ${index}.`)\n }\n return outcomes\n}\n\n/** Reads the effective object an ok outcome produced; runtime object writes always resolve one. */\nexport function requireEffectiveObject(outcome: OntologyOperationOutcome): EffectiveObjectSnapshot {\n if (!outcome.ok || !outcome.object) {\n throw new ObjectError(`[Sixb] Materializer returned no effective object for '${outcome.id}'.`)\n }\n return outcome.object\n}\n\nexport function toObjectRow(projectId: string, snapshot: EffectiveObjectSnapshot): ObjectRow {\n return {\n projectId,\n objectTypeId: snapshot.ref.objectTypeId,\n primaryId: snapshot.ref.primaryId,\n properties: structuredClone(snapshot.properties) as Record<string, unknown>,\n createdAt: new Date(snapshot.createdAt),\n updatedAt: new Date(snapshot.updatedAt),\n version: snapshot.version,\n lastCommitId: snapshot.lastCommitId,\n }\n}\n\n/** Rehydrates a persisted item error into the public runtime error type. */\nexport function toItemError(error: MaterializationItemError): Error {\n switch (error.code) {\n case \"validation\":\n return new OntologyValidationError(error.message)\n }\n}\n\nfunction requireOutcome(\n outcomes: ReadonlyMap<string, OntologyOperationOutcome>,\n id: string\n): OntologyOperationOutcome {\n const outcome = outcomes.get(id)\n if (!outcome) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for '${id}'.`)\n }\n return outcome\n}\n",
8
+ "/**\n * The authorization rule for writing a link, in one place because all three link leaves need it.\n */\nimport { assertAuthorized, assertCanEdit } from \"../../authorization\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\n\n/**\n * Assert a principal may create or remove a link.\n *\n * `edit` on the **source** type, `view` on the **target**: a link is declared on the source type\n * (`objectType.links`), and writing one changes the source's edges, not the target's properties.\n * Requiring `edit` on the target too would mean a clerk needs write access to every customer before\n * attaching an invoice to one.\n *\n * `view` on the target is still required, and for two reasons: it matches how links are *read* —\n * `canViewLink` already demands `view` on both endpoints — and without it the endpoint-existence\n * check that follows would answer whether a target the principal cannot see exists.\n *\n * Call this *before* any endpoint lookup, for that second reason.\n */\nexport function assertCanWriteLink(\n ctx: Pick<SixbRuntimeContext, \"projectId\" | \"runtimeAuthorization\" | \"authorization\">,\n endpoints: { readonly sourceTypeId: string; readonly targetTypeId: string }\n): void {\n assertCanEdit(ctx, endpoints.sourceTypeId)\n assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: endpoints.targetTypeId })\n}\n",
9
+ "/**\n * Leaf operation: remove a single link through the ontology Materializer.\n */\nimport { assertLinkTargetType } from \"../../ontology/validation\"\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkDeleteOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\n\nexport async function removeLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, (expected, actual) =>\n ontology.isValidLinkTarget(expected, actual)\n )\n\n // A missing link is a no-op: the delete records managed authority only when an effective edge\n // exists, so the commit reports `unchanged` instead of failing.\n await commitRuntimeOperations(ctx, [\n linkDeleteOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n }),\n ])\n}\n",
10
+ "/**\n * Shared endpoint existence reads for runtime link batches.\n *\n * The Materializer independently refuses a link whose endpoints are not effective. These reads exist\n * only so batch callers keep receiving the public {@link ObjectNotFoundError} for a missing endpoint\n * instead of a generic per-item validation error.\n */\n\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { objectBatchKey } from \"../../storage\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\n\nexport interface LinkEndpointItem {\n readonly objectType: { readonly id: string }\n readonly sourceId: string\n readonly targetTypeId: string\n readonly targetId: string\n}\n\nexport type EndpointExistence = ReadonlySet<string>\n\nexport function collectEndpointLookups(\n items: readonly LinkEndpointItem[]\n): { objectTypeId: string; primaryId: string }[] {\n const lookups: { objectTypeId: string; primaryId: string }[] = []\n const seen = new Set<string>()\n\n for (const item of items) {\n for (const endpoint of [\n { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n ]) {\n const key = endpointKey(endpoint.objectTypeId, endpoint.primaryId)\n if (seen.has(key)) continue\n seen.add(key)\n lookups.push(endpoint)\n }\n }\n\n return lookups\n}\n\nexport async function loadEndpointExistence(\n ctx: Pick<SixbRuntimeContext, \"projectId\" | \"storage\">,\n lookups: readonly { objectTypeId: string; primaryId: string }[]\n): Promise<EndpointExistence> {\n if (lookups.length === 0) return new Set()\n const rows = await ctx.storage.objects.getByPrimaryIdBatch({\n projectId: ctx.projectId,\n items: lookups,\n })\n return new Set(rows.keys())\n}\n\n/** Throws {@link ObjectNotFoundError} for the first endpoint the read did not find. */\nexport function requireEndpoints(item: LinkEndpointItem, existing: EndpointExistence): void {\n if (!existing.has(endpointKey(item.objectType.id, item.sourceId))) {\n throw new ObjectNotFoundError(item.objectType.id, item.sourceId, \"Source object not found\")\n }\n if (!existing.has(endpointKey(item.targetTypeId, item.targetId))) {\n throw new ObjectNotFoundError(item.targetTypeId, item.targetId, \"Target object not found\")\n }\n}\n\nfunction endpointKey(objectTypeId: string, primaryId: string): string {\n return objectBatchKey(objectTypeId, primaryId)\n}\n",
11
+ "/**\n * Leaf operation: upsert a single link through the ontology Materializer.\n */\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId, properties } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n const endpoints = { objectType, sourceId, targetTypeId, targetId }\n\n // Endpoint reads keep the public `ObjectNotFoundError` contract; the Materializer independently\n // refuses a link whose endpoints are not effective when it commits. This runs before property\n // normalization so the same input reports the same error class here and through the batch APIs,\n // which check endpoints first inside `plan`.\n requireEndpoints(endpoints, await loadEndpointExistence(ctx, collectEndpointLookups([endpoints])))\n\n const normalizedProperties = normalizeRuntimeLink({\n objectType,\n linkDefinition,\n linkId,\n targetTypeId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n\n await commitRuntimeOperations(ctx, [\n linkUpsertOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n ...(normalizedProperties !== undefined ? { properties: normalizedProperties } : {}),\n }),\n ])\n}\n",
12
+ "/**\n * Per-item mechanics shared by every runtime batch.\n *\n * One place owns the rules the public batch APIs promise: a local failure stays at its own input\n * position, an identical repeat collapses onto the first item and shares its result, a conflicting\n * repeat is rejected, and each item's Materializer outcomes map back to the position they came from.\n */\n\nimport type { OntologyEditOperation, OntologyOperationOutcome } from \"../materialization/model\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { BatchItemResult } from \"../runtime/types\"\nimport {\n commitRuntimeBatch,\n type RuntimeMaterializerContext,\n requireItemOutcomes,\n toItemError,\n} from \"./materializer-adapter\"\n\nexport interface RuntimeBatchItemPlan {\n /** Identity this item claims. A later item claiming it must be identical. */\n readonly key: string\n /** How that identity reads in an error message, e.g. `object 'room:r1'`. */\n readonly label: string\n /** Canonical content, so an identical repeat is recognized as one. */\n readonly fingerprint: string\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeItemBatch<TItem, TValue> {\n readonly ctx: RuntimeMaterializerContext\n readonly items: readonly TItem[]\n /** Lowers one item, throwing to record a local failure at that item's position. */\n plan(item: TItem, index: number): RuntimeBatchItemPlan\n /** Maps the outcomes of a fully successful item to its public value. */\n value(outcomes: readonly OntologyOperationOutcome[]): TValue\n}\n\ninterface PlannedItem {\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\ninterface ClaimedIdentity {\n readonly index: number\n readonly fingerprint: string\n}\n\nexport async function runRuntimeItemBatch<TItem, TValue>(\n batch: RuntimeItemBatch<TItem, TValue>\n): Promise<readonly BatchItemResult<TValue>[]> {\n const { items } = batch\n if (items.length === 0) return []\n\n const results: BatchItemResult<TValue>[] = new Array(items.length)\n const planned: PlannedItem[] = []\n const claims = new Map<string, ClaimedIdentity>()\n /** Positions that repeat an earlier identical item and share its result. */\n const aliases = new Map<number, number>()\n\n for (const [index, item] of items.entries()) {\n let plan: RuntimeBatchItemPlan\n try {\n plan = batch.plan(item, index)\n } catch (error) {\n results[index] = {\n ok: false,\n error: error instanceof Error ? error : new Error(String(error)),\n }\n continue\n }\n\n const claimed = claims.get(plan.key)\n if (claimed) {\n if (claimed.fingerprint !== plan.fingerprint) {\n results[index] = {\n ok: false,\n error: new OntologyValidationError(\n `[Sixb] Conflicting duplicate ${plan.label} at batch positions ${claimed.index} and ${index}`\n ),\n }\n continue\n }\n aliases.set(index, claimed.index)\n continue\n }\n\n claims.set(plan.key, { index, fingerprint: plan.fingerprint })\n planned.push({ index, operations: plan.operations })\n }\n\n const commit = await commitRuntimeBatch(batch.ctx, planned)\n\n for (const { index } of planned) {\n const outcomes = requireItemOutcomes(commit, index)\n const failed = outcomes.find((outcome) => !outcome.ok)\n results[index] =\n failed?.ok === false\n ? { ok: false, error: toItemError(failed.error) }\n : { ok: true, value: batch.value(outcomes) }\n }\n for (const [index, source] of aliases) {\n results[index] = results[source]\n }\n return results\n}\n",
13
+ "/**\n * Leaf operation: batch upsert links through the ontology Materializer.\n *\n * Takes SixbRuntimeContext (shared infra) + per-item pre-resolved data, because each item can target\n * a different objectType + linkDefinition. Everything valid is submitted as one ordered\n * continue-mode commit.\n */\n\nimport { stableJsonStringify } from \"../../json\"\nimport { linkRefKey } from \"../../materialization/refs\"\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport {\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLinkBatch(\n ctx: SixbRuntimeContext,\n items: readonly ResolvedLinkBatchItem[]\n): Promise<readonly BatchItemResult<void>[]> {\n const { ontology } = ctx\n if (items.length === 0) return []\n\n // Every item, up front, and before the endpoint lookup below. Authorization is a precondition, not\n // a per-item validation: a refused item must not become one failed `BatchItemResult` while the\n // rest of the batch commits. Asserting inside `plan` would do exactly that, and would also let the\n // existence lookup answer for targets the principal cannot see.\n for (const item of items) {\n assertCanWriteLink(ctx, {\n sourceTypeId: item.objectType.id,\n targetTypeId: item.targetTypeId,\n })\n }\n\n const existing = await loadEndpointExistence(ctx, collectEndpointLookups(items))\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n requireEndpoints(item, existing)\n const properties = normalizeRuntimeLink({\n objectType: item.objectType,\n linkDefinition: item.linkDefinition,\n linkId: item.linkId,\n targetTypeId: item.targetTypeId,\n properties: item.properties,\n valueTypesById,\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n const ref = {\n source: { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n linkId: item.linkId,\n target: { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n }\n const edge = linkRefKey(ref)\n return {\n key: edge,\n // The key is a JSON array, which is unreadable in the error an operator sees on a failed\n // link projection. Name the edge the way the object path names an object.\n label: `link '${item.objectType.id}:${item.sourceId}.${item.linkId} -> ${item.targetTypeId}:${item.targetId}'`,\n fingerprint: stableJsonStringify(properties ?? null),\n operations: [\n linkUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n ...(properties !== undefined ? { properties } : {}),\n }),\n ],\n }\n },\n value: () => undefined,\n })\n}\n",
14
+ "/**\n * Leaf operations: delete and restore a single object through the ontology Materializer.\n *\n * Both are thin wrappers over one materializer operation, exactly like `removeLink` — the cascade\n * over links and the effective-state bookkeeping happen inside the commit.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n objectDeleteOperation,\n objectRestoreOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\n\n/**\n * Delete the object with this primary id.\n *\n * A missing object is a no-op: the delete records managed authority only where effective state\n * exists, so the commit reports `unchanged` rather than failing. An object a projection also writes\n * stays hidden even while the projection keeps asserting it — `restore()` is what reveals it again.\n */\nexport async function deleteObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectDeleteOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n\n/**\n * Withdraw a previous delete.\n *\n * For an object written only from code this is a no-op — there is nothing left to reveal, so write it\n * again instead. For an object a projection also writes, it makes the projected state visible again.\n */\nexport async function restoreObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectRestoreOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n",
15
+ "/**\n * Leaf operation: upsert a single object through the ontology Materializer.\n */\n\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\n\nexport async function upsertObject(\n ctx: ResolvedObjectContext,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n\n // The Materializer classifies this as an independent create, a patch over source authority, or a\n // restore plus patch inside its own transaction.\n const commit = await commitRuntimeOperations(ctx, [\n objectUpsertOperation({ id: runtimeOperationId(0), ref, properties: normalized.properties }),\n ])\n return toObjectRow(ctx.projectId, requireEffectiveObject(commit.outcomes[0]))\n}\n",
16
+ "/**\n * Leaf operation: batch upsert objects of a single type through the ontology Materializer.\n *\n * Everything that survives local normalization is submitted as one ordered continue-mode commit, so\n * later items observe earlier ones and a provider failure rolls the whole batch back.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport { stableJsonStringify } from \"../../json\"\nimport type { BatchItemResult } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\n\nexport async function upsertObjectBatch(\n ctx: ResolvedObjectContext,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties: item.properties,\n valueTypesById,\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n return {\n // One commit resolves one authority state per object, so two items for the same identity are\n // unambiguous only when they ask for the same thing.\n key: `${ref.objectTypeId}:${ref.primaryId}`,\n label: `object '${ref.objectTypeId}:${ref.primaryId}'`,\n fingerprint: stableJsonStringify(normalized.properties),\n operations: [\n objectUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n properties: normalized.properties,\n }),\n ],\n }\n },\n value: ([outcome]) => toObjectRow(ctx.projectId, requireEffectiveObject(outcome)),\n })\n}\n",
17
+ "/**\n * Low-level write: append normalized telemetry points through the ontology Materializer.\n *\n * Shared by the batch operation and the per-property appenders in ObjectByIdHandle. The Materializer\n * persists immutable point history, derives latest telemetry state, and writes the commit's outbox\n * facts in one transaction, so this leaf never appends events or writes providers itself.\n */\nimport { randomUUID } from \"node:crypto\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport { MaterializationObjectNotFoundError } from \"../../materialization/errors\"\nimport type { TelemetryCommitResult, TelemetryPointWrite } from \"../../materialization/model\"\nimport { getOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\nimport type { RuntimeMaterializerContext } from \"../materializer-adapter\"\n\nexport type TelemetryWriteContext = RuntimeMaterializerContext & {\n readonly authorization?: AuthorizationContext\n}\n\nexport async function writeTelemetryBatch(\n ctx: TelemetryWriteContext,\n points: readonly TelemetryPointWrite[]\n): Promise<TelemetryCommitResult | null> {\n // Asserted from the points rather than a resolved context: this leaf is the low-level choke point\n // for both `appendTelemetryBatch` and the per-property `TelemetryChannel`, and only the points know\n // which object types the call actually touches.\n for (const objectTypeId of new Set(points.map((point) => point.series.object.objectTypeId))) {\n assertCanAppendTelemetry(ctx, objectTypeId)\n }\n if (points.length === 0) return null\n\n let commit: TelemetryCommitResult\n try {\n commit = await getOntologyMutationRuntime(ctx).appendTelemetry({\n source: { kind: \"runtime\", requestId: randomUUID() },\n points,\n })\n } catch (error) {\n if (error instanceof MaterializationObjectNotFoundError) {\n throw new ObjectNotFoundError(\n error.objectTypeId,\n error.primaryId,\n \"Object not found for telemetry append\"\n )\n }\n throw error\n }\n return commit\n}\n",
18
+ "/**\n * Leaf operation: batch telemetry append for multiple objects of a single type.\n */\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport { telemetryPointKey } from \"../../materialization/refs\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport { assertTelemetryProperty } from \"../../ontology/validation\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { writeTelemetryBatch } from \"./write-batch\"\n\n/**\n * Type guard for telemetry values that carry an explicit unit.\n *\n * Matches only the exact `{ value, unit }` wrapper (a string `unit` and no other\n * keys) so a legitimate JSON/object telemetry value is not silently\n * reinterpreted as value+unit. A fully explicit batch contract (passing units\n * out-of-band like the single-property appender) is tracked as a follow-up;\n * this narrows the heuristic without changing the public batch API.\n */\nfunction isUnitBearingValue(raw: unknown): raw is { value: unknown; unit: string } {\n if (raw === null || typeof raw !== \"object\") {\n return false\n }\n const record = raw as Record<string, unknown>\n return \"value\" in record && typeof record.unit === \"string\" && Object.keys(record).length === 2\n}\n\nexport async function appendTelemetryBatch(\n ctx: ResolvedObjectContext,\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n): Promise<void> {\n // `writeTelemetryBatch` asserts again from the points it receives. Asserting here as well is not\n // redundant: it reports the type by name before any property is resolved, and it still refuses an\n // empty batch, which produces no points to assert over.\n assertCanAppendTelemetry(ctx, ctx.objectType.id)\n const { objectType } = ctx\n // Telemetry identity is `(series, at)`, so a repeated instant inside one call is an upsert: the\n // last value wins rather than failing the whole batch.\n const points = new Map<string, TelemetryPointWrite>()\n\n for (const item of items) {\n const at = (item.at ?? new Date()).toISOString()\n\n for (const [propertyId, rawValue] of Object.entries(item.properties)) {\n const propertyToken = objectType.p[propertyId]\n if (!propertyToken) {\n throw new OntologyValidationError(`Unknown property '${objectType.id}.${propertyId}'`)\n }\n\n assertTelemetryProperty(propertyToken.property)\n\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n const series = {\n object: { objectTypeId: objectType.id, primaryId: item.id },\n propertyId: propertyToken.id,\n }\n points.set(telemetryPointKey(series, at), {\n series,\n value: isUnitBearingValue(rawValue)\n ? (rawValue.value as TelemetryPointWrite[\"value\"])\n : (rawValue as TelemetryPointWrite[\"value\"]),\n ...(isUnitBearingValue(rawValue) ? { unit: rawValue.unit } : {}),\n at,\n })\n }\n }\n\n await writeTelemetryBatch(ctx, [...points.values()])\n}\n",
19
+ "import { createSixbError } from \"../../errors/internal\"\nimport type { AuthorizedObjectReader } from \"../../execution/authorized-object-reader\"\nimport type {\n TimeseriesHistoryBatchInput,\n TimeseriesHistoryBatchResult,\n TimeseriesHistorySeriesInput,\n TimeseriesPoint,\n TimeseriesStorage,\n} from \"../../storage\"\n\nexport interface TelemetryHistoryOptions {\n readonly storage: TimeseriesStorage\n readonly objectReader: AuthorizedObjectReader\n}\n\nexport type TelemetryHistoryBatchInput = Omit<TimeseriesHistoryBatchInput, \"projectId\">\n\ninterface SnapshotTelemetryHistoryRequest extends TelemetryHistoryBatchInput {\n readonly maxPointOccurrences?: number\n}\n\n/** Read only series selected for the exact object occurrence carried by the nominal reader. */\nexport async function getTelemetryHistoryBatch(\n input: TelemetryHistoryBatchInput,\n options: TelemetryHistoryOptions\n): Promise<readonly TimeseriesHistoryBatchResult[]> {\n // Capture both provider capabilities before reading caller-owned request fields.\n const objectReader = options.objectReader\n const storage = options.storage\n const projectId = objectReader.projectId\n const request = snapshotTelemetryHistoryInput(input, objectReader)\n\n const uniqueSeries = deduplicateSeries(request.series)\n const readableSeries = await selectReadableSeries(uniqueSeries, objectReader)\n const resultsBySeries = await readAndValidateHistory({\n storage,\n projectId,\n request,\n series: readableSeries,\n })\n\n // Objects and telemetry do not share a portable read snapshot. Recheck live selection after\n // all provider-owned values have been detached, before deciding which points to return.\n const releasableSeries =\n readableSeries.length === 0 ? [] : await selectReadableSeries(readableSeries, objectReader)\n const result = assembleHistoryResults({ request, resultsBySeries, releasableSeries })\n objectReader.assertVisibleOutputWithinLimit(result)\n return result\n}\n\n/** Read the latest point only while its exact object property remains selected. */\nexport async function getLatestTelemetryPoint(\n input: TimeseriesHistorySeriesInput,\n options: TelemetryHistoryOptions\n): Promise<TimeseriesPoint | null> {\n const objectReader = options.objectReader\n const storage = options.storage\n const projectId = objectReader.projectId\n const series = snapshotTelemetrySeries(input)\n const readable = await objectReader.canReadObjectProperty(objectPropertySelection(series))\n if (!readable) return visibleLatestResult(null, objectReader)\n\n const rawResult = await storage.getLatest({ projectId, ...series })\n const result = rawResult === null ? null : snapshotProviderPoint(rawResult)\n if (result) assertTimeseriesPointMatchesSeries(projectId, series, result)\n\n // See the batch release check above. Revocation during the timeseries read hides the result.\n const releaseReadable = await objectReader.canReadObjectProperty(objectPropertySelection(series))\n if (!releaseReadable) return visibleLatestResult(null, objectReader)\n\n return visibleLatestResult(result, objectReader)\n}\n\nfunction deduplicateSeries(\n series: readonly TimeseriesHistorySeriesInput[]\n): TimeseriesHistorySeriesInput[] {\n const uniqueSeries = new Map<string, TimeseriesHistorySeriesInput>()\n for (const item of series) {\n const key = seriesKey(item)\n if (!uniqueSeries.has(key)) uniqueSeries.set(key, item)\n }\n return [...uniqueSeries.values()]\n}\n\nasync function selectReadableSeries(\n series: readonly TimeseriesHistorySeriesInput[],\n objectReader: AuthorizedObjectReader\n): Promise<readonly TimeseriesHistorySeriesInput[]> {\n const readable = await objectReader.canReadObjectPropertiesBatch({\n items: series.map(objectPropertySelection),\n })\n return series.filter((_, index) => readable[index] === true)\n}\n\nasync function readAndValidateHistory(input: {\n readonly storage: TimeseriesStorage\n readonly projectId: string\n readonly request: SnapshotTelemetryHistoryRequest\n readonly series: readonly TimeseriesHistorySeriesInput[]\n}): Promise<ReadonlyMap<string, TimeseriesHistoryBatchResult>> {\n const { storage, projectId, request, series } = input\n\n // The provider receives its own detached request. It must never retain or mutate the canonical\n // series snapshot that admission and the final release check rely on.\n const providerRequest = structuredClone({\n projectId,\n series,\n ...(request.from === undefined ? {} : { from: request.from }),\n ...(request.to === undefined ? {} : { to: request.to }),\n ...(request.limitPerSeries === undefined ? {} : { limitPerSeries: request.limitPerSeries }),\n ...(request.order === undefined ? {} : { order: request.order }),\n })\n const stored = series.length === 0 ? [] : await storage.getHistoryBatch(providerRequest)\n\n // Fully detach and validate provider-owned data before the final live check. A provider result\n // may contain accessors or a custom iterator; none of that code may run after release admission.\n if (!Array.isArray(stored)) throw invalidTimeseriesProviderResult()\n const storedCount = stored.length\n if (!Number.isSafeInteger(storedCount) || storedCount > series.length) {\n throw invalidTimeseriesProviderResult()\n }\n const seriesKeys = new Set(series.map(seriesKey))\n const providerResultBySeries = new Map<string, TimeseriesHistoryBatchResult>()\n for (let index = 0; index < storedCount; index += 1) {\n const providerResult = snapshotProviderResult(stored[index]!, request.limitPerSeries)\n const key = seriesKey(providerResult)\n if (providerResultBySeries.has(key) || !seriesKeys.has(key)) {\n throw invalidTimeseriesProviderResult()\n }\n for (const point of providerResult.points) {\n assertTimeseriesPointMatchesSeries(projectId, providerResult, point)\n }\n providerResultBySeries.set(key, providerResult)\n }\n\n return providerResultBySeries\n}\n\n/** Restore request order and duplicates, with independent point copies for every occurrence. */\nfunction assembleHistoryResults(input: {\n readonly request: SnapshotTelemetryHistoryRequest\n readonly resultsBySeries: ReadonlyMap<string, TimeseriesHistoryBatchResult>\n readonly releasableSeries: readonly TimeseriesHistorySeriesInput[]\n}): readonly TimeseriesHistoryBatchResult[] {\n const { request, resultsBySeries, releasableSeries } = input\n const releasableSeriesKeys = new Set(releasableSeries.map(seriesKey))\n const releasedPoints = request.series.map((series) =>\n releasableSeriesKeys.has(seriesKey(series))\n ? (resultsBySeries.get(seriesKey(series))?.points ?? [])\n : []\n )\n const pointOccurrences = releasedPoints.reduce((total, points) => total + points.length, 0)\n if (request.maxPointOccurrences !== undefined && pointOccurrences > request.maxPointOccurrences) {\n throw invalidTimeseriesProviderResult()\n }\n return request.series.map((series, index) => ({\n ...series,\n points: releasedPoints[index]!.map((point) => structuredClone(point)),\n }))\n}\n\nfunction snapshotTelemetrySeries(\n series: TimeseriesHistorySeriesInput\n): TimeseriesHistorySeriesInput {\n if (typeof series !== \"object\" || series === null || Array.isArray(series)) {\n throw new Error(\"[Sixb] Telemetry history series must be an object.\")\n }\n const objectTypeId = telemetryIdentifier(series.objectTypeId, \"objectTypeId\")\n const objectId = telemetryIdentifier(series.objectId, \"objectId\")\n const propertyId = telemetryIdentifier(series.propertyId, \"propertyId\")\n return structuredClone({ objectTypeId, objectId, propertyId })\n}\n\nfunction assertTimeseriesPointMatchesSeries(\n projectId: string,\n series: TimeseriesHistorySeriesInput,\n point: TimeseriesPoint\n): void {\n if (\n typeof point !== \"object\" ||\n point === null ||\n point.projectId !== projectId ||\n point.objectTypeId !== series.objectTypeId ||\n point.objectId !== series.objectId ||\n point.propertyId !== series.propertyId\n ) {\n throw invalidTimeseriesProviderResult()\n }\n}\n\nfunction snapshotTelemetryHistoryInput(\n input: TelemetryHistoryBatchInput,\n objectReader: AuthorizedObjectReader\n): SnapshotTelemetryHistoryRequest {\n const authoredSeries = input.series\n const from = input.from\n const to = input.to\n const limitPerSeries = input.limitPerSeries\n const order = input.order\n if (!Array.isArray(authoredSeries)) {\n throw new Error(\"[Sixb] Telemetry history series must be an array.\")\n }\n if (order !== undefined && order !== \"asc\" && order !== \"desc\") {\n throw new Error(\"[Sixb] Telemetry history order must be 'asc' or 'desc'.\")\n }\n\n // Capture length once and walk by index so proxies cannot change the iteration shape halfway.\n const seriesCount = authoredSeries.length\n const admission = objectReader.admitTelemetryHistoryRead({\n seriesCount,\n ...(limitPerSeries === undefined ? {} : { limitPerSeries }),\n })\n const series: TimeseriesHistorySeriesInput[] = []\n for (let index = 0; index < seriesCount; index += 1) {\n series.push(snapshotTelemetrySeries(authoredSeries[index]!))\n }\n return structuredClone({\n series,\n ...(from === undefined ? {} : { from }),\n ...(to === undefined ? {} : { to }),\n ...(admission.limitPerSeries === undefined ? {} : { limitPerSeries: admission.limitPerSeries }),\n ...(order === undefined ? {} : { order }),\n ...(admission.maxPointOccurrences === undefined\n ? {}\n : { maxPointOccurrences: admission.maxPointOccurrences }),\n })\n}\n\nfunction objectPropertySelection(series: TimeseriesHistorySeriesInput): {\n readonly objectTypeId: string\n readonly primaryId: string\n readonly propertyId: string\n} {\n return {\n objectTypeId: series.objectTypeId,\n primaryId: series.objectId,\n propertyId: series.propertyId,\n }\n}\n\nfunction visibleLatestResult<T extends TimeseriesPoint | null>(\n result: T,\n objectReader: AuthorizedObjectReader\n): T {\n objectReader.assertVisibleOutputWithinLimit(result)\n return result\n}\n\nfunction snapshotProviderResult(\n result: TimeseriesHistoryBatchResult,\n maxPointsPerSeries: number | undefined\n): TimeseriesHistoryBatchResult {\n try {\n if (typeof result !== \"object\" || result === null || Array.isArray(result)) {\n throw invalidTimeseriesProviderResult()\n }\n const series = snapshotTelemetrySeries(result)\n const authoredPoints = result.points\n if (!Array.isArray(authoredPoints)) throw invalidTimeseriesProviderResult()\n const pointCount = authoredPoints.length\n if (\n !Number.isSafeInteger(pointCount) ||\n (maxPointsPerSeries !== undefined && pointCount > maxPointsPerSeries)\n ) {\n throw invalidTimeseriesProviderResult()\n }\n const points: TimeseriesPoint[] = []\n for (let index = 0; index < pointCount; index += 1) {\n points.push(snapshotProviderPoint(authoredPoints[index]!))\n }\n return { ...series, points }\n } catch (error) {\n if (isInvalidTimeseriesProviderResult(error)) throw error\n throw invalidTimeseriesProviderResult(error)\n }\n}\n\nfunction snapshotProviderPoint(point: TimeseriesPoint): TimeseriesPoint {\n try {\n const snapshot = structuredClone(point)\n if (!snapshot || typeof snapshot !== \"object\") throw invalidTimeseriesProviderResult()\n return snapshot\n } catch (error) {\n if (isInvalidTimeseriesProviderResult(error)) throw error\n throw invalidTimeseriesProviderResult(error)\n }\n}\n\nfunction invalidTimeseriesProviderResult(cause?: unknown): Error {\n return createSixbError(\n \"internal.unexpected\",\n \"[Sixb] Timeseries storage returned data outside the requested series.\",\n cause === undefined ? {} : { cause }\n )\n}\n\nfunction isInvalidTimeseriesProviderResult(\n error: unknown\n): error is Error & { readonly code: \"internal.unexpected\" } {\n return (\n error instanceof Error &&\n \"code\" in error &&\n error.code === \"internal.unexpected\" &&\n error.message === \"[Sixb] Timeseries storage returned data outside the requested series.\"\n )\n}\n\nfunction telemetryIdentifier(value: unknown, field: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw new Error(`[Sixb] Telemetry history ${field} must be a non-empty string.`)\n }\n return value\n}\n\nfunction seriesKey(series: TimeseriesHistorySeriesInput): string {\n return JSON.stringify([series.objectTypeId, series.objectId, series.propertyId])\n}\n",
20
+ "/**\n * Context resolution factories.\n *\n * Resolve ontology identifiers into concrete type data so leaf functions\n * receive all structural information pre-resolved.\n */\n\nimport type { ObjectLink } from \"../../ontology\"\nimport { OntologyNotFoundError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkContext, ResolvedObjectContext } from \"./types\"\n\n/** Look up a link definition on an object type, throwing if not found. */\nexport function requireLinkDefinition(\n objectType: ObjectTypeWithPropertyTokens,\n linkId: string\n): ObjectLink {\n const def = objectType.links.find((l) => l.id === linkId)\n if (!def) throw new OntologyNotFoundError(`Unknown link '${objectType.id}.${linkId}'`)\n return def\n}\n\n/**\n * Resolve an object type id to a full ResolvedObjectContext.\n *\n * Uses ontology.resolveObjectType() and getPrimaryPropertyId() — these\n * are structural resolution calls that belong in factories, not leaf functions.\n */\nexport function resolveObjectContext(\n runtime: SixbRuntimeContext,\n objectTypeId: string\n): ResolvedObjectContext {\n const objectType = runtime.ontology.resolveObjectType(objectTypeId)\n const primaryPropertyId = runtime.ontology.getPrimaryPropertyId(objectTypeId)\n return { ...runtime, objectType, primaryPropertyId }\n}\n\n/**\n * Resolve a link id to a full ResolvedLinkContext.\n *\n * Uses requireLinkDefinition to look up the link definition on the\n * already-resolved object type.\n */\nexport function resolveLinkContext(\n objCtx: ResolvedObjectContext,\n linkId: string\n): ResolvedLinkContext {\n const linkDefinition = requireLinkDefinition(objCtx.objectType, linkId)\n return { ...objCtx, linkDefinition }\n}\n",
21
+ "/**\n * Telemetry channel factory for ObjectByIdHandle.\n *\n * Creates a per-property channel that writes through the low-level `writeTelemetryBatch` leaf and\n * reads the same series back through `getTelemetryHistoryBatch`, both keyed by the property token.\n */\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport type { ValueType } from \"../../ontology\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport {\n assertPropertyTokenBelongsToObjectType,\n assertTelemetryProperty,\n} from \"../../ontology/validation\"\nimport { RuntimeError } from \"../../runtime/errors\"\nimport type {\n TelemetryChannel,\n TelemetryHistoryInput,\n TelemetryPropertyToken,\n} from \"../../runtime/types\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { getTelemetryHistoryBatch, writeTelemetryBatch } from \"../telemetry\"\n\nexport function createTelemetryChannel<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ResolvedObjectContext, primaryId: string) {\n return <TToken extends TelemetryPropertyToken<TObjectType>>(\n property: TToken\n ): TelemetryChannel<TToken, TValueTypes> => {\n const { objectType } = ctx\n assertPropertyTokenBelongsToObjectType(objectType, property)\n assertTelemetryProperty(property.property)\n\n const series = { objectTypeId: objectType.id, objectId: primaryId, propertyId: property.id }\n\n const channel = {\n append: async (input: { value: unknown; unit?: string; at: Date }) => {\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n await writeTelemetryBatch(ctx, [\n {\n series: {\n object: { objectTypeId: objectType.id, primaryId },\n propertyId: property.id,\n },\n value: input.value as TelemetryPointWrite[\"value\"],\n ...(input.unit !== undefined ? { unit: input.unit } : {}),\n at: input.at.toISOString(),\n },\n ])\n },\n\n history: async (input: TelemetryHistoryInput = {}) => {\n const timeseries = ctx.storage.timeseries\n const objectReader = ctx.objectReader\n if (!timeseries) {\n throw new RuntimeError(\"[Sixb] Reading telemetry requires storage.timeseries support.\")\n }\n\n const from = input.from\n const to = input.to\n const limit = input.limit\n const order = input.order\n\n const [result] = await getTelemetryHistoryBatch(\n {\n series: [series],\n ...(from !== undefined ? { from } : {}),\n ...(to !== undefined ? { to } : {}),\n ...(limit !== undefined ? { limitPerSeries: limit } : {}),\n ...(order !== undefined ? { order } : {}),\n },\n {\n storage: timeseries,\n objectReader,\n }\n )\n\n return (result?.points ?? []).map((point) => ({\n value: point.value,\n at: point.at,\n ...(point.unit !== undefined ? { unit: point.unit } : {}),\n }))\n },\n }\n\n // Cast needed: generic token inference boundary — TToken is narrower than what `channel` sees\n return channel as unknown as TelemetryChannel<TToken, TValueTypes>\n }\n}\n",
22
+ "/**\n * ObjectByIdHandle binds operations to a specific object id within an ObjectSet.\n * Created via `sixb.objects(MyType).byId(\"id-1\")`, it provides link/unlink and\n * per-property telemetry appenders with compile-time unit and value type safety.\n */\nimport type { ActionDefinition } from \"../../actions\"\nimport type { ObjectLink, ObjectRef, ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { LinkToken, ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { assertLinkTokenBelongsToObjectType } from \"../../ontology/validation\"\nimport type { ObjectByIdHandle, TwinObject } from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ExecutionObjectContext, ResolvedLinkContext } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { deleteObject, restoreObject } from \"../object\"\nimport { createTelemetryChannel } from \"./telemetry-channel\"\n\ntype ObjectRefInput = ObjectRef\ntype AnyLinkToken = LinkToken<string, string, string | readonly string[], ObjectLink>\n\nexport function createObjectByIdHandle<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ExecutionObjectContext, primaryId: string): ObjectByIdHandle<TObjectType, TValueTypes> {\n const objectHandle = {\n get: async () => {\n const row = await ctx.objectReader.getByPrimaryId({\n objectTypeId: ctx.objectType.id,\n primaryId,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n listLinks: async (linkToken?: AnyLinkToken) => {\n if (linkToken) {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n }\n return ctx.objectReader.listLinks({\n objectTypeId: ctx.objectType.id,\n objectId: primaryId,\n linkId: linkToken?.id,\n })\n },\n\n link: async (\n linkToken: AnyLinkToken,\n target: ObjectRefInput,\n options?: { properties?: Record<string, unknown> }\n ) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await upsertLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n properties: options?.properties,\n })\n },\n\n unlink: async (linkToken: AnyLinkToken, target: ObjectRefInput) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await removeLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n })\n },\n\n delete: async () => {\n await deleteObject(ctx, primaryId)\n },\n\n restore: async () => {\n await restoreObject(ctx, primaryId)\n },\n\n requestAction: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n telemetry: createTelemetryChannel<TObjectType, TValueTypes>(ctx, primaryId),\n }\n\n return objectHandle as unknown as ObjectByIdHandle<TObjectType, TValueTypes>\n}\n",
23
+ "/**\n * Server-side ObjectQueryExecutor backed by the shared query executor and storage.\n * Validation, planning, fallback, and execution all run in-process here; the\n * HTTP executor in `@sixb/client` is the remote counterpart.\n */\n\nimport type { AuthorizedObjectReader } from \"../../execution/authorized-object-reader\"\nimport type { OntologyRegistry } from \"../../ontology\"\nimport { ObjectQueryPlanningError } from \"../query\"\nimport { explainObjectQuery } from \"../query/explain\"\nimport type { ObjectQuery } from \"../query/ir\"\nimport { validateObjectQuery } from \"../query/validate\"\nimport type { ObjectQueryExecutor, ObjectQueryExecutorFacetRequest } from \"./query-executor\"\n\nexport function createRuntimeQueryExecutor(params: {\n ontology: OntologyRegistry\n objectReader: AuthorizedObjectReader\n}): ObjectQueryExecutor {\n const { ontology, objectReader } = params\n\n return {\n async list(query: ObjectQuery, options?: { includeTotal?: boolean }) {\n try {\n return await objectReader.executeQuery({ query, includeTotal: options?.includeTotal })\n } catch (error) {\n if (error instanceof ObjectQueryPlanningError) {\n throw addSdkPlanningHints(error)\n }\n throw error\n }\n },\n\n async count(query: ObjectQuery) {\n const result = await objectReader.count({ query })\n return result.count\n },\n\n async exists(query: ObjectQuery) {\n const result = await objectReader.exists({ query })\n return result.exists\n },\n\n async facets(query: ObjectQuery, facets: readonly ObjectQueryExecutorFacetRequest[]) {\n const result = await objectReader.facet({ query, facets })\n return result.facets.map((facet) => ({\n propertyId: facet.propertyId,\n buckets: [...facet.buckets],\n }))\n },\n\n validate(query: ObjectQuery) {\n return validateObjectQuery(query, { ontology, normalize: false })\n },\n\n explain(query: ObjectQuery) {\n return explainObjectQuery(query, { ontology, normalize: false })\n },\n }\n}\n\nfunction addSdkPlanningHints(error: ObjectQueryPlanningError): ObjectQueryPlanningError {\n if (!error.issues.some((issue) => issue.code === \"fallback_requires_bound\")) return error\n\n return new ObjectQueryPlanningError(\n error.issues.map((issue) =>\n issue.code === \"fallback_requires_bound\"\n ? {\n ...issue,\n message:\n \"Object query fallback requires an explicit result bound. Add .limit(n) or .page({ pageSize: n }) before .list().\",\n }\n : issue\n )\n )\n}\n",
24
+ "/**\n * ObjectSet provides a type-safe collection API for objects of a given type.\n * Created via `sixb.objects(MyType)`, it exposes upsert, query, and telemetry batch operations\n * while preserving compile-time property types inferred from the ontology definition.\n */\n\nimport type { ActionDefinition } from \"../../actions\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { shareSixbErrorReporter } from \"../../error-reporting/capability\"\nimport type { ExecutionContext } from \"../../execution\"\nimport { assertAuthorizedObjectReaderBinding } from \"../../execution/authorized-object-reader\"\nimport type { ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { shareOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport type {\n ObjectSet,\n ObjectSetListInput,\n SixbRuntimeContext,\n TwinObject,\n} from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ExecutionObjectContext, ResolvedLinkContext } from \"../context\"\nimport { requireLinkDefinition } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { upsertObject as upsertObjectLeaf } from \"../object\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\nimport { createObjectByIdHandle } from \"./object-handle\"\nimport { createObjectQueryBuilder } from \"./query-builder\"\nimport { createRuntimeQueryExecutor } from \"./runtime-query-executor\"\n\nexport function createObjectSet<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TRegisteredObjectTypes extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(\n params: SixbRuntimeContext & {\n readonly execution: ExecutionContext\n readonly objectType: TObjectType\n readonly authorization?: AuthorizationContext\n }\n): ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes> {\n assertAuthorizedObjectReaderBinding({\n reader: params.objectReader,\n scope: { execution: params.execution, authorization: params.runtimeAuthorization },\n })\n const { objectType } = params\n const primaryProp = objectType.properties.find((p) => p.primary)\n if (!primaryProp) {\n throw new OntologyValidationError(`Object type '${objectType.id}' has no primary property`)\n }\n const primaryPropertyId = primaryProp.id\n\n const {\n projectId,\n broker,\n ontology,\n actionRegistry,\n events,\n storage,\n queues,\n objectReader,\n runtimeAuthorization,\n authorization,\n execution,\n } = params\n const queryExecutor = createRuntimeQueryExecutor({\n ontology,\n objectReader,\n })\n\n const resolvedCtx: ExecutionObjectContext = {\n projectId,\n broker,\n ontology,\n actionRegistry,\n events,\n storage,\n queues,\n objectReader,\n runtimeAuthorization,\n authorization,\n execution,\n objectType,\n primaryPropertyId,\n }\n shareOntologyMutationRuntime(params, resolvedCtx)\n shareSixbErrorReporter(params, resolvedCtx)\n\n const objectSet = {\n get: async (id: string) => {\n const row = await objectReader.getByPrimaryId({\n objectTypeId: objectType.id,\n primaryId: id,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n upsert: async (input: { properties: Record<string, unknown> }) => {\n const row = await upsertObjectLeaf(resolvedCtx, input.properties)\n return row as unknown as TwinObject<TObjectType, TValueTypes>\n },\n\n query: () =>\n createObjectQueryBuilder<TObjectType, TRegisteredObjectTypes, TValueTypes>({\n query: { kind: \"start\", objectTypeId: objectType.id },\n executor: queryExecutor,\n }),\n\n byId: (id: string) => createObjectByIdHandle<TObjectType, TValueTypes>(resolvedCtx, id),\n\n list: async (input?: ObjectSetListInput) => {\n const result = await objectReader.list({\n objectTypeId: objectType.id,\n primaryIdPrefix: input?.idPrefix,\n primaryIdSuffix: input?.idSuffix,\n updatedAfter: input?.updatedAfter,\n updatedBefore: input?.updatedBefore,\n createdAfter: input?.createdAfter,\n createdBefore: input?.createdBefore,\n limit: input?.limit,\n offset: input?.offset,\n orderBy: input?.orderBy,\n order: input?.order,\n })\n\n return {\n objects: result.objects.map(\n (row) => row as unknown as TwinObject<TObjectType, TValueTypes>\n ),\n hasMore: result.hasMore,\n total: result.total ?? result.objects.length,\n }\n },\n\n appendTelemetryBatch: async (\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n ) => {\n await appendTelemetryBatchLeaf(resolvedCtx, items)\n },\n\n requestAction: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n upsertLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await upsertLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n properties: input.properties,\n })\n },\n\n removeLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await removeLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n })\n },\n }\n\n return objectSet as unknown as ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>\n}\n",
25
+ "/**\n * Service layer for action operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\n\nimport type { RequestActionResult } from \"../../actions/request\"\nimport type { ExecutionContext } from \"../../execution\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport { resolveObjectContext } from \"../context\"\n\nexport async function requestAction(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionOptions\n): Promise<RequestActionResult> {\n const ctx = { ...resolveObjectContext(runtime, objectTypeId), execution }\n return requestActionLeaf(ctx, { primaryId, actionId, params, options })\n}\n\nexport async function requestActionAndWait(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionAndWaitOptions\n): Promise<ActionRunRecord> {\n const ctx = { ...resolveObjectContext(runtime, objectTypeId), execution }\n return requestActionAndWaitLeaf(ctx, { primaryId, actionId, params, options })\n}\n",
26
+ "/**\n * Service layer for link operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport { requireLinkDefinition, resolveLinkContext, resolveObjectContext } from \"../context\"\nimport {\n removeLink as removeLinkLeaf,\n upsertLinkBatch as upsertLinkBatchLeaf,\n upsertLink as upsertLinkLeaf,\n} from \"../link\"\n\nexport async function upsertLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await upsertLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n properties: target.properties,\n })\n}\n\nexport async function upsertLinkBatch(\n runtime: SixbRuntimeContext,\n items: readonly {\n objectTypeId: string\n sourceId: string\n linkId: string\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n }[]\n): Promise<readonly BatchItemResult<void>[]> {\n const resolvedItems: ResolvedLinkBatchItem[] = items.map((item) => {\n const objectType = runtime.ontology.resolveObjectType(item.objectTypeId)\n const linkDefinition = requireLinkDefinition(objectType, item.linkId)\n return {\n objectType,\n linkDefinition,\n sourceId: item.sourceId,\n linkId: item.linkId,\n targetTypeId: item.target.targetTypeId,\n targetId: item.target.targetId,\n properties: item.target.properties,\n }\n })\n\n return upsertLinkBatchLeaf(runtime, resolvedItems)\n}\n\nexport async function removeLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await removeLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n })\n}\n",
27
+ "/**\n * Cross-type object listing for dashboards and search.\n *\n * Type hierarchies are expanded before the request reaches the canonical object\n * reader, which owns authorization and provider-scope enforcement.\n */\n\nimport { resolveRuntimeAuthorizationForProject } from \"../../execution/authorization\"\nimport { getAuthorizedOntologyView } from \"../../execution/authorized-object-reader\"\nimport type { ListResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\n\nexport interface ListObjectsParams {\n objectTypeIds?: readonly string[]\n idPrefix?: string\n idSuffix?: string\n updatedAfter?: Date\n updatedBefore?: Date\n createdAfter?: Date\n createdBefore?: Date\n limit?: number\n offset?: number\n orderBy?: \"createdAt\" | \"updatedAt\" | \"primaryId\"\n order?: \"asc\" | \"desc\"\n}\n\nexport async function listObjects(\n runtime: SixbRuntimeContext,\n params: ListObjectsParams\n): Promise<ListResult<ObjectRow>> {\n const objectTypeIds = resolveTypeFilter(runtime, params.objectTypeIds)\n\n if (objectTypeIds !== undefined && objectTypeIds.length === 0) {\n return { objects: [], hasMore: false, total: 0 }\n }\n\n const result = await runtime.objectReader.list({\n objectTypeId: objectTypeIds?.length === 1 ? objectTypeIds[0] : objectTypeIds,\n primaryIdPrefix: params.idPrefix,\n primaryIdSuffix: params.idSuffix,\n updatedAfter: params.updatedAfter,\n updatedBefore: params.updatedBefore,\n createdAfter: params.createdAfter,\n createdBefore: params.createdBefore,\n limit: params.limit,\n offset: params.offset,\n orderBy: params.orderBy,\n order: params.order,\n })\n\n return {\n objects: [...result.objects],\n hasMore: result.hasMore,\n total: result.total,\n }\n}\n\nfunction resolveTypeFilter(\n runtime: SixbRuntimeContext,\n requested: readonly string[] | undefined\n): readonly string[] | undefined {\n const ontology =\n resolveRuntimeAuthorizationForProject(runtime).type === \"delegated\"\n ? getAuthorizedOntologyView(runtime.objectReader)\n : runtime.ontology\n if (requested) {\n for (const objectTypeId of requested) {\n ontology.resolveObjectType(objectTypeId)\n }\n }\n\n return requested\n ? [...new Set(requested.flatMap((id) => [id, ...ontology.listSubTypes(id)]))]\n : undefined\n}\n",
28
+ "/**\n * Service layer for object upsert operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport { resolveObjectContext } from \"../context\"\nimport {\n upsertObjectBatch as upsertObjectBatchLeaf,\n upsertObject as upsertObjectLeaf,\n} from \"../object\"\n\nexport async function upsertObject(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n return upsertObjectLeaf(resolveObjectContext(runtime, objectTypeId), properties)\n}\n\nexport async function upsertObjectBatch(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n return upsertObjectBatchLeaf(resolveObjectContext(runtime, objectTypeId), items)\n}\n",
29
+ "/**\n * Service layer for telemetry operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { resolveObjectContext } from \"../context\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\n\nexport async function appendTelemetry(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { id: string; properties: Record<string, unknown>; at?: Date }[]\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n await appendTelemetryBatchLeaf(ctx, items)\n}\n"
30
+ ],
31
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,cAAa,CACjC,KACA,QAM8B;AAAA,EAC9B,OAAO,eAAqB,KAAK,IAAI,WAAW;AAAA,IAC9C,UAAU,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;AAAA;;AC5DN,eAAsB,aAAY,CAChC,SACA,cACA,YACoB;AAAA,EACpB,OAAO,cAAiB,sBAAqB,SAAS,YAAY,GAAG,UAAU;AAAA;AAGjF,eAAsB,kBAAiB,CACrC,SACA,cACA,OACgD;AAAA,EAChD,OAAO,mBAAsB,sBAAqB,SAAS,YAAY,GAAG,KAAK;AAAA;;ACjBjF,eAAsB,eAAe,CACnC,SACA,cACA,OACe;AAAA,EACf,MAAM,MAAM,sBAAqB,SAAS,YAAY;AAAA,EACtD,MAAM,sBAAyB,KAAK,KAAK;AAAA;",
32
+ "debugId": "0ED9DE016D18A46464756E2164756E21",
33
+ "names": []
34
+ }
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/storage/connector-connections/errors.ts
3
- class ConnectorConnectionStorageError extends Error {
3
+ class ConnectorConnectionStorageError2 extends Error {
4
4
  code;
5
5
  constructor(code, message) {
6
6
  super(message);
@@ -10,7 +10,7 @@ class ConnectorConnectionStorageError extends Error {
10
10
  }
11
11
 
12
12
  // src/storage/connector-connections/types.ts
13
- var CONNECTOR_CONNECTION_RUN_FAILURE_CODES = [
13
+ var CONNECTOR_CONNECTION_RUN_FAILURE_CODES2 = [
14
14
  "internal.unexpected",
15
15
  "connector.adapter_invalid",
16
16
  "connector.authorization_invalid",
@@ -23,6 +23,6 @@ var CONNECTOR_CONNECTION_RUN_FAILURE_CODES = [
23
23
  "connector.provider_unavailable"
24
24
  ];
25
25
 
26
- export { ConnectorConnectionStorageError, CONNECTOR_CONNECTION_RUN_FAILURE_CODES };
26
+ export { ConnectorConnectionStorageError2, CONNECTOR_CONNECTION_RUN_FAILURE_CODES2 };
27
27
 
28
- //# debugId=26D0DA75AEECB3FB64756E2164756E21
28
+ //# debugId=B4781D37D7AB95BB64756E2164756E21
@@ -5,7 +5,7 @@
5
5
  "export type ConnectorConnectionStorageErrorCode =\n | \"attempt_conflict\"\n | \"attempt_invalid\"\n | \"run_conflict\"\n | \"run_invalid\"\n | \"authorization_conflict\"\n | \"connection_conflict\"\n | \"invalid_input\"\n\n/**\n * Storage-provider control signal for atomic conflicts and invalid calls.\n *\n * These codes belong to the provider contract, not `SixbErrorCode`; Core translates errors that\n * cross the connector lifecycle boundary into documented `connector.*` failures.\n */\nexport class ConnectorConnectionStorageError extends Error {\n readonly code: ConnectorConnectionStorageErrorCode\n\n constructor(code: ConnectorConnectionStorageErrorCode, message: string) {\n super(message)\n this.name = \"ConnectorConnectionStorageError\"\n this.code = code\n }\n}\n",
6
6
  "import type { ConnectorAccountCandidate, ConnectorConnectionSelector } from \"../../connectors\"\nimport type { SealedConnectorCredential } from \"../../connectors/credentials\"\nimport type { SixbErrorCode, SixbFailure } from \"../../errors/types\"\nimport type { AuthorizablePrincipal } from \"../../execution\"\n\nexport type {\n ConnectorConnectionOwner,\n ConnectorConnectionSelector,\n ProjectConnectorConnectionOwner,\n} from \"../../connectors\"\n\nexport const CONNECTOR_CONNECTION_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"connector.adapter_invalid\",\n \"connector.authorization_invalid\",\n \"connector.authorization_required\",\n \"connector.credentials_unavailable\",\n \"connector.not_found\",\n \"connector.operation_conflict\",\n \"connector.operation_in_progress\",\n \"connector.provider_failed\",\n \"connector.provider_unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type ConnectorConnectionRunFailureCode =\n (typeof CONNECTOR_CONNECTION_RUN_FAILURE_CODES)[number]\nexport type ConnectorConnectionRunFailure = SixbFailure<ConnectorConnectionRunFailureCode>\nexport type ConnectorConnectionRunKind = \"connect\" | \"reauthorize\"\n\ninterface ConnectorConnectionRunBase extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n /** Durable request execution that initiated and is allowed to manage this run. */\n readonly initiatedByExecutionId: string\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface ConnectorConnectionRunAwaitingProviderRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"provider_authorization\"\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunProcessingRecord extends ConnectorConnectionRunBase {\n readonly status: \"running\"\n /** Fences every callback-side write after the one-shot OAuth attempt was consumed. */\n readonly processingId: string\n readonly callbackStartedAt: Date\n readonly expiresAt: Date\n /** Internal grant handle, attached as soon as a new authorization is durably persisted. */\n readonly authorizationId?: string\n}\n\nexport interface ConnectorConnectionRunAwaitingSelectionRecord extends ConnectorConnectionRunBase {\n readonly status: \"waiting\"\n readonly waitingFor: \"account_selection\"\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface ConnectorConnectionRunSucceededRecord extends ConnectorConnectionRunBase {\n readonly status: \"succeeded\"\n readonly authorizationId: string\n /** Internal handle for a replaced grant whose provider cleanup is still retryable. */\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunFailedRecord extends ConnectorConnectionRunBase {\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n /** Internal cleanup handle; never serialized by the Headless API. */\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunCancelledRecord extends ConnectorConnectionRunBase {\n readonly status: \"cancelled\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport interface ConnectorConnectionRunExpiredRecord extends ConnectorConnectionRunBase {\n readonly status: \"expired\"\n readonly authorizationId?: string\n readonly finishedAt: Date\n}\n\nexport type ConnectorConnectionRunRecord =\n | ConnectorConnectionRunAwaitingProviderRecord\n | ConnectorConnectionRunProcessingRecord\n | ConnectorConnectionRunAwaitingSelectionRecord\n | ConnectorConnectionRunSucceededRecord\n | ConnectorConnectionRunFailedRecord\n | ConnectorConnectionRunCancelledRecord\n | ConnectorConnectionRunExpiredRecord\n\nexport interface CreateConnectorConnectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly kind: ConnectorConnectionRunKind\n readonly initiatedByExecutionId: string\n readonly ttlMs: number\n}\n\nexport interface CreateConnectorConnectionSelectionRunInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly authorizationId: string\n readonly ttlMs: number\n}\n\nexport interface ClaimConnectorConnectionRunCallbackInput {\n readonly projectId: string\n readonly attemptId: string\n readonly stateHash: string\n readonly callbackBindingHash: string\n readonly redirectUri: string\n readonly processingId: string\n readonly processingTtlMs: number\n}\n\nexport type ClaimConnectorConnectionRunCallbackResult =\n | {\n readonly type: \"claimed\"\n readonly run: ConnectorConnectionRunProcessingRecord\n readonly attempt: ConnectorAuthorizationAttemptRecord\n readonly returnTo: string\n }\n | {\n readonly type: \"expired\"\n readonly run: ConnectorConnectionRunExpiredRecord\n readonly returnTo: string\n }\n\nexport interface WaitForConnectorConnectionRunSelectionInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n readonly expiresAt: Date\n}\n\nexport interface AttachConnectorConnectionRunAuthorizationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly authorizationId: string\n}\n\nexport type FinishConnectorConnectionRunInput =\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"succeeded\"\n readonly authorizationId: string\n readonly cleanupAuthorizationId?: string\n readonly connections: readonly ConnectorConnectionRecord[]\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"failed\"\n readonly error: ConnectorConnectionRunFailure\n readonly authorizationId?: string\n }\n | {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly processingId: string\n readonly status: \"cancelled\"\n }\n\nexport interface GetConnectorConnectionRunInput {\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n}\n\nexport interface ConnectorAuthorizationAttemptRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n /** Durable execution that initiated and authorizes completion of this OAuth attempt. */\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n readonly codeVerifier: SealedConnectorCredential\n readonly redirectUri: string\n /** Present only for attempts created by the headless connection-run API. */\n readonly connectionRunId?: string\n /** Fixed, allowlisted continuation consumed with a headless callback. */\n readonly returnTo?: string\n /** Hash of the one-shot browser callback binding secret. */\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly createdAt: Date\n readonly expiresAt: Date\n}\n\nexport interface CreateConnectorAuthorizationAttemptInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly initiatedByExecutionId: string\n readonly stateHash: string\n readonly codeVerifier: SealedConnectorCredential\n readonly redirectUri: string\n readonly connectionRunId?: string\n readonly returnTo?: string\n readonly callbackBindingHash?: string\n readonly reauthorizationId?: string\n readonly reauthorizationRevision?: number\n readonly reauthorizationConnectionIds?: readonly string[]\n readonly ttlMs: number\n}\n\n/** Callback proof. The orchestration layer authorizes the returned initiating execution. */\nexport interface ConsumeConnectorAuthorizationAttemptInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly stateHash: string\n readonly redirectUri: string\n}\n\nexport type ConnectorAuthorizationStatus =\n | \"pending_selection\"\n | \"active\"\n | \"needs_reauthorization\"\n | \"revocation_pending\"\n | \"revoked\"\n\nexport type ConnectorCredentialMutationKind = \"refresh\" | \"reauthorization\" | \"revocation\"\nexport type ConnectorCredentialMutationPhase = \"prepared\" | \"executing\" | \"result_staged\"\n\nexport interface ConnectorStagedCredentials {\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\n/** Durable fencing record for one provider-side OAuth credential mutation. */\nexport interface ConnectorCredentialMutation {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly phase: ConnectorCredentialMutationPhase\n readonly holderId: string\n readonly expiresAt: Date\n readonly deadlineAt: Date\n readonly expectedConnectionIds?: readonly string[]\n readonly stagedCredentials?: ConnectorStagedCredentials\n}\n\nexport interface ConnectorAuthorizationRecord {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n /** Removed after provider revocation is confirmed. */\n readonly credentials?: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly status: ConnectorAuthorizationStatus\n /** Storage-authoritative deadline for the first account selection. */\n readonly selectionExpiresAt?: Date\n readonly revision: number\n readonly credentialMutation?: ConnectorCredentialMutation\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface CreateConnectorAuthorizationInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizedBy: AuthorizablePrincipal\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n readonly accounts: readonly ConnectorAccountCandidate[]\n readonly selectionTtlMs: number\n}\n\nexport interface InitializeConnectorAuthorizationAccountsInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport interface ClaimConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutation: {\n readonly id: string\n readonly kind: ConnectorCredentialMutationKind\n readonly holderId: string\n }\n readonly expectedConnectionIds?: readonly string[]\n readonly leaseDurationMs: number\n readonly operationTimeoutMs: number\n}\n\nexport interface ClaimConnectorCredentialMutationResult {\n readonly authorization: ConnectorAuthorizationRecord\n readonly disconnected: readonly ConnectorConnectionRecord[]\n}\n\nexport interface ConnectorCredentialMutationFence {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly expectedRevision: number\n readonly mutationId: string\n}\n\nexport interface MarkConnectorCredentialMutationExecutingInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RenewConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly leaseDurationMs: number\n}\n\nexport interface StageConnectorCredentialMutationCredentialsInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n readonly credentials: SealedConnectorCredential\n readonly credentialExpiresAt?: Date\n readonly scopes: readonly string[]\n}\n\nexport interface StageConnectorCredentialMutationRevocationInput\n extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface ReleaseConnectorCredentialMutationInput extends ConnectorCredentialMutationFence {\n readonly holderId: string\n}\n\nexport interface RecoverExpiredConnectorCredentialMutationInput {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\nexport interface MarkConnectorAuthorizationNeedsReauthorizationInput\n extends ConnectorCredentialMutationFence {}\n\nexport interface FinalizeConnectorReauthorizationInput extends ConnectorCredentialMutationFence {\n readonly accounts: readonly ConnectorAccountCandidate[]\n}\n\nexport type ConnectorConnectionStatus = \"connected\" | \"disconnected\"\n\nexport interface ConnectorConnectionRecord extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly status: ConnectorConnectionStatus\n readonly disconnectedAt?: Date\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface PutConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n readonly created: boolean\n readonly replaced: boolean\n}\n\nexport interface DisconnectConnectorConnectionResult {\n readonly connection: ConnectorConnectionRecord\n readonly authorization: ConnectorAuthorizationRecord\n readonly revocationPendingAuthorizationId?: string\n}\n\nexport interface PutConnectorConnectionFromRunInput {\n readonly id: string\n readonly projectId: string\n readonly connectorId: string\n readonly runId: string\n readonly account: ConnectorAccountCandidate\n readonly replace: boolean\n}\n\nexport interface PutConnectorConnectionFromRunResult extends PutConnectorConnectionResult {\n readonly run: ConnectorConnectionRunSucceededRecord\n}\n\nexport interface GetConnectorConnectionInput extends ConnectorConnectionSelector {\n readonly projectId: string\n readonly connectorId: string\n}\n\nexport interface ListConnectorConnectionsInput {\n readonly projectId: string\n readonly connectorId: string\n}\n\n/** Tenant-scoped identity for one connector authorization. */\nexport interface ConnectorAuthorizationKey {\n readonly projectId: string\n readonly connectorId: string\n readonly authorizationId: string\n}\n\n/** Tenant-scoped identity for one selected connector connection. */\nexport interface ConnectorConnectionKey {\n readonly projectId: string\n readonly connectorId: string\n readonly connectionId: string\n}\n\n/** Persistent contract. Implementations must make every individual mutation atomic. */\nexport interface ConnectorConnectionStorage {\n readonly durability: \"ephemeral\" | \"durable\"\n\n createAuthorizationAttempt(\n input: CreateConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n consumeAuthorizationAttempt(\n input: ConsumeConnectorAuthorizationAttemptInput\n ): Promise<ConnectorAuthorizationAttemptRecord>\n\n createConnectionRun(\n input: CreateConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord>\n createConnectionSelectionRun(\n input: CreateConnectorConnectionSelectionRunInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord>\n claimConnectionRunCallback(\n input: ClaimConnectorConnectionRunCallbackInput\n ): Promise<ClaimConnectorConnectionRunCallbackResult | null>\n attachConnectionRunAuthorization(\n input: AttachConnectorConnectionRunAuthorizationInput\n ): Promise<ConnectorConnectionRunProcessingRecord | null>\n waitForConnectionRunSelection(\n input: WaitForConnectorConnectionRunSelectionInput\n ): Promise<ConnectorConnectionRunAwaitingSelectionRecord | null>\n finishConnectionRun(\n input: FinishConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n getConnectionRun(\n input: GetConnectorConnectionRunInput\n ): Promise<ConnectorConnectionRunRecord | null>\n\n createAuthorization(\n input: CreateConnectorAuthorizationInput\n ): Promise<ConnectorAuthorizationRecord>\n initializeAuthorizationAccounts(\n input: InitializeConnectorAuthorizationAccountsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n getAuthorization(input: ConnectorAuthorizationKey): Promise<ConnectorAuthorizationRecord | null>\n getAuthorizationByConnectionId(\n input: ConnectorConnectionKey\n ): Promise<ConnectorAuthorizationRecord | null>\n claimCredentialMutation(\n input: ClaimConnectorCredentialMutationInput\n ): Promise<ClaimConnectorCredentialMutationResult | null>\n markCredentialMutationExecuting(\n input: MarkConnectorCredentialMutationExecutingInput\n ): Promise<ConnectorAuthorizationRecord | null>\n renewCredentialMutation(\n input: RenewConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationCredentials(\n input: StageConnectorCredentialMutationCredentialsInput\n ): Promise<ConnectorAuthorizationRecord | null>\n stageCredentialMutationRevocation(\n input: StageConnectorCredentialMutationRevocationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n releaseCredentialMutation(input: ReleaseConnectorCredentialMutationInput): Promise<boolean>\n /**\n * Recovers an expired mutation without replaying an unknown provider effect. Prepared work is\n * released, executing refresh/reauthorization fails closed, revocation stays retryable, and a\n * staged result remains available for finalization.\n */\n recoverExpiredCredentialMutation(\n input: RecoverExpiredConnectorCredentialMutationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n markNeedsReauthorization(\n input: MarkConnectorAuthorizationNeedsReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRefresh(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeReauthorization(\n input: FinalizeConnectorReauthorizationInput\n ): Promise<ConnectorAuthorizationRecord | null>\n finalizeRevocation(\n input: ConnectorCredentialMutationFence\n ): Promise<ConnectorAuthorizationRecord | null>\n\n putConnection(input: PutConnectorConnectionInput): Promise<PutConnectorConnectionResult>\n putConnectionFromRun(\n input: PutConnectorConnectionFromRunInput\n ): Promise<PutConnectorConnectionFromRunResult>\n getConnection(input: GetConnectorConnectionInput): Promise<ConnectorConnectionRecord | null>\n getConnectionById(input: ConnectorConnectionKey): Promise<ConnectorConnectionRecord | null>\n listConnections(\n input: ListConnectorConnectionsInput\n ): Promise<readonly ConnectorConnectionRecord[]>\n listConnectionsByAuthorization(\n input: ConnectorAuthorizationKey\n ): Promise<readonly ConnectorConnectionRecord[]>\n disconnectConnection(\n input: ConnectorConnectionKey\n ): Promise<DisconnectConnectorConnectionResult | null>\n}\n"
7
7
  ],
8
- "mappings": ";;AAeO,MAAM,wCAAwC,MAAM;AAAA,EAChD;AAAA,EAET,WAAW,CAAC,MAA2C,SAAiB;AAAA,IACtE,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA;AAEhB;;;ACZO,IAAM,yCAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
9
- "debugId": "26D0DA75AEECB3FB64756E2164756E21",
8
+ "mappings": ";;AAeO,MAAM,yCAAwC,MAAM;AAAA,EAChD;AAAA,EAET,WAAW,CAAC,MAA2C,SAAiB;AAAA,IACtE,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA;AAEhB;;;ACZO,IAAM,0CAAyC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
9
+ "debugId": "B4781D37D7AB95BB64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,8 +1,9 @@
1
1
  // @bun
2
2
  import {
3
+ createPrincipalRuntimeAuthorization,
3
4
  createDisabledRuntimeAuthorization,
4
- createPrincipalRuntimeAuthorization
5
- } from "./chunk-37wk412q.js";
5
+ createDelegatedRuntimeAuthorization
6
+ } from "./chunk-dz5h08xv.js";
6
7
 
7
8
  // src/execution/scopes.ts
8
9
  import { randomUUID } from "crypto";
@@ -16,16 +17,31 @@ function createPrincipalRequestScope(input) {
16
17
  return Object.freeze({
17
18
  execution,
18
19
  authorization: createPrincipalRuntimeAuthorization({
19
- projectId: input.projectId,
20
+ execution,
20
21
  context: input.context,
21
22
  ...input.credential === undefined ? {} : { credential: input.credential }
22
23
  })
23
24
  });
24
25
  }
25
26
  function createDisabledRequestScope(input) {
27
+ const execution = createRequestExecution(input);
26
28
  return Object.freeze({
27
- execution: createRequestExecution(input),
28
- authorization: createDisabledRuntimeAuthorization(input.projectId)
29
+ execution,
30
+ authorization: createDisabledRuntimeAuthorization(execution)
31
+ });
32
+ }
33
+ function createDelegatedRequestScope(input) {
34
+ const execution = createRequestExecution(input);
35
+ const actionApply = input.actionApply;
36
+ const delegation = input.delegation;
37
+ return Object.freeze({
38
+ execution,
39
+ authorization: createDelegatedRuntimeAuthorization({
40
+ execution,
41
+ objectRead: input.objectRead,
42
+ ...actionApply === undefined ? {} : { actionApply },
43
+ ...delegation === undefined ? {} : { delegation }
44
+ })
29
45
  });
30
46
  }
31
47
  function createTestingScope(input) {
@@ -40,7 +56,7 @@ function createTestingScope(input) {
40
56
  });
41
57
  return Object.freeze({
42
58
  execution,
43
- authorization: context ? createPrincipalRuntimeAuthorization({ projectId: input.projectId, context }) : createDisabledRuntimeAuthorization(input.projectId)
59
+ authorization: context ? createPrincipalRuntimeAuthorization({ execution, context }) : createDisabledRuntimeAuthorization(execution)
44
60
  });
45
61
  }
46
62
  function withoutSession(context) {
@@ -85,6 +101,6 @@ function assertNonEmpty(value, label) {
85
101
  }
86
102
  }
87
103
 
88
- export { createPrincipalRequestScope, createDisabledRequestScope, createTestingScope };
104
+ export { createPrincipalRequestScope, createDisabledRequestScope, createDelegatedRequestScope, createTestingScope };
89
105
 
90
- //# debugId=921D959D4D3E5CA264756E2164756E21
106
+ //# debugId=D67EDA8B3AA3264264756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/execution/scopes.ts"],
4
+ "sourcesContent": [
5
+ "import { randomUUID } from \"node:crypto\"\nimport type { AuthorizationContext } from \"../authorization\"\nimport type { ObjectReadExecutionLimits, SelectedObjectReadScope } from \"../storage\"\nimport {\n createDelegatedRuntimeAuthorization,\n createDisabledRuntimeAuthorization,\n createKernelRuntimeAuthorization,\n createPrincipalRuntimeAuthorization,\n type DelegatedActionApplyTarget,\n} from \"./authorization\"\nimport type {\n AuthorizablePrincipal,\n AuthorizationRef,\n ExecutionContext,\n ExecutionScope,\n ExecutionSource,\n KernelOperation,\n} from \"./types\"\n\nexport function createPrincipalRequestScope(input: {\n readonly projectId: string\n readonly requestId: string\n readonly correlationId: string\n readonly context: AuthorizationContext\n readonly credential?: Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]\n}): ExecutionScope {\n const execution = createRequestExecution({\n projectId: input.projectId,\n requestId: input.requestId,\n correlationId: input.correlationId,\n requestedBy: asAuthorizablePrincipal(input.context.principal),\n })\n\n return Object.freeze({\n execution,\n authorization: createPrincipalRuntimeAuthorization({\n execution,\n context: input.context,\n ...(input.credential === undefined ? {} : { credential: input.credential }),\n }),\n })\n}\n\nexport function createDisabledRequestScope(input: {\n readonly projectId: string\n readonly requestId: string\n readonly correlationId: string\n}): ExecutionScope {\n const execution = createRequestExecution(input)\n return Object.freeze({\n execution,\n authorization: createDisabledRuntimeAuthorization(execution),\n })\n}\n\n/** Internal request scope carrying only a finite object-read selection. */\nexport function createDelegatedRequestScope(input: {\n readonly projectId: string\n readonly requestId: string\n readonly correlationId: string\n readonly objectRead: {\n readonly selection: SelectedObjectReadScope\n readonly limits: ObjectReadExecutionLimits\n }\n readonly actionApply?: readonly DelegatedActionApplyTarget[]\n readonly delegation?: Extract<AuthorizationRef, { readonly type: \"delegated\" }>[\"delegation\"]\n}): ExecutionScope {\n const execution = createRequestExecution(input)\n const actionApply = input.actionApply\n const delegation = input.delegation\n return Object.freeze({\n execution,\n authorization: createDelegatedRuntimeAuthorization({\n execution,\n objectRead: input.objectRead,\n ...(actionApply === undefined ? {} : { actionApply }),\n ...(delegation === undefined ? {} : { delegation }),\n }),\n })\n}\n\nexport function createKernelScope(input: {\n readonly projectId: string\n readonly operation: KernelOperation\n readonly source: ExecutionSource\n readonly correlationId?: string\n}): ExecutionScope {\n const operation = Object.freeze({ ...input.operation })\n const execution = createKernelExecution({\n projectId: input.projectId,\n operation,\n source: input.source,\n correlationId: input.correlationId,\n })\n return Object.freeze({\n execution,\n authorization: createKernelRuntimeAuthorization({ execution, operation }),\n })\n}\n\nfunction createKernelExecution(input: {\n readonly projectId: string\n readonly operation: KernelOperation\n readonly source: ExecutionSource\n readonly correlationId?: string\n}): ExecutionContext {\n const source = snapshotExecutionSource(input.source)\n assertNestedProvenance(source, input.correlationId)\n return freezeExecution({\n id: `exec_${randomUUID()}`,\n projectId: input.projectId,\n executor: Object.freeze({ type: \"kernel\", operation: input.operation }),\n source,\n correlationId: input.correlationId ?? `corr_${randomUUID()}`,\n })\n}\n\nfunction assertNestedProvenance(source: ExecutionSource, correlationId: string | undefined): void {\n if (source.type === \"execution\" && correlationId === undefined) {\n throw new Error(\"[Sixb] Nested execution must preserve its parent correlation id.\")\n }\n}\n\nexport function createTestingScope(input: {\n readonly projectId: string\n readonly context?: AuthorizationContext\n readonly executionId?: string\n readonly requestId?: string\n readonly correlationId?: string\n}): ExecutionScope {\n const context = input.context ? withoutSession(input.context) : undefined\n const requestId = input.requestId ?? `test_request_${randomUUID()}`\n const execution = createRequestExecution({\n projectId: input.projectId,\n requestId,\n correlationId: input.correlationId ?? `test_correlation_${randomUUID()}`,\n ...(context === undefined ? {} : { requestedBy: asAuthorizablePrincipal(context.principal) }),\n executionId: input.executionId,\n })\n return Object.freeze({\n execution,\n authorization: context\n ? createPrincipalRuntimeAuthorization({ execution, context })\n : createDisabledRuntimeAuthorization(execution),\n })\n}\n\nfunction withoutSession(context: AuthorizationContext): AuthorizationContext {\n return {\n principal: context.principal,\n groupIds: context.groupIds,\n roleIds: context.roleIds,\n grants: context.grants,\n }\n}\n\nfunction createRequestExecution(input: {\n readonly projectId: string\n readonly requestId: string\n readonly correlationId: string\n readonly requestedBy?: AuthorizablePrincipal\n readonly executionId?: string\n}): ExecutionContext {\n assertNonEmpty(input.projectId, \"Execution project id\")\n assertNonEmpty(input.requestId, \"Execution request id\")\n assertNonEmpty(input.correlationId, \"Execution correlation id\")\n const id = input.executionId ?? `exec_${randomUUID()}`\n assertNonEmpty(id, \"Execution id\")\n return freezeExecution({\n id,\n projectId: input.projectId,\n ...(input.requestedBy === undefined ? {} : { requestedBy: input.requestedBy }),\n executor: Object.freeze({ type: \"request\", requestId: input.requestId }),\n source: Object.freeze({ type: \"http\", requestId: input.requestId }),\n correlationId: input.correlationId,\n })\n}\n\nfunction freezeExecution(execution: ExecutionContext): ExecutionContext {\n assertNonEmpty(execution.id, \"Execution id\")\n assertNonEmpty(execution.projectId, \"Execution project id\")\n assertNonEmpty(execution.correlationId, \"Execution correlation id\")\n return Object.freeze(execution)\n}\n\nfunction snapshotExecutionSource(source: ExecutionSource): ExecutionSource {\n const field = sourceIdentifier(source)\n assertNonEmpty(field.value, field.label)\n if (source.type === \"datasetVersion\") {\n assertNonEmpty(source.datasetId, \"Execution source dataset id\")\n }\n return Object.freeze({ ...source })\n}\n\nfunction sourceIdentifier(source: ExecutionSource): {\n readonly label: string\n readonly value: string\n} {\n switch (source.type) {\n case \"http\":\n return { label: \"Execution source request id\", value: source.requestId }\n case \"webhook\":\n return { label: \"Execution source delivery id\", value: source.deliveryId }\n case \"schedule\":\n case \"event\":\n return { label: \"Execution source event id\", value: source.eventId }\n case \"datasetVersion\":\n return { label: \"Execution source dataset version id\", value: source.versionId }\n case \"execution\":\n return { label: \"Execution source execution id\", value: source.executionId }\n }\n}\n\nfunction asAuthorizablePrincipal(\n principal: AuthorizationContext[\"principal\"]\n): AuthorizablePrincipal {\n if (principal.type !== \"user\" && principal.type !== \"serviceAccount\") {\n throw new Error(`[Sixb] Principal type '${principal.type}' cannot hold runtime authorization.`)\n }\n assertNonEmpty(principal.id, \"Execution principal id\")\n return Object.freeze({ type: principal.type, id: principal.id })\n}\n\nfunction assertNonEmpty(value: string, label: string): void {\n if (!value.trim()) {\n throw new Error(`[Sixb] ${label} must not be empty.`)\n }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;;;;AAAA;AAmBO,SAAS,2BAA2B,CAAC,OAMzB;AAAA,EACjB,MAAM,YAAY,uBAAuB;AAAA,IACvC,WAAW,MAAM;AAAA,IACjB,WAAW,MAAM;AAAA,IACjB,eAAe,MAAM;AAAA,IACrB,aAAa,wBAAwB,MAAM,QAAQ,SAAS;AAAA,EAC9D,CAAC;AAAA,EAED,OAAO,OAAO,OAAO;AAAA,IACnB;AAAA,IACA,eAAe,oCAAoC;AAAA,MACjD;AAAA,MACA,SAAS,MAAM;AAAA,SACX,MAAM,eAAe,YAAY,CAAC,IAAI,EAAE,YAAY,MAAM,WAAW;AAAA,IAC3E,CAAC;AAAA,EACH,CAAC;AAAA;AAGI,SAAS,0BAA0B,CAAC,OAIxB;AAAA,EACjB,MAAM,YAAY,uBAAuB,KAAK;AAAA,EAC9C,OAAO,OAAO,OAAO;AAAA,IACnB;AAAA,IACA,eAAe,mCAAmC,SAAS;AAAA,EAC7D,CAAC;AAAA;AAII,SAAS,2BAA2B,CAAC,OAUzB;AAAA,EACjB,MAAM,YAAY,uBAAuB,KAAK;AAAA,EAC9C,MAAM,cAAc,MAAM;AAAA,EAC1B,MAAM,aAAa,MAAM;AAAA,EACzB,OAAO,OAAO,OAAO;AAAA,IACnB;AAAA,IACA,eAAe,oCAAoC;AAAA,MACjD;AAAA,MACA,YAAY,MAAM;AAAA,SACd,gBAAgB,Y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U,CAAC;AAAA,IACvE,QAAQ,OAAO,OAAO,EAAE,MAAM,QAAQ,WAAW,MAAM,UAAU,CAAC;AAAA,IAClE,eAAe,MAAM;AAAA,EACvB,CAAC;AAAA;AAGH,SAAS,eAAe,CAAC,WAA+C;AAAA,EACtE,eAAe,UAAU,IAAI,cAAc;AAAA,EAC3C,eAAe,UAAU,WAAW,sBAAsB;AAAA,EAC1D,eAAe,UAAU,eAAe,0BAA0B;AAAA,EAClE,OAAO,OAAO,OAAO,SAAS;AAAA;AA+BhC,SAAS,uBAAuB,CAC9B,WACuB;AAAA,EACvB,IAAI,UAAU,SAAS,UAAU,UAAU,SAAS,kBAAkB;AAAA,IACpE,MAAM,IAAI,MAAM,0BAA0B,UAAU,0CAA0C;AAAA,EAChG;AAAA,EACA,eAAe,UAAU,IAAI,wBAAwB;AAAA,EACrD,OAAO,OAAO,OAAO,EAAE,MAAM,UAAU,MAAM,IAAI,UAAU,GAAG,CAAC;AAAA;AAGjE,SAAS,cAAc,CAAC,OAAe,OAAqB;AAAA,EAC1D,IAAI,CAAC,MAAM,KAAK,GAAG;AAAA,IACjB,MAAM,IAAI,MAAM,UAAU,0BAA0B;AAAA,EACtD;AAAA;",
8
+ "debugId": "D67EDA8B3AA3264264756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
- blobIdFromDigest
4
- } from "./chunk-08m3b6w8.js";
3
+ blobIdFromDigest2
4
+ } from "./chunk-h3v76ams.js";
5
5
  // src/blob-storage/errors.ts
6
- class BlobStorageError extends Error {
6
+ class BlobStorageError2 extends Error {
7
7
  name = "BlobStorageError";
8
8
  }
9
9
  // src/blob-storage/utils.ts
10
10
  import { createHash } from "crypto";
11
- function streamBlobBody(input) {
11
+ function streamBlobBody2(input) {
12
12
  if (input instanceof ReadableStream) {
13
13
  return input;
14
14
  }
@@ -22,7 +22,7 @@ function streamBlobBody(input) {
22
22
  bytes.set(input);
23
23
  return new Blob([bytes]).stream();
24
24
  }
25
- async function readBlobBody(input, signal) {
25
+ async function readBlobBody2(input, signal) {
26
26
  signal?.throwIfAborted();
27
27
  if (input instanceof Uint8Array) {
28
28
  return new Uint8Array(input);
@@ -31,9 +31,9 @@ async function readBlobBody(input, signal) {
31
31
  return new Uint8Array(input.slice(0));
32
32
  }
33
33
  if (input instanceof Blob) {
34
- const bytes2 = new Uint8Array(await input.arrayBuffer());
34
+ const bytes = new Uint8Array(await input.arrayBuffer());
35
35
  signal?.throwIfAborted();
36
- return bytes2;
36
+ return bytes;
37
37
  }
38
38
  const reader = input.getReader();
39
39
  const chunks = [];
@@ -65,28 +65,28 @@ async function readBlobBody(input, signal) {
65
65
  }
66
66
  return bytes;
67
67
  }
68
- function assertExpectedBlobSize(expectedSizeBytes, actualSizeBytes, provider = "BlobStorage") {
69
- assertValidExpectedBlobSize(expectedSizeBytes, provider);
68
+ function assertExpectedBlobSize2(expectedSizeBytes, actualSizeBytes, provider = "BlobStorage") {
69
+ assertValidExpectedBlobSize2(expectedSizeBytes, provider);
70
70
  if (expectedSizeBytes === undefined) {
71
71
  return;
72
72
  }
73
73
  if (actualSizeBytes !== expectedSizeBytes) {
74
- throw new BlobStorageError(`[${provider}] Blob size mismatch: expected ${expectedSizeBytes} bytes, received ${actualSizeBytes}.`);
74
+ throw new BlobStorageError2(`[${provider}] Blob size mismatch: expected ${expectedSizeBytes} bytes, received ${actualSizeBytes}.`);
75
75
  }
76
76
  }
77
- function assertValidExpectedBlobSize(expectedSizeBytes, provider = "BlobStorage") {
77
+ function assertValidExpectedBlobSize2(expectedSizeBytes, provider = "BlobStorage") {
78
78
  if (expectedSizeBytes === undefined) {
79
79
  return;
80
80
  }
81
81
  if (!Number.isSafeInteger(expectedSizeBytes) || expectedSizeBytes < 0) {
82
- throw new BlobStorageError(`[${provider}] expectedSizeBytes must be a non-negative safe integer.`);
82
+ throw new BlobStorageError2(`[${provider}] expectedSizeBytes must be a non-negative safe integer.`);
83
83
  }
84
84
  }
85
- function computeBlobDigest(bytes) {
85
+ function computeBlobDigest2(bytes) {
86
86
  const hash = createHash("sha256").update(bytes).digest("hex");
87
87
  return `sha256:${hash}`;
88
88
  }
89
- function createFileRef(input, info) {
89
+ function createFileRef2(input, info) {
90
90
  return {
91
91
  blobId: info.blobId,
92
92
  digest: info.digest,
@@ -98,14 +98,14 @@ function createFileRef(input, info) {
98
98
  }
99
99
 
100
100
  // src/blob-storage/in-memory.ts
101
- class InMemoryBlobStorage {
101
+ class InMemoryBlobStorage2 {
102
102
  blobsById = new Map;
103
103
  async put(input) {
104
- assertValidExpectedBlobSize(input.expectedSizeBytes);
105
- const bytes = await readBlobBody(input.body, input.signal);
106
- assertExpectedBlobSize(input.expectedSizeBytes, bytes.byteLength, "BlobStorage");
107
- const digest = computeBlobDigest(bytes);
108
- const blobId = blobIdFromDigest(digest);
104
+ assertValidExpectedBlobSize2(input.expectedSizeBytes);
105
+ const bytes = await readBlobBody2(input.body, input.signal);
106
+ assertExpectedBlobSize2(input.expectedSizeBytes, bytes.byteLength, "BlobStorage");
107
+ const digest = computeBlobDigest2(bytes);
108
+ const blobId = blobIdFromDigest2(digest);
109
109
  let stored = this.blobsById.get(blobId);
110
110
  if (!stored) {
111
111
  stored = {
@@ -118,7 +118,7 @@ class InMemoryBlobStorage {
118
118
  };
119
119
  this.blobsById.set(blobId, stored);
120
120
  }
121
- return createFileRef(input, stored.info);
121
+ return createFileRef2(input, stored.info);
122
122
  }
123
123
  async open(blobId) {
124
124
  const stored = this.requireStoredBlob(blobId);
@@ -136,11 +136,11 @@ class InMemoryBlobStorage {
136
136
  requireStoredBlob(blobId) {
137
137
  const stored = this.blobsById.get(blobId);
138
138
  if (!stored) {
139
- throw new BlobStorageError(`[BlobStorage] Unknown blob '${blobId}'`);
139
+ throw new BlobStorageError2(`[BlobStorage] Unknown blob '${blobId}'`);
140
140
  }
141
141
  return stored;
142
142
  }
143
143
  }
144
- export { BlobStorageError, streamBlobBody, readBlobBody, assertExpectedBlobSize, assertValidExpectedBlobSize, computeBlobDigest, createFileRef, InMemoryBlobStorage };
144
+ export { BlobStorageError2, streamBlobBody2, readBlobBody2, assertExpectedBlobSize2, assertValidExpectedBlobSize2, computeBlobDigest2, createFileRef2, InMemoryBlobStorage2 };
145
145
 
146
- //# debugId=C4BF3346CA1C391164756E2164756E21
146
+ //# debugId=F80C5F78371EE3C664756E2164756E21