@sixb/core 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (999) hide show
  1. package/dist/actions/delegated-admission.d.ts +24 -0
  2. package/dist/actions/delegated-admission.d.ts.map +1 -0
  3. package/dist/actions/descriptor.d.ts +29 -0
  4. package/dist/actions/descriptor.d.ts.map +1 -0
  5. package/dist/actions/execution.d.ts +5 -5
  6. package/dist/actions/execution.d.ts.map +1 -1
  7. package/dist/actions/index.js +78 -84
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/actions/request.d.ts.map +1 -1
  10. package/dist/actions/run-authorization.d.ts +20 -0
  11. package/dist/actions/run-authorization.d.ts.map +1 -0
  12. package/dist/actions/run-dispatch.d.ts +3 -1
  13. package/dist/actions/run-dispatch.d.ts.map +1 -1
  14. package/dist/actions/types/context.d.ts +2 -0
  15. package/dist/actions/types/context.d.ts.map +1 -1
  16. package/dist/actions/validation.d.ts +1 -1
  17. package/dist/actions/validation.d.ts.map +1 -1
  18. package/dist/actions/worker.js +33 -37
  19. package/dist/actions/worker.js.map +2 -2
  20. package/dist/agents/adapters.d.ts +8 -125
  21. package/dist/agents/adapters.d.ts.map +1 -1
  22. package/dist/agents/authority.d.ts +1 -1
  23. package/dist/agents/authority.d.ts.map +1 -1
  24. package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
  25. package/dist/agents/context/entries.d.ts.map +1 -0
  26. package/dist/agents/context/index.d.ts +4 -0
  27. package/dist/agents/context/index.d.ts.map +1 -0
  28. package/dist/agents/context/index.js +19 -0
  29. package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
  30. package/dist/agents/context-model.d.ts +1 -1
  31. package/dist/agents/context-model.d.ts.map +1 -1
  32. package/dist/agents/context-resolution.d.ts +1 -1
  33. package/dist/agents/context-resolution.d.ts.map +1 -1
  34. package/dist/agents/errors.d.ts +0 -9
  35. package/dist/agents/errors.d.ts.map +1 -1
  36. package/dist/agents/execution.d.ts.map +1 -1
  37. package/dist/agents/identity.d.ts +3 -0
  38. package/dist/agents/identity.d.ts.map +1 -0
  39. package/dist/agents/index.d.ts +7 -7
  40. package/dist/agents/index.d.ts.map +1 -1
  41. package/dist/agents/index.js +193 -205
  42. package/dist/agents/index.js.map +1 -1
  43. package/dist/agents/message.d.ts +5 -6
  44. package/dist/agents/message.d.ts.map +1 -1
  45. package/dist/agents/model-loop.d.ts +4 -0
  46. package/dist/agents/model-loop.d.ts.map +1 -1
  47. package/dist/agents/request.d.ts +1 -1
  48. package/dist/agents/request.d.ts.map +1 -1
  49. package/dist/agents/streams/index.d.ts +4 -0
  50. package/dist/agents/streams/index.d.ts.map +1 -0
  51. package/dist/agents/streams/index.js +20 -0
  52. package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
  53. package/dist/agents/streams/internal.d.ts +3 -0
  54. package/dist/agents/streams/internal.d.ts.map +1 -0
  55. package/dist/agents/streams/internal.js +40 -0
  56. package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
  57. package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
  58. package/dist/agents/streams/protocol.d.ts.map +1 -0
  59. package/dist/agents/tool-definition.d.ts +0 -1
  60. package/dist/agents/tool-definition.d.ts.map +1 -1
  61. package/dist/agents/types.d.ts +1 -1
  62. package/dist/agents/types.d.ts.map +1 -1
  63. package/dist/agents/validation.d.ts +0 -4
  64. package/dist/agents/validation.d.ts.map +1 -1
  65. package/dist/ai-usage/execution.d.ts.map +1 -1
  66. package/dist/auth/index.d.ts +0 -1
  67. package/dist/auth/index.d.ts.map +1 -1
  68. package/dist/auth/index.js +96 -105
  69. package/dist/auth/index.js.map +1 -1
  70. package/dist/auth/strategy.js +8 -9
  71. package/dist/auth/strategy.js.map +1 -1
  72. package/dist/authorization/decision.d.ts +10 -2
  73. package/dist/authorization/decision.d.ts.map +1 -1
  74. package/dist/authorization/grant-kinds.d.ts +2 -1
  75. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  76. package/dist/authorization/index.d.ts +1 -1
  77. package/dist/authorization/index.d.ts.map +1 -1
  78. package/dist/authorization/index.js +51 -53
  79. package/dist/authorization/index.js.map +1 -1
  80. package/dist/blob-storage/browser.js +15 -17
  81. package/dist/blob-storage/browser.js.map +1 -1
  82. package/dist/blob-storage/index.js +36 -38
  83. package/dist/blob-storage/index.js.map +1 -1
  84. package/dist/bootstrap/discovery.d.ts +20 -1
  85. package/dist/bootstrap/discovery.d.ts.map +1 -1
  86. package/dist/bootstrap/index.d.ts +2 -2
  87. package/dist/bootstrap/index.d.ts.map +1 -1
  88. package/dist/bootstrap/index.js +79 -81
  89. package/dist/bootstrap/index.js.map +1 -1
  90. package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
  91. package/dist/broker/index.js +8 -10
  92. package/dist/broker/index.js.map +1 -1
  93. package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
  94. package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
  95. package/dist/{chunk-3fqt22c4.js → chunk-0w35wavj.js} +360 -168
  96. package/dist/chunk-0w35wavj.js.map +14 -0
  97. package/dist/chunk-0y39rgsb.js +43 -0
  98. package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
  99. package/dist/{chunk-hdz94br2.js → chunk-17kfctj6.js} +23 -13
  100. package/dist/chunk-17kfctj6.js.map +10 -0
  101. package/dist/{chunk-e4rvtvpw.js → chunk-1enhpacz.js} +418 -233
  102. package/dist/chunk-1enhpacz.js.map +34 -0
  103. package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
  104. package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
  105. package/dist/{chunk-7ds9620f.js → chunk-38zv5rkr.js} +24 -8
  106. package/dist/chunk-38zv5rkr.js.map +10 -0
  107. package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
  108. package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
  109. package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
  110. package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
  111. package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
  112. package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
  113. package/dist/chunk-3frsnm7x.js +32 -0
  114. package/dist/chunk-3frsnm7x.js.map +11 -0
  115. package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
  116. package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
  117. package/dist/{chunk-qv38twt8.js → chunk-52hbv0ak.js} +192 -171
  118. package/dist/{chunk-qv38twt8.js.map → chunk-52hbv0ak.js.map} +6 -6
  119. package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
  120. package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
  121. package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
  122. package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
  123. package/dist/chunk-653vwrzr.js +39 -0
  124. package/dist/chunk-653vwrzr.js.map +10 -0
  125. package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
  126. package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
  127. package/dist/chunk-7apz6hg4.js +50 -0
  128. package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
  129. package/dist/chunk-7bs40fe1.js +218 -0
  130. package/dist/{chunk-08twe8m6.js.map → chunk-7bs40fe1.js.map} +3 -3
  131. package/dist/chunk-7zgecwy1.js +113 -0
  132. package/dist/chunk-7zgecwy1.js.map +10 -0
  133. package/dist/{chunk-tn7xcs2n.js → chunk-860dwwy0.js} +93 -30
  134. package/dist/chunk-860dwwy0.js.map +14 -0
  135. package/dist/chunk-8vj0rjgs.js +165 -0
  136. package/dist/chunk-8vj0rjgs.js.map +15 -0
  137. package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
  138. package/dist/chunk-92vk7gta.js.map +10 -0
  139. package/dist/{chunk-gbrpsx4m.js → chunk-93csa55g.js} +72 -16
  140. package/dist/chunk-93csa55g.js.map +11 -0
  141. package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
  142. package/dist/chunk-98cw09sw.js.map +10 -0
  143. package/dist/chunk-9qsh3p5y.js +111 -0
  144. package/dist/chunk-9qsh3p5y.js.map +11 -0
  145. package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
  146. package/dist/{chunk-z2sery1b.js → chunk-9vx5e9g1.js} +68 -28
  147. package/dist/chunk-9vx5e9g1.js.map +11 -0
  148. package/dist/{chunk-9aehf39w.js → chunk-an5tt9y0.js} +353 -353
  149. package/dist/{chunk-9aehf39w.js.map → chunk-an5tt9y0.js.map} +2 -2
  150. package/dist/{chunk-x0qhkqje.js → chunk-ap0g1g74.js} +37 -37
  151. package/dist/{chunk-x0qhkqje.js.map → chunk-ap0g1g74.js.map} +2 -2
  152. package/dist/chunk-awbhdqyc.js +252 -0
  153. package/dist/chunk-awbhdqyc.js.map +10 -0
  154. package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
  155. package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
  156. package/dist/chunk-br3k6qbf.js +436 -0
  157. package/dist/chunk-br3k6qbf.js.map +12 -0
  158. package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
  159. package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
  160. package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
  161. package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
  162. package/dist/chunk-d62kjtbg.js +7 -0
  163. package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
  164. package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
  165. package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
  166. package/dist/{chunk-atmkaf60.js → chunk-dmn70ztd.js} +30 -34
  167. package/dist/chunk-dmn70ztd.js.map +11 -0
  168. package/dist/chunk-dz5h08xv.js +1887 -0
  169. package/dist/chunk-dz5h08xv.js.map +25 -0
  170. package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
  171. package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
  172. package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
  173. package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
  174. package/dist/{chunk-ha58tjtt.js → chunk-emyyk7dx.js} +59 -55
  175. package/dist/{chunk-ha58tjtt.js.map → chunk-emyyk7dx.js.map} +3 -3
  176. package/dist/{chunk-3kv70xwp.js → chunk-ey1nk510.js} +18 -2
  177. package/dist/chunk-ey1nk510.js.map +10 -0
  178. package/dist/chunk-f0rwz2vh.js +152 -0
  179. package/dist/chunk-f0rwz2vh.js.map +11 -0
  180. package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
  181. package/dist/chunk-f4w3yp4f.js.map +12 -0
  182. package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
  183. package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
  184. package/dist/{chunk-rre42skh.js → chunk-g00bfdq6.js} +729 -296
  185. package/dist/{chunk-rre42skh.js.map → chunk-g00bfdq6.js.map} +11 -7
  186. package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
  187. package/dist/chunk-g53f0e4j.js.map +15 -0
  188. package/dist/chunk-g6cke204.js +124 -0
  189. package/dist/chunk-g6cke204.js.map +10 -0
  190. package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
  191. package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
  192. package/dist/chunk-h1gfhhbh.js +602 -0
  193. package/dist/chunk-h1gfhhbh.js.map +18 -0
  194. package/dist/chunk-h3v76ams.js +32 -0
  195. package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
  196. package/dist/chunk-hpr1r6av.js +4006 -0
  197. package/dist/chunk-hpr1r6av.js.map +44 -0
  198. package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
  199. package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
  200. package/dist/{chunk-rp1mvzb4.js → chunk-jjy0fhrn.js} +40 -35
  201. package/dist/{chunk-rp1mvzb4.js.map → chunk-jjy0fhrn.js.map} +3 -3
  202. package/dist/{chunk-4nxeacx7.js → chunk-jmfet9r4.js} +6 -6
  203. package/dist/{chunk-4nxeacx7.js.map → chunk-jmfet9r4.js.map} +2 -2
  204. package/dist/{chunk-64sr682n.js → chunk-k3cqkkn2.js} +61 -55
  205. package/dist/chunk-k3cqkkn2.js.map +12 -0
  206. package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
  207. package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
  208. package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
  209. package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
  210. package/dist/{chunk-qjycjdj6.js → chunk-m3z3x9v0.js} +106 -65
  211. package/dist/{chunk-qjycjdj6.js.map → chunk-m3z3x9v0.js.map} +3 -3
  212. package/dist/{chunk-6ed5bwnd.js → chunk-mjbk2djy.js} +2092 -1714
  213. package/dist/chunk-mjbk2djy.js.map +57 -0
  214. package/dist/{chunk-5jcdmjam.js → chunk-mmagke4x.js} +6 -6
  215. package/dist/{chunk-5jcdmjam.js.map → chunk-mmagke4x.js.map} +2 -2
  216. package/dist/chunk-mrp7k0pw.js +147 -0
  217. package/dist/chunk-mrp7k0pw.js.map +10 -0
  218. package/dist/{chunk-d63tybny.js → chunk-ms2tmn1k.js} +139 -139
  219. package/dist/{chunk-d63tybny.js.map → chunk-ms2tmn1k.js.map} +2 -2
  220. package/dist/{chunk-xdpwpkha.js → chunk-ppytyr6w.js} +156 -179
  221. package/dist/{chunk-xdpwpkha.js.map → chunk-ppytyr6w.js.map} +3 -5
  222. package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
  223. package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
  224. package/dist/{chunk-qjzp9xyb.js → chunk-pr2h4bv4.js} +33 -35
  225. package/dist/chunk-pr2h4bv4.js.map +12 -0
  226. package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
  227. package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
  228. package/dist/{chunk-agsvg9ar.js → chunk-qf954wje.js} +6 -6
  229. package/dist/{chunk-agsvg9ar.js.map → chunk-qf954wje.js.map} +2 -2
  230. package/dist/{chunk-wjgm6jjt.js → chunk-qhcpj9wc.js} +166 -132
  231. package/dist/chunk-qhcpj9wc.js.map +14 -0
  232. package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
  233. package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
  234. package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
  235. package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
  236. package/dist/{chunk-2b5qtban.js → chunk-r4tfx1sf.js} +142 -89
  237. package/dist/chunk-r4tfx1sf.js.map +15 -0
  238. package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
  239. package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
  240. package/dist/chunk-s3csryxe.js +152 -0
  241. package/dist/chunk-s3csryxe.js.map +11 -0
  242. package/dist/chunk-s670k14v.js +60 -0
  243. package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
  244. package/dist/chunk-skz0hst3.js +788 -0
  245. package/dist/chunk-skz0hst3.js.map +19 -0
  246. package/dist/chunk-v4jbb3rs.js +403 -0
  247. package/dist/chunk-v4jbb3rs.js.map +10 -0
  248. package/dist/{chunk-d2ndstdf.js → chunk-vf691g1r.js} +61 -59
  249. package/dist/{chunk-d2ndstdf.js.map → chunk-vf691g1r.js.map} +2 -2
  250. package/dist/{chunk-1kamz6j0.js → chunk-vsj3mdfj.js} +8 -8
  251. package/dist/{chunk-1kamz6j0.js.map → chunk-vsj3mdfj.js.map} +2 -2
  252. package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
  253. package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
  254. package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
  255. package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
  256. package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
  257. package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
  258. package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
  259. package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
  260. package/dist/chunk-x9v4cx1d.js +139 -0
  261. package/dist/chunk-x9v4cx1d.js.map +10 -0
  262. package/dist/{chunk-kt81c11h.js → chunk-xfbydgzy.js} +27 -27
  263. package/dist/{chunk-kt81c11h.js.map → chunk-xfbydgzy.js.map} +2 -2
  264. package/dist/{chunk-vjjv9mrb.js → chunk-xyr8kppc.js} +22 -22
  265. package/dist/{chunk-vjjv9mrb.js.map → chunk-xyr8kppc.js.map} +3 -3
  266. package/dist/chunk-ypbtykv6.js +1537 -0
  267. package/dist/chunk-ypbtykv6.js.map +19 -0
  268. package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
  269. package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
  270. package/dist/{chunk-xc7hq65b.js → chunk-z30bv4ga.js} +80 -33
  271. package/dist/chunk-z30bv4ga.js.map +11 -0
  272. package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
  273. package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
  274. package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
  275. package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
  276. package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
  277. package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
  278. package/dist/chunk-z8fx5cgb.js +159 -0
  279. package/dist/chunk-z8fx5cgb.js.map +11 -0
  280. package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
  281. package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
  282. package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
  283. package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
  284. package/dist/connectors/connections/internal.js +9 -10
  285. package/dist/connectors/connections/internal.js.map +1 -1
  286. package/dist/datasets/builders.d.ts +11 -2
  287. package/dist/datasets/builders.d.ts.map +1 -1
  288. package/dist/datasets/changes.d.ts +14 -4
  289. package/dist/datasets/changes.d.ts.map +1 -1
  290. package/dist/datasets/execution.d.ts +15 -1
  291. package/dist/datasets/execution.d.ts.map +1 -1
  292. package/dist/datasets/index.d.ts +1 -0
  293. package/dist/datasets/index.d.ts.map +1 -1
  294. package/dist/datasets/sequence.d.ts +7 -0
  295. package/dist/datasets/sequence.d.ts.map +1 -0
  296. package/dist/datasets/types.d.ts +1 -0
  297. package/dist/datasets/types.d.ts.map +1 -1
  298. package/dist/datasets/validation.d.ts.map +1 -1
  299. package/dist/datasets/write.d.ts +37 -0
  300. package/dist/datasets/write.d.ts.map +1 -0
  301. package/dist/datasets/write.js +13 -0
  302. package/dist/datasets/write.js.map +9 -0
  303. package/dist/edits/index.js +7 -8
  304. package/dist/edits/index.js.map +1 -1
  305. package/dist/error-reporting/internal.js +22 -24
  306. package/dist/error-reporting/internal.js.map +1 -1
  307. package/dist/errors/internal.d.ts +1 -1
  308. package/dist/errors/internal.d.ts.map +1 -1
  309. package/dist/errors/internal.js +22 -24
  310. package/dist/errors/internal.js.map +1 -1
  311. package/dist/errors/redaction.d.ts +8 -0
  312. package/dist/errors/redaction.d.ts.map +1 -0
  313. package/dist/errors/types.d.ts +4 -0
  314. package/dist/errors/types.d.ts.map +1 -1
  315. package/dist/events/execution.d.ts.map +1 -1
  316. package/dist/events/index.js +60 -63
  317. package/dist/events/index.js.map +1 -1
  318. package/dist/events/scope.js +4 -5
  319. package/dist/events/scope.js.map +1 -1
  320. package/dist/events/selectors/index.js +9 -10
  321. package/dist/events/selectors/index.js.map +1 -1
  322. package/dist/events/types/datasets.d.ts +2 -6
  323. package/dist/events/types/datasets.d.ts.map +1 -1
  324. package/dist/execution/agent.d.ts +3 -3
  325. package/dist/execution/agent.d.ts.map +1 -1
  326. package/dist/execution/agent.js +70 -75
  327. package/dist/execution/agent.js.map +1 -1
  328. package/dist/execution/authorization.d.ts +58 -20
  329. package/dist/execution/authorization.d.ts.map +1 -1
  330. package/dist/execution/authorized-object-reader.d.ts +69 -0
  331. package/dist/execution/authorized-object-reader.d.ts.map +1 -0
  332. package/dist/execution/durable.d.ts +1 -0
  333. package/dist/execution/durable.d.ts.map +1 -1
  334. package/dist/execution/index.d.ts +1 -1
  335. package/dist/execution/index.d.ts.map +1 -1
  336. package/dist/execution/primitive.d.ts +2 -0
  337. package/dist/execution/primitive.d.ts.map +1 -1
  338. package/dist/execution/primitive.js +63 -64
  339. package/dist/execution/primitive.js.map +3 -3
  340. package/dist/execution/request.d.ts +12 -0
  341. package/dist/execution/request.d.ts.map +1 -1
  342. package/dist/execution/request.js +97 -71
  343. package/dist/execution/request.js.map +3 -3
  344. package/dist/execution/scopes.d.ts +16 -0
  345. package/dist/execution/scopes.d.ts.map +1 -1
  346. package/dist/execution/types.d.ts +9 -0
  347. package/dist/execution/types.d.ts.map +1 -1
  348. package/dist/http/api-routes.d.ts +2 -0
  349. package/dist/http/api-routes.d.ts.map +1 -1
  350. package/dist/http/index.js +10 -11
  351. package/dist/http/index.js.map +1 -1
  352. package/dist/index.d.ts +21 -14
  353. package/dist/index.d.ts.map +1 -1
  354. package/dist/index.js +455 -463
  355. package/dist/index.js.map +1 -1
  356. package/dist/lake-storage/definition-updates.d.ts.map +1 -1
  357. package/dist/lake-storage/errors.d.ts +5 -1
  358. package/dist/lake-storage/errors.d.ts.map +1 -1
  359. package/dist/lake-storage/in-memory.d.ts +1 -0
  360. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  361. package/dist/lake-storage/index.d.ts +6 -1
  362. package/dist/lake-storage/index.d.ts.map +1 -1
  363. package/dist/lake-storage/index.js +40 -27
  364. package/dist/lake-storage/index.js.map +1 -1
  365. package/dist/lake-storage/merge-validation.d.ts.map +1 -1
  366. package/dist/lake-storage/merge.d.ts +13 -2
  367. package/dist/lake-storage/merge.d.ts.map +1 -1
  368. package/dist/lake-storage/source-ordering.d.ts +19 -0
  369. package/dist/lake-storage/source-ordering.d.ts.map +1 -0
  370. package/dist/lake-storage/sql-transforms.d.ts +2 -1
  371. package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
  372. package/dist/lake-storage/types.d.ts +10 -5
  373. package/dist/lake-storage/types.d.ts.map +1 -1
  374. package/dist/lake-storage/version-inputs.d.ts +4 -0
  375. package/dist/lake-storage/version-inputs.d.ts.map +1 -0
  376. package/dist/logging/index.d.ts +3 -4
  377. package/dist/logging/index.d.ts.map +1 -1
  378. package/dist/logging/index.js +18 -40
  379. package/dist/logging/index.js.map +1 -1
  380. package/dist/logging/internal.d.ts +5 -0
  381. package/dist/logging/internal.d.ts.map +1 -0
  382. package/dist/logging/internal.js +43 -0
  383. package/dist/logging/internal.js.map +9 -0
  384. package/dist/materialization/index.js +46 -49
  385. package/dist/materialization/index.js.map +1 -1
  386. package/dist/materializer/index.js +137 -142
  387. package/dist/materializer/index.js.map +1 -1
  388. package/dist/models/errors.d.ts +4 -0
  389. package/dist/models/errors.d.ts.map +1 -1
  390. package/dist/models/execution/binding.d.ts +9 -0
  391. package/dist/models/execution/binding.d.ts.map +1 -0
  392. package/dist/models/execution/errors.d.ts +9 -0
  393. package/dist/models/execution/errors.d.ts.map +1 -0
  394. package/dist/models/execution/index.d.ts +11 -0
  395. package/dist/models/execution/index.d.ts.map +1 -0
  396. package/dist/models/execution/index.js +55 -0
  397. package/dist/models/execution/index.js.map +9 -0
  398. package/dist/models/execution/model-call-accounting.d.ts +17 -0
  399. package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
  400. package/dist/models/execution/model-call-admission.d.ts +47 -0
  401. package/dist/models/execution/model-call-admission.d.ts.map +1 -0
  402. package/dist/models/execution/model-call-limits.d.ts +15 -0
  403. package/dist/models/execution/model-call-limits.d.ts.map +1 -0
  404. package/dist/models/execution/model-call-recorder.d.ts +40 -0
  405. package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
  406. package/dist/models/execution/model-call-recovery.d.ts +12 -0
  407. package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
  408. package/dist/models/execution/recovery-queue.d.ts +5 -0
  409. package/dist/models/execution/recovery-queue.d.ts.map +1 -0
  410. package/dist/models/execution/types.d.ts +44 -0
  411. package/dist/models/execution/types.d.ts.map +1 -0
  412. package/dist/models/execution/usage.d.ts +5 -0
  413. package/dist/models/execution/usage.d.ts.map +1 -0
  414. package/dist/models/execution.d.ts +6 -0
  415. package/dist/models/execution.d.ts.map +1 -0
  416. package/dist/models/generation-types.d.ts +40 -0
  417. package/dist/models/generation-types.d.ts.map +1 -0
  418. package/dist/models/index.d.ts +1 -0
  419. package/dist/models/index.d.ts.map +1 -1
  420. package/dist/models/index.js +42 -43
  421. package/dist/models/index.js.map +1 -1
  422. package/dist/models/language-model.d.ts +3 -0
  423. package/dist/models/language-model.d.ts.map +1 -1
  424. package/dist/models/output.d.ts +5 -0
  425. package/dist/models/output.d.ts.map +1 -0
  426. package/dist/models/resolve.d.ts +4 -0
  427. package/dist/models/resolve.d.ts.map +1 -0
  428. package/dist/objects/authorized-ontology-view.d.ts +25 -0
  429. package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
  430. package/dist/objects/execution.d.ts +1 -1
  431. package/dist/objects/execution.d.ts.map +1 -1
  432. package/dist/objects/index.js +75 -84
  433. package/dist/objects/index.js.map +1 -1
  434. package/dist/objects/link/authorization.d.ts +2 -7
  435. package/dist/objects/link/authorization.d.ts.map +1 -1
  436. package/dist/objects/query/executor.d.ts +4 -2
  437. package/dist/objects/query/executor.d.ts.map +1 -1
  438. package/dist/objects/query/index.js +67 -73
  439. package/dist/objects/query/index.js.map +1 -1
  440. package/dist/objects/query/links.d.ts +22 -1
  441. package/dist/objects/query/links.d.ts.map +1 -1
  442. package/dist/objects/query/selected-read-admission.d.ts +27 -0
  443. package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
  444. package/dist/objects/query/validate.d.ts +60 -2
  445. package/dist/objects/query/validate.d.ts.map +1 -1
  446. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  447. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  448. package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
  449. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  450. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  451. package/dist/objects/service/list-service.d.ts +2 -3
  452. package/dist/objects/service/list-service.d.ts.map +1 -1
  453. package/dist/objects/telemetry/history.d.ts +8 -6
  454. package/dist/objects/telemetry/history.d.ts.map +1 -1
  455. package/dist/objects/telemetry/index.d.ts +2 -2
  456. package/dist/objects/telemetry/index.d.ts.map +1 -1
  457. package/dist/objects/telemetry/workload.d.ts +11 -0
  458. package/dist/objects/telemetry/workload.d.ts.map +1 -0
  459. package/dist/ontology/index.d.ts +2 -2
  460. package/dist/ontology/index.d.ts.map +1 -1
  461. package/dist/ontology/index.js +61 -111
  462. package/dist/ontology/index.js.map +1 -1
  463. package/dist/ontology/inference/index.d.ts +2 -1
  464. package/dist/ontology/inference/index.d.ts.map +1 -1
  465. package/dist/ontology/internal.d.ts +7 -1
  466. package/dist/ontology/internal.d.ts.map +1 -1
  467. package/dist/ontology/internal.js +65 -121
  468. package/dist/ontology/internal.js.map +3 -4
  469. package/dist/ontology/json-schema.d.ts +10 -6
  470. package/dist/ontology/json-schema.d.ts.map +1 -1
  471. package/dist/ontology/link-path-selection.d.ts +35 -0
  472. package/dist/ontology/link-path-selection.d.ts.map +1 -0
  473. package/dist/ontology/refs.d.ts +2 -0
  474. package/dist/ontology/refs.d.ts.map +1 -1
  475. package/dist/ontology/tokens.d.ts +2 -1
  476. package/dist/ontology/tokens.d.ts.map +1 -1
  477. package/dist/pipelines/execution.d.ts.map +1 -1
  478. package/dist/pipelines/index.js +57 -63
  479. package/dist/pipelines/index.js.map +1 -1
  480. package/dist/pipelines/request.d.ts.map +1 -1
  481. package/dist/projections/execution.d.ts.map +1 -1
  482. package/dist/projections/internal.js +58 -64
  483. package/dist/projections/internal.js.map +1 -1
  484. package/dist/projections/run-dispatch.d.ts.map +1 -1
  485. package/dist/query.d.ts +0 -1
  486. package/dist/query.d.ts.map +1 -1
  487. package/dist/query.js +11 -15
  488. package/dist/query.js.map +1 -1
  489. package/dist/queues/index.d.ts +2 -1
  490. package/dist/queues/index.d.ts.map +1 -1
  491. package/dist/queues/index.js +6 -7
  492. package/dist/queues/index.js.map +1 -1
  493. package/dist/queues/types.d.ts +3 -20
  494. package/dist/queues/types.d.ts.map +1 -1
  495. package/dist/rules/execution.d.ts.map +1 -1
  496. package/dist/rules/internal.js +4 -5
  497. package/dist/rules/internal.js.map +1 -1
  498. package/dist/runtime/create.d.ts +6 -2
  499. package/dist/runtime/create.d.ts.map +1 -1
  500. package/dist/runtime/definitions.d.ts +2 -0
  501. package/dist/runtime/definitions.d.ts.map +1 -1
  502. package/dist/runtime/host.d.ts +4 -1
  503. package/dist/runtime/host.d.ts.map +1 -1
  504. package/dist/runtime/internal.d.ts +1 -0
  505. package/dist/runtime/internal.d.ts.map +1 -1
  506. package/dist/runtime/internal.js +13 -14
  507. package/dist/runtime/internal.js.map +1 -1
  508. package/dist/runtime/resolve-definitions.d.ts +2 -0
  509. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  510. package/dist/runtime/sixb.d.ts +6 -0
  511. package/dist/runtime/sixb.d.ts.map +1 -1
  512. package/dist/runtime/types.d.ts +3 -0
  513. package/dist/runtime/types.d.ts.map +1 -1
  514. package/dist/sandboxes/errors.d.ts +4 -0
  515. package/dist/sandboxes/errors.d.ts.map +1 -1
  516. package/dist/sandboxes/index.d.ts +2 -2
  517. package/dist/sandboxes/index.d.ts.map +1 -1
  518. package/dist/sandboxes/index.js +14 -13
  519. package/dist/sandboxes/index.js.map +1 -1
  520. package/dist/sandboxes/sandbox.d.ts +35 -7
  521. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  522. package/dist/scheduler/index.js +9 -10
  523. package/dist/scheduler/index.js.map +1 -1
  524. package/dist/schedules/execution.d.ts +2 -1
  525. package/dist/schedules/execution.d.ts.map +1 -1
  526. package/dist/schedules/index.js +31 -33
  527. package/dist/schedules/index.js.map +1 -1
  528. package/dist/security/every.d.ts +4 -1
  529. package/dist/security/every.d.ts.map +1 -1
  530. package/dist/security/grants.d.ts +7 -2
  531. package/dist/security/grants.d.ts.map +1 -1
  532. package/dist/security/index.d.ts +1 -1
  533. package/dist/security/index.d.ts.map +1 -1
  534. package/dist/security/registry.d.ts +1 -0
  535. package/dist/security/registry.d.ts.map +1 -1
  536. package/dist/security/types.d.ts +7 -1
  537. package/dist/security/types.d.ts.map +1 -1
  538. package/dist/security/validation.d.ts +2 -0
  539. package/dist/security/validation.d.ts.map +1 -1
  540. package/dist/shares/access-plan.d.ts +22 -0
  541. package/dist/shares/access-plan.d.ts.map +1 -0
  542. package/dist/shares/builders.d.ts +14 -0
  543. package/dist/shares/builders.d.ts.map +1 -0
  544. package/dist/shares/compiler.d.ts +14 -0
  545. package/dist/shares/compiler.d.ts.map +1 -0
  546. package/dist/shares/errors.d.ts +4 -0
  547. package/dist/shares/errors.d.ts.map +1 -0
  548. package/dist/shares/execution.d.ts +57 -0
  549. package/dist/shares/execution.d.ts.map +1 -0
  550. package/dist/shares/index.d.ts +10 -0
  551. package/dist/shares/index.d.ts.map +1 -0
  552. package/dist/shares/internal.d.ts +3 -0
  553. package/dist/shares/internal.d.ts.map +1 -0
  554. package/dist/shares/internal.js +231 -0
  555. package/dist/shares/internal.js.map +10 -0
  556. package/dist/shares/intersection.d.ts +9 -0
  557. package/dist/shares/intersection.d.ts.map +1 -0
  558. package/dist/shares/session-protocol.d.ts +41 -0
  559. package/dist/shares/session-protocol.d.ts.map +1 -0
  560. package/dist/shares/types.d.ts +51 -0
  561. package/dist/shares/types.d.ts.map +1 -0
  562. package/dist/shares/validation.d.ts +11 -0
  563. package/dist/shares/validation.d.ts.map +1 -0
  564. package/dist/storage/action-runs/failure.js +7 -9
  565. package/dist/storage/action-runs/failure.js.map +1 -1
  566. package/dist/storage/action-runs/provider.js +4 -8
  567. package/dist/storage/action-runs/provider.js.map +1 -1
  568. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  569. package/dist/storage/agents/provider.js +26 -30
  570. package/dist/storage/agents/provider.js.map +1 -1
  571. package/dist/storage/agents/types.d.ts +0 -3
  572. package/dist/storage/agents/types.d.ts.map +1 -1
  573. package/dist/storage/ai-cost/attribution.d.ts +4 -0
  574. package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
  575. package/dist/storage/ai-cost/groups.d.ts +3 -0
  576. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  577. package/dist/storage/ai-cost/provider.d.ts +1 -0
  578. package/dist/storage/ai-cost/provider.d.ts.map +1 -1
  579. package/dist/storage/ai-cost/provider.js +30 -143
  580. package/dist/storage/ai-cost/provider.js.map +3 -4
  581. package/dist/storage/ai-cost/types.d.ts +15 -0
  582. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  583. package/dist/storage/ai-limits/enforcement.js +14 -16
  584. package/dist/storage/ai-limits/enforcement.js.map +1 -1
  585. package/dist/storage/ai-limits/provider.js +56 -57
  586. package/dist/storage/ai-limits/provider.js.map +1 -1
  587. package/dist/storage/auth/in-memory.d.ts +1 -1
  588. package/dist/storage/auth/in-memory.d.ts.map +1 -1
  589. package/dist/storage/connector-connections/provider.js +34 -36
  590. package/dist/storage/connector-connections/provider.js.map +2 -2
  591. package/dist/storage/executions/in-memory.d.ts +3 -0
  592. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  593. package/dist/storage/executions/provider.d.ts +6 -2
  594. package/dist/storage/executions/provider.d.ts.map +1 -1
  595. package/dist/storage/executions/provider.js +35 -12
  596. package/dist/storage/executions/provider.js.map +3 -3
  597. package/dist/storage/executions/run-link.d.ts +7 -0
  598. package/dist/storage/executions/run-link.d.ts.map +1 -1
  599. package/dist/storage/executions/types.d.ts +6 -2
  600. package/dist/storage/executions/types.d.ts.map +1 -1
  601. package/dist/storage/executions/validation.d.ts +8 -0
  602. package/dist/storage/executions/validation.d.ts.map +1 -1
  603. package/dist/storage/in-memory/index.d.ts +8 -0
  604. package/dist/storage/in-memory/index.d.ts.map +1 -1
  605. package/dist/storage/index.d.ts +14 -9
  606. package/dist/storage/index.d.ts.map +1 -1
  607. package/dist/storage/index.js +221 -227
  608. package/dist/storage/index.js.map +1 -1
  609. package/dist/storage/internal.d.ts +10 -0
  610. package/dist/storage/internal.d.ts.map +1 -0
  611. package/dist/storage/internal.js +47 -0
  612. package/dist/storage/internal.js.map +9 -0
  613. package/dist/storage/objects/execution-limits.d.ts +25 -0
  614. package/dist/storage/objects/execution-limits.d.ts.map +1 -0
  615. package/dist/storage/objects/guard.d.ts +16 -0
  616. package/dist/storage/objects/guard.d.ts.map +1 -0
  617. package/dist/storage/objects/in-memory/index.d.ts +3 -0
  618. package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
  619. package/dist/storage/objects/in-memory/keys.d.ts +10 -0
  620. package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
  621. package/dist/storage/objects/in-memory/query.d.ts +31 -0
  622. package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
  623. package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
  624. package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
  625. package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
  626. package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
  627. package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
  628. package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
  629. package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
  630. package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
  631. package/dist/storage/objects/index.d.ts +4 -1
  632. package/dist/storage/objects/index.d.ts.map +1 -1
  633. package/dist/storage/objects/keys.d.ts +1 -1
  634. package/dist/storage/objects/keys.d.ts.map +1 -1
  635. package/dist/storage/objects/read-scope.d.ts +25 -0
  636. package/dist/storage/objects/read-scope.d.ts.map +1 -0
  637. package/dist/storage/objects/types.d.ts +114 -22
  638. package/dist/storage/objects/types.d.ts.map +1 -1
  639. package/dist/storage/ontology/provider.js +105 -109
  640. package/dist/storage/ontology/provider.js.map +1 -1
  641. package/dist/storage/operation-scope.d.ts +3 -0
  642. package/dist/storage/operation-scope.d.ts.map +1 -1
  643. package/dist/storage/operation-scope.js +18 -17
  644. package/dist/storage/operation-scope.js.map +1 -1
  645. package/dist/storage/pipeline-runs/provider.js +4 -6
  646. package/dist/storage/pipeline-runs/provider.js.map +1 -1
  647. package/dist/storage/projection-runs/provider.js +66 -70
  648. package/dist/storage/projection-runs/provider.js.map +1 -1
  649. package/dist/storage/share-grants/errors.d.ts +8 -0
  650. package/dist/storage/share-grants/errors.d.ts.map +1 -0
  651. package/dist/storage/share-grants/in-memory.d.ts +11 -0
  652. package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
  653. package/dist/storage/share-grants/index.d.ts +5 -0
  654. package/dist/storage/share-grants/index.d.ts.map +1 -0
  655. package/dist/storage/share-grants/provider.d.ts +4 -0
  656. package/dist/storage/share-grants/provider.d.ts.map +1 -0
  657. package/dist/storage/share-grants/provider.js +22 -0
  658. package/dist/storage/share-grants/provider.js.map +9 -0
  659. package/dist/storage/share-grants/record.d.ts +11 -0
  660. package/dist/storage/share-grants/record.d.ts.map +1 -0
  661. package/dist/storage/share-grants/types.d.ts +97 -0
  662. package/dist/storage/share-grants/types.d.ts.map +1 -0
  663. package/dist/storage/share-sessions/errors.d.ts +8 -0
  664. package/dist/storage/share-sessions/errors.d.ts.map +1 -0
  665. package/dist/storage/share-sessions/in-memory.d.ts +14 -0
  666. package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
  667. package/dist/storage/share-sessions/index.d.ts +5 -0
  668. package/dist/storage/share-sessions/index.d.ts.map +1 -0
  669. package/dist/storage/share-sessions/provider.d.ts +3 -0
  670. package/dist/storage/share-sessions/provider.d.ts.map +1 -0
  671. package/dist/storage/share-sessions/provider.js +19 -0
  672. package/dist/storage/share-sessions/provider.js.map +9 -0
  673. package/dist/storage/share-sessions/record.d.ts +8 -0
  674. package/dist/storage/share-sessions/record.d.ts.map +1 -0
  675. package/dist/storage/share-sessions/types.d.ts +50 -0
  676. package/dist/storage/share-sessions/types.d.ts.map +1 -0
  677. package/dist/storage/sync-runs/provider.js +4 -6
  678. package/dist/storage/sync-runs/provider.js.map +1 -1
  679. package/dist/storage/transaction.d.ts +2 -1
  680. package/dist/storage/transaction.d.ts.map +1 -1
  681. package/dist/storage/types.d.ts +8 -0
  682. package/dist/storage/types.d.ts.map +1 -1
  683. package/dist/storage/webhook-runs/provider.js +4 -6
  684. package/dist/storage/webhook-runs/provider.js.map +1 -1
  685. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  686. package/dist/storage/workflow-runs/provider.js +13 -18
  687. package/dist/storage/workflow-runs/provider.js.map +1 -1
  688. package/dist/storage/workflow-runs/types.d.ts +0 -3
  689. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  690. package/dist/syncs/execution.d.ts.map +1 -1
  691. package/dist/syncs/index.js +55 -62
  692. package/dist/syncs/index.js.map +1 -1
  693. package/dist/syncs/request.d.ts.map +1 -1
  694. package/dist/testing/action-execution.d.ts +4 -1
  695. package/dist/testing/action-execution.d.ts.map +1 -1
  696. package/dist/testing/agent-execution.d.ts +1 -0
  697. package/dist/testing/agent-execution.d.ts.map +1 -1
  698. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  699. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  700. package/dist/testing/dataset-sequence-contract.d.ts +4 -0
  701. package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
  702. package/dist/testing/effective-storage-contract.d.ts.map +1 -1
  703. package/dist/testing/execution-storage-contract.d.ts +4 -0
  704. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  705. package/dist/testing/execution.d.ts +1 -0
  706. package/dist/testing/execution.d.ts.map +1 -1
  707. package/dist/testing/index.d.ts +3 -0
  708. package/dist/testing/index.d.ts.map +1 -1
  709. package/dist/testing/index.js +3087 -1328
  710. package/dist/testing/index.js.map +17 -13
  711. package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
  712. package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
  713. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  714. package/dist/testing/object-read-scope-contract.d.ts +22 -0
  715. package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
  716. package/dist/testing/share-grant-storage-contract.d.ts +10 -0
  717. package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
  718. package/dist/testing/share-session-storage-contract.d.ts +9 -0
  719. package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
  720. package/dist/testing/workflow-execution.d.ts +1 -0
  721. package/dist/testing/workflow-execution.d.ts.map +1 -1
  722. package/dist/webhooks/internal.js +51 -56
  723. package/dist/webhooks/internal.js.map +2 -2
  724. package/dist/workers/index.js +11 -13
  725. package/dist/workers/index.js.map +2 -2
  726. package/dist/workflows/execution.d.ts.map +1 -1
  727. package/dist/workflows/failure.d.ts +2 -0
  728. package/dist/workflows/failure.d.ts.map +1 -1
  729. package/dist/workflows/index.js +135 -140
  730. package/dist/workflows/index.js.map +1 -1
  731. package/dist/workflows/request.d.ts.map +1 -1
  732. package/dist/workflows/run-dispatch.d.ts +0 -1
  733. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  734. package/dist/workflows/types.d.ts +2 -0
  735. package/dist/workflows/types.d.ts.map +1 -1
  736. package/package.json +72 -30
  737. package/src/actions/delegated-admission.ts +72 -0
  738. package/src/actions/descriptor.ts +58 -0
  739. package/src/actions/execution.ts +99 -24
  740. package/src/actions/request.ts +136 -19
  741. package/src/actions/run-authorization.ts +53 -0
  742. package/src/actions/run-dispatch.ts +10 -7
  743. package/src/actions/types/context.ts +2 -0
  744. package/src/actions/validation.ts +2 -1
  745. package/src/agents/adapters.ts +34 -429
  746. package/src/agents/authority.ts +3 -4
  747. package/src/agents/{context.ts → context/entries.ts} +4 -4
  748. package/src/agents/context/index.ts +15 -0
  749. package/src/agents/context-model.ts +1 -1
  750. package/src/agents/context-resolution.ts +2 -5
  751. package/src/agents/errors.ts +0 -10
  752. package/src/agents/execution.ts +13 -5
  753. package/src/agents/identity.ts +4 -0
  754. package/src/agents/index.ts +5 -24
  755. package/src/agents/message.ts +5 -6
  756. package/src/agents/model-loop.ts +62 -6
  757. package/src/agents/request.ts +27 -29
  758. package/src/agents/streams/index.ts +18 -0
  759. package/src/agents/streams/internal.ts +19 -0
  760. package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
  761. package/src/agents/tool-definition.ts +0 -19
  762. package/src/agents/types.ts +1 -1
  763. package/src/agents/validation.ts +9 -72
  764. package/src/ai-usage/execution.ts +4 -11
  765. package/src/auth/index.ts +0 -1
  766. package/src/authorization/decision.ts +29 -14
  767. package/src/authorization/grant-kinds.ts +10 -0
  768. package/src/authorization/index.ts +1 -0
  769. package/src/bootstrap/discovery.ts +84 -24
  770. package/src/bootstrap/index.ts +8 -1
  771. package/src/bootstrap/ontology-type-manifest.ts +12 -6
  772. package/src/datasets/builders.ts +23 -2
  773. package/src/datasets/changes.ts +16 -4
  774. package/src/datasets/execution.ts +76 -5
  775. package/src/datasets/index.ts +1 -0
  776. package/src/datasets/sequence.ts +77 -0
  777. package/src/datasets/types.ts +1 -0
  778. package/src/datasets/validation.ts +26 -0
  779. package/src/datasets/write.ts +240 -0
  780. package/src/errors/internal.ts +90 -10
  781. package/src/errors/redaction.ts +98 -0
  782. package/src/errors/types.ts +4 -0
  783. package/src/events/execution.ts +57 -7
  784. package/src/events/types/datasets.ts +2 -6
  785. package/src/execution/agent.ts +6 -7
  786. package/src/execution/authorization.ts +470 -90
  787. package/src/execution/authorized-object-reader.ts +695 -0
  788. package/src/execution/durable.ts +21 -3
  789. package/src/execution/index.ts +1 -0
  790. package/src/execution/primitive.ts +5 -1
  791. package/src/execution/request.ts +66 -13
  792. package/src/execution/scopes.ts +36 -6
  793. package/src/execution/types.ts +8 -0
  794. package/src/http/api-routes.ts +45 -0
  795. package/src/index.ts +56 -33
  796. package/src/lake-storage/definition-updates.ts +9 -0
  797. package/src/lake-storage/errors.ts +6 -1
  798. package/src/lake-storage/in-memory.ts +53 -17
  799. package/src/lake-storage/index.ts +10 -1
  800. package/src/lake-storage/merge-validation.ts +12 -2
  801. package/src/lake-storage/merge.ts +40 -2
  802. package/src/lake-storage/source-ordering.ts +95 -0
  803. package/src/lake-storage/sql-transforms.ts +2 -1
  804. package/src/lake-storage/types.ts +10 -5
  805. package/src/lake-storage/version-inputs.ts +14 -0
  806. package/src/logging/index.ts +2 -33
  807. package/src/logging/internal.ts +43 -0
  808. package/src/models/errors.ts +12 -0
  809. package/src/models/execution/binding.ts +29 -0
  810. package/src/models/execution/errors.ts +18 -0
  811. package/src/models/execution/index.ts +26 -0
  812. package/src/models/execution/model-call-accounting.ts +211 -0
  813. package/src/models/execution/model-call-admission.ts +127 -0
  814. package/src/models/execution/model-call-limits.ts +135 -0
  815. package/src/models/execution/model-call-recorder.ts +235 -0
  816. package/src/models/execution/model-call-recovery.ts +125 -0
  817. package/src/models/execution/recovery-queue.ts +31 -0
  818. package/src/models/execution/types.ts +58 -0
  819. package/src/models/execution/usage.ts +23 -0
  820. package/src/models/execution.ts +207 -0
  821. package/src/models/generation-types.ts +50 -0
  822. package/src/models/index.ts +8 -0
  823. package/src/models/language-model.ts +3 -0
  824. package/src/models/output.ts +45 -0
  825. package/src/models/resolve.ts +27 -0
  826. package/src/objects/authorized-ontology-view.ts +512 -0
  827. package/src/objects/execution.ts +99 -144
  828. package/src/objects/link/authorization.ts +3 -2
  829. package/src/objects/query/executor.ts +45 -34
  830. package/src/objects/query/links.ts +84 -25
  831. package/src/objects/query/selected-read-admission.ts +310 -0
  832. package/src/objects/query/validate.ts +353 -36
  833. package/src/objects/sdk/object-handle.ts +2 -8
  834. package/src/objects/sdk/object-set.ts +10 -11
  835. package/src/objects/sdk/runtime-query-executor.ts +8 -28
  836. package/src/objects/sdk/telemetry-channel.ts +11 -7
  837. package/src/objects/service/list-service.ts +15 -29
  838. package/src/objects/telemetry/history.ts +297 -17
  839. package/src/objects/telemetry/index.ts +2 -2
  840. package/src/objects/telemetry/workload.ts +79 -0
  841. package/src/ontology/index.ts +7 -2
  842. package/src/ontology/inference/index.ts +4 -1
  843. package/src/ontology/internal.ts +35 -1
  844. package/src/ontology/json-schema.ts +13 -12
  845. package/src/ontology/link-path-selection.ts +193 -0
  846. package/src/ontology/refs.ts +19 -0
  847. package/src/ontology/tokens.ts +15 -8
  848. package/src/pipelines/execution.ts +30 -7
  849. package/src/pipelines/request.ts +5 -0
  850. package/src/projections/execution.ts +72 -11
  851. package/src/projections/run-dispatch.ts +7 -12
  852. package/src/query.ts +0 -1
  853. package/src/queues/index.ts +4 -2
  854. package/src/queues/types.ts +6 -25
  855. package/src/rules/execution.ts +20 -8
  856. package/src/runtime/create.ts +7 -2
  857. package/src/runtime/definitions.ts +2 -0
  858. package/src/runtime/host.ts +27 -7
  859. package/src/runtime/internal.ts +1 -0
  860. package/src/runtime/resolve-definitions.ts +9 -0
  861. package/src/runtime/sixb.ts +27 -2
  862. package/src/runtime/types.ts +3 -0
  863. package/src/sandboxes/errors.ts +5 -0
  864. package/src/sandboxes/index.ts +3 -0
  865. package/src/sandboxes/sandbox.ts +35 -7
  866. package/src/schedules/execution.ts +24 -2
  867. package/src/security/every.ts +4 -0
  868. package/src/security/grants.ts +45 -3
  869. package/src/security/index.ts +1 -0
  870. package/src/security/registry.ts +3 -0
  871. package/src/security/types.ts +8 -0
  872. package/src/security/validation.ts +3 -0
  873. package/src/shares/access-plan.ts +225 -0
  874. package/src/shares/builders.ts +381 -0
  875. package/src/shares/compiler.ts +359 -0
  876. package/src/shares/errors.ts +3 -0
  877. package/src/shares/execution.ts +394 -0
  878. package/src/shares/index.ts +28 -0
  879. package/src/shares/internal.ts +9 -0
  880. package/src/shares/intersection.ts +178 -0
  881. package/src/shares/session-protocol.ts +258 -0
  882. package/src/shares/types.ts +76 -0
  883. package/src/shares/validation.ts +40 -0
  884. package/src/storage/agents/in-memory.ts +0 -3
  885. package/src/storage/agents/types.ts +0 -3
  886. package/src/storage/ai-cost/analytics.ts +1 -1
  887. package/src/storage/ai-cost/attribution.ts +15 -0
  888. package/src/storage/ai-cost/groups.ts +5 -1
  889. package/src/storage/ai-cost/provider.ts +1 -0
  890. package/src/storage/ai-cost/types.ts +7 -0
  891. package/src/storage/auth/in-memory.ts +1 -1
  892. package/src/storage/executions/in-memory.ts +13 -10
  893. package/src/storage/executions/provider.ts +34 -1
  894. package/src/storage/executions/run-link.ts +29 -0
  895. package/src/storage/executions/types.ts +6 -2
  896. package/src/storage/executions/validation.ts +78 -1
  897. package/src/storage/in-memory/index.ts +37 -3
  898. package/src/storage/index.ts +54 -29
  899. package/src/storage/internal.ts +20 -0
  900. package/src/storage/objects/execution-limits.ts +283 -0
  901. package/src/storage/objects/guard.ts +55 -0
  902. package/src/storage/objects/in-memory/index.ts +2 -0
  903. package/src/storage/objects/in-memory/keys.ts +46 -0
  904. package/src/storage/objects/in-memory/query.ts +754 -0
  905. package/src/storage/objects/in-memory/read-scope.ts +211 -0
  906. package/src/storage/objects/in-memory/read-source.ts +10 -0
  907. package/src/storage/objects/in-memory/selected-reader.ts +252 -0
  908. package/src/storage/objects/in-memory/storage.ts +589 -0
  909. package/src/storage/objects/index.ts +21 -0
  910. package/src/storage/objects/keys.ts +1 -1
  911. package/src/storage/objects/read-scope.ts +672 -0
  912. package/src/storage/objects/types.ts +123 -19
  913. package/src/storage/operation-scope.ts +16 -0
  914. package/src/storage/share-grants/errors.ts +14 -0
  915. package/src/storage/share-grants/in-memory.ts +107 -0
  916. package/src/storage/share-grants/index.ts +14 -0
  917. package/src/storage/share-grants/provider.ts +11 -0
  918. package/src/storage/share-grants/record.ts +347 -0
  919. package/src/storage/share-grants/types.ts +112 -0
  920. package/src/storage/share-sessions/errors.ts +14 -0
  921. package/src/storage/share-sessions/in-memory.ts +105 -0
  922. package/src/storage/share-sessions/index.ts +11 -0
  923. package/src/storage/share-sessions/provider.ts +9 -0
  924. package/src/storage/share-sessions/record.ts +176 -0
  925. package/src/storage/share-sessions/types.ts +57 -0
  926. package/src/storage/transaction.ts +14 -2
  927. package/src/storage/types.ts +27 -0
  928. package/src/storage/workflow-runs/in-memory.ts +0 -2
  929. package/src/storage/workflow-runs/types.ts +0 -3
  930. package/src/syncs/execution.ts +25 -5
  931. package/src/syncs/request.ts +5 -0
  932. package/src/testing/action-execution.ts +9 -2
  933. package/src/testing/agent-execution.ts +3 -0
  934. package/src/testing/agent-storage-contract.ts +0 -5
  935. package/src/testing/ai-model-call-groups-contract.ts +74 -2
  936. package/src/testing/dataset-sequence-contract.ts +373 -0
  937. package/src/testing/effective-storage-contract.ts +34 -0
  938. package/src/testing/execution-storage-contract.ts +138 -1
  939. package/src/testing/execution.ts +6 -0
  940. package/src/testing/index.ts +16 -0
  941. package/src/testing/lake-merge-storage-contract.ts +3 -0
  942. package/src/testing/lake-storage-contract.ts +58 -0
  943. package/src/testing/object-read-scope-contract.ts +939 -0
  944. package/src/testing/share-grant-storage-contract.ts +325 -0
  945. package/src/testing/share-session-storage-contract.ts +235 -0
  946. package/src/testing/workflow-execution.ts +4 -0
  947. package/src/workflows/execution.ts +53 -14
  948. package/src/workflows/failure.ts +62 -1
  949. package/src/workflows/request.ts +5 -9
  950. package/src/workflows/run-dispatch.ts +0 -3
  951. package/src/workflows/types.ts +2 -0
  952. package/src/workflows/validation.ts +1 -1
  953. package/dist/agents/context.d.ts.map +0 -1
  954. package/dist/agents/context.js +0 -23
  955. package/dist/agents/streams.d.ts.map +0 -1
  956. package/dist/agents/streams.js +0 -55
  957. package/dist/chunk-08m3b6w8.js +0 -32
  958. package/dist/chunk-08twe8m6.js +0 -218
  959. package/dist/chunk-2b5qtban.js.map +0 -14
  960. package/dist/chunk-2xns679x.js.map +0 -11
  961. package/dist/chunk-37wk412q.js +0 -1370
  962. package/dist/chunk-37wk412q.js.map +0 -23
  963. package/dist/chunk-3fqt22c4.js.map +0 -14
  964. package/dist/chunk-3kv70xwp.js.map +0 -10
  965. package/dist/chunk-407j3msh.js +0 -60
  966. package/dist/chunk-64sr682n.js.map +0 -12
  967. package/dist/chunk-6ed5bwnd.js.map +0 -57
  968. package/dist/chunk-7ds9620f.js.map +0 -10
  969. package/dist/chunk-7y0f6rf1.js.map +0 -10
  970. package/dist/chunk-atmkaf60.js.map +0 -11
  971. package/dist/chunk-c15dr03f.js +0 -43
  972. package/dist/chunk-d8qkxt2v.js.map +0 -10
  973. package/dist/chunk-dqn23610.js +0 -72
  974. package/dist/chunk-dqn23610.js.map +0 -11
  975. package/dist/chunk-e4rvtvpw.js.map +0 -34
  976. package/dist/chunk-gbrpsx4m.js.map +0 -11
  977. package/dist/chunk-h0knpbz5.js +0 -2486
  978. package/dist/chunk-h0knpbz5.js.map +0 -38
  979. package/dist/chunk-hdz94br2.js.map +0 -10
  980. package/dist/chunk-jq43kdvk.js +0 -50
  981. package/dist/chunk-n2arzn6e.js +0 -1745
  982. package/dist/chunk-n2arzn6e.js.map +0 -20
  983. package/dist/chunk-p03r0h5s.js.map +0 -16
  984. package/dist/chunk-qjzp9xyb.js.map +0 -12
  985. package/dist/chunk-tn7xcs2n.js.map +0 -13
  986. package/dist/chunk-wjgm6jjt.js.map +0 -13
  987. package/dist/chunk-xc7hq65b.js.map +0 -10
  988. package/dist/chunk-y35ma3mj.js +0 -551
  989. package/dist/chunk-y35ma3mj.js.map +0 -15
  990. package/dist/chunk-y64skrwp.js +0 -19
  991. package/dist/chunk-z2sery1b.js.map +0 -11
  992. package/dist/chunk-zcnhxkvd.js +0 -7
  993. package/dist/logging/types.js +0 -27
  994. package/dist/logging/types.js.map +0 -9
  995. package/dist/storage/objects/in-memory.d.ts.map +0 -1
  996. package/src/storage/objects/in-memory.ts +0 -1241
  997. /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
  998. /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
  999. /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
