@sixb/core 0.1.18 → 0.1.20

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 (523) hide show
  1. package/README.md +7 -6
  2. package/dist/actions/commit-edits.d.ts +7 -19
  3. package/dist/actions/commit-edits.d.ts.map +1 -1
  4. package/dist/actions/errors.d.ts +0 -3
  5. package/dist/actions/errors.d.ts.map +1 -1
  6. package/dist/actions/execution.d.ts +10 -3
  7. package/dist/actions/execution.d.ts.map +1 -1
  8. package/dist/actions/index.d.ts +6 -9
  9. package/dist/actions/index.d.ts.map +1 -1
  10. package/dist/actions/index.js +51 -50
  11. package/dist/actions/index.js.map +1 -1
  12. package/dist/actions/request.d.ts +14 -25
  13. package/dist/actions/request.d.ts.map +1 -1
  14. package/dist/actions/run/context.d.ts +40 -0
  15. package/dist/actions/run/context.d.ts.map +1 -0
  16. package/dist/actions/run/edits-commit.d.ts +31 -0
  17. package/dist/actions/run/edits-commit.d.ts.map +1 -0
  18. package/dist/actions/run/effects.d.ts +23 -0
  19. package/dist/actions/run/effects.d.ts.map +1 -0
  20. package/dist/actions/run/execute.d.ts +30 -0
  21. package/dist/actions/run/execute.d.ts.map +1 -0
  22. package/dist/actions/run/executor.d.ts +95 -0
  23. package/dist/actions/run/executor.d.ts.map +1 -0
  24. package/dist/actions/run/normalize.d.ts +36 -0
  25. package/dist/actions/run/normalize.d.ts.map +1 -0
  26. package/dist/actions/run/phase-types.d.ts +18 -0
  27. package/dist/actions/run/phase-types.d.ts.map +1 -0
  28. package/dist/actions/run/phases.d.ts +20 -0
  29. package/dist/actions/run/phases.d.ts.map +1 -0
  30. package/dist/actions/run/run-action.d.ts +25 -0
  31. package/dist/actions/run/run-action.d.ts.map +1 -0
  32. package/dist/actions/run/signals.d.ts +67 -0
  33. package/dist/actions/run/signals.d.ts.map +1 -0
  34. package/dist/actions/run/state.d.ts +47 -0
  35. package/dist/actions/run/state.d.ts.map +1 -0
  36. package/dist/actions/run/types.d.ts +54 -0
  37. package/dist/actions/run/types.d.ts.map +1 -0
  38. package/dist/actions/run/writeback.d.ts +17 -0
  39. package/dist/actions/run/writeback.d.ts.map +1 -0
  40. package/dist/actions/run-authorization.d.ts +1 -1
  41. package/dist/actions/run-authorization.d.ts.map +1 -1
  42. package/dist/actions/run-persistence.d.ts +53 -0
  43. package/dist/actions/run-persistence.d.ts.map +1 -0
  44. package/dist/actions/types/context.d.ts +10 -0
  45. package/dist/actions/types/context.d.ts.map +1 -1
  46. package/dist/agents/index.js +52 -55
  47. package/dist/agents/index.js.map +1 -1
  48. package/dist/agents/streams/index.js +2 -2
  49. package/dist/agents/streams/internal.js +2 -2
  50. package/dist/auth/cookies.d.ts +2 -4
  51. package/dist/auth/cookies.d.ts.map +1 -1
  52. package/dist/auth/index.d.ts +0 -2
  53. package/dist/auth/index.d.ts.map +1 -1
  54. package/dist/auth/index.js +15 -21
  55. package/dist/auth/index.js.map +1 -1
  56. package/dist/auth/runtime.d.ts +8 -10
  57. package/dist/auth/runtime.d.ts.map +1 -1
  58. package/dist/auth/session-cache.d.ts +1 -5
  59. package/dist/auth/session-cache.d.ts.map +1 -1
  60. package/dist/auth/strategy.js +1 -1
  61. package/dist/auth/types.d.ts +4 -8
  62. package/dist/auth/types.d.ts.map +1 -1
  63. package/dist/auth/validation.d.ts +0 -1
  64. package/dist/auth/validation.d.ts.map +1 -1
  65. package/dist/authorization/decision.d.ts +0 -4
  66. package/dist/authorization/decision.d.ts.map +1 -1
  67. package/dist/authorization/event-visibility.d.ts.map +1 -1
  68. package/dist/authorization/grant-kinds.d.ts +6 -8
  69. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  70. package/dist/authorization/index.d.ts +0 -1
  71. package/dist/authorization/index.d.ts.map +1 -1
  72. package/dist/authorization/index.js +5 -9
  73. package/dist/authorization/index.js.map +1 -1
  74. package/dist/authorization/resolve.d.ts +1 -1
  75. package/dist/authorization/resolve.d.ts.map +1 -1
  76. package/dist/bootstrap/index.js +50 -53
  77. package/dist/bootstrap/index.js.map +2 -2
  78. package/dist/{chunk-vz3gc1tm.js → chunk-0rbyz4qy.js} +67 -69
  79. package/dist/{chunk-vz3gc1tm.js.map → chunk-0rbyz4qy.js.map} +4 -4
  80. package/dist/{chunk-rz53yb4v.js → chunk-0yh890a4.js} +1 -1
  81. package/dist/{chunk-vgk3hknm.js → chunk-1k89ecfr.js} +1 -1
  82. package/dist/{chunk-ny3xyvcn.js → chunk-1zq2p6g0.js} +3 -3
  83. package/dist/{chunk-dnmadg9k.js → chunk-3t2hgbgd.js} +2 -2
  84. package/dist/{chunk-k6hrnf35.js → chunk-4vyr1j8f.js} +51 -4
  85. package/dist/chunk-4vyr1j8f.js.map +11 -0
  86. package/dist/{chunk-22v5bpz3.js → chunk-5e43w60z.js} +1 -1
  87. package/dist/{chunk-de4z2bj6.js → chunk-5j58wjct.js} +17 -17
  88. package/dist/chunk-5j58wjct.js.map +18 -0
  89. package/dist/{chunk-fe52eczz.js → chunk-6c6sn0bh.js} +6352 -2127
  90. package/dist/chunk-6c6sn0bh.js.map +106 -0
  91. package/dist/{chunk-7hpdd6r9.js → chunk-6p49a5cq.js} +4 -4
  92. package/dist/{chunk-b9affek3.js → chunk-7n440zgt.js} +30 -30
  93. package/dist/{chunk-b9affek3.js.map → chunk-7n440zgt.js.map} +4 -4
  94. package/dist/{chunk-kkqwzy6h.js → chunk-7t429e3f.js} +1 -1
  95. package/dist/{chunk-6fsr7y93.js → chunk-8mx7qw3y.js} +14 -13
  96. package/dist/{chunk-6fsr7y93.js.map → chunk-8mx7qw3y.js.map} +4 -4
  97. package/dist/{chunk-kpx7jrmn.js → chunk-91mg3nj9.js} +59 -59
  98. package/dist/{chunk-kpx7jrmn.js.map → chunk-91mg3nj9.js.map} +5 -5
  99. package/dist/{chunk-ex496vct.js → chunk-9dmt152s.js} +1 -1
  100. package/dist/{chunk-48e3cn2d.js → chunk-9gyp8hg1.js} +2 -2
  101. package/dist/{chunk-ewqa58h9.js → chunk-9k93ah50.js} +4 -4
  102. package/dist/{chunk-ewqa58h9.js.map → chunk-9k93ah50.js.map} +1 -1
  103. package/dist/{chunk-zxawp1n2.js → chunk-9w055r5b.js} +1 -1
  104. package/dist/{chunk-4wn7bxxa.js → chunk-9ybhtmg4.js} +1 -1
  105. package/dist/{chunk-fc5zfxy1.js → chunk-a40ad1ft.js} +5 -13
  106. package/dist/chunk-a40ad1ft.js.map +10 -0
  107. package/dist/{chunk-y2aq6ag9.js → chunk-b38szspf.js} +5 -14
  108. package/dist/chunk-b38szspf.js.map +11 -0
  109. package/dist/{chunk-r2y23egw.js → chunk-bkpke1sg.js} +1 -10
  110. package/dist/chunk-bkpke1sg.js.map +10 -0
  111. package/dist/{chunk-htr6wjmv.js → chunk-bx9q3cwv.js} +22 -22
  112. package/dist/{chunk-htr6wjmv.js.map → chunk-bx9q3cwv.js.map} +1 -1
  113. package/dist/{chunk-vx2yp45y.js → chunk-c85m1hyj.js} +2 -2
  114. package/dist/{chunk-bs7sqkre.js → chunk-d09tj99x.js} +2 -2
  115. package/dist/{chunk-qkbx3tf6.js → chunk-d0bqz29d.js} +27 -47
  116. package/dist/chunk-d0bqz29d.js.map +23 -0
  117. package/dist/{chunk-zb77kjth.js → chunk-dk8tkk5f.js} +4 -4
  118. package/dist/{chunk-xt1zt7gv.js → chunk-es1gxsbf.js} +24 -15
  119. package/dist/chunk-es1gxsbf.js.map +13 -0
  120. package/dist/{chunk-vjcd8d27.js → chunk-fa02jy15.js} +1 -1
  121. package/dist/{chunk-za5yd58j.js → chunk-fkgc1wt8.js} +2 -2
  122. package/dist/{chunk-enpsx8k5.js → chunk-gsjm1wms.js} +16 -20
  123. package/dist/chunk-gsjm1wms.js.map +10 -0
  124. package/dist/{chunk-2jntasmh.js → chunk-hcbyfxbe.js} +25 -49
  125. package/dist/chunk-hcbyfxbe.js.map +12 -0
  126. package/dist/{chunk-p0dqwj3n.js → chunk-hjzdd750.js} +66 -47
  127. package/dist/{chunk-p0dqwj3n.js.map → chunk-hjzdd750.js.map} +4 -4
  128. package/dist/chunk-hkc3jct7.js.map +1 -1
  129. package/dist/{chunk-y05543x6.js → chunk-hvsb78a1.js} +4 -4
  130. package/dist/{chunk-y05543x6.js.map → chunk-hvsb78a1.js.map} +1 -1
  131. package/dist/{chunk-1b1f2d5f.js → chunk-k6q3n2sc.js} +9 -9
  132. package/dist/{chunk-1b1f2d5f.js.map → chunk-k6q3n2sc.js.map} +1 -1
  133. package/dist/{chunk-wr8qp979.js → chunk-m427qgq0.js} +9 -5
  134. package/dist/{chunk-wr8qp979.js.map → chunk-m427qgq0.js.map} +4 -3
  135. package/dist/{chunk-qq90g05n.js → chunk-n33z5bjw.js} +50 -240
  136. package/dist/{chunk-qq90g05n.js.map → chunk-n33z5bjw.js.map} +4 -4
  137. package/dist/{chunk-e1c18xjx.js → chunk-nq6gpjt7.js} +4 -45
  138. package/dist/{chunk-e1c18xjx.js.map → chunk-nq6gpjt7.js.map} +5 -5
  139. package/dist/{chunk-1hqwggsn.js → chunk-nzapm6p0.js} +1 -2
  140. package/dist/chunk-nzapm6p0.js.map +12 -0
  141. package/dist/{chunk-wt4szfec.js → chunk-pbcbn83d.js} +4 -4
  142. package/dist/{chunk-wt4szfec.js.map → chunk-pbcbn83d.js.map} +1 -1
  143. package/dist/{chunk-s4jhg8a3.js → chunk-ren4kg2j.js} +15 -15
  144. package/dist/{chunk-s4jhg8a3.js.map → chunk-ren4kg2j.js.map} +1 -1
  145. package/dist/{chunk-d0eb5yy6.js → chunk-rrzt8jdy.js} +5 -5
  146. package/dist/{chunk-d0eb5yy6.js.map → chunk-rrzt8jdy.js.map} +1 -1
  147. package/dist/{chunk-y9jmd7e5.js → chunk-s16apyk9.js} +102 -16
  148. package/dist/chunk-s16apyk9.js.map +16 -0
  149. package/dist/{chunk-6gmfggss.js → chunk-t7x8dmn0.js} +2 -2
  150. package/dist/{chunk-f1zxad2t.js → chunk-tg2cw67r.js} +6 -6
  151. package/dist/{chunk-f1zxad2t.js.map → chunk-tg2cw67r.js.map} +1 -1
  152. package/dist/{chunk-p844e0rn.js → chunk-tpn40322.js} +2 -2
  153. package/dist/{chunk-rt9p8m9t.js → chunk-v9xd5wzd.js} +1 -1
  154. package/dist/{chunk-6h5m9xjx.js → chunk-vpq4shxz.js} +49 -113
  155. package/dist/chunk-vpq4shxz.js.map +39 -0
  156. package/dist/{chunk-2vhg6ysa.js → chunk-vyf9kfqf.js} +1 -1
  157. package/dist/{chunk-bwjcehza.js → chunk-way52z4h.js} +1 -1
  158. package/dist/{chunk-qkvz64nd.js → chunk-x6m907x7.js} +3 -3
  159. package/dist/{chunk-yv9czyfr.js → chunk-xfs8x8m9.js} +5 -5
  160. package/dist/chunk-y0c4e6ex.js +16 -0
  161. package/dist/chunk-y0c4e6ex.js.map +10 -0
  162. package/dist/{chunk-v6xpd60t.js → chunk-yevzdx4y.js} +5 -5
  163. package/dist/{chunk-dfm066qg.js → chunk-yxd3nnqt.js} +2 -29
  164. package/dist/chunk-yxd3nnqt.js.map +11 -0
  165. package/dist/{chunk-70jmg2zx.js → chunk-yzwja0mj.js} +4 -19
  166. package/dist/{chunk-70jmg2zx.js.map → chunk-yzwja0mj.js.map} +3 -3
  167. package/dist/{chunk-qmnnhde6.js → chunk-z4m0yz8c.js} +1 -1
  168. package/dist/datasets/write.js +5 -5
  169. package/dist/deploy/index.d.ts +1 -1
  170. package/dist/deploy/index.d.ts.map +1 -1
  171. package/dist/deploy/internal.js +13 -10
  172. package/dist/deploy/internal.js.map +4 -4
  173. package/dist/deploy/services.d.ts +1 -2
  174. package/dist/deploy/services.d.ts.map +1 -1
  175. package/dist/deploy/types.d.ts +7 -7
  176. package/dist/deploy/types.d.ts.map +1 -1
  177. package/dist/deploy/validation.d.ts.map +1 -1
  178. package/dist/edits/index.js +3 -5
  179. package/dist/edits/index.js.map +1 -1
  180. package/dist/error-reporting/internal.js +3 -3
  181. package/dist/error-reporting/types.d.ts +2 -9
  182. package/dist/error-reporting/types.d.ts.map +1 -1
  183. package/dist/errors/catalog.d.ts +12 -0
  184. package/dist/errors/catalog.d.ts.map +1 -1
  185. package/dist/errors/internal.js +1 -1
  186. package/dist/events/definitions.d.ts +0 -5
  187. package/dist/events/definitions.d.ts.map +1 -1
  188. package/dist/events/index.d.ts +3 -3
  189. package/dist/events/index.d.ts.map +1 -1
  190. package/dist/events/index.js +6 -8
  191. package/dist/events/index.js.map +1 -1
  192. package/dist/events/scope.d.ts +0 -1
  193. package/dist/events/scope.d.ts.map +1 -1
  194. package/dist/events/scope.js +1 -1
  195. package/dist/events/selectors/builder.d.ts +1 -8
  196. package/dist/events/selectors/builder.d.ts.map +1 -1
  197. package/dist/events/selectors/index.d.ts +2 -2
  198. package/dist/events/selectors/index.d.ts.map +1 -1
  199. package/dist/events/selectors/index.js +2 -2
  200. package/dist/events/selectors/predicate.d.ts.map +1 -1
  201. package/dist/events/selectors/types.d.ts +2 -33
  202. package/dist/events/selectors/types.d.ts.map +1 -1
  203. package/dist/events/types/index.d.ts +1 -12
  204. package/dist/events/types/index.d.ts.map +1 -1
  205. package/dist/execution/agent.js +41 -44
  206. package/dist/execution/agent.js.map +1 -1
  207. package/dist/execution/authorization.d.ts.map +1 -1
  208. package/dist/execution/primitive.js +60 -91
  209. package/dist/execution/primitive.js.map +3 -4
  210. package/dist/execution/request.js +40 -43
  211. package/dist/execution/request.js.map +2 -2
  212. package/dist/index.d.ts +8 -8
  213. package/dist/index.d.ts.map +1 -1
  214. package/dist/index.js +105 -127
  215. package/dist/index.js.map +1 -1
  216. package/dist/lake-storage/index.js +5 -5
  217. package/dist/materialization/index.js +3 -3
  218. package/dist/materialization/index.js.map +1 -1
  219. package/dist/materialization/model.d.ts +19 -6
  220. package/dist/materialization/model.d.ts.map +1 -1
  221. package/dist/materializer/index.js +31 -31
  222. package/dist/materializer/index.js.map +1 -1
  223. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  224. package/dist/models/execution/index.js +21 -21
  225. package/dist/objects/action/errors.d.ts +0 -9
  226. package/dist/objects/action/errors.d.ts.map +1 -1
  227. package/dist/objects/action/index.d.ts +3 -3
  228. package/dist/objects/action/index.d.ts.map +1 -1
  229. package/dist/objects/action/request.d.ts +2 -8
  230. package/dist/objects/action/request.d.ts.map +1 -1
  231. package/dist/objects/execution.d.ts +0 -2
  232. package/dist/objects/execution.d.ts.map +1 -1
  233. package/dist/objects/index.js +44 -29
  234. package/dist/objects/index.js.map +1 -1
  235. package/dist/objects/query/index.js +29 -29
  236. package/dist/objects/query/index.js.map +1 -1
  237. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  238. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  239. package/dist/objects/service/index.d.ts +0 -1
  240. package/dist/objects/service/index.d.ts.map +1 -1
  241. package/dist/objects/vectors/handle.d.ts.map +1 -1
  242. package/dist/objects/vectors/profile.d.ts +5 -0
  243. package/dist/objects/vectors/profile.d.ts.map +1 -1
  244. package/dist/ontology/index.js +6 -6
  245. package/dist/ontology/index.js.map +1 -1
  246. package/dist/ontology/internal.js +2 -2
  247. package/dist/pipelines/index.js +28 -28
  248. package/dist/projections/internal.js +22 -22
  249. package/dist/projections/internal.js.map +1 -1
  250. package/dist/query.js +2 -2
  251. package/dist/queues/in-memory.d.ts +1 -2
  252. package/dist/queues/in-memory.d.ts.map +1 -1
  253. package/dist/queues/index.d.ts +1 -1
  254. package/dist/queues/index.d.ts.map +1 -1
  255. package/dist/queues/index.js +1 -1
  256. package/dist/queues/types.d.ts +0 -7
  257. package/dist/queues/types.d.ts.map +1 -1
  258. package/dist/runtime/host.d.ts.map +1 -1
  259. package/dist/runtime/internal.js +27 -28
  260. package/dist/runtime/internal.js.map +1 -1
  261. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  262. package/dist/runtime/types.d.ts +16 -36
  263. package/dist/runtime/types.d.ts.map +1 -1
  264. package/dist/sandboxes/index.js +5 -5
  265. package/dist/schedules/builders.d.ts.map +1 -1
  266. package/dist/schedules/index.js +3 -3
  267. package/dist/schedules/runtime.d.ts.map +1 -1
  268. package/dist/schedules/validation.d.ts +0 -1
  269. package/dist/schedules/validation.d.ts.map +1 -1
  270. package/dist/security/builders.d.ts.map +1 -1
  271. package/dist/security/every.d.ts +2 -5
  272. package/dist/security/every.d.ts.map +1 -1
  273. package/dist/security/grants.d.ts +2 -4
  274. package/dist/security/grants.d.ts.map +1 -1
  275. package/dist/security/index.d.ts +1 -2
  276. package/dist/security/index.d.ts.map +1 -1
  277. package/dist/security/membership-policies.d.ts.map +1 -1
  278. package/dist/security/public.d.ts +10 -0
  279. package/dist/security/public.d.ts.map +1 -0
  280. package/dist/security/public.js +10 -0
  281. package/dist/security/public.js.map +9 -0
  282. package/dist/security/registry.d.ts +0 -1
  283. package/dist/security/registry.d.ts.map +1 -1
  284. package/dist/security/types.d.ts +13 -18
  285. package/dist/security/types.d.ts.map +1 -1
  286. package/dist/security/validation.d.ts +0 -6
  287. package/dist/security/validation.d.ts.map +1 -1
  288. package/dist/shares/internal.js +20 -20
  289. package/dist/storage/action-runs/failure.js +2 -2
  290. package/dist/storage/action-runs/idempotency.d.ts +3 -4
  291. package/dist/storage/action-runs/idempotency.d.ts.map +1 -1
  292. package/dist/storage/action-runs/in-memory.d.ts +2 -9
  293. package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
  294. package/dist/storage/action-runs/index.d.ts +1 -3
  295. package/dist/storage/action-runs/index.d.ts.map +1 -1
  296. package/dist/storage/action-runs/provider.js +1 -1
  297. package/dist/storage/action-runs/record.d.ts +20 -0
  298. package/dist/storage/action-runs/record.d.ts.map +1 -0
  299. package/dist/storage/action-runs/types.d.ts +39 -68
  300. package/dist/storage/action-runs/types.d.ts.map +1 -1
  301. package/dist/storage/agents/types.d.ts +1 -1
  302. package/dist/storage/ai-limits/enforcement.js +2 -2
  303. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  304. package/dist/storage/auth/in-memory/magic-links.d.ts.map +1 -1
  305. package/dist/storage/auth/in-memory/oidc-attempts.d.ts.map +1 -1
  306. package/dist/storage/auth/in-memory/sessions.d.ts +0 -10
  307. package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
  308. package/dist/storage/auth/in-memory/shared.d.ts +1 -2
  309. package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
  310. package/dist/storage/auth/types.d.ts +1 -17
  311. package/dist/storage/auth/types.d.ts.map +1 -1
  312. package/dist/storage/connector-connections/provider.js +1 -1
  313. package/dist/storage/file-upload-sessions/provider.js +10 -10
  314. package/dist/storage/index.d.ts +2 -2
  315. package/dist/storage/index.d.ts.map +1 -1
  316. package/dist/storage/index.js +21 -22
  317. package/dist/storage/index.js.map +1 -1
  318. package/dist/storage/internal.d.ts +1 -1
  319. package/dist/storage/internal.d.ts.map +1 -1
  320. package/dist/storage/internal.js +9 -12
  321. package/dist/storage/internal.js.map +1 -1
  322. package/dist/storage/objects/execution-limits.d.ts +1 -1
  323. package/dist/storage/objects/execution-limits.d.ts.map +1 -1
  324. package/dist/storage/ontology/provider.js +2 -2
  325. package/dist/storage/projection-runs/provider.js +2 -2
  326. package/dist/storage/types.d.ts +1 -1
  327. package/dist/storage/types.d.ts.map +1 -1
  328. package/dist/storage/workflow-runs/provider.js +10 -10
  329. package/dist/syncs/index.js +29 -29
  330. package/dist/testing/action-execution.d.ts +34 -4
  331. package/dist/testing/action-execution.d.ts.map +1 -1
  332. package/dist/testing/action-run-storage-contract.d.ts +11 -0
  333. package/dist/testing/action-run-storage-contract.d.ts.map +1 -0
  334. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  335. package/dist/testing/index.d.ts +2 -1
  336. package/dist/testing/index.d.ts.map +1 -1
  337. package/dist/testing/index.js +3205 -2946
  338. package/dist/testing/index.js.map +9 -8
  339. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  340. package/dist/testing/queues-contract.d.ts.map +1 -1
  341. package/dist/webhooks/internal.js +26 -26
  342. package/dist/webhooks/internal.js.map +1 -1
  343. package/dist/workers/index.js +1 -1
  344. package/dist/workflows/index.js +48 -51
  345. package/dist/workflows/index.js.map +1 -1
  346. package/package.json +8 -8
  347. package/src/actions/commit-edits.ts +9 -37
  348. package/src/actions/errors.ts +0 -4
  349. package/src/actions/execution.ts +10 -10
  350. package/src/actions/index.ts +5 -24
  351. package/src/actions/request.ts +157 -295
  352. package/src/actions/run/context.ts +193 -0
  353. package/src/actions/run/edits-commit.ts +102 -0
  354. package/src/actions/run/effects.ts +105 -0
  355. package/src/actions/run/execute.ts +113 -0
  356. package/src/actions/run/executor.ts +314 -0
  357. package/src/actions/run/normalize.ts +142 -0
  358. package/src/actions/run/phase-types.ts +20 -0
  359. package/src/actions/run/phases.ts +150 -0
  360. package/src/actions/run/run-action.ts +170 -0
  361. package/src/actions/run/signals.ts +118 -0
  362. package/src/actions/run/state.ts +95 -0
  363. package/src/actions/run/types.ts +61 -0
  364. package/src/actions/run/writeback.ts +79 -0
  365. package/src/actions/run-authorization.ts +1 -1
  366. package/src/actions/run-persistence.ts +105 -0
  367. package/src/actions/types/context.ts +10 -0
  368. package/src/auth/cookies.ts +3 -20
  369. package/src/auth/index.ts +0 -6
  370. package/src/auth/runtime.ts +59 -76
  371. package/src/auth/session-cache.ts +2 -9
  372. package/src/auth/types.ts +4 -8
  373. package/src/auth/validation.ts +0 -2
  374. package/src/authorization/decision.ts +8 -23
  375. package/src/authorization/event-visibility.ts +0 -12
  376. package/src/authorization/grant-kinds.ts +20 -27
  377. package/src/authorization/index.ts +0 -1
  378. package/src/authorization/resolve.ts +10 -6
  379. package/src/deploy/index.ts +0 -1
  380. package/src/deploy/services.ts +2 -12
  381. package/src/deploy/types.ts +7 -8
  382. package/src/deploy/validation.ts +15 -7
  383. package/src/error-reporting/types.ts +2 -10
  384. package/src/errors/catalog.ts +13 -0
  385. package/src/events/definitions.ts +0 -17
  386. package/src/events/index.ts +0 -14
  387. package/src/events/scope.ts +0 -12
  388. package/src/events/selectors/builder.ts +0 -51
  389. package/src/events/selectors/index.ts +0 -6
  390. package/src/events/selectors/predicate.ts +0 -2
  391. package/src/events/selectors/types.ts +7 -65
  392. package/src/events/types/index.ts +0 -11
  393. package/src/execution/authorization.ts +11 -5
  394. package/src/index.ts +2 -33
  395. package/src/materialization/model.ts +26 -9
  396. package/src/materializer/README.md +6 -1
  397. package/src/materializer/edits/commit.ts +42 -32
  398. package/src/materializer/shared/normalize.ts +25 -14
  399. package/src/models/execution/embedding.ts +6 -6
  400. package/src/objects/action/errors.ts +0 -12
  401. package/src/objects/action/index.ts +3 -3
  402. package/src/objects/action/request.ts +2 -29
  403. package/src/objects/execution.ts +2 -2
  404. package/src/objects/sdk/object-handle.ts +3 -29
  405. package/src/objects/sdk/object-set.ts +5 -30
  406. package/src/objects/service/index.ts +0 -1
  407. package/src/objects/vectors/README.md +4 -0
  408. package/src/objects/vectors/handle.ts +11 -2
  409. package/src/objects/vectors/indexing-generate.ts +2 -2
  410. package/src/objects/vectors/profile.ts +5 -0
  411. package/src/queues/in-memory.ts +0 -6
  412. package/src/queues/index.ts +0 -2
  413. package/src/queues/types.ts +0 -11
  414. package/src/runtime/host.ts +5 -0
  415. package/src/runtime/resolve-definitions.ts +0 -1
  416. package/src/runtime/types.ts +16 -45
  417. package/src/schedules/builders.ts +1 -4
  418. package/src/schedules/runtime.ts +0 -41
  419. package/src/schedules/validation.ts +2 -16
  420. package/src/security/builders.ts +7 -2
  421. package/src/security/every.ts +1 -5
  422. package/src/security/grants.ts +5 -25
  423. package/src/security/index.ts +0 -3
  424. package/src/security/membership-policies.ts +3 -1
  425. package/src/security/public.ts +10 -0
  426. package/src/security/registry.ts +0 -8
  427. package/src/security/types.ts +19 -25
  428. package/src/security/validation.ts +19 -17
  429. package/src/storage/action-runs/idempotency.ts +13 -41
  430. package/src/storage/action-runs/in-memory.ts +20 -311
  431. package/src/storage/action-runs/index.ts +1 -16
  432. package/src/storage/action-runs/record.ts +130 -0
  433. package/src/storage/action-runs/types.ts +37 -92
  434. package/src/storage/agents/types.ts +1 -1
  435. package/src/storage/auth/in-memory/auth-storage.ts +0 -18
  436. package/src/storage/auth/in-memory/magic-links.ts +0 -3
  437. package/src/storage/auth/in-memory/oidc-attempts.ts +0 -3
  438. package/src/storage/auth/in-memory/sessions.ts +1 -25
  439. package/src/storage/auth/in-memory/shared.ts +1 -10
  440. package/src/storage/auth/types.ts +2 -18
  441. package/src/storage/index.ts +1 -9
  442. package/src/storage/internal.ts +1 -7
  443. package/src/storage/objects/execution-limits.ts +3 -2
  444. package/src/storage/types.ts +2 -4
  445. package/src/testing/action-execution.ts +73 -13
  446. package/src/testing/action-run-storage-contract.ts +335 -0
  447. package/src/testing/auth-storage-contract.ts +14 -107
  448. package/src/testing/execution-storage-contract.ts +0 -2
  449. package/src/testing/index.ts +8 -1
  450. package/src/testing/materializer-storage-contract.ts +174 -18
  451. package/src/testing/queues-contract.ts +0 -18
  452. package/dist/actions/run-dispatch.d.ts +0 -25
  453. package/dist/actions/run-dispatch.d.ts.map +0 -1
  454. package/dist/actions/worker.d.ts +0 -3
  455. package/dist/actions/worker.d.ts.map +0 -1
  456. package/dist/actions/worker.js +0 -325
  457. package/dist/actions/worker.js.map +0 -11
  458. package/dist/auth/audience.d.ts +0 -8
  459. package/dist/auth/audience.d.ts.map +0 -1
  460. package/dist/authorization/application-access.d.ts +0 -18
  461. package/dist/authorization/application-access.d.ts.map +0 -1
  462. package/dist/chunk-1hqwggsn.js.map +0 -12
  463. package/dist/chunk-2jntasmh.js.map +0 -13
  464. package/dist/chunk-6h5m9xjx.js.map +0 -40
  465. package/dist/chunk-85cd7e8c.js +0 -51
  466. package/dist/chunk-85cd7e8c.js.map +0 -10
  467. package/dist/chunk-de4z2bj6.js.map +0 -18
  468. package/dist/chunk-dfm066qg.js.map +0 -11
  469. package/dist/chunk-enpsx8k5.js.map +0 -10
  470. package/dist/chunk-fc5zfxy1.js.map +0 -11
  471. package/dist/chunk-fe52eczz.js.map +0 -49
  472. package/dist/chunk-fx93hd2n.js +0 -1614
  473. package/dist/chunk-fx93hd2n.js.map +0 -20
  474. package/dist/chunk-k6hrnf35.js.map +0 -10
  475. package/dist/chunk-qkbx3tf6.js.map +0 -24
  476. package/dist/chunk-qxvp5epv.js +0 -1329
  477. package/dist/chunk-qxvp5epv.js.map +0 -36
  478. package/dist/chunk-r2y23egw.js.map +0 -10
  479. package/dist/chunk-tffvfy6s.js +0 -593
  480. package/dist/chunk-tffvfy6s.js.map +0 -15
  481. package/dist/chunk-xt1zt7gv.js.map +0 -13
  482. package/dist/chunk-y2aq6ag9.js.map +0 -11
  483. package/dist/chunk-y9jmd7e5.js.map +0 -15
  484. package/dist/chunk-zvx7h87b.js +0 -12
  485. package/dist/chunk-zvx7h87b.js.map +0 -10
  486. package/dist/events/types/actions.d.ts +0 -39
  487. package/dist/events/types/actions.d.ts.map +0 -1
  488. package/dist/objects/service/action-service.d.ts +0 -13
  489. package/dist/objects/service/action-service.d.ts.map +0 -1
  490. package/dist/security/applications.d.ts +0 -15
  491. package/dist/security/applications.d.ts.map +0 -1
  492. package/src/actions/run-dispatch.ts +0 -282
  493. package/src/actions/worker.ts +0 -2
  494. package/src/auth/audience.ts +0 -28
  495. package/src/authorization/application-access.ts +0 -34
  496. package/src/events/types/actions.ts +0 -42
  497. package/src/objects/service/action-service.ts +0 -43
  498. package/src/security/applications.ts +0 -11
  499. /package/dist/{chunk-rz53yb4v.js.map → chunk-0yh890a4.js.map} +0 -0
  500. /package/dist/{chunk-vgk3hknm.js.map → chunk-1k89ecfr.js.map} +0 -0
  501. /package/dist/{chunk-ny3xyvcn.js.map → chunk-1zq2p6g0.js.map} +0 -0
  502. /package/dist/{chunk-dnmadg9k.js.map → chunk-3t2hgbgd.js.map} +0 -0
  503. /package/dist/{chunk-22v5bpz3.js.map → chunk-5e43w60z.js.map} +0 -0
  504. /package/dist/{chunk-7hpdd6r9.js.map → chunk-6p49a5cq.js.map} +0 -0
  505. /package/dist/{chunk-kkqwzy6h.js.map → chunk-7t429e3f.js.map} +0 -0
  506. /package/dist/{chunk-ex496vct.js.map → chunk-9dmt152s.js.map} +0 -0
  507. /package/dist/{chunk-48e3cn2d.js.map → chunk-9gyp8hg1.js.map} +0 -0
  508. /package/dist/{chunk-zxawp1n2.js.map → chunk-9w055r5b.js.map} +0 -0
  509. /package/dist/{chunk-4wn7bxxa.js.map → chunk-9ybhtmg4.js.map} +0 -0
  510. /package/dist/{chunk-vx2yp45y.js.map → chunk-c85m1hyj.js.map} +0 -0
  511. /package/dist/{chunk-bs7sqkre.js.map → chunk-d09tj99x.js.map} +0 -0
  512. /package/dist/{chunk-zb77kjth.js.map → chunk-dk8tkk5f.js.map} +0 -0
  513. /package/dist/{chunk-vjcd8d27.js.map → chunk-fa02jy15.js.map} +0 -0
  514. /package/dist/{chunk-za5yd58j.js.map → chunk-fkgc1wt8.js.map} +0 -0
  515. /package/dist/{chunk-6gmfggss.js.map → chunk-t7x8dmn0.js.map} +0 -0
  516. /package/dist/{chunk-p844e0rn.js.map → chunk-tpn40322.js.map} +0 -0
  517. /package/dist/{chunk-rt9p8m9t.js.map → chunk-v9xd5wzd.js.map} +0 -0
  518. /package/dist/{chunk-2vhg6ysa.js.map → chunk-vyf9kfqf.js.map} +0 -0
  519. /package/dist/{chunk-bwjcehza.js.map → chunk-way52z4h.js.map} +0 -0
  520. /package/dist/{chunk-qkvz64nd.js.map → chunk-x6m907x7.js.map} +0 -0
  521. /package/dist/{chunk-yv9czyfr.js.map → chunk-xfs8x8m9.js.map} +0 -0
  522. /package/dist/{chunk-v6xpd60t.js.map → chunk-yevzdx4y.js.map} +0 -0
  523. /package/dist/{chunk-qmnnhde6.js.map → chunk-z4m0yz8c.js.map} +0 -0
