@sixb/core 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (615) hide show
  1. package/dist/actions/index.js +77 -89
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/run-dispatch.d.ts.map +1 -1
  4. package/dist/actions/types/context.d.ts +2 -0
  5. package/dist/actions/types/context.d.ts.map +1 -1
  6. package/dist/actions/validation.d.ts +1 -1
  7. package/dist/actions/validation.d.ts.map +1 -1
  8. package/dist/actions/worker.js +33 -37
  9. package/dist/actions/worker.js.map +2 -2
  10. package/dist/agents/adapters.d.ts +3 -3
  11. package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
  12. package/dist/agents/context/entries.d.ts.map +1 -0
  13. package/dist/agents/context/index.d.ts +4 -0
  14. package/dist/agents/context/index.d.ts.map +1 -0
  15. package/dist/agents/context/index.js +19 -0
  16. package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
  17. package/dist/agents/context-model.d.ts +1 -1
  18. package/dist/agents/context-model.d.ts.map +1 -1
  19. package/dist/agents/context-resolution.d.ts +1 -1
  20. package/dist/agents/context-resolution.d.ts.map +1 -1
  21. package/dist/agents/index.d.ts +4 -4
  22. package/dist/agents/index.d.ts.map +1 -1
  23. package/dist/agents/index.js +192 -204
  24. package/dist/agents/index.js.map +1 -1
  25. package/dist/agents/message.d.ts +1 -1
  26. package/dist/agents/message.d.ts.map +1 -1
  27. package/dist/agents/model-loop.d.ts +2 -0
  28. package/dist/agents/model-loop.d.ts.map +1 -1
  29. package/dist/agents/request.d.ts +1 -1
  30. package/dist/agents/request.d.ts.map +1 -1
  31. package/dist/agents/streams/index.d.ts +4 -0
  32. package/dist/agents/streams/index.d.ts.map +1 -0
  33. package/dist/agents/streams/index.js +20 -0
  34. package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
  35. package/dist/agents/streams/internal.d.ts +3 -0
  36. package/dist/agents/streams/internal.d.ts.map +1 -0
  37. package/dist/agents/streams/internal.js +40 -0
  38. package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
  39. package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
  40. package/dist/agents/streams/protocol.d.ts.map +1 -0
  41. package/dist/agents/types.d.ts +1 -1
  42. package/dist/agents/types.d.ts.map +1 -1
  43. package/dist/agents/validation.d.ts.map +1 -1
  44. package/dist/auth/index.d.ts +0 -1
  45. package/dist/auth/index.d.ts.map +1 -1
  46. package/dist/auth/index.js +96 -108
  47. package/dist/auth/index.js.map +1 -1
  48. package/dist/auth/strategy.js +8 -9
  49. package/dist/auth/strategy.js.map +1 -1
  50. package/dist/authorization/index.js +51 -56
  51. package/dist/authorization/index.js.map +1 -1
  52. package/dist/blob-storage/browser.js +15 -17
  53. package/dist/blob-storage/browser.js.map +1 -1
  54. package/dist/blob-storage/index.js +36 -38
  55. package/dist/blob-storage/index.js.map +1 -1
  56. package/dist/bootstrap/discovery.d.ts +14 -1
  57. package/dist/bootstrap/discovery.d.ts.map +1 -1
  58. package/dist/bootstrap/index.d.ts +2 -2
  59. package/dist/bootstrap/index.d.ts.map +1 -1
  60. package/dist/bootstrap/index.js +79 -88
  61. package/dist/bootstrap/index.js.map +1 -1
  62. package/dist/broker/index.js +8 -10
  63. package/dist/broker/index.js.map +1 -1
  64. package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
  65. package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
  66. package/dist/{chunk-q0k9nc5a.js → chunk-0w35wavj.js} +98 -98
  67. package/dist/{chunk-q0k9nc5a.js.map → chunk-0w35wavj.js.map} +2 -2
  68. package/dist/chunk-0y39rgsb.js +43 -0
  69. package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
  70. package/dist/{chunk-k522z7v6.js → chunk-17kfctj6.js} +16 -11
  71. package/dist/chunk-17kfctj6.js.map +10 -0
  72. package/dist/{chunk-aa2pen2v.js → chunk-1enhpacz.js} +188 -175
  73. package/dist/{chunk-aa2pen2v.js.map → chunk-1enhpacz.js.map} +2 -2
  74. package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
  75. package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
  76. package/dist/{chunk-fvt9rjsa.js → chunk-38zv5rkr.js} +4 -4
  77. package/dist/{chunk-fvt9rjsa.js.map → chunk-38zv5rkr.js.map} +1 -1
  78. package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
  79. package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
  80. package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
  81. package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
  82. package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
  83. package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
  84. package/dist/chunk-3frsnm7x.js +32 -0
  85. package/dist/chunk-3frsnm7x.js.map +11 -0
  86. package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
  87. package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
  88. package/dist/{chunk-mwsxn98e.js → chunk-52hbv0ak.js} +170 -170
  89. package/dist/{chunk-mwsxn98e.js.map → chunk-52hbv0ak.js.map} +4 -4
  90. package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
  91. package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
  92. package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
  93. package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
  94. package/dist/chunk-653vwrzr.js +39 -0
  95. package/dist/chunk-653vwrzr.js.map +10 -0
  96. package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
  97. package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
  98. package/dist/chunk-7apz6hg4.js +50 -0
  99. package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
  100. package/dist/chunk-7bs40fe1.js +218 -0
  101. package/dist/{chunk-p1rzczbt.js.map → chunk-7bs40fe1.js.map} +3 -3
  102. package/dist/chunk-7zgecwy1.js +113 -0
  103. package/dist/chunk-7zgecwy1.js.map +10 -0
  104. package/dist/{chunk-pc7ys28c.js → chunk-860dwwy0.js} +29 -29
  105. package/dist/{chunk-pc7ys28c.js.map → chunk-860dwwy0.js.map} +2 -2
  106. package/dist/chunk-8vj0rjgs.js +165 -0
  107. package/dist/chunk-8vj0rjgs.js.map +15 -0
  108. package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
  109. package/dist/chunk-92vk7gta.js.map +10 -0
  110. package/dist/{chunk-rafagrwr.js → chunk-93csa55g.js} +45 -17
  111. package/dist/chunk-93csa55g.js.map +11 -0
  112. package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
  113. package/dist/chunk-98cw09sw.js.map +10 -0
  114. package/dist/{chunk-n4khvw9n.js → chunk-9qsh3p5y.js} +17 -17
  115. package/dist/{chunk-n4khvw9n.js.map → chunk-9qsh3p5y.js.map} +2 -2
  116. package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
  117. package/dist/{chunk-9nbmsvn5.js → chunk-9vx5e9g1.js} +9 -9
  118. package/dist/{chunk-9nbmsvn5.js.map → chunk-9vx5e9g1.js.map} +2 -2
  119. package/dist/{chunk-f26bck4t.js → chunk-an5tt9y0.js} +353 -353
  120. package/dist/{chunk-f26bck4t.js.map → chunk-an5tt9y0.js.map} +2 -2
  121. package/dist/{chunk-2dw777qw.js → chunk-ap0g1g74.js} +37 -82
  122. package/dist/{chunk-2dw777qw.js.map → chunk-ap0g1g74.js.map} +3 -4
  123. package/dist/{chunk-v4en4jc2.js → chunk-awbhdqyc.js} +7 -7
  124. package/dist/{chunk-v4en4jc2.js.map → chunk-awbhdqyc.js.map} +2 -2
  125. package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
  126. package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
  127. package/dist/{chunk-nx7k8tpr.js → chunk-br3k6qbf.js} +23 -23
  128. package/dist/{chunk-nx7k8tpr.js.map → chunk-br3k6qbf.js.map} +2 -2
  129. package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
  130. package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
  131. package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
  132. package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
  133. package/dist/chunk-d62kjtbg.js +7 -0
  134. package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
  135. package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
  136. package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
  137. package/dist/{chunk-5e3pq99w.js → chunk-dmn70ztd.js} +30 -30
  138. package/dist/chunk-dmn70ztd.js.map +11 -0
  139. package/dist/{chunk-p1x242ad.js → chunk-dz5h08xv.js} +175 -175
  140. package/dist/{chunk-p1x242ad.js.map → chunk-dz5h08xv.js.map} +2 -2
  141. package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
  142. package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
  143. package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
  144. package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
  145. package/dist/{chunk-wtf06et8.js → chunk-emyyk7dx.js} +55 -55
  146. package/dist/{chunk-wtf06et8.js.map → chunk-emyyk7dx.js.map} +2 -2
  147. package/dist/{chunk-19jp6g9d.js → chunk-f0rwz2vh.js} +54 -33
  148. package/dist/chunk-f0rwz2vh.js.map +11 -0
  149. package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
  150. package/dist/chunk-f4w3yp4f.js.map +12 -0
  151. package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
  152. package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
  153. package/dist/{chunk-4sm0aznx.js → chunk-g00bfdq6.js} +254 -256
  154. package/dist/{chunk-4sm0aznx.js.map → chunk-g00bfdq6.js.map} +3 -3
  155. package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
  156. package/dist/chunk-g53f0e4j.js.map +15 -0
  157. package/dist/chunk-g6cke204.js +124 -0
  158. package/dist/chunk-g6cke204.js.map +10 -0
  159. package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
  160. package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
  161. package/dist/chunk-h1gfhhbh.js +602 -0
  162. package/dist/chunk-h1gfhhbh.js.map +18 -0
  163. package/dist/chunk-h3v76ams.js +32 -0
  164. package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
  165. package/dist/{chunk-xajtptbw.js → chunk-hpr1r6av.js} +1367 -418
  166. package/dist/chunk-hpr1r6av.js.map +44 -0
  167. package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
  168. package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
  169. package/dist/{chunk-w9tg6yyb.js → chunk-jjy0fhrn.js} +36 -36
  170. package/dist/{chunk-w9tg6yyb.js.map → chunk-jjy0fhrn.js.map} +2 -2
  171. package/dist/{chunk-wdage1eb.js → chunk-jmfet9r4.js} +6 -6
  172. package/dist/{chunk-wdage1eb.js.map → chunk-jmfet9r4.js.map} +2 -2
  173. package/dist/{chunk-ajnan18g.js → chunk-k3cqkkn2.js} +58 -55
  174. package/dist/chunk-k3cqkkn2.js.map +12 -0
  175. package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
  176. package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
  177. package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
  178. package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
  179. package/dist/{chunk-3z1qec12.js → chunk-m3z3x9v0.js} +107 -64
  180. package/dist/{chunk-3z1qec12.js.map → chunk-m3z3x9v0.js.map} +3 -3
  181. package/dist/{chunk-sbzzr4kx.js → chunk-mjbk2djy.js} +1061 -1195
  182. package/dist/{chunk-sbzzr4kx.js.map → chunk-mjbk2djy.js.map} +9 -15
  183. package/dist/{chunk-4jjp5k14.js → chunk-mmagke4x.js} +6 -6
  184. package/dist/{chunk-4jjp5k14.js.map → chunk-mmagke4x.js.map} +2 -2
  185. package/dist/{chunk-359jm1jw.js → chunk-mrp7k0pw.js} +20 -20
  186. package/dist/{chunk-359jm1jw.js.map → chunk-mrp7k0pw.js.map} +2 -2
  187. package/dist/{chunk-h0k55pc7.js → chunk-ms2tmn1k.js} +139 -139
  188. package/dist/{chunk-h0k55pc7.js.map → chunk-ms2tmn1k.js.map} +2 -2
  189. package/dist/{chunk-rv2hkwwa.js → chunk-ppytyr6w.js} +156 -179
  190. package/dist/{chunk-rv2hkwwa.js.map → chunk-ppytyr6w.js.map} +3 -5
  191. package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
  192. package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
  193. package/dist/{chunk-nn0tekr1.js → chunk-pr2h4bv4.js} +33 -33
  194. package/dist/{chunk-nn0tekr1.js.map → chunk-pr2h4bv4.js.map} +2 -2
  195. package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
  196. package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
  197. package/dist/{chunk-5ntny1qx.js → chunk-qf954wje.js} +6 -6
  198. package/dist/{chunk-5ntny1qx.js.map → chunk-qf954wje.js.map} +2 -2
  199. package/dist/{chunk-mth82m8t.js → chunk-qhcpj9wc.js} +77 -77
  200. package/dist/{chunk-mth82m8t.js.map → chunk-qhcpj9wc.js.map} +2 -2
  201. package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
  202. package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
  203. package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
  204. package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
  205. package/dist/{chunk-3xep5cjx.js → chunk-r4tfx1sf.js} +104 -86
  206. package/dist/chunk-r4tfx1sf.js.map +15 -0
  207. package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
  208. package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
  209. package/dist/chunk-s3csryxe.js +152 -0
  210. package/dist/chunk-s3csryxe.js.map +11 -0
  211. package/dist/chunk-s670k14v.js +60 -0
  212. package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
  213. package/dist/chunk-skz0hst3.js +788 -0
  214. package/dist/chunk-skz0hst3.js.map +19 -0
  215. package/dist/{chunk-r8jrnexe.js → chunk-v4jbb3rs.js} +4 -4
  216. package/dist/{chunk-r8jrnexe.js.map → chunk-v4jbb3rs.js.map} +2 -2
  217. package/dist/{chunk-v1xppd0y.js → chunk-vf691g1r.js} +60 -60
  218. package/dist/{chunk-v1xppd0y.js.map → chunk-vf691g1r.js.map} +2 -2
  219. package/dist/{chunk-w1tvjszy.js → chunk-vsj3mdfj.js} +8 -8
  220. package/dist/{chunk-w1tvjszy.js.map → chunk-vsj3mdfj.js.map} +2 -2
  221. package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
  222. package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
  223. package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
  224. package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
  225. package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
  226. package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
  227. package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
  228. package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
  229. package/dist/{chunk-z4ccwbkz.js → chunk-x9v4cx1d.js} +1 -1
  230. package/dist/{chunk-gbejpkex.js → chunk-xfbydgzy.js} +26 -26
  231. package/dist/{chunk-gbejpkex.js.map → chunk-xfbydgzy.js.map} +2 -2
  232. package/dist/{chunk-gzasd5b6.js → chunk-xyr8kppc.js} +22 -22
  233. package/dist/{chunk-gzasd5b6.js.map → chunk-xyr8kppc.js.map} +2 -2
  234. package/dist/{chunk-h5vqbfmd.js → chunk-ypbtykv6.js} +117 -117
  235. package/dist/{chunk-h5vqbfmd.js.map → chunk-ypbtykv6.js.map} +3 -3
  236. package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
  237. package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
  238. package/dist/{chunk-yp8ee62z.js → chunk-z30bv4ga.js} +35 -35
  239. package/dist/{chunk-yp8ee62z.js.map → chunk-z30bv4ga.js.map} +2 -2
  240. package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
  241. package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
  242. package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
  243. package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
  244. package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
  245. package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
  246. package/dist/{chunk-4yqmp43v.js → chunk-z8fx5cgb.js} +12 -12
  247. package/dist/{chunk-4yqmp43v.js.map → chunk-z8fx5cgb.js.map} +2 -2
  248. package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
  249. package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
  250. package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
  251. package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
  252. package/dist/connectors/connections/internal.js +9 -10
  253. package/dist/connectors/connections/internal.js.map +1 -1
  254. package/dist/datasets/write.js +8 -12
  255. package/dist/datasets/write.js.map +1 -1
  256. package/dist/edits/index.js +7 -8
  257. package/dist/edits/index.js.map +1 -1
  258. package/dist/error-reporting/internal.js +22 -24
  259. package/dist/error-reporting/internal.js.map +1 -1
  260. package/dist/errors/internal.d.ts +1 -1
  261. package/dist/errors/internal.d.ts.map +1 -1
  262. package/dist/errors/internal.js +22 -24
  263. package/dist/errors/internal.js.map +1 -1
  264. package/dist/errors/redaction.d.ts +8 -0
  265. package/dist/errors/redaction.d.ts.map +1 -0
  266. package/dist/errors/types.d.ts +4 -0
  267. package/dist/errors/types.d.ts.map +1 -1
  268. package/dist/events/index.js +60 -63
  269. package/dist/events/index.js.map +1 -1
  270. package/dist/events/scope.js +4 -5
  271. package/dist/events/scope.js.map +1 -1
  272. package/dist/events/selectors/index.js +9 -10
  273. package/dist/events/selectors/index.js.map +1 -1
  274. package/dist/execution/agent.d.ts +3 -3
  275. package/dist/execution/agent.d.ts.map +1 -1
  276. package/dist/execution/agent.js +70 -82
  277. package/dist/execution/agent.js.map +1 -1
  278. package/dist/execution/durable.d.ts +1 -0
  279. package/dist/execution/durable.d.ts.map +1 -1
  280. package/dist/execution/primitive.d.ts +2 -0
  281. package/dist/execution/primitive.d.ts.map +1 -1
  282. package/dist/execution/primitive.js +63 -71
  283. package/dist/execution/primitive.js.map +3 -3
  284. package/dist/execution/request.d.ts +1 -0
  285. package/dist/execution/request.d.ts.map +1 -1
  286. package/dist/execution/request.js +65 -75
  287. package/dist/execution/request.js.map +3 -3
  288. package/dist/http/index.js +10 -11
  289. package/dist/http/index.js.map +1 -1
  290. package/dist/index.d.ts +14 -10
  291. package/dist/index.d.ts.map +1 -1
  292. package/dist/index.js +455 -477
  293. package/dist/index.js.map +1 -1
  294. package/dist/lake-storage/index.js +38 -42
  295. package/dist/lake-storage/index.js.map +1 -1
  296. package/dist/logging/index.d.ts +3 -4
  297. package/dist/logging/index.d.ts.map +1 -1
  298. package/dist/logging/index.js +18 -40
  299. package/dist/logging/index.js.map +1 -1
  300. package/dist/logging/internal.d.ts +5 -0
  301. package/dist/logging/internal.d.ts.map +1 -0
  302. package/dist/logging/internal.js +43 -0
  303. package/dist/logging/internal.js.map +9 -0
  304. package/dist/materialization/index.js +46 -49
  305. package/dist/materialization/index.js.map +1 -1
  306. package/dist/materializer/index.js +137 -145
  307. package/dist/materializer/index.js.map +1 -1
  308. package/dist/models/errors.d.ts +4 -0
  309. package/dist/models/errors.d.ts.map +1 -1
  310. package/dist/models/execution/binding.d.ts +9 -0
  311. package/dist/models/execution/binding.d.ts.map +1 -0
  312. package/dist/models/execution/errors.d.ts +9 -0
  313. package/dist/models/execution/errors.d.ts.map +1 -0
  314. package/dist/models/execution/index.d.ts +11 -0
  315. package/dist/models/execution/index.d.ts.map +1 -0
  316. package/dist/models/execution/index.js +55 -0
  317. package/dist/models/execution/index.js.map +9 -0
  318. package/dist/models/execution/model-call-accounting.d.ts +17 -0
  319. package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
  320. package/dist/models/execution/model-call-admission.d.ts +47 -0
  321. package/dist/models/execution/model-call-admission.d.ts.map +1 -0
  322. package/dist/models/execution/model-call-limits.d.ts +15 -0
  323. package/dist/models/execution/model-call-limits.d.ts.map +1 -0
  324. package/dist/models/execution/model-call-recorder.d.ts +40 -0
  325. package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
  326. package/dist/models/execution/model-call-recovery.d.ts +12 -0
  327. package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
  328. package/dist/models/execution/recovery-queue.d.ts +5 -0
  329. package/dist/models/execution/recovery-queue.d.ts.map +1 -0
  330. package/dist/models/execution/types.d.ts +44 -0
  331. package/dist/models/execution/types.d.ts.map +1 -0
  332. package/dist/models/execution/usage.d.ts +5 -0
  333. package/dist/models/execution/usage.d.ts.map +1 -0
  334. package/dist/models/execution.d.ts +6 -0
  335. package/dist/models/execution.d.ts.map +1 -0
  336. package/dist/models/generation-types.d.ts +40 -0
  337. package/dist/models/generation-types.d.ts.map +1 -0
  338. package/dist/models/index.d.ts +1 -0
  339. package/dist/models/index.d.ts.map +1 -1
  340. package/dist/models/index.js +42 -43
  341. package/dist/models/index.js.map +1 -1
  342. package/dist/models/language-model.d.ts +3 -0
  343. package/dist/models/language-model.d.ts.map +1 -1
  344. package/dist/models/output.d.ts +5 -0
  345. package/dist/models/output.d.ts.map +1 -0
  346. package/dist/models/resolve.d.ts +4 -0
  347. package/dist/models/resolve.d.ts.map +1 -0
  348. package/dist/objects/execution.d.ts.map +1 -1
  349. package/dist/objects/index.js +75 -87
  350. package/dist/objects/index.js.map +1 -1
  351. package/dist/objects/query/index.js +67 -76
  352. package/dist/objects/query/index.js.map +1 -1
  353. package/dist/ontology/index.d.ts +1 -2
  354. package/dist/ontology/index.d.ts.map +1 -1
  355. package/dist/ontology/index.js +62 -113
  356. package/dist/ontology/index.js.map +1 -1
  357. package/dist/ontology/internal.d.ts +7 -0
  358. package/dist/ontology/internal.d.ts.map +1 -1
  359. package/dist/ontology/internal.js +65 -116
  360. package/dist/ontology/internal.js.map +3 -4
  361. package/dist/pipelines/index.js +57 -66
  362. package/dist/pipelines/index.js.map +1 -1
  363. package/dist/projections/internal.js +58 -67
  364. package/dist/projections/internal.js.map +1 -1
  365. package/dist/query.d.ts +0 -1
  366. package/dist/query.d.ts.map +1 -1
  367. package/dist/query.js +11 -15
  368. package/dist/query.js.map +1 -1
  369. package/dist/queues/index.d.ts +2 -1
  370. package/dist/queues/index.d.ts.map +1 -1
  371. package/dist/queues/index.js +6 -7
  372. package/dist/queues/index.js.map +1 -1
  373. package/dist/queues/types.d.ts +3 -20
  374. package/dist/queues/types.d.ts.map +1 -1
  375. package/dist/rules/internal.js +4 -5
  376. package/dist/rules/internal.js.map +1 -1
  377. package/dist/runtime/create.d.ts +2 -1
  378. package/dist/runtime/create.d.ts.map +1 -1
  379. package/dist/runtime/host.d.ts +2 -1
  380. package/dist/runtime/host.d.ts.map +1 -1
  381. package/dist/runtime/internal.js +13 -14
  382. package/dist/runtime/internal.js.map +1 -1
  383. package/dist/runtime/sixb.d.ts +2 -0
  384. package/dist/runtime/sixb.d.ts.map +1 -1
  385. package/dist/sandboxes/errors.d.ts +4 -0
  386. package/dist/sandboxes/errors.d.ts.map +1 -1
  387. package/dist/sandboxes/index.d.ts +2 -2
  388. package/dist/sandboxes/index.d.ts.map +1 -1
  389. package/dist/sandboxes/index.js +14 -13
  390. package/dist/sandboxes/index.js.map +1 -1
  391. package/dist/sandboxes/sandbox.d.ts +35 -7
  392. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  393. package/dist/scheduler/index.js +9 -10
  394. package/dist/scheduler/index.js.map +1 -1
  395. package/dist/schedules/index.js +31 -33
  396. package/dist/schedules/index.js.map +1 -1
  397. package/dist/shares/internal.js +46 -54
  398. package/dist/shares/internal.js.map +2 -2
  399. package/dist/storage/action-runs/failure.js +7 -9
  400. package/dist/storage/action-runs/failure.js.map +1 -1
  401. package/dist/storage/action-runs/provider.js +4 -8
  402. package/dist/storage/action-runs/provider.js.map +1 -1
  403. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  404. package/dist/storage/agents/provider.js +26 -30
  405. package/dist/storage/agents/provider.js.map +1 -1
  406. package/dist/storage/agents/types.d.ts +0 -3
  407. package/dist/storage/agents/types.d.ts.map +1 -1
  408. package/dist/storage/ai-cost/attribution.d.ts +4 -0
  409. package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
  410. package/dist/storage/ai-cost/groups.d.ts +3 -0
  411. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  412. package/dist/storage/ai-cost/provider.d.ts +1 -0
  413. package/dist/storage/ai-cost/provider.d.ts.map +1 -1
  414. package/dist/storage/ai-cost/provider.js +30 -143
  415. package/dist/storage/ai-cost/provider.js.map +3 -4
  416. package/dist/storage/ai-cost/types.d.ts +15 -0
  417. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  418. package/dist/storage/ai-limits/enforcement.js +14 -16
  419. package/dist/storage/ai-limits/enforcement.js.map +1 -1
  420. package/dist/storage/ai-limits/provider.js +56 -57
  421. package/dist/storage/ai-limits/provider.js.map +1 -1
  422. package/dist/storage/auth/in-memory.d.ts +1 -1
  423. package/dist/storage/auth/in-memory.d.ts.map +1 -1
  424. package/dist/storage/connector-connections/provider.js +34 -36
  425. package/dist/storage/connector-connections/provider.js.map +2 -2
  426. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  427. package/dist/storage/executions/provider.d.ts +2 -1
  428. package/dist/storage/executions/provider.d.ts.map +1 -1
  429. package/dist/storage/executions/provider.js +14 -11
  430. package/dist/storage/executions/provider.js.map +3 -3
  431. package/dist/storage/executions/types.d.ts +6 -2
  432. package/dist/storage/executions/types.d.ts.map +1 -1
  433. package/dist/storage/executions/validation.d.ts +2 -0
  434. package/dist/storage/executions/validation.d.ts.map +1 -1
  435. package/dist/storage/in-memory/index.d.ts.map +1 -1
  436. package/dist/storage/index.d.ts +6 -7
  437. package/dist/storage/index.d.ts.map +1 -1
  438. package/dist/storage/index.js +221 -256
  439. package/dist/storage/index.js.map +1 -1
  440. package/dist/storage/internal.d.ts +10 -0
  441. package/dist/storage/internal.d.ts.map +1 -0
  442. package/dist/storage/internal.js +47 -0
  443. package/dist/storage/internal.js.map +9 -0
  444. package/dist/storage/ontology/provider.js +105 -109
  445. package/dist/storage/ontology/provider.js.map +1 -1
  446. package/dist/storage/operation-scope.js +18 -19
  447. package/dist/storage/operation-scope.js.map +1 -1
  448. package/dist/storage/pipeline-runs/provider.js +4 -6
  449. package/dist/storage/pipeline-runs/provider.js.map +1 -1
  450. package/dist/storage/projection-runs/provider.js +66 -70
  451. package/dist/storage/projection-runs/provider.js.map +1 -1
  452. package/dist/storage/share-grants/provider.js +17 -19
  453. package/dist/storage/share-grants/provider.js.map +1 -1
  454. package/dist/storage/share-sessions/provider.js +14 -15
  455. package/dist/storage/share-sessions/provider.js.map +1 -1
  456. package/dist/storage/sync-runs/provider.js +4 -6
  457. package/dist/storage/sync-runs/provider.js.map +1 -1
  458. package/dist/storage/webhook-runs/provider.js +4 -6
  459. package/dist/storage/webhook-runs/provider.js.map +1 -1
  460. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  461. package/dist/storage/workflow-runs/provider.js +13 -21
  462. package/dist/storage/workflow-runs/provider.js.map +1 -1
  463. package/dist/storage/workflow-runs/types.d.ts +0 -3
  464. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  465. package/dist/syncs/index.js +55 -65
  466. package/dist/syncs/index.js.map +1 -1
  467. package/dist/testing/action-execution.d.ts +4 -1
  468. package/dist/testing/action-execution.d.ts.map +1 -1
  469. package/dist/testing/agent-execution.d.ts +1 -0
  470. package/dist/testing/agent-execution.d.ts.map +1 -1
  471. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  472. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  473. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  474. package/dist/testing/execution.d.ts +1 -0
  475. package/dist/testing/execution.d.ts.map +1 -1
  476. package/dist/testing/index.js +911 -799
  477. package/dist/testing/index.js.map +9 -9
  478. package/dist/testing/workflow-execution.d.ts +1 -0
  479. package/dist/testing/workflow-execution.d.ts.map +1 -1
  480. package/dist/webhooks/internal.js +51 -59
  481. package/dist/webhooks/internal.js.map +2 -2
  482. package/dist/workers/index.js +11 -13
  483. package/dist/workers/index.js.map +2 -2
  484. package/dist/workflows/failure.d.ts +2 -0
  485. package/dist/workflows/failure.d.ts.map +1 -1
  486. package/dist/workflows/index.js +135 -147
  487. package/dist/workflows/index.js.map +1 -1
  488. package/dist/workflows/request.d.ts.map +1 -1
  489. package/dist/workflows/run-dispatch.d.ts +0 -1
  490. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  491. package/dist/workflows/types.d.ts +2 -0
  492. package/dist/workflows/types.d.ts.map +1 -1
  493. package/package.json +48 -30
  494. package/src/actions/run-dispatch.ts +2 -6
  495. package/src/actions/types/context.ts +2 -0
  496. package/src/actions/validation.ts +2 -1
  497. package/src/agents/adapters.ts +4 -9
  498. package/src/agents/{context.ts → context/entries.ts} +4 -4
  499. package/src/agents/context/index.ts +15 -0
  500. package/src/agents/context-model.ts +1 -1
  501. package/src/agents/context-resolution.ts +1 -1
  502. package/src/agents/index.ts +4 -4
  503. package/src/agents/message.ts +1 -1
  504. package/src/agents/model-loop.ts +8 -0
  505. package/src/agents/request.ts +11 -26
  506. package/src/agents/streams/index.ts +18 -0
  507. package/src/agents/streams/internal.ts +19 -0
  508. package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
  509. package/src/agents/types.ts +1 -1
  510. package/src/agents/validation.ts +3 -7
  511. package/src/auth/index.ts +0 -1
  512. package/src/bootstrap/discovery.ts +81 -24
  513. package/src/bootstrap/index.ts +8 -1
  514. package/src/errors/internal.ts +90 -10
  515. package/src/errors/redaction.ts +98 -0
  516. package/src/errors/types.ts +4 -0
  517. package/src/execution/agent.ts +5 -3
  518. package/src/execution/durable.ts +11 -1
  519. package/src/execution/primitive.ts +5 -1
  520. package/src/execution/request.ts +3 -0
  521. package/src/index.ts +20 -18
  522. package/src/logging/index.ts +2 -33
  523. package/src/logging/internal.ts +43 -0
  524. package/src/models/errors.ts +12 -0
  525. package/src/models/execution/binding.ts +29 -0
  526. package/src/models/execution/errors.ts +18 -0
  527. package/src/models/execution/index.ts +26 -0
  528. package/src/models/execution/model-call-accounting.ts +211 -0
  529. package/src/models/execution/model-call-admission.ts +127 -0
  530. package/src/models/execution/model-call-limits.ts +135 -0
  531. package/src/models/execution/model-call-recorder.ts +235 -0
  532. package/src/models/execution/model-call-recovery.ts +125 -0
  533. package/src/models/execution/recovery-queue.ts +31 -0
  534. package/src/models/execution/types.ts +58 -0
  535. package/src/models/execution/usage.ts +23 -0
  536. package/src/models/execution.ts +207 -0
  537. package/src/models/generation-types.ts +50 -0
  538. package/src/models/index.ts +8 -0
  539. package/src/models/language-model.ts +3 -0
  540. package/src/models/output.ts +45 -0
  541. package/src/models/resolve.ts +27 -0
  542. package/src/objects/execution.ts +1 -1
  543. package/src/ontology/index.ts +1 -2
  544. package/src/ontology/internal.ts +35 -0
  545. package/src/projections/run-dispatch.ts +1 -0
  546. package/src/query.ts +0 -1
  547. package/src/queues/index.ts +4 -2
  548. package/src/queues/types.ts +6 -25
  549. package/src/runtime/create.ts +2 -1
  550. package/src/runtime/host.ts +2 -1
  551. package/src/runtime/sixb.ts +4 -0
  552. package/src/sandboxes/errors.ts +5 -0
  553. package/src/sandboxes/index.ts +3 -0
  554. package/src/sandboxes/sandbox.ts +35 -7
  555. package/src/storage/agents/in-memory.ts +0 -3
  556. package/src/storage/agents/types.ts +0 -3
  557. package/src/storage/ai-cost/analytics.ts +1 -1
  558. package/src/storage/ai-cost/attribution.ts +15 -0
  559. package/src/storage/ai-cost/groups.ts +5 -1
  560. package/src/storage/ai-cost/provider.ts +1 -0
  561. package/src/storage/ai-cost/types.ts +7 -0
  562. package/src/storage/auth/in-memory.ts +1 -1
  563. package/src/storage/executions/in-memory.ts +4 -9
  564. package/src/storage/executions/provider.ts +4 -0
  565. package/src/storage/executions/types.ts +6 -2
  566. package/src/storage/executions/validation.ts +32 -0
  567. package/src/storage/in-memory/index.ts +16 -1
  568. package/src/storage/index.ts +3 -29
  569. package/src/storage/internal.ts +20 -0
  570. package/src/storage/workflow-runs/in-memory.ts +0 -2
  571. package/src/storage/workflow-runs/types.ts +0 -3
  572. package/src/testing/action-execution.ts +9 -2
  573. package/src/testing/agent-execution.ts +3 -0
  574. package/src/testing/agent-storage-contract.ts +0 -5
  575. package/src/testing/ai-model-call-groups-contract.ts +74 -2
  576. package/src/testing/execution-storage-contract.ts +59 -1
  577. package/src/testing/execution.ts +6 -0
  578. package/src/testing/workflow-execution.ts +4 -0
  579. package/src/workflows/failure.ts +62 -1
  580. package/src/workflows/request.ts +0 -9
  581. package/src/workflows/run-dispatch.ts +0 -3
  582. package/src/workflows/types.ts +2 -0
  583. package/src/workflows/validation.ts +1 -1
  584. package/dist/agents/context.d.ts.map +0 -1
  585. package/dist/agents/context.js +0 -23
  586. package/dist/agents/streams.d.ts.map +0 -1
  587. package/dist/agents/streams.js +0 -55
  588. package/dist/chunk-08m3b6w8.js +0 -32
  589. package/dist/chunk-19jp6g9d.js.map +0 -11
  590. package/dist/chunk-2xns679x.js.map +0 -11
  591. package/dist/chunk-3xep5cjx.js.map +0 -15
  592. package/dist/chunk-407j3msh.js +0 -60
  593. package/dist/chunk-4qfkag59.js +0 -1568
  594. package/dist/chunk-4qfkag59.js.map +0 -20
  595. package/dist/chunk-5e3pq99w.js.map +0 -11
  596. package/dist/chunk-7y0f6rf1.js.map +0 -10
  597. package/dist/chunk-ajnan18g.js.map +0 -12
  598. package/dist/chunk-c15dr03f.js +0 -43
  599. package/dist/chunk-d8qkxt2v.js.map +0 -10
  600. package/dist/chunk-jq43kdvk.js +0 -50
  601. package/dist/chunk-k522z7v6.js.map +0 -10
  602. package/dist/chunk-p03r0h5s.js.map +0 -16
  603. package/dist/chunk-p1rzczbt.js +0 -218
  604. package/dist/chunk-rafagrwr.js.map +0 -11
  605. package/dist/chunk-xajtptbw.js.map +0 -40
  606. package/dist/chunk-y64skrwp.js +0 -19
  607. package/dist/chunk-zcnhxkvd.js +0 -7
  608. package/dist/logging/types.js +0 -27
  609. package/dist/logging/types.js.map +0 -9
  610. /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
  611. /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
  612. /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
  613. /package/dist/{chunk-j1sbhm7p.js → chunk-ey1nk510.js} +0 -0
  614. /package/dist/{chunk-j1sbhm7p.js.map → chunk-ey1nk510.js.map} +0 -0
  615. /package/dist/{chunk-z4ccwbkz.js.map → chunk-x9v4cx1d.js.map} +0 -0