@@ -1,37 +1,48 @@
1
1
  // @bun
2
2
  import {
3
- AuthRuntimeError,
4
- assertNonEmpty,
5
- getCookie,
6
- isInvitationDeliveryAuthStrategy,
7
- normalizePagination,
8
- resolveAuthConfig,
3
+ GRANT_KINDS,
4
+ grantKindOf,
5
+ canAccessApplication2,
6
+ resolveRoleGrants2,
7
+ resolveAuthorizationContext2
8
+ } from "./chunk-dz5h08xv.js";
9
+ import {
10
+ normalizeSchemaValue2,
11
+ coerceSchemaValueToTyped2
12
+ } from "./chunk-ms2tmn1k.js";
13
+ import {
14
+ AuthRuntimeError2,
15
+ resolveAuthSessionAudience2,
9
16
  resolveAuthCookieOptionsForAudience,
10
- resolveAuthSessionAudience,
17
+ getCookie2,
18
+ resolveAuthConfig2,
11
19
  resolveInvitationExpiresAt,
12
- sanitizeReturnTo
13
- } from "./chunk-xwnf87e1.js";
20
+ sanitizeReturnTo,
21
+ assertNonEmpty3,
22
+ normalizePagination,
23
+ isInvitationDeliveryAuthStrategy2
24
+ } from "./chunk-q5gz3g2j.js";
14
25
  import {
15
- GRANT_KINDS,
16
- canAccessApplication,
17
- grantKindOf,
18
- resolveAuthorizationContext,
19
- resolveRoleGrants
20
- } from "./chunk-37wk412q.js";
26
+ validateSchemaOrRefValue2,
27
+ snapshotLinkPathSelection
28
+ } from "./chunk-f0rwz2vh.js";
29
+ import {
30
+ OntologyValidationError2
31
+ } from "./chunk-cqr3acm1.js";
21
32
 
