@sixb/core 0.1.8 → 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 (615) hide show
  1. package/dist/actions/index.js +77 -89
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/run-dispatch.d.ts.map +1 -1
  4. package/dist/actions/types/context.d.ts +2 -0
  5. package/dist/actions/types/context.d.ts.map +1 -1
  6. package/dist/actions/validation.d.ts +1 -1
  7. package/dist/actions/validation.d.ts.map +1 -1
  8. package/dist/actions/worker.js +33 -37
  9. package/dist/actions/worker.js.map +2 -2
  10. package/dist/agents/adapters.d.ts +3 -3
  11. package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
  12. package/dist/agents/context/entries.d.ts.map +1 -0
  13. package/dist/agents/context/index.d.ts +4 -0
  14. package/dist/agents/context/index.d.ts.map +1 -0
  15. package/dist/agents/context/index.js +19 -0
  16. package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
  17. package/dist/agents/context-model.d.ts +1 -1
  18. package/dist/agents/context-model.d.ts.map +1 -1
  19. package/dist/agents/context-resolution.d.ts +1 -1
  20. package/dist/agents/context-resolution.d.ts.map +1 -1
  21. package/dist/agents/index.d.ts +4 -4
  22. package/dist/agents/index.d.ts.map +1 -1
  23. package/dist/agents/index.js +192 -204
  24. package/dist/agents/index.js.map +1 -1
  25. package/dist/agents/message.d.ts +1 -1
  26. package/dist/agents/message.d.ts.map +1 -1
  27. package/dist/agents/model-loop.d.ts +2 -0
  28. package/dist/agents/model-loop.d.ts.map +1 -1
  29. package/dist/agents/request.d.ts +1 -1
  30. package/dist/agents/request.d.ts.map +1 -1
  31. package/dist/agents/streams/index.d.ts +4 -0
  32. package/dist/agents/streams/index.d.ts.map +1 -0
  33. package/dist/agents/streams/index.js +20 -0
  34. package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
  35. package/dist/agents/streams/internal.d.ts +3 -0
  36. package/dist/agents/streams/internal.d.ts.map +1 -0
  37. package/dist/agents/streams/internal.js +40 -0
  38. package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
  39. package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
  40. package/dist/agents/streams/protocol.d.ts.map +1 -0
  41. package/dist/agents/types.d.ts +1 -1
  42. package/dist/agents/types.d.ts.map +1 -1
  43. package/dist/agents/validation.d.ts.map +1 -1
  44. package/dist/auth/index.d.ts +0 -1
  45. package/dist/auth/index.d.ts.map +1 -1
  46. package/dist/auth/index.js +96 -108
  47. package/dist/auth/index.js.map +1 -1
  48. package/dist/auth/strategy.js +8 -9
  49. package/dist/auth/strategy.js.map +1 -1
  50. package/dist/authorization/index.js +51 -56
  51. package/dist/authorization/index.js.map +1 -1
  52. package/dist/blob-storage/browser.js +15 -17
  53. package/dist/blob-storage/browser.js.map +1 -1
  54. package/dist/blob-storage/index.js +36 -38
  55. package/dist/blob-storage/index.js.map +1 -1
  56. package/dist/bootstrap/discovery.d.ts +14 -1
  57. package/dist/bootstrap/discovery.d.ts.map +1 -1
  58. package/dist/bootstrap/index.d.ts +2 -2
  59. package/dist/bootstrap/index.d.ts.map +1 -1
  60. package/dist/bootstrap/index.js +79 -88
  61. package/dist/bootstrap/index.js.map +1 -1
  62. package/dist/broker/index.js +8 -10
  63. package/dist/broker/index.js.map +1 -1
  64. package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
  65. package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
  66. package/dist/{chunk-q0k9nc5a.js → chunk-0w35wavj.js} +98 -98
  67. package/dist/{chunk-q0k9nc5a.js.map → chunk-0w35wavj.js.map} +2 -2
  68. package/dist/chunk-0y39rgsb.js +43 -0
  69. package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
  70. package/dist/{chunk-k522z7v6.js → chunk-17kfctj6.js} +16 -11
  71. package/dist/chunk-17kfctj6.js.map +10 -0
  72. package/dist/{chunk-aa2pen2v.js → chunk-1enhpacz.js} +188 -175
  73. package/dist/{chunk-aa2pen2v.js.map → chunk-1enhpacz.js.map} +2 -2
  74. package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
  75. package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
  76. package/dist/{chunk-fvt9rjsa.js → chunk-38zv5rkr.js} +4 -4
  77. package/dist/{chunk-fvt9rjsa.js.map → chunk-38zv5rkr.js.map} +1 -1
  78. package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
  79. package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
  80. package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
  81. package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
  82. package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
  83. package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
  84. package/dist/chunk-3frsnm7x.js +32 -0
  85. package/dist/chunk-3frsnm7x.js.map +11 -0
  86. package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
  87. package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
  88. package/dist/{chunk-mwsxn98e.js → chunk-52hbv0ak.js} +170 -170
  89. package/dist/{chunk-mwsxn98e.js.map → chunk-52hbv0ak.js.map} +4 -4
  90. package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
  91. package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
  92. package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
  93. package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
  94. package/dist/chunk-653vwrzr.js +39 -0
  95. package/dist/chunk-653vwrzr.js.map +10 -0
  96. package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
  97. package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
  98. package/dist/chunk-7apz6hg4.js +50 -0
  99. package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
  100. package/dist/chunk-7bs40fe1.js +218 -0
  101. package/dist/{chunk-p1rzczbt.js.map → chunk-7bs40fe1.js.map} +3 -3
  102. package/dist/chunk-7zgecwy1.js +113 -0
  103. package/dist/chunk-7zgecwy1.js.map +10 -0
  104. package/dist/{chunk-pc7ys28c.js → chunk-860dwwy0.js} +29 -29
  105. package/dist/{chunk-pc7ys28c.js.map → chunk-860dwwy0.js.map} +2 -2
  106. package/dist/chunk-8vj0rjgs.js +165 -0
  107. package/dist/chunk-8vj0rjgs.js.map +15 -0
  108. package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
  109. package/dist/chunk-92vk7gta.js.map +10 -0
  110. package/dist/{chunk-rafagrwr.js → chunk-93csa55g.js} +45 -17
  111. package/dist/chunk-93csa55g.js.map +11 -0
  112. package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
  113. package/dist/chunk-98cw09sw.js.map +10 -0
  114. package/dist/{chunk-n4khvw9n.js → chunk-9qsh3p5y.js} +17 -17
  115. package/dist/{chunk-n4khvw9n.js.map → chunk-9qsh3p5y.js.map} +2 -2
  116. package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
  117. package/dist/{chunk-9nbmsvn5.js → chunk-9vx5e9g1.js} +9 -9
  118. package/dist/{chunk-9nbmsvn5.js.map → chunk-9vx5e9g1.js.map} +2 -2
  119. package/dist/{chunk-f26bck4t.js → chunk-an5tt9y0.js} +353 -353
  120. package/dist/{chunk-f26bck4t.js.map → chunk-an5tt9y0.js.map} +2 -2
  121. package/dist/{chunk-2dw777qw.js → chunk-ap0g1g74.js} +37 -82
  122. package/dist/{chunk-2dw777qw.js.map → chunk-ap0g1g74.js.map} +3 -4
  123. package/dist/{chunk-v4en4jc2.js → chunk-awbhdqyc.js} +7 -7
  124. package/dist/{chunk-v4en4jc2.js.map → chunk-awbhdqyc.js.map} +2 -2
  125. package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
  126. package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
  127. package/dist/{chunk-nx7k8tpr.js → chunk-br3k6qbf.js} +23 -23
  128. package/dist/{chunk-nx7k8tpr.js.map → chunk-br3k6qbf.js.map} +2 -2
  129. package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
  130. package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
  131. package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
  132. package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
  133. package/dist/chunk-d62kjtbg.js +7 -0
  134. package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
  135. package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
  136. package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
  137. package/dist/{chunk-5e3pq99w.js → chunk-dmn70ztd.js} +30 -30
  138. package/dist/chunk-dmn70ztd.js.map +11 -0
  139. package/dist/{chunk-p1x242ad.js → chunk-dz5h08xv.js} +175 -175
  140. package/dist/{chunk-p1x242ad.js.map → chunk-dz5h08xv.js.map} +2 -2
  141. package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
  142. package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
  143. package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
  144. package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
  145. package/dist/{chunk-wtf06et8.js → chunk-emyyk7dx.js} +55 -55
  146. package/dist/{chunk-wtf06et8.js.map → chunk-emyyk7dx.js.map} +2 -2
  147. package/dist/{chunk-19jp6g9d.js → chunk-f0rwz2vh.js} +54 -33
  148. package/dist/chunk-f0rwz2vh.js.map +11 -0
  149. package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
  150. package/dist/chunk-f4w3yp4f.js.map +12 -0
  151. package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
  152. package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
  153. package/dist/{chunk-4sm0aznx.js → chunk-g00bfdq6.js} +254 -256
  154. package/dist/{chunk-4sm0aznx.js.map → chunk-g00bfdq6.js.map} +3 -3
  155. package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
  156. package/dist/chunk-g53f0e4j.js.map +15 -0
  157. package/dist/chunk-g6cke204.js +124 -0
  158. package/dist/chunk-g6cke204.js.map +10 -0
  159. package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
  160. package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
  161. package/dist/chunk-h1gfhhbh.js +602 -0
  162. package/dist/chunk-h1gfhhbh.js.map +18 -0
  163. package/dist/chunk-h3v76ams.js +32 -0
  164. package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
  165. package/dist/{chunk-xajtptbw.js → chunk-hpr1r6av.js} +1367 -418
  166. package/dist/chunk-hpr1r6av.js.map +44 -0
  167. package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
  168. package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
  169. package/dist/{chunk-w9tg6yyb.js → chunk-jjy0fhrn.js} +36 -36
  170. package/dist/{chunk-w9tg6yyb.js.map → chunk-jjy0fhrn.js.map} +2 -2
  171. package/dist/{chunk-wdage1eb.js → chunk-jmfet9r4.js} +6 -6
  172. package/dist/{chunk-wdage1eb.js.map → chunk-jmfet9r4.js.map} +2 -2
  173. package/dist/{chunk-ajnan18g.js → chunk-k3cqkkn2.js} +58 -55
  174. package/dist/chunk-k3cqkkn2.js.map +12 -0
  175. package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
  176. package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
  177. package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
  178. package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
  179. package/dist/{chunk-3z1qec12.js → chunk-m3z3x9v0.js} +107 -64
  180. package/dist/{chunk-3z1qec12.js.map → chunk-m3z3x9v0.js.map} +3 -3
  181. package/dist/{chunk-sbzzr4kx.js → chunk-mjbk2djy.js} +1061 -1195
  182. package/dist/{chunk-sbzzr4kx.js.map → chunk-mjbk2djy.js.map} +9 -15
  183. package/dist/{chunk-4jjp5k14.js → chunk-mmagke4x.js} +6 -6
  184. package/dist/{chunk-4jjp5k14.js.map → chunk-mmagke4x.js.map} +2 -2
  185. package/dist/{chunk-359jm1jw.js → chunk-mrp7k0pw.js} +20 -20
  186. package/dist/{chunk-359jm1jw.js.map → chunk-mrp7k0pw.js.map} +2 -2
  187. package/dist/{chunk-h0k55pc7.js → chunk-ms2tmn1k.js} +139 -139
  188. package/dist/{chunk-h0k55pc7.js.map → chunk-ms2tmn1k.js.map} +2 -2
  189. package/dist/{chunk-rv2hkwwa.js → chunk-ppytyr6w.js} +156 -179
  190. package/dist/{chunk-rv2hkwwa.js.map → chunk-ppytyr6w.js.map} +3 -5
  191. package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
  192. package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
  193. package/dist/{chunk-nn0tekr1.js → chunk-pr2h4bv4.js} +33 -33
  194. package/dist/{chunk-nn0tekr1.js.map → chunk-pr2h4bv4.js.map} +2 -2
  195. package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
  196. package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
  197. package/dist/{chunk-5ntny1qx.js → chunk-qf954wje.js} +6 -6
  198. package/dist/{chunk-5ntny1qx.js.map → chunk-qf954wje.js.map} +2 -2
  199. package/dist/{chunk-mth82m8t.js → chunk-qhcpj9wc.js} +77 -77
  200. package/dist/{chunk-mth82m8t.js.map → chunk-qhcpj9wc.js.map} +2 -2
  201. package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
  202. package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
  203. package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
  204. package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
  205. package/dist/{chunk-3xep5cjx.js → chunk-r4tfx1sf.js} +104 -86
  206. package/dist/chunk-r4tfx1sf.js.map +15 -0
  207. package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
  208. package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
  209. package/dist/chunk-s3csryxe.js +152 -0
  210. package/dist/chunk-s3csryxe.js.map +11 -0
  211. package/dist/chunk-s670k14v.js +60 -0
  212. package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
  213. package/dist/chunk-skz0hst3.js +788 -0
  214. package/dist/chunk-skz0hst3.js.map +19 -0
  215. package/dist/{chunk-r8jrnexe.js → chunk-v4jbb3rs.js} +4 -4
  216. package/dist/{chunk-r8jrnexe.js.map → chunk-v4jbb3rs.js.map} +2 -2
  217. package/dist/{chunk-v1xppd0y.js → chunk-vf691g1r.js} +60 -60
  218. package/dist/{chunk-v1xppd0y.js.map → chunk-vf691g1r.js.map} +2 -2
  219. package/dist/{chunk-w1tvjszy.js → chunk-vsj3mdfj.js} +8 -8
  220. package/dist/{chunk-w1tvjszy.js.map → chunk-vsj3mdfj.js.map} +2 -2
  221. package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
  222. package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
  223. package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
  224. package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
  225. package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
  226. package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
  227. package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
  228. package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
  229. package/dist/{chunk-z4ccwbkz.js → chunk-x9v4cx1d.js} +1 -1
  230. package/dist/{chunk-gbejpkex.js → chunk-xfbydgzy.js} +26 -26
  231. package/dist/{chunk-gbejpkex.js.map → chunk-xfbydgzy.js.map} +2 -2
  232. package/dist/{chunk-gzasd5b6.js → chunk-xyr8kppc.js} +22 -22
  233. package/dist/{chunk-gzasd5b6.js.map → chunk-xyr8kppc.js.map} +2 -2
  234. package/dist/{chunk-h5vqbfmd.js → chunk-ypbtykv6.js} +117 -117
  235. package/dist/{chunk-h5vqbfmd.js.map → chunk-ypbtykv6.js.map} +3 -3
  236. package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
  237. package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
  238. package/dist/{chunk-yp8ee62z.js → chunk-z30bv4ga.js} +35 -35
  239. package/dist/{chunk-yp8ee62z.js.map → chunk-z30bv4ga.js.map} +2 -2
  240. package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
  241. package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
  242. package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
  243. package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
  244. package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
  245. package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
  246. package/dist/{chunk-4yqmp43v.js → chunk-z8fx5cgb.js} +12 -12
  247. package/dist/{chunk-4yqmp43v.js.map → chunk-z8fx5cgb.js.map} +2 -2
  248. package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
  249. package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
  250. package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
  251. package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
  252. package/dist/connectors/connections/internal.js +9 -10
  253. package/dist/connectors/connections/internal.js.map +1 -1
  254. package/dist/datasets/write.js +8 -12
  255. package/dist/datasets/write.js.map +1 -1
  256. package/dist/edits/index.js +7 -8
  257. package/dist/edits/index.js.map +1 -1
  258. package/dist/error-reporting/internal.js +22 -24
  259. package/dist/error-reporting/internal.js.map +1 -1
  260. package/dist/errors/internal.d.ts +1 -1
  261. package/dist/errors/internal.d.ts.map +1 -1
  262. package/dist/errors/internal.js +22 -24
  263. package/dist/errors/internal.js.map +1 -1
  264. package/dist/errors/redaction.d.ts +8 -0
  265. package/dist/errors/redaction.d.ts.map +1 -0
  266. package/dist/errors/types.d.ts +4 -0
  267. package/dist/errors/types.d.ts.map +1 -1
  268. package/dist/events/index.js +60 -63
  269. package/dist/events/index.js.map +1 -1
  270. package/dist/events/scope.js +4 -5
  271. package/dist/events/scope.js.map +1 -1
  272. package/dist/events/selectors/index.js +9 -10
  273. package/dist/events/selectors/index.js.map +1 -1
  274. package/dist/execution/agent.d.ts +3 -3
  275. package/dist/execution/agent.d.ts.map +1 -1
  276. package/dist/execution/agent.js +70 -82
  277. package/dist/execution/agent.js.map +1 -1
  278. package/dist/execution/durable.d.ts +1 -0
  279. package/dist/execution/durable.d.ts.map +1 -1
  280. package/dist/execution/primitive.d.ts +2 -0
  281. package/dist/execution/primitive.d.ts.map +1 -1
  282. package/dist/execution/primitive.js +63 -71
  283. package/dist/execution/primitive.js.map +3 -3
  284. package/dist/execution/request.d.ts +1 -0
  285. package/dist/execution/request.d.ts.map +1 -1
  286. package/dist/execution/request.js +65 -75
  287. package/dist/execution/request.js.map +3 -3
  288. package/dist/http/index.js +10 -11
  289. package/dist/http/index.js.map +1 -1
  290. package/dist/index.d.ts +14 -10
  291. package/dist/index.d.ts.map +1 -1
  292. package/dist/index.js +455 -477
  293. package/dist/index.js.map +1 -1
  294. package/dist/lake-storage/index.js +38 -42
  295. package/dist/lake-storage/index.js.map +1 -1
  296. package/dist/logging/index.d.ts +3 -4
  297. package/dist/logging/index.d.ts.map +1 -1
  298. package/dist/logging/index.js +18 -40
  299. package/dist/logging/index.js.map +1 -1
  300. package/dist/logging/internal.d.ts +5 -0
  301. package/dist/logging/internal.d.ts.map +1 -0
  302. package/dist/logging/internal.js +43 -0
  303. package/dist/logging/internal.js.map +9 -0
  304. package/dist/materialization/index.js +46 -49
  305. package/dist/materialization/index.js.map +1 -1
  306. package/dist/materializer/index.js +137 -145
  307. package/dist/materializer/index.js.map +1 -1
  308. package/dist/models/errors.d.ts +4 -0
  309. package/dist/models/errors.d.ts.map +1 -1
  310. package/dist/models/execution/binding.d.ts +9 -0
  311. package/dist/models/execution/binding.d.ts.map +1 -0
  312. package/dist/models/execution/errors.d.ts +9 -0
  313. package/dist/models/execution/errors.d.ts.map +1 -0
  314. package/dist/models/execution/index.d.ts +11 -0
  315. package/dist/models/execution/index.d.ts.map +1 -0
  316. package/dist/models/execution/index.js +55 -0
  317. package/dist/models/execution/index.js.map +9 -0
  318. package/dist/models/execution/model-call-accounting.d.ts +17 -0
  319. package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
  320. package/dist/models/execution/model-call-admission.d.ts +47 -0
  321. package/dist/models/execution/model-call-admission.d.ts.map +1 -0
  322. package/dist/models/execution/model-call-limits.d.ts +15 -0
  323. package/dist/models/execution/model-call-limits.d.ts.map +1 -0
  324. package/dist/models/execution/model-call-recorder.d.ts +40 -0
  325. package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
  326. package/dist/models/execution/model-call-recovery.d.ts +12 -0
  327. package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
  328. package/dist/models/execution/recovery-queue.d.ts +5 -0
  329. package/dist/models/execution/recovery-queue.d.ts.map +1 -0
  330. package/dist/models/execution/types.d.ts +44 -0
  331. package/dist/models/execution/types.d.ts.map +1 -0
  332. package/dist/models/execution/usage.d.ts +5 -0
  333. package/dist/models/execution/usage.d.ts.map +1 -0
  334. package/dist/models/execution.d.ts +6 -0
  335. package/dist/models/execution.d.ts.map +1 -0
  336. package/dist/models/generation-types.d.ts +40 -0
  337. package/dist/models/generation-types.d.ts.map +1 -0
  338. package/dist/models/index.d.ts +1 -0
  339. package/dist/models/index.d.ts.map +1 -1
  340. package/dist/models/index.js +42 -43
  341. package/dist/models/index.js.map +1 -1
  342. package/dist/models/language-model.d.ts +3 -0
  343. package/dist/models/language-model.d.ts.map +1 -1
  344. package/dist/models/output.d.ts +5 -0
  345. package/dist/models/output.d.ts.map +1 -0
  346. package/dist/models/resolve.d.ts +4 -0
  347. package/dist/models/resolve.d.ts.map +1 -0
  348. package/dist/objects/execution.d.ts.map +1 -1
  349. package/dist/objects/index.js +75 -87
  350. package/dist/objects/index.js.map +1 -1
  351. package/dist/objects/query/index.js +67 -76
  352. package/dist/objects/query/index.js.map +1 -1
  353. package/dist/ontology/index.d.ts +1 -2
  354. package/dist/ontology/index.d.ts.map +1 -1
  355. package/dist/ontology/index.js +62 -113
  356. package/dist/ontology/index.js.map +1 -1
  357. package/dist/ontology/internal.d.ts +7 -0
  358. package/dist/ontology/internal.d.ts.map +1 -1
  359. package/dist/ontology/internal.js +65 -116
  360. package/dist/ontology/internal.js.map +3 -4
  361. package/dist/pipelines/index.js +57 -66
  362. package/dist/pipelines/index.js.map +1 -1
  363. package/dist/projections/internal.js +58 -67
  364. package/dist/projections/internal.js.map +1 -1
  365. package/dist/query.d.ts +0 -1
  366. package/dist/query.d.ts.map +1 -1
  367. package/dist/query.js +11 -15
  368. package/dist/query.js.map +1 -1
  369. package/dist/queues/index.d.ts +2 -1
  370. package/dist/queues/index.d.ts.map +1 -1
  371. package/dist/queues/index.js +6 -7
  372. package/dist/queues/index.js.map +1 -1
  373. package/dist/queues/types.d.ts +3 -20
  374. package/dist/queues/types.d.ts.map +1 -1
  375. package/dist/rules/internal.js +4 -5
  376. package/dist/rules/internal.js.map +1 -1
  377. package/dist/runtime/create.d.ts +2 -1
  378. package/dist/runtime/create.d.ts.map +1 -1
  379. package/dist/runtime/host.d.ts +2 -1
  380. package/dist/runtime/host.d.ts.map +1 -1
  381. package/dist/runtime/internal.js +13 -14
  382. package/dist/runtime/internal.js.map +1 -1
  383. package/dist/runtime/sixb.d.ts +2 -0
  384. package/dist/runtime/sixb.d.ts.map +1 -1
  385. package/dist/sandboxes/errors.d.ts +4 -0
  386. package/dist/sandboxes/errors.d.ts.map +1 -1
  387. package/dist/sandboxes/index.d.ts +2 -2
  388. package/dist/sandboxes/index.d.ts.map +1 -1
  389. package/dist/sandboxes/index.js +14 -13
  390. package/dist/sandboxes/index.js.map +1 -1
  391. package/dist/sandboxes/sandbox.d.ts +35 -7
  392. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  393. package/dist/scheduler/index.js +9 -10
  394. package/dist/scheduler/index.js.map +1 -1
  395. package/dist/schedules/index.js +31 -33
  396. package/dist/schedules/index.js.map +1 -1
  397. package/dist/shares/internal.js +46 -54
  398. package/dist/shares/internal.js.map +2 -2
  399. package/dist/storage/action-runs/failure.js +7 -9
  400. package/dist/storage/action-runs/failure.js.map +1 -1
  401. package/dist/storage/action-runs/provider.js +4 -8
  402. package/dist/storage/action-runs/provider.js.map +1 -1
  403. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  404. package/dist/storage/agents/provider.js +26 -30
  405. package/dist/storage/agents/provider.js.map +1 -1
  406. package/dist/storage/agents/types.d.ts +0 -3
  407. package/dist/storage/agents/types.d.ts.map +1 -1
  408. package/dist/storage/ai-cost/attribution.d.ts +4 -0
  409. package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
  410. package/dist/storage/ai-cost/groups.d.ts +3 -0
  411. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  412. package/dist/storage/ai-cost/provider.d.ts +1 -0
  413. package/dist/storage/ai-cost/provider.d.ts.map +1 -1
  414. package/dist/storage/ai-cost/provider.js +30 -143
  415. package/dist/storage/ai-cost/provider.js.map +3 -4
  416. package/dist/storage/ai-cost/types.d.ts +15 -0
  417. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  418. package/dist/storage/ai-limits/enforcement.js +14 -16
  419. package/dist/storage/ai-limits/enforcement.js.map +1 -1
  420. package/dist/storage/ai-limits/provider.js +56 -57
  421. package/dist/storage/ai-limits/provider.js.map +1 -1
  422. package/dist/storage/auth/in-memory.d.ts +1 -1
  423. package/dist/storage/auth/in-memory.d.ts.map +1 -1
  424. package/dist/storage/connector-connections/provider.js +34 -36
  425. package/dist/storage/connector-connections/provider.js.map +2 -2
  426. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  427. package/dist/storage/executions/provider.d.ts +2 -1
  428. package/dist/storage/executions/provider.d.ts.map +1 -1
  429. package/dist/storage/executions/provider.js +14 -11
  430. package/dist/storage/executions/provider.js.map +3 -3
  431. package/dist/storage/executions/types.d.ts +6 -2
  432. package/dist/storage/executions/types.d.ts.map +1 -1
  433. package/dist/storage/executions/validation.d.ts +2 -0
  434. package/dist/storage/executions/validation.d.ts.map +1 -1
  435. package/dist/storage/in-memory/index.d.ts.map +1 -1
  436. package/dist/storage/index.d.ts +6 -7
  437. package/dist/storage/index.d.ts.map +1 -1
  438. package/dist/storage/index.js +221 -256
  439. package/dist/storage/index.js.map +1 -1
  440. package/dist/storage/internal.d.ts +10 -0
  441. package/dist/storage/internal.d.ts.map +1 -0
  442. package/dist/storage/internal.js +47 -0
  443. package/dist/storage/internal.js.map +9 -0
  444. package/dist/storage/ontology/provider.js +105 -109
  445. package/dist/storage/ontology/provider.js.map +1 -1
  446. package/dist/storage/operation-scope.js +18 -19
  447. package/dist/storage/operation-scope.js.map +1 -1
  448. package/dist/storage/pipeline-runs/provider.js +4 -6
  449. package/dist/storage/pipeline-runs/provider.js.map +1 -1
  450. package/dist/storage/projection-runs/provider.js +66 -70
  451. package/dist/storage/projection-runs/provider.js.map +1 -1
  452. package/dist/storage/share-grants/provider.js +17 -19
  453. package/dist/storage/share-grants/provider.js.map +1 -1
  454. package/dist/storage/share-sessions/provider.js +14 -15
  455. package/dist/storage/share-sessions/provider.js.map +1 -1
  456. package/dist/storage/sync-runs/provider.js +4 -6
  457. package/dist/storage/sync-runs/provider.js.map +1 -1
  458. package/dist/storage/webhook-runs/provider.js +4 -6
  459. package/dist/storage/webhook-runs/provider.js.map +1 -1
  460. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  461. package/dist/storage/workflow-runs/provider.js +13 -21
  462. package/dist/storage/workflow-runs/provider.js.map +1 -1
  463. package/dist/storage/workflow-runs/types.d.ts +0 -3
  464. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  465. package/dist/syncs/index.js +55 -65
  466. package/dist/syncs/index.js.map +1 -1
  467. package/dist/testing/action-execution.d.ts +4 -1
  468. package/dist/testing/action-execution.d.ts.map +1 -1
  469. package/dist/testing/agent-execution.d.ts +1 -0
  470. package/dist/testing/agent-execution.d.ts.map +1 -1
  471. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  472. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  473. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  474. package/dist/testing/execution.d.ts +1 -0
  475. package/dist/testing/execution.d.ts.map +1 -1
  476. package/dist/testing/index.js +911 -799
  477. package/dist/testing/index.js.map +9 -9
  478. package/dist/testing/workflow-execution.d.ts +1 -0
  479. package/dist/testing/workflow-execution.d.ts.map +1 -1
  480. package/dist/webhooks/internal.js +51 -59
  481. package/dist/webhooks/internal.js.map +2 -2
  482. package/dist/workers/index.js +11 -13
  483. package/dist/workers/index.js.map +2 -2
  484. package/dist/workflows/failure.d.ts +2 -0
  485. package/dist/workflows/failure.d.ts.map +1 -1
  486. package/dist/workflows/index.js +135 -147
  487. package/dist/workflows/index.js.map +1 -1
  488. package/dist/workflows/request.d.ts.map +1 -1
  489. package/dist/workflows/run-dispatch.d.ts +0 -1
  490. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  491. package/dist/workflows/types.d.ts +2 -0
  492. package/dist/workflows/types.d.ts.map +1 -1
  493. package/package.json +48 -30
  494. package/src/actions/run-dispatch.ts +2 -6
  495. package/src/actions/types/context.ts +2 -0
  496. package/src/actions/validation.ts +2 -1
  497. package/src/agents/adapters.ts +4 -9
  498. package/src/agents/{context.ts → context/entries.ts} +4 -4
  499. package/src/agents/context/index.ts +15 -0
  500. package/src/agents/context-model.ts +1 -1
  501. package/src/agents/context-resolution.ts +1 -1
  502. package/src/agents/index.ts +4 -4
  503. package/src/agents/message.ts +1 -1
  504. package/src/agents/model-loop.ts +8 -0
  505. package/src/agents/request.ts +11 -26
  506. package/src/agents/streams/index.ts +18 -0
  507. package/src/agents/streams/internal.ts +19 -0
  508. package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
  509. package/src/agents/types.ts +1 -1
  510. package/src/agents/validation.ts +3 -7
  511. package/src/auth/index.ts +0 -1
  512. package/src/bootstrap/discovery.ts +81 -24
  513. package/src/bootstrap/index.ts +8 -1
  514. package/src/errors/internal.ts +90 -10
  515. package/src/errors/redaction.ts +98 -0
  516. package/src/errors/types.ts +4 -0
  517. package/src/execution/agent.ts +5 -3
  518. package/src/execution/durable.ts +11 -1
  519. package/src/execution/primitive.ts +5 -1
  520. package/src/execution/request.ts +3 -0
  521. package/src/index.ts +20 -18
  522. package/src/logging/index.ts +2 -33
  523. package/src/logging/internal.ts +43 -0
  524. package/src/models/errors.ts +12 -0
  525. package/src/models/execution/binding.ts +29 -0
  526. package/src/models/execution/errors.ts +18 -0
  527. package/src/models/execution/index.ts +26 -0
  528. package/src/models/execution/model-call-accounting.ts +211 -0
  529. package/src/models/execution/model-call-admission.ts +127 -0
  530. package/src/models/execution/model-call-limits.ts +135 -0
  531. package/src/models/execution/model-call-recorder.ts +235 -0
  532. package/src/models/execution/model-call-recovery.ts +125 -0
  533. package/src/models/execution/recovery-queue.ts +31 -0
  534. package/src/models/execution/types.ts +58 -0
  535. package/src/models/execution/usage.ts +23 -0
  536. package/src/models/execution.ts +207 -0
  537. package/src/models/generation-types.ts +50 -0
  538. package/src/models/index.ts +8 -0
  539. package/src/models/language-model.ts +3 -0
  540. package/src/models/output.ts +45 -0
  541. package/src/models/resolve.ts +27 -0
  542. package/src/objects/execution.ts +1 -1
  543. package/src/ontology/index.ts +1 -2
  544. package/src/ontology/internal.ts +35 -0
  545. package/src/projections/run-dispatch.ts +1 -0
  546. package/src/query.ts +0 -1
  547. package/src/queues/index.ts +4 -2
  548. package/src/queues/types.ts +6 -25
  549. package/src/runtime/create.ts +2 -1
  550. package/src/runtime/host.ts +2 -1
  551. package/src/runtime/sixb.ts +4 -0
  552. package/src/sandboxes/errors.ts +5 -0
  553. package/src/sandboxes/index.ts +3 -0
  554. package/src/sandboxes/sandbox.ts +35 -7
  555. package/src/storage/agents/in-memory.ts +0 -3
  556. package/src/storage/agents/types.ts +0 -3
  557. package/src/storage/ai-cost/analytics.ts +1 -1
  558. package/src/storage/ai-cost/attribution.ts +15 -0
  559. package/src/storage/ai-cost/groups.ts +5 -1
  560. package/src/storage/ai-cost/provider.ts +1 -0
  561. package/src/storage/ai-cost/types.ts +7 -0
  562. package/src/storage/auth/in-memory.ts +1 -1
  563. package/src/storage/executions/in-memory.ts +4 -9
  564. package/src/storage/executions/provider.ts +4 -0
  565. package/src/storage/executions/types.ts +6 -2
  566. package/src/storage/executions/validation.ts +32 -0
  567. package/src/storage/in-memory/index.ts +16 -1
  568. package/src/storage/index.ts +3 -29
  569. package/src/storage/internal.ts +20 -0
  570. package/src/storage/workflow-runs/in-memory.ts +0 -2
  571. package/src/storage/workflow-runs/types.ts +0 -3
  572. package/src/testing/action-execution.ts +9 -2
  573. package/src/testing/agent-execution.ts +3 -0
  574. package/src/testing/agent-storage-contract.ts +0 -5
  575. package/src/testing/ai-model-call-groups-contract.ts +74 -2
  576. package/src/testing/execution-storage-contract.ts +59 -1
  577. package/src/testing/execution.ts +6 -0
  578. package/src/testing/workflow-execution.ts +4 -0
  579. package/src/workflows/failure.ts +62 -1
  580. package/src/workflows/request.ts +0 -9
  581. package/src/workflows/run-dispatch.ts +0 -3
  582. package/src/workflows/types.ts +2 -0
  583. package/src/workflows/validation.ts +1 -1
  584. package/dist/agents/context.d.ts.map +0 -1
  585. package/dist/agents/context.js +0 -23
  586. package/dist/agents/streams.d.ts.map +0 -1
  587. package/dist/agents/streams.js +0 -55
  588. package/dist/chunk-08m3b6w8.js +0 -32
  589. package/dist/chunk-19jp6g9d.js.map +0 -11
  590. package/dist/chunk-2xns679x.js.map +0 -11
  591. package/dist/chunk-3xep5cjx.js.map +0 -15
  592. package/dist/chunk-407j3msh.js +0 -60
  593. package/dist/chunk-4qfkag59.js +0 -1568
  594. package/dist/chunk-4qfkag59.js.map +0 -20
  595. package/dist/chunk-5e3pq99w.js.map +0 -11
  596. package/dist/chunk-7y0f6rf1.js.map +0 -10
  597. package/dist/chunk-ajnan18g.js.map +0 -12
  598. package/dist/chunk-c15dr03f.js +0 -43
  599. package/dist/chunk-d8qkxt2v.js.map +0 -10
  600. package/dist/chunk-jq43kdvk.js +0 -50
  601. package/dist/chunk-k522z7v6.js.map +0 -10
  602. package/dist/chunk-p03r0h5s.js.map +0 -16
  603. package/dist/chunk-p1rzczbt.js +0 -218
  604. package/dist/chunk-rafagrwr.js.map +0 -11
  605. package/dist/chunk-xajtptbw.js.map +0 -40
  606. package/dist/chunk-y64skrwp.js +0 -19
  607. package/dist/chunk-zcnhxkvd.js +0 -7
  608. package/dist/logging/types.js +0 -27
  609. package/dist/logging/types.js.map +0 -9
  610. /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
  611. /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
  612. /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
  613. /package/dist/{chunk-j1sbhm7p.js → chunk-ey1nk510.js} +0 -0
  614. /package/dist/{chunk-j1sbhm7p.js.map → chunk-ey1nk510.js.map} +0 -0
  615. /package/dist/{chunk-z4ccwbkz.js.map → chunk-x9v4cx1d.js.map} +0 -0