@@ -1,50 +1,48 @@
1
1
  // @bun
2
2
  import {
3
- validateSchemaOrRefValue
4
- } from "./chunk-2dw777qw.js";
3
+ GRANT_KINDS,
4
+ grantKindOf,
5
+ canAccessApplication2,
6
+ resolveRoleGrants2,
7
+ resolveAuthorizationContext2
8
+ } from "./chunk-dz5h08xv.js";
5
9
  import {
6
- snapshotLinkPathSelection
7
- } from "./chunk-19jp6g9d.js";
10
+ normalizeSchemaValue2,
11
+ coerceSchemaValueToTyped2
12
+ } from "./chunk-ms2tmn1k.js";
8
13
  import {
9
- AuthRuntimeError,
10
- assertNonEmpty,
11
- getCookie,
12
- isInvitationDeliveryAuthStrategy,
13
- normalizePagination,
14
- resolveAuthConfig,
14
+ AuthRuntimeError2,
15
+ resolveAuthSessionAudience2,
15
16
  resolveAuthCookieOptionsForAudience,
16
- resolveAuthSessionAudience,
17
+ getCookie2,
18
+ resolveAuthConfig2,
17
19
  resolveInvitationExpiresAt,
18
- sanitizeReturnTo
19
- } from "./chunk-xwnf87e1.js";
20
- import {
21
- GRANT_KINDS,
22
- canAccessApplication,
23
- grantKindOf,
24
- resolveAuthorizationContext,
25
- resolveRoleGrants
26
- } from "./chunk-p1x242ad.js";
20
+ sanitizeReturnTo,
21
+ assertNonEmpty3,
22
+ normalizePagination,
23
+ isInvitationDeliveryAuthStrategy2
24
+ } from "./chunk-q5gz3g2j.js";
27
25
  import {
28
- coerceSchemaValueToTyped,
29
- normalizeSchemaValue
30
- } from "./chunk-h0k55pc7.js";
26
+ validateSchemaOrRefValue2,
27
+ snapshotLinkPathSelection
28
+ } from "./chunk-f0rwz2vh.js";
31
29
  import {
32
- OntologyValidationError
33
- } from "./chunk-dktq02ne.js";
30
+ OntologyValidationError2
31
+ } from "./chunk-cqr3acm1.js";
34
32
 