22
33
  // src/auth/access-tokens.ts
23
34
  import { createHash, randomBytes, randomUUID } from "crypto";
24
- var PERSONAL_ACCESS_TOKEN_PREFIX = "sixb_pat";
25
- var SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX = "sixb_sat";
35
+ var PERSONAL_ACCESS_TOKEN_PREFIX2 = "sixb_pat";
36
+ var SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2 = "sixb_sat";
26
37
  var ACCESS_TOKEN_ID_PATTERN = /^tok_[A-Za-z0-9_-]+$/;
27
38
  var ACCESS_TOKEN_SECRET_PATTERN = /^[A-Za-z0-9_-]{32,}$/;
28
- function generateAccessTokenSecret() {
39
+ function generateAccessTokenSecret2() {
29
40
  return randomBytes(32).toString("base64url");
30
41
  }
31
- function hashAccessTokenSecret(secret) {
42
+ function hashAccessTokenSecret2(secret) {
32
43
  return createHash("sha256").update(secret).digest("hex");
33
44
  }
34
- function formatAccessTokenValue(kind, tokenId, tokenSecret) {
45
+ function formatAccessTokenValue2(kind, tokenId, tokenSecret) {
35
46
  const prefix = accessTokenPrefixForKind(kind);
36
47
  if (!ACCESS_TOKEN_ID_PATTERN.test(tokenId)) {
37
48
  throw new Error("[Sixb] Access token ids must start with 'tok_' and be URL-safe.");
@@ -41,7 +52,7 @@ function formatAccessTokenValue(kind, tokenId, tokenSecret) {
41
52
  }
42
53
  return `${prefix}_${tokenId}.${tokenSecret}`;
43
54
  }
44
- function parseAccessTokenValue(value) {
55
+ function parseAccessTokenValue2(value) {
45
56
  if (!value) {
46
57
  return null;
47
58
  }
@@ -61,7 +72,7 @@ function parseAccessTokenValue(value) {
61
72
  }
62
73
  return { kind, tokenId, tokenSecret };
63
74
  }
64
- function getBearerAccessTokenValue(request) {
75
+ function getBearerAccessTokenValue2(request) {
65
76
  const header = request.headers.get("authorization");
66
77
  if (!header) {
67
78
  return null;
@@ -72,49 +83,49 @@ function getBearerAccessTokenValue(request) {
72
83
  }
73
84
  return token;
74
85
  }
75
- function createAccessTokenCredential(kind, tokenId = `tok_${randomUUID()}`) {
76
- const tokenSecret = generateAccessTokenSecret();
86
+ function createAccessTokenCredential2(kind, tokenId = `tok_${randomUUID()}`) {
87
+ const tokenSecret = generateAccessTokenSecret2();
77
88
  return {
78
89
  kind,
79
90
  tokenId,
80
91
  tokenSecret,
81
- tokenHash: hashAccessTokenSecret(tokenSecret),
82
- tokenValue: formatAccessTokenValue(kind, tokenId, tokenSecret)
92
+ tokenHash: hashAccessTokenSecret2(tokenSecret),
93
+ tokenValue: formatAccessTokenValue2(kind, tokenId, tokenSecret)
83
94
  };
84
95
  }
85
96
  function accessTokenPrefixForKind(kind) {
86
97
  switch (kind) {
87
98
  case "personal":
88
- return PERSONAL_ACCESS_TOKEN_PREFIX;
99
+ return PERSONAL_ACCESS_TOKEN_PREFIX2;
89
100
  case "serviceAccount":
90
- return SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX;
101
+ return SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2;
91
102
  }
92
103
  }
93
104
  function accessTokenKindFromLabel(label) {
94
- if (label.startsWith(`${PERSONAL_ACCESS_TOKEN_PREFIX}_`)) {
105
+ if (label.startsWith(`${PERSONAL_ACCESS_TOKEN_PREFIX2}_`)) {
95
106
  return "personal";
96
107
  }
97
- if (label.startsWith(`${SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX}_`)) {
108
+ if (label.startsWith(`${SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2}_`)) {
98
109
  return "serviceAccount";
99
110
  }
100
111
  return null;
101
112
  }
102
113
  // src/auth/csrf.ts
103
114
  import { randomBytes as randomBytes2, timingSafeEqual } from "crypto";
104
- var CSRF_HEADER_NAME = "x-sixb-csrf";
105
- function generateCsrfToken() {
115
+ var CSRF_HEADER_NAME2 = "x-sixb-csrf";
116
+ function generateCsrfToken2() {
106
117
  return randomBytes2(32).toString("base64url");
107
118
  }
108
- function isCsrfExemptMethod(method) {
119
+ function isCsrfExemptMethod2(method) {
109
120
  const normalized = method.toUpperCase();
110
121
  return normalized === "GET" || normalized === "HEAD" || normalized === "OPTIONS";
111
122
  }
112
- function verifyDoubleSubmitCsrf(request, options) {
113
- if (isCsrfExemptMethod(request.method)) {
123
+ function verifyDoubleSubmitCsrf2(request, options) {
124
+ if (isCsrfExemptMethod2(request.method)) {
114
125
  return true;
115
126
  }
116
- const cookieValue = getCookie(request, options.cookieName);
117
- const headerValue = request.headers.get(options.headerName ?? CSRF_HEADER_NAME);
127
+ const cookieValue = getCookie2(request, options.cookieName);
128
+ const headerValue = request.headers.get(options.headerName ?? CSRF_HEADER_NAME2);
118
129
  if (!cookieValue || !headerValue) {
119
130
  return false;
120
131
  }
@@ -132,13 +143,13 @@ function safeEqual(left, right) {
132
143
  import { randomUUID as randomUUID3 } from "crypto";
133
144
 
134
145
  // src/security/applications.ts
135
- var applications = {
146
+ var applications2 = {
136
147
  atlas: { kind: "application", id: "atlas", label: "Atlas" },
137
148
  app: { kind: "application", id: "app", label: "Custom app" }
138
149
  };
139
- var APPLICATION_IDS = new Set(Object.values(applications).map((application) => application.id));
150
+ var APPLICATION_IDS = new Set(Object.values(applications2).map((application) => application.id));
140
151
  // src/security/errors.ts
141
- class SecurityValidationError extends Error {
152
+ class SecurityValidationError2 extends Error {
142
153
  name = "SecurityValidationError";
143
154
  }
144
155
 
@@ -210,6 +221,7 @@ var GRANT_CAPABILITIES = Object.keys({
210
221
  edit: true,
211
222
  append: true,
212
223
  apply: true,
224
+ share: true,
213
225
  run: true,
214
226
  observe: true,
215
227
  manage: true
@@ -222,12 +234,12 @@ function formatAlternatives(values) {
222
234
  function isRecord(value) {
223
235
  return typeof value === "object" && value !== null && !Array.isArray(value);
224
236
  }
225
- function assertNonEmptyString(value, field, createError = (message) => new SecurityValidationError(message)) {
237
+ function assertNonEmptyString(value, field, createError = (message) => new SecurityValidationError2(message)) {
226
238
  if (typeof value !== "string" || value.trim().length === 0) {
227
239
  throw createError(`[Sixb] ${field} must not be empty.`);
228
240
  }
229
241
  }
230
- function assertOptionalString(value, field, createError = (message) => new SecurityValidationError(message)) {
242
+ function assertOptionalString(value, field, createError = (message) => new SecurityValidationError2(message)) {
231
243
  if (value === undefined) {
232
244
  return;
233
245
  }
@@ -257,7 +269,7 @@ function assertNoDuplicateIds(ids, field) {
257
269
  const seen = new Set;
258
270
  for (const id of ids) {
259
271
  if (seen.has(id)) {
260
- throw new SecurityValidationError(`[Sixb] ${field} contains duplicate group id '${id}'.`);
272
+ throw new SecurityValidationError2(`[Sixb] ${field} contains duplicate group id '${id}'.`);
261
273
  }
262
274
  seen.add(id);
263
275
  }
@@ -266,12 +278,12 @@ function assertNoDuplicateOperations(operations, field) {
266
278
  const seen = new Set;
267
279
  for (const operation of operations) {
268
280
  if (seen.has(operation)) {
269
- throw new SecurityValidationError(`[Sixb] ${field} contains duplicate operation '${operation}'.`);
281
+ throw new SecurityValidationError2(`[Sixb] ${field} contains duplicate operation '${operation}'.`);
270
282
  }
271
283
  seen.add(operation);
272
284
  }
273
285
  }
274
- function assertGroupDefinition(value, createError = (message) => new SecurityValidationError(message)) {
286
+ function assertGroupDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
275
287
  if (!isRecord(value)) {
276
288
  throw createError("[Sixb] Group definition must be an object.");
277
289
  }
@@ -290,7 +302,7 @@ function isGroupDefinition(value) {
290
302
  return false;
291
303
  }
292
304
  }
293
- function assertMembershipPolicyDefinition(value, createError = (message) => new SecurityValidationError(message)) {
305
+ function assertMembershipPolicyDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
294
306
  if (!isRecord(value)) {
295
307
  throw createError("[Sixb] Membership policy definition must be an object.");
296
308
  }
@@ -310,7 +322,7 @@ function isMembershipPolicyDefinition(value) {
310
322
  return false;
311
323
  }
312
324
  }
313
- function assertGrantDefinition(value, field, createError = (message) => new SecurityValidationError(message)) {
325
+ function assertGrantDefinition(value, field, createError = (message) => new SecurityValidationError2(message)) {
314
326
  if (!isRecord(value) || value.kind !== "grant") {
315
327
  throw createError(`[Sixb] ${field} must contain only grant definitions from 'can'.`);
316
328
  }
@@ -352,7 +364,7 @@ function assertSelection(value, field, createError) {
352
364
  assertNonEmptyString(id, `${field} grant selection id`, createError);
353
365
  }
354
366
  }
355
- function assertRoleDefinition(value, createError = (message) => new SecurityValidationError(message)) {
367
+ function assertRoleDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
356
368
  if (!isRecord(value)) {
357
369
  throw createError("[Sixb] Role definition must be an object.");
358
370
  }
@@ -385,25 +397,25 @@ function validateSecurityDefinitionsAtStartup(input) {
385
397
  for (const group of input.groups) {
386
398
  assertGroupDefinition(group);
387
399
  if (groupsById.has(group.id)) {
388
- throw new SecurityValidationError(`[Sixb] Duplicate group id: ${group.id}`);
400
+ throw new SecurityValidationError2(`[Sixb] Duplicate group id: ${group.id}`);
389
401
  }
390
402
  groupsById.set(group.id, group);
391
403
  }
392
404
  for (const role of input.roles ?? []) {
393
405
  assertRoleDefinition(role);
394
406
  if (rolesById.has(role.id)) {
395
- throw new SecurityValidationError(`[Sixb] Duplicate role id: ${role.id}`);
407
+ throw new SecurityValidationError2(`[Sixb] Duplicate role id: ${role.id}`);
396
408
  }
397
409
  if (role.grantedToGroupIds.length === 0) {
398
- throw new SecurityValidationError(`[Sixb] Role '${role.id}' must be granted to at least one group.`);
410
+ throw new SecurityValidationError2(`[Sixb] Role '${role.id}' must be granted to at least one group.`);
399
411
  }
400
412
  if (role.grants.length === 0) {
401
- throw new SecurityValidationError(`[Sixb] Role '${role.id}' must declare at least one grant.`);
413
+ throw new SecurityValidationError2(`[Sixb] Role '${role.id}' must declare at least one grant.`);
402
414
  }
403
415
  assertNoDuplicateIds(role.grantedToGroupIds, `Role '${role.id}' grantedTo`);
404
416
  for (const groupId of role.grantedToGroupIds) {
405
417
  if (!groupsById.has(groupId)) {
406
- throw new SecurityValidationError(`[Sixb] Role '${role.id}' grantedTo references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
418
+ throw new SecurityValidationError2(`[Sixb] Role '${role.id}' grantedTo references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
407
419
  }
408
420
  }
409
421
  for (const grant of role.grants) {
@@ -414,25 +426,25 @@ function validateSecurityDefinitionsAtStartup(input) {
414
426
  for (const policy of input.membershipPolicies) {
415
427
  assertMembershipPolicyDefinition(policy);
416
428
  if (membershipPoliciesById.has(policy.id)) {
417
- throw new SecurityValidationError(`[Sixb] Duplicate membership policy id: ${policy.id}`);
429
+ throw new SecurityValidationError2(`[Sixb] Duplicate membership policy id: ${policy.id}`);
418
430
  }
419
431
  if (policy.grantedToGroupIds.length === 0) {
420
- throw new SecurityValidationError(`[Sixb] Membership policy '${policy.id}' must grant membership authority to at least one group.`);
432
+ throw new SecurityValidationError2(`[Sixb] Membership policy '${policy.id}' must grant membership authority to at least one group.`);
421
433
  }
422
434
  if (policy.can.length === 0) {
423
- throw new SecurityValidationError(`[Sixb] Membership policy '${policy.id}' must declare at least one operation.`);
435
+ throw new SecurityValidationError2(`[Sixb] Membership policy '${policy.id}' must declare at least one operation.`);
424
436
  }
425
437
  assertNoDuplicateIds(policy.grantedToGroupIds, `Membership policy '${policy.id}' grantedTo`);
426
438
  assertNoDuplicateIds(policy.scopeGroupIds, `Membership policy '${policy.id}' scope`);
427
439
  assertNoDuplicateOperations(policy.can, `Membership policy '${policy.id}' can`);
428
440
  for (const groupId of policy.grantedToGroupIds) {
429
441
  if (!groupsById.has(groupId)) {
430
- throw new SecurityValidationError(`[Sixb] Membership policy '${policy.id}' grantedTo references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
442
+ throw new SecurityValidationError2(`[Sixb] Membership policy '${policy.id}' grantedTo references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
431
443
  }
432
444
  }
433
445
  for (const groupId of policy.scopeGroupIds) {
434
446
  if (!groupsById.has(groupId)) {
435
- throw new SecurityValidationError(`[Sixb] Membership policy '${policy.id}' scope references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
447
+ throw new SecurityValidationError2(`[Sixb] Membership policy '${policy.id}' scope references unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
436
448
  }
437
449
  }
438
450
  membershipPoliciesById.set(policy.id, policy);
@@ -448,9 +460,9 @@ function validateSecurityDefinitionsAtStartup(input) {
448
460
  }
449
461
  function assertGrantReferences(roleId, grant, registered) {
450
462
  if (grant.capability === "run" && grant.target === "agent") {
451
- const spec2 = GRANT_KINDS[grantKindOf(grant)];
463
+ const spec = GRANT_KINDS[grantKindOf(grant)];
452
464
  if (!registered.agentAvailable) {
453
- throw new SecurityValidationError(`[Sixb] Role '${roleId}' grants ${grant.capability} on the project Agent, but it is unavailable. ${spec2.fix}`);
465
+ throw new SecurityValidationError2(`[Sixb] Role '${roleId}' grants ${grant.capability} on the project Agent, but it is unavailable. ${spec.fix}`);
454
466
  }
455
467
  return;
456
468
  }
@@ -462,7 +474,7 @@ function assertGrantReferences(roleId, grant, registered) {
462
474
  const ids = grant.selection.all ? grant.selection.except : grant.selection.ids;
463
475
  for (const id of ids) {
464
476
  if (!universe.has(id)) {
465
- throw new SecurityValidationError(`[Sixb] Role '${roleId}' grants ${grant.capability} on unknown ${spec.subject} '${id}'. ${spec.fix}`);
477
+ throw new SecurityValidationError2(`[Sixb] Role '${roleId}' grants ${grant.capability} on unknown ${spec.subject} '${id}'. ${spec.fix}`);
466
478
  }
467
479
  }
468
480
  }
@@ -471,13 +483,13 @@ function assertGrantReferences(roleId, grant, registered) {
471
483
  var MEMBERSHIP_OPERATIONS2 = new Set(["invite", "assignGroups", "suspend"]);
472
484
  function assertNonEmptyArray(value, field) {
473
485
  if (value.length === 0) {
474
- throw new SecurityValidationError(`[Sixb] ${field} must not be empty.`);
486
+ throw new SecurityValidationError2(`[Sixb] ${field} must not be empty.`);
475
487
  }
476
488
  }
477
489
  function groupIdsFrom(groups, field) {
478
490
  return groups.map((group) => {
479
491
  if (!isRecord(group) || group.kind !== "group") {
480
- throw new SecurityValidationError(`[Sixb] ${field} must contain only group definitions.`);
492
+ throw new SecurityValidationError2(`[Sixb] ${field} must contain only group definitions.`);
481
493
  }
482
494
  assertNonEmptyString(group.id, `${field} group id`);
483
495
  return group.id;
@@ -486,12 +498,12 @@ function groupIdsFrom(groups, field) {
486
498
  function membershipOperationsFrom(operations, field) {
487
499
  return operations.map((operation) => {
488
500
  if (!MEMBERSHIP_OPERATIONS2.has(operation)) {
489
- throw new SecurityValidationError(`[Sixb] ${field} must contain only membership operations: invite, assignGroups, suspend.`);
501
+ throw new SecurityValidationError2(`[Sixb] ${field} must contain only membership operations: invite, assignGroups, suspend.`);
490
502
  }
491
503
  return operation;
492
504
  });
493
505
  }
494
- function defineGroup(id, options = {}) {
506
+ function defineGroup2(id, options = {}) {
495
507
  assertNonEmptyString(id, "Group id");
496
508
  assertOptionalString(options.label, `Group '${id}' label`);
497
509
  assertOptionalString(options.description, `Group '${id}' description`);
@@ -502,7 +514,7 @@ function defineGroup(id, options = {}) {
502
514
  ...options.description !== undefined ? { description: options.description } : {}
503
515
  };
504
516
  }
505
- function defineRole(id, options) {
517
+ function defineRole2(id, options) {
506
518
  assertNonEmptyString(id, "Role id");
507
519
  assertOptionalString(options.label, `Role '${id}' label`);
508
520
  assertOptionalString(options.description, `Role '${id}' description`);
@@ -512,7 +524,7 @@ function defineRole(id, options) {
512
524
  assertGrantDefinition(grant, `Role '${id}' grants`);
513
525
  }
514
526
  if (options.grants.length === 0) {
515
- throw new SecurityValidationError(`[Sixb] Role '${id}' grants must not be empty.`);
527
+ throw new SecurityValidationError2(`[Sixb] Role '${id}' grants must not be empty.`);
516
528
  }
517
529
  return {
518
530
  kind: "role",
@@ -523,7 +535,7 @@ function defineRole(id, options) {
523
535
  grants: options.grants
524
536
  };
525
537
  }
526
- function defineMembershipPolicy(id, options) {
538
+ function defineMembershipPolicy2(id, options) {
527
539
  assertNonEmptyString(id, "Membership policy id");
528
540
  assertNonEmptyArray(options.grantedTo, `Membership policy '${id}' grantedTo`);
529
541
  assertNonEmptyArray(options.can, `Membership policy '${id}' can`);
@@ -544,7 +556,8 @@ var BREADTH_TARGETS = [
544
556
  "sync",
545
557
  "pipeline",
546
558
  "application",
547
- "connector"
559
+ "connector",
560
+ "share"
548
561
  ];
549
562
  function isBreadthSelector(value) {
550
563
  if (typeof value !== "object" || value === null)
@@ -554,7 +567,7 @@ function isBreadthSelector(value) {
554
567
  }
555
568
  function definitionIdOf(item, label) {
556
569
  if (typeof item?.id !== "string" || !item.id.trim()) {
557
- throw new SecurityValidationError(`[Sixb] ${label} requires definitions with a non-empty id.`);
570
+ throw new SecurityValidationError2(`[Sixb] ${label} requires definitions with a non-empty id.`);
558
571
  }
559
572
  return item.id;
560
573
  }
@@ -570,7 +583,7 @@ function all(target, except = []) {
570
583
  }
571
584
  };
572
585
  }
573
- var every = {
586
+ var every2 = {
574
587
  object: () => all("object"),
575
588
  dataset: () => all("dataset"),
576
589
  action: () => all("action"),
@@ -578,8 +591,405 @@ var every = {
578
591
  sync: () => all("sync"),
579
592
  pipeline: () => all("pipeline"),
580
593
  application: () => all("application"),
581
- connector: () => all("connector")
594
+ connector: () => all("connector"),
595
+ share: () => all("share")
582
596
  };
597
+ // src/actions/errors.ts
598
+ class ActionDefinitionError2 extends Error {
599
+ name = "ActionDefinitionError";
600
+ }
601
+
602
+ class ActionEditCommitError2 extends Error {
603
+ name = "ActionEditCommitError";
604
+ }
605
+ function missingActionMutationMessage(actionId) {
606
+ return `Action "${actionId}" must declare .writeback(...) or .edits(...).`;
607
+ }
608
+ function effectsWithoutEditsMessage(actionId) {
609
+ return `Action "${actionId}" cannot declare .effects(...) without .edits(...).`;
610
+ }
611
+
612
+ // src/actions/validation.ts
613
+ function assertNonEmpty2(value, field) {
614
+ if (!value.trim()) {
615
+ throw new ActionDefinitionError2(`Action ${field} must not be empty.`);
616
+ }
617
+ }
618
+ function isActionDefinition2(value) {
619
+ const binding = value?.binding;
620
+ return typeof value === "object" && value !== null && value.kind === "action" && (binding?.kind === "global" || binding?.kind === "object");
621
+ }
622
+ function isGlobalActionDefinition2(value) {
623
+ return value.binding.kind === "global";
624
+ }
625
+ function isObjectActionDefinition2(value) {
626
+ return value.binding.kind === "object";
627
+ }
628
+ function normalizeActionParams(runtime, paramsConfig, params, pathPrefix) {
629
+ const knownParamIds = new Set(Object.keys(paramsConfig));
630
+ const normalized = {};
631
+ for (const paramId of Object.keys(params)) {
632
+ if (!knownParamIds.has(paramId)) {
633
+ throw new OntologyValidationError2(`Unknown param '${paramId}' for action '${pathPrefix}'`);
634
+ }
635
+ }
636
+ for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
637
+ const value = params[paramId];
638
+ if (value === undefined) {
639
+ if (paramDef.required) {
640
+ throw new OntologyValidationError2(`Missing required param '${paramId}' for action '${pathPrefix}'`);
641
+ }
642
+ continue;
643
+ }
644
+ if (value === null) {
645
+ if (!paramDef.nullable) {
646
+ throw new OntologyValidationError2(`[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`);
647
+ }
648
+ normalized[paramId] = null;
649
+ continue;
650
+ }
651
+ validateSchemaOrRefValue2(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
652
+ normalized[paramId] = normalizeSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
653
+ }
654
+ return normalized;
655
+ }
656
+ function coerceActionParamsToTyped2(paramsConfig, params, valueTypesById) {
657
+ const coerced = { ...params };
658
+ for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
659
+ const value = params[paramId];
660
+ if (value === undefined)
661
+ continue;
662
+ const schema = paramDef.schema;
663
+ if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
664
+ continue;
665
+ }
666
+ coerced[paramId] = coerceSchemaValueToTyped2(schema, value, valueTypesById);
667
+ }
668
+ return coerced;
669
+ }
670
+ function validateActionSubject(action, subject) {
671
+ if (isGlobalActionDefinition2(action) && subject.kind !== "none") {
672
+ throw new OntologyValidationError2(`Action '${action.id}' does not accept an object subject.`);
673
+ }
674
+ }
675
+ function resolveObjectActionSubject(params) {
676
+ const { runtime, action, subject } = params;
677
+ if (subject.kind !== "object") {
678
+ throw new OntologyValidationError2(`Action '${action.id}' requires an object subject.`);
679
+ }
680
+ const objectType = runtime.ontology.resolveObjectType(subject.objectTypeId);
681
+ if (!actionAppliesToObjectType(runtime, action, objectType)) {
682
+ throw new OntologyValidationError2(`Action '${action.id}' is not valid for object type '${objectType.id}'.`);
683
+ }
684
+ return objectType;
685
+ }
686
+ function actionAppliesToObjectType(runtime, action, objectType) {
687
+ return runtime.actionRegistry.listForType(objectType).some((candidate) => candidate.id === action.id);
688
+ }
689
+ function normalizeSchemaOrRefValue(schema, value, path, valueTypesById) {
690
+ if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
691
+ const refValue = value;
692
+ return {
693
+ objectTypeId: refValue.objectTypeId,
694
+ primaryId: refValue.primaryId
695
+ };
696
+ }
697
+ return normalizeSchemaValue2(schema, value, path, valueTypesById);
698
+ }
699
+
700
+ // src/shares/errors.ts
701
+ class ShareDefinitionError2 extends Error {
702
+ name = "ShareDefinitionError";
703
+ }
704
+
705
+ // src/shares/builders.ts
706
+ var shareTargets = new WeakSet;
707
+ function defineShare2(id, options) {
708
+ assertNonEmpty(id, "Share id");
709
+ if (!isObjectType(options.target)) {
710
+ throw invalid(`Share '${id}' target must be an object type.`);
711
+ }
712
+ if (typeof options.grants !== "function") {
713
+ throw invalid(`Share '${id}' grants must be a function.`);
714
+ }
715
+ if (options.description !== undefined && typeof options.description !== "string") {
716
+ throw invalid(`Share '${id}' description must be a string.`);
717
+ }
718
+ const target = createShareTarget(options.target.id);
719
+ let authoredGrants;
720
+ try {
721
+ authoredGrants = options.grants({ target });
722
+ } catch (error) {
723
+ if (error instanceof ShareDefinitionError2)
724
+ throw error;
725
+ const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
726
+ throw invalid(`Share '${id}' grants are invalid: ${reason}`);
727
+ }
728
+ if (!Array.isArray(authoredGrants) || authoredGrants.length === 0) {
729
+ throw invalid(`Share '${id}' must declare at least one grant.`);
730
+ }
731
+ const grants = snapshotShareGrants(id, options.target.id, authoredGrants);
732
+ return Object.freeze({
733
+ kind: "share",
734
+ id,
735
+ target: Object.freeze({ kind: "object", objectTypeId: options.target.id }),
736
+ grants,
737
+ ...options.description === undefined ? {} : { description: options.description }
738
+ });
739
+ }
740
+ function isShareDefinition(value) {
741
+ if (!isRecord2(value) || value.kind !== "share" || !isNonEmpty(value.id))
742
+ return false;
743
+ if (!isRecord2(value.target) || value.target.kind !== "object" || !isNonEmpty(value.target.objectTypeId)) {
744
+ return false;
745
+ }
746
+ return Array.isArray(value.grants);
747
+ }
748
+ function snapshotShareDefinition(value) {
749
+ try {
750
+ if (!isRecord2(value)) {
751
+ throw invalid("Share definition kind must be 'share'.");
752
+ }
753
+ const kind = value.kind;
754
+ const authoredId = value.id;
755
+ const target = value.target;
756
+ const authoredGrants = value.grants;
757
+ const description = value.description;
758
+ if (kind !== "share") {
759
+ throw invalid("Share definition kind must be 'share'.");
760
+ }
761
+ const id = nonEmpty(authoredId, "Share id");
762
+ if (!isRecord2(target)) {
763
+ throw invalid(`Share '${id}' target must be an object type.`);
764
+ }
765
+ const targetKind = target.kind;
766
+ const authoredObjectTypeId = target.objectTypeId;
767
+ if (targetKind !== "object" || !isNonEmpty(authoredObjectTypeId)) {
768
+ throw invalid(`Share '${id}' target must be an object type.`);
769
+ }
770
+ if (!Array.isArray(authoredGrants) || authoredGrants.length === 0) {
771
+ throw invalid(`Share '${id}' must declare grants.`);
772
+ }
773
+ if (description !== undefined && typeof description !== "string") {
774
+ throw invalid(`Share '${id}' description must be a string.`);
775
+ }
776
+ const objectTypeId = authoredObjectTypeId;
777
+ return Object.freeze({
778
+ kind: "share",
779
+ id,
780
+ target: Object.freeze({ kind: "object", objectTypeId }),
781
+ grants: snapshotShareGrants(id, objectTypeId, authoredGrants),
782
+ ...description === undefined ? {} : { description }
783
+ });
784
+ } catch (error) {
785
+ if (error instanceof ShareDefinitionError2)
786
+ throw error;
787
+ const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
788
+ throw invalid(`Share definition is invalid: ${reason}`);
789
+ }
790
+ }
791
+ function isShareTarget(value) {
792
+ return typeof value === "object" && value !== null && shareTargets.has(value);
793
+ }
794
+ function createShareViewGrant(target) {
795
+ assertShareTarget(target);
796
+ return createShareViewGrantWithLinks(target.objectTypeId, Object.freeze({ kind: "none" }));
797
+ }
798
+ function createShareActionGrant(action, target) {
799
+ assertShareTarget(target);
800
+ const objectTypeId = action.binding.objectType.id;
801
+ if (target.objectTypeId !== objectTypeId) {
802
+ throw invalid(`Action '${action.id}' is defined on '${objectTypeId}', not Share target '${target.objectTypeId}'. Shared Actions are exact-type only in V1.`);
803
+ }
804
+ return Object.freeze({
805
+ kind: "action.apply",
806
+ actionId: action.id,
807
+ subjectObjectTypeId: target.objectTypeId
808
+ });
809
+ }
810
+ function createShareTarget(objectTypeId) {
811
+ const target = { objectTypeId };
812
+ shareTargets.add(target);
813
+ return Object.freeze(target);
814
+ }
815
+ function createShareViewGrantWithLinks(targetObjectTypeId, links) {
816
+ const grant = {
817
+ kind: "object.view",
818
+ targetObjectTypeId,
819
+ links
820
+ };
821
+ Object.defineProperty(grant, "withLinks", {
822
+ configurable: false,
823
+ enumerable: false,
824
+ writable: false,
825
+ value: (...args) => {
826
+ if (args.length === 0) {
827
+ return freezeViewGrant(targetObjectTypeId, Object.freeze({ kind: "all" }));
828
+ }
829
+ const selected = args[0];
830
+ if (!Array.isArray(selected)) {
831
+ throw invalid("withLinks(...) expects an array, or no argument for every direct link.");
832
+ }
833
+ return freezeViewGrant(targetObjectTypeId, Object.freeze({
834
+ kind: "selected",
835
+ links: Object.freeze(selected.map(snapshotLinkPathSelection))
836
+ }));
837
+ }
838
+ });
839
+ return Object.freeze(grant);
840
+ }
841
+ function freezeViewGrant(targetObjectTypeId, links) {
842
+ return Object.freeze({ kind: "object.view", targetObjectTypeId, links });
843
+ }
844
+ function snapshotShareGrants(shareId, targetObjectTypeId, authored) {
845
+ const grants = [];
846
+ const actionIds = new Set;
847
+ let viewCount = 0;
848
+ for (let index = 0;index < authored.length; index += 1) {
849
+ const grant = authored[index];
850
+ if (!isRecord2(grant)) {
851
+ throw invalid(`Share '${shareId}' grant ${index} must come from 'can'.`);
852
+ }
853
+ const kind = grant.kind;
854
+ if (kind === "object.view") {
855
+ const authoredTargetObjectTypeId = grant.targetObjectTypeId;
856
+ const links = grant.links;
857
+ if (authoredTargetObjectTypeId !== targetObjectTypeId) {
858
+ throw invalid(`Share '${shareId}' view grant must use its contextual target.`);
859
+ }
860
+ viewCount += 1;
861
+ if (viewCount > 1) {
862
+ throw invalid(`Share '${shareId}' must declare exactly one view grant.`);
863
+ }
864
+ grants.push(Object.freeze({
865
+ kind: "object.view",
866
+ targetObjectTypeId,
867
+ links: snapshotLinkMode(links)
868
+ }));
869
+ continue;
870
+ }
871
+ if (kind === "action.apply") {
872
+ const actionId = grant.actionId;
873
+ const subjectObjectTypeId = grant.subjectObjectTypeId;
874
+ if (!isNonEmpty(actionId) || subjectObjectTypeId !== targetObjectTypeId) {
875
+ throw invalid(`Share '${shareId}' action grant must apply to its contextual target.`);
876
+ }
877
+ if (actionIds.has(actionId)) {
878
+ throw invalid(`Share '${shareId}' contains duplicate action '${actionId}'.`);
879
+ }
880
+ actionIds.add(actionId);
881
+ grants.push(Object.freeze({
882
+ kind: "action.apply",
883
+ actionId,
884
+ subjectObjectTypeId: targetObjectTypeId
885
+ }));
886
+ continue;
887
+ }
888
+ throw invalid(`Share '${shareId}' grant ${index} must come from 'can'.`);
889
+ }
890
+ if (viewCount !== 1) {
891
+ throw invalid(`Share '${shareId}' must declare exactly one can.view(target) grant.`);
892
+ }
893
+ return Object.freeze(grants);
894
+ }
895
+ function snapshotLinkMode(value) {
896
+ if (!isRecord2(value))
897
+ throw invalid("Share link selection must be an object.");
898
+ const kind = value.kind;
899
+ const links = value.links;
900
+ if (kind === "none" || kind === "all") {
901
+ return Object.freeze({ kind });
902
+ }
903
+ if (kind !== "selected" || !Array.isArray(links)) {
904
+ throw invalid("Share link selection must be none, all, or selected links.");
905
+ }
906
+ if (links.length === 0) {
907
+ throw invalid("withLinks([]) is empty; omit withLinks() when no links should be shared.");
908
+ }
909
+ try {
910
+ return Object.freeze({
911
+ kind: "selected",
912
+ links: snapshotLinkPaths(links)
913
+ });
914
+ } catch (error) {
915
+ if (error instanceof ShareDefinitionError2)
916
+ throw error;
917
+ const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
918
+ throw invalid(`Share link selection is invalid: ${reason}`);
919
+ }
920
+ }
921
+ function snapshotLinkPaths(values) {
922
+ const byKey = new Map;
923
+ for (const value of values) {
924
+ const captured = canonicalizeLinkPath(snapshotLinkPathSelection(value));
925
+ const key = JSON.stringify([captured.sourceObjectTypeId, captured.linkId]);
926
+ const current = byKey.get(key);
927
+ if (!current) {
928
+ byKey.set(key, captured);
929
+ continue;
930
+ }
931
+ if (!sameLinkTargets(current.targetObjectTypeId, captured.targetObjectTypeId)) {
932
+ throw invalid(`Link '${captured.sourceObjectTypeId}.${captured.linkId}' declares inconsistent targets.`);
933
+ }
934
+ byKey.set(key, Object.freeze({
935
+ ...current,
936
+ selection: mergeLinkModes(current.selection, captured.selection)
937
+ }));
938
+ }
939
+ return Object.freeze([...byKey.values()]);
940
+ }
941
+ function canonicalizeLinkPath(value) {
942
+ return Object.freeze({
943
+ ...value,
944
+ selection: value.selection.kind === "selected" ? Object.freeze({
945
+ kind: "selected",
946
+ links: snapshotLinkPaths(value.selection.links)
947
+ }) : value.selection
948
+ });
949
+ }
950
+ function mergeLinkModes(left, right) {
951
+ if (left.kind === "all" || right.kind === "all")
952
+ return Object.freeze({ kind: "all" });
953
+ if (left.kind === "none")
954
+ return right;
955
+ if (right.kind === "none")
956
+ return left;
957
+ return Object.freeze({
958
+ kind: "selected",
959
+ links: snapshotLinkPaths([...left.links, ...right.links])
960
+ });
961
+ }
962
+ function sameLinkTargets(left, right) {
963
+ if (typeof left === "string" || typeof right === "string")
964
+ return left === right;
965
+ return left.length === right.length && left.every((value, index) => value === right[index]);
966
+ }
967
+ function assertShareTarget(value) {
968
+ if (!isShareTarget(value)) {
969
+ throw invalid("Shared grants must use the target provided by defineShare(...).");
970
+ }
971
+ }
972
+ function isObjectType(value) {
973
+ return isRecord2(value) && isNonEmpty(value.id) && Array.isArray(value.properties) && Array.isArray(value.links);
974
+ }
975
+ function isRecord2(value) {
976
+ return typeof value === "object" && value !== null && !Array.isArray(value);
977
+ }
978
+ function isNonEmpty(value) {
979
+ return typeof value === "string" && value.trim().length > 0;
980
+ }
981
+ function assertNonEmpty(value, field) {
982
+ if (!isNonEmpty(value))
983
+ throw invalid(`${field} must not be empty.`);
984
+ }
985
+ function nonEmpty(value, field) {
986
+ assertNonEmpty(value, field);
987
+ return value;
988
+ }
989
+ function invalid(message) {
990
+ return new ShareDefinitionError2(`[Sixb] ${message}`);
991
+ }
992
+
583
993
  // src/security/grants.ts
584
994
  var VIEW_TARGETS = ["object", "dataset"];
585
995
  var RUN_TARGETS = ["workflow", "sync", "pipeline"];
@@ -589,7 +999,8 @@ var TARGET_BY_DEFINITION_KIND = {
589
999
  pipeline: "pipeline",
590
1000
  workflow: "workflow",
591
1001
  application: "application",
592
- connector: "connector"
1002
+ connector: "connector",
1003
+ share: "share"
593
1004
  };
594
1005
  var UNDISCRIMINATED_TARGETS = ["object", "action"];
595
1006
  function targetOfDefinition(item, label, allowedTargets) {
@@ -597,7 +1008,7 @@ function targetOfDefinition(item, label, allowedTargets) {
597
1008
  const discriminated = typeof kind === "string" ? TARGET_BY_DEFINITION_KIND[kind] : undefined;
598
1009
  if (discriminated) {
599
1010
  if (!isAllowedTarget(discriminated, allowedTargets)) {
600
- throw new SecurityValidationError(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} definitions, but received one targeting ${discriminated}.`);
1011
+ throw new SecurityValidationError2(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} definitions, but received one targeting ${discriminated}.`);
601
1012
  }
602
1013
  return discriminated;
603
1014
  }
@@ -605,7 +1016,7 @@ function targetOfDefinition(item, label, allowedTargets) {
605
1016
  const only = candidates.length === 1 ? candidates[0] : undefined;
606
1017
  if (only)
607
1018
  return only;
608
- throw new SecurityValidationError(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} definitions, but received one Sixb could not classify.`);
1019
+ throw new SecurityValidationError2(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} definitions, but received one Sixb could not classify.`);
609
1020
  }
610
1021
  function isAllowedTarget(target, allowedTargets) {
611
1022
  return allowedTargets.includes(target);
@@ -613,7 +1024,7 @@ function isAllowedTarget(target, allowedTargets) {
613
1024
  function resolveGrant(input, label, allowedTargets) {
614
1025
  if (isBreadthSelector(input)) {
615
1026
  if (!isAllowedTarget(input.target, allowedTargets)) {
616
- throw new SecurityValidationError(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} selectors, but received every.${input.target}().`);
1027
+ throw new SecurityValidationError2(`[Sixb] ${label} accepts ${allowedTargets.join(" or ")} selectors, but received every.${input.target}().`);
617
1028
  }
618
1029
  return { target: input.target, selection: input.selection };
619
1030
  }
@@ -626,11 +1037,11 @@ function resolveGrant(input, label, allowedTargets) {
626
1037
  continue;
627
1038
  }
628
1039
  if (itemTarget !== target) {
629
- throw new SecurityValidationError(`[Sixb] ${label} requires one target per grant, but received both ${target} and ${itemTarget} definitions. Use one grant each.`);
1040
+ throw new SecurityValidationError2(`[Sixb] ${label} requires one target per grant, but received both ${target} and ${itemTarget} definitions. Use one grant each.`);
630
1041
  }
631
1042
  }
632
1043
  if (target === undefined) {
633
- throw new SecurityValidationError(`[Sixb] ${label} requires at least one definition.`);
1044
+ throw new SecurityValidationError2(`[Sixb] ${label} requires at least one definition.`);
634
1045
  }
635
1046
  const ids = [...new Set(items.map((item) => definitionIdOf(item, label)))];
636
1047
  return { target, selection: { all: false, ids } };
@@ -640,6 +1051,8 @@ function access(input) {
640
1051
  return { kind: "grant", capability: "access", target: "application", selection };
641
1052
  }
642
1053
  function view(input) {
1054
+ if (isShareTarget(input))
1055
+ return createShareViewGrant(input);
643
1056
  const { target, selection } = resolveGrant(input, "can.view", VIEW_TARGETS);
644
1057
  return { kind: "grant", capability: "view", target, selection };
645
1058
  }
@@ -658,11 +1071,28 @@ function append(input) {
658
1071
  };
659
1072
  }
660
1073
  function apply(input) {
661
- return {
1074
+ const grant = {
662
1075
  kind: "grant",
663
1076
  capability: "apply",
664
1077
  selection: resolveGrant(input, "can.apply", ["action"]).selection
665
1078
  };
1079
+ const one = Array.isArray(input) || isBreadthSelector(input) ? undefined : input;
1080
+ if (one && isObjectActionDefinition2(one)) {
1081
+ Object.defineProperty(grant, "on", {
1082
+ configurable: false,
1083
+ enumerable: false,
1084
+ writable: false,
1085
+ value: (target) => createShareActionGrant(one, target)
1086
+ });
1087
+ }
1088
+ return grant;
1089
+ }
1090
+ function share(input) {
1091
+ return {
1092
+ kind: "grant",
1093
+ capability: "share",
1094
+ selection: resolveGrant(input, "can.share", ["share"]).selection
1095
+ };
666
1096
  }
667
1097
  function run(input) {
668
1098
  if (isAgentReference(input)) {
@@ -679,7 +1109,7 @@ function isAgentUsageReference(input) {
679
1109
  }
680
1110
  function observe(input) {
681
1111
  if (input !== "logs" && !isAgentUsageReference(input)) {
682
- throw new SecurityValidationError('[Sixb] can.observe accepts "logs" or agent.usage.');
1112
+ throw new SecurityValidationError2('[Sixb] can.observe accepts "logs" or agent.usage.');
683
1113
  }
684
1114
  const target = input === "logs" ? "logs" : "aiUsage";
685
1115
  return {
@@ -705,12 +1135,13 @@ function manage(input) {
705
1135
  selection: resolveGrant(input, "can.manage", ["connector"]).selection
706
1136
  };
707
1137
  }
708
- var can = {
1138
+ var can2 = {
709
1139
  access,
710
1140
  view,
711
1141
  edit,
712
1142
  append,
713
1143
  apply,
1144
+ share,
714
1145
  run,
715
1146
  observe,
716
1147
  manage
@@ -736,7 +1167,8 @@ class SecurityRegistry {
736
1167
  agentAvailable: input.agentAvailable,
737
1168
  connectorIds: input.connectorIds,
738
1169
  observableIds: new Set(["logs", "aiUsage"]),
739
- manageableIds: new Set(["aiUsage"])
1170
+ manageableIds: new Set(["aiUsage"]),
1171
+ shareIds: input.shareIds
740
1172
  });
741
1173
  const universe = {
742
1174
  applicationIds: input.applicationIds ?? APPLICATION_IDS,
@@ -749,6 +1181,7 @@ class SecurityRegistry {
749
1181
  connectorIds: input.connectorIds ?? new Set,
750
1182
  observableIds: new Set(["logs", "aiUsage"]),
751
1183
  manageableIds: new Set(["aiUsage"]),
1184
+ shareIds: input.shareIds ?? new Set,
752
1185
  getSubTypes: input.getSubTypes ?? (() => [])
753
1186
  };
754
1187
  this.groupsById = definitions.groupsById;
@@ -757,7 +1190,7 @@ class SecurityRegistry {
757
1190
  this.resolvedRoles = definitions.roles.map((role) => ({
758
1191
  id: role.id,
759
1192
  grantedToGroupIds: role.grantedToGroupIds,
760
- grants: resolveRoleGrants(role, universe)
1193
+ grants: resolveRoleGrants2(role, universe)
761
1194
  }));
762
1195
  }
763
1196
  listGroups() {
@@ -783,7 +1216,7 @@ class SecurityRegistry {
783
1216
  }
784
1217
  }
785
1218
  // src/storage/auth/errors.ts
786
- class AuthStorageError extends Error {
1219
+ class AuthStorageError2 extends Error {
787
1220
  code;
788
1221
  name = "AuthStorageError";
789
1222
  constructor(code, message) {
@@ -855,18 +1288,18 @@ function cloneDate(value) {
855
1288
  function dateOrNow(value) {
856
1289
  return value ? cloneDate(value) : new Date;
857
1290
  }
858
- function assertNonEmpty2(value, label) {
1291
+ function assertNonEmpty4(value, label) {
859
1292
  const normalized = value.trim();
860
1293
  if (!normalized) {
861
- throw new AuthStorageError("invalid_input", `[Sixb] ${label} must be a non-empty string.`);
1294
+ throw new AuthStorageError2("invalid_input", `[Sixb] ${label} must be a non-empty string.`);
862
1295
  }
863
1296
  return normalized;
864
1297
  }
865
1298
  function normalizeEmail(email) {
866
- return assertNonEmpty2(email, "Email").toLowerCase();
1299
+ return assertNonEmpty4(email, "Email").toLowerCase();
867
1300
  }
868
1301
  function normalizeGroupIds(groupIds) {
869
- return [...new Set((groupIds ?? []).map((groupId) => assertNonEmpty2(groupId, "Group id")))];
1302
+ return [...new Set((groupIds ?? []).map((groupId) => assertNonEmpty4(groupId, "Group id")))];
870
1303
  }
871
1304
  function normalizeOptionalGroupIds(groupIds) {
872
1305
  return groupIds === undefined ? undefined : normalizeGroupIds(groupIds);
@@ -949,22 +1382,22 @@ function revokeActiveMagicLinksForEmail(state, projectId, email, revokedAt) {
949
1382
  }
950
1383
  function assertSessionIdAvailable(state, projectId, sessionId) {
951
1384
  if (state.sessions.has(sessionKey(projectId, sessionId))) {
952
- throw new AuthStorageError("duplicate_session", `[Sixb] Session '${sessionId}' already exists for project '${projectId}'.`);
1385
+ throw new AuthStorageError2("duplicate_session", `[Sixb] Session '${sessionId}' already exists for project '${projectId}'.`);
953
1386
  }
954
1387
  }
955
1388
  function validateCompleteSessionInput(state, projectId, session) {
956
- const sessionId = assertNonEmpty2(session.id, "Session id");
957
- assertNonEmpty2(session.audience, "Session audience");
958
- assertNonEmpty2(session.tokenHash, "Session token hash");
1389
+ const sessionId = assertNonEmpty4(session.id, "Session id");
1390
+ assertNonEmpty4(session.audience, "Session audience");
1391
+ assertNonEmpty4(session.tokenHash, "Session token hash");
959
1392
  assertSessionIdAvailable(state, projectId, sessionId);
960
1393
  }
961
1394
  function createSessionRecord(state, input) {
962
- const id = assertNonEmpty2(input.id, "Session id");
963
- const projectId = assertNonEmpty2(input.projectId, "Project id");
964
- const userId = assertNonEmpty2(input.userId, "User id");
965
- const strategyId = assertNonEmpty2(input.strategyId, "Strategy id");
966
- const audience = resolveAuthSessionAudience(input.audience);
967
- const tokenHash = assertNonEmpty2(input.tokenHash, "Session token hash");
1395
+ const id = assertNonEmpty4(input.id, "Session id");
1396
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1397
+ const userId = assertNonEmpty4(input.userId, "User id");
1398
+ const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1399
+ const audience = resolveAuthSessionAudience2(input.audience);
1400
+ const tokenHash = assertNonEmpty4(input.tokenHash, "Session token hash");
968
1401
  assertSessionIdAvailable(state, projectId, id);
969
1402
  const session = {
970
1403
  id,
@@ -983,12 +1416,12 @@ function createSessionRecord(state, input) {
983
1416
  return session;
984
1417
  }
985
1418
  function createServiceAccountRecord(state, input) {
986
- const id = assertNonEmpty2(input.id, "Service account id");
987
- const projectId = assertNonEmpty2(input.projectId, "Project id");
988
- const name = assertNonEmpty2(input.name, "Service account name");
1419
+ const id = assertNonEmpty4(input.id, "Service account id");
1420
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1421
+ const name = assertNonEmpty4(input.name, "Service account name");
989
1422
  const key = serviceAccountKey(projectId, id);
990
1423
  if (state.serviceAccounts.has(key)) {
991
- throw new AuthStorageError("duplicate_service_account", `[Sixb] Service account '${id}' already exists for project '${projectId}'.`);
1424
+ throw new AuthStorageError2("duplicate_service_account", `[Sixb] Service account '${id}' already exists for project '${projectId}'.`);
992
1425
  }
993
1426
  const createdAt = dateOrNow(input.createdAt);
994
1427
  const serviceAccount = {
@@ -1006,11 +1439,11 @@ function createServiceAccountRecord(state, input) {
1006
1439
  return serviceAccount;
1007
1440
  }
1008
1441
  function upsertServiceAccountGroupMembershipRecord(state, input) {
1009
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1010
- const serviceAccountId = assertNonEmpty2(input.serviceAccountId, "Service account id");
1011
- const groupId = assertNonEmpty2(input.groupId, "Group id");
1442
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1443
+ const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
1444
+ const groupId = assertNonEmpty4(input.groupId, "Group id");
1012
1445
  if (!state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
1013
- throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
1446
+ throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
1014
1447
  }
1015
1448
  const key = serviceAccountGroupMembershipKey(projectId, serviceAccountId, groupId);
1016
1449
  const existing = state.serviceAccountGroupMemberships.get(key);
@@ -1028,16 +1461,16 @@ function upsertServiceAccountGroupMembershipRecord(state, input) {
1028
1461
  return membership;
1029
1462
  }
1030
1463
  function createAccessTokenRecord(state, input) {
1031
- const id = assertNonEmpty2(input.id, "Access token id");
1032
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1033
- const name = assertNonEmpty2(input.name, "Access token name");
1034
- const subjectId = assertNonEmpty2(input.subjectId, "Access token subject id");
1035
- const tokenHash = assertNonEmpty2(input.tokenHash, "Access token hash");
1464
+ const id = assertNonEmpty4(input.id, "Access token id");
1465
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1466
+ const name = assertNonEmpty4(input.name, "Access token name");
1467
+ const subjectId = assertNonEmpty4(input.subjectId, "Access token subject id");
1468
+ const tokenHash = assertNonEmpty4(input.tokenHash, "Access token hash");
1036
1469
  assertAccessTokenSubject(input.kind, input.subjectType);
1037
1470
  assertAccessTokenSubjectExists(state, projectId, input.subjectType, subjectId);
1038
1471
  const key = accessTokenKey(projectId, id);
1039
1472
  if (state.accessTokens.has(key)) {
1040
- throw new AuthStorageError("duplicate_access_token", `[Sixb] Access token '${id}' already exists for project '${projectId}'.`);
1473
+ throw new AuthStorageError2("duplicate_access_token", `[Sixb] Access token '${id}' already exists for project '${projectId}'.`);
1041
1474
  }
1042
1475
  const token = {
1043
1476
  id,
@@ -1057,11 +1490,11 @@ function createAccessTokenRecord(state, input) {
1057
1490
  return token;
1058
1491
  }
1059
1492
  function upsertGroupMembershipRecord(state, input) {
1060
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1061
- const userId = assertNonEmpty2(input.userId, "User id");
1062
- const groupId = assertNonEmpty2(input.groupId, "Group id");
1493
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1494
+ const userId = assertNonEmpty4(input.userId, "User id");
1495
+ const groupId = assertNonEmpty4(input.groupId, "Group id");
1063
1496
  if (!state.users.has(userKey(projectId, userId))) {
1064
- throw new AuthStorageError("missing_user", `[Sixb] User '${userId}' not found for project '${projectId}'.`);
1497
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${userId}' not found for project '${projectId}'.`);
1065
1498
  }
1066
1499
  const key = groupMembershipKey(projectId, userId, groupId);
1067
1500
  const existing = state.groupMemberships.get(key);
@@ -1079,9 +1512,9 @@ function upsertGroupMembershipRecord(state, input) {
1079
1512
  return membership;
1080
1513
  }
1081
1514
  function removeGroupMembershipRecord(state, params) {
1082
- const projectId = assertNonEmpty2(params.projectId, "Project id");
1083
- const userId = assertNonEmpty2(params.userId, "User id");
1084
- const groupId = assertNonEmpty2(params.groupId, "Group id");
1515
+ const projectId = assertNonEmpty4(params.projectId, "Project id");
1516
+ const userId = assertNonEmpty4(params.userId, "User id");
1517
+ const groupId = assertNonEmpty4(params.groupId, "Group id");
1085
1518
  const key = groupMembershipKey(projectId, userId, groupId);
1086
1519
  const existing = state.groupMemberships.get(key);
1087
1520
  if (!existing) {
@@ -1094,32 +1527,32 @@ function assertAccessTokenSubject(kind, subjectType) {
1094
1527
  if (kind === "personal" && subjectType === "user" || kind === "serviceAccount" && subjectType === "serviceAccount") {
1095
1528
  return;
1096
1529
  }
1097
- throw new AuthStorageError("invalid_input", `[Sixb] Access token kind '${kind}' cannot target subject type '${subjectType}'.`);
1530
+ throw new AuthStorageError2("invalid_input", `[Sixb] Access token kind '${kind}' cannot target subject type '${subjectType}'.`);
1098
1531
  }
1099
1532
  function assertAccessTokenSubjectExists(state, projectId, subjectType, subjectId) {
1100
1533
  if (subjectType === "user") {
1101
1534
  if (state.users.has(userKey(projectId, subjectId)))
1102
1535
  return;
1103
- throw new AuthStorageError("missing_user", `[Sixb] User '${subjectId}' not found for project '${projectId}'.`);
1536
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${subjectId}' not found for project '${projectId}'.`);
1104
1537
  }
1105
1538
  if (state.serviceAccounts.has(serviceAccountKey(projectId, subjectId)))
1106
1539
  return;
1107
- throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${subjectId}' not found for project '${projectId}'.`);
1540
+ throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${subjectId}' not found for project '${projectId}'.`);
1108
1541
  }
1109
1542
  function consumeMagicLinkRecord(state, params) {
1110
- const projectId = assertNonEmpty2(params.projectId, "Project id");
1111
- const id = assertNonEmpty2(params.id, "Magic link id");
1112
- const tokenHash = assertNonEmpty2(params.tokenHash, "Magic link token hash");
1543
+ const projectId = assertNonEmpty4(params.projectId, "Project id");
1544
+ const id = assertNonEmpty4(params.id, "Magic link id");
1545
+ const tokenHash = assertNonEmpty4(params.tokenHash, "Magic link token hash");
1113
1546
  const key = magicLinkKey(projectId, id);
1114
1547
  const existing = state.magicLinks.get(key);
1115
1548
  if (!existing) {
1116
- throw new AuthStorageError("missing_magic_link", `[Sixb] Magic link '${id}' not found for project '${projectId}'.`);
1549
+ throw new AuthStorageError2("missing_magic_link", `[Sixb] Magic link '${id}' not found for project '${projectId}'.`);
1117
1550
  }
1118
1551
  if (existing.tokenHash !== tokenHash || existing.consumedAt || existing.revokedAt) {
1119
- throw new AuthStorageError("invalid_magic_link", `[Sixb] Magic link '${id}' is not valid for project '${projectId}'.`);
1552
+ throw new AuthStorageError2("invalid_magic_link", `[Sixb] Magic link '${id}' is not valid for project '${projectId}'.`);
1120
1553
  }
1121
1554
  if (existing.expiresAt <= params.consumedAt) {
1122
- throw new AuthStorageError("expired_magic_link", `[Sixb] Magic link '${id}' is expired for project '${projectId}'.`);
1555
+ throw new AuthStorageError2("expired_magic_link", `[Sixb] Magic link '${id}' is expired for project '${projectId}'.`);
1123
1556
  }
1124
1557
  const consumed = {
1125
1558
  ...existing,
@@ -1129,19 +1562,19 @@ function consumeMagicLinkRecord(state, params) {
1129
1562
  return consumed;
1130
1563
  }
1131
1564
  function consumeOidcAttemptRecord(state, params) {
1132
- const projectId = assertNonEmpty2(params.projectId, "Project id");
1133
- const id = assertNonEmpty2(params.id, "OIDC authorization attempt id");
1134
- const stateHash = assertNonEmpty2(params.stateHash, "OIDC state hash");
1565
+ const projectId = assertNonEmpty4(params.projectId, "Project id");
1566
+ const id = assertNonEmpty4(params.id, "OIDC authorization attempt id");
1567
+ const stateHash = assertNonEmpty4(params.stateHash, "OIDC state hash");
1135
1568
  const key = oidcAttemptKey(projectId, id);
1136
1569
  const existing = state.oidcAuthorizationAttempts.get(key);
1137
1570
  if (!existing) {
1138
- throw new AuthStorageError("missing_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' not found for project '${projectId}'.`);
1571
+ throw new AuthStorageError2("missing_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' not found for project '${projectId}'.`);
1139
1572
  }
1140
1573
  if (existing.stateHash !== stateHash || existing.consumedAt) {
1141
- throw new AuthStorageError("invalid_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' is not valid for project '${projectId}'.`);
1574
+ throw new AuthStorageError2("invalid_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' is not valid for project '${projectId}'.`);
1142
1575
  }
1143
1576
  if (existing.expiresAt <= params.consumedAt) {
1144
- throw new AuthStorageError("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' is expired for project '${projectId}'.`);
1577
+ throw new AuthStorageError2("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' is expired for project '${projectId}'.`);
1145
1578
  }
1146
1579
  const consumed = {
1147
1580
  ...existing,
@@ -1186,7 +1619,7 @@ class InMemoryAuthAccessTokenStore {
1186
1619
  const key = accessTokenKey(params.projectId, params.id);
1187
1620
  const existing = this.state.accessTokens.get(key);
1188
1621
  if (!existing) {
1189
- throw new AuthStorageError("missing_access_token", `[Sixb] Access token '${params.id}' not found for project '${params.projectId}'.`);
1622
+ throw new AuthStorageError2("missing_access_token", `[Sixb] Access token '${params.id}' not found for project '${params.projectId}'.`);
1190
1623
  }
1191
1624
  const next = {
1192
1625
  ...existing,
@@ -1199,7 +1632,7 @@ class InMemoryAuthAccessTokenStore {
1199
1632
  const key = accessTokenKey(params.projectId, params.id);
1200
1633
  const existing = this.state.accessTokens.get(key);
1201
1634
  if (!existing) {
1202
- throw new AuthStorageError("missing_access_token", `[Sixb] Access token '${params.id}' not found for project '${params.projectId}'.`);
1635
+ throw new AuthStorageError2("missing_access_token", `[Sixb] Access token '${params.id}' not found for project '${params.projectId}'.`);
1203
1636
  }
1204
1637
  const next = {
1205
1638
  ...existing,
@@ -1213,7 +1646,7 @@ class InMemoryAuthAccessTokenStore {
1213
1646
  }
1214
1647
 
1215
1648
  // src/storage/auth/types.ts
1216
- var MAX_PENDING_DEVICE_AUTHORIZATIONS = 100;
1649
+ var MAX_PENDING_DEVICE_AUTHORIZATIONS2 = 100;
1217
1650
 
1218
1651
  // src/storage/auth/in-memory/device-authorizations.ts
1219
1652
  class InMemoryAuthDeviceAuthorizationStore {
@@ -1222,16 +1655,16 @@ class InMemoryAuthDeviceAuthorizationStore {
1222
1655
  this.state = state;
1223
1656
  }
1224
1657
  async create(input) {
1225
- const id = assertNonEmpty2(input.id, "Device authorization id");
1226
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1227
- for (const [key2, authorization] of this.state.deviceAuthorizations) {
1658
+ const id = assertNonEmpty4(input.id, "Device authorization id");
1659
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1660
+ for (const [key, authorization] of this.state.deviceAuthorizations) {
1228
1661
  if (authorization.projectId === projectId && authorization.expiresAt <= input.createdAt) {
1229
- this.state.deviceAuthorizations.delete(key2);
1662
+ this.state.deviceAuthorizations.delete(key);
1230
1663
  }
1231
1664
  }
1232
1665
  const pending = [...this.state.deviceAuthorizations.values()].filter((authorization) => authorization.projectId === projectId && authorization.status === "pending").length;
1233
- if (pending >= MAX_PENDING_DEVICE_AUTHORIZATIONS) {
1234
- throw new AuthStorageError("device_authorization_limit_exceeded", `[Sixb] Project '${projectId}' has too many pending device authorizations.`);
1666
+ if (pending >= MAX_PENDING_DEVICE_AUTHORIZATIONS2) {
1667
+ throw new AuthStorageError2("device_authorization_limit_exceeded", `[Sixb] Project '${projectId}' has too many pending device authorizations.`);
1235
1668
  }
1236
1669
  const key = deviceAuthorizationKey(projectId, id);
1237
1670
  if (this.state.deviceAuthorizations.has(key)) {
@@ -1240,10 +1673,10 @@ class InMemoryAuthDeviceAuthorizationStore {
1240
1673
  const record = {
1241
1674
  id,
1242
1675
  projectId,
1243
- deviceCodeHash: assertNonEmpty2(input.deviceCodeHash, "Device code hash"),
1244
- userCode: assertNonEmpty2(input.userCode, "User code"),
1245
- clientName: assertNonEmpty2(input.clientName, "Client name"),
1246
- tokenName: assertNonEmpty2(input.tokenName, "Token name"),
1676
+ deviceCodeHash: assertNonEmpty4(input.deviceCodeHash, "Device code hash"),
1677
+ userCode: assertNonEmpty4(input.userCode, "User code"),
1678
+ clientName: assertNonEmpty4(input.clientName, "Client name"),
1679
+ tokenName: assertNonEmpty4(input.tokenName, "Token name"),
1247
1680
  tokenExpiresAt: new Date(input.tokenExpiresAt),
1248
1681
  status: "pending",
1249
1682
  createdAt: new Date(input.createdAt),
@@ -1269,13 +1702,13 @@ class InMemoryAuthDeviceAuthorizationStore {
1269
1702
  const user = this.state.users.get(userKey(params.projectId, params.userId));
1270
1703
  const session = this.state.sessions.get(sessionKey(params.projectId, params.sessionId));
1271
1704
  if (!user || user.status !== "active" || !session || session.userId !== user.id || !isActiveSession(session, params.approvedAt)) {
1272
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device authorization requires an active user session.");
1705
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device authorization requires an active user session.");
1273
1706
  }
1274
1707
  const next = {
1275
1708
  ...record,
1276
1709
  status: "approved",
1277
- approvedUserId: assertNonEmpty2(params.userId, "Approved user id"),
1278
- approvedSessionId: assertNonEmpty2(params.sessionId, "Approved session id"),
1710
+ approvedUserId: assertNonEmpty4(params.userId, "Approved user id"),
1711
+ approvedSessionId: assertNonEmpty4(params.sessionId, "Approved session id"),
1279
1712
  approvedAt: new Date(params.approvedAt)
1280
1713
  };
1281
1714
  this.state.deviceAuthorizations.set(deviceAuthorizationKey(params.projectId, params.id), next);
@@ -1294,16 +1727,16 @@ class InMemoryAuthDeviceAuthorizationStore {
1294
1727
  requirePending(projectId, id, now) {
1295
1728
  const record = this.state.deviceAuthorizations.get(deviceAuthorizationKey(projectId, id));
1296
1729
  if (!record) {
1297
- throw new AuthStorageError("missing_device_authorization", `[Sixb] Device authorization '${id}' not found for project '${projectId}'.`);
1730
+ throw new AuthStorageError2("missing_device_authorization", `[Sixb] Device authorization '${id}' not found for project '${projectId}'.`);
1298
1731
  }
1299
1732
  if (record.status !== "pending" || record.expiresAt <= now) {
1300
- throw new AuthStorageError("invalid_device_authorization", `[Sixb] Device authorization '${id}' is no longer pending for project '${projectId}'.`);
1733
+ throw new AuthStorageError2("invalid_device_authorization", `[Sixb] Device authorization '${id}' is no longer pending for project '${projectId}'.`);
1301
1734
  }
1302
1735
  return record;
1303
1736
  }
1304
1737
  }
1305
1738
  function duplicateAuthorization(id, projectId) {
1306
- return new AuthStorageError("duplicate_device_authorization", `[Sixb] Device authorization '${id}' already exists for project '${projectId}'.`);
1739
+ return new AuthStorageError2("duplicate_device_authorization", `[Sixb] Device authorization '${id}' already exists for project '${projectId}'.`);
1307
1740
  }
1308
1741
 
1309
1742
  // src/storage/auth/in-memory/group-memberships.ts
@@ -1334,10 +1767,10 @@ class InMemoryAuthUserIdentityStore {
1334
1767
  this.state = state;
1335
1768
  }
1336
1769
  async upsert(input) {
1337
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1338
- const strategyId = assertNonEmpty2(input.strategyId, "Strategy id");
1339
- const subject = assertNonEmpty2(input.subject, "Subject");
1340
- const userId = assertNonEmpty2(input.userId, "User id");
1770
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1771
+ const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1772
+ const subject = assertNonEmpty4(input.subject, "Subject");
1773
+ const userId = assertNonEmpty4(input.userId, "User id");
1341
1774
  const key = identityKey(projectId, strategyId, subject);
1342
1775
  const existing = this.state.identities.get(key);
1343
1776
  const createdAt = existing?.createdAt ?? dateOrNow(input.createdAt);
@@ -1387,8 +1820,8 @@ class InMemoryAuthInvitationStore {
1387
1820
  this.state = state;
1388
1821
  }
1389
1822
  async createOrUpdateActive(input) {
1390
- const id = assertNonEmpty2(input.id, "Invitation id");
1391
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1823
+ const id = assertNonEmpty4(input.id, "Invitation id");
1824
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1392
1825
  const email = normalizeEmail(input.email);
1393
1826
  const groupIds = normalizeGroupIds(input.groupIds);
1394
1827
  const now = dateOrNow(input.updatedAt ?? input.createdAt);
@@ -1407,7 +1840,7 @@ class InMemoryAuthInvitationStore {
1407
1840
  }
1408
1841
  const key = invitationKey(projectId, id);
1409
1842
  if (this.state.invitations.has(key)) {
1410
- throw new AuthStorageError("duplicate_invitation", `[Sixb] Invitation '${id}' already exists but is not active for project '${projectId}'.`);
1843
+ throw new AuthStorageError2("duplicate_invitation", `[Sixb] Invitation '${id}' already exists but is not active for project '${projectId}'.`);
1411
1844
  }
1412
1845
  const invitation = {
1413
1846
  id,
@@ -1451,7 +1884,7 @@ class InMemoryAuthInvitationStore {
1451
1884
  const key = invitationKey(params.projectId, params.id);
1452
1885
  const existing = this.state.invitations.get(key);
1453
1886
  if (!existing) {
1454
- throw new AuthStorageError("missing_invitation", `[Sixb] Invitation '${params.id}' not found for project '${params.projectId}'.`);
1887
+ throw new AuthStorageError2("missing_invitation", `[Sixb] Invitation '${params.id}' not found for project '${params.projectId}'.`);
1455
1888
  }
1456
1889
  const next = {
1457
1890
  ...existing,
@@ -1466,7 +1899,7 @@ class InMemoryAuthInvitationStore {
1466
1899
  const key = invitationKey(params.projectId, params.id);
1467
1900
  const existing = this.state.invitations.get(key);
1468
1901
  if (!existing) {
1469
- throw new AuthStorageError("missing_invitation", `[Sixb] Invitation '${params.id}' not found for project '${params.projectId}'.`);
1902
+ throw new AuthStorageError2("missing_invitation", `[Sixb] Invitation '${params.id}' not found for project '${params.projectId}'.`);
1470
1903
  }
1471
1904
  const next = {
1472
1905
  ...existing,
@@ -1486,15 +1919,15 @@ class InMemoryAuthMagicLinkStore {
1486
1919
  this.state = state;
1487
1920
  }
1488
1921
  async create(input) {
1489
- const id = assertNonEmpty2(input.id, "Magic link id");
1490
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1491
- const strategyId = assertNonEmpty2(input.strategyId, "Strategy id");
1492
- const audience = resolveAuthSessionAudience(input.audience);
1922
+ const id = assertNonEmpty4(input.id, "Magic link id");
1923
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1924
+ const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1925
+ const audience = resolveAuthSessionAudience2(input.audience);
1493
1926
  const email = normalizeEmail(input.email);
1494
- const tokenHash = assertNonEmpty2(input.tokenHash, "Magic link token hash");
1927
+ const tokenHash = assertNonEmpty4(input.tokenHash, "Magic link token hash");
1495
1928
  const key = magicLinkKey(projectId, id);
1496
1929
  if (this.state.magicLinks.has(key)) {
1497
- throw new AuthStorageError("duplicate_magic_link", `[Sixb] Magic link '${id}' already exists for project '${projectId}'.`);
1930
+ throw new AuthStorageError2("duplicate_magic_link", `[Sixb] Magic link '${id}' already exists for project '${projectId}'.`);
1498
1931
  }
1499
1932
  revokeActiveMagicLinksForEmail(this.state, projectId, email, input.createdAt);
1500
1933
  const link = {
@@ -1535,16 +1968,16 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
1535
1968
  this.state = state;
1536
1969
  }
1537
1970
  async create(input) {
1538
- const id = assertNonEmpty2(input.id, "OIDC authorization attempt id");
1539
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1540
- const strategyId = assertNonEmpty2(input.strategyId, "Strategy id");
1541
- const audience = resolveAuthSessionAudience(input.audience);
1542
- const stateHash = assertNonEmpty2(input.stateHash, "OIDC state hash");
1543
- const nonceHash = assertNonEmpty2(input.nonceHash, "OIDC nonce hash");
1544
- const codeVerifier = assertNonEmpty2(input.codeVerifier, "OIDC code verifier");
1971
+ const id = assertNonEmpty4(input.id, "OIDC authorization attempt id");
1972
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1973
+ const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1974
+ const audience = resolveAuthSessionAudience2(input.audience);
1975
+ const stateHash = assertNonEmpty4(input.stateHash, "OIDC state hash");
1976
+ const nonceHash = assertNonEmpty4(input.nonceHash, "OIDC nonce hash");
1977
+ const codeVerifier = assertNonEmpty4(input.codeVerifier, "OIDC code verifier");
1545
1978
  const key = oidcAttemptKey(projectId, id);
1546
1979
  if (this.state.oidcAuthorizationAttempts.has(key)) {
1547
- throw new AuthStorageError("duplicate_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' already exists for project '${projectId}'.`);
1980
+ throw new AuthStorageError2("duplicate_oidc_attempt", `[Sixb] OIDC authorization attempt '${id}' already exists for project '${projectId}'.`);
1548
1981
  }
1549
1982
  const attempt = {
1550
1983
  id,
@@ -1580,10 +2013,10 @@ class InMemoryAuthServiceAccountGroupMembershipStore {
1580
2013
  return cloneRecord(upsertServiceAccountGroupMembershipRecord(this.state, input));
1581
2014
  }
1582
2015
  async reconcileForServiceAccount(input) {
1583
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1584
- const serviceAccountId = assertNonEmpty2(input.serviceAccountId, "Service account id");
2016
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
2017
+ const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
1585
2018
  if (!this.state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
1586
- throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
2019
+ throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${projectId}'.`);
1587
2020
  }
1588
2021
  const groupIds = normalizeGroupIds(input.groupIds);
1589
2022
  const desired = new Set(groupIds);
@@ -1632,16 +2065,16 @@ class InMemoryAuthServiceAccountStore {
1632
2065
  return cloneOptionalRecord(record);
1633
2066
  }
1634
2067
  async update(input) {
1635
- const projectId = assertNonEmpty2(input.projectId, "Project id");
1636
- const id = assertNonEmpty2(input.id, "Service account id");
2068
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
2069
+ const id = assertNonEmpty4(input.id, "Service account id");
1637
2070
  const key = serviceAccountKey(projectId, id);
1638
2071
  const existing = this.state.serviceAccounts.get(key);
1639
2072
  if (!existing) {
1640
- throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${id}' not found for project '${projectId}'.`);
2073
+ throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${id}' not found for project '${projectId}'.`);
1641
2074
  }
1642
2075
  const next = {
1643
2076
  ...existing,
1644
- name: input.name === undefined ? existing.name : assertNonEmpty2(input.name, "Service account name"),
2077
+ name: input.name === undefined ? existing.name : assertNonEmpty4(input.name, "Service account name"),
1645
2078
  description: input.description === undefined ? existing.description : input.description,
1646
2079
  status: input.status ?? existing.status,
1647
2080
  updatedAt: input.updatedAt ? cloneDate(input.updatedAt) : new Date
@@ -1715,7 +2148,7 @@ class InMemoryAuthSessionStore {
1715
2148
  const key = sessionKey(params.projectId, params.id);
1716
2149
  const existing = this.state.sessions.get(key);
1717
2150
  if (!existing) {
1718
- throw new AuthStorageError("missing_session", `[Sixb] Session '${params.id}' not found for project '${params.projectId}'.`);
2151
+ throw new AuthStorageError2("missing_session", `[Sixb] Session '${params.id}' not found for project '${params.projectId}'.`);
1719
2152
  }
1720
2153
  const next = {
1721
2154
  ...existing,
@@ -1731,7 +2164,7 @@ class InMemoryAuthSessionStore {
1731
2164
  const key = sessionKey(params.projectId, params.id);
1732
2165
  const existing = this.state.sessions.get(key);
1733
2166
  if (!existing) {
1734
- throw new AuthStorageError("missing_session", `[Sixb] Session '${params.id}' not found for project '${params.projectId}'.`);
2167
+ throw new AuthStorageError2("missing_session", `[Sixb] Session '${params.id}' not found for project '${params.projectId}'.`);
1735
2168
  }
1736
2169
  const next = {
1737
2170
  ...existing,
@@ -1749,15 +2182,15 @@ class InMemoryAuthUserStore {
1749
2182
  this.state = state;
1750
2183
  }
1751
2184
  async create(input) {
1752
- const id = assertNonEmpty2(input.id, "User id");
1753
- const projectId = assertNonEmpty2(input.projectId, "Project id");
2185
+ const id = assertNonEmpty4(input.id, "User id");
2186
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1754
2187
  const email = normalizeEmail(input.email);
1755
2188
  const key = userKey(projectId, id);
1756
2189
  if (this.state.users.has(key)) {
1757
- throw new AuthStorageError("duplicate_user", `[Sixb] User '${id}' already exists for project '${projectId}'.`);
2190
+ throw new AuthStorageError2("duplicate_user", `[Sixb] User '${id}' already exists for project '${projectId}'.`);
1758
2191
  }
1759
2192
  if (getUserByEmail(this.state, projectId, email)) {
1760
- throw new AuthStorageError("duplicate_user", `[Sixb] User email '${email}' already exists for project '${projectId}'.`);
2193
+ throw new AuthStorageError2("duplicate_user", `[Sixb] User email '${email}' already exists for project '${projectId}'.`);
1761
2194
  }
1762
2195
  const createdAt = dateOrNow(input.createdAt);
1763
2196
  const user = {
@@ -1784,7 +2217,7 @@ class InMemoryAuthUserStore {
1784
2217
  const key = userKey(input.projectId, input.id);
1785
2218
  const existing = this.state.users.get(key);
1786
2219
  if (!existing) {
1787
- throw new AuthStorageError("missing_user", `[Sixb] User '${input.id}' not found for project '${input.projectId}'.`);
2220
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${input.id}' not found for project '${input.projectId}'.`);
1788
2221
  }
1789
2222
  const next = {
1790
2223
  ...existing,
@@ -1799,7 +2232,7 @@ class InMemoryAuthUserStore {
1799
2232
  const key = userKey(input.projectId, input.id);
1800
2233
  const existing = this.state.users.get(key);
1801
2234
  if (!existing) {
1802
- throw new AuthStorageError("missing_user", `[Sixb] User '${input.id}' not found for project '${input.projectId}'.`);
2235
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${input.id}' not found for project '${input.projectId}'.`);
1803
2236
  }
1804
2237
  const next = {
1805
2238
  ...existing,
@@ -1826,7 +2259,7 @@ class InMemoryAuthUserStore {
1826
2259
  }
1827
2260
 
1828
2261
  // src/storage/auth/in-memory/auth-storage.ts
1829
- class InMemoryAuthStorage {
2262
+ class InMemoryAuthStorage2 {
1830
2263
  state = createAuthStorageState();
1831
2264
  users = new InMemoryAuthUserStore(this.state);
1832
2265
  identities = new InMemoryAuthUserIdentityStore(this.state);
@@ -1871,22 +2304,22 @@ class InMemoryAuthStorage {
1871
2304
  const key = deviceAuthorizationKey(input.projectId, input.id);
1872
2305
  const authorization = this.state.deviceAuthorizations.get(key);
1873
2306
  if (!authorization) {
1874
- throw new AuthStorageError("missing_device_authorization", `[Sixb] Device authorization '${input.id}' not found for project '${input.projectId}'.`);
2307
+ throw new AuthStorageError2("missing_device_authorization", `[Sixb] Device authorization '${input.id}' not found for project '${input.projectId}'.`);
1875
2308
  }
1876
2309
  if (authorization.deviceCodeHash !== input.deviceCodeHash) {
1877
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Invalid device authorization.");
2310
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Invalid device authorization.");
1878
2311
  }
1879
2312
  if (authorization.status === "pending") {
1880
- throw new AuthStorageError("pending_device_authorization", "[Sixb] Device authorization is pending.");
2313
+ throw new AuthStorageError2("pending_device_authorization", "[Sixb] Device authorization is pending.");
1881
2314
  }
1882
2315
  if (authorization.status === "denied") {
1883
- throw new AuthStorageError("device_authorization_denied", "[Sixb] Device authorization was denied.");
2316
+ throw new AuthStorageError2("device_authorization_denied", "[Sixb] Device authorization was denied.");
1884
2317
  }
1885
2318
  if (authorization.status !== "approved" || !authorization.approvedUserId || !authorization.approvedSessionId || authorization.expiresAt <= input.completedAt) {
1886
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
2319
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
1887
2320
  }
1888
2321
  if (input.accessToken.projectId !== input.projectId || input.accessToken.subjectType !== "user" || input.accessToken.subjectId !== authorization.approvedUserId || input.accessToken.createdBySessionId !== authorization.approvedSessionId) {
1889
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device access token is invalid.");
2322
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device access token is invalid.");
1890
2323
  }
1891
2324
  const accessToken = createAccessTokenRecord(this.state, input.accessToken);
1892
2325
  const consumed = {
@@ -1898,17 +2331,17 @@ class InMemoryAuthStorage {
1898
2331
  return { authorization: cloneRecord(consumed), accessToken: cloneRecord(accessToken) };
1899
2332
  }
1900
2333
  async completeMagicLinkSignIn(input) {
1901
- const projectId = assertNonEmpty2(input.projectId, "Project id");
2334
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
1902
2335
  const completedAt = cloneDate(input.completedAt);
1903
2336
  const magicLink = this.state.magicLinks.get(magicLinkKey(projectId, input.magicLinkId));
1904
2337
  if (!magicLink) {
1905
- throw new AuthStorageError("missing_magic_link", `[Sixb] Magic link '${input.magicLinkId}' not found for project '${projectId}'.`);
2338
+ throw new AuthStorageError2("missing_magic_link", `[Sixb] Magic link '${input.magicLinkId}' not found for project '${projectId}'.`);
1906
2339
  }
1907
2340
  if (magicLink.tokenHash !== input.tokenHash || magicLink.consumedAt || magicLink.revokedAt) {
1908
- throw new AuthStorageError("invalid_magic_link", `[Sixb] Magic link '${input.magicLinkId}' is not valid for project '${projectId}'.`);
2341
+ throw new AuthStorageError2("invalid_magic_link", `[Sixb] Magic link '${input.magicLinkId}' is not valid for project '${projectId}'.`);
1909
2342
  }
1910
2343
  if (magicLink.expiresAt <= completedAt) {
1911
- throw new AuthStorageError("expired_magic_link", `[Sixb] Magic link '${input.magicLinkId}' is expired for project '${projectId}'.`);
2344
+ throw new AuthStorageError2("expired_magic_link", `[Sixb] Magic link '${input.magicLinkId}' is expired for project '${projectId}'.`);
1912
2345
  }
1913
2346
  const existingUser = getUserByEmail(this.state, projectId, magicLink.email);
1914
2347
  const activeInvitation = getActiveInvitationByEmail(this.state, projectId, magicLink.email, completedAt);
@@ -1921,7 +2354,7 @@ class InMemoryAuthStorage {
1921
2354
  tokenHash: input.tokenHash,
1922
2355
  consumedAt: completedAt
1923
2356
  });
1924
- throw new AuthStorageError("suspended_user", `[Sixb] User '${existingUser.id}' is suspended for project '${projectId}'.`);
2357
+ throw new AuthStorageError2("suspended_user", `[Sixb] User '${existingUser.id}' is suspended for project '${projectId}'.`);
1925
2358
  }
1926
2359
  if (shouldCreateUser && !activeInvitation && !input.allowUserCreationWithoutInvitation) {
1927
2360
  consumeMagicLinkRecord(this.state, {
@@ -1930,7 +2363,7 @@ class InMemoryAuthStorage {
1930
2363
  tokenHash: input.tokenHash,
1931
2364
  consumedAt: completedAt
1932
2365
  });
1933
- throw new AuthStorageError("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
2366
+ throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
1934
2367
  }
1935
2368
  if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
1936
2369
  consumeMagicLinkRecord(this.state, {
@@ -1939,15 +2372,15 @@ class InMemoryAuthStorage {
1939
2372
  tokenHash: input.tokenHash,
1940
2373
  consumedAt: completedAt
1941
2374
  });
1942
- throw new AuthStorageError("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
2375
+ throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
1943
2376
  }
1944
2377
  validateCompleteSessionInput(this.state, projectId, input.session);
1945
2378
  assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
1946
2379
  let newUserId;
1947
2380
  if (shouldCreateUser) {
1948
- newUserId = assertNonEmpty2(input.newUserId, "User id");
2381
+ newUserId = assertNonEmpty4(input.newUserId, "User id");
1949
2382
  if (this.state.users.has(userKey(projectId, newUserId))) {
1950
- throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
2383
+ throw new AuthStorageError2("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
1951
2384
  }
1952
2385
  }
1953
2386
  consumeMagicLinkRecord(this.state, {
@@ -1959,7 +2392,7 @@ class InMemoryAuthStorage {
1959
2392
  let user = existingUser;
1960
2393
  if (!user) {
1961
2394
  user = {
1962
- id: newUserId ?? assertNonEmpty2(input.newUserId, "User id"),
2395
+ id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
1963
2396
  projectId,
1964
2397
  email: magicLink.email,
1965
2398
  displayName: input.newUserDisplayName,
@@ -1997,19 +2430,19 @@ class InMemoryAuthStorage {
1997
2430
  };
1998
2431
  }
1999
2432
  async completeOidcSignIn(input) {
2000
- const projectId = assertNonEmpty2(input.projectId, "Project id");
2433
+ const projectId = assertNonEmpty4(input.projectId, "Project id");
2001
2434
  const completedAt = cloneDate(input.completedAt);
2002
2435
  const attempt = this.state.oidcAuthorizationAttempts.get(oidcAttemptKey(projectId, input.oidcAuthorizationAttemptId));
2003
2436
  if (!attempt) {
2004
- throw new AuthStorageError("missing_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' not found for project '${projectId}'.`);
2437
+ throw new AuthStorageError2("missing_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' not found for project '${projectId}'.`);
2005
2438
  }
2006
2439
  if (attempt.stateHash !== input.stateHash || attempt.consumedAt) {
2007
- throw new AuthStorageError("invalid_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is not valid for project '${projectId}'.`);
2440
+ throw new AuthStorageError2("invalid_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is not valid for project '${projectId}'.`);
2008
2441
  }
2009
2442
  if (attempt.expiresAt <= completedAt) {
2010
- throw new AuthStorageError("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is expired for project '${projectId}'.`);
2443
+ throw new AuthStorageError2("expired_oidc_attempt", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' is expired for project '${projectId}'.`);
2011
2444
  }
2012
- const subject = assertNonEmpty2(input.subject, "Subject");
2445
+ const subject = assertNonEmpty4(input.subject, "Subject");
2013
2446
  const email = normalizeEmail(input.email);
2014
2447
  const claims = normalizeClaims(input.claims);
2015
2448
  const identity = this.state.identities.get(identityKey(projectId, attempt.strategyId, subject));
@@ -2019,41 +2452,41 @@ class InMemoryAuthStorage {
2019
2452
  const manualGroupIds = normalizeGroupIds(input.manualGroupIds);
2020
2453
  if (identity && !user) {
2021
2454
  this.consumeOidcAttempt(input, completedAt, projectId);
2022
- throw new AuthStorageError("missing_user", `[Sixb] User '${identity.userId}' not found for linked OIDC identity.`);
2455
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${identity.userId}' not found for linked OIDC identity.`);
2023
2456
  }
2024
2457
  if (!identity && user && (!input.autoLinkByVerifiedEmail || !input.emailVerified)) {
2025
2458
  this.consumeOidcAttempt(input, completedAt, projectId);
2026
- throw new AuthStorageError("email_link_not_allowed", `[Sixb] OIDC identity cannot auto-link to user '${user.id}' for project '${projectId}'.`);
2459
+ throw new AuthStorageError2("email_link_not_allowed", `[Sixb] OIDC identity cannot auto-link to user '${user.id}' for project '${projectId}'.`);
2027
2460
  }
2028
2461
  if (user?.status === "suspended") {
2029
2462
  this.consumeOidcAttempt(input, completedAt, projectId);
2030
- throw new AuthStorageError("suspended_user", `[Sixb] User '${user.id}' is suspended for project '${projectId}'.`);
2463
+ throw new AuthStorageError2("suspended_user", `[Sixb] User '${user.id}' is suspended for project '${projectId}'.`);
2031
2464
  }
2032
2465
  if (shouldCreateUser && !input.emailVerified) {
2033
2466
  this.consumeOidcAttempt(input, completedAt, projectId);
2034
- throw new AuthStorageError("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2467
+ throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2035
2468
  }
2036
2469
  if (shouldCreateUser && !activeInvitation && !input.allowUserCreationWithoutInvitation) {
2037
2470
  this.consumeOidcAttempt(input, completedAt, projectId);
2038
- throw new AuthStorageError("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2471
+ throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2039
2472
  }
2040
2473
  if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
2041
2474
  this.consumeOidcAttempt(input, completedAt, projectId);
2042
- throw new AuthStorageError("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2475
+ throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
2043
2476
  }
2044
2477
  validateCompleteSessionInput(this.state, projectId, input.session);
2045
2478
  assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
2046
2479
  let newUserId;
2047
2480
  if (shouldCreateUser) {
2048
- newUserId = assertNonEmpty2(input.newUserId, "User id");
2481
+ newUserId = assertNonEmpty4(input.newUserId, "User id");
2049
2482
  if (this.state.users.has(userKey(projectId, newUserId))) {
2050
- throw new AuthStorageError("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
2483
+ throw new AuthStorageError2("duplicate_user", `[Sixb] User '${newUserId}' already exists for project '${projectId}'.`);
2051
2484
  }
2052
2485
  }
2053
2486
  this.consumeOidcAttempt(input, completedAt, projectId);
2054
2487
  if (!user) {
2055
2488
  user = {
2056
- id: newUserId ?? assertNonEmpty2(input.newUserId, "User id"),
2489
+ id: newUserId ?? assertNonEmpty4(input.newUserId, "User id"),
2057
2490
  projectId,
2058
2491
  email,
2059
2492
  displayName: input.displayName,
@@ -2105,7 +2538,7 @@ class InMemoryAuthStorage {
2105
2538
  const key = userKey(input.projectId, input.userId);
2106
2539
  const existing = this.state.users.get(key);
2107
2540
  if (!existing) {
2108
- throw new AuthStorageError("missing_user", `[Sixb] User '${input.userId}' not found for project '${input.projectId}'.`);
2541
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${input.userId}' not found for project '${input.projectId}'.`);
2109
2542
  }
2110
2543
  const next = {
2111
2544
  ...existing,
@@ -2191,7 +2624,7 @@ function assertSignInSessionAudience(projectId, sessionAudience, storedAudience)
2191
2624
  if (sessionAudience === storedAudience) {
2192
2625
  return;
2193
2626
  }
2194
- throw new AuthStorageError("invalid_input", `[Sixb] Sign-in session audience '${sessionAudience}' does not match stored auth audience '${storedAudience}' for project '${projectId}'.`);
2627
+ throw new AuthStorageError2("invalid_input", `[Sixb] Sign-in session audience '${sessionAudience}' does not match stored auth audience '${storedAudience}' for project '${projectId}'.`);
2195
2628
  }
2196
2629
  // src/auth/session-cache.ts
2197
2630
  class SessionCache {
@@ -2249,19 +2682,19 @@ class SessionCache {
2249
2682
 
2250
2683
  // src/auth/sessions.ts
2251
2684
  import { createHash as createHash2, randomBytes as randomBytes3, randomUUID as randomUUID2 } from "crypto";
2252
- function generateSessionSecret() {
2685
+ function generateSessionSecret2() {
2253
2686
  return randomBytes3(32).toString("base64url");
2254
2687
  }
2255
- function hashSessionSecret(secret) {
2688
+ function hashSessionSecret2(secret) {
2256
2689
  return createHash2("sha256").update(secret).digest("hex");
2257
2690
  }
2258
- function formatSessionCookieValue(sessionId, sessionSecret) {
2691
+ function formatSessionCookieValue2(sessionId, sessionSecret) {
2259
2692
  if (!sessionId || !sessionSecret || sessionId.includes(".") || sessionSecret.includes(".")) {
2260
2693
  throw new Error("[Sixb] Session cookie values must be non-empty and must not contain '.'.");
2261
2694
  }
2262
2695
  return `${sessionId}.${sessionSecret}`;
2263
2696
  }
2264
- function parseSessionCookieValue(value) {
2697
+ function parseSessionCookieValue2(value) {
2265
2698
  if (!value) {
2266
2699
  return null;
2267
2700
  }
@@ -2274,13 +2707,13 @@ function parseSessionCookieValue(value) {
2274
2707
  sessionSecret: value.slice(firstDot + 1)
2275
2708
  };
2276
2709
  }
2277
- function createSessionCredential(sessionId = `ses_${randomUUID2()}`) {
2278
- const sessionSecret = generateSessionSecret();
2710
+ function createSessionCredential2(sessionId = `ses_${randomUUID2()}`) {
2711
+ const sessionSecret = generateSessionSecret2();
2279
2712
  return {
2280
2713
  sessionId,
2281
2714
  sessionSecret,
2282
- tokenHash: hashSessionSecret(sessionSecret),
2283
- cookieValue: formatSessionCookieValue(sessionId, sessionSecret)
2715
+ tokenHash: hashSessionSecret2(sessionSecret),
2716
+ cookieValue: formatSessionCookieValue2(sessionId, sessionSecret)
2284
2717
  };
2285
2718
  }
2286
2719
 
@@ -2288,7 +2721,7 @@ function createSessionCredential(sessionId = `ses_${randomUUID2()}`) {
2288
2721
  var SESSION_TOUCH_INTERVAL_MS = 60000;
2289
2722
  var ACCESS_TOKEN_TOUCH_INTERVAL_MS = 60000;
2290
2723
 
2291
- class AuthRuntime {
2724
+ class AuthRuntime2 {
2292
2725
  projectId;
2293
2726
  storage;
2294
2727
  security;
@@ -2298,10 +2731,10 @@ class AuthRuntime {
2298
2731
  this.projectId = options.projectId;
2299
2732
  this.storage = options.storage;
2300
2733
  this.security = options.security;
2301
- this.config = resolveAuthConfig(options.config);
2734
+ this.config = resolveAuthConfig2(options.config);
2302
2735
  this.sessionCache = this.config.session.cacheTtlMs > 0 ? new SessionCache(this.config.session.cacheTtlMs) : null;
2303
2736
  if (this.isEnabled() && !this.storage.auth) {
2304
- throw new AuthRuntimeError("auth_storage_missing", "[Sixb] Auth is enabled but storage.auth is not configured.");
2737
+ throw new AuthRuntimeError2("auth_storage_missing", "[Sixb] Auth is enabled but storage.auth is not configured.");
2305
2738
  }
2306
2739
  }
2307
2740
  isEnabled() {
@@ -2325,26 +2758,26 @@ class AuthRuntime {
2325
2758
  const strategy = this.config.strategy;
2326
2759
  if (!strategy) {
2327
2760
  if (params.production) {
2328
- throw new AuthRuntimeError("production_auth_required", "[SixbServer] Auth is required in production. Configure auth or use an explicit disabled auth strategy.");
2761
+ throw new AuthRuntimeError2("production_auth_required", "[SixbServer] Auth is required in production. Configure auth or use an explicit disabled auth strategy.");
2329
2762
  }
2330
2763
  return;
2331
2764
  }
2332
2765
  if (params.production && strategy.developmentOnly) {
2333
- throw new AuthRuntimeError("production_auth_required", `[SixbServer] Auth strategy '${strategy.id}' is development-only and cannot be used in production.`);
2766
+ throw new AuthRuntimeError2("production_auth_required", `[SixbServer] Auth strategy '${strategy.id}' is development-only and cannot be used in production.`);
2334
2767
  }
2335
2768
  if (params.production && (strategy.kind === "disabled" || strategy.disabled === true) && strategy.allowDisabledInProduction !== true) {
2336
- throw new AuthRuntimeError("production_auth_required", "[SixbServer] Disabled auth in production requires allowDisabledInProduction: true.");
2769
+ throw new AuthRuntimeError2("production_auth_required", "[SixbServer] Disabled auth in production requires allowDisabledInProduction: true.");
2337
2770
  }
2338
2771
  }
2339
2772
  async getSession(request, options = {}) {
2340
2773
  if (!this.isEnabled()) {
2341
2774
  return { authenticated: false, reason: "auth_disabled" };
2342
2775
  }
2343
- const audience = resolveAuthSessionAudience(options.audience);
2776
+ const audience = resolveAuthSessionAudience2(options.audience);
2344
2777
  const credentialSource = options.credentialSource ?? "session";
2345
2778
  if (credentialSource !== "session") {
2346
2779
  const authorizationHeader = request.headers.get("authorization");
2347
- const tokenValue = getBearerAccessTokenValue(request);
2780
+ const tokenValue = getBearerAccessTokenValue2(request);
2348
2781
  if (tokenValue) {
2349
2782
  return this.resolveAccessTokenSession(request, tokenValue);
2350
2783
  }
@@ -2359,15 +2792,15 @@ class AuthRuntime {
2359
2792
  }
2360
2793
  async resolveCookieSession(request, audience, activity) {
2361
2794
  const cookieOptions = this.getCookieOptions({ audience });
2362
- const cookieValue = getCookie(request, cookieOptions.sessionCookieName);
2795
+ const cookieValue = getCookie2(request, cookieOptions.sessionCookieName);
2363
2796
  if (!cookieValue) {
2364
2797
  return { authenticated: false, reason: "missing_cookie" };
2365
2798
  }
2366
- const parts = parseSessionCookieValue(cookieValue);
2799
+ const parts = parseSessionCookieValue2(cookieValue);
2367
2800
  if (!parts) {
2368
2801
  return { authenticated: false, reason: "invalid_cookie" };
2369
2802
  }
2370
- const tokenHash = hashSessionSecret(parts.sessionSecret);
2803
+ const tokenHash = hashSessionSecret2(parts.sessionSecret);
2371
2804
  const nowMs = Date.now();
2372
2805
  const cached = this.sessionCache?.get({
2373
2806
  sessionId: parts.sessionId,
@@ -2457,7 +2890,7 @@ class AuthRuntime {
2457
2890
  return new Date(session.absoluteExpiresAt ? Math.min(idleExpiresAtMs, session.absoluteExpiresAt.getTime()) : idleExpiresAtMs);
2458
2891
  }
2459
2892
  async resolveAccessTokenSession(request, tokenValue) {
2460
- const parts = parseAccessTokenValue(tokenValue);
2893
+ const parts = parseAccessTokenValue2(tokenValue);
2461
2894
  if (!parts) {
2462
2895
  return { authenticated: false, reason: "invalid_access_token" };
2463
2896
  }
@@ -2467,7 +2900,7 @@ class AuthRuntime {
2467
2900
  projectId: this.projectId,
2468
2901
  id: parts.tokenId,
2469
2902
  kind: parts.kind,
2470
- tokenHash: hashAccessTokenSecret(parts.tokenSecret),
2903
+ tokenHash: hashAccessTokenSecret2(parts.tokenSecret),
2471
2904
  now
2472
2905
  });
2473
2906
  if (!accessToken) {
@@ -2485,7 +2918,7 @@ class AuthRuntime {
2485
2918
  if (user.status === "suspended") {
2486
2919
  return { authenticated: false, reason: "suspended_user" };
2487
2920
  }
2488
- const memberships2 = await storage.groupMemberships.listForUser({
2921
+ const memberships = await storage.groupMemberships.listForUser({
2489
2922
  projectId: this.projectId,
2490
2923
  userId: user.id
2491
2924
  });
@@ -2495,7 +2928,7 @@ class AuthRuntime {
2495
2928
  principal: { type: "user", id: user.id },
2496
2929
  user,
2497
2930
  accessToken,
2498
- groupIds: constrainTokenGroupIds(memberships2.map((membership) => membership.groupId), accessToken)
2931
+ groupIds: constrainTokenGroupIds(memberships.map((membership) => membership.groupId), accessToken)
2499
2932
  };
2500
2933
  }
2501
2934
  const serviceAccount = await storage.serviceAccounts.getById({
@@ -2551,24 +2984,24 @@ class AuthRuntime {
2551
2984
  async requirePrincipal(request, options = {}) {
2552
2985
  const session = await this.getSession(request, options);
2553
2986
  if (!session.authenticated) {
2554
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
2987
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2555
2988
  }
2556
2989
  return session.principal;
2557
2990
  }
2558
2991
  async requireUser(request, options = {}) {
2559
2992
  const session = await this.getSession(request, { ...options, credentialSource: "session" });
2560
2993
  if (!session.authenticated) {
2561
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
2994
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2562
2995
  }
2563
2996
  return session;
2564
2997
  }
2565
2998
  async requireUserRequest(request, options = {}) {
2566
2999
  const session = await this.getSession(request, { ...options, credentialSource: "any" });
2567
3000
  if (!session.authenticated) {
2568
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
3001
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2569
3002
  }
2570
3003
  if (!isAuthenticatedUserRequestSession(session)) {
2571
- throw new AuthRuntimeError("authorization_denied", "[Sixb] User authentication is required.");
3004
+ throw new AuthRuntimeError2("authorization_denied", "[Sixb] User authentication is required.");
2572
3005
  }
2573
3006
  return session;
2574
3007
  }
@@ -2584,12 +3017,12 @@ class AuthRuntime {
2584
3017
  async createAuthorizationContext(request, options = {}) {
2585
3018
  const session = await this.getSession(request, options);
2586
3019
  if (!session.authenticated) {
2587
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
3020
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2588
3021
  }
2589
3022
  return this.contextFromSession(session);
2590
3023
  }
2591
3024
  contextFromSession(session) {
2592
- return resolveAuthorizationContext({
3025
+ return resolveAuthorizationContext2({
2593
3026
  principal: session.principal,
2594
3027
  sessionId: session.credentialSource === "session" ? session.session.id : undefined,
2595
3028
  groupIds: session.groupIds,
@@ -2616,7 +3049,7 @@ class AuthRuntime {
2616
3049
  const groupIds = constrainRequestedGroupIds(input.groupIds, session.groupIds, {
2617
3050
  subject: "personal access token"
2618
3051
  });
2619
- const credential = createAccessTokenCredential("personal");
3052
+ const credential = createAccessTokenCredential2("personal");
2620
3053
  const accessToken = await storage.accessTokens.create({
2621
3054
  id: credential.tokenId,
2622
3055
  projectId: this.projectId,
@@ -2727,12 +3160,12 @@ class AuthRuntime {
2727
3160
  const storage = this.requireAuthStorage();
2728
3161
  const { serviceAccount, groupIds: serviceAccountGroupIds } = await this.requireManageableServiceAccount(storage, session.groupIds, input.serviceAccountId);
2729
3162
  if (serviceAccount.status === "suspended") {
2730
- throw new AuthStorageError("suspended_service_account", `[Sixb] Service account '${input.serviceAccountId}' is suspended for project '${this.projectId}'.`);
3163
+ throw new AuthStorageError2("suspended_service_account", `[Sixb] Service account '${input.serviceAccountId}' is suspended for project '${this.projectId}'.`);
2731
3164
  }
2732
3165
  const groupIds = constrainRequestedGroupIds(input.groupIds, serviceAccountGroupIds, {
2733
3166
  subject: "service account token"
2734
3167
  });
2735
- const credential = createAccessTokenCredential("serviceAccount");
3168
+ const credential = createAccessTokenCredential2("serviceAccount");
2736
3169
  const accessToken = await storage.accessTokens.create({
2737
3170
  id: credential.tokenId,
2738
3171
  projectId: this.projectId,
@@ -2774,7 +3207,7 @@ class AuthRuntime {
2774
3207
  });
2775
3208
  const groupIds = serviceAccount ? await this.listServiceAccountGroupIds(storage, serviceAccountId) : [];
2776
3209
  if (!serviceAccount || !callerCanManageServiceAccount(callerGroupIds, groupIds)) {
2777
- throw new AuthStorageError("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${this.projectId}'.`);
3210
+ throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${this.projectId}'.`);
2778
3211
  }
2779
3212
  return { serviceAccount, groupIds };
2780
3213
  }
@@ -2844,19 +3277,19 @@ class AuthRuntime {
2844
3277
  const session = await this.requireUser(request, options);
2845
3278
  const storage = this.requireAuthStorage();
2846
3279
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
2847
- const userId = assertNonEmpty(input.userId, "User id");
3280
+ const userId = assertNonEmpty3(input.userId, "User id");
2848
3281
  const { user, groupIds: currentGroupIds } = await this.requireManageableMember(storage, scope, "assignGroups", userId);
2849
3282
  const requestedGroupIds = this.resolveMemberGroupIds(input.groupIds);
2850
3283
  const missing = missingMembershipGroupIds(scope, "assignGroups", requestedGroupIds);
2851
3284
  if (missing.length > 0) {
2852
- throw new AuthRuntimeError("authorization_denied", `[Sixb] The current user is not allowed to assign group(s): ${missing.join(", ")}.`);
3285
+ throw new AuthRuntimeError2("authorization_denied", `[Sixb] The current user is not allowed to assign group(s): ${missing.join(", ")}.`);
2853
3286
  }
2854
3287
  const current = new Set(currentGroupIds);
2855
3288
  const requested = new Set(requestedGroupIds);
2856
3289
  const additions = requestedGroupIds.filter((groupId) => !current.has(groupId));
2857
3290
  const removals = currentGroupIds.filter((groupId) => !requested.has(groupId));
2858
3291
  if (user.id === session.user.id && removals.length > 0) {
2859
- throw new AuthRuntimeError("authorization_denied", "[Sixb] The current user cannot remove their own groups.");
3292
+ throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot remove their own groups.");
2860
3293
  }
2861
3294
  const now = new Date;
2862
3295
  for (const groupId of additions) {
@@ -2883,10 +3316,10 @@ class AuthRuntime {
2883
3316
  const session = await this.requireUser(request, options);
2884
3317
  const storage = this.requireAuthStorage();
2885
3318
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
2886
- const userId = assertNonEmpty(input.userId, "User id");
3319
+ const userId = assertNonEmpty3(input.userId, "User id");
2887
3320
  const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
2888
3321
  if (user.id === session.user.id) {
2889
- throw new AuthRuntimeError("authorization_denied", "[Sixb] The current user cannot suspend themselves.");
3322
+ throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot suspend themselves.");
2890
3323
  }
2891
3324
  const suspended = await storage.suspendUserAndRevokeSessions({
2892
3325
  projectId: this.projectId,
@@ -2900,7 +3333,7 @@ class AuthRuntime {
2900
3333
  const session = await this.requireUser(request, options);
2901
3334
  const storage = this.requireAuthStorage();
2902
3335
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
2903
- const userId = assertNonEmpty(input.userId, "User id");
3336
+ const userId = assertNonEmpty3(input.userId, "User id");
2904
3337
  const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
2905
3338
  const reactivated = await storage.users.updateStatus({
2906
3339
  projectId: this.projectId,
@@ -2924,15 +3357,15 @@ class AuthRuntime {
2924
3357
  const user = await storage.users.getById({ projectId: this.projectId, id: userId });
2925
3358
  const groupIds = user ? (await storage.groupMemberships.listForUser({ projectId: this.projectId, userId })).map((membership) => membership.groupId) : [];
2926
3359
  if (!user || !canPerformMembershipOperation(scope, operation, groupIds)) {
2927
- throw new AuthStorageError("missing_user", `[Sixb] User '${userId}' not found for project '${this.projectId}'.`);
3360
+ throw new AuthStorageError2("missing_user", `[Sixb] User '${userId}' not found for project '${this.projectId}'.`);
2928
3361
  }
2929
3362
  return { user, groupIds };
2930
3363
  }
2931
3364
  resolveMemberGroupIds(input) {
2932
- const groupIds = [...new Set(input.map((groupId) => assertNonEmpty(groupId, "Group id")))];
3365
+ const groupIds = [...new Set(input.map((groupId) => assertNonEmpty3(groupId, "Group id")))];
2933
3366
  for (const groupId of groupIds) {
2934
3367
  if (!this.security.getGroupById(groupId)) {
2935
- throw new AuthRuntimeError("invalid_auth_input", `[Sixb] Unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
3368
+ throw new AuthRuntimeError2("invalid_auth_input", `[Sixb] Unknown group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
2936
3369
  }
2937
3370
  }
2938
3371
  return groupIds;
@@ -2944,11 +3377,11 @@ class AuthRuntime {
2944
3377
  const groupIds = this.resolveInviteGroupIds(input);
2945
3378
  this.assertCanManageInvitationGroups(session.groupIds, groupIds);
2946
3379
  const strategy = this.getStrategy();
2947
- if (!isInvitationDeliveryAuthStrategy(strategy)) {
2948
- throw new AuthRuntimeError("invalid_auth_config", "[Sixb] The active auth strategy does not support invitations.");
3380
+ if (!isInvitationDeliveryAuthStrategy2(strategy)) {
3381
+ throw new AuthRuntimeError2("invalid_auth_config", "[Sixb] The active auth strategy does not support invitations.");
2949
3382
  }
2950
3383
  await this.assertCanInviteRecipient(strategy, authStorage, input.email, now);
2951
- const deliveryAudience = resolveAuthSessionAudience(options.delivery?.audience ?? options.audience);
3384
+ const deliveryAudience = resolveAuthSessionAudience2(options.delivery?.audience ?? options.audience);
2952
3385
  this.assertInvitationApplicationAccess(groupIds, deliveryAudience);
2953
3386
  const invitation = await authStorage.invitations.createOrUpdateActive({
2954
3387
  id: `inv_${randomUUID3()}`,
@@ -3012,17 +3445,17 @@ class AuthRuntime {
3012
3445
  async revokeInvitation(request, input, options = {}) {
3013
3446
  const session = await this.requireUser(request, options);
3014
3447
  const authStorage = this.requireAuthStorage();
3015
- const invitationId = assertNonEmpty(input.invitationId, "Invitation id");
3448
+ const invitationId = assertNonEmpty3(input.invitationId, "Invitation id");
3016
3449
  const invitation = await authStorage.invitations.getById({
3017
3450
  projectId: this.projectId,
3018
3451
  id: invitationId
3019
3452
  });
3020
3453
  if (!invitation) {
3021
- throw new AuthStorageError("missing_invitation", `[Sixb] Invitation '${invitationId}' not found for project '${this.projectId}'.`);
3454
+ throw new AuthStorageError2("missing_invitation", `[Sixb] Invitation '${invitationId}' not found for project '${this.projectId}'.`);
3022
3455
  }
3023
3456
  this.assertCanManageInvitationGroups(session.groupIds, invitation.groupIds);
3024
3457
  if (invitation.status !== "pending") {
3025
- throw new AuthRuntimeError("invalid_auth_input", `[Sixb] Invitation '${invitationId}' is already ${invitation.status} and cannot be revoked.`);
3458
+ throw new AuthRuntimeError2("invalid_auth_input", `[Sixb] Invitation '${invitationId}' is already ${invitation.status} and cannot be revoked.`);
3026
3459
  }
3027
3460
  return {
3028
3461
  invitation: await authStorage.invitations.revoke({
@@ -3034,19 +3467,19 @@ class AuthRuntime {
3034
3467
  }
3035
3468
  requireAuthStorage() {
3036
3469
  if (!this.storage.auth) {
3037
- throw new AuthRuntimeError("auth_storage_missing", "[Sixb] Auth is enabled but storage.auth is not configured.");
3470
+ throw new AuthRuntimeError2("auth_storage_missing", "[Sixb] Auth is enabled but storage.auth is not configured.");
3038
3471
  }
3039
3472
  return this.storage.auth;
3040
3473
  }
3041
3474
  resolveInviteGroupIds(input) {
3042
3475
  if (input.groups && input.groupIds) {
3043
- throw new AuthRuntimeError("invalid_auth_input", "[Sixb] Invitation input cannot provide both groups and groupIds.");
3476
+ throw new AuthRuntimeError2("invalid_auth_input", "[Sixb] Invitation input cannot provide both groups and groupIds.");
3044
3477
  }
3045
- const rawGroupIds = input.groupIds ?? input.groups?.map((group) => assertNonEmpty(group.id, "Group id")) ?? [];
3046
- const groupIds = [...new Set(rawGroupIds.map((groupId) => assertNonEmpty(groupId, "Group id")))];
3478
+ const rawGroupIds = input.groupIds ?? input.groups?.map((group) => assertNonEmpty3(group.id, "Group id")) ?? [];
3479
+ const groupIds = [...new Set(rawGroupIds.map((groupId) => assertNonEmpty3(groupId, "Group id")))];
3047
3480
  for (const groupId of groupIds) {
3048
3481
  if (!this.security.getGroupById(groupId)) {
3049
- throw new AuthRuntimeError("invalid_auth_input", `[Sixb] Unknown invitation group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
3482
+ throw new AuthRuntimeError2("invalid_auth_input", `[Sixb] Unknown invitation group '${groupId}'. Add it to 'security/groups/' or pass it to createSixb({ groups }).`);
3050
3483
  }
3051
3484
  }
3052
3485
  return groupIds;
@@ -3058,7 +3491,7 @@ class AuthRuntime {
3058
3491
  });
3059
3492
  }
3060
3493
  resolveCreateInvitationCapability(input) {
3061
- if (!isInvitationDeliveryAuthStrategy(this.getStrategy())) {
3494
+ if (!isInvitationDeliveryAuthStrategy2(this.getStrategy())) {
3062
3495
  return { state: "disabled", reason: "invitation_delivery_not_supported" };
3063
3496
  }
3064
3497
  if (!input.canInvite) {
@@ -3068,14 +3501,14 @@ class AuthRuntime {
3068
3501
  }
3069
3502
  assertInvitationApplicationAccess(groupIds, audience) {
3070
3503
  const roles = this.security.listResolvedRoles();
3071
- const authorization = resolveAuthorizationContext({
3504
+ const authorization = resolveAuthorizationContext2({
3072
3505
  principal: { type: "user", id: "invited-user" },
3073
3506
  groupIds,
3074
3507
  roles
3075
3508
  });
3076
- if (canAccessApplication(authorization, roles, audience))
3509
+ if (canAccessApplication2(authorization, roles, audience))
3077
3510
  return;
3078
- throw new AuthRuntimeError("authorization_denied", `[Sixb] Invitation groups do not grant access to application '${audience}'.`);
3511
+ throw new AuthRuntimeError2("authorization_denied", `[Sixb] Invitation groups do not grant access to application '${audience}'.`);
3079
3512
  }
3080
3513
  async assertCanInviteRecipient(strategy, authStorage, email, now) {
3081
3514
  if (!strategy.validateInvitationRecipient) {
@@ -3101,9 +3534,9 @@ class AuthRuntime {
3101
3534
  }
3102
3535
  createInvitationDeliveryError(status) {
3103
3536
  if (status === "rate_limited") {
3104
- return new AuthRuntimeError("rate_limited", "[Sixb] Invitation delivery is rate limited. Try again later.");
3537
+ return new AuthRuntimeError2("rate_limited", "[Sixb] Invitation delivery is rate limited. Try again later.");
3105
3538
  }
3106
- return new AuthRuntimeError("invalid_auth_input", "[Sixb] Invitation delivery was skipped by the active auth strategy.");
3539
+ return new AuthRuntimeError2("invalid_auth_input", "[Sixb] Invitation delivery was skipped by the active auth strategy.");
3107
3540
  }
3108
3541
  assertCanManageInvitationGroups(callerGroupIds, groupIds) {
3109
3542
  const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds);
@@ -3111,10 +3544,10 @@ class AuthRuntime {
3111
3544
  return;
3112
3545
  }
3113
3546
  if (groupIds.length === 0) {
3114
- throw new AuthRuntimeError("authorization_denied", "[Sixb] The current user is not allowed to create or manage invitations without groups.");
3547
+ throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user is not allowed to create or manage invitations without groups.");
3115
3548
  }
3116
3549
  const missing = missingMembershipGroupIds(scope, "invite", groupIds);
3117
- throw new AuthRuntimeError("authorization_denied", `[Sixb] The current user is not allowed to create or manage invitations for group(s): ${missing.join(", ")}.`);
3550
+ throw new AuthRuntimeError2("authorization_denied", `[Sixb] The current user is not allowed to create or manage invitations for group(s): ${missing.join(", ")}.`);
3118
3551
  }
3119
3552
  }
3120
3553
  function resolveCorrelationId(request) {
@@ -3138,7 +3571,7 @@ function callerCanManageServiceAccount(callerGroupIds, serviceAccountGroupIds) {
3138
3571
  return serviceAccountGroupIds.every((groupId) => callerGroups.has(groupId));
3139
3572
  }
3140
3573
  function missingAccessTokenError(tokenId, projectId) {
3141
- return new AuthStorageError("missing_access_token", `[Sixb] Access token '${tokenId}' not found for project '${projectId}'.`);
3574
+ return new AuthStorageError2("missing_access_token", `[Sixb] Access token '${tokenId}' not found for project '${projectId}'.`);
3142
3575
  }
3143
3576
  function constrainRequestedGroupIds(input, allowedGroupIds, options) {
3144
3577
  const groupIds = normalizeRequestedGroupIds(input);
@@ -3148,7 +3581,7 @@ function constrainRequestedGroupIds(input, allowedGroupIds, options) {
3148
3581
  const allowed = new Set(allowedGroupIds);
3149
3582
  for (const groupId of groupIds) {
3150
3583
  if (!allowed.has(groupId)) {
3151
- throw new AuthRuntimeError("authorization_denied", `[Sixb] Group '${groupId}' cannot be assigned to this ${options.subject}.`);
3584
+ throw new AuthRuntimeError2("authorization_denied", `[Sixb] Group '${groupId}' cannot be assigned to this ${options.subject}.`);
3152
3585
  }
3153
3586
  }
3154
3587
  return groupIds;
@@ -3161,7 +3594,7 @@ function normalizeRequestedGroupIds(input) {
3161
3594
  for (const raw of input) {
3162
3595
  const groupId = raw.trim();
3163
3596
  if (!groupId) {
3164
- throw new AuthRuntimeError("invalid_auth_input", "[Sixb] Group ids cannot be empty when creating auth credentials.");
3597
+ throw new AuthRuntimeError2("invalid_auth_input", "[Sixb] Group ids cannot be empty when creating auth credentials.");
3165
3598
  }
3166
3599
  if (!groupIds.includes(groupId)) {
3167
3600
  groupIds.push(groupId);
@@ -3171,15 +3604,15 @@ function normalizeRequestedGroupIds(input) {
3171
3604
  }
3172
3605
  function createInvitationRecipientError(status, email) {
3173
3606
  if (status === "rate_limited") {
3174
- return new AuthRuntimeError("rate_limited", "[Sixb] Invitation delivery is rate limited. Try again later.");
3607
+ return new AuthRuntimeError2("rate_limited", "[Sixb] Invitation delivery is rate limited. Try again later.");
3175
3608
  }
3176
3609
  if (status === "invalid_email") {
3177
- return new AuthRuntimeError("invalid_auth_input", "[Sixb] Invitation email is invalid.");
3610
+ return new AuthRuntimeError2("invalid_auth_input", "[Sixb] Invitation email is invalid.");
3178
3611
  }
3179
3612
  if (status === "disallowed_domain") {
3180
- return new AuthRuntimeError("invalid_auth_input", `[Sixb] Invitation email '${email}' is not allowed by the active auth strategy.`);
3613
+ return new AuthRuntimeError2("invalid_auth_input", `[Sixb] Invitation email '${email}' is not allowed by the active auth strategy.`);
3181
3614
  }
3182
- return new AuthRuntimeError("invalid_auth_input", `[Sixb] Invitation email '${email}' belongs to a suspended user.`);
3615
+ return new AuthRuntimeError2("invalid_auth_input", `[Sixb] Invitation email '${email}' belongs to a suspended user.`);
3183
3616
  }
3184
3617
  function membershipCapabilities(scope) {
3185
3618
  return {
@@ -3196,10 +3629,10 @@ function groupIdsOf(groups) {
3196
3629
  return groups.map((group) => typeof group === "string" ? group : group.id);
3197
3630
  }
3198
3631
  // src/auth/types.ts
3199
- var SYSTEM_PRINCIPAL = { type: "system", id: "system" };
3200
- function principalsEqual(left, right) {
3632
+ var SYSTEM_PRINCIPAL2 = { type: "system", id: "system" };
3633
+ function principalsEqual2(left, right) {
3201
3634
  return left.type === right.type && left.id === right.id;
3202
3635
  }
3203
- export { PERSONAL_ACCESS_TOKEN_PREFIX, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX, generateAccessTokenSecret, hashAccessTokenSecret, formatAccessTokenValue, parseAccessTokenValue, getBearerAccessTokenValue, createAccessTokenCredential, CSRF_HEADER_NAME, generateCsrfToken, isCsrfExemptMethod, verifyDoubleSubmitCsrf, applications, SecurityValidationError, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup, defineRole, defineMembershipPolicy, every, can, SecurityRegistry, AuthStorageError, MAX_PENDING_DEVICE_AUTHORIZATIONS, paginate, InMemoryAuthStorage, generateSessionSecret, hashSessionSecret, formatSessionCookieValue, parseSessionCookieValue, createSessionCredential, AuthRuntime, SYSTEM_PRINCIPAL, principalsEqual };
3636
+ export { ActionDefinitionError2, ActionEditCommitError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped2, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, applications2, SecurityValidationError2, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup2, defineRole2, defineMembershipPolicy2, every2, ShareDefinitionError2, defineShare2, isShareDefinition, snapshotShareDefinition, can2, SecurityRegistry, AuthStorageError2, MAX_PENDING_DEVICE_AUTHORIZATIONS2, paginate, InMemoryAuthStorage2, generateSessionSecret2, hashSessionSecret2, formatSessionCookieValue2, parseSessionCookieValue2, createSessionCredential2, AuthRuntime2, SYSTEM_PRINCIPAL2, principalsEqual2 };
3204
3637
 
3205
- //# debugId=D187F2B23E70181D64756E2164756E21
3638
+ //# debugId=4470AA67E3AEAE5264756E2164756E21