@@ -1,10 +1,18 @@
1
1
  import { createSixbError, isSixbError, summarizeErrorMessage } from "../errors/internal"
2
+ import type { ReadonlyJsonObject } from "../json"
3
+ import {
4
+ ModelProviderError,
5
+ StructuredOutputError,
6
+ UnsupportedModelFeatureError,
7
+ } from "../models/errors"
2
8
 
3
9
  interface WorkflowNodeFailureIdentityBase {
4
10
  readonly workflowId: string
5
11
  readonly workflowRunId: string
6
12
  readonly nodeId: string
7
13
  readonly nodeRunId?: string
14
+ readonly failurePhase?: "output-preflight" | "agent-loop" | "structured-finalizer"
15
+ readonly modelId?: string
8
16
  }
9
17
 
10
18
  export interface WorkflowNodeFailureIdentity extends WorkflowNodeFailureIdentityBase {
@@ -26,11 +34,62 @@ export function createWorkflowNodeFailure(error: unknown, identity: WorkflowNode
26
34
  summarizeErrorMessage(error, "Workflow node execution failed."),
27
35
  {
28
36
  cause: error,
29
- details: workflowNodeFailureDetails(identity),
37
+ details: {
38
+ ...workflowNodeFailureDetails(identity),
39
+ ...safeModelFailureDetails(error),
40
+ },
30
41
  }
31
42
  )
32
43
  }
