@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
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/execution/scopes.ts"],
4
- "sourcesContent": [
5
- "import { randomUUID } from \"node:crypto\"\nimport type { AuthorizationContext } from \"../authorization\"\nimport {\n createDisabledRuntimeAuthorization,\n createKernelRuntimeAuthorization,\n createPrincipalRuntimeAuthorization,\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 projectId: input.projectId,\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 return Object.freeze({\n execution: createRequestExecution(input),\n authorization: createDisabledRuntimeAuthorization(input.projectId),\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({ projectId: input.projectId, 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({ projectId: input.projectId, context })\n : createDisabledRuntimeAuthorization(input.projectId),\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;AAgBO,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,WAAW,MAAM;AAAA,MACjB,SAAS,MAAM;AAAA,SACX,MAAM,eAAe,YAAY,CAAC,IAAI,EAAE,YAAY,MAAM,WAAW;AAAA,IAC3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EAAE,aAAa,MAAM,YAAY;AAAA,IAC5E,UAAU,OAAO,OAAO,EAAE,MAAM,WAAW,WAAW,MAAM,UAAU,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": "921D959D4D3E5CA264756E2164756E21",
9
- "names": []
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/agents/streams.ts"],
4
- "sourcesContent": [
5
- "import type { Broker, BrokerStreamDefinition } from \"../broker\"\nimport { parseSixbFailure } from \"../errors/internal\"\nimport type { SixbFailure } from \"../errors/types\"\nimport { isJsonValue, isPlainRecord, type JsonValue } from \"../json\"\nimport {\n AGENT_RUN_FAILURE_CODES,\n type AgentContextCheckpointReason,\n type AgentRunFailureCode,\n type AgentRunRecord,\n type ConversationAgentRunRecord,\n} from \"../storage/agents/types\"\n\nexport const AGENT_RUN_STREAM_SCHEMA_VERSION = 1 as const\nexport const DEFAULT_AGENT_RUN_STREAM_RETENTION = {\n maxAgeMs: 2 * 60 * 60 * 1000, // 2 hours\n maxRecords: 5_000,\n} as const\n\nexport const AGENT_ACTIVITY_STREAM_SCHEMA_VERSION = 1 as const\nexport const AGENT_ACTIVITY_STREAM_ID = \"agents.activity\" as const\nexport const DEFAULT_AGENT_ACTIVITY_STREAM_RETENTION = {\n maxAgeMs: 24 * 60 * 60 * 1000, // 24 hours\n maxRecords: 10_000,\n} as const\n\nexport interface AgentRunActivityEvent {\n readonly schemaVersion: typeof AGENT_ACTIVITY_STREAM_SCHEMA_VERSION\n readonly type: \"agent.run.activity\"\n readonly projectId: string\n readonly runId: string\n readonly threadId: string\n readonly status: AgentRunRecord[\"status\"]\n readonly attempt: number\n readonly occurredAt: string\n}\n\nexport function agentActivityStreamDefinition(): BrokerStreamDefinition {\n return {\n id: AGENT_ACTIVITY_STREAM_ID,\n retention: DEFAULT_AGENT_ACTIVITY_STREAM_RETENTION,\n }\n}\n\nexport function agentRunActivityEvent(\n run: ConversationAgentRunRecord,\n occurredAt: Date = new Date()\n): AgentRunActivityEvent {\n return {\n schemaVersion: AGENT_ACTIVITY_STREAM_SCHEMA_VERSION,\n type: \"agent.run.activity\",\n projectId: run.projectId,\n runId: run.id,\n threadId: run.threadId,\n status: run.status,\n attempt: run.attempt,\n occurredAt: occurredAt.toISOString(),\n }\n}\n\nexport function isAgentRunActivityEvent(value: unknown): value is AgentRunActivityEvent {\n return (\n isPlainRecord(value) &&\n value.schemaVersion === AGENT_ACTIVITY_STREAM_SCHEMA_VERSION &&\n value.type === \"agent.run.activity\" &&\n typeof value.projectId === \"string\" &&\n typeof value.runId === \"string\" &&\n typeof value.threadId === \"string\" &&\n isAgentRunStatus(value.status) &&\n typeof value.attempt === \"number\" &&\n Number.isFinite(value.attempt) &&\n typeof value.occurredAt === \"string\"\n )\n}\n\nexport async function publishAgentRunActivity(\n broker: Broker,\n run: ConversationAgentRunRecord\n): Promise<void> {\n const event = agentRunActivityEvent(run)\n await broker.ensureStream({\n projectId: run.projectId,\n stream: agentActivityStreamDefinition(),\n })\n await broker.append({\n projectId: run.projectId,\n streamId: AGENT_ACTIVITY_STREAM_ID,\n records: [\n {\n name: event.type,\n key: event.threadId,\n // The event is composed only of validated JSON primitives.\n payload: event as unknown as JsonValue,\n idempotencyKey: `${event.runId}:${event.attempt}:${event.status}`,\n },\n ],\n })\n}\n\nexport type AgentRunStreamId = `agents.runs.${string}`\n\nexport function agentRunStreamId(runId: string): AgentRunStreamId {\n return `agents.runs.${runId}`\n}\n\nexport function agentRunStreamDefinition(runId: string): BrokerStreamDefinition {\n return {\n id: agentRunStreamId(runId),\n retention: DEFAULT_AGENT_RUN_STREAM_RETENTION,\n }\n}\n\ntype AgentRunStreamEventBase = {\n readonly schemaVersion: typeof AGENT_RUN_STREAM_SCHEMA_VERSION\n readonly projectId: string\n readonly runId: string\n readonly attempt: number\n readonly occurredAt: string\n} & (\n | {\n readonly threadId: string\n readonly parentRunId?: never\n }\n | {\n readonly parentRunId: string\n readonly threadId?: never\n }\n)\n\n// ── Control stream (worker-inbound) ─────────────────────────────────────────────────────────────\n//\n// A per-run channel the API layer publishes to and the worker subscribes to — the reverse direction\n// of the event stream above. It carries only a cancel signal, and is addressed by `runId` (not a run\n// record), so a cancel works even before the worker has reserved the run. Kept separate from the\n// event stream so control records never reach the browser client.\n\nexport type AgentRunControlStreamId = `agents.runs.${string}.control`\n\nexport function agentRunControlStreamId(runId: string): AgentRunControlStreamId {\n return `agents.runs.${runId}.control`\n}\n\n/** The only control record: a request to stop the run. */\nexport const AGENT_RUN_CANCEL_RECORD = \"agent.run.cancel\"\n\n// A cancel only needs to outlive the queue wait plus one turn, so retention is short and tiny.\nconst AGENT_RUN_CONTROL_RETENTION = { maxAgeMs: 30 * 60 * 1000, maxRecords: 16 } as const\n\nexport function agentRunControlStreamDefinition(runId: string): BrokerStreamDefinition {\n return { id: agentRunControlStreamId(runId), retention: AGENT_RUN_CONTROL_RETENTION }\n}\n\n/**\n * Signal a run to stop. Publishing is addressed by `runId`, so it works whether the run is queued,\n * reserved, or being drained — the worker picks the record up when it subscribes.\n */\nexport async function publishAgentRunCancel(\n broker: Broker,\n params: { readonly projectId: string; readonly runId: string }\n): Promise<void> {\n await broker.ensureStream({\n projectId: params.projectId,\n stream: agentRunControlStreamDefinition(params.runId),\n })\n await broker.append({\n projectId: params.projectId,\n streamId: agentRunControlStreamId(params.runId),\n records: [\n {\n name: AGENT_RUN_CANCEL_RECORD,\n key: params.runId,\n payload: { runId: params.runId },\n idempotencyKey: `${params.runId}:cancel`,\n },\n ],\n })\n}\n\n/**\n * Watch a run's control stream and invoke `onCancel` when a cancel arrives. Reads from `earliest` so\n * a cancel published before the worker subscribed (a run stopped while still queued) is still seen.\n * Returns the unsubscribe handle.\n */\nexport async function subscribeAgentRunCancel(\n broker: Broker,\n params: { readonly projectId: string; readonly runId: string },\n onCancel: () => void\n): Promise<() => void> {\n await broker.ensureStream({\n projectId: params.projectId,\n stream: agentRunControlStreamDefinition(params.runId),\n })\n return broker.subscribe(\n {\n projectId: params.projectId,\n streamId: agentRunControlStreamId(params.runId),\n from: \"earliest\",\n names: [AGENT_RUN_CANCEL_RECORD],\n },\n () => onCancel()\n )\n}\n\n/** Exact portable failure exposed by a terminal Agent run stream event. */\nexport type AgentRunFailure = SixbFailure<AgentRunFailureCode>\n\nexport const AGENT_COMPACTION_FAILURE_CODES = [\n \"context_limit_exceeded\",\n \"summary_failed\",\n \"checkpoint_failed\",\n] as const\nexport type AgentCompactionFailureCode = (typeof AGENT_COMPACTION_FAILURE_CODES)[number]\n\nexport type AgentRunStreamEvent =\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.run.started\"\n readonly modelId?: string\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.compaction.started\"\n readonly reason: AgentContextCheckpointReason\n readonly estimatedInputTokensBefore: number\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.compaction.completed\"\n readonly reason: AgentContextCheckpointReason\n readonly checkpointId: string\n readonly estimatedInputTokensBefore: number\n readonly estimatedInputTokensAfter: number\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.compaction.failed\"\n readonly reason: AgentContextCheckpointReason\n readonly errorCode: AgentCompactionFailureCode\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.ui.chunk\"\n readonly chunkIndex: number\n readonly chunk: JsonValue\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.message.finalized\"\n readonly messageId: string\n })\n | (AgentRunStreamEventBase & {\n readonly type: \"agent.run.finished\"\n readonly status: \"succeeded\" | \"failed\" | \"cancelled\"\n readonly finishReason?: string\n readonly error?: AgentRunFailure\n })\n\nexport type AgentRunFinishedEvent = Extract<AgentRunStreamEvent, { type: \"agent.run.finished\" }>\n\n// ── Record construction ──────────────────────────────────────────────────────────────────────────\n//\n// The wire format of run stream records — event shape, record name/key, and the idempotency-key\n// vocabulary — is owned here so every producer (the worker's stream sink, the server's queued\n// cancellation) shares one definition and cannot drift.\n\n/** Build the terminal stream event for a finished run. Throws if the run is not terminal. */\nexport function agentRunFinishedEvent(\n run: AgentRunRecord,\n occurredAt: Date = new Date()\n): AgentRunFinishedEvent {\n if (run.status === \"queued\" || run.status === \"running\") {\n throw new Error(\n `[Sixb] Agent run '${run.id}' is not terminal (status '${run.status}'), so it has no finished event.`\n )\n }\n return {\n ...agentRunStreamEventBase(run, occurredAt),\n type: \"agent.run.finished\",\n status: run.status,\n ...(run.finishReason === undefined ? {} : { finishReason: run.finishReason }),\n ...(run.error === undefined ? {} : { error: run.error }),\n }\n}\n\n/** Shared lineage for stream records emitted by conversational and headless runs. */\nexport function agentRunStreamEventBase(\n run: AgentRunRecord,\n occurredAt: Date = new Date()\n): AgentRunStreamEventBase {\n const common = {\n schemaVersion: AGENT_RUN_STREAM_SCHEMA_VERSION,\n projectId: run.projectId,\n runId: run.id,\n attempt: run.attempt,\n occurredAt: occurredAt.toISOString(),\n }\n return run.kind === \"conversation\"\n ? { ...common, threadId: run.threadId }\n : { ...common, parentRunId: run.parentRunId }\n}\n\n/** Validate an Agent stream payload using the same contract its producers use. */\nexport function isAgentRunStreamEvent(value: unknown): value is AgentRunStreamEvent {\n if (\n !isPlainRecord(value) ||\n value.schemaVersion !== AGENT_RUN_STREAM_SCHEMA_VERSION ||\n typeof value.projectId !== \"string\" ||\n typeof value.runId !== \"string\" ||\n typeof value.attempt !== \"number\" ||\n !Number.isFinite(value.attempt) ||\n typeof value.occurredAt !== \"string\" ||\n typeof value.type !== \"string\"\n ) {\n return false\n }\n const hasConversationLineage =\n typeof value.threadId === \"string\" && value.parentRunId === undefined\n const hasSubagentLineage = typeof value.parentRunId === \"string\" && value.threadId === undefined\n if (!hasConversationLineage && !hasSubagentLineage) return false\n\n switch (value.type) {\n case \"agent.run.started\":\n return value.modelId === undefined || typeof value.modelId === \"string\"\n case \"agent.compaction.started\":\n return (\n isAgentContextCheckpointReason(value.reason) &&\n isTokenEstimate(value.estimatedInputTokensBefore)\n )\n case \"agent.compaction.completed\":\n return (\n isAgentContextCheckpointReason(value.reason) &&\n typeof value.checkpointId === \"string\" &&\n isTokenEstimate(value.estimatedInputTokensBefore) &&\n isTokenEstimate(value.estimatedInputTokensAfter)\n )\n case \"agent.compaction.failed\":\n return (\n isAgentContextCheckpointReason(value.reason) &&\n AGENT_COMPACTION_FAILURE_CODES.includes(value.errorCode as AgentCompactionFailureCode)\n )\n case \"agent.ui.chunk\":\n return (\n Number.isInteger(value.chunkIndex) &&\n Object.hasOwn(value, \"chunk\") &&\n isJsonValue(value.chunk)\n )\n case \"agent.message.finalized\":\n return typeof value.messageId === \"string\"\n case \"agent.run.finished\":\n return (\n isTerminalAgentRunStatus(value.status) &&\n (value.finishReason === undefined || typeof value.finishReason === \"string\") &&\n (value.error === undefined || isAgentRunFailure(value.error))\n )\n default:\n return false\n }\n}\n\nfunction isAgentContextCheckpointReason(value: unknown): value is AgentContextCheckpointReason {\n return value === \"threshold\" || value === \"overflow\"\n}\n\nfunction isTokenEstimate(value: unknown): value is number {\n return Number.isSafeInteger(value) && (value as number) >= 0\n}\n\nfunction isTerminalAgentRunStatus(value: unknown): value is \"succeeded\" | \"failed\" | \"cancelled\" {\n return value === \"succeeded\" || value === \"failed\" || value === \"cancelled\"\n}\n\nfunction isAgentRunStatus(value: unknown): value is AgentRunRecord[\"status\"] {\n return value === \"queued\" || value === \"running\" || isTerminalAgentRunStatus(value)\n}\n\nfunction isAgentRunFailure(value: unknown): value is AgentRunFailure {\n if (!isPlainRecord(value)) return false\n try {\n parseSixbFailure(value, AGENT_RUN_FAILURE_CODES)\n return true\n } catch {\n return false\n }\n}\n\n/** Single owner of the idempotency-key vocabulary for agent run stream records. */\nexport function agentRunStreamIdempotencyKey(event: AgentRunStreamEvent): string {\n switch (event.type) {\n case \"agent.run.started\":\n return `${event.runId}:${event.attempt}:started`\n case \"agent.compaction.started\":\n return `${event.runId}:${event.attempt}:compaction:${event.reason}:started`\n case \"agent.compaction.completed\":\n return `${event.runId}:${event.attempt}:compaction:${event.checkpointId}:completed`\n case \"agent.compaction.failed\":\n return `${event.runId}:${event.attempt}:compaction:${event.reason}:failed:${event.errorCode}`\n case \"agent.ui.chunk\":\n return `${event.runId}:${event.attempt}:chunk:${event.chunkIndex}`\n case \"agent.message.finalized\":\n return `${event.runId}:${event.attempt}:message:${event.messageId}:finalized`\n case \"agent.run.finished\":\n return `${event.runId}:${event.attempt}:finished:${event.status}`\n }\n}\n\n/**\n * Ensure the run's stream and append its terminal record — mirrors {@link publishAgentRunCancel}.\n * Used where a terminal transition happens outside the worker (e.g. cancelling a queued run).\n */\nexport async function publishAgentRunFinished(broker: Broker, run: AgentRunRecord): Promise<void> {\n const event = agentRunFinishedEvent(run)\n await broker.ensureStream({\n projectId: run.projectId,\n stream: agentRunStreamDefinition(run.id),\n })\n await broker.append({\n projectId: run.projectId,\n streamId: agentRunStreamId(run.id),\n records: [\n {\n name: event.type,\n key: event.runId,\n // The event is built from JSON primitives only, so the round-trip is a safe narrowing.\n payload: JSON.parse(JSON.stringify(event)) as JsonValue,\n idempotencyKey: agentRunStreamIdempotencyKey(event),\n },\n ],\n })\n if (run.kind === \"conversation\") await publishAgentRunActivity(broker, run)\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;AAYO,IAAM,kCAAkC;AACxC,IAAM,qCAAqC;AAAA,EAChD,UAAU,IAAI,KAAK,KAAK;AAAA,EACxB,YAAY;AACd;AAEO,IAAM,uCAAuC;AAC7C,IAAM,2BAA2B;AACjC,IAAM,0CAA0C;AAAA,EACrD,UAAU,KAAK,KAAK,KAAK;AAAA,EACzB,YAAY;AACd;AAaO,SAAS,6BAA6B,GAA2B;AAAA,EACtE,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,WAAW;AAAA,EACb;AAAA;AAGK,SAAS,qBAAqB,CACnC,KACA,aAAmB,IAAI,MACA;AAAA,EACvB,OAAO;AAAA,IACL,eAAe;AAAA,IACf,MAAM;AAAA,IACN,WAAW,IAAI;AAAA,IACf,OAAO,IAAI;AAAA,IACX,UAAU,IAAI;AAAA,IACd,QAAQ,IAAI;AAAA,IACZ,SAAS,IAAI;AAAA,IACb,YAAY,WAAW,YAAY;AAAA,EACrC;AAAA;AAGK,SAAS,uBAAuB,CAAC,OAAgD;AAAA,EACtF,OACE,cAAc,KAAK,KACnB,MAAM,kBAAkB,wCACxB,MAAM,SAAS,wBACf,OAAO,MAAM,cAAc,YAC3B,OAAO,MAAM,UAAU,YACvB,OAAO,MAAM,aAAa,YAC1B,iBAAiB,MAAM,MAAM,KAC7B,OAAO,MAAM,YAAY,YACzB,OAAO,SAAS,MAAM,OAAO,KAC7B,OAAO,MAAM,eAAe;AAAA;AAIhC,eAAsB,uBAAuB,CAC3C,QACA,KACe;AAAA,EACf,MAAM,QAAQ,sBAAsB,GAAG;AAAA,EACvC,MAAM,OAAO,aAAa;AAAA,IACxB,WAAW,IAAI;AAAA,IAC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A,QACE,MAAM,MAAM;AAAA,QACZ,KAAK,MAAM;AAAA,QAEX,SAAS,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AAAA,QACzC,gBAAgB,6BAA6B,KAAK;AAAA,MACpD;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,IAAI,IAAI,SAAS;AAAA,IAAgB,MAAM,wBAAwB,QAAQ,GAAG;AAAA;",
8
- "debugId": "01E889A4551AE38464756E2164756E21",
9
- "names": []
10
- }
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/agents/errors.ts", "../src/agents/context.ts"],
4
- "sourcesContent": [
5
- "/**\n * Base error for the agents module. Specific subclasses extend this so callers\n * can catch any agent-scoped failure with a single `instanceof AgentDefinitionError` check.\n */\nexport class AgentDefinitionError extends Error {\n readonly name: string = \"AgentDefinitionError\"\n}\n\n/**\n * Raised by the message adapters. `fromUiMessage` is **total**: rather than silently dropping a part it\n * cannot model, it throws this — which both prevents data loss and pinpoints exactly when the\n * {@link AgentMessage} part union must be extended. It also fires on transient/streaming parts that\n * must never be persisted, and on out-of-contract (non-JSON) payloads.\n */\nexport class AgentMessageAdapterError extends Error {\n readonly name = \"AgentMessageAdapterError\"\n}\n\n/**\n * An agent-tool failure whose message is intentionally safe to expose to the model and persist in\n * the durable trace. Tool authors must keep the message free of credentials and internal details;\n * unknown errors remain masked by the worker.\n */\nexport class AgentToolPublicError extends Error {\n readonly name: string = \"AgentToolPublicError\"\n}\n\n/** Raised when an agent tool result cannot cross the durable message boundary. */\nexport class AgentToolResultValidationError extends Error {\n readonly name = \"AgentToolResultValidationError\"\n\n constructor(\n readonly toolName: string,\n readonly reason: string,\n options?: ErrorOptions\n ) {\n super(`[Sixb] Agent tool '${toolName}' returned an invalid result; ${reason}.`, options)\n }\n}\n\nexport type AgentRequestErrorCode =\n | \"agent_selector_removed\"\n | \"agent_not_found\"\n | \"model_not_found\"\n | \"invalid_model_selection\"\n | \"run_not_found\"\n | \"run_not_retryable\"\n | \"thread_not_found\"\n | \"active_run_exists\"\n | \"authority_not_inheritable\"\n | \"invalid_context\"\n | \"storage_unavailable\"\n\n/**\n * Raised by {@link requestAgentRun} (the trigger). Callers branch on `code` rather than message text\n * — e.g. the HTTP layer maps `active_run_exists` to 409 and `agent_not_found` to 404.\n */\nexport class AgentRequestError extends Error {\n readonly name = \"AgentRequestError\"\n\n constructor(\n readonly code: AgentRequestErrorCode,\n message: string\n ) {\n super(message)\n }\n}\n",
6
- "import type { JsonValue } from \"../json\"\nimport { cloneJsonValue, getInvalidJsonValueReason, stableJsonStringify } from \"../json\"\nimport type { ObjectRef } from \"../ontology/refs\"\nimport { AgentRequestError } from \"./errors\"\n\nexport type AgentContextInput =\n | { readonly kind: \"object\"; readonly ref: ObjectRef }\n | {\n readonly kind: \"app-state\"\n readonly id: string\n readonly label: string\n readonly description: string\n readonly value: JsonValue\n }\n\nexport type AgentContextOrigin = \"ambient\" | \"explicit\"\n\nexport interface AgentContextEntryInput {\n readonly context: AgentContextInput\n readonly origin: AgentContextOrigin\n}\n\n/** Durable user-message part. Origin is display provenance, never an authorization grant. */\nexport interface AgentContextPart extends AgentContextEntryInput {\n readonly type: \"context\"\n}\n\nexport const MAX_AGENT_CONTEXT_ENTRIES = 12\nexport const MAX_AGENT_APP_STATE_ENTRY_BYTES = 16 * 1024\nexport const MAX_AGENT_APP_STATE_TOTAL_BYTES = 64 * 1024\n\n/** Typed constructors for context values shared by custom apps and agent clients. */\nexport const agentContext = {\n object<const TObjectTypeId extends string>(\n objectType: { readonly id: TObjectTypeId },\n primaryId: string\n ) {\n return {\n kind: \"object\" as const,\n ref: { objectTypeId: objectType.id, primaryId },\n }\n },\n\n appState<const TValue extends JsonValue>(\n id: string,\n input: {\n readonly label: string\n readonly description: string\n readonly value: TValue\n }\n ) {\n return { kind: \"app-state\" as const, id, ...input }\n },\n}\n\n/** Stable identity shared by core deduplication and context-aware clients. */\nexport function agentContextIdentity(context: AgentContextInput): string {\n return context.kind === \"object\"\n ? `object:${encodeURIComponent(context.ref.objectTypeId)}:${encodeURIComponent(context.ref.primaryId)}`\n : `app-state:${encodeURIComponent(context.id)}`\n}\n\n/** Stable semantic key for client-side comparisons. */\nexport function agentContextFingerprint(context: AgentContextInput): string {\n return stableJsonStringify(context)\n}\n\n/**\n * Validate transport-independent context rules and clone mutable app state before it can become\n * durable. Object existence and visibility are resolved separately because they require a runtime.\n */\nexport function normalizeAgentContextEntries(\n input: readonly AgentContextEntryInput[] | undefined\n): readonly AgentContextEntryInput[] {\n if (input === undefined) return []\n if (!Array.isArray(input)) invalidContext(\"context must be an array\")\n if (input.length > MAX_AGENT_CONTEXT_ENTRIES) {\n invalidContext(`context cannot contain more than ${MAX_AGENT_CONTEXT_ENTRIES} entries`)\n }\n\n const entries: AgentContextEntryInput[] = []\n const byIdentity = new Map<string, string>()\n let totalAppStateBytes = 0\n\n for (const [index, rawEntry] of input.entries()) {\n const entry = normalizeEntry(rawEntry, index)\n const identity = agentContextIdentity(entry.context)\n const serialized = stableJsonStringify(entry)\n const existing = byIdentity.get(identity)\n\n if (existing !== undefined) {\n if (existing === serialized) continue\n invalidContext(`context contains conflicting entries for '${identity}'`)\n }\n\n if (entry.context.kind === \"app-state\") {\n const bytes = utf8ByteLength(serialized)\n if (bytes > MAX_AGENT_APP_STATE_ENTRY_BYTES) {\n invalidContext(\n `context entry '${identity}' exceeds the ${MAX_AGENT_APP_STATE_ENTRY_BYTES}-byte limit`\n )\n }\n totalAppStateBytes += bytes\n if (totalAppStateBytes > MAX_AGENT_APP_STATE_TOTAL_BYTES) {\n invalidContext(\n `app-state context exceeds the ${MAX_AGENT_APP_STATE_TOTAL_BYTES}-byte message limit`\n )\n }\n }\n\n byIdentity.set(identity, serialized)\n entries.push(entry)\n }\n\n return entries\n}\n\nfunction normalizeEntry(rawEntry: unknown, index: number): AgentContextEntryInput {\n if (!isRecord(rawEntry)) invalidContext(`context[${index}] must be an object`)\n if (rawEntry.origin !== \"ambient\" && rawEntry.origin !== \"explicit\") {\n invalidContext(`context[${index}].origin must be 'ambient' or 'explicit'`)\n }\n if (!isRecord(rawEntry.context)) invalidContext(`context[${index}].context must be an object`)\n\n const context = rawEntry.context\n if (context.kind === \"object\") {\n if (!isRecord(context.ref)) invalidContext(`context[${index}].context.ref must be an object`)\n const objectTypeId = requireNonEmptyString(\n context.ref.objectTypeId,\n `context[${index}].context.ref.objectTypeId`\n )\n const primaryId = requireNonEmptyString(\n context.ref.primaryId,\n `context[${index}].context.ref.primaryId`\n )\n return {\n context: { kind: \"object\", ref: { objectTypeId, primaryId } },\n origin: rawEntry.origin,\n }\n }\n\n if (context.kind === \"app-state\") {\n const id = requireNonEmptyString(context.id, `context[${index}].context.id`)\n const label = requireNonEmptyString(context.label, `context[${index}].context.label`)\n const description = requireNonEmptyString(\n context.description,\n `context[${index}].context.description`\n )\n const reason = getInvalidJsonValueReason(context.value, `context[${index}].context.value`)\n if (reason) {\n invalidContext(`context[${index}].context.value must be a JSON value; ${reason}`)\n }\n return {\n context: {\n kind: \"app-state\",\n id,\n label,\n description,\n value: cloneJsonValue(context.value as JsonValue),\n },\n origin: rawEntry.origin,\n }\n }\n\n invalidContext(`context[${index}].context.kind must be 'object' or 'app-state'`)\n}\n\nfunction requireNonEmptyString(value: unknown, label: string): string {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n invalidContext(`${label} must be a non-empty string`)\n }\n return value\n}\n\nfunction utf8ByteLength(value: string): number {\n return new TextEncoder().encode(value).byteLength\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction invalidContext(message: string): never {\n throw new AgentRequestError(\"invalid_context\", `[Sixb] Invalid agent context: ${message}.`)\n}\n"
7
- ],
8
- "mappings": ";;;;;;;;AAIO,MAAM,6BAA6B,MAAM;AAAA,EACrC,OAAe;AAC1B;AAAA;AAQO,MAAM,iCAAiC,MAAM;AAAA,EACzC,OAAO;AAClB;AAAA;AAOO,MAAM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AM,IAAI,kBAAkB,mBAAmB,iCAAiC,UAAU;AAAA;",
9
- "debugId": "0BA2036A5CD1F1D964756E2164756E21",
10
- "names": []
11
- }
@@ -1,43 +0,0 @@
1
- // @bun
2
- import {
3
- aiLimitSubjectKey
4
- } from "./chunk-jecn6t54.js";
5
- import {
6
- createSixbError
7
- } from "./chunk-2xns679x.js";
8
-
9
- // src/storage/ai-limits/enforcement.ts
10
- function aiLimitSubjectsFromAttribution(requestedBy, requesterGroupIds) {
11
- const subjects = [
12
- { type: "project" },
13
- ...requesterGroupIds.map((id) => ({ type: "group", id }))
14
- ];
15
- if (requestedBy)
16
- subjects.push(requestedBy);
17
- const byKey = new Map(subjects.map((subject) => [aiLimitSubjectKey(subject), subject]));
18
- return [...byKey.values()].sort((left, right) => aiLimitSubjectKey(left).localeCompare(aiLimitSubjectKey(right)));
19
- }
20
- function applicableAiLimitPolicyStatuses(statuses, subjects) {
21
- const keys = new Set(subjects.map(aiLimitSubjectKey));
22
- return statuses.filter((status) => keys.has(aiLimitSubjectKey(status.policy.subject)));
23
- }
24
- function applicableAiLimitPolicies(policies, subjects) {
25
- const keys = new Set(subjects.map(aiLimitSubjectKey));
26
- return policies.filter((policy) => keys.has(aiLimitSubjectKey(policy.subject)));
27
- }
28
- function aiUsageLimitExceededError(resetAt) {
29
- return createSixbError("ai.usage_limit_exceeded", "[Sixb] An applicable AI usage limit has no capacity for this model call.", { details: aiLimitFailureDetails({ resetAt }) });
30
- }
31
- function aiUsageLimitUnavailableError(reasons) {
32
- return createSixbError("ai.usage_limit_unavailable", "[Sixb] An applicable AI usage limit could not be evaluated safely.", { details: aiLimitFailureDetails({ reasons }) });
33
- }
34
- function aiLimitFailureDetails(input) {
35
- return {
36
- ...input.resetAt === undefined ? {} : { resetAt: input.resetAt.toISOString() },
37
- ...input.reasons === undefined ? {} : { reasons: [...input.reasons] }
38
- };
39
- }
40
-
41
- export { aiLimitSubjectsFromAttribution, applicableAiLimitPolicyStatuses, applicableAiLimitPolicies, aiUsageLimitExceededError, aiUsageLimitUnavailableError };
42
-
43
- //# debugId=264BFFFD79C6CA2964756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/storage/agents/types.ts"],
4
- "sourcesContent": [
5
- "import type { AgentMessage, AgentMessagePart, AgentMessageRole } from \"../../agents/message\"\nimport type { AgentReasoningLevel } from \"../../agents/types\"\nimport type { Principal } from \"../../auth\"\nimport type { FileRef } from \"../../blob-storage\"\nimport type { SixbErrorCode, SixbFailure } from \"../../errors/types\"\nimport type { JsonValue } from \"../../json\"\nimport type { LanguageModelRef } from \"../../models\"\n\n// ── agent_threads — one conversation with an agent ──────────────────────────────────────────────\n\nexport type AgentThreadStatus = \"active\" | \"archived\"\n\nexport interface AgentThreadRecord {\n readonly id: string\n readonly projectId: string\n /** Who owns/opened the thread. Reuses the canonical auth principal (gains `agent` later for free). */\n readonly ownerPrincipal: Principal\n readonly title?: string\n readonly status: AgentThreadStatus\n /** Single-flight anchor: the id of the one run currently allowed to write, or `null` when idle. */\n readonly activeRunId: string | null\n readonly lastMessageAt?: Date\n readonly messageCount: number\n readonly createdAt: Date\n readonly updatedAt: Date\n}\n\nexport interface CreateAgentThreadInput {\n readonly id: string\n readonly projectId: string\n readonly ownerPrincipal: Principal\n readonly title?: string\n readonly status?: AgentThreadStatus\n readonly createdAt?: Date\n readonly updatedAt?: Date\n}\n\nexport interface ListAgentThreadsInput {\n readonly projectId: string\n readonly statuses?: readonly AgentThreadStatus[]\n readonly ownerPrincipal?: Principal\n readonly limit?: number\n readonly offset?: number\n readonly order?: \"asc\" | \"desc\"\n}\n\nexport interface ListAgentThreadsResult {\n readonly threads: readonly AgentThreadRecord[]\n readonly hasMore: boolean\n readonly total: number\n}\n\n// ── agent_runs — one loop execution (the worker job; attribution + fencing) ───────────────────\n\n/** Lifecycle shared by every durable agent execution, conversational or workflow-owned. */\nexport type AgentExecutionStatus = \"queued\" | \"running\" | \"succeeded\" | \"failed\" | \"cancelled\"\n\nexport type AgentRunStatus = AgentExecutionStatus\nexport type AgentRunKind = \"conversation\" | \"subagent\"\n\n/** Error codes an agent execution can persist and expose through its public contract. */\nexport const AGENT_RUN_FAILURE_CODES = [\n \"internal.unexpected\",\n \"runtime.cancelled\",\n \"agent.execution_failed\",\n \"ai.usage_limit_exceeded\",\n \"ai.usage_limit_unavailable\",\n] as const satisfies readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport type AgentRunFailureCode = (typeof AGENT_RUN_FAILURE_CODES)[number]\n\n/**\n * Why a run ended — Sixb's provider-independent vocabulary. It includes model-loop reasons plus\n * platform-level endings such as `timeout`, so reads remain typed and exhaustive. `other` and\n * `unknown` preserve terminal state when a provider adds a new reason.\n */\nexport const AGENT_RUN_FINISH_REASONS = [\n \"stop\",\n \"length\",\n \"content-filter\",\n \"tool-calls\",\n \"timeout\",\n \"error\",\n \"other\",\n \"unknown\",\n] as const\n\nexport type AgentRunFinishReason = (typeof AGENT_RUN_FINISH_REASONS)[number]\n\n/**\n * Coerce an external finish-reason string — a DB column or an SDK value — to {@link\n * AgentRunFinishReason}. An unrecognised value becomes `\"unknown\"` rather than being dropped.\n */\nexport function coerceAgentRunFinishReason(\n value: string | null | undefined\n): AgentRunFinishReason | undefined {\n if (value === null || value === undefined) {\n return undefined\n }\n return (AGENT_RUN_FINISH_REASONS as readonly string[]).includes(value)\n ? (value as AgentRunFinishReason)\n : \"unknown\"\n}\n\n/** Stable, user-facing diagnostics emitted by the platform while executing a run. */\nexport const AGENT_RUN_DIAGNOSTIC_CODES = [\n \"output_file_limit_exceeded\",\n \"output_file_too_large\",\n \"output_budget_exhausted\",\n \"output_collection_failed\",\n \"output_file_changed\",\n \"output_storage_failed\",\n] as const\n\n/**\n * Closed on purpose, and the wire is closed with it.\n *\n * Sixb writes these codes and the generated client is what reads them, so an open union would only\n * be honest if the HTTP schema were open too — and that costs the OpenAPI enum, the client's\n * autocompletion, and Atlas's exhaustive `switch`. Sixb owns both ends, so a new code is a minor\n * version bump: cheap here, and a broken `switch` is better than a 500 from `z.enum`.\n */\nexport type AgentRunDiagnosticCode = (typeof AGENT_RUN_DIAGNOSTIC_CODES)[number]\nexport type AgentRunDiagnosticSeverity = \"warning\" | \"error\"\n\nexport interface AgentRunDiagnostic {\n readonly code: AgentRunDiagnosticCode\n readonly severity: AgentRunDiagnosticSeverity\n readonly scope: \"output\"\n /** Relative path inside the run's published output directory, when one file is involved. */\n readonly path?: string\n /** Sanitized, stable copy suitable for display to an end user. */\n readonly message: string\n}\n\n/**\n * Authorization state for the current queue delivery.\n *\n * `queueLeaseExpiresAt` is a persisted projection of `ClaimedQueueJob.leaseExpiresAt`, not an\n * independently managed run lease. It may only be extended from a successful queue lease renewal.\n */\nexport interface AgentRunExecution {\n readonly token: string\n readonly queueLeaseExpiresAt: Date\n}\n\ninterface AgentRunRecordBase {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n /** Durable group memberships snapshotted when the run was admitted. */\n readonly requesterGroupIds: readonly string[]\n readonly status: AgentRunStatus\n readonly modelId?: string\n /** Why the run ended (our own SDK-independent enum). */\n readonly finishReason?: AgentRunFinishReason\n /** Platform diagnostics are transcript annotations, never agent-authored message content. */\n readonly diagnostics?: readonly AgentRunDiagnostic[]\n /** Portable failure snapshot when the run did not succeed. */\n readonly error?: SixbFailure<AgentRunFailureCode>\n /** Execution attempts: `0` while queued, `1` on first start, incremented on redelivery. */\n readonly attempt: number\n readonly execution?: AgentRunExecution\n readonly createdAt: Date\n readonly startedAt?: Date\n readonly completedAt?: Date\n}\n\nexport interface ConversationAgentRunRecord extends AgentRunRecordBase {\n readonly kind: \"conversation\"\n readonly threadId: string\n readonly triggerMessageId: string\n /** Immutable model selection captured at admission. Absent only on runs predating this field. */\n readonly spec?: ConversationAgentRunSpec\n}\n\n/** Immutable, serialisable model selection for one conversational turn. */\nexport interface ConversationAgentRunSpec {\n readonly model: LanguageModelRef\n readonly reasoning?: AgentReasoningLevel\n}\n\n/** Immutable, serialisable child configuration captured before dispatch. */\nexport interface SubagentRunSpec {\n readonly model: LanguageModelRef\n readonly reasoning?: AgentReasoningLevel\n /** Focused task supplied by the parent Agent. */\n readonly task: string\n /** Project tools available when the child was admitted. Runtime tools are injected separately. */\n readonly toolNames: readonly string[]\n readonly maxSteps: number\n}\n\n/** Durable child output returned to its parent by `wait_agent`. */\nexport interface SubagentRunResult {\n readonly text?: string\n readonly files?: readonly FileRef[]\n}\n\nexport interface SubagentRunRecord extends AgentRunRecordBase {\n readonly kind: \"subagent\"\n readonly parentRunId: string\n /** Stable parent-selected key that makes repeated tool execution idempotent. */\n readonly spawnKey: string\n readonly spec: SubagentRunSpec\n readonly result?: SubagentRunResult\n}\n\nexport type AgentRunRecord = ConversationAgentRunRecord | SubagentRunRecord\n\nexport interface CreateAgentRunInput {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly threadId: string\n readonly triggerMessageId: string\n readonly spec: ConversationAgentRunSpec\n readonly requesterGroupIds: readonly string[]\n readonly createdAt?: Date\n}\n\nexport interface CreateSubagentRunInput {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly parentRunId: string\n /** Current parent delivery token. New children are admitted only while that delivery owns it. */\n readonly parentExecutionToken: string\n readonly spawnKey: string\n readonly spec: SubagentRunSpec\n /** Internal safety bound enforced atomically across worker processes. */\n readonly maxActiveChildren: number\n readonly createdAt?: Date\n}\n\nexport interface StartAgentRunInput {\n readonly id: string\n readonly projectId: string\n readonly modelId?: string\n readonly execution: AgentRunExecution\n readonly startedAt?: Date\n}\n\nexport interface FinishQueuedAgentRunInput {\n readonly id: string\n readonly projectId: string\n readonly status: \"failed\" | \"cancelled\"\n readonly error?: SixbFailure<AgentRunFailureCode>\n readonly completedAt?: Date\n}\n\nexport interface ReclaimAgentRunInput {\n readonly id: string\n readonly projectId: string\n readonly execution: AgentRunExecution\n}\n\nexport interface ConfirmAgentRunExecutionOwnershipInput {\n readonly id: string\n readonly projectId: string\n readonly executionToken: string\n /** Exact expiration returned by the queue claim or its latest successful renewal. */\n readonly queueLeaseExpiresAt: Date\n}\n\nexport type FinishAgentRunInput =\n | {\n readonly id: string\n readonly projectId: string\n readonly executionToken: string\n readonly status: \"succeeded\"\n readonly modelId?: string\n readonly finishReason?: AgentRunFinishReason\n readonly diagnostics?: readonly AgentRunDiagnostic[]\n readonly result?: SubagentRunResult\n readonly completedAt?: Date\n }\n | {\n readonly id: string\n readonly projectId: string\n readonly executionToken: string\n readonly status: \"failed\" | \"cancelled\"\n readonly modelId?: string\n readonly finishReason?: AgentRunFinishReason\n readonly diagnostics?: readonly AgentRunDiagnostic[]\n readonly error?: SixbFailure<AgentRunFailureCode>\n readonly completedAt?: Date\n }\n\nexport interface ListAgentRunsInput {\n readonly projectId: string\n readonly kinds?: readonly AgentRunKind[]\n readonly threadId?: string\n readonly parentRunId?: string\n readonly statuses?: readonly AgentRunStatus[]\n /** Effective start time; runs that never started use `createdAt`. */\n readonly startedAfter?: Date\n /** Effective start time; runs that never started use `createdAt`. */\n readonly startedBefore?: Date\n readonly limit?: number\n readonly offset?: number\n readonly order?: \"asc\" | \"desc\"\n}\n\nexport interface ListAgentRunsResult {\n readonly runs: readonly AgentRunRecord[]\n readonly hasMore: boolean\n readonly total: number\n}\n\n// ── agent_messages — one message (assistant messages inserted only once finalized) ─────────────\n\nexport type { AgentMessageRole }\n\nexport interface AgentMessageRecord {\n readonly id: string\n readonly projectId: string\n readonly threadId: string\n /** The run that produced this message; `null` for user-authored messages. */\n readonly runId: string | null\n readonly role: AgentMessageRole\n /** Principal that authored this persisted message: caller for user messages, agent identity later for assistant messages. */\n readonly authorPrincipal?: Principal\n /** Monotonic per thread, assigned by the store. */\n readonly seq: number\n /** Structured message content — text / reasoning / step boundaries / tool calls. */\n readonly parts: readonly AgentMessagePart[]\n /** Message-level metadata (mirrors `UIMessage.metadata`). */\n readonly metadata?: JsonValue\n /** Versions the `parts` shape so it can be migrated; stamped from `AGENT_MESSAGE_CONTENT_VERSION`. */\n readonly contentVersion: number\n readonly createdAt: Date\n readonly completedAt?: Date\n}\n\n/** Append a message: a {@link AgentMessage} (role + parts + metadata) plus its storage identity. */\nexport interface AppendAgentMessageInput extends AgentMessage {\n readonly id: string\n readonly projectId: string\n readonly threadId: string\n readonly runId: string | null\n readonly authorPrincipal?: Principal\n readonly createdAt?: Date\n readonly completedAt?: Date\n}\n\nexport interface DeleteAgentMessagesByRunInput {\n readonly projectId: string\n readonly threadId: string\n readonly runId: string\n}\n\nexport interface ListAgentMessagesInput {\n readonly projectId: string\n readonly threadId: string\n /** Return only messages whose per-thread sequence is greater than this retained boundary. */\n readonly afterSeq?: number\n readonly roles?: readonly AgentMessageRole[]\n readonly limit?: number\n readonly offset?: number\n readonly order?: \"asc\" | \"desc\"\n}\n\nexport interface ListAgentMessagesResult {\n readonly messages: readonly AgentMessageRecord[]\n readonly hasMore: boolean\n readonly total: number\n}\n\n// ── agent_context_checkpoints — append-only model-context boundaries ──────────────────────────\n\nexport type AgentContextCheckpointReason = \"threshold\" | \"overflow\"\n\n/**\n * A durable summary boundary used only when projecting a thread into model context.\n *\n * Checkpoints never replace or mutate transcript messages. Normal thread reads remain authoritative\n * and complete; the worker reads the latest checkpoint and only the retained message tail.\n */\nexport interface AgentContextCheckpointRecord {\n readonly id: string\n readonly projectId: string\n readonly threadId: string\n readonly createdByRunId: string\n readonly previousCheckpointId?: string\n readonly reason: AgentContextCheckpointReason\n readonly summary: string\n readonly summaryFormatVersion: 1\n readonly summarizedThroughSeq: number\n readonly observedHeadSeq: number\n readonly estimatedInputTokensBefore: number\n readonly estimatedInputTokensAfter: number\n readonly summaryModelId: string\n readonly createdAt: Date\n}\n\nexport interface CreateAgentContextCheckpointInput {\n readonly id: string\n readonly projectId: string\n readonly threadId: string\n readonly createdByRunId: string\n /** Compare-and-swap anchor. `null` means the thread must not have a prior checkpoint. */\n readonly expectedPreviousCheckpointId: string | null\n /** Compare-and-swap anchor for the complete transcript observed by the summarizer. */\n readonly expectedHeadSeq: number\n /** Current delivery token for `createdByRunId`; stale redeliveries must not write. */\n readonly executionToken: string\n readonly reason: AgentContextCheckpointReason\n readonly summary: string\n readonly summaryFormatVersion: 1\n readonly summarizedThroughSeq: number\n readonly observedHeadSeq: number\n readonly estimatedInputTokensBefore: number\n readonly estimatedInputTokensAfter: number\n readonly summaryModelId: string\n readonly createdAt?: Date\n}\n\n// ── Store ───────────────────────────────────────────────────────────────────────────────────────\n\nexport interface AgentThreadStore {\n create(input: CreateAgentThreadInput): Promise<AgentThreadRecord>\n getById(params: { projectId: string; id: string }): Promise<AgentThreadRecord | null>\n list(input: ListAgentThreadsInput): Promise<ListAgentThreadsResult>\n}\n\nexport interface AgentRunStore {\n /** Persist a queued run and atomically claim the thread's single-flight slot. */\n create(input: CreateAgentRunInput): Promise<ConversationAgentRunRecord>\n /** Persist or replay one idempotent child run while atomically enforcing parent fan-out. */\n createSubagent(input: CreateSubagentRunInput): Promise<SubagentRunRecord>\n /** Transition a queued run to running and install the first delivery's execution token. */\n start(input: StartAgentRunInput): Promise<AgentRunRecord>\n /** Finish a queued run before execution and release the thread's single-flight slot. */\n finishQueued(input: FinishQueuedAgentRunInput): Promise<AgentRunRecord>\n /** Rotate the execution token for a redelivered running job (`attempt++`). */\n reclaim(input: ReclaimAgentRunInput): Promise<AgentRunRecord>\n /**\n * Project the queue's latest confirmed ownership expiration onto the current execution.\n * Implementations must fence by token and must never move the expiration backwards.\n */\n confirmExecutionOwnership(input: ConfirmAgentRunExecutionOwnershipInput): Promise<AgentRunRecord>\n /** Finalize a run and release the thread's `activeRunId`. */\n finish(input: FinishAgentRunInput): Promise<AgentRunRecord>\n getById(params: { projectId: string; id: string }): Promise<AgentRunRecord | null>\n getByIds(params: {\n projectId: string\n ids: readonly string[]\n }): Promise<readonly AgentRunRecord[]>\n list(input: ListAgentRunsInput): Promise<ListAgentRunsResult>\n}\n\nexport interface AgentMessageStore {\n /** Insert a message (its `parts` are the canonical content) and bump thread stats. */\n append(input: AppendAgentMessageInput): Promise<AgentMessageRecord>\n /** Delete every message produced by one run and repair the thread's message stats. */\n deleteByRunId(input: DeleteAgentMessagesByRunInput): Promise<number>\n getById(params: { projectId: string; id: string }): Promise<AgentMessageRecord | null>\n list(input: ListAgentMessagesInput): Promise<ListAgentMessagesResult>\n}\n\nexport interface AgentContextCheckpointStore {\n /**\n * Append one checkpoint after atomically validating run ownership and both transcript anchors.\n * Repeating the same payload for the same creating run is idempotent.\n */\n create(input: CreateAgentContextCheckpointInput): Promise<AgentContextCheckpointRecord>\n /** Return checkpoints created by the requested runs, in first-occurrence input order. */\n getByRunIds(input: {\n readonly projectId: string\n readonly runIds: readonly string[]\n }): Promise<readonly AgentContextCheckpointRecord[]>\n getLatest(input: {\n readonly projectId: string\n readonly threadId: string\n }): Promise<AgentContextCheckpointRecord | null>\n}\n\nexport interface AgentStorage {\n readonly threads: AgentThreadStore\n readonly runs: AgentRunStore\n readonly messages: AgentMessageStore\n readonly checkpoints: AgentContextCheckpointStore\n}\n"
6
- ],
7
- "mappings": ";;AA6DO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQO,SAAS,0BAA0B,CACxC,OACkC;AAAA,EAClC,IAAI,UAAU,QAAQ,UAAU,WAAW;AAAA,IACzC;AAAA,EACF;AAAA,EACA,OAAQ,yBAA+C,SAAS,KAAK,IAChE,QACD;AAAA;AAIC,IAAM,6BAA6B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
8
- "debugId": "4012BA3E8FE1A2E864756E2164756E21",
9
- "names": []
10
- }
@@ -1,72 +0,0 @@
1
- // @bun
2
- import {
3
- isRecord,
4
- validateSchemaValue
5
- } from "./chunk-d63tybny.js";
6
- import {
7
- OntologyValidationError
8
- } from "./chunk-dktq02ne.js";
9
-
10
- // src/ontology/refs.ts
11
- function ref(objectType) {
12
- return {
13
- type: "objectRef",
14
- objectTypeId: objectType.id
15
- };
16
- }
17
- function isObjectRefSchema(schema) {
18
- return typeof schema === "object" && schema !== null && schema.type === "objectRef";
19
- }
20
- function validateSchemaOrRefValue(schema, value, path, valueTypesById) {
21
- if (isObjectRefSchema(schema)) {
22
- validateObjectRefValue(schema, value, path);
23
- return;
24
- }
25
- validateSchemaValue(schema, value, path, valueTypesById);
26
- }
27
- function validateObjectRefValue(schema, value, path) {
28
- if (!isRecord(value)) {
29
- throw new OntologyValidationError(`[Sixb] Property ${path} must be an objectRef`);
30
- }
31
- const allowedFields = new Set(["objectTypeId", "primaryId"]);
32
- for (const fieldId of Object.keys(value)) {
33
- if (!allowedFields.has(fieldId)) {
34
- throw new OntologyValidationError(`[Sixb] Unknown field '${path}.${fieldId}'`);
35
- }
36
- }
37
- if (value.objectTypeId !== schema.objectTypeId) {
38
- throw new OntologyValidationError(`[Sixb] Property ${path}.objectTypeId must be "${schema.objectTypeId}"`);
39
- }
40
- if (typeof value.primaryId !== "string") {
41
- throw new OntologyValidationError(`[Sixb] Property ${path}.primaryId must be a string`);
42
- }
43
- }
44
-
45
- // src/ontology/tokens.ts
46
- function createPropertyTokenMap(objectType) {
47
- const tokenEntries = objectType.properties.map((property) => {
48
- const token = {
49
- objectTypeId: objectType.id,
50
- id: property.id,
51
- property
52
- };
53
- return [property.id, token];
54
- });
55
- return Object.fromEntries(tokenEntries);
56
- }
57
- function createLinkTokenMap(objectType) {
58
- const tokenEntries = objectType.links.map((link) => {
59
- const token = {
60
- objectTypeId: objectType.id,
61
- id: link.id,
62
- targetObjectTypeId: link.targetObjectTypeId,
63
- link
64
- };
65
- return [link.id, token];
66
- });
67
- return Object.fromEntries(tokenEntries);
68
- }
69
-
70
- export { ref, isObjectRefSchema, validateSchemaOrRefValue, createPropertyTokenMap, createLinkTokenMap };
71
-
72
- //# debugId=912178D6A694401B64756E2164756E21
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/ontology/refs.ts", "../src/ontology/tokens.ts"],
4
- "sourcesContent": [
5
- "import { OntologyValidationError } from \"./errors\"\nimport type { InferSchema } from \"./inference\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport { isRecord, validateSchemaValue } from \"./validation\"\n\nexport type ObjectRef<TObjectTypeId extends string = string> = {\n objectTypeId: TObjectTypeId\n primaryId: string\n}\n\nexport interface ObjectRefSchema<TObjectTypeId extends string = string> {\n readonly type: \"objectRef\"\n readonly objectTypeId: TObjectTypeId\n}\n\nexport type SchemaOrRef = Schema | ObjectRefSchema\n\nexport type InferSchemaOrRef<\n TSchema extends SchemaOrRef,\n TValueTypes extends readonly ValueType[] = [],\n> =\n TSchema extends ObjectRefSchema<infer TObjectTypeId>\n ? ObjectRef<TObjectTypeId>\n : TSchema extends Schema\n ? InferSchema<TSchema, TValueTypes>\n : never\n\nexport function ref<const TObjectType extends ObjectType>(\n objectType: TObjectType\n): ObjectRefSchema<TObjectType[\"id\"]> {\n return {\n type: \"objectRef\",\n objectTypeId: objectType.id,\n }\n}\n\nexport function isObjectRefSchema(schema: SchemaOrRef): schema is ObjectRefSchema {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n (schema as { type?: unknown }).type === \"objectRef\"\n )\n}\n\nexport function validateSchemaOrRefValue(\n schema: SchemaOrRef,\n value: unknown,\n path: string,\n valueTypesById: ReadonlyMap<string, ValueType>\n): void {\n if (isObjectRefSchema(schema)) {\n validateObjectRefValue(schema, value, path)\n return\n }\n\n validateSchemaValue(schema, value, path, valueTypesById)\n}\n\nfunction validateObjectRefValue(schema: ObjectRefSchema, value: unknown, path: string): void {\n if (!isRecord(value)) {\n throw new OntologyValidationError(`[Sixb] Property ${path} must be an objectRef`)\n }\n\n const allowedFields = new Set([\"objectTypeId\", \"primaryId\"])\n for (const fieldId of Object.keys(value)) {\n if (!allowedFields.has(fieldId)) {\n throw new OntologyValidationError(`[Sixb] Unknown field '${path}.${fieldId}'`)\n }\n }\n\n if (value.objectTypeId !== schema.objectTypeId) {\n throw new OntologyValidationError(\n `[Sixb] Property ${path}.objectTypeId must be \"${schema.objectTypeId}\"`\n )\n }\n\n if (typeof value.primaryId !== \"string\") {\n throw new OntologyValidationError(`[Sixb] Property ${path}.primaryId must be a string`)\n }\n}\n",
6
- "import type { ObjectLink, ObjectType, Property } from \"./types\"\n\ndeclare const propertyTokenBrand: unique symbol\ndeclare const linkTokenBrand: unique symbol\n\n/**\n * Strongly-typed handle to a property on a specific object type.\n *\n * Tokens let runtime APIs accept object properties without using string ids.\n */\nexport type PropertyToken<\n TObjectTypeId extends string = string,\n TPropertyId extends string = string,\n TProperty extends Property = Property,\n> = {\n readonly [propertyTokenBrand]?: never\n readonly objectTypeId: TObjectTypeId\n readonly id: TPropertyId\n readonly property: TProperty\n}\n\nexport type PropertyTokenMap<TObjectType extends ObjectType> = {\n readonly [P in TObjectType[\"properties\"][number] as P[\"id\"]]: PropertyToken<\n TObjectType[\"id\"],\n P[\"id\"],\n P\n >\n}\n\nexport type LinkToken<\n TObjectTypeId extends string = string,\n TLinkId extends string = string,\n TTargetObjectTypeId extends string | readonly string[] = string | readonly string[],\n TLink extends ObjectLink = ObjectLink,\n> = {\n readonly [linkTokenBrand]?: never\n readonly objectTypeId: TObjectTypeId\n readonly id: TLinkId\n readonly targetObjectTypeId: TTargetObjectTypeId\n readonly link: TLink\n}\n\nexport type LinkTokenMap<TObjectType extends ObjectType> = {\n readonly [L in TObjectType[\"links\"][number] as L[\"id\"]]: LinkToken<\n TObjectType[\"id\"],\n L[\"id\"],\n L[\"targetObjectTypeId\"],\n L\n >\n}\n\n/**\n * Object type with property tokens (`p.*`).\n *\n * The original ontology shape is preserved; this only adds typed handles.\n */\nexport type ObjectTypeWithPropertyTokens<TObjectType extends ObjectType = ObjectType> =\n TObjectType & {\n readonly p: PropertyTokenMap<TObjectType>\n }\n\n/**\n * Object type with property tokens (`p.*`) and link tokens (`l.*`).\n *\n * `links` is a plain array for iteration.\n * `l` provides keyed token access (`Room.l.hasThermostat`).\n */\nexport type ObjectTypeWithTokens<TObjectType extends ObjectType = ObjectType> =\n ObjectTypeWithPropertyTokens<TObjectType> & {\n readonly l: LinkTokenMap<TObjectType>\n }\n\n/**\n * Build the `objectType.p.*` token map once when the object type is defined.\n */\nexport function createPropertyTokenMap<TObjectType extends ObjectType>(\n objectType: TObjectType\n): PropertyTokenMap<TObjectType> {\n const tokenEntries = objectType.properties.map((property) => {\n const token: PropertyToken<TObjectType[\"id\"], typeof property.id, typeof property> = {\n objectTypeId: objectType.id,\n id: property.id,\n property,\n }\n return [property.id, token] as const\n })\n\n return Object.fromEntries(tokenEntries) as PropertyTokenMap<TObjectType>\n}\n\n/**\n * Build the `objectType.l.*` link token map once when the object type is defined.\n */\nexport function createLinkTokenMap<TObjectType extends ObjectType>(\n objectType: TObjectType\n): LinkTokenMap<TObjectType> {\n const tokenEntries = objectType.links.map((link) => {\n const token: LinkToken<\n TObjectType[\"id\"],\n typeof link.id,\n typeof link.targetObjectTypeId,\n typeof link\n > = {\n objectTypeId: objectType.id,\n id: link.id,\n targetObjectTypeId: link.targetObjectTypeId,\n link,\n }\n return [link.id, token] as const\n })\n\n return Object.fromEntries(tokenEntries) as LinkTokenMap<TObjectType>\n}\n"
7
- ],
8
- "mappings": ";;;;;;;;;;AA2BO,SAAS,GAAyC,CACvD,YACoC;AAAA,EACpC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,WAAW;AAAA,EAC3B;AAAA;AAGK,SAAS,iBAAiB,CAAC,QAAgD;AAAA,EAChF,OACE,OAAO,WAAW,YAClB,WAAW,QACV,OAA8B,SAAS;AAAA;AAIrC,SAAS,wBAAwB,CACtC,QACA,OACA,MACA,gBACM;AAAA,EACN,IAAI,kBAAkB,MAAM,GAAG;AAAA,IAC7B,uBAAuB,QAAQ,OAAO,IAAI;AAAA,IAC1C;AAAA,EACF;AAAA,E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O,YAAY,YAAY;AAAA;",
9
- "debugId": "912178D6A694401B64756E2164756E21",
10
- "names": []
11
- }
@@ -1,34 +0,0 @@
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 { type AuthorizationContext, assertAuthorized, assertCanEdit } from \"../../authorization\"\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: { readonly authorization?: AuthorizationContext },\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 { type AuthorizationContext, assertAuthorized } from \"../../authorization\"\nimport type { RuntimeAuthorization } from \"../../execution\"\nimport type {\n TimeseriesHistoryBatchInput,\n TimeseriesHistoryBatchResult,\n TimeseriesHistorySeriesInput,\n TimeseriesStorage,\n} from \"../../storage\"\n\nexport interface TelemetryHistoryOptions {\n readonly storage: TimeseriesStorage\n readonly runtimeAuthorization?: RuntimeAuthorization\n readonly authorization?: AuthorizationContext | null\n}\n\nexport async function getTelemetryHistoryBatch(\n input: TimeseriesHistoryBatchInput,\n options: TelemetryHistoryOptions\n): Promise<readonly TimeseriesHistoryBatchResult[]> {\n assertTelemetrySeriesViewable(input.series, options)\n return options.storage.getHistoryBatch(input)\n}\n\nfunction assertTelemetrySeriesViewable(\n series: readonly TimeseriesHistorySeriesInput[],\n authorization: Pick<TelemetryHistoryOptions, \"authorization\" | \"runtimeAuthorization\">\n): void {\n for (const objectTypeId of new Set(series.map((entry) => entry.objectTypeId))) {\n assertAuthorized(\n {\n runtimeAuthorization: authorization.runtimeAuthorization,\n authorization: authorization.authorization ?? undefined,\n },\n { kind: \"object.view\", objectTypeId }\n )\n }\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 if (!timeseries) {\n throw new RuntimeError(\"[Sixb] Reading telemetry requires storage.timeseries support.\")\n }\n\n const [result] = await getTelemetryHistoryBatch(\n {\n projectId: ctx.projectId,\n series: [series],\n ...(input.from !== undefined ? { from: input.from } : {}),\n ...(input.to !== undefined ? { to: input.to } : {}),\n ...(input.limit !== undefined ? { limitPerSeries: input.limit } : {}),\n ...(input.order !== undefined ? { order: input.order } : {}),\n },\n {\n storage: timeseries,\n runtimeAuthorization: ctx.runtimeAuthorization,\n authorization: ctx.authorization,\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 { assertAuthorized, assertPrivileged } from \"../../authorization\"\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 assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: ctx.objectType.id })\n const row = await ctx.storage.objects.getByPrimaryId({\n projectId: ctx.projectId,\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 // Link rows reveal target types; no link grant semantics exist yet.\n assertPrivileged(ctx, \"listLinks\")\n if (linkToken) {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n }\n return ctx.storage.objects.listLinks({\n projectId: ctx.projectId,\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 { AuthorizationContext } from \"../../authorization\"\nimport type { RuntimeAuthorization } from \"../../execution/types\"\nimport type { OntologyRegistry } from \"../../ontology\"\nimport type { Storage } from \"../../storage\"\nimport {\n countObjects,\n executeObjectQuery,\n existsObjects,\n facetObjects,\n ObjectQueryPlanningError,\n} 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 projectId: string\n ontology: OntologyRegistry\n storage: Storage\n runtimeAuthorization?: RuntimeAuthorization\n authorization?: AuthorizationContext\n}): ObjectQueryExecutor {\n const { projectId, ontology, storage, runtimeAuthorization, authorization } = params\n const executorOptions = {\n ontology,\n storage: storage.objects,\n runtimeAuthorization,\n authorization,\n }\n\n return {\n async list(query: ObjectQuery, options?: { includeTotal?: boolean }) {\n try {\n return await executeObjectQuery(\n { projectId, query, includeTotal: options?.includeTotal },\n executorOptions\n )\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 countObjects({ projectId, query }, executorOptions)\n return result.count\n },\n\n async exists(query: ObjectQuery) {\n const result = await existsObjects({ projectId, query }, executorOptions)\n return result.exists\n },\n\n async facets(query: ObjectQuery, facets: readonly ObjectQueryExecutorFacetRequest[]) {\n const result = await facetObjects({ projectId, query, facets }, executorOptions)\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 { assertAuthorized } from \"../../authorization\"\nimport { shareSixbErrorReporter } from \"../../error-reporting/capability\"\nimport type { ExecutionContext } from \"../../execution\"\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 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 runtimeAuthorization,\n authorization,\n execution,\n } = params\n const queryExecutor = createRuntimeQueryExecutor({\n projectId,\n ontology,\n storage,\n runtimeAuthorization,\n authorization,\n })\n\n const resolvedCtx: ExecutionObjectContext = {\n projectId,\n broker,\n ontology,\n actionRegistry,\n events,\n storage,\n queues,\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 assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const row = await storage.objects.getByPrimaryId({\n projectId,\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 assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const result = await storage.objects.list({\n projectId,\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 * On principal-bound runtimes the type filter is authorized before the storage call:\n * explicitly requested types must all be viewable, and unfiltered listings\n * narrow to the principal's viewable types instead of post-filtering rows.\n */\n\nimport { assertAuthorized } from \"../../authorization\"\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 = resolveAuthorizedTypeFilter(runtime, params.objectTypeIds)\n\n if (runtime.authorization && objectTypeIds !== undefined && objectTypeIds.length === 0) {\n return { objects: [], hasMore: false, total: 0 }\n }\n\n const result = await runtime.storage.objects.list({\n projectId: runtime.projectId,\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 resolveAuthorizedTypeFilter(\n runtime: SixbRuntimeContext,\n requested: readonly string[] | undefined\n): readonly string[] | undefined {\n if (requested) {\n for (const objectTypeId of requested) {\n runtime.ontology.resolveObjectType(objectTypeId)\n }\n }\n\n const expanded = requested\n ? [...new Set(requested.flatMap((id) => [id, ...runtime.ontology.listSubTypes(id)]))]\n : undefined\n\n if (!runtime.authorization) {\n return expanded\n }\n\n if (!expanded) {\n // Broad listings narrow to the visible universe rather than failing. The\n // set already contains every registered type when \"all\" was granted.\n return [...runtime.authorization.grants[\"view:object\"]]\n }\n\n // Explicitly requested types must all be viewable.\n for (const objectTypeId of expanded) {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n }\n\n return expanded\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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