35
33
  // src/auth/access-tokens.ts
36
34
  import { createHash, randomBytes, randomUUID } from "crypto";
37
- var PERSONAL_ACCESS_TOKEN_PREFIX = "sixb_pat";
38
- 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";
39
37
  var ACCESS_TOKEN_ID_PATTERN = /^tok_[A-Za-z0-9_-]+$/;
40
38
  var ACCESS_TOKEN_SECRET_PATTERN = /^[A-Za-z0-9_-]{32,}$/;
41
- function generateAccessTokenSecret() {
39
+ function generateAccessTokenSecret2() {
42
40
  return randomBytes(32).toString("base64url");
43
41
  }
44
- function hashAccessTokenSecret(secret) {
42
+ function hashAccessTokenSecret2(secret) {
45
43
  return createHash("sha256").update(secret).digest("hex");
46
44
  }
47
- function formatAccessTokenValue(kind, tokenId, tokenSecret) {
45
+ function formatAccessTokenValue2(kind, tokenId, tokenSecret) {
48
46
  const prefix = accessTokenPrefixForKind(kind);
49
47
  if (!ACCESS_TOKEN_ID_PATTERN.test(tokenId)) {
50
48
  throw new Error("[Sixb] Access token ids must start with 'tok_' and be URL-safe.");
@@ -54,7 +52,7 @@ function formatAccessTokenValue(kind, tokenId, tokenSecret) {
54
52
  }
55
53
  return `${prefix}_${tokenId}.${tokenSecret}`;
56
54
  }
57
- function parseAccessTokenValue(value) {
55
+ function parseAccessTokenValue2(value) {
58
56
  if (!value) {
59
57
  return null;
60
58
  }
@@ -74,7 +72,7 @@ function parseAccessTokenValue(value) {
74
72
  }
75
73
  return { kind, tokenId, tokenSecret };
76
74
  }
77
- function getBearerAccessTokenValue(request) {
75
+ function getBearerAccessTokenValue2(request) {
78
76
  const header = request.headers.get("authorization");
79
77
  if (!header) {
80
78
  return null;
@@ -85,49 +83,49 @@ function getBearerAccessTokenValue(request) {
85
83
  }
86
84
  return token;
87
85
  }
88
- function createAccessTokenCredential(kind, tokenId = `tok_${randomUUID()}`) {
89
- const tokenSecret = generateAccessTokenSecret();
86
+ function createAccessTokenCredential2(kind, tokenId = `tok_${randomUUID()}`) {
87
+ const tokenSecret = generateAccessTokenSecret2();
90
88
  return {
91
89
  kind,
92
90
  tokenId,
93
91
  tokenSecret,
94
- tokenHash: hashAccessTokenSecret(tokenSecret),
95
- tokenValue: formatAccessTokenValue(kind, tokenId, tokenSecret)
92
+ tokenHash: hashAccessTokenSecret2(tokenSecret),
93
+ tokenValue: formatAccessTokenValue2(kind, tokenId, tokenSecret)
96
94
  };
97
95
  }
98
96
  function accessTokenPrefixForKind(kind) {
99
97
  switch (kind) {
100
98
  case "personal":
101
- return PERSONAL_ACCESS_TOKEN_PREFIX;
99
+ return PERSONAL_ACCESS_TOKEN_PREFIX2;
102
100
  case "serviceAccount":
103
- return SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX;
101
+ return SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2;
104
102
  }
105
103
  }
106
104
  function accessTokenKindFromLabel(label) {
107
- if (label.startsWith(`${PERSONAL_ACCESS_TOKEN_PREFIX}_`)) {
105
+ if (label.startsWith(`${PERSONAL_ACCESS_TOKEN_PREFIX2}_`)) {
108
106
  return "personal";
109
107
  }
110
- if (label.startsWith(`${SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX}_`)) {
108
+ if (label.startsWith(`${SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2}_`)) {
111
109
  return "serviceAccount";
112
110
  }
113
111
  return null;
114
112
  }
115
113
  // src/auth/csrf.ts
116
114
  import { randomBytes as randomBytes2, timingSafeEqual } from "crypto";
117
- var CSRF_HEADER_NAME = "x-sixb-csrf";
118
- function generateCsrfToken() {
115
+ var CSRF_HEADER_NAME2 = "x-sixb-csrf";
116
+ function generateCsrfToken2() {
119
117
  return randomBytes2(32).toString("base64url");
120
118
  }
121
- function isCsrfExemptMethod(method) {
119
+ function isCsrfExemptMethod2(method) {
122
120
  const normalized = method.toUpperCase();
123
121
  return normalized === "GET" || normalized === "HEAD" || normalized === "OPTIONS";
124
122
  }
125
- function verifyDoubleSubmitCsrf(request, options) {
126
- if (isCsrfExemptMethod(request.method)) {
123
+ function verifyDoubleSubmitCsrf2(request, options) {
124
+ if (isCsrfExemptMethod2(request.method)) {
127
125
  return true;
128
126
  }
129
- const cookieValue = getCookie(request, options.cookieName);
130
- 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);
131
129
  if (!cookieValue || !headerValue) {
132
130
  return false;
133
131
  }
@@ -145,13 +143,13 @@ function safeEqual(left, right) {
145
143
  import { randomUUID as randomUUID3 } from "crypto";
146
144
 
147
145
  // src/security/applications.ts
148
- var applications = {
146
+ var applications2 = {
149
147
  atlas: { kind: "application", id: "atlas", label: "Atlas" },
150
148
  app: { kind: "application", id: "app", label: "Custom app" }
151
149
  };
152
- 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));
153
151
  // src/security/errors.ts
154
- class SecurityValidationError extends Error {
152
+ class SecurityValidationError2 extends Error {
155
153
  name = "SecurityValidationError";
156
154
  }
157
155
 
@@ -236,12 +234,12 @@ function formatAlternatives(values) {
236
234
  function isRecord(value) {
237
235
  return typeof value === "object" && value !== null && !Array.isArray(value);
238
236
  }
239
- function assertNonEmptyString(value, field, createError = (message) => new SecurityValidationError(message)) {
237
+ function assertNonEmptyString(value, field, createError = (message) => new SecurityValidationError2(message)) {
240
238
  if (typeof value !== "string" || value.trim().length === 0) {
241
239
  throw createError(`[Sixb] ${field} must not be empty.`);
242
240
  }
243
241
  }
244
- function assertOptionalString(value, field, createError = (message) => new SecurityValidationError(message)) {
242
+ function assertOptionalString(value, field, createError = (message) => new SecurityValidationError2(message)) {
245
243
  if (value === undefined) {
246
244
  return;
247
245
  }
@@ -271,7 +269,7 @@ function assertNoDuplicateIds(ids, field) {
271
269
  const seen = new Set;
272
270
  for (const id of ids) {
273
271
  if (seen.has(id)) {
274
- throw new SecurityValidationError(`[Sixb] ${field} contains duplicate group id '${id}'.`);
272
+ throw new SecurityValidationError2(`[Sixb] ${field} contains duplicate group id '${id}'.`);
275
273
  }
276
274
  seen.add(id);
277
275
  }
@@ -280,12 +278,12 @@ function assertNoDuplicateOperations(operations, field) {
280
278
  const seen = new Set;
281
279
  for (const operation of operations) {
282
280
  if (seen.has(operation)) {
283
- throw new SecurityValidationError(`[Sixb] ${field} contains duplicate operation '${operation}'.`);
281
+ throw new SecurityValidationError2(`[Sixb] ${field} contains duplicate operation '${operation}'.`);
284
282
  }
285
283
  seen.add(operation);
286
284
  }
287
285
  }
288
- function assertGroupDefinition(value, createError = (message) => new SecurityValidationError(message)) {
286
+ function assertGroupDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
289
287
  if (!isRecord(value)) {
290
288
  throw createError("[Sixb] Group definition must be an object.");
291
289
  }
@@ -304,7 +302,7 @@ function isGroupDefinition(value) {
304
302
  return false;
305
303
  }
306
304
  }
307
- function assertMembershipPolicyDefinition(value, createError = (message) => new SecurityValidationError(message)) {
305
+ function assertMembershipPolicyDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
308
306
  if (!isRecord(value)) {
309
307
  throw createError("[Sixb] Membership policy definition must be an object.");
310
308
  }
@@ -324,7 +322,7 @@ function isMembershipPolicyDefinition(value) {
324
322
  return false;
325
323
  }
326
324
  }
327
- function assertGrantDefinition(value, field, createError = (message) => new SecurityValidationError(message)) {
325
+ function assertGrantDefinition(value, field, createError = (message) => new SecurityValidationError2(message)) {
328
326
  if (!isRecord(value) || value.kind !== "grant") {
329
327
  throw createError(`[Sixb] ${field} must contain only grant definitions from 'can'.`);
330
328
  }
@@ -366,7 +364,7 @@ function assertSelection(value, field, createError) {
366
364
  assertNonEmptyString(id, `${field} grant selection id`, createError);
367
365
  }
368
366
  }
369
- function assertRoleDefinition(value, createError = (message) => new SecurityValidationError(message)) {
367
+ function assertRoleDefinition(value, createError = (message) => new SecurityValidationError2(message)) {
370
368
  if (!isRecord(value)) {
371
369
  throw createError("[Sixb] Role definition must be an object.");
372
370
  }
@@ -399,25 +397,25 @@ function validateSecurityDefinitionsAtStartup(input) {
399
397
  for (const group of input.groups) {
400
398
  assertGroupDefinition(group);
401
399
  if (groupsById.has(group.id)) {
402
- throw new SecurityValidationError(`[Sixb] Duplicate group id: ${group.id}`);
400
+ throw new SecurityValidationError2(`[Sixb] Duplicate group id: ${group.id}`);
403
401
  }
404
402
  groupsById.set(group.id, group);
405
403
  }
406
404
  for (const role of input.roles ?? []) {
407
405
  assertRoleDefinition(role);
408
406
  if (rolesById.has(role.id)) {
409
- throw new SecurityValidationError(`[Sixb] Duplicate role id: ${role.id}`);
407
+ throw new SecurityValidationError2(`[Sixb] Duplicate role id: ${role.id}`);
410
408
  }
411
409
  if (role.grantedToGroupIds.length === 0) {
412
- 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.`);
413
411
  }
414
412
  if (role.grants.length === 0) {
415
- 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.`);
416
414
  }
417
415
  assertNoDuplicateIds(role.grantedToGroupIds, `Role '${role.id}' grantedTo`);
418
416
  for (const groupId of role.grantedToGroupIds) {
419
417
  if (!groupsById.has(groupId)) {
420
- 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 }).`);
421
419
  }
422
420
  }
423
421
  for (const grant of role.grants) {
@@ -428,25 +426,25 @@ function validateSecurityDefinitionsAtStartup(input) {
428
426
  for (const policy of input.membershipPolicies) {
429
427
  assertMembershipPolicyDefinition(policy);
430
428
  if (membershipPoliciesById.has(policy.id)) {
431
- throw new SecurityValidationError(`[Sixb] Duplicate membership policy id: ${policy.id}`);
429
+ throw new SecurityValidationError2(`[Sixb] Duplicate membership policy id: ${policy.id}`);
432
430
  }
433
431
  if (policy.grantedToGroupIds.length === 0) {
434
- 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.`);
435
433
  }
436
434
  if (policy.can.length === 0) {
437
- 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.`);
438
436
  }
439
437
  assertNoDuplicateIds(policy.grantedToGroupIds, `Membership policy '${policy.id}' grantedTo`);
440
438
  assertNoDuplicateIds(policy.scopeGroupIds, `Membership policy '${policy.id}' scope`);
441
439
  assertNoDuplicateOperations(policy.can, `Membership policy '${policy.id}' can`);
442
440
  for (const groupId of policy.grantedToGroupIds) {
443
441
  if (!groupsById.has(groupId)) {
444
- 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 }).`);
445
443
  }
446
444
  }
447
445
  for (const groupId of policy.scopeGroupIds) {
448
446
  if (!groupsById.has(groupId)) {
449
- 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 }).`);
450
448
  }
451
449
  }
452
450
  membershipPoliciesById.set(policy.id, policy);
@@ -462,9 +460,9 @@ function validateSecurityDefinitionsAtStartup(input) {
462
460
  }
463
461
  function assertGrantReferences(roleId, grant, registered) {
464
462
  if (grant.capability === "run" && grant.target === "agent") {
465
- const spec2 = GRANT_KINDS[grantKindOf(grant)];
463
+ const spec = GRANT_KINDS[grantKindOf(grant)];
466
464
  if (!registered.agentAvailable) {
467
- 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}`);
468
466
  }
469
467
  return;
470
468
  }
@@ -476,7 +474,7 @@ function assertGrantReferences(roleId, grant, registered) {
476
474
  const ids = grant.selection.all ? grant.selection.except : grant.selection.ids;
477
475
  for (const id of ids) {
478
476
  if (!universe.has(id)) {
479
- 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}`);
480
478
  }
481
479
  }
482
480
  }
@@ -485,13 +483,13 @@ function assertGrantReferences(roleId, grant, registered) {
485
483
  var MEMBERSHIP_OPERATIONS2 = new Set(["invite", "assignGroups", "suspend"]);
486
484
  function assertNonEmptyArray(value, field) {
487
485
  if (value.length === 0) {
488
- throw new SecurityValidationError(`[Sixb] ${field} must not be empty.`);
486
+ throw new SecurityValidationError2(`[Sixb] ${field} must not be empty.`);
489
487
  }
490
488
  }
491
489
  function groupIdsFrom(groups, field) {
492
490
  return groups.map((group) => {
493
491
  if (!isRecord(group) || group.kind !== "group") {
494
- throw new SecurityValidationError(`[Sixb] ${field} must contain only group definitions.`);
492
+ throw new SecurityValidationError2(`[Sixb] ${field} must contain only group definitions.`);
495
493
  }
496
494
  assertNonEmptyString(group.id, `${field} group id`);
497
495
  return group.id;
@@ -500,12 +498,12 @@ function groupIdsFrom(groups, field) {
500
498
  function membershipOperationsFrom(operations, field) {
501
499
  return operations.map((operation) => {
502
500
  if (!MEMBERSHIP_OPERATIONS2.has(operation)) {
503
- 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.`);
504
502
  }
505
503
  return operation;
506
504
  });
507
505
  }
508
- function defineGroup(id, options = {}) {
506
+ function defineGroup2(id, options = {}) {
509
507
  assertNonEmptyString(id, "Group id");
510
508
  assertOptionalString(options.label, `Group '${id}' label`);
511
509
  assertOptionalString(options.description, `Group '${id}' description`);
@@ -516,7 +514,7 @@ function defineGroup(id, options = {}) {
516
514
  ...options.description !== undefined ? { description: options.description } : {}
517
515
  };
518
516
  }
519
- function defineRole(id, options) {
517
+ function defineRole2(id, options) {
520
518
  assertNonEmptyString(id, "Role id");
521
519
  assertOptionalString(options.label, `Role '${id}' label`);
522
520
  assertOptionalString(options.description, `Role '${id}' description`);
@@ -526,7 +524,7 @@ function defineRole(id, options) {
526
524
  assertGrantDefinition(grant, `Role '${id}' grants`);
527
525
  }
528
526
  if (options.grants.length === 0) {
529
- throw new SecurityValidationError(`[Sixb] Role '${id}' grants must not be empty.`);
527
+ throw new SecurityValidationError2(`[Sixb] Role '${id}' grants must not be empty.`);
530
528
  }
531
529
  return {
532
530
  kind: "role",
@@ -537,7 +535,7 @@ function defineRole(id, options) {
537
535
  grants: options.grants
538
536
  };
539
537
  }
540
- function defineMembershipPolicy(id, options) {
538
+ function defineMembershipPolicy2(id, options) {
541
539
  assertNonEmptyString(id, "Membership policy id");
542
540
  assertNonEmptyArray(options.grantedTo, `Membership policy '${id}' grantedTo`);
543
541
  assertNonEmptyArray(options.can, `Membership policy '${id}' can`);
@@ -569,7 +567,7 @@ function isBreadthSelector(value) {
569
567
  }
570
568
  function definitionIdOf(item, label) {
571
569
  if (typeof item?.id !== "string" || !item.id.trim()) {
572
- 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.`);
573
571
  }
574
572
  return item.id;
575
573
  }
@@ -585,7 +583,7 @@ function all(target, except = []) {
585
583
  }
586
584
  };
587
585
  }
588
- var every = {
586
+ var every2 = {
589
587
  object: () => all("object"),
590
588
  dataset: () => all("dataset"),
591
589
  action: () => all("action"),
@@ -597,11 +595,11 @@ var every = {
597
595
  share: () => all("share")
598
596
  };
599
597
  // src/actions/errors.ts
600
- class ActionDefinitionError extends Error {
598
+ class ActionDefinitionError2 extends Error {
601
599
  name = "ActionDefinitionError";
602
600
  }
603
601
 
604
- class ActionEditCommitError extends Error {
602
+ class ActionEditCommitError2 extends Error {
605
603
  name = "ActionEditCommitError";
606
604
  }
607
605
  function missingActionMutationMessage(actionId) {
@@ -614,17 +612,17 @@ function effectsWithoutEditsMessage(actionId) {
614
612
  // src/actions/validation.ts
615
613
  function assertNonEmpty2(value, field) {
616
614
  if (!value.trim()) {
617
- throw new ActionDefinitionError(`Action ${field} must not be empty.`);
615
+ throw new ActionDefinitionError2(`Action ${field} must not be empty.`);
618
616
  }
619
617
  }
620
- function isActionDefinition(value) {
618
+ function isActionDefinition2(value) {
621
619
  const binding = value?.binding;
622
620
  return typeof value === "object" && value !== null && value.kind === "action" && (binding?.kind === "global" || binding?.kind === "object");
623
621
  }
624
- function isGlobalActionDefinition(value) {
622
+ function isGlobalActionDefinition2(value) {
625
623
  return value.binding.kind === "global";
626
624
  }
627
- function isObjectActionDefinition(value) {
625
+ function isObjectActionDefinition2(value) {
628
626
  return value.binding.kind === "object";
629
627
  }
630
628
  function normalizeActionParams(runtime, paramsConfig, params, pathPrefix) {
@@ -632,30 +630,30 @@ function normalizeActionParams(runtime, paramsConfig, params, pathPrefix) {
632
630
  const normalized = {};
633
631
  for (const paramId of Object.keys(params)) {
634
632
  if (!knownParamIds.has(paramId)) {
635
- throw new OntologyValidationError(`Unknown param '${paramId}' for action '${pathPrefix}'`);
633
+ throw new OntologyValidationError2(`Unknown param '${paramId}' for action '${pathPrefix}'`);
636
634
  }
637
635
  }
638
636
  for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
639
637
  const value = params[paramId];
640
638
  if (value === undefined) {
641
639
  if (paramDef.required) {
642
- throw new OntologyValidationError(`Missing required param '${paramId}' for action '${pathPrefix}'`);
640
+ throw new OntologyValidationError2(`Missing required param '${paramId}' for action '${pathPrefix}'`);
643
641
  }
644
642
  continue;
645
643
  }
646
644
  if (value === null) {
647
645
  if (!paramDef.nullable) {
648
- throw new OntologyValidationError(`[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`);
646
+ throw new OntologyValidationError2(`[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`);
649
647
  }
650
648
  normalized[paramId] = null;
651
649
  continue;
652
650
  }
653
- validateSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
651
+ validateSchemaOrRefValue2(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
654
652
  normalized[paramId] = normalizeSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
655
653
  }
656
654
  return normalized;
657
655
  }
658
- function coerceActionParamsToTyped(paramsConfig, params, valueTypesById) {
656
+ function coerceActionParamsToTyped2(paramsConfig, params, valueTypesById) {
659
657
  const coerced = { ...params };
660
658
  for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
661
659
  const value = params[paramId];
@@ -665,23 +663,23 @@ function coerceActionParamsToTyped(paramsConfig, params, valueTypesById) {
665
663
  if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
666
664
  continue;
667
665
  }
668
- coerced[paramId] = coerceSchemaValueToTyped(schema, value, valueTypesById);
666
+ coerced[paramId] = coerceSchemaValueToTyped2(schema, value, valueTypesById);
669
667
  }
670
668
  return coerced;
671
669
  }
672
670
  function validateActionSubject(action, subject) {
673
- if (isGlobalActionDefinition(action) && subject.kind !== "none") {
674
- throw new OntologyValidationError(`Action '${action.id}' does not accept an object subject.`);
671
+ if (isGlobalActionDefinition2(action) && subject.kind !== "none") {
672
+ throw new OntologyValidationError2(`Action '${action.id}' does not accept an object subject.`);
675
673
  }
676
674
  }
677
675
  function resolveObjectActionSubject(params) {
678
676
  const { runtime, action, subject } = params;
679
677
  if (subject.kind !== "object") {
680
- throw new OntologyValidationError(`Action '${action.id}' requires an object subject.`);
678
+ throw new OntologyValidationError2(`Action '${action.id}' requires an object subject.`);
681
679
  }
682
680
  const objectType = runtime.ontology.resolveObjectType(subject.objectTypeId);
683
681
  if (!actionAppliesToObjectType(runtime, action, objectType)) {
684
- throw new OntologyValidationError(`Action '${action.id}' is not valid for object type '${objectType.id}'.`);
682
+ throw new OntologyValidationError2(`Action '${action.id}' is not valid for object type '${objectType.id}'.`);
685
683
  }
686
684
  return objectType;
687
685
  }
@@ -696,18 +694,18 @@ function normalizeSchemaOrRefValue(schema, value, path, valueTypesById) {
696
694
  primaryId: refValue.primaryId
697
695
  };
698
696
  }
699
- return normalizeSchemaValue(schema, value, path, valueTypesById);
697
+ return normalizeSchemaValue2(schema, value, path, valueTypesById);
700
698
  }
701
699
 
702
700
  // src/shares/errors.ts
703
- class ShareDefinitionError extends Error {
701
+ class ShareDefinitionError2 extends Error {
704
702
  name = "ShareDefinitionError";
705
703
  }
706
704
 
707
705
  // src/shares/builders.ts
708
706
  var shareTargets = new WeakSet;
709
- function defineShare(id, options) {
710
- assertNonEmpty3(id, "Share id");
707
+ function defineShare2(id, options) {
708
+ assertNonEmpty(id, "Share id");
711
709
  if (!isObjectType(options.target)) {
712
710
  throw invalid(`Share '${id}' target must be an object type.`);
713
711
  }
@@ -722,7 +720,7 @@ function defineShare(id, options) {
722
720
  try {
723
721
  authoredGrants = options.grants({ target });
724
722
  } catch (error) {
725
- if (error instanceof ShareDefinitionError)
723
+ if (error instanceof ShareDefinitionError2)
726
724
  throw error;
727
725
  const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
728
726
  throw invalid(`Share '${id}' grants are invalid: ${reason}`);
@@ -784,7 +782,7 @@ function snapshotShareDefinition(value) {
784
782
  ...description === undefined ? {} : { description }
785
783
  });
786
784
  } catch (error) {
787
- if (error instanceof ShareDefinitionError)
785
+ if (error instanceof ShareDefinitionError2)
788
786
  throw error;
789
787
  const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
790
788
  throw invalid(`Share definition is invalid: ${reason}`);
@@ -914,7 +912,7 @@ function snapshotLinkMode(value) {
914
912
  links: snapshotLinkPaths(links)
915
913
  });
916
914
  } catch (error) {
917
- if (error instanceof ShareDefinitionError)
915
+ if (error instanceof ShareDefinitionError2)
918
916
  throw error;
919
917
  const reason = error instanceof Error ? error.message.replace(/^\[Sixb\] /, "") : String(error);
920
918
  throw invalid(`Share link selection is invalid: ${reason}`);
@@ -980,16 +978,16 @@ function isRecord2(value) {
980
978
  function isNonEmpty(value) {
981
979
  return typeof value === "string" && value.trim().length > 0;
982
980
  }
983
- function assertNonEmpty3(value, field) {
981
+ function assertNonEmpty(value, field) {
984
982
  if (!isNonEmpty(value))
985
983
  throw invalid(`${field} must not be empty.`);
986
984
  }
987
985
  function nonEmpty(value, field) {
988
- assertNonEmpty3(value, field);
986
+ assertNonEmpty(value, field);
989
987
  return value;
990
988
  }
991
989
  function invalid(message) {
992
- return new ShareDefinitionError(`[Sixb] ${message}`);
990
+ return new ShareDefinitionError2(`[Sixb] ${message}`);
993
991
  }
994
992
 
995
993
  // src/security/grants.ts
@@ -1010,7 +1008,7 @@ function targetOfDefinition(item, label, allowedTargets) {
1010
1008
  const discriminated = typeof kind === "string" ? TARGET_BY_DEFINITION_KIND[kind] : undefined;
1011
1009
  if (discriminated) {
1012
1010
  if (!isAllowedTarget(discriminated, allowedTargets)) {
1013
- 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}.`);
1014
1012
  }
1015
1013
  return discriminated;
1016
1014
  }
@@ -1018,7 +1016,7 @@ function targetOfDefinition(item, label, allowedTargets) {
1018
1016
  const only = candidates.length === 1 ? candidates[0] : undefined;
1019
1017
  if (only)
1020
1018
  return only;
1021
- 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.`);
1022
1020
  }
1023
1021
  function isAllowedTarget(target, allowedTargets) {
1024
1022
  return allowedTargets.includes(target);
@@ -1026,7 +1024,7 @@ function isAllowedTarget(target, allowedTargets) {
1026
1024
  function resolveGrant(input, label, allowedTargets) {
1027
1025
  if (isBreadthSelector(input)) {
1028
1026
  if (!isAllowedTarget(input.target, allowedTargets)) {
1029
- 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}().`);
1030
1028
  }
1031
1029
  return { target: input.target, selection: input.selection };
1032
1030
  }
@@ -1039,11 +1037,11 @@ function resolveGrant(input, label, allowedTargets) {
1039
1037
  continue;
1040
1038
  }
1041
1039
  if (itemTarget !== target) {
1042
- 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.`);
1043
1041
  }
1044
1042
  }
1045
1043
  if (target === undefined) {
1046
- throw new SecurityValidationError(`[Sixb] ${label} requires at least one definition.`);
1044
+ throw new SecurityValidationError2(`[Sixb] ${label} requires at least one definition.`);
1047
1045
  }
1048
1046
  const ids = [...new Set(items.map((item) => definitionIdOf(item, label)))];
1049
1047
  return { target, selection: { all: false, ids } };
@@ -1079,7 +1077,7 @@ function apply(input) {
1079
1077
  selection: resolveGrant(input, "can.apply", ["action"]).selection
1080
1078
  };
1081
1079
  const one = Array.isArray(input) || isBreadthSelector(input) ? undefined : input;
1082
- if (one && isObjectActionDefinition(one)) {
1080
+ if (one && isObjectActionDefinition2(one)) {
1083
1081
  Object.defineProperty(grant, "on", {
1084
1082
  configurable: false,
1085
1083
  enumerable: false,
@@ -1111,7 +1109,7 @@ function isAgentUsageReference(input) {
1111
1109
  }
1112
1110
  function observe(input) {
1113
1111
  if (input !== "logs" && !isAgentUsageReference(input)) {
1114
- throw new SecurityValidationError('[Sixb] can.observe accepts "logs" or agent.usage.');
1112
+ throw new SecurityValidationError2('[Sixb] can.observe accepts "logs" or agent.usage.');
1115
1113
  }
1116
1114
  const target = input === "logs" ? "logs" : "aiUsage";
1117
1115
  return {
@@ -1137,7 +1135,7 @@ function manage(input) {
1137
1135
  selection: resolveGrant(input, "can.manage", ["connector"]).selection
1138
1136
  };
1139
1137
  }
1140
- var can = {
1138
+ var can2 = {
1141
1139
  access,
1142
1140
  view,
1143
1141
  edit,
@@ -1192,7 +1190,7 @@ class SecurityRegistry {
1192
1190
  this.resolvedRoles = definitions.roles.map((role) => ({
1193
1191
  id: role.id,
1194
1192
  grantedToGroupIds: role.grantedToGroupIds,
1195
- grants: resolveRoleGrants(role, universe)
1193
+ grants: resolveRoleGrants2(role, universe)
1196
1194
  }));
1197
1195
  }
1198
1196
  listGroups() {
@@ -1218,7 +1216,7 @@ class SecurityRegistry {
1218
1216
  }
1219
1217
  }
1220
1218
  // src/storage/auth/errors.ts
1221
- class AuthStorageError extends Error {
1219
+ class AuthStorageError2 extends Error {
1222
1220
  code;
1223
1221
  name = "AuthStorageError";
1224
1222
  constructor(code, message) {
@@ -1293,7 +1291,7 @@ function dateOrNow(value) {
1293
1291
  function assertNonEmpty4(value, label) {
1294
1292
  const normalized = value.trim();
1295
1293
  if (!normalized) {
1296
- 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.`);
1297
1295
  }
1298
1296
  return normalized;
1299
1297
  }
@@ -1384,7 +1382,7 @@ function revokeActiveMagicLinksForEmail(state, projectId, email, revokedAt) {
1384
1382
  }
1385
1383
  function assertSessionIdAvailable(state, projectId, sessionId) {
1386
1384
  if (state.sessions.has(sessionKey(projectId, sessionId))) {
1387
- 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}'.`);
1388
1386
  }
1389
1387
  }
1390
1388
  function validateCompleteSessionInput(state, projectId, session) {
@@ -1398,7 +1396,7 @@ function createSessionRecord(state, input) {
1398
1396
  const projectId = assertNonEmpty4(input.projectId, "Project id");
1399
1397
  const userId = assertNonEmpty4(input.userId, "User id");
1400
1398
  const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1401
- const audience = resolveAuthSessionAudience(input.audience);
1399
+ const audience = resolveAuthSessionAudience2(input.audience);
1402
1400
  const tokenHash = assertNonEmpty4(input.tokenHash, "Session token hash");
1403
1401
  assertSessionIdAvailable(state, projectId, id);
1404
1402
  const session = {
@@ -1423,7 +1421,7 @@ function createServiceAccountRecord(state, input) {
1423
1421
  const name = assertNonEmpty4(input.name, "Service account name");
1424
1422
  const key = serviceAccountKey(projectId, id);
1425
1423
  if (state.serviceAccounts.has(key)) {
1426
- 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}'.`);
1427
1425
  }
1428
1426
  const createdAt = dateOrNow(input.createdAt);
1429
1427
  const serviceAccount = {
@@ -1445,7 +1443,7 @@ function upsertServiceAccountGroupMembershipRecord(state, input) {
1445
1443
  const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
1446
1444
  const groupId = assertNonEmpty4(input.groupId, "Group id");
1447
1445
  if (!state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
1448
- 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}'.`);
1449
1447
  }
1450
1448
  const key = serviceAccountGroupMembershipKey(projectId, serviceAccountId, groupId);
1451
1449
  const existing = state.serviceAccountGroupMemberships.get(key);
@@ -1472,7 +1470,7 @@ function createAccessTokenRecord(state, input) {
1472
1470
  assertAccessTokenSubjectExists(state, projectId, input.subjectType, subjectId);
1473
1471
  const key = accessTokenKey(projectId, id);
1474
1472
  if (state.accessTokens.has(key)) {
1475
- 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}'.`);
1476
1474
  }
1477
1475
  const token = {
1478
1476
  id,
@@ -1496,7 +1494,7 @@ function upsertGroupMembershipRecord(state, input) {
1496
1494
  const userId = assertNonEmpty4(input.userId, "User id");
1497
1495
  const groupId = assertNonEmpty4(input.groupId, "Group id");
1498
1496
  if (!state.users.has(userKey(projectId, userId))) {
1499
- 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}'.`);
1500
1498
  }
1501
1499
  const key = groupMembershipKey(projectId, userId, groupId);
1502
1500
  const existing = state.groupMemberships.get(key);
@@ -1529,17 +1527,17 @@ function assertAccessTokenSubject(kind, subjectType) {
1529
1527
  if (kind === "personal" && subjectType === "user" || kind === "serviceAccount" && subjectType === "serviceAccount") {
1530
1528
  return;
1531
1529
  }
1532
- 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}'.`);
1533
1531
  }
1534
1532
  function assertAccessTokenSubjectExists(state, projectId, subjectType, subjectId) {
1535
1533
  if (subjectType === "user") {
1536
1534
  if (state.users.has(userKey(projectId, subjectId)))
1537
1535
  return;
1538
- 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}'.`);
1539
1537
  }
1540
1538
  if (state.serviceAccounts.has(serviceAccountKey(projectId, subjectId)))
1541
1539
  return;
1542
- 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}'.`);
1543
1541
  }
1544
1542
  function consumeMagicLinkRecord(state, params) {
1545
1543
  const projectId = assertNonEmpty4(params.projectId, "Project id");
@@ -1548,13 +1546,13 @@ function consumeMagicLinkRecord(state, params) {
1548
1546
  const key = magicLinkKey(projectId, id);
1549
1547
  const existing = state.magicLinks.get(key);
1550
1548
  if (!existing) {
1551
- 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}'.`);
1552
1550
  }
1553
1551
  if (existing.tokenHash !== tokenHash || existing.consumedAt || existing.revokedAt) {
1554
- 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}'.`);
1555
1553
  }
1556
1554
  if (existing.expiresAt <= params.consumedAt) {
1557
- 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}'.`);
1558
1556
  }
1559
1557
  const consumed = {
1560
1558
  ...existing,
@@ -1570,13 +1568,13 @@ function consumeOidcAttemptRecord(state, params) {
1570
1568
  const key = oidcAttemptKey(projectId, id);
1571
1569
  const existing = state.oidcAuthorizationAttempts.get(key);
1572
1570
  if (!existing) {
1573
- 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}'.`);
1574
1572
  }
1575
1573
  if (existing.stateHash !== stateHash || existing.consumedAt) {
1576
- 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}'.`);
1577
1575
  }
1578
1576
  if (existing.expiresAt <= params.consumedAt) {
1579
- 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}'.`);
1580
1578
  }
1581
1579
  const consumed = {
1582
1580
  ...existing,
@@ -1621,7 +1619,7 @@ class InMemoryAuthAccessTokenStore {
1621
1619
  const key = accessTokenKey(params.projectId, params.id);
1622
1620
  const existing = this.state.accessTokens.get(key);
1623
1621
  if (!existing) {
1624
- 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}'.`);
1625
1623
  }
1626
1624
  const next = {
1627
1625
  ...existing,
@@ -1634,7 +1632,7 @@ class InMemoryAuthAccessTokenStore {
1634
1632
  const key = accessTokenKey(params.projectId, params.id);
1635
1633
  const existing = this.state.accessTokens.get(key);
1636
1634
  if (!existing) {
1637
- 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}'.`);
1638
1636
  }
1639
1637
  const next = {
1640
1638
  ...existing,
@@ -1648,7 +1646,7 @@ class InMemoryAuthAccessTokenStore {
1648
1646
  }
1649
1647
 
1650
1648
  // src/storage/auth/types.ts
1651
- var MAX_PENDING_DEVICE_AUTHORIZATIONS = 100;
1649
+ var MAX_PENDING_DEVICE_AUTHORIZATIONS2 = 100;
1652
1650
 
1653
1651
  // src/storage/auth/in-memory/device-authorizations.ts
1654
1652
  class InMemoryAuthDeviceAuthorizationStore {
@@ -1659,14 +1657,14 @@ class InMemoryAuthDeviceAuthorizationStore {
1659
1657
  async create(input) {
1660
1658
  const id = assertNonEmpty4(input.id, "Device authorization id");
1661
1659
  const projectId = assertNonEmpty4(input.projectId, "Project id");
1662
- for (const [key2, authorization] of this.state.deviceAuthorizations) {
1660
+ for (const [key, authorization] of this.state.deviceAuthorizations) {
1663
1661
  if (authorization.projectId === projectId && authorization.expiresAt <= input.createdAt) {
1664
- this.state.deviceAuthorizations.delete(key2);
1662
+ this.state.deviceAuthorizations.delete(key);
1665
1663
  }
1666
1664
  }
1667
1665
  const pending = [...this.state.deviceAuthorizations.values()].filter((authorization) => authorization.projectId === projectId && authorization.status === "pending").length;
1668
- if (pending >= MAX_PENDING_DEVICE_AUTHORIZATIONS) {
1669
- 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.`);
1670
1668
  }
1671
1669
  const key = deviceAuthorizationKey(projectId, id);
1672
1670
  if (this.state.deviceAuthorizations.has(key)) {
@@ -1704,7 +1702,7 @@ class InMemoryAuthDeviceAuthorizationStore {
1704
1702
  const user = this.state.users.get(userKey(params.projectId, params.userId));
1705
1703
  const session = this.state.sessions.get(sessionKey(params.projectId, params.sessionId));
1706
1704
  if (!user || user.status !== "active" || !session || session.userId !== user.id || !isActiveSession(session, params.approvedAt)) {
1707
- 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.");
1708
1706
  }
1709
1707
  const next = {
1710
1708
  ...record,
@@ -1729,16 +1727,16 @@ class InMemoryAuthDeviceAuthorizationStore {
1729
1727
  requirePending(projectId, id, now) {
1730
1728
  const record = this.state.deviceAuthorizations.get(deviceAuthorizationKey(projectId, id));
1731
1729
  if (!record) {
1732
- 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}'.`);
1733
1731
  }
1734
1732
  if (record.status !== "pending" || record.expiresAt <= now) {
1735
- 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}'.`);
1736
1734
  }
1737
1735
  return record;
1738
1736
  }
1739
1737
  }
1740
1738
  function duplicateAuthorization(id, projectId) {
1741
- 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}'.`);
1742
1740
  }
1743
1741
 
1744
1742
  // src/storage/auth/in-memory/group-memberships.ts
@@ -1842,7 +1840,7 @@ class InMemoryAuthInvitationStore {
1842
1840
  }
1843
1841
  const key = invitationKey(projectId, id);
1844
1842
  if (this.state.invitations.has(key)) {
1845
- 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}'.`);
1846
1844
  }
1847
1845
  const invitation = {
1848
1846
  id,
@@ -1886,7 +1884,7 @@ class InMemoryAuthInvitationStore {
1886
1884
  const key = invitationKey(params.projectId, params.id);
1887
1885
  const existing = this.state.invitations.get(key);
1888
1886
  if (!existing) {
1889
- 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}'.`);
1890
1888
  }
1891
1889
  const next = {
1892
1890
  ...existing,
@@ -1901,7 +1899,7 @@ class InMemoryAuthInvitationStore {
1901
1899
  const key = invitationKey(params.projectId, params.id);
1902
1900
  const existing = this.state.invitations.get(key);
1903
1901
  if (!existing) {
1904
- 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}'.`);
1905
1903
  }
1906
1904
  const next = {
1907
1905
  ...existing,
@@ -1924,12 +1922,12 @@ class InMemoryAuthMagicLinkStore {
1924
1922
  const id = assertNonEmpty4(input.id, "Magic link id");
1925
1923
  const projectId = assertNonEmpty4(input.projectId, "Project id");
1926
1924
  const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1927
- const audience = resolveAuthSessionAudience(input.audience);
1925
+ const audience = resolveAuthSessionAudience2(input.audience);
1928
1926
  const email = normalizeEmail(input.email);
1929
1927
  const tokenHash = assertNonEmpty4(input.tokenHash, "Magic link token hash");
1930
1928
  const key = magicLinkKey(projectId, id);
1931
1929
  if (this.state.magicLinks.has(key)) {
1932
- 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}'.`);
1933
1931
  }
1934
1932
  revokeActiveMagicLinksForEmail(this.state, projectId, email, input.createdAt);
1935
1933
  const link = {
@@ -1973,13 +1971,13 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
1973
1971
  const id = assertNonEmpty4(input.id, "OIDC authorization attempt id");
1974
1972
  const projectId = assertNonEmpty4(input.projectId, "Project id");
1975
1973
  const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
1976
- const audience = resolveAuthSessionAudience(input.audience);
1974
+ const audience = resolveAuthSessionAudience2(input.audience);
1977
1975
  const stateHash = assertNonEmpty4(input.stateHash, "OIDC state hash");
1978
1976
  const nonceHash = assertNonEmpty4(input.nonceHash, "OIDC nonce hash");
1979
1977
  const codeVerifier = assertNonEmpty4(input.codeVerifier, "OIDC code verifier");
1980
1978
  const key = oidcAttemptKey(projectId, id);
1981
1979
  if (this.state.oidcAuthorizationAttempts.has(key)) {
1982
- 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}'.`);
1983
1981
  }
1984
1982
  const attempt = {
1985
1983
  id,
@@ -2018,7 +2016,7 @@ class InMemoryAuthServiceAccountGroupMembershipStore {
2018
2016
  const projectId = assertNonEmpty4(input.projectId, "Project id");
2019
2017
  const serviceAccountId = assertNonEmpty4(input.serviceAccountId, "Service account id");
2020
2018
  if (!this.state.serviceAccounts.has(serviceAccountKey(projectId, serviceAccountId))) {
2021
- 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}'.`);
2022
2020
  }
2023
2021
  const groupIds = normalizeGroupIds(input.groupIds);
2024
2022
  const desired = new Set(groupIds);
@@ -2072,7 +2070,7 @@ class InMemoryAuthServiceAccountStore {
2072
2070
  const key = serviceAccountKey(projectId, id);
2073
2071
  const existing = this.state.serviceAccounts.get(key);
2074
2072
  if (!existing) {
2075
- 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}'.`);
2076
2074
  }
2077
2075
  const next = {
2078
2076
  ...existing,
@@ -2150,7 +2148,7 @@ class InMemoryAuthSessionStore {
2150
2148
  const key = sessionKey(params.projectId, params.id);
2151
2149
  const existing = this.state.sessions.get(key);
2152
2150
  if (!existing) {
2153
- 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}'.`);
2154
2152
  }
2155
2153
  const next = {
2156
2154
  ...existing,
@@ -2166,7 +2164,7 @@ class InMemoryAuthSessionStore {
2166
2164
  const key = sessionKey(params.projectId, params.id);
2167
2165
  const existing = this.state.sessions.get(key);
2168
2166
  if (!existing) {
2169
- 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}'.`);
2170
2168
  }
2171
2169
  const next = {
2172
2170
  ...existing,
@@ -2189,10 +2187,10 @@ class InMemoryAuthUserStore {
2189
2187
  const email = normalizeEmail(input.email);
2190
2188
  const key = userKey(projectId, id);
2191
2189
  if (this.state.users.has(key)) {
2192
- 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}'.`);
2193
2191
  }
2194
2192
  if (getUserByEmail(this.state, projectId, email)) {
2195
- 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}'.`);
2196
2194
  }
2197
2195
  const createdAt = dateOrNow(input.createdAt);
2198
2196
  const user = {
@@ -2219,7 +2217,7 @@ class InMemoryAuthUserStore {
2219
2217
  const key = userKey(input.projectId, input.id);
2220
2218
  const existing = this.state.users.get(key);
2221
2219
  if (!existing) {
2222
- 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}'.`);
2223
2221
  }
2224
2222
  const next = {
2225
2223
  ...existing,
@@ -2234,7 +2232,7 @@ class InMemoryAuthUserStore {
2234
2232
  const key = userKey(input.projectId, input.id);
2235
2233
  const existing = this.state.users.get(key);
2236
2234
  if (!existing) {
2237
- 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}'.`);
2238
2236
  }
2239
2237
  const next = {
2240
2238
  ...existing,
@@ -2261,7 +2259,7 @@ class InMemoryAuthUserStore {
2261
2259
  }
2262
2260
 
2263
2261
  // src/storage/auth/in-memory/auth-storage.ts
2264
- class InMemoryAuthStorage {
2262
+ class InMemoryAuthStorage2 {
2265
2263
  state = createAuthStorageState();
2266
2264
  users = new InMemoryAuthUserStore(this.state);
2267
2265
  identities = new InMemoryAuthUserIdentityStore(this.state);
@@ -2306,22 +2304,22 @@ class InMemoryAuthStorage {
2306
2304
  const key = deviceAuthorizationKey(input.projectId, input.id);
2307
2305
  const authorization = this.state.deviceAuthorizations.get(key);
2308
2306
  if (!authorization) {
2309
- 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}'.`);
2310
2308
  }
2311
2309
  if (authorization.deviceCodeHash !== input.deviceCodeHash) {
2312
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Invalid device authorization.");
2310
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Invalid device authorization.");
2313
2311
  }
2314
2312
  if (authorization.status === "pending") {
2315
- throw new AuthStorageError("pending_device_authorization", "[Sixb] Device authorization is pending.");
2313
+ throw new AuthStorageError2("pending_device_authorization", "[Sixb] Device authorization is pending.");
2316
2314
  }
2317
2315
  if (authorization.status === "denied") {
2318
- throw new AuthStorageError("device_authorization_denied", "[Sixb] Device authorization was denied.");
2316
+ throw new AuthStorageError2("device_authorization_denied", "[Sixb] Device authorization was denied.");
2319
2317
  }
2320
2318
  if (authorization.status !== "approved" || !authorization.approvedUserId || !authorization.approvedSessionId || authorization.expiresAt <= input.completedAt) {
2321
- throw new AuthStorageError("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
2319
+ throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
2322
2320
  }
2323
2321
  if (input.accessToken.projectId !== input.projectId || input.accessToken.subjectType !== "user" || input.accessToken.subjectId !== authorization.approvedUserId || input.accessToken.createdBySessionId !== authorization.approvedSessionId) {
2324
- 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.");
2325
2323
  }
2326
2324
  const accessToken = createAccessTokenRecord(this.state, input.accessToken);
2327
2325
  const consumed = {
@@ -2337,13 +2335,13 @@ class InMemoryAuthStorage {
2337
2335
  const completedAt = cloneDate(input.completedAt);
2338
2336
  const magicLink = this.state.magicLinks.get(magicLinkKey(projectId, input.magicLinkId));
2339
2337
  if (!magicLink) {
2340
- 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}'.`);
2341
2339
  }
2342
2340
  if (magicLink.tokenHash !== input.tokenHash || magicLink.consumedAt || magicLink.revokedAt) {
2343
- 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}'.`);
2344
2342
  }
2345
2343
  if (magicLink.expiresAt <= completedAt) {
2346
- 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}'.`);
2347
2345
  }
2348
2346
  const existingUser = getUserByEmail(this.state, projectId, magicLink.email);
2349
2347
  const activeInvitation = getActiveInvitationByEmail(this.state, projectId, magicLink.email, completedAt);
@@ -2356,7 +2354,7 @@ class InMemoryAuthStorage {
2356
2354
  tokenHash: input.tokenHash,
2357
2355
  consumedAt: completedAt
2358
2356
  });
2359
- 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}'.`);
2360
2358
  }
2361
2359
  if (shouldCreateUser && !activeInvitation && !input.allowUserCreationWithoutInvitation) {
2362
2360
  consumeMagicLinkRecord(this.state, {
@@ -2365,7 +2363,7 @@ class InMemoryAuthStorage {
2365
2363
  tokenHash: input.tokenHash,
2366
2364
  consumedAt: completedAt
2367
2365
  });
2368
- 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}'.`);
2369
2367
  }
2370
2368
  if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
2371
2369
  consumeMagicLinkRecord(this.state, {
@@ -2374,7 +2372,7 @@ class InMemoryAuthStorage {
2374
2372
  tokenHash: input.tokenHash,
2375
2373
  consumedAt: completedAt
2376
2374
  });
2377
- 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}'.`);
2378
2376
  }
2379
2377
  validateCompleteSessionInput(this.state, projectId, input.session);
2380
2378
  assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
@@ -2382,7 +2380,7 @@ class InMemoryAuthStorage {
2382
2380
  if (shouldCreateUser) {
2383
2381
  newUserId = assertNonEmpty4(input.newUserId, "User id");
2384
2382
  if (this.state.users.has(userKey(projectId, newUserId))) {
2385
- 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}'.`);
2386
2384
  }
2387
2385
  }
2388
2386
  consumeMagicLinkRecord(this.state, {
@@ -2436,13 +2434,13 @@ class InMemoryAuthStorage {
2436
2434
  const completedAt = cloneDate(input.completedAt);
2437
2435
  const attempt = this.state.oidcAuthorizationAttempts.get(oidcAttemptKey(projectId, input.oidcAuthorizationAttemptId));
2438
2436
  if (!attempt) {
2439
- 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}'.`);
2440
2438
  }
2441
2439
  if (attempt.stateHash !== input.stateHash || attempt.consumedAt) {
2442
- 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}'.`);
2443
2441
  }
2444
2442
  if (attempt.expiresAt <= completedAt) {
2445
- 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}'.`);
2446
2444
  }
2447
2445
  const subject = assertNonEmpty4(input.subject, "Subject");
2448
2446
  const email = normalizeEmail(input.email);
@@ -2454,27 +2452,27 @@ class InMemoryAuthStorage {
2454
2452
  const manualGroupIds = normalizeGroupIds(input.manualGroupIds);
2455
2453
  if (identity && !user) {
2456
2454
  this.consumeOidcAttempt(input, completedAt, projectId);
2457
- 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.`);
2458
2456
  }
2459
2457
  if (!identity && user && (!input.autoLinkByVerifiedEmail || !input.emailVerified)) {
2460
2458
  this.consumeOidcAttempt(input, completedAt, projectId);
2461
- 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}'.`);
2462
2460
  }
2463
2461
  if (user?.status === "suspended") {
2464
2462
  this.consumeOidcAttempt(input, completedAt, projectId);
2465
- 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}'.`);
2466
2464
  }
2467
2465
  if (shouldCreateUser && !input.emailVerified) {
2468
2466
  this.consumeOidcAttempt(input, completedAt, projectId);
2469
- 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}'.`);
2470
2468
  }
2471
2469
  if (shouldCreateUser && !activeInvitation && !input.allowUserCreationWithoutInvitation) {
2472
2470
  this.consumeOidcAttempt(input, completedAt, projectId);
2473
- 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}'.`);
2474
2472
  }
2475
2473
  if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
2476
2474
  this.consumeOidcAttempt(input, completedAt, projectId);
2477
- 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}'.`);
2478
2476
  }
2479
2477
  validateCompleteSessionInput(this.state, projectId, input.session);
2480
2478
  assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
@@ -2482,7 +2480,7 @@ class InMemoryAuthStorage {
2482
2480
  if (shouldCreateUser) {
2483
2481
  newUserId = assertNonEmpty4(input.newUserId, "User id");
2484
2482
  if (this.state.users.has(userKey(projectId, newUserId))) {
2485
- 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}'.`);
2486
2484
  }
2487
2485
  }
2488
2486
  this.consumeOidcAttempt(input, completedAt, projectId);
@@ -2540,7 +2538,7 @@ class InMemoryAuthStorage {
2540
2538
  const key = userKey(input.projectId, input.userId);
2541
2539
  const existing = this.state.users.get(key);
2542
2540
  if (!existing) {
2543
- 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}'.`);
2544
2542
  }
2545
2543
  const next = {
2546
2544
  ...existing,
@@ -2626,7 +2624,7 @@ function assertSignInSessionAudience(projectId, sessionAudience, storedAudience)
2626
2624
  if (sessionAudience === storedAudience) {
2627
2625
  return;
2628
2626
  }
2629
- 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}'.`);
2630
2628
  }
2631
2629
  // src/auth/session-cache.ts
2632
2630
  class SessionCache {
@@ -2684,19 +2682,19 @@ class SessionCache {
2684
2682
 
2685
2683
  // src/auth/sessions.ts
2686
2684
  import { createHash as createHash2, randomBytes as randomBytes3, randomUUID as randomUUID2 } from "crypto";
2687
- function generateSessionSecret() {
2685
+ function generateSessionSecret2() {
2688
2686
  return randomBytes3(32).toString("base64url");
2689
2687
  }
2690
- function hashSessionSecret(secret) {
2688
+ function hashSessionSecret2(secret) {
2691
2689
  return createHash2("sha256").update(secret).digest("hex");
2692
2690
  }
2693
- function formatSessionCookieValue(sessionId, sessionSecret) {
2691
+ function formatSessionCookieValue2(sessionId, sessionSecret) {
2694
2692
  if (!sessionId || !sessionSecret || sessionId.includes(".") || sessionSecret.includes(".")) {
2695
2693
  throw new Error("[Sixb] Session cookie values must be non-empty and must not contain '.'.");
2696
2694
  }
2697
2695
  return `${sessionId}.${sessionSecret}`;
2698
2696
  }
2699
- function parseSessionCookieValue(value) {
2697
+ function parseSessionCookieValue2(value) {
2700
2698
  if (!value) {
2701
2699
  return null;
2702
2700
  }
@@ -2709,13 +2707,13 @@ function parseSessionCookieValue(value) {
2709
2707
  sessionSecret: value.slice(firstDot + 1)
2710
2708
  };
2711
2709
  }
2712
- function createSessionCredential(sessionId = `ses_${randomUUID2()}`) {
2713
- const sessionSecret = generateSessionSecret();
2710
+ function createSessionCredential2(sessionId = `ses_${randomUUID2()}`) {
2711
+ const sessionSecret = generateSessionSecret2();
2714
2712
  return {
2715
2713
  sessionId,
2716
2714
  sessionSecret,
2717
- tokenHash: hashSessionSecret(sessionSecret),
2718
- cookieValue: formatSessionCookieValue(sessionId, sessionSecret)
2715
+ tokenHash: hashSessionSecret2(sessionSecret),
2716
+ cookieValue: formatSessionCookieValue2(sessionId, sessionSecret)
2719
2717
  };
2720
2718
  }
2721
2719
 
@@ -2723,7 +2721,7 @@ function createSessionCredential(sessionId = `ses_${randomUUID2()}`) {
2723
2721
  var SESSION_TOUCH_INTERVAL_MS = 60000;
2724
2722
  var ACCESS_TOKEN_TOUCH_INTERVAL_MS = 60000;
2725
2723
 
2726
- class AuthRuntime {
2724
+ class AuthRuntime2 {
2727
2725
  projectId;
2728
2726
  storage;
2729
2727
  security;
@@ -2733,10 +2731,10 @@ class AuthRuntime {
2733
2731
  this.projectId = options.projectId;
2734
2732
  this.storage = options.storage;
2735
2733
  this.security = options.security;
2736
- this.config = resolveAuthConfig(options.config);
2734
+ this.config = resolveAuthConfig2(options.config);
2737
2735
  this.sessionCache = this.config.session.cacheTtlMs > 0 ? new SessionCache(this.config.session.cacheTtlMs) : null;
2738
2736
  if (this.isEnabled() && !this.storage.auth) {
2739
- 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.");
2740
2738
  }
2741
2739
  }
2742
2740
  isEnabled() {
@@ -2760,26 +2758,26 @@ class AuthRuntime {
2760
2758
  const strategy = this.config.strategy;
2761
2759
  if (!strategy) {
2762
2760
  if (params.production) {
2763
- 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.");
2764
2762
  }
2765
2763
  return;
2766
2764
  }
2767
2765
  if (params.production && strategy.developmentOnly) {
2768
- 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.`);
2769
2767
  }
2770
2768
  if (params.production && (strategy.kind === "disabled" || strategy.disabled === true) && strategy.allowDisabledInProduction !== true) {
2771
- 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.");
2772
2770
  }
2773
2771
  }
2774
2772
  async getSession(request, options = {}) {
2775
2773
  if (!this.isEnabled()) {
2776
2774
  return { authenticated: false, reason: "auth_disabled" };
2777
2775
  }
2778
- const audience = resolveAuthSessionAudience(options.audience);
2776
+ const audience = resolveAuthSessionAudience2(options.audience);
2779
2777
  const credentialSource = options.credentialSource ?? "session";
2780
2778
  if (credentialSource !== "session") {
2781
2779
  const authorizationHeader = request.headers.get("authorization");
2782
- const tokenValue = getBearerAccessTokenValue(request);
2780
+ const tokenValue = getBearerAccessTokenValue2(request);
2783
2781
  if (tokenValue) {
2784
2782
  return this.resolveAccessTokenSession(request, tokenValue);
2785
2783
  }
@@ -2794,15 +2792,15 @@ class AuthRuntime {
2794
2792
  }
2795
2793
  async resolveCookieSession(request, audience, activity) {
2796
2794
  const cookieOptions = this.getCookieOptions({ audience });
2797
- const cookieValue = getCookie(request, cookieOptions.sessionCookieName);
2795
+ const cookieValue = getCookie2(request, cookieOptions.sessionCookieName);
2798
2796
  if (!cookieValue) {
2799
2797
  return { authenticated: false, reason: "missing_cookie" };
2800
2798
  }
2801
- const parts = parseSessionCookieValue(cookieValue);
2799
+ const parts = parseSessionCookieValue2(cookieValue);
2802
2800
  if (!parts) {
2803
2801
  return { authenticated: false, reason: "invalid_cookie" };
2804
2802
  }
2805
- const tokenHash = hashSessionSecret(parts.sessionSecret);
2803
+ const tokenHash = hashSessionSecret2(parts.sessionSecret);
2806
2804
  const nowMs = Date.now();
2807
2805
  const cached = this.sessionCache?.get({
2808
2806
  sessionId: parts.sessionId,
@@ -2892,7 +2890,7 @@ class AuthRuntime {
2892
2890
  return new Date(session.absoluteExpiresAt ? Math.min(idleExpiresAtMs, session.absoluteExpiresAt.getTime()) : idleExpiresAtMs);
2893
2891
  }
2894
2892
  async resolveAccessTokenSession(request, tokenValue) {
2895
- const parts = parseAccessTokenValue(tokenValue);
2893
+ const parts = parseAccessTokenValue2(tokenValue);
2896
2894
  if (!parts) {
2897
2895
  return { authenticated: false, reason: "invalid_access_token" };
2898
2896
  }
@@ -2902,7 +2900,7 @@ class AuthRuntime {
2902
2900
  projectId: this.projectId,
2903
2901
  id: parts.tokenId,
2904
2902
  kind: parts.kind,
2905
- tokenHash: hashAccessTokenSecret(parts.tokenSecret),
2903
+ tokenHash: hashAccessTokenSecret2(parts.tokenSecret),
2906
2904
  now
2907
2905
  });
2908
2906
  if (!accessToken) {
@@ -2920,7 +2918,7 @@ class AuthRuntime {
2920
2918
  if (user.status === "suspended") {
2921
2919
  return { authenticated: false, reason: "suspended_user" };
2922
2920
  }
2923
- const memberships2 = await storage.groupMemberships.listForUser({
2921
+ const memberships = await storage.groupMemberships.listForUser({
2924
2922
  projectId: this.projectId,
2925
2923
  userId: user.id
2926
2924
  });
@@ -2930,7 +2928,7 @@ class AuthRuntime {
2930
2928
  principal: { type: "user", id: user.id },
2931
2929
  user,
2932
2930
  accessToken,
2933
- groupIds: constrainTokenGroupIds(memberships2.map((membership) => membership.groupId), accessToken)
2931
+ groupIds: constrainTokenGroupIds(memberships.map((membership) => membership.groupId), accessToken)
2934
2932
  };
2935
2933
  }
2936
2934
  const serviceAccount = await storage.serviceAccounts.getById({
@@ -2986,24 +2984,24 @@ class AuthRuntime {
2986
2984
  async requirePrincipal(request, options = {}) {
2987
2985
  const session = await this.getSession(request, options);
2988
2986
  if (!session.authenticated) {
2989
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
2987
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2990
2988
  }
2991
2989
  return session.principal;
2992
2990
  }
2993
2991
  async requireUser(request, options = {}) {
2994
2992
  const session = await this.getSession(request, { ...options, credentialSource: "session" });
2995
2993
  if (!session.authenticated) {
2996
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
2994
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
2997
2995
  }
2998
2996
  return session;
2999
2997
  }
3000
2998
  async requireUserRequest(request, options = {}) {
3001
2999
  const session = await this.getSession(request, { ...options, credentialSource: "any" });
3002
3000
  if (!session.authenticated) {
3003
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
3001
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
3004
3002
  }
3005
3003
  if (!isAuthenticatedUserRequestSession(session)) {
3006
- throw new AuthRuntimeError("authorization_denied", "[Sixb] User authentication is required.");
3004
+ throw new AuthRuntimeError2("authorization_denied", "[Sixb] User authentication is required.");
3007
3005
  }
3008
3006
  return session;
3009
3007
  }
@@ -3019,12 +3017,12 @@ class AuthRuntime {
3019
3017
  async createAuthorizationContext(request, options = {}) {
3020
3018
  const session = await this.getSession(request, options);
3021
3019
  if (!session.authenticated) {
3022
- throw new AuthRuntimeError("authentication_required", "[Sixb] Authentication is required.");
3020
+ throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
3023
3021
  }
3024
3022
  return this.contextFromSession(session);
3025
3023
  }
3026
3024
  contextFromSession(session) {
3027
- return resolveAuthorizationContext({
3025
+ return resolveAuthorizationContext2({
3028
3026
  principal: session.principal,
3029
3027
  sessionId: session.credentialSource === "session" ? session.session.id : undefined,
3030
3028
  groupIds: session.groupIds,
@@ -3051,7 +3049,7 @@ class AuthRuntime {
3051
3049
  const groupIds = constrainRequestedGroupIds(input.groupIds, session.groupIds, {
3052
3050
  subject: "personal access token"
3053
3051
  });
3054
- const credential = createAccessTokenCredential("personal");
3052
+ const credential = createAccessTokenCredential2("personal");
3055
3053
  const accessToken = await storage.accessTokens.create({
3056
3054
  id: credential.tokenId,
3057
3055
  projectId: this.projectId,
@@ -3162,12 +3160,12 @@ class AuthRuntime {
3162
3160
  const storage = this.requireAuthStorage();
3163
3161
  const { serviceAccount, groupIds: serviceAccountGroupIds } = await this.requireManageableServiceAccount(storage, session.groupIds, input.serviceAccountId);
3164
3162
  if (serviceAccount.status === "suspended") {
3165
- 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}'.`);
3166
3164
  }
3167
3165
  const groupIds = constrainRequestedGroupIds(input.groupIds, serviceAccountGroupIds, {
3168
3166
  subject: "service account token"
3169
3167
  });
3170
- const credential = createAccessTokenCredential("serviceAccount");
3168
+ const credential = createAccessTokenCredential2("serviceAccount");
3171
3169
  const accessToken = await storage.accessTokens.create({
3172
3170
  id: credential.tokenId,
3173
3171
  projectId: this.projectId,
@@ -3209,7 +3207,7 @@ class AuthRuntime {
3209
3207
  });
3210
3208
  const groupIds = serviceAccount ? await this.listServiceAccountGroupIds(storage, serviceAccountId) : [];
3211
3209
  if (!serviceAccount || !callerCanManageServiceAccount(callerGroupIds, groupIds)) {
3212
- 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}'.`);
3213
3211
  }
3214
3212
  return { serviceAccount, groupIds };
3215
3213
  }
@@ -3279,19 +3277,19 @@ class AuthRuntime {
3279
3277
  const session = await this.requireUser(request, options);
3280
3278
  const storage = this.requireAuthStorage();
3281
3279
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
3282
- const userId = assertNonEmpty(input.userId, "User id");
3280
+ const userId = assertNonEmpty3(input.userId, "User id");
3283
3281
  const { user, groupIds: currentGroupIds } = await this.requireManageableMember(storage, scope, "assignGroups", userId);
3284
3282
  const requestedGroupIds = this.resolveMemberGroupIds(input.groupIds);
3285
3283
  const missing = missingMembershipGroupIds(scope, "assignGroups", requestedGroupIds);
3286
3284
  if (missing.length > 0) {
3287
- 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(", ")}.`);
3288
3286
  }
3289
3287
  const current = new Set(currentGroupIds);
3290
3288
  const requested = new Set(requestedGroupIds);
3291
3289
  const additions = requestedGroupIds.filter((groupId) => !current.has(groupId));
3292
3290
  const removals = currentGroupIds.filter((groupId) => !requested.has(groupId));
3293
3291
  if (user.id === session.user.id && removals.length > 0) {
3294
- 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.");
3295
3293
  }
3296
3294
  const now = new Date;
3297
3295
  for (const groupId of additions) {
@@ -3318,10 +3316,10 @@ class AuthRuntime {
3318
3316
  const session = await this.requireUser(request, options);
3319
3317
  const storage = this.requireAuthStorage();
3320
3318
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
3321
- const userId = assertNonEmpty(input.userId, "User id");
3319
+ const userId = assertNonEmpty3(input.userId, "User id");
3322
3320
  const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
3323
3321
  if (user.id === session.user.id) {
3324
- 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.");
3325
3323
  }
3326
3324
  const suspended = await storage.suspendUserAndRevokeSessions({
3327
3325
  projectId: this.projectId,
@@ -3335,7 +3333,7 @@ class AuthRuntime {
3335
3333
  const session = await this.requireUser(request, options);
3336
3334
  const storage = this.requireAuthStorage();
3337
3335
  const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
3338
- const userId = assertNonEmpty(input.userId, "User id");
3336
+ const userId = assertNonEmpty3(input.userId, "User id");
3339
3337
  const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
3340
3338
  const reactivated = await storage.users.updateStatus({
3341
3339
  projectId: this.projectId,
@@ -3359,15 +3357,15 @@ class AuthRuntime {
3359
3357
  const user = await storage.users.getById({ projectId: this.projectId, id: userId });
3360
3358
  const groupIds = user ? (await storage.groupMemberships.listForUser({ projectId: this.projectId, userId })).map((membership) => membership.groupId) : [];
3361
3359
  if (!user || !canPerformMembershipOperation(scope, operation, groupIds)) {
3362
- 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}'.`);
3363
3361
  }
3364
3362
  return { user, groupIds };
3365
3363
  }
3366
3364
  resolveMemberGroupIds(input) {
3367
- const groupIds = [...new Set(input.map((groupId) => assertNonEmpty(groupId, "Group id")))];
3365
+ const groupIds = [...new Set(input.map((groupId) => assertNonEmpty3(groupId, "Group id")))];
3368
3366
  for (const groupId of groupIds) {
3369
3367
  if (!this.security.getGroupById(groupId)) {
3370
- 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 }).`);
3371
3369
  }
3372
3370
  }
3373
3371
  return groupIds;
@@ -3379,11 +3377,11 @@ class AuthRuntime {
3379
3377
  const groupIds = this.resolveInviteGroupIds(input);
3380
3378
  this.assertCanManageInvitationGroups(session.groupIds, groupIds);
3381
3379
  const strategy = this.getStrategy();
3382
- if (!isInvitationDeliveryAuthStrategy(strategy)) {
3383
- 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.");
3384
3382
  }
3385
3383
  await this.assertCanInviteRecipient(strategy, authStorage, input.email, now);
3386
- const deliveryAudience = resolveAuthSessionAudience(options.delivery?.audience ?? options.audience);
3384
+ const deliveryAudience = resolveAuthSessionAudience2(options.delivery?.audience ?? options.audience);
3387
3385
  this.assertInvitationApplicationAccess(groupIds, deliveryAudience);
3388
3386
  const invitation = await authStorage.invitations.createOrUpdateActive({
3389
3387
  id: `inv_${randomUUID3()}`,
@@ -3447,17 +3445,17 @@ class AuthRuntime {
3447
3445
  async revokeInvitation(request, input, options = {}) {
3448
3446
  const session = await this.requireUser(request, options);
3449
3447
  const authStorage = this.requireAuthStorage();
3450
- const invitationId = assertNonEmpty(input.invitationId, "Invitation id");
3448
+ const invitationId = assertNonEmpty3(input.invitationId, "Invitation id");
3451
3449
  const invitation = await authStorage.invitations.getById({
3452
3450
  projectId: this.projectId,
3453
3451
  id: invitationId
3454
3452
  });
3455
3453
  if (!invitation) {
3456
- 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}'.`);
3457
3455
  }
3458
3456
  this.assertCanManageInvitationGroups(session.groupIds, invitation.groupIds);
3459
3457
  if (invitation.status !== "pending") {
3460
- 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.`);
3461
3459
  }
3462
3460
  return {
3463
3461
  invitation: await authStorage.invitations.revoke({
@@ -3469,19 +3467,19 @@ class AuthRuntime {
3469
3467
  }
3470
3468
  requireAuthStorage() {
3471
3469
  if (!this.storage.auth) {
3472
- 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.");
3473
3471
  }
3474
3472
  return this.storage.auth;
3475
3473
  }
3476
3474
  resolveInviteGroupIds(input) {
3477
3475
  if (input.groups && input.groupIds) {
3478
- 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.");
3479
3477
  }
3480
- const rawGroupIds = input.groupIds ?? input.groups?.map((group) => assertNonEmpty(group.id, "Group id")) ?? [];
3481
- 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")))];
3482
3480
  for (const groupId of groupIds) {
3483
3481
  if (!this.security.getGroupById(groupId)) {
3484
- 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 }).`);
3485
3483
  }
3486
3484
  }
3487
3485
  return groupIds;
@@ -3493,7 +3491,7 @@ class AuthRuntime {
3493
3491
  });
3494
3492
  }
3495
3493
  resolveCreateInvitationCapability(input) {
3496
- if (!isInvitationDeliveryAuthStrategy(this.getStrategy())) {
3494
+ if (!isInvitationDeliveryAuthStrategy2(this.getStrategy())) {
3497
3495
  return { state: "disabled", reason: "invitation_delivery_not_supported" };
3498
3496
  }
3499
3497
  if (!input.canInvite) {
@@ -3503,14 +3501,14 @@ class AuthRuntime {
3503
3501
  }
3504
3502
  assertInvitationApplicationAccess(groupIds, audience) {
3505
3503
  const roles = this.security.listResolvedRoles();
3506
- const authorization = resolveAuthorizationContext({
3504
+ const authorization = resolveAuthorizationContext2({
3507
3505
  principal: { type: "user", id: "invited-user" },
3508
3506
  groupIds,
3509
3507
  roles
3510
3508
  });
3511
- if (canAccessApplication(authorization, roles, audience))
3509
+ if (canAccessApplication2(authorization, roles, audience))
3512
3510
  return;
3513
- 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}'.`);
3514
3512
  }
3515
3513
  async assertCanInviteRecipient(strategy, authStorage, email, now) {
3516
3514
  if (!strategy.validateInvitationRecipient) {
@@ -3536,9 +3534,9 @@ class AuthRuntime {
3536
3534
  }
3537
3535
  createInvitationDeliveryError(status) {
3538
3536
  if (status === "rate_limited") {
3539
- 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.");
3540
3538
  }
3541
- 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.");
3542
3540
  }
3543
3541
  assertCanManageInvitationGroups(callerGroupIds, groupIds) {
3544
3542
  const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds);
@@ -3546,10 +3544,10 @@ class AuthRuntime {
3546
3544
  return;
3547
3545
  }
3548
3546
  if (groupIds.length === 0) {
3549
- 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.");
3550
3548
  }
3551
3549
  const missing = missingMembershipGroupIds(scope, "invite", groupIds);
3552
- 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(", ")}.`);
3553
3551
  }
3554
3552
  }
3555
3553
  function resolveCorrelationId(request) {
@@ -3573,7 +3571,7 @@ function callerCanManageServiceAccount(callerGroupIds, serviceAccountGroupIds) {
3573
3571
  return serviceAccountGroupIds.every((groupId) => callerGroups.has(groupId));
3574
3572
  }
3575
3573
  function missingAccessTokenError(tokenId, projectId) {
3576
- 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}'.`);
3577
3575
  }
3578
3576
  function constrainRequestedGroupIds(input, allowedGroupIds, options) {
3579
3577
  const groupIds = normalizeRequestedGroupIds(input);
@@ -3583,7 +3581,7 @@ function constrainRequestedGroupIds(input, allowedGroupIds, options) {
3583
3581
  const allowed = new Set(allowedGroupIds);
3584
3582
  for (const groupId of groupIds) {
3585
3583
  if (!allowed.has(groupId)) {
3586
- 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}.`);
3587
3585
  }
3588
3586
  }
3589
3587
  return groupIds;
@@ -3596,7 +3594,7 @@ function normalizeRequestedGroupIds(input) {
3596
3594
  for (const raw of input) {
3597
3595
  const groupId = raw.trim();
3598
3596
  if (!groupId) {
3599
- 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.");
3600
3598
  }
3601
3599
  if (!groupIds.includes(groupId)) {
3602
3600
  groupIds.push(groupId);
@@ -3606,15 +3604,15 @@ function normalizeRequestedGroupIds(input) {
3606
3604
  }
3607
3605
  function createInvitationRecipientError(status, email) {
3608
3606
  if (status === "rate_limited") {
3609
- 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.");
3610
3608
  }
3611
3609
  if (status === "invalid_email") {
3612
- return new AuthRuntimeError("invalid_auth_input", "[Sixb] Invitation email is invalid.");
3610
+ return new AuthRuntimeError2("invalid_auth_input", "[Sixb] Invitation email is invalid.");
3613
3611
  }
3614
3612
  if (status === "disallowed_domain") {
3615
- 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.`);
3616
3614
  }
3617
- 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.`);
3618
3616
  }
3619
3617
  function membershipCapabilities(scope) {
3620
3618
  return {
@@ -3631,10 +3629,10 @@ function groupIdsOf(groups) {
3631
3629
  return groups.map((group) => typeof group === "string" ? group : group.id);
3632
3630
  }
3633
3631
  // src/auth/types.ts
3634
- var SYSTEM_PRINCIPAL = { type: "system", id: "system" };
3635
- function principalsEqual(left, right) {
3632
+ var SYSTEM_PRINCIPAL2 = { type: "system", id: "system" };
3633
+ function principalsEqual2(left, right) {
3636
3634
  return left.type === right.type && left.id === right.id;
3637
3635
  }
3638
- export { ActionDefinitionError, ActionEditCommitError, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2 as assertNonEmpty, isActionDefinition, isGlobalActionDefinition, isObjectActionDefinition, normalizeActionParams, coerceActionParamsToTyped, validateActionSubject, resolveObjectActionSubject, 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, ShareDefinitionError, defineShare, isShareDefinition, snapshotShareDefinition, 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 };
3639
3637
 
3640
- //# debugId=883B08C31B88A92764756E2164756E21
3638
+ //# debugId=4470AA67E3AEAE5264756E2164756E21