33
44
 
45
+ /** Only controlled diagnostics cross the durable boundary; provider messages/output stay private. */
46
+ function safeModelFailureDetails(error: unknown): ReadonlyJsonObject {
47
+ if (error instanceof UnsupportedModelFeatureError) {
48
+ const reason = error.reason ?? "unsupported-feature"
49
+ const messages = {
50
+ "unsupported-feature":
51
+ "The adapter cannot support a requested model feature. Check provider configuration.",
52
+ "unsupported-model":
53
+ "The model is configured without structured-output support. Choose a supported model.",
54
+ "unsupported-schema":
55
+ "The output schema is incompatible with the adapter. Use valid JSON Schema types, require every property, and disallow additional properties.",
56
+ }
57
+ return { modelFailure: { source: "adapter", reason, message: messages[reason] } }
58
+ }
59
+ if (error instanceof ModelProviderError) {
60
+ // Interpret only known machine codes, never provider prose (which can echo private inputs).
61
+ const schemaRejected = error.code === "invalid_json_schema" || error.code === "invalid_schema"
62
+ const modelRejected = error.code === "model_not_supported" || error.code === "unsupported_model"
63
+ return {
64
+ modelFailure: {
65
+ source: "provider",
66
+ reason: schemaRejected
67
+ ? "unsupported-schema"
68
+ : modelRejected
69
+ ? "unsupported-model"
70
+ : "provider-rejection",
71
+ message: schemaRejected
72
+ ? "The model endpoint rejected the supplied schema. Check the routed provider's supported JSON Schema subset."
73
+ : modelRejected
74
+ ? "The model endpoint does not support the requested model configuration. Choose a supported model or route."
75
+ : "The model endpoint rejected the request or failed its response. Check provider diagnostics for model, schema, authentication, or availability errors.",
76
+ ...(error.status === undefined ? {} : { status: error.status }),
77
+ },
78
+ }
79
+ }
80
+ if (error instanceof StructuredOutputError) {
81
+ return {
82
+ modelFailure: {
83
+ source: "validation",
84
+ reason: "invalid-output",
85
+ message:
86
+ "The model response did not complete with valid output matching the workflow schema.",
87
+ },
88
+ }
89
+ }
90
+ return {}
91
+ }
92
+
34
93
  /** Recover the native child error for direct callers and error-monitoring integrations. */