@@ -1,9 +1,8 @@
1
- import type { AuthSessionAudience } from "./audience"
2
- import { DEFAULT_AUTH_SESSION_AUDIENCE, resolveAuthSessionAudience } from "./audience"
3
1
  import type { AuthCookieOptions } from "./types"
4
2
 
5
- export const DEFAULT_SESSION_COOKIE_NAME = "sixb_session"
6
- export const DEFAULT_CSRF_COOKIE_NAME = "sixb_csrf"
3
+ // The names the app's cookies had beside Atlas's, so its sessions survived Atlas leaving.
4
+ export const DEFAULT_SESSION_COOKIE_NAME = "sixb_session_app"
5
+ export const DEFAULT_CSRF_COOKIE_NAME = "sixb_csrf_app"
7
6
 
8
7
  export interface ResolvedAuthCookieOptions {
9
8
  readonly sessionCookieName: string
@@ -41,22 +40,6 @@ export function resolveAuthCookieOptions(
41
40
  return resolved
42
41
  }
43
42
 
44
- export function resolveAuthCookieOptionsForAudience(
45
- options: ResolvedAuthCookieOptions,
46
- audience: AuthSessionAudience | undefined
47
- ): ResolvedAuthCookieOptions {
48
- const resolvedAudience = resolveAuthSessionAudience(audience)
49
- if (resolvedAudience === DEFAULT_AUTH_SESSION_AUDIENCE) {
50
- return options
51
- }
52
-
53
- return {
54
- ...options,
55
- sessionCookieName: `${options.sessionCookieName}_${resolvedAudience}`,
56
- csrfCookieName: `${options.csrfCookieName}_${resolvedAudience}`,
57
- }
58
- }
59
-
60
43
  export function parseCookieHeader(header: string | null): ReadonlyMap<string, string> {
61
44
  const cookies = new Map<string, string>()
62
45
  if (!header) {
package/src/auth/index.ts CHANGED
@@ -9,12 +9,6 @@ export {
9
9
  parseAccessTokenValue,
10
10
  SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX,
11
11
  } from "./access-tokens"
12
- export type { AuthSessionAudience, AuthSessionAudienceOptions } from "./audience"
13
- export {
14
- DEFAULT_AUTH_SESSION_AUDIENCE,
15
- isValidAuthSessionAudience,
16
- resolveAuthSessionAudience,
17
- } from "./audience"
18
12
  export { getRequestClientAddress, setRequestClientAddress } from "./client-address"
19
13
  export {
20
14
  clearCsrfCookieHeader,
@@ -1,9 +1,5 @@
1
1
  import { randomUUID } from "node:crypto"
2
- import {
3
- type AuthorizationContext,
4
- canAccessApplication,
5
- resolveAuthorizationContext,
6
- } from "../authorization"
2
+ import { type AuthorizationContext, resolveAuthorizationContext } from "../authorization"
7
3
  import {
8
4
  canPerformMembershipOperation,
9
5
  type GroupReference,
@@ -33,13 +29,8 @@ import {
33
29
  hashAccessTokenSecret,
34
30
  parseAccessTokenValue,
35
31
  } from "./access-tokens"
36
- import { type AuthSessionAudience, DEFAULT_AUTH_SESSION_AUDIENCE } from "./audience"
37
32
  import { getRequestClientAddress } from "./client-address"
38
- import {
39
- getCookie,
40
- type ResolvedAuthCookieOptions,
41
- resolveAuthCookieOptionsForAudience,
42
- } from "./cookies"
33
+ import { getCookie, type ResolvedAuthCookieOptions } from "./cookies"
43
34
  import { AuthRuntimeError } from "./errors"
44
35
  import { SessionCache } from "./session-cache"
45
36
  import {
@@ -108,7 +99,6 @@ import {
108
99
  isInvitationDeliveryAuthStrategy,
109
100
  normalizePagination,
110
101
  resolveAuthConfig,
111
- resolveAuthSessionAudience,
112
102
  resolveInvitationExpiresAt,
113
103
  } from "./validation"
114
104
 
@@ -184,8 +174,8 @@ export class AuthRuntime {
184
174
  }
185
175
  }
186
176
 
187
- getCookieOptions(options: AuthSessionResolutionOptions = {}): ResolvedAuthCookieOptions {
188
- return resolveAuthCookieOptionsForAudience(this.config.cookies, options.audience)
177
+ getCookieOptions(): ResolvedAuthCookieOptions {
178
+ return this.config.cookies
189
179
  }
190
180
 
191
181
  assertCanServeHttp(params: { readonly production: boolean }): void {
@@ -240,8 +230,6 @@ export class AuthRuntime {
240
230
  return { authenticated: false, reason: "auth_disabled" }
241
231
  }
242
232
 
243
- const audience = resolveAuthSessionAudience(options.audience)
244
-
245
233
  if (options.credentialSource === "any") {
246
234
  const tokenValue = getBearerAccessTokenValue(request)
247
235
  if (tokenValue?.startsWith(SESSION_ACCESS_TOKEN_PREFIX)) {
@@ -257,15 +245,14 @@ export class AuthRuntime {
257
245
  }
258
246
  }
259
247
 
260
- return this.resolveCookieSession(request, audience, options.sessionActivity)
248
+ return this.resolveCookieSession(request, options.sessionActivity)
261
249
  }
262
250
 
263
251
  private async resolveCookieSession(
264
252
  request: Request,
265
- audience: ReturnType<typeof resolveAuthSessionAudience>,
266
253
  activity: AuthSessionResolutionOptions["sessionActivity"]
267
254
  ): Promise<AuthSessionResult> {
268
- const cookieOptions = this.getCookieOptions({ audience })
255
+ const cookieOptions = this.getCookieOptions()
269
256
  const cookieValue = getCookie(request, cookieOptions.sessionCookieName)
270
257
  if (!cookieValue) {
271
258
  return { authenticated: false, reason: "missing_cookie" }
@@ -283,7 +270,6 @@ export class AuthRuntime {
283
270
  sessionId: parts.sessionId,
284
271
  tokenHash,
285
272
  transport: "cookie",
286
- audience,
287
273
  nowMs,
288
274
  })
289
275
  if (cached) {
@@ -298,7 +284,6 @@ export class AuthRuntime {
298
284
  let session = await storage.sessions.findValidByTokenHash({
299
285
  projectId: this.projectId,
300
286
  id: parts.sessionId,
301
- audience,
302
287
  tokenHash,
303
288
  now,
304
289
  })
@@ -312,7 +297,6 @@ export class AuthRuntime {
312
297
  const renewed = await storage.sessions.renewIfValid({
313
298
  projectId: this.projectId,
314
299
  id: parts.sessionId,
315
- audience,
316
300
  tokenHash,
317
301
  now,
318
302
  expiresAt: this.getRenewedSessionExpiresAt(session, nowMs),
@@ -388,7 +372,6 @@ export class AuthRuntime {
388
372
  this.sessionCache?.set({
389
373
  sessionId: session.id,
390
374
  tokenHash,
391
- audience: session.audience,
392
375
  session: result,
393
376
  nowMs: now.getTime(),
394
377
  sessionExpiresAtMs: session.expiresAt.getTime(),
@@ -418,8 +401,6 @@ export class AuthRuntime {
418
401
  projectId: this.projectId,
419
402
  userId: input.userId,
420
403
  strategyId: "device",
421
- // A native session belongs to no web app. The column needs a value; nothing reads it.
422
- audience: DEFAULT_AUTH_SESSION_AUDIENCE,
423
404
  tokenHash: tokens.tokenHash,
424
405
  createdAt: input.now,
425
406
  ...this.createSessionDeadlines(input.now),
@@ -712,6 +693,11 @@ export class AuthRuntime {
712
693
  caller: AuthenticatedUserRequestSession
713
694
  ): Promise<ListServiceAccountsResult> {
714
695
  const storage = this.requireAuthStorage()
696
+ const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds)
697
+ if (scope.operations.serviceAccounts.policyIds.length === 0) {
698
+ return { serviceAccounts: [] }
699
+ }
700
+
715
701
  const result = await storage.serviceAccounts.list({
716
702
  projectId: this.projectId,
717
703
  order: "desc",
@@ -724,11 +710,11 @@ export class AuthRuntime {
724
710
  }))
725
711
  )
726
712
 
727
- // A caller only sees the service accounts it is allowed to manage, so
728
- // listing never leaks the groups of more-privileged accounts.
713
+ // A caller only sees the service accounts its membership policies cover, so
714
+ // listing never leaks the groups of accounts outside its scope.
729
715
  return {
730
716
  serviceAccounts: withGroups.filter(({ groupIds }) =>
731
- callerCanManageServiceAccount(caller.groupIds, groupIds)
717
+ canPerformMembershipOperation(scope, "serviceAccounts", groupIds)
732
718
  ),
733
719
  }
734
720
  }
@@ -738,11 +724,9 @@ export class AuthRuntime {
738
724
  input: CreateServiceAccountInput
739
725
  ): Promise<CreateServiceAccountResult> {
740
726
  const storage = this.requireAuthStorage()
741
- // A caller can only place a service account in groups it itself belongs to.
742
- const groupIds =
743
- constrainRequestedGroupIds(input.groupIds, caller.groupIds, {
744
- subject: "service account",
745
- }) ?? []
727
+ // A caller can only place a service account in groups its `serviceAccounts` policies cover.
728
+ const groupIds = normalizeRequestedGroupIds(input.groupIds) ?? []
729
+ this.assertCanManageServiceAccountGroups(caller.groupIds, groupIds)
746
730
  const now = new Date()
747
731
  const serviceAccount = await storage.serviceAccounts.create({
748
732
  id: input.id ?? `svc_${randomUUID()}`,
@@ -829,8 +813,8 @@ export class AuthRuntime {
829
813
  }
830
814
 
831
815
  // The token can only carry groups the service account already holds; the
832
- // manageability check above guarantees those are a subset of the caller's
833
- // own groups, so the caller can never mint privileges it lacks.
816
+ // manageability check above guarantees those are within the caller's
817
+ // `serviceAccounts` scope, so the token never reaches past that scope.
834
818
  const groupIds = constrainRequestedGroupIds(input.groupIds, serviceAccountGroupIds, {
835
819
  subject: "service account token",
836
820
  })
@@ -888,12 +872,10 @@ export class AuthRuntime {
888
872
  /**
889
873
  * Resolve a service account the caller is allowed to manage.
890
874
  *
891
- * A caller may manage a service account only when it belongs to every group
892
- * the account is in ("you can manage what you could have created"). This
893
- * confines token minting, disabling, and revocation to privileges the caller
894
- * already holds and prevents a service-account token from outliving the
895
- * caller's own access. Missing and non-manageable accounts raise the same
896
- * error so callers cannot probe which privileged accounts exist.
875
+ * A caller needs a membership policy with the `serviceAccounts` operation whose scope covers every
876
+ * group the account is in ("you can manage what you could have created"). This confines token
877
+ * minting, disabling, and revocation to the groups the project's policies hand out. Missing and
878
+ * out-of-scope accounts raise the same error so callers cannot probe which accounts exist.
897
879
  */
898
880
  private async requireManageableServiceAccount(
899
881
  storage: AuthStorage,
@@ -903,6 +885,11 @@ export class AuthRuntime {
903
885
  readonly serviceAccount: ServiceAccountRecord
904
886
  readonly groupIds: readonly string[]
905
887
  }> {
888
+ const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds)
889
+ if (scope.operations.serviceAccounts.policyIds.length === 0) {
890
+ throw missingServiceAccountsPolicyError()
891
+ }
892
+
906
893
  const serviceAccount = await storage.serviceAccounts.getById({
907
894
  projectId: this.projectId,
908
895
  id: serviceAccountId,
@@ -911,7 +898,7 @@ export class AuthRuntime {
911
898
  ? await this.listServiceAccountGroupIds(storage, serviceAccountId)
912
899
  : []
913
900
 
914
- if (!serviceAccount || !callerCanManageServiceAccount(callerGroupIds, groupIds)) {
901
+ if (!serviceAccount || !canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
915
902
  throw new AuthStorageError(
916
903
  "missing_service_account",
917
904
  `[Sixb] Service account '${serviceAccountId}' not found for project '${this.projectId}'.`
@@ -975,6 +962,7 @@ export class AuthRuntime {
975
962
  return {
976
963
  // The member-admin edit-groups dialog assigns from the `assignGroups` scope.
977
964
  groups: this.scopedGroupOptions(scope.operations.assignGroups.groupIds),
965
+ serviceAccountGroups: this.scopedGroupOptions(scope.operations.serviceAccounts.groupIds),
978
966
  capabilities: membershipCapabilities(scope).holds,
979
967
  }
980
968
  }
@@ -1163,7 +1151,7 @@ export class AuthRuntime {
1163
1151
  return { user: reactivated, groupIds, managedGroupIds }
1164
1152
  }
1165
1153
 
1166
- /** The caller's active sessions across every audience, most recently active first. */
1154
+ /** The caller's active sessions, most recently active first. */
1167
1155
  async listSessions(caller: AuthenticatedUserRequestSession): Promise<readonly SessionRecord[]> {
1168
1156
  return this.requireAuthStorage().sessions.listActiveByUserId({
1169
1157
  projectId: this.projectId,
@@ -1195,7 +1183,7 @@ export class AuthRuntime {
1195
1183
  return true
1196
1184
  }
1197
1185
 
1198
- /** End every active session of the caller, across audiences. Returns how many ended. */
1186
+ /** End every active session of the caller. Returns how many ended. */
1199
1187
  async revokeAllSessions(caller: AuthenticatedUserRequestSession): Promise<number> {
1200
1188
  const revoked = await this.requireAuthStorage().sessions.revokeActiveForUser({
1201
1189
  projectId: this.projectId,
@@ -1284,7 +1272,6 @@ export class AuthRuntime {
1284
1272
  }
1285
1273
 
1286
1274
  await this.assertCanInviteRecipient(strategy, authStorage, input.email, now)
1287
- this.assertInvitationApplicationAccess(groupIds, destination.audience)
1288
1275
 
1289
1276
  const invitation = await authStorage.invitations.createOrUpdateActive({
1290
1277
  id: `inv_${randomUUID()}`,
@@ -1304,7 +1291,6 @@ export class AuthRuntime {
1304
1291
  projectId: this.projectId,
1305
1292
  authStorage,
1306
1293
  invitation,
1307
- audience: destination.audience,
1308
1294
  returnTo: destination.returnTo,
1309
1295
  requestOrigin: destination.requestOrigin,
1310
1296
  revealLink: input.revealLink,
@@ -1451,27 +1437,6 @@ export class AuthRuntime {
1451
1437
  return { state: "enabled" }
1452
1438
  }
1453
1439
 
1454
- private assertInvitationApplicationAccess(
1455
- groupIds: readonly string[],
1456
- audience: AuthSessionAudience
1457
- ): void {
1458
- // Check only the groups this invitation assigns. Existing memberships may
1459
- // be outside the caller's policy scope and must not affect this response.
1460
- const roles = this.security.listResolvedRoles()
1461
- const authorization = resolveAuthorizationContext({
1462
- principal: { type: "user", id: "invited-user" },
1463
- groupIds,
1464
- roles,
1465
- })
1466
-
1467
- if (canAccessApplication(authorization, roles, audience)) return
1468
-
1469
- throw new AuthRuntimeError(
1470
- "authorization_denied",
1471
- `[Sixb] Invitation groups do not grant access to application '${audience}'.`
1472
- )
1473
- }
1474
-
1475
1440
  private async assertCanInviteRecipient(
1476
1441
  strategy: InvitationDeliveryAuthStrategy,
1477
1442
  authStorage: AuthStorage,
@@ -1524,6 +1489,27 @@ export class AuthRuntime {
1524
1489
  )
1525
1490
  }
1526
1491
 
1492
+ private assertCanManageServiceAccountGroups(
1493
+ callerGroupIds: readonly string[],
1494
+ groupIds: readonly string[]
1495
+ ): void {
1496
+ const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds)
1497
+
1498
+ if (canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
1499
+ return
1500
+ }
1501
+
1502
+ if (scope.operations.serviceAccounts.policyIds.length === 0) {
1503
+ throw missingServiceAccountsPolicyError()
1504
+ }
1505
+
1506
+ const missing = missingMembershipGroupIds(scope, "serviceAccounts", groupIds)
1507
+ throw new AuthRuntimeError(
1508
+ "authorization_denied",
1509
+ `[Sixb] The current user is not allowed to place service accounts in group(s): ${missing.join(", ")}.`
1510
+ )
1511
+ }
1512
+
1527
1513
  private assertCanManageInvitationGroups(
1528
1514
  callerGroupIds: readonly string[],
1529
1515
  groupIds: readonly string[]
@@ -1590,15 +1576,11 @@ function constrainTokenGroupIds(
1590
1576
  return principalGroupIds.filter((groupId) => allowed.has(groupId))
1591
1577
  }
1592
1578
 
1593
- // A caller may manage a service account only when it belongs to every group the
1594
- // account is in, so managing it can never grant more than the caller already
1595
- // has. An account with no groups is powerless and therefore freely manageable.
1596
- function callerCanManageServiceAccount(
1597
- callerGroupIds: readonly string[],
1598
- serviceAccountGroupIds: readonly string[]
1599
- ): boolean {
1600
- const callerGroups = new Set(callerGroupIds)
1601
- return serviceAccountGroupIds.every((groupId) => callerGroups.has(groupId))
1579
+ function missingServiceAccountsPolicyError(): AuthRuntimeError {
1580
+ return new AuthRuntimeError(
1581
+ "authorization_denied",
1582
+ "[Sixb] Managing service accounts needs a membership policy with the 'serviceAccounts' operation."
1583
+ )
1602
1584
  }
1603
1585
 
1604
1586
  function missingAccessTokenError(tokenId: string, projectId: string): AuthStorageError {
@@ -1701,6 +1683,7 @@ function membershipCapabilities(scope: MembershipPolicyScope): MembershipCapabil
1701
1683
  invite: scope.operations.invite.policyIds.length > 0,
1702
1684
  assignGroups: scope.operations.assignGroups.policyIds.length > 0,
1703
1685
  suspend: scope.operations.suspend.policyIds.length > 0,
1686
+ serviceAccounts: scope.operations.serviceAccounts.policyIds.length > 0,
1704
1687
  },
1705
1688
  assignableGroupIds: [...scope.operations.assignGroups.groupIds],
1706
1689
  covers: (operation, memberGroups) =>
@@ -1,10 +1,8 @@
1
- import type { AuthSessionAudience } from "./audience"
2
1
  import type { AuthenticatedAuthSession } from "./types"
3
2
 
4
3
  interface SessionCacheEntry {
5
4
  readonly tokenHash: string
6
5
  readonly transport: "cookie" | "bearer"
7
- readonly audience: AuthSessionAudience
8
6
  readonly session: AuthenticatedAuthSession
9
7
  readonly expiresAtMs: number
10
8
  }
@@ -14,15 +12,12 @@ export interface SessionCacheGetInput {
14
12
  readonly tokenHash: string
15
13
  /** A cookie is only ever answered from a cookie entry, and a bearer token from a bearer entry. */
16
14
  readonly transport: "cookie" | "bearer"
17
- /** The browser audience a cookie was read for. Bearer sessions carry their own. */
18
- readonly audience?: AuthSessionAudience
19
15
  readonly nowMs: number
20
16
  }
21
17
 
22
18
  export interface SessionCacheSetInput {
23
19
  readonly sessionId: string
24
20
  readonly tokenHash: string
25
- readonly audience: AuthSessionAudience
26
21
  readonly nowMs: number
27
22
  readonly session: AuthenticatedAuthSession
28
23
  readonly sessionExpiresAtMs: number
@@ -38,7 +33,7 @@ export interface SessionCacheSetInput {
38
33
  * API stalls. Caching the resolved result for a short TTL collapses those reads to one
39
34
  * per session per window.
40
35
  *
41
- * Safety: entries are pinned to the exact token hash, transport, and audience that produced them and
36
+ * Safety: entries are pinned to the exact token hash and transport that produced them and
42
37
  * are never served past the session's rolling or absolute deadline. The short TTL bounds how long
43
38
  * a revoked session can linger; sign-out additionally invalidates eagerly via
44
39
  * {@link SessionCache.invalidate}.
@@ -60,8 +55,7 @@ export class SessionCache {
60
55
  if (
61
56
  entry.expiresAtMs <= input.nowMs ||
62
57
  entry.tokenHash !== input.tokenHash ||
63
- entry.transport !== input.transport ||
64
- (input.audience !== undefined && entry.audience !== input.audience)
58
+ entry.transport !== input.transport
65
59
  ) {
66
60
  this.entries.delete(input.sessionId)
67
61
  return undefined
@@ -88,7 +82,6 @@ export class SessionCache {
88
82
  this.entries.set(input.sessionId, {
89
83
  tokenHash: input.tokenHash,
90
84
  transport: bearer ? "bearer" : "cookie",
91
- audience: input.audience,
92
85
  session: input.session,
93
86
  expiresAtMs,
94
87
  })
package/src/auth/types.ts CHANGED
@@ -11,7 +11,6 @@ import type {
11
11
  SessionRecord,
12
12
  UserRecord,
13
13
  } from "../storage/auth"
14
- import type { AuthSessionAudience, AuthSessionAudienceOptions } from "./audience"
15
14
 
16
15
  export type Principal =
17
16
  | { readonly type: "user"; readonly id: string }
@@ -63,7 +62,6 @@ export interface InvitationDeliveryInput {
63
62
  readonly projectId: string
64
63
  readonly authStorage: AuthStorage
65
64
  readonly invitation: InvitationRecord
66
- readonly audience: AuthSessionAudience
67
65
  readonly returnTo: string
68
66
  readonly requestOrigin: string
69
67
  /** Return the delivered link once so the inviter can copy it through an approved channel. */
@@ -98,7 +96,6 @@ export interface MagicLinkRequestInput {
98
96
  readonly projectId: string
99
97
  readonly authStorage: AuthStorage
100
98
  readonly email: string
101
- readonly audience: AuthSessionAudience
102
99
  readonly returnTo: string
103
100
  readonly requestOrigin: string
104
101
  /**
@@ -140,7 +137,6 @@ export interface MagicLinkCallbackInput {
140
137
  }
141
138
 
142
139
  export interface MagicLinkCallbackResult extends CompleteSignInResult {
143
- readonly audience: AuthSessionAudience
144
140
  readonly returnTo: string
145
141
  }
146
142
 
@@ -182,7 +178,6 @@ export interface MagicLinkAuthStrategy extends InvitationDeliveryAuthStrategy {
182
178
  export interface OidcStartSignInInput {
183
179
  readonly projectId: string
184
180
  readonly authStorage: AuthStorage
185
- readonly audience: AuthSessionAudience
186
181
  readonly returnTo: string
187
182
  readonly requestOrigin: string
188
183
  readonly now?: Date
@@ -208,7 +203,6 @@ export interface OidcCallbackInput {
208
203
  }
209
204
 
210
205
  export interface OidcCallbackResult extends CompleteSignInResult {
211
- readonly audience: AuthSessionAudience
212
206
  readonly returnTo: string
213
207
  }
214
208
 
@@ -277,11 +271,14 @@ export interface MembershipOperationCapabilities {
277
271
  readonly invite: boolean
278
272
  readonly assignGroups: boolean
279
273
  readonly suspend: boolean
274
+ readonly serviceAccounts: boolean
280
275
  }
281
276
 
282
277
  export interface GetMembershipOptionsResult {
283
278
  /** Groups the caller may assign to a member (the `assignGroups` scope). */
284
279
  readonly groups: readonly InvitationGroupOption[]
280
+ /** Groups the caller may place a service account in (the `serviceAccounts` scope). */
281
+ readonly serviceAccountGroups: readonly InvitationGroupOption[]
285
282
  readonly capabilities: MembershipOperationCapabilities
286
283
  }
287
284
 
@@ -377,7 +374,7 @@ export interface ReactivateMemberResult {
377
374
  /** `"session"` reads only the cookie; `"any"` reads a bearer access token, else the cookie. */
378
375
  export type AuthCredentialSource = "session" | "any"
379
376
 
380
- export interface AuthSessionResolutionOptions extends AuthSessionAudienceOptions {
377
+ export interface AuthSessionResolutionOptions {
381
378
  readonly credentialSource?: AuthCredentialSource
382
379
  /** Marks this request as eligible to renew a near-expiry browser session. */
383
380
  readonly sessionActivity?: "foreground"
@@ -385,7 +382,6 @@ export interface AuthSessionResolutionOptions extends AuthSessionAudienceOptions
385
382
 
386
383
  /** Where an invitation link sends its recipient. */
387
384
  export interface InvitationDestination {
388
- readonly audience: AuthSessionAudience
389
385
  readonly requestOrigin: string
390
386
  readonly returnTo: string
391
387
  }
@@ -22,8 +22,6 @@ export const MAX_AUTH_INVITATION_TTL_MS = 30 * DAY
22
22
  */
23
23
  export const DEFAULT_AUTH_SESSION_CACHE_TTL_MS = 5_000
24
24
 
25
- export { resolveAuthSessionAudience } from "./audience"
26
-
27
25
  export function resolveAuthConfig(config: SixbAuthConfig | undefined): ResolvedAuthConfig {
28
26
  if (!config) {
29
27
  return {
@@ -10,7 +10,6 @@
10
10
  * is unrestricted.
11
11
  */
12
12
 
13
- import type { AuthSessionAudience } from "../auth/audience"
14
13
  import {
15
14
  type ResolvedRuntimeAuthorization,
16
15
  resolveExecutionScopeAuthorization,
@@ -18,12 +17,11 @@ import {
18
17
  } from "../execution/authorization"
19
18
  import type { ExecutionContext, RuntimeAuthorization } from "../execution/types"
20
19
  import { AuthorizationError } from "./errors"
21
- import type { GrantKind } from "./grant-kinds"
20
+ import type { SingletonGrantKind, TargetedGrantKind } from "./grant-kinds"
22
21
  import type { AuthorizationContext, GrantIndex } from "./types"
23
22
 
24
23
  /** Something a principal may attempt, paired with the resource it targets. */
25
24
  export type AuthzRequest =
26
- | { readonly kind: "application.access"; readonly audience: AuthSessionAudience }
27
25
  | { readonly kind: "object.view"; readonly objectTypeId: string }
28
26
  | { readonly kind: "dataset.view"; readonly datasetId: string }
29
27
  | { readonly kind: "object.edit"; readonly objectTypeId: string }
@@ -59,13 +57,11 @@ interface AuthorizedRuntime {
59
57
  // the two can never drift. `kind` is the resolved-index key, so enforcement is
60
58
  // a direct lookup with no per-target dispatch.
61
59
  type Atom =
62
- | { readonly kind: "run:agent" }
63
- | { readonly kind: Exclude<GrantKind, "run:agent">; readonly id: string }
60
+ | { readonly kind: SingletonGrantKind }
61
+ | { readonly kind: TargetedGrantKind; readonly id: string }
64
62
 
65
63
  function atomsFor(request: AuthzRequest): readonly Atom[] {
66
64
  switch (request.kind) {
67
- case "application.access":
68
- return [{ kind: "access:application", id: request.audience }]
69
65
  case "object.view":
70
66
  return [{ kind: "view:object", id: request.objectTypeId }]
71
67
  case "dataset.view":
@@ -87,11 +83,11 @@ function atomsFor(request: AuthzRequest): readonly Atom[] {
87
83
  case "agent.run":
88
84
  return [{ kind: "run:agent" }]
89
85
  case "logs.observe":
90
- return [{ kind: "observe:logs", id: "logs" }]
86
+ return [{ kind: "observe:logs" }]
91
87
  case "aiUsage.observe":
92
- return [{ kind: "observe:aiUsage", id: "aiUsage" }]
88
+ return [{ kind: "observe:aiUsage" }]
93
89
  case "aiUsage.manage":
94
- return [{ kind: "manage:aiUsage", id: "aiUsage" }]
90
+ return [{ kind: "manage:aiUsage" }]
95
91
  case "connector.manage":
96
92
  return [{ kind: "manage:connector", id: request.connectorId }]
97
93
  case "object.query":
@@ -100,20 +96,11 @@ function atomsFor(request: AuthzRequest): readonly Atom[] {
100
96
  }
101
97
 
102
98
  function atomKey(atom: Atom): string {
103
- if (atom.kind === "run:agent") return atom.kind
104
- if (
105
- atom.kind === "observe:logs" ||
106
- atom.kind === "observe:aiUsage" ||
107
- atom.kind === "manage:aiUsage"
108
- ) {
109
- return atom.kind
110
- }
111
- return `${atom.kind}:${atom.id}`
99
+ return "id" in atom ? `${atom.kind}:${atom.id}` : atom.kind
112
100
  }
113
101
 
114
102
  function holds(grants: GrantIndex, atom: Atom): boolean {
115
- if (atom.kind === "run:agent") return grants[atom.kind]
116
- return grants[atom.kind].has(atom.id)
103
+ return "id" in atom ? grants[atom.kind].has(atom.id) : grants[atom.kind]
117
104
  }
118
105
 
119
106
  /** Resolve a request against a principal's grants. Never throws. */
@@ -267,8 +254,6 @@ function deniedMessage(
267
254
  ): string {
268
255
  const principalId = authorization?.principal.id ?? "unknown"
269
256
  switch (request.kind) {
270
- case "application.access":
271
- return `[Sixb] Principal '${principalId}' is not allowed to access application '${request.audience}'.`
272
257
  case "object.view":
273
258
  return `[Sixb] Principal '${principalId}' is not allowed to view object type '${request.objectTypeId}'.`
274
259
  case "dataset.view":
@@ -38,18 +38,6 @@ export function canViewEvent(
38
38
  }) &&
39
39
  isAllowed(authorization, { kind: "object.view", objectTypeId: event.payload.targetTypeId })
40
40
  )
41
- case "actions": {
42
- // Apply is necessary; for object-bound actions the principal must also be
43
- // able to view the subject type, or the event would leak a hidden
44
- // object's id/type — mirroring the rule in `canListAction`.
45
- if (!isAllowed(authorization, { kind: "action.apply", actionId: event.payload.actionId })) {
46
- return false
47
- }
48
- const subject = event.payload.subject
49
- return subject.kind === "object"
50
- ? isAllowed(authorization, { kind: "object.view", objectTypeId: subject.objectTypeId })
51
- : true
52
- }
53
41
  case "workflows":
54
42
  return isAllowed(authorization, {
55
43
  kind: "workflow.run",