35
94
  export function unwrapWorkflowNodeFailure(error: unknown): unknown {
36
95
  return isSixbError(error) && error.code === "workflow.node_failed" && error.cause !== undefined
@@ -44,6 +103,8 @@ function workflowNodeFailureDetails(identity: WorkflowNodeFailureIdentity) {
44
103
  workflowRunId: identity.workflowRunId,
45
104
  nodeId: identity.nodeId,
46
105
  ...(identity.nodeRunId ? { nodeRunId: identity.nodeRunId } : {}),
106
+ ...(identity.failurePhase ? { failurePhase: identity.failurePhase } : {}),
107
+ ...(identity.modelId ? { modelId: identity.modelId } : {}),
47
108
  }
48
109
 
49
110
  switch (identity.child.type) {
@@ -1,4 +1,3 @@
1
- import { snapshotRequesterGroupIds } from "../auth/attribution"
2
1
  import { assertAuthorized } from "../authorization"
3
2
  import { resolveExecutionScopeAuthorization } from "../execution/authorization"
4
3
  import {
@@ -50,13 +49,6 @@ export async function requestWorkflowRun(
50
49
  authorization: runtime.runtimeAuthorization,
51
50
  })
52
51
  assertAuthorized(runtime, { kind: "workflow.run", workflowId: workflow.id })
53
- const requesterGroupIds = execution.requestedBy
54
- ? await snapshotRequesterGroupIds({
55
- auth: runtime.storage.auth,
56
- projectId: runtime.projectId,
57
- principal: execution.requestedBy,
58
- })
59
- : []
60
52
  return dispatchWorkflowRun({
61
53
  errorReporterHost: runtime,
62
54
  projectId: runtime.projectId,
@@ -68,7 +60,6 @@ export async function requestWorkflowRun(
68
60
  runId: options.runId,
69
61
  input: options.input,
70
62
  source: options.source,
71
- requesterGroupIds,
72
63
  createExecution: async (executionId, runId) => {
73
64
  const caller = await ensureExecutionRecord(
74
65
  runtime.storage.executions,
@@ -55,7 +55,6 @@ interface DispatchWorkflowRunInput {
55
55
  readonly runId?: string
56
56
  readonly input?: Readonly<Record<string, unknown>>
57
57
  readonly source?: WorkflowRunSource
58
- readonly requesterGroupIds: readonly string[]
59
58
  readonly metadata?: Readonly<Record<string, string>>
60
59
  readonly queueJobId?: string
61
60
  readonly createExecution: (executionId: string, runId: string) => Promise<CreateExecutionInput>
@@ -105,7 +104,6 @@ export class WorkflowRunDispatcher implements WorkflowRunDispatchPort {
105
104
  eventId: input.source.eventId,
106
105
  principal: SYSTEM_PRINCIPAL,
107
106
  },
108
- requesterGroupIds: [],
109
107
  metadata: input.metadata,
110
108
  queueJobId: input.runId,
111
109
  createExecution: async (executionId, runId) =>
@@ -192,7 +190,6 @@ async function persistWorkflowRun(
192
190
  workflowId: input.workflow.id,
193
191
  input: request.snapshot,
194
192
  queuedAt,
195
- requesterGroupIds: input.requesterGroupIds,
196
193
  })
197
194
  return { run, execution, queuedAt, created: true }
198
195
  },
@@ -15,6 +15,7 @@ import type { EventsRuntime } from "../events/execution"
15
15
  import type { JsonValue } from "../json"
16
16
  import type { Logger } from "../logging"
17
17
  import type { LogsRuntime } from "../logging/execution"
18
+ import type { ModelsRuntime } from "../models/generation-types"
18
19
  import type { LanguageModel } from "../models/language-model"
19
20
  import type { ObjectsRuntime } from "../objects/execution"
20
21
  import type { InferSchemaOrRef, ObjectRef, OntologySource, SchemaOrRef } from "../ontology"
@@ -60,6 +61,7 @@ export interface StepRunContext<TInput extends Record<string, unknown>> {
60
61
  * It is a type-level cycle break, not a separate runtime or compatibility surface.
61
62
  */
62
63
  export interface WorkflowRuntimeFacade {
64
+ readonly models: ModelsRuntime
63
65
  readonly objects: ObjectsRuntime<readonly OntologySource[]>
64
66
  readonly actions: ActionsRuntime
65
67
  readonly agent: AgentRuntime
@@ -3,7 +3,7 @@ import type { AgentToolCatalog } from "../agents"
3
3
  import type { ModelCatalog } from "../models"
4
4
  import { isModelReasoning } from "../models/language-model"
5
5
  import type { SchemaOrRef, ValueType } from "../ontology"
6
- import { validateSchemaOrRefValue } from "../ontology"
6
+ import { validateSchemaOrRefValue } from "../ontology/refs"
7
7
  import type { ScheduleDefinition } from "../schedules"
8
8
  import type { SecurityDefinitionCatalog } from "../security"
9
9
  import { WorkflowDefinitionError, WorkflowValidationError } from "./errors"
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/agents/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGjD,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,C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KAAK,EAAE,SAAS,sBAAsB,EAAE,GAAG,SAAS,GACnD,SAAS,sBAAsB,EAAE,CA0CnC"}
@@ -1,23 +0,0 @@
1
- // @bun
2
- import {
3
- MAX_AGENT_APP_STATE_ENTRY_BYTES,
4
- MAX_AGENT_APP_STATE_TOTAL_BYTES,
5
- MAX_AGENT_CONTEXT_ENTRIES,
6
- agentContext,
7
- agentContextFingerprint,
8
- agentContextIdentity,
9
- normalizeAgentContextEntries
10
- } from "../chunk-5e3pq99w.js";
11
- import"../chunk-n6jxh8sw.js";
12
- import"../chunk-y64skrwp.js";
13
- export {
14
- normalizeAgentContextEntries,
15
- agentContextIdentity,
16
- agentContextFingerprint,
17
- agentContext,
18
- MAX_AGENT_CONTEXT_ENTRIES,
19
- MAX_AGENT_APP_STATE_TOTAL_BYTES,
20
- MAX_AGENT_APP_STATE_ENTRY_BYTES
21
- };
22
-
23
- //# debugId=E92147A2E6E34B4264756E2164756E21
@@ -1 +0,0 @@
1
- {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/agents/streams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAA;AAEhC,eAAO,MAAM,+BAA+B,EAAG,CAAU,CAAA;AACzD,eAAO,MAAM,kCAAkC;;;CAGrC,CAAA;AAEV,eAAO,MAAM,oCAAoC,EAAG,CAAU,CAAA;AAC9D,eAAO,MAAM,wBAAwB,EAAG,iBAA0B,CAAA;AAClE,eAAO,MAAM,uCAAuC;;;CAG1C,CAAA;AAEV,MAAM,WAAW,qBAAqB;IACpC,QA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AAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC,CAAA;AAQhG,6FAA6F;AAC7F,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,cAAc,EACnB,UAAU,GAAE,IAAiB,GAC5B,qBAAqB,CAavB;AAED,qFAAqF;AACrF,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EACnB,UAAU,GAAE,IAAiB,GAC5B,uBAAuB,CAWzB;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAuDlF;AA4BD,mFAAmF;AACnF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAiB/E;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhG"}
@@ -1,55 +0,0 @@
1
- // @bun
2
- import {
3
- AGENT_ACTIVITY_STREAM_ID,
4
- AGENT_ACTIVITY_STREAM_SCHEMA_VERSION,
5
- AGENT_COMPACTION_FAILURE_CODES,
6
- AGENT_RUN_CANCEL_RECORD,
7
- AGENT_RUN_STREAM_SCHEMA_VERSION,
8
- DEFAULT_AGENT_ACTIVITY_STREAM_RETENTION,
9
- DEFAULT_AGENT_RUN_STREAM_RETENTION,
10
- agentActivityStreamDefinition,
11
- agentRunActivityEvent,
12
- agentRunControlStreamDefinition,
13
- agentRunControlStreamId,
14
- agentRunFinishedEvent,
15
- agentRunStreamDefinition,
16
- agentRunStreamEventBase,
17
- agentRunStreamId,
18
- agentRunStreamIdempotencyKey,
19
- isAgentRunActivityEvent,
20
- isAgentRunStreamEvent,
21
- publishAgentRunActivity,
22
- publishAgentRunCancel,
23
- publishAgentRunFinished,
24
- subscribeAgentRunCancel
25
- } from "../chunk-7y0f6rf1.js";
26
- import"../chunk-d8qkxt2v.js";
27
- import"../chunk-2xns679x.js";
28
- import"../chunk-n6jxh8sw.js";
29
- import"../chunk-y64skrwp.js";
30
- export {
31
- subscribeAgentRunCancel,
32
- publishAgentRunFinished,
33
- publishAgentRunCancel,
34
- publishAgentRunActivity,
35
- isAgentRunStreamEvent,
36
- isAgentRunActivityEvent,
37
- agentRunStreamIdempotencyKey,
38
- agentRunStreamId,
39
- agentRunStreamEventBase,
40
- agentRunStreamDefinition,
41
- agentRunFinishedEvent,
42
- agentRunControlStreamId,
43
- agentRunControlStreamDefinition,
44
- agentRunActivityEvent,
45
- agentActivityStreamDefinition,
46
- DEFAULT_AGENT_RUN_STREAM_RETENTION,
47
- DEFAULT_AGENT_ACTIVITY_STREAM_RETENTION,
48
- AGENT_RUN_STREAM_SCHEMA_VERSION,
49
- AGENT_RUN_CANCEL_RECORD,
50
- AGENT_COMPACTION_FAILURE_CODES,
51
- AGENT_ACTIVITY_STREAM_SCHEMA_VERSION,
52
- AGENT_ACTIVITY_STREAM_ID
53
- };
54
-
55
- //# debugId=023A2403FDCC318264756E2164756E21
@@ -1,32 +0,0 @@
1
- // @bun
2
- import {
3
- isPlainRecord
4
- } from "./chunk-n6jxh8sw.js";
5
-
6
- // src/blob-storage/derive.ts
7
- function blobDigestHex(digest) {
8
- return digest.slice("sha256:".length);
9
- }
10
- function blobIdFromDigest(digest) {
11
- return `blob_${blobDigestHex(digest)}`;
12
- }
13
-
14
- // src/blob-storage/validation.ts
15
- function isBlobDigest(value) {
16
- return typeof value === "string" && value.startsWith("sha256:") && value.length > "sha256:".length;
17
- }
18
- function isFileRef(value) {
19
- return isPlainRecord(value) && typeof value.blobId === "string" && value.blobId.trim().length > 0 && isBlobDigest(value.digest) && value.blobId === blobIdFromDigest(value.digest) && typeof value.sizeBytes === "number" && Number.isInteger(value.sizeBytes) && value.sizeBytes >= 0 && (value.fileName === undefined || typeof value.fileName === "string") && (value.mediaType === undefined || typeof value.mediaType === "string") && (value.logicalPath === undefined || typeof value.logicalPath === "string");
20
- }
21
- function supportsDirectUpload(storage) {
22
- const candidate = storage;
23
- return typeof candidate.createUpload === "function" && typeof candidate.signUploadPart === "function" && typeof candidate.completeUpload === "function" && typeof candidate.abortUpload === "function";
24
- }
25
- function supportsRangeRead(storage) {
26
- const candidate = storage;
27
- return typeof candidate.openRange === "function";
28
- }
29
-
30
- export { blobDigestHex, blobIdFromDigest, isBlobDigest, isFileRef, supportsDirectUpload, supportsRangeRead };
31
-
32
- //# debugId=CBADD015FD5B0A0D64756E2164756E21
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/ontology/link-path-selection.ts", "../src/ontology/tokens.ts"],
4
- "sourcesContent": [
5
- "import type { LinkToken } from \"./tokens\"\n\ndeclare const linkPathSelectionBrand: unique symbol\n\ntype LinkTargetObjectTypeId<TTarget> = TTarget extends readonly string[]\n ? TTarget[number]\n : TTarget extends \"*\"\n ? string\n : TTarget extends string\n ? TTarget\n : never\n\nexport type LinkPathSelectionMode =\n | { readonly kind: \"none\" }\n | { readonly kind: \"all\" }\n | {\n readonly kind: \"selected\"\n readonly links: readonly LinkPathSelection[]\n }\n\n/**\n * Inert nested selection produced by `ObjectType.l.someLink.withLinks(...)`.\n *\n * It stores ids only. Consumers such as Share definitions resolve those ids against their own\n * current ontology registry instead of trusting the token's embedded metadata.\n */\nexport type LinkPathSelection<\n TSourceObjectTypeId extends string = string,\n TLinkId extends string = string,\n TTargetObjectTypeId extends string | readonly string[] = string | readonly string[],\n> = {\n readonly [linkPathSelectionBrand]?: never\n readonly kind: \"linkPathSelection\"\n readonly sourceObjectTypeId: TSourceObjectTypeId\n readonly linkId: TLinkId\n readonly targetObjectTypeId: TTargetObjectTypeId\n readonly selection: LinkPathSelectionMode\n}\n\nexport type LinkPathSelectionInput<TSourceObjectTypeId extends string = string> =\n | LinkToken<TSourceObjectTypeId>\n | LinkPathSelection<TSourceObjectTypeId>\n\nexport interface LinkPathSelectionBuilder<\n TSourceObjectTypeId extends string,\n TLinkId extends string,\n TTargetObjectTypeId extends string | readonly string[],\n> {\n withLinks(): LinkPathSelection<TSourceObjectTypeId, TLinkId, TTargetObjectTypeId>\n withLinks<\n const TLinks extends readonly LinkPathSelectionInput<\n LinkTargetObjectTypeId<TTargetObjectTypeId>\n >[],\n >(links: TLinks): LinkPathSelection<TSourceObjectTypeId, TLinkId, TTargetObjectTypeId>\n}\n\n/** @internal Snapshot a token/path into the portable ids-only representation. */\nexport function snapshotLinkPathSelection(input: LinkPathSelectionInput): LinkPathSelection {\n return snapshotLinkPathSelectionValue(input, new Set())\n}\n\nfunction snapshotLinkPathSelectionValue(input: unknown, visiting: Set<object>): LinkPathSelection {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) {\n throw new Error(\"[Sixb] Link path selection must be a link token or nested link selection.\")\n }\n if (visiting.has(input)) {\n throw new Error(\"[Sixb] Link path selection must not contain a cycle.\")\n }\n visiting.add(input)\n try {\n if (isLinkPathSelection(input)) {\n return createLinkPathSelectionFromIds(\n {\n sourceObjectTypeId: input.sourceObjectTypeId,\n linkId: input.linkId,\n targetObjectTypeId: input.targetObjectTypeId,\n selection: input.selection,\n },\n visiting\n )\n }\n\n return createLinkPathSelectionFromIds(\n {\n sourceObjectTypeId: (input as { readonly objectTypeId?: unknown }).objectTypeId,\n linkId: (input as { readonly id?: unknown }).id,\n targetObjectTypeId: (input as { readonly targetObjectTypeId?: unknown }).targetObjectTypeId,\n selection: { kind: \"none\" },\n },\n visiting\n )\n } finally {\n visiting.delete(input)\n }\n}\n\n/** @internal */\nfunction isLinkPathSelection(value: unknown): value is LinkPathSelection {\n return (\n typeof value === \"object\" &&\n value !== null &&\n (value as { readonly kind?: unknown }).kind === \"linkPathSelection\"\n )\n}\n\nexport function createLinkPathSelection(\n token: LinkToken,\n links: readonly LinkPathSelectionInput[] | undefined\n): LinkPathSelection {\n if (links !== undefined && !Array.isArray(links)) {\n throw new Error(`[Sixb] Link '${token.objectTypeId}.${token.id}' withLinks expects an array.`)\n }\n if (links?.length === 0) {\n throw new Error(\n `[Sixb] Link '${token.objectTypeId}.${token.id}' withLinks([]) is empty; omit withLinks() when no nested links should be selected.`\n )\n }\n\n return createLinkPathSelectionFromIds({\n sourceObjectTypeId: token.objectTypeId,\n linkId: token.id,\n targetObjectTypeId: token.targetObjectTypeId,\n selection:\n links === undefined\n ? { kind: \"all\" }\n : { kind: \"selected\", links: links.map(snapshotLinkPathSelection) },\n })\n}\n\nfunction createLinkPathSelectionFromIds(\n input: {\n readonly sourceObjectTypeId: unknown\n readonly linkId: unknown\n readonly targetObjectTypeId: unknown\n readonly selection: unknown\n },\n visiting: Set<object> = new Set()\n): LinkPathSelection {\n const sourceObjectTypeId = nonEmptyLinkSelectionId(\n input.sourceObjectTypeId,\n \"source object type id\"\n )\n const linkId = nonEmptyLinkSelectionId(input.linkId, \"link id\")\n const targetObjectTypeId = snapshotLinkTarget(input.targetObjectTypeId)\n const selection = snapshotLinkSelectionMode(input.selection, visiting)\n return Object.freeze({\n kind: \"linkPathSelection\" as const,\n sourceObjectTypeId,\n linkId,\n targetObjectTypeId,\n selection,\n })\n}\n\nfunction snapshotLinkSelectionMode(value: unknown, visiting: Set<object>): LinkPathSelectionMode {\n if (typeof value !== \"object\" || value === null) {\n throw new Error(\"[Sixb] Link path selection must declare nested links.\")\n }\n const kind = (value as { readonly kind?: unknown }).kind\n if (kind === \"none\" || kind === \"all\") return Object.freeze({ kind })\n if (kind !== \"selected\") {\n throw new Error(`[Sixb] Unknown nested link selection '${String(kind)}'.`)\n }\n const links = (value as { readonly links?: unknown }).links\n if (!Array.isArray(links)) {\n throw new Error(\"[Sixb] Selected nested links must be an array.\")\n }\n if (links.length === 0) {\n throw new Error(\n \"[Sixb] Selected nested links must not be empty; omit withLinks() when no nested links should be selected.\"\n )\n }\n return Object.freeze({\n kind: \"selected\" as const,\n links: Object.freeze(links.map((link) => snapshotLinkPathSelectionValue(link, visiting))),\n })\n}\n\nfunction snapshotLinkTarget(value: unknown): string | readonly string[] {\n if (Array.isArray(value)) {\n return Object.freeze(\n value.map((item) => nonEmptyLinkSelectionId(item, \"target object type id\"))\n )\n }\n return nonEmptyLinkSelectionId(value, \"target object type id\")\n}\n\nfunction nonEmptyLinkSelectionId(value: unknown, field: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw new Error(`[Sixb] Link path ${field} must not be empty.`)\n }\n return value\n}\n",
6
- "import {\n createLinkPathSelection,\n type LinkPathSelectionBuilder,\n type LinkPathSelectionInput,\n} from \"./link-path-selection\"\nimport 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} & LinkPathSelectionBuilder<TObjectTypeId, TLinkId, TTargetObjectTypeId>\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 = {\n objectTypeId: objectType.id,\n id: link.id,\n targetObjectTypeId: link.targetObjectTypeId,\n link,\n } as LinkToken<TObjectType[\"id\"], typeof link.id, typeof link.targetObjectTypeId, typeof link>\n Object.defineProperty(token, \"withLinks\", {\n configurable: false,\n enumerable: false,\n writable: false,\n value: (...args: [links?: readonly LinkPathSelectionInput[]]) =>\n createLinkPathSelection(token, args.length === 0 ? undefined : args[0]),\n })\n return [link.id, token] as const\n })\n\n return Object.fromEntries(tokenEntries) as LinkTokenMap<TObjectType>\n}\n"
7
- ],
8
- "mappings": ";;AAyDO,SAAS,yBAAyB,CAAC,OAAkD;AAAA,EAC1F,OAAO,+BAA+B,OAAO,IAAI,GAAK;AAAA;AAGxD,SAAS,8BAA8B,CAAC,OAAgB,UAA0C;AAAA,EAChG,IAAI,OAAO,UAAU,YAAY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ACZ,MAAM,IAAI,CAAC,SAAS,wBAAwB,MAAM,uBAAuB,CAAC,CAC5E;AAAA,EACF;AAAA,EACA,OAAO,wBAAwB,OAAO,uBAAuB;AAAA;AAG/D,SAAS,uBAAuB,CAAC,OAAgB,OAAuB;AAAA,EACtE,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,GAAG;AAAA,IAC9C,MAAM,IAAI,MAAM,oBAAoB,0BAA0B;AAAA,EAChE;AAAA,EACA,OAAO;AAAA;;;AC/GF,SAAS,sBAAsD,CACpE,YAC+B;AAAA,EAC/B,MAAM,eAAe,WAAW,WAAW,IAAI,CAAC,aAAa;AAAA,IAC3D,MAAM,QAA+E;AAAA,MACnF,cAAc,WAAW;AAAA,MACzB,IAAI,SAAS;AAAA,MACb;AAAA,IACF;AAAA,IACA,OAAO,CAAC,SAAS,IAAI,KAAK;AAAA,GAC3B;AAAA,EAED,OAAO,OAAO,YAAY,YAAY;AAAA;AAMjC,SAAS,kBAAkD,CAChE,YAC2B;AAAA,EAC3B,MAAM,eAAe,WAAW,MAAM,IAAI,CAAC,SAAS;AAAA,IAClD,MAAM,QAAQ;AAAA,MACZ,cAAc,WAAW;AAAA,MACzB,IAAI,KAAK;AAAA,MACT,oBAAoB,KAAK;AAAA,MACzB;AAAA,IACF;AAAA,IACA,OAAO,eAAe,OAAO,aAAa;AAAA,MACxC,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,OAAO,IAAI,SACT,wBAAwB,OAAO,KAAK,WAAW,IAAI,YAAY,KAAK,EAAE;AAAA,IAC1E,CAAC;AAAA,IACD,OAAO,CAAC,KAAK,IAAI,KAAK;AAAA,GACvB;AAAA,EAED,OAAO,OAAO,YAAY,YAAY;AAAA;",
9
- "debugId": "68FDB5E36E5E9DB764756E2164756E21",
10
- "names": []
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/errors/catalog.ts", "../src/errors/internal.ts"],
4
- "sourcesContent": [
5
- "interface SixbErrorDefinition {\n readonly publicMessage: string\n readonly retryable: boolean\n}\n\n/**\n * Source of truth for stable Sixb error codes and their framework-level policy.\n *\n * Keep this catalog internal. Consumers receive the `SixbErrorCode` union and persisted\n * `SixbFailure` values, not a mutable registry.\n */\nexport const SIXB_ERROR_DEFINITIONS = {\n \"action.phase_failed\": {\n publicMessage: \"Action execution failed.\",\n retryable: false,\n },\n \"agent.execution_failed\": {\n publicMessage: \"Agent execution failed.\",\n retryable: false,\n },\n \"ai.usage_limit_exceeded\": {\n publicMessage: \"AI usage limit exceeded.\",\n retryable: false,\n },\n \"ai.usage_limit_unavailable\": {\n publicMessage: \"AI usage limit could not be evaluated.\",\n retryable: true,\n },\n \"connector.adapter_invalid\": {\n publicMessage: \"Connector adapter returned an invalid result.\",\n retryable: false,\n },\n \"connector.authorization_invalid\": {\n publicMessage: \"Connector authorization is invalid.\",\n retryable: false,\n },\n \"connector.authorization_required\": {\n publicMessage: \"Connector authorization is required.\",\n retryable: false,\n },\n \"connector.configuration_invalid\": {\n publicMessage: \"Connector configuration is invalid.\",\n retryable: false,\n },\n \"connector.credentials_unavailable\": {\n publicMessage: \"Connector credentials are unavailable.\",\n retryable: false,\n },\n \"connector.not_found\": {\n publicMessage: \"Connector resource not found.\",\n retryable: false,\n },\n \"connector.operation_conflict\": {\n publicMessage: \"Connector operation conflicts with the current state.\",\n retryable: false,\n },\n \"connector.operation_in_progress\": {\n publicMessage: \"Another connector credential operation is in progress.\",\n retryable: true,\n },\n \"connector.provider_failed\": {\n publicMessage: \"Connector provider operation failed.\",\n retryable: false,\n },\n \"connector.provider_unavailable\": {\n publicMessage: \"Connector provider is temporarily unavailable.\",\n retryable: true,\n },\n \"connector.replacement_required\": {\n publicMessage: \"Connector selection requires explicit replacement.\",\n retryable: false,\n },\n \"connector.revocation_pending\": {\n publicMessage: \"Connector revocation is pending.\",\n retryable: true,\n },\n \"dataset.not_found\": {\n publicMessage: \"Dataset not found.\",\n retryable: false,\n },\n \"dataset.version_incompatible\": {\n publicMessage: \"Dataset version is incompatible.\",\n retryable: false,\n },\n \"dataset.version_not_found\": {\n publicMessage: \"Dataset version not found.\",\n retryable: false,\n },\n \"dataset.version_read_inconsistent\": {\n publicMessage: \"Dataset version could not be read consistently.\",\n retryable: true,\n },\n \"event.delivery_failed\": {\n publicMessage: \"Event delivery failed.\",\n retryable: true,\n },\n \"internal.unexpected\": {\n publicMessage: \"An unexpected internal error occurred.\",\n retryable: false,\n },\n \"queue.enqueue_failed\": {\n publicMessage: \"The job could not be enqueued.\",\n retryable: true,\n },\n \"pipeline.step_failed\": {\n publicMessage: \"Pipeline step execution failed.\",\n retryable: false,\n },\n \"projection.definition_invalid\": {\n publicMessage: \"Projection definition is invalid.\",\n retryable: false,\n },\n \"projection.execution_failed\": {\n publicMessage: \"Projection execution failed.\",\n retryable: false,\n },\n \"projection.not_found\": {\n publicMessage: \"Projection not found.\",\n retryable: false,\n },\n \"projection.run_already_terminal\": {\n publicMessage: \"Projection run is already terminal.\",\n retryable: false,\n },\n \"projection.run_identity_mismatch\": {\n publicMessage: \"Projection run identity does not match the queued job.\",\n retryable: false,\n },\n \"runtime.cancelled\": {\n publicMessage: \"Execution was cancelled.\",\n retryable: false,\n },\n \"sync.execution_failed\": {\n publicMessage: \"Sync execution failed.\",\n retryable: false,\n },\n \"webhook.delivery_failed\": {\n publicMessage: \"Webhook delivery failed.\",\n retryable: true,\n },\n \"webhook.delivery_rejected\": {\n publicMessage: \"Webhook delivery was rejected.\",\n retryable: false,\n },\n \"workflow.node_failed\": {\n publicMessage: \"Workflow node execution failed.\",\n retryable: false,\n },\n} as const satisfies Readonly<Record<string, SixbErrorDefinition>>\n\ntype CatalogErrorCode = keyof typeof SIXB_ERROR_DEFINITIONS\n\n/** Runtime counterpart of `SixbErrorCode` for internal schema boundaries. */\nexport const SIXB_ERROR_CODES = Object.freeze(Object.keys(SIXB_ERROR_DEFINITIONS)) as readonly [\n CatalogErrorCode,\n ...CatalogErrorCode[],\n]\n",
6
- "import { cloneJsonValue, isJsonValue, isPlainRecord, type ReadonlyJsonValue } from \"../json\"\nimport { SIXB_ERROR_CODES, SIXB_ERROR_DEFINITIONS } from \"./catalog\"\nimport type { SixbErrorCode, SixbFailure } from \"./types\"\n\nexport const SIXB_FAILURE_MAX_MESSAGE_BYTES = 4 * 1024\nexport const SIXB_FAILURE_MAX_SERIALIZED_BYTES = 32 * 1024\nconst TRUNCATION_SUFFIX = \"… [truncated]\"\nconst SIXB_ERROR_CODE_SET: ReadonlySet<string> = new Set(SIXB_ERROR_CODES)\n\ntype SixbErrorCodeTuple = readonly [SixbErrorCode, ...SixbErrorCode[]]\n\nexport { SIXB_ERROR_CODES }\n\nexport interface SixbErrorOptions {\n readonly cause?: unknown\n readonly details?: ReadonlyJsonValue\n}\n\n/** Internal structural view returned by the factory. The implementing class stays private. */\nexport interface SixbCodedError extends Error {\n readonly code: SixbErrorCode\n readonly retryable: boolean\n readonly details?: ReadonlyJsonValue\n readonly cause?: unknown\n}\n\nexport interface ToSixbFailureOptions {\n /** Timestamp for deterministic persistence. Defaults to the current time. */\n readonly at?: Date\n}\n\nexport interface ToScopedSixbFailureOptions<TCodes extends SixbErrorCodeTuple>\n extends ToSixbFailureOptions {\n /** Codes this boundary is allowed to expose. */\n readonly allowedCodes: TCodes\n}\n\nexport interface CaptureSixbFailureOptions<TCodes extends SixbErrorCodeTuple>\n extends ToScopedSixbFailureOptions<TCodes> {\n /** Code assigned when the captured value is uncoded or outside this boundary's contract. */\n readonly defaultCode: TCodes[number]\n /** Context attached only to the boundary error created for such a captured value. */\n readonly details?: ReadonlyJsonValue\n}\n\n/**\n * The canonical exception used inside Sixb.\n *\n * The class is deliberately not exported: repo-internal callers use the factory and consumers only\n * ever observe serializable `SixbFailure` values.\n */\nclass SixbError extends Error implements SixbCodedError {\n override readonly name = \"SixbError\"\n readonly retryable: boolean\n readonly details?: ReadonlyJsonValue\n\n constructor(\n readonly code: SixbErrorCode,\n message: string,\n options: SixbErrorOptions = {}\n ) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause })\n this.retryable = SIXB_ERROR_DEFINITIONS[code].retryable\n if (options.details !== undefined) {\n this.details = cloneJsonValue(options.details, \"Sixb error details\")\n }\n }\n}\n\n/** Creates a coded internal error without exposing its runtime class. */\nexport function createSixbError(\n code: SixbErrorCode,\n message: string,\n options: SixbErrorOptions = {}\n): SixbCodedError {\n return new SixbError(code, message, options)\n}\n\n/**\n * Captures an unknown terminal error as a scoped durable failure.\n *\n * An already-coded error is preserved only when its code belongs to this boundary. Every other\n * value is wrapped once with the boundary's default code and context before serialization.\n */\nexport function captureSixbFailure<const TCodes extends SixbErrorCodeTuple>(\n error: unknown,\n options: CaptureSixbFailureOptions<TCodes>\n): SixbFailure<TCodes[number]> {\n const allowedCodes = new Set<SixbErrorCode>(options.allowedCodes)\n const codedError =\n isSixbError(error) && allowedCodes.has(error.code)\n ? error\n : createSixbError(options.defaultCode, summarizeErrorMessage(error), {\n cause: error,\n ...(options.details === undefined ? {} : { details: options.details }),\n })\n\n return toSixbFailure(codedError, {\n allowedCodes: options.allowedCodes,\n ...(options.at === undefined ? {} : { at: options.at }),\n })\n}\n\n/** Identifies errors created by Sixb without making their class part of the contract. */\nexport function isSixbError(error: unknown): error is SixbCodedError {\n return error instanceof SixbError\n}\n\n/**\n * Takes a detached, serializable snapshot of a coded internal error.\n *\n * Use `captureSixbFailure()` instead when a terminal boundary receives an unknown thrown value.\n */\nexport function toSixbFailure<const TCodes extends SixbErrorCodeTuple>(\n error: SixbCodedError,\n options: ToScopedSixbFailureOptions<TCodes>\n): SixbFailure<TCodes[number]>\nexport function toSixbFailure(error: SixbCodedError, options?: ToSixbFailureOptions): SixbFailure\nexport function toSixbFailure(\n error: SixbCodedError,\n options: ToSixbFailureOptions | ToScopedSixbFailureOptions<SixbErrorCodeTuple> = {}\n): SixbFailure {\n if (!isSixbError(error)) {\n throw new Error(\"[Sixb] A durable failure can only be created from a coded Sixb error.\")\n }\n const allowedCodes = \"allowedCodes\" in options ? new Set(options.allowedCodes) : undefined\n if (allowedCodes && !allowedCodes.has(error.code)) {\n throw new Error(`[Sixb] Error code '${error.code}' is not allowed by this failure contract.`)\n }\n const code = error.code\n const details = error.details\n const message = truncateUtf8(\n SIXB_ERROR_DEFINITIONS[code].publicMessage,\n SIXB_FAILURE_MAX_MESSAGE_BYTES\n )\n const failure: SixbFailure = {\n code,\n message: message.value,\n retryable: SIXB_ERROR_DEFINITIONS[code].retryable,\n at: failureTimestamp(options.at),\n ...(details === undefined ? {} : { details: cloneJsonValue(details, \"Sixb failure details\") }),\n ...(message.truncated ? { truncated: true } : {}),\n }\n\n if (serializedByteLength(failure) <= SIXB_FAILURE_MAX_SERIALIZED_BYTES) return failure\n\n return {\n code: failure.code,\n message: failure.message,\n retryable: failure.retryable,\n at: failure.at,\n truncated: true,\n }\n}\n\n/** Serializes a validated failure for durable storage. */\nexport function serializeSixbFailure<const TCodes extends SixbErrorCodeTuple>(\n failure: SixbFailure<TCodes[number]>,\n allowedCodes: TCodes\n): string\nexport function serializeSixbFailure(failure: SixbFailure): string\nexport function serializeSixbFailure(\n failure: SixbFailure,\n allowedCodes?: SixbErrorCodeTuple\n): string {\n const parsed = allowedCodes ? parseSixbFailure(failure, allowedCodes) : parseSixbFailure(failure)\n return JSON.stringify(parsed)\n}\n\n/**\n * Validates and detaches a failure read from a storage boundary.\n *\n * Strings are accepted for SQLite; PostgreSQL adapters can pass their decoded JSON value directly.\n */\nexport function parseSixbFailure<const TCodes extends SixbErrorCodeTuple>(\n value: unknown,\n allowedCodes: TCodes\n): SixbFailure<TCodes[number]>\nexport function parseSixbFailure(value: unknown): SixbFailure\nexport function parseSixbFailure(\n value: unknown,\n allowedCodes: SixbErrorCodeTuple = SIXB_ERROR_CODES\n): SixbFailure {\n const candidate = parseStoredFailureValue(value)\n if (!isPlainRecord(candidate)) {\n throw invalidStoredFailure(\"expected a JSON object\")\n }\n\n const { code, message, retryable, at, details, truncated } = candidate\n if (typeof code !== \"string\" || !SIXB_ERROR_CODE_SET.has(code)) {\n throw invalidStoredFailure(\"code is not a known Sixb error code\")\n }\n if (!(allowedCodes as readonly string[]).includes(code)) {\n throw invalidStoredFailure(\"code is not allowed by this failure contract\")\n }\n if (typeof message !== \"string\") {\n throw invalidStoredFailure(\"message is not a string\")\n }\n if (utf8ByteLength(message) > SIXB_FAILURE_MAX_MESSAGE_BYTES) {\n throw invalidStoredFailure(`message exceeds ${SIXB_FAILURE_MAX_MESSAGE_BYTES} UTF-8 bytes`)\n }\n if (typeof retryable !== \"boolean\") {\n throw invalidStoredFailure(\"retryable is not a boolean\")\n }\n if (retryable !== SIXB_ERROR_DEFINITIONS[code as SixbErrorCode].retryable) {\n throw invalidStoredFailure(\"retryable does not match the error code policy\")\n }\n if (typeof at !== \"string\" || !isCanonicalIsoTimestamp(at)) {\n throw invalidStoredFailure(\"at is not a canonical ISO-8601 timestamp\")\n }\n if (details !== undefined && !isJsonValue(details)) {\n throw invalidStoredFailure(\"details is not a JSON value\")\n }\n if (truncated !== undefined && truncated !== true) {\n throw invalidStoredFailure(\"truncated must be true when present\")\n }\n\n const failure: SixbFailure = {\n code: code as SixbErrorCode,\n message,\n retryable,\n at,\n ...(details === undefined\n ? {}\n : { details: cloneJsonValue(details, \"Stored Sixb failure details\") }),\n ...(truncated === true ? { truncated: true } : {}),\n }\n if (serializedByteLength(failure) > SIXB_FAILURE_MAX_SERIALIZED_BYTES) {\n throw invalidStoredFailure(\n `record exceeds ${SIXB_FAILURE_MAX_SERIALIZED_BYTES} serialized UTF-8 bytes`\n )\n }\n return failure\n}\n\nfunction parseStoredFailureValue(value: unknown): unknown {\n if (typeof value !== \"string\") return value\n try {\n return JSON.parse(value) as unknown\n } catch {\n throw invalidStoredFailure(\"value is not valid JSON\")\n }\n}\n\nfunction isCanonicalIsoTimestamp(value: string): boolean {\n const timestamp = new Date(value)\n return Number.isFinite(timestamp.getTime()) && timestamp.toISOString() === value\n}\n\nfunction invalidStoredFailure(reason: string): Error {\n return new Error(`[Sixb] Stored failure is invalid: ${reason}.`)\n}\n\n/**\n * Extracts a diagnostic message for an internal error or log entry.\n *\n * The result can contain provider data and must not be persisted or returned by an API.\n * `toSixbFailure()` selects the catalog-owned public message instead.\n */\nexport function summarizeErrorMessage(value: unknown, fallback?: string): string {\n const message = readStringProperty(value, \"message\")\n if (message !== undefined) return message\n if (typeof value === \"string\") return value\n return fallback ?? safeString(value)\n}\n\nfunction readStringProperty(value: unknown, property: \"message\"): string | undefined {\n if (!isObjectLike(value)) return undefined\n try {\n const result = Reflect.get(value, property)\n return typeof result === \"string\" ? result : undefined\n } catch {\n return undefined\n }\n}\n\nfunction isObjectLike(value: unknown): value is object {\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\"\n}\n\nfunction safeString(value: unknown): string {\n try {\n return String(value)\n } catch {\n return \"Unknown thrown value\"\n }\n}\n\nfunction failureTimestamp(at: Date | undefined): string {\n const timestamp = at ?? new Date()\n if (!Number.isFinite(timestamp.getTime())) {\n throw new Error(\"[Sixb] Failure timestamp must be a valid Date.\")\n }\n return timestamp.toISOString()\n}\n\nfunction serializedByteLength(value: SixbFailure): number {\n return utf8ByteLength(JSON.stringify(value))\n}\n\nfunction utf8ByteLength(value: string): number {\n return new TextEncoder().encode(value).byteLength\n}\n\nfunction truncateUtf8(value: string, maxBytes: number): { value: string; truncated: boolean } {\n if (utf8ByteLength(value) <= maxBytes) return { value, truncated: false }\n\n const suffixBytes = utf8ByteLength(TRUNCATION_SUFFIX)\n const characters = Array.from(value)\n let low = 0\n let high = characters.length\n while (low < high) {\n const middle = Math.ceil((low + high) / 2)\n if (utf8ByteLength(characters.slice(0, middle).join(\"\")) + suffixBytes <= maxBytes) {\n low = middle\n } else {\n high = middle - 1\n }\n }\n\n return { value: `${characters.slice(0, low).join(\"\")}${TRUNCATION_SUFFIX}`, truncated: true }\n}\n"
7
- ],
8
- "mappings": ";;;;;;;;AAWO,IAAM,yBAAyB;AAAA,EACpC,uBAAu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AAuB;AAAA,EAC7C,OAAO,IAAI,YAAY,EAAE,OAAO,KAAK,EAAE;AAAA;AAGzC,SAAS,YAAY,CAAC,OAAe,UAAyD;AAAA,EAC5F,IAAI,eAAe,KAAK,KAAK;AAAA,IAAU,OAAO,EAAE,OAAO,WAAW,MAAM;AAAA,EAExE,MAAM,cAAc,eAAe,iBAAiB;AAAA,EACpD,MAAM,aAAa,MAAM,KAAK,KAAK;AAAA,EACnC,IAAI,MAAM;AAAA,EACV,IAAI,OAAO,WAAW;AAAA,EACtB,OAAO,MAAM,MAAM;AAAA,IACjB,MAAM,SAAS,KAAK,MAAM,MAAM,QAAQ,CAAC;AAAA,IACzC,IAAI,eAAe,WAAW,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,eAAe,UAAU;AAAA,MAClF,MAAM;AAAA,IACR,EAAO;AAAA,MACL,OAAO,SAAS;AAAA;AAAA,EAEpB;AAAA,EAEA,OAAO,EAAE,OAAO,GAAG,WAAW,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,IAAI,qBAAqB,WAAW,KAAK;AAAA;",
9
- "debugId": "28898042FA6A84E464756E2164756E21",
10
- "names": []
11
- }
@@ -1,15 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/bootstrap/discovery.ts", "../src/rules/errors.ts", "../src/rules/validation.ts", "../src/rules/builders.ts", "../src/shares/validation.ts", "../src/bootstrap/ontology-type-manifest.ts"],
4
- "sourcesContent": [
5
- "/**\n * Filesystem auto-discovery for convention-based module loading.\n *\n * Scans well-known definition directories (`ontology/`, `actions/`, etc.)\n * relative to a project root and returns typed definition arrays ready\n * for the `Sixb` constructor.\n */\n\nimport { readdir } from \"node:fs/promises\"\nimport { join, relative } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport { isActionDefinition } from \"../actions\"\nimport { isConnectorDefinition } from \"../connectors\"\nimport { isDatasetDefinition } from \"../datasets\"\nimport type { OntologyDocumentInput, OntologySource } from \"../ontology/registry\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { ValueType } from \"../ontology/types\"\nimport { isPipelineDefinition } from \"../pipelines\"\nimport { isProjectionDefinition } from \"../projections/builders\"\nimport { isRuleDefinition } from \"../rules\"\nimport { RuntimeError } from \"../runtime/errors\"\nimport { isScheduleDefinition } from \"../schedules\"\nimport { isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition } from \"../security\"\nimport { isShareDefinition } from \"../shares\"\nimport { isSyncDefinition } from \"../syncs\"\nimport { isWorkflowDefinition } from \"../workflows\"\n\nconst moduleExtensions = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"])\n\nexport async function discoverOntologySources(\n projectRoot: string\n): Promise<readonly OntologySource[]> {\n const ontologyDir = join(projectRoot, \"ontology\")\n const modulePaths = await listModuleFiles(ontologyDir)\n const exportedCandidates = await loadModuleExports({\n modulePaths,\n projectRoot,\n kind: \"ontology\",\n })\n\n const ontologyDocuments: OntologyDocumentInput[] = []\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n\n for (const candidate of exportedCandidates) {\n if (isOntologyDocumentInput(candidate)) {\n ontologyDocuments.push(candidate)\n continue\n }\n\n if (isObjectTypeWithPropertyTokens(candidate)) {\n objectTypes.push(candidate)\n continue\n }\n\n if (isValueType(candidate)) {\n valueTypes.push(candidate)\n }\n }\n\n const discoveredSources: OntologySource[] = [...ontologyDocuments, ...objectTypes]\n if (valueTypes.length > 0) {\n discoveredSources.push({\n id: \"__sixb.discovered.value-types__\",\n version: \"0.0.0\",\n objectTypes: [],\n valueTypes,\n })\n }\n\n return discoveredSources\n}\n\ntype DiscoveryModuleKind =\n | \"action\"\n | \"connector\"\n | \"dataset\"\n | \"group\"\n | \"membershipPolicy\"\n | \"ontology\"\n | \"pipeline\"\n | \"projection\"\n | \"role\"\n | \"rule\"\n | \"schedule\"\n | \"share\"\n | \"sync\"\n | \"workflow\"\n\ninterface DefinitionDiscoveryFamily<TDefinition> {\n readonly directory: readonly string[]\n readonly kind: Exclude<DiscoveryModuleKind, \"ontology\">\n readonly isDefinition: (value: unknown) => value is TDefinition\n}\n\nconst definitionDiscoveryRegistry = {\n actions: { directory: [\"actions\"], kind: \"action\", isDefinition: isActionDefinition },\n projections: {\n directory: [\"projections\"],\n kind: \"projection\",\n isDefinition: isProjectionDefinition,\n },\n schedules: {\n directory: [\"schedules\"],\n kind: \"schedule\",\n isDefinition: isScheduleDefinition,\n },\n syncs: { directory: [\"syncs\"], kind: \"sync\", isDefinition: isSyncDefinition },\n connectors: {\n directory: [\"connectors\"],\n kind: \"connector\",\n isDefinition: isConnectorDefinition,\n },\n pipelines: {\n directory: [\"pipelines\"],\n kind: \"pipeline\",\n isDefinition: isPipelineDefinition,\n },\n datasets: { directory: [\"datasets\"], kind: \"dataset\", isDefinition: isDatasetDefinition },\n rules: { directory: [\"rules\"], kind: \"rule\", isDefinition: isRuleDefinition },\n workflows: {\n directory: [\"workflows\"],\n kind: \"workflow\",\n isDefinition: isWorkflowDefinition,\n },\n groups: {\n directory: [\"security\", \"groups\"],\n kind: \"group\",\n isDefinition: isGroupDefinition,\n },\n roles: {\n directory: [\"security\", \"roles\"],\n kind: \"role\",\n isDefinition: isRoleDefinition,\n },\n membershipPolicies: {\n directory: [\"security\", \"policies\"],\n kind: \"membershipPolicy\",\n isDefinition: isMembershipPolicyDefinition,\n },\n shares: { directory: [\"shares\"], kind: \"share\", isDefinition: isShareDefinition },\n} as const satisfies Record<string, DefinitionDiscoveryFamily<unknown>>\n\ntype DefinitionFromFamily<TFamily> =\n TFamily extends DefinitionDiscoveryFamily<infer TDefinition> ? TDefinition : never\n\nexport type DiscoveredProjectDefinitions = {\n readonly [TKey in keyof typeof definitionDiscoveryRegistry]: readonly DefinitionFromFamily<\n (typeof definitionDiscoveryRegistry)[TKey]\n >[]\n}\n\nexport async function discoverProjectDefinitions(\n projectRoot: string\n): Promise<DiscoveredProjectDefinitions> {\n const entries = await Promise.all(\n Object.entries(definitionDiscoveryRegistry).map(async ([key, family]) => {\n const definitions = await discoverDefinitionFamily(projectRoot, family)\n return [key, definitions] as const\n })\n )\n\n // Object.fromEntries erases literal keys. Every entry above comes from the exact registry and its\n // definitions have passed that entry's type guard, so restoring the mapped result type is safe.\n return Object.fromEntries(entries) as DiscoveredProjectDefinitions\n}\n\nasync function discoverDefinitionFamily(\n projectRoot: string,\n family: DefinitionDiscoveryFamily<unknown>\n): Promise<readonly unknown[]> {\n const modulePaths = await listModuleFiles(join(projectRoot, ...family.directory))\n const exportedCandidates = await loadModuleExports({\n modulePaths,\n projectRoot,\n kind: family.kind,\n })\n\n return exportedCandidates.filter(family.isDefinition)\n}\n\n// ── Internal helpers ────────────────────────────────────────\n\nasync function loadModuleExports(options: {\n modulePaths: readonly string[]\n projectRoot: string\n kind: DiscoveryModuleKind\n}): Promise<unknown[]> {\n const exportedCandidates: unknown[] = []\n const seen = new Set<unknown>()\n\n for (const modulePath of options.modulePaths) {\n let moduleNamespace: Record<string, unknown>\n try {\n moduleNamespace = (await import(pathToFileURL(modulePath).href)) as Record<string, unknown>\n } catch (error) {\n const relPath = relative(options.projectRoot, modulePath)\n const reason = error instanceof Error ? error.message : String(error)\n throw new RuntimeError(`Failed to load ${options.kind} module '${relPath}': ${reason}`)\n }\n\n for (const exportedValue of Object.values(moduleNamespace)) {\n collectExportedCandidates(exportedValue, exportedCandidates, seen)\n }\n }\n\n return exportedCandidates\n}\n\nfunction collectExportedCandidates(value: unknown, target: unknown[], seen: Set<unknown>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n collectExportedCandidates(item, target, seen)\n }\n return\n }\n\n if (value === undefined) {\n return\n }\n\n if ((typeof value === \"object\" && value !== null) || typeof value === \"function\") {\n if (seen.has(value)) {\n return\n }\n seen.add(value)\n }\n\n target.push(value)\n}\n\nasync function listModuleFiles(dir: string): Promise<string[]> {\n let entries: import(\"node:fs\").Dirent[]\n try {\n entries = (await readdir(dir, { withFileTypes: true })) as import(\"node:fs\").Dirent[]\n } catch (error) {\n if (isNotFoundError(error)) {\n return []\n }\n throw error\n }\n\n const files: string[] = []\n const sortedEntries = [...entries].sort((a, b) => a.name.localeCompare(b.name))\n\n for (const entry of sortedEntries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n files.push(...(await listModuleFiles(fullPath)))\n continue\n }\n\n if (!entry.isFile()) {\n continue\n }\n\n if (!hasSupportedModuleExtension(entry.name)) {\n continue\n }\n\n files.push(fullPath)\n }\n\n return files\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false\n }\n\n const code = (error as NodeJS.ErrnoException).code\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n\nfunction hasSupportedModuleExtension(fileName: string): boolean {\n const normalized = fileName.toLowerCase()\n for (const extension of moduleExtensions) {\n if (normalized.endsWith(extension)) {\n return true\n }\n }\n return false\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction isOntologyDocumentInput(value: unknown): value is OntologyDocumentInput {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.version === \"string\" &&\n Array.isArray(value.objectTypes)\n )\n}\n\nfunction isObjectTypeWithPropertyTokens(value: unknown): value is ObjectTypeWithPropertyTokens {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n Array.isArray(value.properties) &&\n Array.isArray(value.links) &&\n isRecord(value.p)\n )\n}\n\nfunction isValueType(value: unknown): value is ValueType {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.name === \"string\" &&\n \"schema\" in value &&\n !Array.isArray(value.properties) &&\n !Array.isArray(value.objectTypes)\n )\n}\n",
6
- "/**\n * Base error for the rules module. `RuleValidationError` covers invalid rule\n * definitions both at builder time and during runtime startup validation.\n */\nexport class RuleError extends Error {\n readonly name: string = \"RuleError\"\n}\n\nexport class RuleValidationError extends RuleError {\n override readonly name = \"RuleValidationError\"\n}\n",
7
- "import type { OntologyRegistry } from \"../ontology/registry\"\nimport type { ObjectType } from \"../ontology/types\"\nimport { assertPredicateShape } from \"../predicates\"\nimport { RuleValidationError } from \"./errors\"\nimport type { RuleDefinition, RulePredicate } from \"./types\"\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction assertNonEmptyString(\n value: unknown,\n field: string,\n createError: (message: string) => Error\n): asserts value is string {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw createError(`${field} must not be empty.`)\n }\n}\n\n/**\n * Validate only the portable AST shape.\n *\n * This is used by discovery/type guards and by the builder after `.where(...)`.\n * Ontology-aware checks live in `validateRulesAtStartup`, once the full\n * registry has inherited properties and links resolved.\n */\nexport function assertRulePredicateShape(\n value: unknown,\n createError: (message: string) => Error = (message) => new RuleValidationError(message)\n): asserts value is RulePredicate {\n assertPredicateShape(value, { subject: \"Rule\", createError })\n}\n\n/** Validate the serializable rule envelope without consulting ontology state. */\nexport function assertRuleDefinition(\n value: unknown,\n createError: (message: string) => Error = (message) => new RuleValidationError(message)\n): asserts value is RuleDefinition {\n if (!isRecord(value)) {\n throw createError(\"Rule definition must be an object.\")\n }\n\n if (value.kind !== \"rule\") {\n throw createError(\"Rule definition kind must be 'rule'.\")\n }\n\n assertNonEmptyString(value.id, \"Rule id\", createError)\n\n if (!isRecord(value.subject) || value.subject.kind !== \"object\") {\n throw createError(`Rule '${value.id}' subject must be an object subject.`)\n }\n\n assertNonEmptyString(\n value.subject.objectTypeId,\n `Rule '${value.id}' subject objectTypeId`,\n createError\n )\n assertRulePredicateShape(value.predicate, createError)\n}\n\nexport function isRuleDefinition(value: unknown): value is RuleDefinition {\n try {\n assertRuleDefinition(value, (message) => new Error(message))\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Validate rules after the ontology registry is built.\n *\n * Startup is where we can reject references that cannot be known from the\n * serialized rule alone: duplicate ids, unknown subject types, unknown\n * properties/links, and empty logical groups.\n */\nexport function validateRulesAtStartup(\n rules: readonly RuleDefinition[],\n ontology: OntologyRegistry\n): void {\n const seenRuleIds = new Set<string>()\n\n for (const rule of rules) {\n assertRuleDefinition(rule)\n\n if (seenRuleIds.has(rule.id)) {\n throw new RuleValidationError(`Duplicate rule id: ${rule.id}`)\n }\n seenRuleIds.add(rule.id)\n\n const objectType = ontology.getObjectTypeById(rule.subject.objectTypeId)\n if (!objectType) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown object type \"${rule.subject.objectTypeId}\".`\n )\n }\n\n validatePredicateAgainstSubject(rule, objectType, rule.predicate)\n }\n}\n\n/** Walk every predicate node and check subject-scoped references. */\nfunction validatePredicateAgainstSubject(\n rule: RuleDefinition,\n objectType: ObjectType,\n predicate: RulePredicate\n): void {\n if (predicate.kind === \"all\" || predicate.kind === \"any\") {\n if (predicate.predicates.length === 0) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": ${predicate.kind} predicate must contain at least one predicate.`\n )\n }\n\n for (const child of predicate.predicates) {\n validatePredicateAgainstSubject(rule, objectType, child)\n }\n return\n }\n\n if (predicate.kind === \"not\") {\n validatePredicateAgainstSubject(rule, objectType, predicate.predicate)\n return\n }\n\n if (predicate.kind === \"property\") {\n const propertyIds = new Set(objectType.properties.map((property) => property.id))\n if (!propertyIds.has(predicate.propertyId)) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown property \"${predicate.propertyId}\" on object type \"${objectType.id}\".`\n )\n }\n return\n }\n\n if (predicate.kind === \"field\") {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": field predicates are not supported in rule conditions.`\n )\n }\n\n const linkIds = new Set(objectType.links.map((link) => link.id))\n if (!linkIds.has(predicate.linkId)) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown link \"${predicate.linkId}\" on object type \"${objectType.id}\".`\n )\n }\n}\n",
8
- "import {\n allPredicates,\n anyPredicates,\n createLinkPredicateBuilder as createSharedLinkPredicateBuilder,\n createPropertyPredicateBuilder as createSharedPropertyPredicateBuilder,\n notPredicate,\n type RuntimePropertyPredicateBuilder,\n} from \"../predicates\"\nimport { RuleValidationError } from \"./errors\"\nimport type {\n RuleBuilder,\n RuleDefinition,\n RuleLinkPredicateBuilder,\n RuleObjectType,\n RulePredicate,\n RulePropertyPredicate,\n} from \"./types\"\nimport { assertRulePredicateShape } from \"./validation\"\n\n/**\n * Runtime builders stay deliberately concrete.\n *\n * The public overload below provides typed property/link keys to callers, while\n * this internal shape keeps the implementation simple and avoids asking\n * TypeScript to instantiate the full ontology mapped type while checking this\n * file.\n */\ntype RuntimeRulePropertyPredicateBuilder = RuntimePropertyPredicateBuilder<RulePropertyPredicate>\n\ntype RuntimeRuleSubjectBuilder = {\n p: Record<string, RuntimeRulePropertyPredicateBuilder>\n l: Record<string, RuleLinkPredicateBuilder>\n all(...predicates: RulePredicate[]): RulePredicate\n any(...predicates: RulePredicate[]): RulePredicate\n not(predicate: RulePredicate): RulePredicate\n}\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new RuleValidationError(`Rule ${field} must not be empty.`)\n }\n}\n\n/** Build the `tx.p.<propertyId>` API for one ontology property. */\nfunction createPropertyPredicateBuilder(propertyId: string): RuntimeRulePropertyPredicateBuilder {\n return createSharedPropertyPredicateBuilder(propertyId, {\n subject: \"Rule\",\n createError: (message) => new RuleValidationError(message),\n })\n}\n\n/** Build the `tx.l.<linkId>` API for one ontology link. */\nfunction createLinkPredicateBuilder(linkId: string): RuleLinkPredicateBuilder {\n return createSharedLinkPredicateBuilder(linkId)\n}\n\n/**\n * Build the callback subject from ontology metadata.\n *\n * This object is only used while `.where(...)` executes. The returned\n * RuleDefinition stores the predicate data produced by these methods, not this\n * builder object or the user callback.\n */\nfunction createRuleSubjectBuilder<TObjectType extends RuleObjectType>(\n objectType: TObjectType\n): RuntimeRuleSubjectBuilder {\n const properties = Object.fromEntries(\n objectType.properties.map((property) => [\n property.id,\n createPropertyPredicateBuilder(property.id),\n ])\n )\n\n const links = Object.fromEntries(\n objectType.links.map((link) => [link.id, createLinkPredicateBuilder(link.id)])\n )\n\n return {\n p: properties,\n l: links,\n all(...predicates: RulePredicate[]): RulePredicate {\n return allPredicates(predicates)\n },\n any(...predicates: RulePredicate[]): RulePredicate {\n return anyPredicates(predicates)\n },\n not(predicate: RulePredicate): RulePredicate {\n return notPredicate(predicate)\n },\n }\n}\n\n/**\n * Define an inert business rule.\n *\n * The overload preserves literal ids and typed property/link keys for users.\n * The implementation returns a concrete builder and casts at the boundary so\n * runtime code stays small while callers still get the typed DSL.\n */\nexport function defineRule<const TId extends string>(id: TId): RuleBuilder<TId>\nexport function defineRule(id: string): RuleBuilder<string> {\n assertNonEmpty(id, \"id\")\n\n const builder = {\n on(objectType: RuleObjectType) {\n return {\n where(callback: (subject: RuntimeRuleSubjectBuilder) => RulePredicate): RuleDefinition {\n const predicate = callback(createRuleSubjectBuilder(objectType))\n assertRulePredicateShape(predicate)\n\n return {\n kind: \"rule\",\n id,\n subject: {\n kind: \"object\",\n objectTypeId: objectType.id,\n },\n predicate,\n }\n },\n }\n },\n }\n\n return builder as unknown as RuleBuilder<string>\n}\n",
9
- "import type { ActionDefinitionCatalog } from \"../actions\"\nimport type { OntologyDefinitionCatalog } from \"../ontology\"\nimport { snapshotShareDefinition } from \"./builders\"\nimport { compileShareAccessPlan } from \"./compiler\"\nimport { ShareDefinitionError } from \"./errors\"\nimport type { ShareDefinition } from \"./types\"\n\n/** Cross-validate discovered Share definitions after ontology and Actions are registered. */\nexport function validateSharesAtStartup(input: {\n readonly shares: readonly ShareDefinition[]\n readonly ontology: OntologyDefinitionCatalog\n readonly actions: ActionDefinitionCatalog\n}): ReadonlyMap<string, ShareDefinition> {\n const byId = new Map<string, ShareDefinition>()\n for (const authoredShare of input.shares) {\n const share = snapshotShareDefinition(authoredShare)\n if (byId.has(share.id)) {\n throw invalid(`Duplicate Share id: ${share.id}`)\n }\n compileShareAccessPlan({\n share,\n target: {\n objectTypeId: share.target.objectTypeId,\n primaryId: \"__sixb_share_definition_validation__\",\n },\n ontology: input.ontology,\n actions: input.actions,\n })\n byId.set(share.id, share)\n }\n return byId\n}\n\nexport function assertShareDefinitionEnvelope(value: unknown): asserts value is ShareDefinition {\n snapshotShareDefinition(value)\n}\n\nfunction invalid(message: string): ShareDefinitionError {\n return new ShareDefinitionError(`[Sixb] ${message}`)\n}\n",
10
- "import { access, mkdir, readdir, readFile, writeFile } from \"node:fs/promises\"\nimport { dirname, extname, join, relative, resolve, sep } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport type { OntologyDocumentInput } from \"../ontology/registry\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport { RuntimeError } from \"../runtime/errors\"\n\nconst moduleExtensions = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"])\n\nexport interface OntologyTypeManifestEntry {\n readonly objectTypeId: string\n readonly modulePath: string\n readonly exportName: string\n readonly typeExpression: string\n}\n\nexport interface OntologyTypeManifestDiscovery {\n readonly entries: readonly OntologyTypeManifestEntry[]\n readonly moduleCount: number\n}\n\nexport interface GenerateOntologyTypeManifestOptions {\n readonly projectRoot: string\n readonly outFile?: string\n}\n\nexport interface GenerateOntologyTypeManifestResult extends OntologyTypeManifestDiscovery {\n readonly path: string\n readonly written: boolean\n readonly skipped: boolean\n}\n\nexport async function discoverOntologyTypeManifest(\n projectRoot: string\n): Promise<OntologyTypeManifestDiscovery> {\n const resolvedProjectRoot = resolve(projectRoot)\n const ontologyDir = join(resolvedProjectRoot, \"ontology\")\n const modulePaths = await listModuleFiles(ontologyDir)\n const entries = new Map<string, OntologyTypeManifestEntry>()\n const seenObjectTypes = new Set<unknown>()\n\n for (const modulePath of modulePaths) {\n const moduleSpecifier = toGeneratedModuleSpecifier({\n fromDir: join(resolvedProjectRoot, \".sixb\", \"types\"),\n modulePath,\n })\n const moduleNamespace = await loadOntologyModule({\n modulePath,\n projectRoot: resolvedProjectRoot,\n })\n\n for (const [exportName, exportedValue] of Object.entries(moduleNamespace)) {\n collectManifestEntries({\n exportedValue,\n exportName,\n modulePath,\n moduleSpecifier,\n entries,\n seenObjectTypes,\n })\n }\n }\n\n return {\n entries: [...entries.values()].sort((a, b) => a.objectTypeId.localeCompare(b.objectTypeId)),\n moduleCount: modulePaths.length,\n }\n}\n\nexport async function generateOntologyTypeManifest(\n options: GenerateOntologyTypeManifestOptions\n): Promise<GenerateOntologyTypeManifestResult> {\n const projectRoot = resolve(options.projectRoot)\n const outFile = resolve(projectRoot, options.outFile ?? join(\".sixb\", \"types\", \"ontology.d.ts\"))\n const discovery = await discoverOntologyTypeManifest(projectRoot)\n\n if (discovery.moduleCount === 0) {\n // Leave projects without ontology untouched, but clear a previously generated map.\n try {\n await access(outFile)\n } catch (error) {\n if (!isNotFoundError(error)) throw error\n return {\n ...discovery,\n path: outFile,\n written: false,\n skipped: true,\n }\n }\n }\n\n const content = renderOntologyTypeManifest(discovery.entries)\n await mkdir(dirname(outFile), { recursive: true })\n const written = await writeFileIfChanged(outFile, content)\n\n return {\n ...discovery,\n path: outFile,\n written,\n skipped: false,\n }\n}\n\nfunction collectManifestEntries(input: {\n readonly exportedValue: unknown\n readonly exportName: string\n readonly modulePath: string\n readonly moduleSpecifier: string\n readonly entries: Map<string, OntologyTypeManifestEntry>\n readonly seenObjectTypes: Set<unknown>\n}): void {\n if (isObjectTypeWithPropertyTokens(input.exportedValue)) {\n addManifestEntry({\n objectType: input.exportedValue,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `typeof import(${JSON.stringify(input.moduleSpecifier)})[${JSON.stringify(\n input.exportName\n )}]`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n return\n }\n\n if (isOntologyDocumentInput(input.exportedValue)) {\n for (const objectType of input.exportedValue.objectTypes) {\n addManifestEntry({\n objectType,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `Extract<(typeof import(${JSON.stringify(\n input.moduleSpecifier\n )})[${JSON.stringify(input.exportName)}])[\"objectTypes\"][number], { id: ${JSON.stringify(\n objectType.id\n )} }>`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n }\n return\n }\n\n if (Array.isArray(input.exportedValue)) {\n for (const item of input.exportedValue) {\n if (!isObjectTypeWithPropertyTokens(item)) continue\n addManifestEntry({\n objectType: item,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `Extract<(typeof import(${JSON.stringify(\n input.moduleSpecifier\n )})[${JSON.stringify(input.exportName)}])[number], { id: ${JSON.stringify(item.id)} }>`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n }\n }\n}\n\nfunction addManifestEntry(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly modulePath: string\n readonly exportName: string\n readonly typeExpression: string\n readonly entries: Map<string, OntologyTypeManifestEntry>\n readonly seenObjectTypes: Set<unknown>\n}): void {\n if (input.seenObjectTypes.has(input.objectType)) {\n return\n }\n input.seenObjectTypes.add(input.objectType)\n\n const existing = input.entries.get(input.objectType.id)\n const entry: OntologyTypeManifestEntry = {\n objectTypeId: input.objectType.id,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: input.typeExpression,\n }\n\n if (!existing) {\n input.entries.set(input.objectType.id, entry)\n return\n }\n\n throw new RuntimeError(\n `[Sixb] Duplicate ontology object type id \"${input.objectType.id}\" while generating `.concat(\n `the type manifest: ${relative(process.cwd(), existing.modulePath)} and `,\n `${relative(process.cwd(), input.modulePath)}.`\n )\n )\n}\n\nfunction renderOntologyTypeManifest(entries: readonly OntologyTypeManifestEntry[]): string {\n const lines = [\n \"// This file is auto-generated by Sixb.\",\n \"// Do not edit this file directly.\",\n \"\",\n 'declare module \"@sixb/core/ontology\" {',\n \" interface SixbObjectTypeMap {\",\n ]\n\n for (const entry of entries) {\n lines.push(` ${JSON.stringify(entry.objectTypeId)}: ${entry.typeExpression}`)\n }\n\n lines.push(\" }\", \"}\", \"\", \"export {}\", \"\")\n return lines.join(\"\\n\")\n}\n\nasync function writeFileIfChanged(path: string, content: string): Promise<boolean> {\n try {\n const existing = await readFile(path, \"utf-8\")\n if (existing === content) return false\n } catch (error) {\n if (!isNotFoundError(error)) throw error\n }\n\n await writeFile(path, content, \"utf-8\")\n return true\n}\n\nasync function loadOntologyModule(input: {\n readonly modulePath: string\n readonly projectRoot: string\n}): Promise<Record<string, unknown>> {\n try {\n return (await import(pathToFileURL(input.modulePath).href)) as Record<string, unknown>\n } catch (error) {\n const relPath = relative(input.projectRoot, input.modulePath)\n const reason = error instanceof Error ? error.message : String(error)\n throw new RuntimeError(`Failed to load ontology module '${relPath}': ${reason}`)\n }\n}\n\nasync function listModuleFiles(dir: string): Promise<string[]> {\n let entries: import(\"node:fs\").Dirent[]\n try {\n entries = (await readdir(dir, { withFileTypes: true })) as import(\"node:fs\").Dirent[]\n } catch (error) {\n if (isNotFoundError(error)) {\n return []\n }\n throw error\n }\n\n const files: string[] = []\n const sortedEntries = [...entries].sort((a, b) => a.name.localeCompare(b.name))\n\n for (const entry of sortedEntries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n files.push(...(await listModuleFiles(fullPath)))\n continue\n }\n\n if (!entry.isFile() || !hasSupportedModuleExtension(entry.name)) {\n continue\n }\n\n files.push(fullPath)\n }\n\n return files\n}\n\nfunction toGeneratedModuleSpecifier(input: {\n readonly fromDir: string\n readonly modulePath: string\n}): string {\n const withoutExtension = stripSupportedModuleExtension(input.modulePath)\n const relativePath = relative(input.fromDir, withoutExtension).split(sep).join(\"/\")\n return relativePath.startsWith(\".\") ? relativePath : `./${relativePath}`\n}\n\nfunction stripSupportedModuleExtension(path: string): string {\n const extension = extname(path)\n return moduleExtensions.has(extension) ? path.slice(0, -extension.length) : path\n}\n\nfunction hasSupportedModuleExtension(fileName: string): boolean {\n return moduleExtensions.has(extname(fileName).toLowerCase())\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false\n }\n\n const code = (error as NodeJS.ErrnoException).code\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction isObjectTypeWithPropertyTokens(value: unknown): value is ObjectTypeWithPropertyTokens {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n Array.isArray(value.properties) &&\n Array.isArray(value.links) &&\n isRecord(value.p)\n )\n}\n\nfunction isOntologyDocumentInput(value: unknown): value is OntologyDocumentInput {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.version === \"string\" &&\n Array.isArray(value.objectTypes)\n )\n}\n"
11
- ],
12
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AACA;AACA;;;ACNO,MAAM,kBAAkB,MAAM;AAAA,EAC1B,OAAe;AAC1B;AAAA;AAEO,MAAM,4BAA4B,UAAU;AAAA,EAC/B,OAAO;AAC3B;;;ACJA,SAAS,QAAQ,CAAC,OAAkD;AAAA,EAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAAA;AAG5E,SAAS,oBAAoB,CAC3B,OACA,OACA,aACyB;AAAA,EACzB,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,EAAE,WAAW,GAAG;AAAA,IAC1D,MAAM,YAAY,GAAG,0BAA0B;AAAA,EACjD;AAAA;AAUK,SAAS,wBAAwB,CACtC,OACA,cAA0C,CAAC,YAAY,IAAI,oBAAoB,OAAO,GACtD;AAAA,EAChC,qBAAqB,OAAO,EAAE,SAAS,QAAQ,YAAY,CAAC;AAAA;AAIvD,SAAS,oBAAoB,CAClC,OACA,cAA0C,CAAC,YAAY,IAAI,oBAAoB,OAAO,GACrD;AA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AM,UAAU,KAC9B,MAAM,QAAQ,MAAM,KAAK,KACzB,UAAS,MAAM,CAAC;AAAA;AAIpB,SAAS,wBAAuB,CAAC,OAAgD;AAAA,EAC/E,IAAI,CAAC,UAAS,KAAK,GAAG;AAAA,IACpB,OAAO;AAAA,EACT;AAAA,EAEA,OACE,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,YAAY,YACzB,MAAM,QAAQ,MAAM,WAAW;AAAA;",
13
- "debugId": "AE5FFEDCD6F31C5E64756E2164756E21",
14
- "names": []
15
- }
@@ -1,60 +0,0 @@
1
- // @bun
2
- import {
3
- isJsonValue
4
- } from "./chunk-n6jxh8sw.js";
5
-
6
- // src/logging/types.ts
7
- var LOG_LEVELS = ["debug", "info", "warn", "error"];
8
- var SIXB_RUN_KINDS = [
9
- "action",
10
- "agent",
11
- "pipeline",
12
- "projection",
13
- "sync",
14
- "webhook",
15
- "workflow"
16
- ];
17
- function isLevelEnabled(level, threshold) {
18
- const levelIndex = LOG_LEVELS.indexOf(level);
19
- const thresholdIndex = LOG_LEVELS.indexOf(threshold);
20
- return levelIndex >= 0 && thresholdIndex >= 0 && levelIndex >= thresholdIndex;
21
- }
22
- function logLevelsAtOrAbove(threshold) {
23
- const thresholdIndex = LOG_LEVELS.indexOf(threshold);
24
- return thresholdIndex < 0 ? [] : LOG_LEVELS.slice(thresholdIndex);
25
- }
26
- function isLogLevel(value) {
27
- return typeof value === "string" && LOG_LEVELS.includes(value);
28
- }
29
- function isSixbRunKind(value) {
30
- return typeof value === "string" && SIXB_RUN_KINDS.includes(value);
31
- }
32
- function isLogRecord(value) {
33
- return isRecord(value) && isLogLevel(value.level) && typeof value.message === "string" && typeof value.at === "string" && (value.fields === undefined || isLogFields(value.fields)) && isLogContext(value.context);
34
- }
35
- function isStoredLogLine(value) {
36
- return isRecord(value) && isLogRecord(value) && typeof value.cursor === "string";
37
- }
38
- function isLogFields(value) {
39
- return isRecord(value) && isJsonValue(value);
40
- }
41
- function isLogContext(value) {
42
- return isRecord(value) && isRecord(value.run) && isSixbRunKind(value.run.kind) && typeof value.run.id === "string" && (value.stepId === undefined || typeof value.stepId === "string") && (value.phase === undefined || typeof value.phase === "string") && (value.attempt === undefined || typeof value.attempt === "number" && Number.isFinite(value.attempt));
43
- }
44
- function isRecord(value) {
45
- return typeof value === "object" && value !== null && !Array.isArray(value);
46
- }
47
- function normalizeLogError(message, fields) {
48
- if (message instanceof Error) {
49
- const error = { name: message.name };
50
- if (message.stack !== undefined) {
51
- error.stack = message.stack;
52
- }
53
- return { message: message.message, fields: { ...fields, error } };
54
- }
55
- return { message, fields };
56
- }
57
-
58
- export { LOG_LEVELS, SIXB_RUN_KINDS, isLevelEnabled, logLevelsAtOrAbove, isLogLevel, isSixbRunKind, isLogRecord, isStoredLogLine, normalizeLogError };
59
-
60
- //# debugId=BFBAFDF76D3E4DAC64756E2164756E21