@sixb/core 0.1.12 → 0.1.13

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 (527) hide show
  1. package/dist/actions/index.d.ts +2 -2
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +28 -26
  4. package/dist/actions/index.js.map +1 -1
  5. package/dist/actions/read-facade.d.ts +14 -16
  6. package/dist/actions/read-facade.d.ts.map +1 -1
  7. package/dist/actions/request.d.ts.map +1 -1
  8. package/dist/actions/run-dispatch.d.ts +2 -0
  9. package/dist/actions/run-dispatch.d.ts.map +1 -1
  10. package/dist/actions/types/context.d.ts +18 -31
  11. package/dist/actions/types/context.d.ts.map +1 -1
  12. package/dist/actions/types/params.d.ts +2 -1
  13. package/dist/actions/types/params.d.ts.map +1 -1
  14. package/dist/actions/worker.js +1 -1
  15. package/dist/agents/index.js +41 -39
  16. package/dist/agents/index.js.map +1 -1
  17. package/dist/agents/streams/index.js +2 -2
  18. package/dist/agents/streams/internal.js +2 -2
  19. package/dist/assert-never.d.ts +6 -0
  20. package/dist/assert-never.d.ts.map +1 -0
  21. package/dist/auth/client-address.d.ts +3 -0
  22. package/dist/auth/client-address.d.ts.map +1 -0
  23. package/dist/auth/csrf.d.ts +5 -1
  24. package/dist/auth/csrf.d.ts.map +1 -1
  25. package/dist/auth/index.d.ts +3 -2
  26. package/dist/auth/index.d.ts.map +1 -1
  27. package/dist/auth/index.js +14 -8
  28. package/dist/auth/index.js.map +1 -1
  29. package/dist/auth/runtime.d.ts +58 -41
  30. package/dist/auth/runtime.d.ts.map +1 -1
  31. package/dist/auth/session-cache.d.ts +10 -3
  32. package/dist/auth/session-cache.d.ts.map +1 -1
  33. package/dist/auth/sessions.d.ts +12 -0
  34. package/dist/auth/sessions.d.ts.map +1 -1
  35. package/dist/auth/strategy.js +1 -1
  36. package/dist/auth/types.d.ts +8 -15
  37. package/dist/auth/types.d.ts.map +1 -1
  38. package/dist/authorization/index.js +3 -3
  39. package/dist/bootstrap/index.d.ts +1 -1
  40. package/dist/bootstrap/index.d.ts.map +1 -1
  41. package/dist/bootstrap/index.js +45 -43
  42. package/dist/bootstrap/index.js.map +1 -1
  43. package/dist/bootstrap/ontology-type-manifest.d.ts +8 -0
  44. package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
  45. package/dist/{chunk-q5gz3g2j.js → chunk-0321g649.js} +2 -16
  46. package/dist/{chunk-q5gz3g2j.js.map → chunk-0321g649.js.map} +2 -2
  47. package/dist/{chunk-e1f1sqba.js → chunk-04h4t2b5.js} +3 -3
  48. package/dist/{chunk-y3ev53cq.js → chunk-2fv8sajb.js} +2 -2
  49. package/dist/{chunk-3bnt2wna.js → chunk-2hbhn1ff.js} +1 -1
  50. package/dist/{chunk-eyjzgav0.js → chunk-3nx8vj5a.js} +6 -4
  51. package/dist/chunk-3nx8vj5a.js.map +12 -0
  52. package/dist/{chunk-5tetw4hn.js → chunk-4tnrzqqh.js} +1 -1
  53. package/dist/{chunk-g50nxqs5.js → chunk-63fp9x3q.js} +63 -20
  54. package/dist/chunk-63fp9x3q.js.map +20 -0
  55. package/dist/{chunk-qm535afa.js → chunk-693f3zn8.js} +66 -24
  56. package/dist/chunk-693f3zn8.js.map +15 -0
  57. package/dist/{chunk-7zgecwy1.js → chunk-6x0pqh32.js} +12 -1
  58. package/dist/{chunk-7zgecwy1.js.map → chunk-6x0pqh32.js.map} +3 -3
  59. package/dist/{chunk-6ma8dvzc.js → chunk-898y24dd.js} +49 -42
  60. package/dist/chunk-898y24dd.js.map +15 -0
  61. package/dist/{chunk-7qnvhtcd.js → chunk-91wthfwe.js} +17 -17
  62. package/dist/{chunk-7qnvhtcd.js.map → chunk-91wthfwe.js.map} +5 -5
  63. package/dist/chunk-96yw3pwd.js.map +2 -2
  64. package/dist/{chunk-2cxv584m.js → chunk-9pfw47qx.js} +309 -204
  65. package/dist/chunk-9pfw47qx.js.map +44 -0
  66. package/dist/{chunk-4k53sm9e.js → chunk-a0073121.js} +59 -59
  67. package/dist/{chunk-4k53sm9e.js.map → chunk-a0073121.js.map} +5 -5
  68. package/dist/{chunk-jjwhy3rs.js → chunk-a69fkrtr.js} +5 -5
  69. package/dist/{chunk-y1ahv8b7.js → chunk-bdhfn0ww.js} +1 -1
  70. package/dist/{chunk-4ph94nhd.js → chunk-bep5rrdq.js} +2 -2
  71. package/dist/{chunk-kept9cdd.js → chunk-bxx3ms5t.js} +1 -1
  72. package/dist/{chunk-xtfryrfb.js → chunk-cbn96bve.js} +2 -2
  73. package/dist/{chunk-nzsy3xrp.js → chunk-cvrbhvtr.js} +69 -44
  74. package/dist/{chunk-nzsy3xrp.js.map → chunk-cvrbhvtr.js.map} +7 -7
  75. package/dist/{chunk-vsg0g7h9.js → chunk-d8yes9yx.js} +304 -45
  76. package/dist/chunk-d8yes9yx.js.map +20 -0
  77. package/dist/{chunk-tg4g4zh0.js → chunk-darm7eeg.js} +9 -9
  78. package/dist/{chunk-tg4g4zh0.js.map → chunk-darm7eeg.js.map} +3 -3
  79. package/dist/{chunk-vpxss818.js → chunk-drz59ve0.js} +9 -8
  80. package/dist/chunk-drz59ve0.js.map +10 -0
  81. package/dist/{chunk-7c2g3sz9.js → chunk-dsfw1bdr.js} +5 -5
  82. package/dist/{chunk-7c2g3sz9.js.map → chunk-dsfw1bdr.js.map} +1 -1
  83. package/dist/{chunk-p6r1ex7t.js → chunk-ffwvdgk1.js} +5 -13
  84. package/dist/chunk-ffwvdgk1.js.map +10 -0
  85. package/dist/{chunk-r5zythxp.js → chunk-gbcrz0gr.js} +7 -7
  86. package/dist/{chunk-ybhz3j9g.js → chunk-gc226ten.js} +104 -148
  87. package/dist/{chunk-ybhz3j9g.js.map → chunk-gc226ten.js.map} +7 -8
  88. package/dist/{chunk-3ghw2t5q.js → chunk-gmt22nxx.js} +10 -16
  89. package/dist/chunk-gmt22nxx.js.map +10 -0
  90. package/dist/chunk-h89wz928.js +42 -0
  91. package/dist/chunk-h89wz928.js.map +10 -0
  92. package/dist/{chunk-hkw8rykk.js → chunk-ht4a7mjg.js} +74 -4
  93. package/dist/chunk-ht4a7mjg.js.map +15 -0
  94. package/dist/{chunk-t7dzd1tm.js → chunk-jhyc777j.js} +2 -2
  95. package/dist/{chunk-xn686q2e.js → chunk-jmwy25mf.js} +75 -57
  96. package/dist/{chunk-xn686q2e.js.map → chunk-jmwy25mf.js.map} +3 -3
  97. package/dist/{chunk-f06sf7rr.js → chunk-k4kkp58d.js} +18 -5
  98. package/dist/chunk-k4kkp58d.js.map +11 -0
  99. package/dist/{chunk-2h63nrde.js → chunk-ky7zpbtt.js} +5 -7
  100. package/dist/{chunk-2h63nrde.js.map → chunk-ky7zpbtt.js.map} +3 -4
  101. package/dist/chunk-m4ehq95f.js +9 -0
  102. package/dist/chunk-m4ehq95f.js.map +10 -0
  103. package/dist/{chunk-0mza4xb2.js → chunk-m8zkvep1.js} +2 -2
  104. package/dist/{chunk-b768c93y.js → chunk-mf6hwpzh.js} +83 -28
  105. package/dist/{chunk-b768c93y.js.map → chunk-mf6hwpzh.js.map} +5 -5
  106. package/dist/{chunk-yxb4c62x.js → chunk-mr60an99.js} +3 -2
  107. package/dist/{chunk-yxb4c62x.js.map → chunk-mr60an99.js.map} +3 -3
  108. package/dist/chunk-n33e8dz8.js +191 -0
  109. package/dist/chunk-n33e8dz8.js.map +11 -0
  110. package/dist/chunk-rdghfsss.js.map +2 -2
  111. package/dist/{chunk-m7cx05vp.js → chunk-rqtdtm43.js} +126 -59
  112. package/dist/{chunk-m7cx05vp.js.map → chunk-rqtdtm43.js.map} +13 -12
  113. package/dist/{chunk-bbaa1fet.js → chunk-rzcjp5m2.js} +7 -3
  114. package/dist/chunk-rzcjp5m2.js.map +25 -0
  115. package/dist/{chunk-hzw7yv5g.js → chunk-rzkr70gr.js} +5 -1
  116. package/dist/{chunk-hzw7yv5g.js.map → chunk-rzkr70gr.js.map} +3 -3
  117. package/dist/{chunk-sfypc7mk.js → chunk-s24qbp32.js} +4 -4
  118. package/dist/{chunk-axndsymr.js → chunk-tw03bsmb.js} +2 -2
  119. package/dist/{chunk-axndsymr.js.map → chunk-tw03bsmb.js.map} +3 -3
  120. package/dist/{chunk-y0v18c2j.js → chunk-vef6qa14.js} +2 -2
  121. package/dist/{chunk-gzt6v1ja.js → chunk-vn3yh259.js} +1 -1
  122. package/dist/{chunk-bg2bs62d.js → chunk-w9bp61e7.js} +5 -5
  123. package/dist/{chunk-3h7ctayx.js → chunk-xgptywp0.js} +4 -3
  124. package/dist/chunk-xgptywp0.js.map +11 -0
  125. package/dist/{chunk-gswwr35f.js → chunk-y487ywrv.js} +4 -4
  126. package/dist/{chunk-bet1rb9h.js → chunk-y6vnvayj.js} +1 -1
  127. package/dist/{chunk-x9tmx3fc.js → chunk-ypj2wqtj.js} +3 -6
  128. package/dist/{chunk-x9tmx3fc.js.map → chunk-ypj2wqtj.js.map} +4 -4
  129. package/dist/{chunk-g2gezsg5.js → chunk-z9h698s8.js} +1 -1
  130. package/dist/{chunk-wjffn5m4.js → chunk-zdkcdshk.js} +3 -36
  131. package/dist/{chunk-wjffn5m4.js.map → chunk-zdkcdshk.js.map} +3 -4
  132. package/dist/{chunk-bfjv1adk.js → chunk-znw0zvy4.js} +1 -1
  133. package/dist/edits/types.d.ts +19 -19
  134. package/dist/edits/types.d.ts.map +1 -1
  135. package/dist/error-reporting/internal.js +3 -3
  136. package/dist/errors/catalog.d.ts +4 -0
  137. package/dist/errors/catalog.d.ts.map +1 -1
  138. package/dist/errors/internal.js +1 -1
  139. package/dist/events/envelope.d.ts +0 -12
  140. package/dist/events/envelope.d.ts.map +1 -1
  141. package/dist/events/index.d.ts +1 -1
  142. package/dist/events/index.d.ts.map +1 -1
  143. package/dist/events/index.js +3 -3
  144. package/dist/events/service.d.ts +1 -2
  145. package/dist/events/service.d.ts.map +1 -1
  146. package/dist/events/toStoredEvent.d.ts +1 -2
  147. package/dist/events/toStoredEvent.d.ts.map +1 -1
  148. package/dist/events/types/index.d.ts +2 -1
  149. package/dist/events/types/index.d.ts.map +1 -1
  150. package/dist/execution/agent.d.ts +1 -2
  151. package/dist/execution/agent.d.ts.map +1 -1
  152. package/dist/execution/agent.js +39 -37
  153. package/dist/execution/agent.js.map +1 -1
  154. package/dist/execution/authorized-object-reader.d.ts.map +1 -1
  155. package/dist/execution/primitive.d.ts +1 -2
  156. package/dist/execution/primitive.d.ts.map +1 -1
  157. package/dist/execution/primitive.js +38 -36
  158. package/dist/execution/primitive.js.map +3 -3
  159. package/dist/execution/request.d.ts +1 -2
  160. package/dist/execution/request.d.ts.map +1 -1
  161. package/dist/execution/request.js +39 -37
  162. package/dist/execution/request.js.map +3 -3
  163. package/dist/index.d.ts +6 -6
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +56 -50
  166. package/dist/index.js.map +1 -1
  167. package/dist/maintenance/ontology-maintenance.d.ts +11 -1
  168. package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
  169. package/dist/materialization/errors.d.ts +3 -1
  170. package/dist/materialization/errors.d.ts.map +1 -1
  171. package/dist/materialization/events.d.ts +27 -2
  172. package/dist/materialization/events.d.ts.map +1 -1
  173. package/dist/materializer/edits/commit.d.ts.map +1 -1
  174. package/dist/materializer/edits/operations.d.ts +2 -1
  175. package/dist/materializer/edits/operations.d.ts.map +1 -1
  176. package/dist/materializer/edits/plan.d.ts +2 -2
  177. package/dist/materializer/edits/plan.d.ts.map +1 -1
  178. package/dist/materializer/edits/user-refs.d.ts +30 -0
  179. package/dist/materializer/edits/user-refs.d.ts.map +1 -0
  180. package/dist/materializer/effective/build-events.d.ts +2 -2
  181. package/dist/materializer/effective/build-events.d.ts.map +1 -1
  182. package/dist/materializer/execution/scope.d.ts +11 -3
  183. package/dist/materializer/execution/scope.d.ts.map +1 -1
  184. package/dist/materializer/index.js +23 -21
  185. package/dist/materializer/index.js.map +1 -1
  186. package/dist/materializer/projections/replacement-plan.d.ts +2 -0
  187. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  188. package/dist/materializer/telemetry/plan.d.ts +2 -2
  189. package/dist/materializer/telemetry/plan.d.ts.map +1 -1
  190. package/dist/models/execution/index.js +23 -21
  191. package/dist/models/execution/index.js.map +1 -1
  192. package/dist/models/index.js +1 -1
  193. package/dist/objects/execution.d.ts +21 -27
  194. package/dist/objects/execution.d.ts.map +1 -1
  195. package/dist/objects/index.js +28 -26
  196. package/dist/objects/index.js.map +1 -1
  197. package/dist/objects/query/executor.d.ts.map +1 -1
  198. package/dist/objects/query/index.js +27 -25
  199. package/dist/objects/query/index.js.map +1 -1
  200. package/dist/objects/query/ir.d.ts +8 -1
  201. package/dist/objects/query/ir.d.ts.map +1 -1
  202. package/dist/objects/query/scalar-values.d.ts.map +1 -1
  203. package/dist/objects/query/validate.d.ts.map +1 -1
  204. package/dist/objects/sdk/object-handle.d.ts +1 -2
  205. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  206. package/dist/objects/sdk/object-set.d.ts +2 -3
  207. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  208. package/dist/objects/sdk/query-builder.d.ts +8 -10
  209. package/dist/objects/sdk/query-builder.d.ts.map +1 -1
  210. package/dist/objects/sdk/telemetry-channel.d.ts +1 -2
  211. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  212. package/dist/objects/sdk/where.d.ts +2 -3
  213. package/dist/objects/sdk/where.d.ts.map +1 -1
  214. package/dist/ontology/builders.d.ts +11 -10
  215. package/dist/ontology/builders.d.ts.map +1 -1
  216. package/dist/ontology/index.d.ts +4 -2
  217. package/dist/ontology/index.d.ts.map +1 -1
  218. package/dist/ontology/index.js +6 -4
  219. package/dist/ontology/index.js.map +1 -1
  220. package/dist/ontology/inference/index.d.ts +34 -22
  221. package/dist/ontology/inference/index.d.ts.map +1 -1
  222. package/dist/ontology/internal.d.ts +1 -0
  223. package/dist/ontology/internal.d.ts.map +1 -1
  224. package/dist/ontology/internal.js +9 -7
  225. package/dist/ontology/internal.js.map +1 -1
  226. package/dist/ontology/primitives.d.ts +38 -0
  227. package/dist/ontology/primitives.d.ts.map +1 -0
  228. package/dist/ontology/query-capabilities.d.ts +38 -0
  229. package/dist/ontology/query-capabilities.d.ts.map +1 -0
  230. package/dist/ontology/refs.d.ts +23 -2
  231. package/dist/ontology/refs.d.ts.map +1 -1
  232. package/dist/ontology/registered.d.ts +16 -0
  233. package/dist/ontology/registered.d.ts.map +1 -0
  234. package/dist/ontology/registry.d.ts.map +1 -1
  235. package/dist/ontology/tokens.d.ts +35 -1
  236. package/dist/ontology/tokens.d.ts.map +1 -1
  237. package/dist/ontology/types.d.ts +18 -4
  238. package/dist/ontology/types.d.ts.map +1 -1
  239. package/dist/ontology/user-ref.d.ts +35 -0
  240. package/dist/ontology/user-ref.d.ts.map +1 -0
  241. package/dist/ontology/validation/definition.d.ts.map +1 -1
  242. package/dist/ontology/validation/index.d.ts +1 -1
  243. package/dist/ontology/validation/index.d.ts.map +1 -1
  244. package/dist/ontology/validation/normalize.d.ts.map +1 -1
  245. package/dist/ontology/validation/properties.d.ts +6 -1
  246. package/dist/ontology/validation/properties.d.ts.map +1 -1
  247. package/dist/ontology/validation/query.d.ts.map +1 -1
  248. package/dist/ontology/validation/schema.d.ts.map +1 -1
  249. package/dist/pipelines/index.js +26 -24
  250. package/dist/pipelines/index.js.map +1 -1
  251. package/dist/predicates/types.d.ts +53 -3
  252. package/dist/predicates/types.d.ts.map +1 -1
  253. package/dist/projections/builders.d.ts +19 -1
  254. package/dist/projections/builders.d.ts.map +1 -1
  255. package/dist/projections/internal.js +23 -21
  256. package/dist/projections/internal.js.map +1 -1
  257. package/dist/projections/validation.d.ts.map +1 -1
  258. package/dist/query.js +2 -2
  259. package/dist/queues/in-memory.d.ts +1 -1
  260. package/dist/queues/in-memory.d.ts.map +1 -1
  261. package/dist/runtime/create.d.ts +1 -1
  262. package/dist/runtime/create.d.ts.map +1 -1
  263. package/dist/runtime/host.d.ts +5 -5
  264. package/dist/runtime/host.d.ts.map +1 -1
  265. package/dist/runtime/index.d.ts +1 -1
  266. package/dist/runtime/index.d.ts.map +1 -1
  267. package/dist/runtime/internal.js +27 -25
  268. package/dist/runtime/internal.js.map +1 -1
  269. package/dist/runtime/sixb.d.ts +5 -5
  270. package/dist/runtime/sixb.d.ts.map +1 -1
  271. package/dist/runtime/types.d.ts +171 -188
  272. package/dist/runtime/types.d.ts.map +1 -1
  273. package/dist/sandboxes/index.js +5 -5
  274. package/dist/sandboxes/sandbox.d.ts +4 -1
  275. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  276. package/dist/shared/params/types.d.ts +4 -3
  277. package/dist/shared/params/types.d.ts.map +1 -1
  278. package/dist/shared/params/user-refs.d.ts +19 -0
  279. package/dist/shared/params/user-refs.d.ts.map +1 -0
  280. package/dist/shares/compiler.d.ts.map +1 -1
  281. package/dist/shares/internal.js +24 -22
  282. package/dist/shares/internal.js.map +2 -2
  283. package/dist/storage/action-runs/failure.js +2 -2
  284. package/dist/storage/action-runs/types.d.ts +1 -1
  285. package/dist/storage/action-runs/types.d.ts.map +1 -1
  286. package/dist/storage/agents/provider.js +1 -1
  287. package/dist/storage/ai-limits/enforcement.js +2 -2
  288. package/dist/storage/auth/in-memory/access-tokens.d.ts.map +1 -1
  289. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  290. package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -1
  291. package/dist/storage/auth/in-memory/sessions.d.ts +8 -1
  292. package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
  293. package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
  294. package/dist/storage/auth/index.d.ts +1 -1
  295. package/dist/storage/auth/index.d.ts.map +1 -1
  296. package/dist/storage/auth/types.d.ts +62 -13
  297. package/dist/storage/auth/types.d.ts.map +1 -1
  298. package/dist/storage/connector-connections/provider.js +1 -1
  299. package/dist/storage/executions/provider.js +1 -1
  300. package/dist/storage/file-upload-sessions/in-memory.d.ts +9 -18
  301. package/dist/storage/file-upload-sessions/in-memory.d.ts.map +1 -1
  302. package/dist/storage/file-upload-sessions/index.d.ts +1 -1
  303. package/dist/storage/file-upload-sessions/index.d.ts.map +1 -1
  304. package/dist/storage/file-upload-sessions/provider.d.ts +52 -0
  305. package/dist/storage/file-upload-sessions/provider.d.ts.map +1 -0
  306. package/dist/storage/file-upload-sessions/provider.js +24 -0
  307. package/dist/storage/file-upload-sessions/provider.js.map +9 -0
  308. package/dist/storage/file-upload-sessions/types.d.ts +19 -1
  309. package/dist/storage/file-upload-sessions/types.d.ts.map +1 -1
  310. package/dist/storage/file-upload-sessions/utils.d.ts +8 -2
  311. package/dist/storage/file-upload-sessions/utils.d.ts.map +1 -1
  312. package/dist/storage/index.d.ts +3 -3
  313. package/dist/storage/index.d.ts.map +1 -1
  314. package/dist/storage/index.js +29 -25
  315. package/dist/storage/index.js.map +1 -1
  316. package/dist/storage/internal.js +11 -9
  317. package/dist/storage/internal.js.map +1 -1
  318. package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
  319. package/dist/storage/ontology/commits.d.ts +6 -2
  320. package/dist/storage/ontology/commits.d.ts.map +1 -1
  321. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  322. package/dist/storage/ontology/provider-work.d.ts.map +1 -1
  323. package/dist/storage/ontology/provider.d.ts +14 -1
  324. package/dist/storage/ontology/provider.d.ts.map +1 -1
  325. package/dist/storage/ontology/provider.js +8 -2
  326. package/dist/storage/ontology/provider.js.map +1 -1
  327. package/dist/storage/operation-scope.d.ts.map +1 -1
  328. package/dist/storage/operation-scope.js +1 -1
  329. package/dist/storage/projection-runs/provider.js +2 -2
  330. package/dist/storage/types.d.ts +1 -1
  331. package/dist/storage/types.d.ts.map +1 -1
  332. package/dist/storage/workflow-interventions/index.d.ts +1 -1
  333. package/dist/storage/workflow-interventions/index.d.ts.map +1 -1
  334. package/dist/storage/workflow-interventions/types.d.ts +5 -8
  335. package/dist/storage/workflow-interventions/types.d.ts.map +1 -1
  336. package/dist/storage/workflow-runs/provider.js +8 -8
  337. package/dist/syncs/index.js +27 -25
  338. package/dist/syncs/index.js.map +1 -1
  339. package/dist/testing/action-execution.d.ts +4 -0
  340. package/dist/testing/action-execution.d.ts.map +1 -1
  341. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  342. package/dist/testing/execution.d.ts +1 -2
  343. package/dist/testing/execution.d.ts.map +1 -1
  344. package/dist/testing/file-upload-session-storage-contract.d.ts +12 -0
  345. package/dist/testing/file-upload-session-storage-contract.d.ts.map +1 -0
  346. package/dist/testing/index.d.ts +2 -0
  347. package/dist/testing/index.d.ts.map +1 -1
  348. package/dist/testing/index.js +1951 -1242
  349. package/dist/testing/index.js.map +15 -13
  350. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  351. package/dist/testing/object-query-contract.d.ts.map +1 -1
  352. package/dist/testing/ontology-contract-fixture.d.ts +8 -0
  353. package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
  354. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  355. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  356. package/dist/testing/workflow-intervention-storage-contract.d.ts +8 -0
  357. package/dist/testing/workflow-intervention-storage-contract.d.ts.map +1 -0
  358. package/dist/webhooks/internal.js +24 -22
  359. package/dist/webhooks/internal.js.map +2 -2
  360. package/dist/webhooks/types.d.ts +2 -2
  361. package/dist/webhooks/types.d.ts.map +1 -1
  362. package/dist/workers/index.js +1 -1
  363. package/dist/workflows/index.js +42 -40
  364. package/dist/workflows/index.js.map +1 -1
  365. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  366. package/dist/workflows/types.d.ts +2 -2
  367. package/dist/workflows/types.d.ts.map +1 -1
  368. package/package.json +7 -1
  369. package/src/actions/index.ts +0 -3
  370. package/src/actions/read-facade.ts +102 -62
  371. package/src/actions/request.ts +13 -0
  372. package/src/actions/run-dispatch.ts +3 -0
  373. package/src/actions/types/context.ts +17 -65
  374. package/src/actions/types/params.ts +2 -1
  375. package/src/agents/authority.ts +1 -1
  376. package/src/assert-never.ts +7 -0
  377. package/src/auth/client-address.ts +12 -0
  378. package/src/auth/csrf.ts +14 -5
  379. package/src/auth/index.ts +3 -2
  380. package/src/auth/runtime.ts +299 -277
  381. package/src/auth/session-cache.ts +18 -6
  382. package/src/auth/sessions.ts +30 -0
  383. package/src/auth/types.ts +7 -17
  384. package/src/bootstrap/index.ts +1 -0
  385. package/src/bootstrap/ontology-type-manifest.ts +112 -60
  386. package/src/edits/types.ts +47 -63
  387. package/src/errors/catalog.ts +4 -0
  388. package/src/events/envelope.ts +0 -13
  389. package/src/events/index.ts +1 -1
  390. package/src/events/service.ts +1 -11
  391. package/src/events/toStoredEvent.ts +1 -3
  392. package/src/events/types/index.ts +1 -1
  393. package/src/execution/agent.ts +1 -2
  394. package/src/execution/authorized-object-reader.ts +5 -7
  395. package/src/execution/primitive.ts +1 -2
  396. package/src/execution/request.ts +1 -2
  397. package/src/index.ts +8 -7
  398. package/src/maintenance/ontology-maintenance.ts +77 -1
  399. package/src/materialization/errors.ts +2 -0
  400. package/src/materialization/events.ts +27 -2
  401. package/src/materializer/README.md +2 -0
  402. package/src/materializer/edits/commit.ts +21 -12
  403. package/src/materializer/edits/operations.ts +32 -4
  404. package/src/materializer/edits/plan.ts +4 -5
  405. package/src/materializer/edits/user-refs.ts +115 -0
  406. package/src/materializer/effective/build-events.ts +4 -5
  407. package/src/materializer/execution/scope.ts +40 -7
  408. package/src/materializer/projections/replace.ts +2 -0
  409. package/src/materializer/projections/replacement-plan.ts +4 -0
  410. package/src/materializer/telemetry/append.ts +4 -12
  411. package/src/materializer/telemetry/plan.ts +4 -5
  412. package/src/objects/execution.ts +33 -62
  413. package/src/objects/query/executor.ts +12 -3
  414. package/src/objects/query/ir.ts +7 -0
  415. package/src/objects/query/planner.ts +1 -0
  416. package/src/objects/query/scalar-values.ts +19 -0
  417. package/src/objects/query/validate.ts +55 -44
  418. package/src/objects/sdk/object-handle.ts +8 -8
  419. package/src/objects/sdk/object-set.ts +8 -15
  420. package/src/objects/sdk/query-builder.ts +59 -71
  421. package/src/objects/sdk/telemetry-channel.ts +6 -7
  422. package/src/objects/sdk/where.ts +6 -13
  423. package/src/ontology/builders.ts +15 -11
  424. package/src/ontology/index.ts +4 -0
  425. package/src/ontology/inference/index.ts +56 -36
  426. package/src/ontology/internal.ts +1 -0
  427. package/src/ontology/json-schema.ts +12 -0
  428. package/src/ontology/primitives.ts +91 -0
  429. package/src/ontology/query-capabilities.ts +136 -0
  430. package/src/ontology/refs.ts +33 -6
  431. package/src/ontology/registered.ts +22 -0
  432. package/src/ontology/registry.ts +6 -3
  433. package/src/ontology/tokens.ts +41 -2
  434. package/src/ontology/types.ts +19 -3
  435. package/src/ontology/user-ref.ts +120 -0
  436. package/src/ontology/validation/definition.ts +2 -13
  437. package/src/ontology/validation/index.ts +1 -0
  438. package/src/ontology/validation/normalize.ts +39 -3
  439. package/src/ontology/validation/properties.ts +95 -19
  440. package/src/ontology/validation/query.ts +11 -42
  441. package/src/ontology/validation/schema.ts +16 -0
  442. package/src/predicates/types.ts +43 -33
  443. package/src/projections/builders.ts +24 -3
  444. package/src/projections/validation.ts +15 -1
  445. package/src/runtime/create.ts +2 -2
  446. package/src/runtime/host.ts +10 -12
  447. package/src/runtime/index.ts +3 -2
  448. package/src/runtime/sixb.ts +13 -23
  449. package/src/runtime/types.ts +277 -479
  450. package/src/sandboxes/sandbox.ts +4 -1
  451. package/src/shared/params/types.ts +4 -3
  452. package/src/shared/params/user-refs.ts +48 -0
  453. package/src/shares/compiler.ts +6 -16
  454. package/src/storage/action-runs/types.ts +1 -0
  455. package/src/storage/auth/in-memory/access-tokens.ts +5 -2
  456. package/src/storage/auth/in-memory/auth-storage.ts +5 -8
  457. package/src/storage/auth/in-memory/device-authorizations.ts +0 -2
  458. package/src/storage/auth/in-memory/sessions.ts +69 -1
  459. package/src/storage/auth/in-memory/shared.ts +13 -7
  460. package/src/storage/auth/index.ts +2 -1
  461. package/src/storage/auth/types.ts +57 -13
  462. package/src/storage/executions/validation.ts +1 -1
  463. package/src/storage/file-upload-sessions/in-memory.ts +64 -113
  464. package/src/storage/file-upload-sessions/index.ts +1 -0
  465. package/src/storage/file-upload-sessions/provider.ts +258 -0
  466. package/src/storage/file-upload-sessions/types.ts +20 -1
  467. package/src/storage/file-upload-sessions/utils.ts +25 -9
  468. package/src/storage/index.ts +3 -2
  469. package/src/storage/objects/in-memory/query.ts +13 -3
  470. package/src/storage/ontology/commits.ts +6 -2
  471. package/src/storage/ontology/in-memory/materializations.ts +6 -34
  472. package/src/storage/ontology/provider-header-validation.ts +57 -0
  473. package/src/storage/ontology/provider-work.ts +15 -3
  474. package/src/storage/ontology/provider.ts +59 -1
  475. package/src/storage/operation-scope.ts +1 -0
  476. package/src/storage/types.ts +0 -1
  477. package/src/storage/workflow-interventions/index.ts +0 -1
  478. package/src/storage/workflow-interventions/types.ts +5 -9
  479. package/src/testing/action-execution.ts +13 -3
  480. package/src/testing/auth-storage-contract.ts +149 -62
  481. package/src/testing/execution-storage-contract.ts +1 -2
  482. package/src/testing/execution.ts +4 -7
  483. package/src/testing/file-upload-session-storage-contract.ts +335 -0
  484. package/src/testing/index.ts +8 -0
  485. package/src/testing/materializer-storage-contract.ts +86 -4
  486. package/src/testing/object-query-contract.ts +121 -2
  487. package/src/testing/ontology-contract-fixture.ts +23 -3
  488. package/src/testing/ontology-storage-contract.ts +58 -0
  489. package/src/testing/sandboxes-contract.ts +27 -0
  490. package/src/testing/workflow-intervention-storage-contract.ts +203 -0
  491. package/src/webhooks/types.ts +2 -2
  492. package/src/workflows/run-dispatch.ts +12 -1
  493. package/src/workflows/snapshot.ts +16 -7
  494. package/src/workflows/types.ts +2 -2
  495. package/dist/chunk-2cxv584m.js.map +0 -43
  496. package/dist/chunk-3ghw2t5q.js.map +0 -10
  497. package/dist/chunk-3h7ctayx.js.map +0 -11
  498. package/dist/chunk-6ma8dvzc.js.map +0 -15
  499. package/dist/chunk-bbaa1fet.js.map +0 -25
  500. package/dist/chunk-eyjzgav0.js.map +0 -12
  501. package/dist/chunk-f06sf7rr.js.map +0 -11
  502. package/dist/chunk-g50nxqs5.js.map +0 -18
  503. package/dist/chunk-hkw8rykk.js.map +0 -15
  504. package/dist/chunk-p6r1ex7t.js.map +0 -10
  505. package/dist/chunk-qm535afa.js.map +0 -15
  506. package/dist/chunk-vpxss818.js.map +0 -10
  507. package/dist/chunk-vsg0g7h9.js.map +0 -17
  508. /package/dist/{chunk-e1f1sqba.js.map → chunk-04h4t2b5.js.map} +0 -0
  509. /package/dist/{chunk-y3ev53cq.js.map → chunk-2fv8sajb.js.map} +0 -0
  510. /package/dist/{chunk-3bnt2wna.js.map → chunk-2hbhn1ff.js.map} +0 -0
  511. /package/dist/{chunk-5tetw4hn.js.map → chunk-4tnrzqqh.js.map} +0 -0
  512. /package/dist/{chunk-jjwhy3rs.js.map → chunk-a69fkrtr.js.map} +0 -0
  513. /package/dist/{chunk-y1ahv8b7.js.map → chunk-bdhfn0ww.js.map} +0 -0
  514. /package/dist/{chunk-4ph94nhd.js.map → chunk-bep5rrdq.js.map} +0 -0
  515. /package/dist/{chunk-kept9cdd.js.map → chunk-bxx3ms5t.js.map} +0 -0
  516. /package/dist/{chunk-xtfryrfb.js.map → chunk-cbn96bve.js.map} +0 -0
  517. /package/dist/{chunk-r5zythxp.js.map → chunk-gbcrz0gr.js.map} +0 -0
  518. /package/dist/{chunk-t7dzd1tm.js.map → chunk-jhyc777j.js.map} +0 -0
  519. /package/dist/{chunk-0mza4xb2.js.map → chunk-m8zkvep1.js.map} +0 -0
  520. /package/dist/{chunk-sfypc7mk.js.map → chunk-s24qbp32.js.map} +0 -0
  521. /package/dist/{chunk-y0v18c2j.js.map → chunk-vef6qa14.js.map} +0 -0
  522. /package/dist/{chunk-gzt6v1ja.js.map → chunk-vn3yh259.js.map} +0 -0
  523. /package/dist/{chunk-bg2bs62d.js.map → chunk-w9bp61e7.js.map} +0 -0
  524. /package/dist/{chunk-gswwr35f.js.map → chunk-y487ywrv.js.map} +0 -0
  525. /package/dist/{chunk-bet1rb9h.js.map → chunk-y6vnvayj.js.map} +0 -0
  526. /package/dist/{chunk-g2gezsg5.js.map → chunk-z9h698s8.js.map} +0 -0
  527. /package/dist/{chunk-bfjv1adk.js.map → chunk-znw0zvy4.js.map} +0 -0
@@ -1,25 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/execution/authorization.ts", "../src/agents/identity.ts", "../src/authorization/grant-kinds.ts", "../src/storage/objects/execution-limits.ts", "../src/execution/types.ts", "../src/authorization/errors.ts", "../src/authorization/decision.ts", "../src/authorization/application-access.ts", "../src/authorization/event-visibility.ts", "../src/authorization/resolve.ts", "../src/projections/errors.ts", "../src/projections/ownership.ts", "../src/projections/validation.ts", "../src/projections/builders.ts", "../src/authorization/run-visibility.ts", "../src/authorization/types.ts"],
4
- "sourcesContent": [
5
- "import { isDeepStrictEqual } from \"node:util\"\nimport { agentServiceAccountId } from \"../agents/identity\"\nimport type { Principal } from \"../auth\"\nimport { TARGETED_GRANT_KIND_KEYS, type TargetedGrantKind } from \"../authorization/grant-kinds\"\nimport type { AuthorizationContext, GrantIndex } from \"../authorization/types\"\nimport { createSixbError } from \"../errors/internal\"\nimport type { ObjectRef } from \"../ontology\"\nimport {\n type ObjectReadExecutionLimits,\n snapshotObjectReadExecutionLimits,\n} from \"../storage/objects/execution-limits\"\nimport { compileSelectedObjectReadScope } from \"../storage/objects/read-scope\"\nimport type {\n CompiledSelectedObjectReadScope,\n SelectedObjectReadScope,\n} from \"../storage/objects/types\"\nimport { kernelOperationFromId, kernelOperationId } from \"./kernel-operation\"\nimport {\n type AuthorizablePrincipal,\n type AuthorizationRef,\n createRuntimeAuthorizationCapability,\n type ExecutionContext,\n type ExecutionScope,\n isRuntimeAuthorizationCapability,\n type KernelOperation,\n type RuntimeAuthorization,\n type TrustedPrimitiveKind,\n type TrustedPrimitiveRef,\n} from \"./types\"\n\nexport type ResolvedRuntimeAuthorization =\n | {\n readonly type: \"principal\"\n readonly projectId: string\n readonly context: AuthorizationContext\n readonly ref: Extract<AuthorizationRef, { readonly type: \"principal\" }>\n }\n | {\n readonly type: \"unrestricted\"\n readonly projectId: string\n readonly ref: Exclude<AuthorizationRef, { readonly type: \"principal\" | \"delegated\" }>\n }\n | {\n readonly type: \"delegated\"\n readonly projectId: string\n readonly objectRead: DelegatedObjectReadAuthorization\n readonly actionApply: readonly DelegatedActionApplyTarget[]\n readonly delegation?: Extract<AuthorizationRef, { readonly type: \"delegated\" }>[\"delegation\"]\n }\n | { readonly type: \"denied\" }\n\n/** Immutable process-local object-read authority. It has no durable representation. */\nexport interface DelegatedObjectReadAuthorization {\n readonly scope: CompiledSelectedObjectReadScope\n readonly limits: ObjectReadExecutionLimits\n}\n\n/** One exact object-bound Action target carried by process-local delegated authority. */\nexport interface DelegatedActionApplyTarget {\n readonly actionId: string\n readonly subject: ObjectRef\n}\n\ntype RegisteredRuntimeAuthorization = Exclude<\n ResolvedRuntimeAuthorization,\n { readonly type: \"denied\" }\n>\n\ntype PrincipalAuthorizationContext = Omit<AuthorizationContext, \"principal\"> & {\n readonly principal: AuthorizablePrincipal\n}\n\ninterface RuntimeAuthorizationRegistration {\n readonly resolved: RegisteredRuntimeAuthorization\n readonly execution: ExecutionContext\n}\n\nconst registeredAuthorizations = new WeakMap<\n RuntimeAuthorization,\n RuntimeAuthorizationRegistration\n>()\n\nconst MAX_DELEGATED_ACTION_APPLY_TARGETS = 4_096\nconst MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS = 1_000_000\n\nexport function createPrincipalRuntimeAuthorization(input: {\n readonly execution: ExecutionContext\n readonly context: AuthorizationContext\n readonly credential?: Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]\n}): RuntimeAuthorization {\n if (input.execution.executor.type !== \"request\") {\n throw new Error(\"[Sixb] Principal runtime authorization requires a request execution.\")\n }\n return createRegisteredPrincipalAuthorization(input)\n}\n\n/** Register restored authority bound to one exact agent run. */\nexport function createAgentRuntimeAuthorization(input: {\n readonly execution: ExecutionContext\n readonly authority:\n | {\n readonly type: \"principal\"\n readonly context: AuthorizationContext\n readonly credential?: Extract<\n AuthorizationRef,\n { readonly type: \"principal\" }\n >[\"credential\"]\n }\n | { readonly type: \"disabled\" }\n}): RuntimeAuthorization {\n if (input.execution.executor.type !== \"agent\") {\n throw new Error(\"[Sixb] Agent runtime authorization requires an Agent execution.\")\n }\n\n if (input.authority.type === \"principal\") {\n return createRegisteredPrincipalAuthorization({\n execution: input.execution,\n context: input.authority.context,\n ...(input.authority.credential === undefined\n ? {}\n : { credential: input.authority.credential }),\n })\n }\n\n return register(input.execution, {\n type: \"unrestricted\",\n projectId: input.execution.projectId,\n ref: Object.freeze({ type: \"disabled\" }),\n })\n}\n\nfunction createRegisteredPrincipalAuthorization(input: {\n readonly execution: ExecutionContext\n readonly context: AuthorizationContext\n readonly credential?: Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]\n}): RuntimeAuthorization {\n const context = snapshotAuthorizationContext(input.context)\n const credential = input.credential ? snapshotCredential(input.credential) : undefined\n assertCredentialMatchesContext(context, credential)\n const ref: Extract<AuthorizationRef, { readonly type: \"principal\" }> = Object.freeze({\n type: \"principal\",\n principal: context.principal,\n ...(credential === undefined ? {} : { credential }),\n })\n return register(input.execution, {\n type: \"principal\",\n projectId: input.execution.projectId,\n context,\n ref,\n })\n}\n\nexport function createDisabledRuntimeAuthorization(\n execution: ExecutionContext\n): RuntimeAuthorization {\n return register(execution, {\n type: \"unrestricted\",\n projectId: execution.projectId,\n ref: Object.freeze({ type: \"disabled\" }),\n })\n}\n\n/** Register exact object-read authority without fabricating a principal identity. */\nexport function createDelegatedRuntimeAuthorization(input: {\n readonly execution: ExecutionContext\n readonly objectRead: {\n readonly selection: SelectedObjectReadScope\n readonly limits: ObjectReadExecutionLimits\n }\n readonly actionApply?: readonly DelegatedActionApplyTarget[]\n readonly delegation?: Extract<AuthorizationRef, { readonly type: \"delegated\" }>[\"delegation\"]\n}): RuntimeAuthorization {\n const execution = input.execution\n const objectReadInput = input.objectRead\n const actionApplyInput = input.actionApply\n const delegationInput = input.delegation\n const delegation =\n delegationInput === undefined ? undefined : snapshotSharedDelegation(delegationInput)\n if (execution.executor.type !== \"request\" || execution.requestedBy !== undefined) {\n throw new Error(\n \"[Sixb] Delegated runtime authorization requires a request execution without a principal.\"\n )\n }\n\n const objectRead = Object.freeze({\n scope: compileSelectedObjectReadScope(objectReadInput.selection),\n limits: snapshotObjectReadExecutionLimits(objectReadInput.limits),\n })\n return register(execution, {\n type: \"delegated\",\n projectId: execution.projectId,\n objectRead,\n actionApply: snapshotDelegatedActionApply(actionApplyInput ?? []),\n ...(delegation === undefined ? {} : { delegation }),\n })\n}\n\nexport function createTrustedPrimitiveRuntimeAuthorization(input: {\n readonly execution: ExecutionContext\n readonly primitive: TrustedPrimitiveRef\n}): RuntimeAuthorization {\n const primitive = snapshotTrustedPrimitive(input.primitive)\n return register(input.execution, {\n type: \"unrestricted\",\n projectId: input.execution.projectId,\n ref: Object.freeze({ type: \"trustedPrimitive\", primitive }),\n })\n}\n\nexport function createKernelRuntimeAuthorization(input: {\n readonly execution: ExecutionContext\n readonly operation: KernelOperation\n}): RuntimeAuthorization {\n const operation = snapshotKernelOperation(input.operation)\n return register(input.execution, {\n type: \"unrestricted\",\n projectId: input.execution.projectId,\n ref: Object.freeze({ type: \"kernel\", operation }),\n })\n}\n\nexport function resolveRuntimeAuthorization(authorization: unknown): ResolvedRuntimeAuthorization {\n if (!isRuntimeAuthorizationCapability(authorization)) {\n return { type: \"denied\" }\n }\n return registeredAuthorizations.get(authorization)?.resolved ?? { type: \"denied\" }\n}\n\n/**\n * Resolve authority from a runtime already admitted by `SixbHost.withScope`.\n *\n * Bound runtime facades carry no second execution value to recombine. Any lower-level boundary\n * that receives an `ExecutionContext` separately must use `resolveExecutionScopeAuthorization`.\n */\nexport function resolveRuntimeAuthorizationForProject(input: {\n readonly projectId: unknown\n readonly runtimeAuthorization?: unknown\n}): ResolvedRuntimeAuthorization {\n const resolved = resolveRuntimeAuthorization(input.runtimeAuthorization)\n if (\n resolved.type === \"denied\" ||\n typeof input.projectId !== \"string\" ||\n resolved.projectId !== input.projectId\n ) {\n return { type: \"denied\" }\n }\n return resolved\n}\n\nexport function getAuthorizationRef(authorization: RuntimeAuthorization): AuthorizationRef {\n const resolved = resolveRuntimeAuthorization(authorization)\n if (resolved.type === \"denied\") {\n throw new Error(\"[Sixb] Runtime authorization is not a registered Core capability.\")\n }\n if (resolved.type === \"delegated\") {\n if (resolved.delegation) {\n return { type: \"delegated\", delegation: { ...resolved.delegation } }\n }\n throw new Error(\n \"[Sixb] Delegated runtime authorization cannot cross a durable execution boundary.\"\n )\n }\n return cloneAuthorizationRef(resolved.ref)\n}\n\nfunction snapshotSharedDelegation(\n input: Extract<AuthorizationRef, { readonly type: \"delegated\" }>[\"delegation\"]\n): Extract<AuthorizationRef, { readonly type: \"delegated\" }>[\"delegation\"] {\n const kind = input.kind\n const grantId = input.grantId\n const sessionId = input.sessionId\n if (kind !== \"share\") throw new Error(\"[Sixb] Unknown delegated authority provenance.\")\n assertNonEmpty(grantId, \"Share grant id\")\n assertNonEmpty(sessionId, \"Share session id\")\n return Object.freeze({ kind, grantId, sessionId })\n}\n\nexport function assertExecutionScopeProject(projectId: string, scope: ExecutionScope): void {\n assertNonEmpty(projectId, \"Project id\")\n if (scope.execution.projectId !== projectId) {\n throw createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution scope belongs to project '${scope.execution.projectId}', not '${projectId}'.`,\n {\n details: {\n executionId: scope.execution.id,\n expectedProjectId: projectId,\n scopeProjectId: scope.execution.projectId,\n },\n }\n )\n }\n\n const resolved = resolveRuntimeAuthorization(scope.authorization)\n if (resolved.type === \"denied\") {\n throw createSixbError(\n \"internal.unexpected\",\n \"[Sixb] Execution scope carries unregistered runtime authorization.\",\n { details: { executionId: scope.execution.id, projectId } }\n )\n }\n if (resolved.projectId !== projectId) {\n throw createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution authorization belongs to project '${resolved.projectId}', not '${projectId}'.`,\n {\n details: {\n authorizationProjectId: resolved.projectId,\n executionId: scope.execution.id,\n expectedProjectId: projectId,\n },\n }\n )\n }\n}\n\n/**\n * Capture the two opaque capabilities carried by a scope exactly once.\n *\n * Security-sensitive boundaries must not resolve a caller-owned wrapper and then read it again:\n * accessor-backed inputs could otherwise substitute a different execution or authority between\n * those operations.\n */\nexport function captureExecutionScope(scope: ExecutionScope): ExecutionScope {\n const execution = scope.execution\n const authorization = scope.authorization\n return Object.freeze({ execution, authorization })\n}\n\n/** Validate that one registered authority belongs to the exact execution it accompanies. */\nexport function resolveExecutionScopeAuthorization(\n projectId: string,\n scope: ExecutionScope\n): RegisteredRuntimeAuthorization {\n const capturedScope = captureExecutionScope(scope)\n assertExecutionScopeProject(projectId, capturedScope)\n const resolved = resolveRuntimeAuthorization(capturedScope.authorization)\n if (resolved.type === \"denied\") {\n throw createSixbError(\n \"internal.unexpected\",\n \"[Sixb] Execution scope carries unregistered runtime authorization.\",\n { details: { executionId: capturedScope.execution.id, projectId } }\n )\n }\n\n const registration = registeredAuthorizations.get(capturedScope.authorization)\n if (!registration || !executionMatchesBinding(registration.execution, capturedScope.execution)) {\n throw invalidExecutionAuthority(\n capturedScope.execution.id,\n \"authority is bound to different execution provenance\"\n )\n }\n\n assertResolvedAuthorizationMatchesExecution(resolved, capturedScope.execution)\n return resolved\n}\n\nfunction assertResolvedAuthorizationMatchesExecution(\n resolved: RegisteredRuntimeAuthorization,\n execution: ExecutionContext\n): void {\n switch (execution.executor.type) {\n case \"request\":\n if (\n execution.source.type !== \"http\" ||\n execution.source.requestId !== execution.executor.requestId\n ) {\n throw invalidExecutionAuthority(execution.id, \"request source does not match its executor\")\n }\n if (resolved.type === \"principal\") {\n if (!principalsEqual(execution.requestedBy, resolved.ref.principal)) {\n throw invalidExecutionAuthority(\n execution.id,\n \"request authority does not match its requested-by principal\"\n )\n }\n return\n }\n if (\n resolved.type === \"unrestricted\" &&\n resolved.ref.type === \"disabled\" &&\n execution.requestedBy === undefined\n ) {\n return\n }\n if (resolved.type === \"delegated\" && execution.requestedBy === undefined) return\n throw invalidExecutionAuthority(\n execution.id,\n \"request execution requires principal, delegated, or explicitly disabled authority\"\n )\n\n case \"primitive\":\n if (\n resolved.type !== \"unrestricted\" ||\n resolved.ref.type !== \"trustedPrimitive\" ||\n resolved.ref.primitive.kind !== execution.executor.kind ||\n resolved.ref.primitive.id !== execution.executor.id ||\n resolved.ref.primitive.runId !== execution.executor.runId\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"trusted primitive authority does not match its executor\"\n )\n }\n return\n\n case \"agent\":\n if (execution.source.type !== \"execution\") {\n throw invalidExecutionAuthority(\n execution.id,\n \"agent execution requires an execution source\"\n )\n }\n if (resolved.type === \"principal\" && resolved.ref.type === \"principal\") {\n if (resolved.ref.principal.type === \"serviceAccount\") {\n const actorId = execution.executor.actorId\n if (\n actorId === undefined ||\n resolved.ref.principal.id !== agentServiceAccountId(actorId) ||\n resolved.ref.credential !== undefined\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"agent authority must reference its managed service account\"\n )\n }\n } else if (resolved.ref.credential === undefined) {\n throw invalidExecutionAuthority(\n execution.id,\n \"inherited user agent authority requires a credential\"\n )\n }\n return\n }\n if (resolved.type === \"unrestricted\" && resolved.ref.type === \"disabled\") return\n throw invalidExecutionAuthority(\n execution.id,\n \"agent authority must be principal or explicitly disabled\"\n )\n\n case \"kernel\":\n if (\n resolved.type !== \"unrestricted\" ||\n resolved.ref.type !== \"kernel\" ||\n execution.requestedBy !== undefined ||\n resolved.ref.operation.type !== execution.executor.operation.type ||\n kernelOperationId(resolved.ref.operation) !==\n kernelOperationId(execution.executor.operation)\n ) {\n throw invalidExecutionAuthority(\n execution.id,\n \"kernel authority does not match its executor\"\n )\n }\n return\n }\n}\n\nfunction principalsEqual(\n left: AuthorizablePrincipal | undefined,\n right: AuthorizablePrincipal | undefined\n): boolean {\n return left?.type === right?.type && left?.id === right?.id\n}\n\nfunction invalidExecutionAuthority(executionId: string, reason: string): Error {\n return createSixbError(\n \"internal.unexpected\",\n `[Sixb] Execution '${executionId}' is incompatible with its authority: ${reason}.`,\n { details: { executionId, reason } }\n )\n}\n\nfunction register(\n execution: ExecutionContext,\n input: RegisteredRuntimeAuthorization\n): RuntimeAuthorization {\n assertNonEmpty(input.projectId, \"Authorization project id\")\n const executionBinding = snapshotExecutionContext(execution)\n if (input.projectId !== executionBinding.projectId) {\n throw new Error(\n `[Sixb] Runtime authorization belongs to project '${input.projectId}', not execution project '${executionBinding.projectId}'.`\n )\n }\n assertResolvedAuthorizationMatchesExecution(input, executionBinding)\n const authorization = createRuntimeAuthorizationCapability()\n registeredAuthorizations.set(\n authorization,\n Object.freeze({ resolved: Object.freeze(input), execution: executionBinding })\n )\n return authorization\n}\n\nfunction executionMatchesBinding(binding: ExecutionContext, execution: ExecutionContext): boolean {\n try {\n return isDeepStrictEqual(binding, snapshotExecutionContext(execution))\n } catch {\n return false\n }\n}\n\nfunction snapshotExecutionContext(execution: ExecutionContext): ExecutionContext {\n assertNonEmpty(execution.id, \"Execution id\")\n assertNonEmpty(execution.projectId, \"Execution project id\")\n assertNonEmpty(execution.correlationId, \"Execution correlation id\")\n return Object.freeze({\n id: execution.id,\n projectId: execution.projectId,\n ...(execution.requestedBy === undefined\n ? {}\n : { requestedBy: snapshotAuthorizablePrincipal(execution.requestedBy) }),\n executor: snapshotExecutionExecutor(execution.executor),\n source: snapshotExecutionSource(execution.source),\n correlationId: execution.correlationId,\n })\n}\n\nfunction snapshotExecutionExecutor(\n executor: ExecutionContext[\"executor\"]\n): ExecutionContext[\"executor\"] {\n switch (executor.type) {\n case \"request\":\n assertNonEmpty(executor.requestId, \"Execution request id\")\n return Object.freeze({ type: \"request\", requestId: executor.requestId })\n case \"primitive\": {\n const primitive = snapshotTrustedPrimitive(executor)\n return Object.freeze({ type: \"primitive\", ...primitive })\n }\n case \"agent\":\n if (executor.actorId !== undefined)\n assertNonEmpty(executor.actorId, \"Execution Agent actor id\")\n assertNonEmpty(executor.runId, \"Execution Agent run id\")\n return Object.freeze({\n type: \"agent\",\n ...(executor.actorId === undefined ? {} : { actorId: executor.actorId }),\n runId: executor.runId,\n })\n case \"kernel\":\n return Object.freeze({\n type: \"kernel\",\n operation: snapshotKernelOperation(executor.operation),\n })\n }\n throw new Error(\n `[Sixb] Unknown execution executor type '${String((executor as { type?: unknown }).type)}'.`\n )\n}\n\nfunction snapshotExecutionSource(source: ExecutionContext[\"source\"]): ExecutionContext[\"source\"] {\n switch (source.type) {\n case \"ontologyCommit\":\n assertNonEmpty(source.commitId, \"Execution source commit id\")\n return Object.freeze({ type: source.type, commitId: source.commitId })\n case \"http\":\n assertNonEmpty(source.requestId, \"Execution source request id\")\n return Object.freeze({ type: \"http\", requestId: source.requestId })\n case \"webhook\":\n assertNonEmpty(source.deliveryId, \"Execution source delivery id\")\n return Object.freeze({ type: \"webhook\", deliveryId: source.deliveryId })\n case \"schedule\":\n case \"event\":\n assertNonEmpty(source.eventId, \"Execution source event id\")\n return Object.freeze({ type: source.type, eventId: source.eventId })\n case \"datasetVersion\":\n assertNonEmpty(source.datasetId, \"Execution source dataset id\")\n assertNonEmpty(source.versionId, \"Execution source dataset version id\")\n return Object.freeze({\n type: \"datasetVersion\",\n datasetId: source.datasetId,\n versionId: source.versionId,\n })\n case \"execution\":\n assertNonEmpty(source.executionId, \"Execution source execution id\")\n return Object.freeze({ type: \"execution\", executionId: source.executionId })\n }\n throw new Error(\n `[Sixb] Unknown execution source type '${String((source as { type?: unknown }).type)}'.`\n )\n}\n\nfunction snapshotAuthorizationContext(\n context: AuthorizationContext\n): PrincipalAuthorizationContext {\n const principal = snapshotAuthorizablePrincipal(context.principal)\n const grants = {} as Record<TargetedGrantKind, ReadonlySet<string>>\n for (const kind of TARGETED_GRANT_KIND_KEYS) {\n grants[kind] = new ImmutableGrantSet(context.grants[kind])\n }\n const frozenGrants: GrantIndex = Object.freeze({\n ...grants,\n \"run:agent\": context.grants[\"run:agent\"],\n })\n return Object.freeze({\n principal,\n ...(context.sessionId === undefined ? {} : { sessionId: context.sessionId }),\n groupIds: Object.freeze([...context.groupIds]),\n roleIds: Object.freeze([...context.roleIds]),\n grants: frozenGrants,\n })\n}\n\n/** Read-only Set semantics with no mutable handle hidden behind the TypeScript interface. */\nclass ImmutableGrantSet implements ReadonlySet<string> {\n readonly #values: Set<string>\n readonly [Symbol.toStringTag] = \"Set\"\n\n constructor(values: Iterable<string>) {\n this.#values = new Set(values)\n Object.freeze(this)\n }\n\n get size(): number {\n return this.#values.size\n }\n\n has(value: string): boolean {\n return this.#values.has(value)\n }\n\n entries(): ReturnType<Set<string>[\"entries\"]> {\n return this.#values.entries()\n }\n\n keys(): ReturnType<Set<string>[\"keys\"]> {\n return this.#values.keys()\n }\n\n values(): ReturnType<Set<string>[\"values\"]> {\n return this.#values.values()\n }\n\n [Symbol.iterator](): ReturnType<Set<string>[typeof Symbol.iterator]> {\n return this.#values[Symbol.iterator]()\n }\n\n forEach(\n callback: (value: string, valueAgain: string, set: ReadonlySet<string>) => void,\n thisArg?: unknown\n ): void {\n for (const value of this.#values) {\n callback.call(thisArg, value, value, this)\n }\n }\n\n add(_value: string): never {\n throw immutableGrantSetMutation()\n }\n\n delete(_value: string): never {\n throw immutableGrantSetMutation()\n }\n\n clear(): never {\n throw immutableGrantSetMutation()\n }\n}\n\nObject.freeze(ImmutableGrantSet.prototype)\n\nfunction immutableGrantSetMutation(): Error {\n return new Error(\"[Sixb] Runtime authorization grants are immutable.\")\n}\n\nfunction snapshotAuthorizablePrincipal(principal: Principal): AuthorizablePrincipal {\n if (principal.type !== \"user\" && principal.type !== \"serviceAccount\") {\n throw new Error(`[Sixb] Principal type '${principal.type}' cannot hold runtime authorization.`)\n }\n assertNonEmpty(principal.id, \"Authorization principal id\")\n return Object.freeze({ type: principal.type, id: principal.id })\n}\n\nfunction snapshotCredential(\n credential: NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]>\n): NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]> {\n assertNonEmpty(credential.id, \"Authorization credential id\")\n if (credential.type !== \"session\" && credential.type !== \"accessToken\") {\n const credentialType = (credential as { readonly type: string }).type\n throw new Error(`[Sixb] Unknown authorization credential type '${credentialType}'.`)\n }\n return Object.freeze({ type: credential.type, id: credential.id })\n}\n\nfunction assertCredentialMatchesContext(\n context: PrincipalAuthorizationContext,\n credential:\n | NonNullable<Extract<AuthorizationRef, { readonly type: \"principal\" }>[\"credential\"]>\n | undefined\n): void {\n if (credential?.type === \"session\") {\n if (context.sessionId !== credential.id) {\n throw new Error(\n \"[Sixb] Session credential id must match the authorization context session id.\"\n )\n }\n return\n }\n if (context.sessionId !== undefined) {\n throw new Error(\"[Sixb] Authorization context session requires a matching session credential.\")\n }\n}\n\nfunction snapshotTrustedPrimitive(primitive: TrustedPrimitiveRef): TrustedPrimitiveRef {\n if (!isTrustedPrimitiveKind(primitive.kind)) {\n throw new Error(`[Sixb] Unknown trusted primitive kind '${primitive.kind}'.`)\n }\n assertNonEmpty(primitive.id, \"Trusted primitive id\")\n assertNonEmpty(primitive.runId, \"Trusted primitive run id\")\n return Object.freeze({ kind: primitive.kind, id: primitive.id, runId: primitive.runId })\n}\n\nfunction snapshotKernelOperation(operation: KernelOperation): KernelOperation {\n if (operation.type !== \"ontology.recover\" && operation.type !== \"ontology.indexVectors\") {\n throw new Error(\n `[Sixb] Unknown kernel operation '${String((operation as { type?: unknown }).type)}'.`\n )\n }\n assertNonEmpty(kernelOperationId(operation), \"Kernel operation id\")\n return Object.freeze(kernelOperationFromId(operation.type, kernelOperationId(operation)))\n}\n\n/** Validate, bound, and detach exact delegated Action targets before registering authority. */\nfunction snapshotDelegatedActionApply(\n input: readonly DelegatedActionApplyTarget[]\n): readonly DelegatedActionApplyTarget[] {\n if (!Array.isArray(input)) {\n throw new Error(\"[Sixb] Delegated Action targets must be an array.\")\n }\n\n const targetCount = input.length\n if (targetCount > MAX_DELEGATED_ACTION_APPLY_TARGETS) {\n throw new Error(\n `[Sixb] Delegated authority exceeds the maximum of ${MAX_DELEGATED_ACTION_APPLY_TARGETS} Action targets.`\n )\n }\n\n let identifierCharacters = 0\n const targets: DelegatedActionApplyTarget[] = []\n for (let index = 0; index < targetCount; index += 1) {\n const authoredTarget = input[index]\n if (!isRecord(authoredTarget)) {\n throw new Error(`[Sixb] Delegated Action target ${index} must be an object.`)\n }\n\n const authoredActionId = authoredTarget.actionId\n const authoredSubject = authoredTarget.subject\n if (!isRecord(authoredSubject)) {\n throw new Error(`[Sixb] Delegated Action target ${index} subject must be an ObjectRef.`)\n }\n\n const actionId = delegatedActionIdentifier(\n authoredActionId,\n `Delegated Action target ${index} action id`\n )\n const objectTypeId = delegatedActionIdentifier(\n authoredSubject.objectTypeId,\n `Delegated Action target ${index} subject object type id`\n )\n const primaryId = delegatedActionIdentifier(\n authoredSubject.primaryId,\n `Delegated Action target ${index} subject primary id`\n )\n identifierCharacters += actionId.length + objectTypeId.length + primaryId.length\n if (identifierCharacters > MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS) {\n throw new Error(\n `[Sixb] Delegated authority exceeds the maximum of ${MAX_DELEGATED_ACTION_IDENTIFIER_CHARACTERS} Action identifier characters.`\n )\n }\n\n targets.push(\n Object.freeze({\n actionId,\n subject: Object.freeze({ objectTypeId, primaryId }),\n })\n )\n }\n\n return Object.freeze(targets)\n}\n\nfunction delegatedActionIdentifier(value: unknown, label: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw new Error(`[Sixb] ${label} must not be empty.`)\n }\n return value\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction cloneAuthorizationRef(ref: AuthorizationRef): AuthorizationRef {\n switch (ref.type) {\n case \"principal\":\n return {\n type: \"principal\",\n principal: { ...ref.principal },\n ...(ref.credential === undefined ? {} : { credential: { ...ref.credential } }),\n }\n case \"trustedPrimitive\":\n return { type: \"trustedPrimitive\", primitive: { ...ref.primitive } }\n case \"delegated\":\n return { type: \"delegated\", delegation: { ...ref.delegation } }\n case \"kernel\":\n return { type: \"kernel\", operation: { ...ref.operation } }\n case \"disabled\":\n return { type: \"disabled\" }\n }\n}\n\nfunction isTrustedPrimitiveKind(value: string): value is TrustedPrimitiveKind {\n return (\n value === \"action\" ||\n value === \"pipeline\" ||\n value === \"projection\" ||\n value === \"rule\" ||\n value === \"sync\" ||\n value === \"webhook\" ||\n value === \"workflow\"\n )\n}\n\nfunction assertNonEmpty(value: string, label: string): void {\n if (!value.trim()) {\n throw new Error(`[Sixb] ${label} must not be empty.`)\n }\n}\n",
6
- "/** Deterministic managed service-account id owned by one framework Agent actor. */\nexport function agentServiceAccountId(actorId: string): string {\n return `svc_agent_${actorId}`\n}\n",
7
- "/**\n * Grant kinds: the single source of truth for the (capability, target) space.\n *\n * Every grant collapses to one `GrantKind` discriminant — the same\n * `capability:target` string the decision engine uses as a grant key (e.g.\n * `view:object`, `run:sync`). Resolution, validation, enforcement, and the\n * resolved `GrantIndex` all key off it, so adding a grant family is a single\n * entry in `GRANT_KINDS` plus the compile errors that forces at every consumer.\n */\n\nimport type { AgentRunGrant, GrantDefinition } from \"../security/types\"\n\nexport type GrantKind =\n | \"access:application\"\n | \"view:object\"\n | \"view:dataset\"\n | \"edit:object\"\n | \"append:telemetry\"\n | \"apply:action\"\n | \"share:share\"\n | \"run:workflow\"\n | \"run:sync\"\n | \"run:pipeline\"\n | \"run:agent\"\n | \"observe:logs\"\n | \"observe:aiUsage\"\n | \"manage:connector\"\n | \"manage:aiUsage\"\n\nexport type SingletonGrantKind = \"run:agent\"\nexport type TargetedGrantKind = Exclude<GrantKind, SingletonGrantKind>\n\n/** Registered id universes a grant kind ranges over, plus subtype expansion. */\nexport interface GrantUniverse {\n readonly applicationIds: ReadonlySet<string>\n readonly objectTypeIds: ReadonlySet<string>\n readonly datasetIds: ReadonlySet<string>\n readonly actionIds: ReadonlySet<string>\n readonly shareIds: ReadonlySet<string>\n readonly workflowIds: ReadonlySet<string>\n readonly syncIds: ReadonlySet<string>\n readonly pipelineIds: ReadonlySet<string>\n readonly observableIds: ReadonlySet<string>\n readonly connectorIds: ReadonlySet<string>\n readonly manageableIds: ReadonlySet<string>\n readonly getSubTypes: (objectTypeId: string) => readonly string[]\n}\n\n/** The registered-id sets a grant kind validates against (no subtype hook). */\nexport type GrantUniverseKey = Exclude<keyof GrantUniverse, \"getSubTypes\">\n\ninterface TargetedGrantKindSpec {\n /** Registered universe the grant's ids must belong to. */\n readonly universeKey: GrantUniverseKey\n /** Subject noun used in validation errors (\"unknown <subject> '<id>'\"). */\n readonly subject: string\n /** Actionable hint appended to the \"unknown <subject>\" error. */\n readonly fix: string\n /** Only object-type grants also expand to subtypes. */\n readonly expandsSubtypes?: true\n}\n\ninterface SingletonGrantKindSpec {\n /** Project-wide capability with no resource selection; resolves to a boolean. */\n readonly singleton: true\n readonly subject: string\n readonly fix: string\n}\n\n/**\n * The exhaustive grant-kind table. A new grant family is one entry here; the\n * mapped type makes every omission a compile error.\n */\nexport const GRANT_KINDS: {\n readonly [TKind in GrantKind]: TKind extends SingletonGrantKind\n ? SingletonGrantKindSpec\n : TargetedGrantKindSpec\n} = {\n \"access:application\": {\n universeKey: \"applicationIds\",\n subject: \"application\",\n fix: \"Use an application exported from '@sixb/core'.\",\n },\n \"view:object\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n expandsSubtypes: true,\n },\n \"view:dataset\": {\n universeKey: \"datasetIds\",\n subject: \"dataset\",\n fix: \"Add it to 'datasets/' or pass it to createSixb({ datasets }).\",\n },\n // Deliberately no `expandsSubtypes`: granting writes on a parent type must not\n // silently extend to types added under it later. `view:object` expands because\n // a read of a subtype reveals nothing the parent's grant did not already cover.\n \"edit:object\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n },\n \"append:telemetry\": {\n universeKey: \"objectTypeIds\",\n subject: \"object type\",\n fix: \"Register it in 'ontology/' or pass it to createSixb({ ontologies }).\",\n },\n \"apply:action\": {\n universeKey: \"actionIds\",\n subject: \"action\",\n fix: \"Add it to 'actions/' or pass it to createSixb({ actions }).\",\n },\n \"share:share\": {\n universeKey: \"shareIds\",\n subject: \"share\",\n fix: \"Add it to 'shares/' or pass it to createSixb({ shares }).\",\n },\n \"run:workflow\": {\n universeKey: \"workflowIds\",\n subject: \"workflow\",\n fix: \"Add it to 'workflows/' or pass it to createSixb({ workflows }).\",\n },\n \"run:sync\": {\n universeKey: \"syncIds\",\n subject: \"sync\",\n fix: \"Add it to 'syncs/' or pass it to createSixb({ syncs }).\",\n },\n \"run:pipeline\": {\n universeKey: \"pipelineIds\",\n subject: \"pipeline\",\n fix: \"Add it to 'pipelines/' or pass it to createSixb({ pipelines }).\",\n },\n \"run:agent\": {\n singleton: true,\n subject: \"agent\",\n fix: \"Configure models.language and use the exported agent reference in can.run(agent).\",\n },\n \"observe:logs\": {\n universeKey: \"observableIds\",\n subject: \"observability surface\",\n fix: 'Use can.observe(\"logs\").',\n },\n \"observe:aiUsage\": {\n universeKey: \"observableIds\",\n subject: \"observability surface\",\n fix: \"Use can.observe(agent.usage).\",\n },\n \"manage:connector\": {\n universeKey: \"connectorIds\",\n subject: \"connector\",\n fix: \"Add it to 'connectors/' or pass it to createSixb({ connectors }).\",\n },\n \"manage:aiUsage\": {\n universeKey: \"manageableIds\",\n subject: \"management surface\",\n fix: \"Use can.manage(agent.usage).\",\n },\n}\n\nexport const GRANT_KIND_KEYS = Object.keys(GRANT_KINDS) as readonly GrantKind[]\nexport const TARGETED_GRANT_KIND_KEYS = GRANT_KIND_KEYS.filter(\n (kind): kind is TargetedGrantKind => kind !== \"run:agent\"\n)\n\n/** The grant kind a stored grant resolves to. */\nexport function grantKindOf(grant: AgentRunGrant): SingletonGrantKind\nexport function grantKindOf(grant: Exclude<GrantDefinition, AgentRunGrant>): TargetedGrantKind\nexport function grantKindOf(grant: GrantDefinition): GrantKind\nexport function grantKindOf(grant: GrantDefinition): GrantKind {\n switch (grant.capability) {\n case \"access\":\n return \"access:application\"\n case \"view\":\n return `view:${grant.target}`\n case \"edit\":\n return \"edit:object\"\n case \"append\":\n return \"append:telemetry\"\n case \"apply\":\n return \"apply:action\"\n case \"share\":\n return \"share:share\"\n case \"run\":\n return `run:${grant.target}`\n case \"observe\":\n return `observe:${grant.target}`\n case \"manage\":\n return `manage:${grant.target}`\n }\n}\n\n/** Mutable grant index: booleans for singleton capabilities, id sets for selected resources. */\nexport type MutableGrantIndex = {\n [TKind in GrantKind]: TKind extends SingletonGrantKind ? boolean : Set<string>\n}\n\nexport function emptyGrantSets(): MutableGrantIndex {\n return {\n \"access:application\": new Set(),\n \"view:object\": new Set(),\n \"view:dataset\": new Set(),\n \"edit:object\": new Set(),\n \"append:telemetry\": new Set(),\n \"apply:action\": new Set(),\n \"share:share\": new Set(),\n \"run:workflow\": new Set(),\n \"run:sync\": new Set(),\n \"run:pipeline\": new Set(),\n \"run:agent\": false,\n \"observe:logs\": new Set(),\n \"observe:aiUsage\": new Set(),\n \"manage:connector\": new Set(),\n \"manage:aiUsage\": new Set(),\n }\n}\n",
8
- "/** Provider-side limits for one selected object-read operation. */\nexport interface ObjectReadExecutionLimits {\n /** Maximum number of live roots and selected edge occurrences resolved by one operation. */\n readonly maxTraversalFacts: number\n /** Maximum UTF-8 JSON size released by one operation. */\n readonly maxOutputJsonBytes: number\n}\n\nexport type ObjectReadLimitMetric = \"traversalFacts\" | \"outputJsonBytes\"\n\n/** Cross-provider admission bound for one selected-reader facet terminal. */\nexport const MAX_OBJECT_READ_FACETS = 16\n\nconst MAX_OUTPUT_JSON_DEPTH = 64\n\n/** Stable, provider-neutral failure raised when an object-read budget is exhausted. */\nexport class ObjectReadLimitExceededError extends Error {\n readonly name = \"ObjectReadLimitExceededError\"\n readonly code = \"object_read_limit_exceeded\"\n\n constructor(\n readonly metric: ObjectReadLimitMetric,\n readonly limit: number\n ) {\n super(`[Sixb] Object read exceeded its ${metric} limit (${limit}).`)\n }\n}\n\n/** Validate and detach limits at the provider boundary. */\nexport function snapshotObjectReadExecutionLimits(\n limits: ObjectReadExecutionLimits\n): ObjectReadExecutionLimits {\n if (typeof limits !== \"object\" || limits === null) {\n throw new Error(\"[Sixb] Object read execution limits must be provided.\")\n }\n return Object.freeze({\n maxTraversalFacts: positiveSafeInteger(limits.maxTraversalFacts, \"maxTraversalFacts\"),\n maxOutputJsonBytes: positiveSafeInteger(limits.maxOutputJsonBytes, \"maxOutputJsonBytes\"),\n })\n}\n\n/** Reject facet fan-out before a provider resolves the selected universe. */\nexport function assertObjectReadFacetCount(count: number): void {\n if (!Number.isSafeInteger(count) || count < 0 || count > MAX_OBJECT_READ_FACETS) {\n throw new Error(\n `[Sixb] An object read supports between 0 and ${MAX_OBJECT_READ_FACETS} facets.`\n )\n }\n}\n\n/** Fail before a selected reader releases an oversized value to its caller. */\nexport function assertObjectReadOutputWithinLimit(\n value: unknown,\n limits: Pick<ObjectReadExecutionLimits, \"maxOutputJsonBytes\">\n): void {\n const fail = (): never => {\n throw new ObjectReadLimitExceededError(\"outputJsonBytes\", limits.maxOutputJsonBytes)\n }\n const stack: Array<{ value: object; serializedChildren: number }> = []\n let bytes = 0\n const addBytes = (count: number): void => {\n bytes += count\n if (bytes > limits.maxOutputJsonBytes) fail()\n }\n const addPrimitiveBytes = (primitive: boolean | number | string): void => {\n switch (typeof primitive) {\n case \"string\":\n addBytes(jsonStringUtf8Length(primitive))\n break\n case \"number\":\n addBytes(\n Number.isFinite(primitive) ? (Object.is(primitive, -0) ? 1 : String(primitive).length) : 4\n )\n break\n case \"boolean\":\n addBytes(primitive ? 4 : 5)\n break\n }\n }\n\n try {\n JSON.stringify(value, function (this: unknown, key, current: unknown) {\n const parent = isObject(this) ? this : undefined\n let parentFrameIndex = -1\n if (parent) {\n for (let index = stack.length - 1; index >= 0; index -= 1) {\n if (stack[index]?.value === parent) {\n parentFrameIndex = index\n break\n }\n }\n }\n const isRoot = parentFrameIndex === -1\n if (isRoot) {\n stack.length = 0\n } else {\n stack.length = parentFrameIndex + 1\n }\n const parentFrame = isRoot ? undefined : stack[parentFrameIndex]\n const parentIsArray = Array.isArray(parent)\n const unsupported =\n current === undefined || typeof current === \"function\" || typeof current === \"symbol\"\n\n if (!isRoot) {\n if (!parentIsArray && unsupported) return current\n if (!parentFrame) return fail()\n if (parentFrame.serializedChildren > 0) addBytes(1)\n parentFrame.serializedChildren += 1\n if (!parentIsArray) addBytes(jsonStringUtf8Length(key) + 1)\n } else if (unsupported) {\n return current\n }\n\n if (parentIsArray && unsupported) {\n addBytes(4)\n return current\n }\n\n if (isObject(current)) {\n // JSON.stringify handles primitive wrappers and raw JSON specially after the replacer.\n // Return an already-coerced primitive so custom Number/String coercion runs exactly once.\n const special = inspectJsonSpecialObject(current)\n switch (special.kind) {\n case \"primitive\":\n addPrimitiveBytes(special.value)\n return special.value\n case \"bigint\":\n throw new TypeError(\"BigInt is not JSON serializable\")\n case \"raw\":\n addBytes(rawJsonUtf8Length(special.value))\n return current\n case \"ordinary\":\n break\n }\n }\n\n switch (typeof current) {\n case \"string\":\n addPrimitiveBytes(current)\n break\n case \"number\":\n addPrimitiveBytes(current)\n break\n case \"boolean\":\n addPrimitiveBytes(current)\n break\n case \"bigint\":\n throw new TypeError(\"BigInt is not JSON serializable\")\n case \"object\":\n if (current === null) {\n addBytes(4)\n break\n }\n if (stack.some((frame) => frame.value === current)) {\n throw new TypeError(\"Cyclic object value\")\n }\n if (stack.length + 1 > MAX_OUTPUT_JSON_DEPTH) fail()\n addBytes(2)\n stack.push({ value: current, serializedChildren: 0 })\n break\n }\n return current\n })\n } catch (error) {\n if (error instanceof ObjectReadLimitExceededError) throw error\n if (error instanceof RangeError || error instanceof TypeError) fail()\n throw error\n }\n}\n\ntype JsonSpecialObject =\n | { readonly kind: \"ordinary\" }\n | { readonly kind: \"primitive\"; readonly value: boolean | number | string }\n | { readonly kind: \"bigint\" }\n | { readonly kind: \"raw\"; readonly value: string }\n\nconst jsonWithRawJson = JSON as JSON & {\n isRawJSON?: (value: unknown) => boolean\n}\nconst isRawJson = jsonWithRawJson.isRawJSON?.bind(jsonWithRawJson)\nconst booleanValueOf = bindValueOf(Boolean.prototype.valueOf)\nconst numberValueOf = bindValueOf(Number.prototype.valueOf)\nconst stringValueOf = bindValueOf(String.prototype.valueOf)\nconst bigintValueOf = bindValueOf(BigInt.prototype.valueOf)\nconst toStringValue = String\n\nfunction inspectJsonSpecialObject(value: object): JsonSpecialObject {\n if (isRawJson?.(value)) {\n const raw = (value as { readonly rawJSON?: unknown }).rawJSON\n if (typeof raw !== \"string\") return { kind: \"ordinary\" }\n return { kind: \"raw\", value: raw }\n }\n\n const boolean = unbox(value, booleanValueOf)\n if (boolean.matched) return { kind: \"primitive\", value: boolean.value }\n const number = unbox(value, numberValueOf)\n if (number.matched) return { kind: \"primitive\", value: +(value as unknown as number) }\n const string = unbox(value, stringValueOf)\n if (string.matched) return { kind: \"primitive\", value: toStringValue(value) }\n if (unbox(value, bigintValueOf).matched) return { kind: \"bigint\" }\n return { kind: \"ordinary\" }\n}\n\nfunction bindValueOf<T>(unboxer: (this: object) => T): (value: object) => T {\n return Function.prototype.call.bind(unboxer) as (value: object) => T\n}\n\nfunction unbox<T>(\n value: object,\n unboxer: (value: object) => T\n): { readonly matched: true; readonly value: T } | { readonly matched: false } {\n try {\n return { matched: true, value: unboxer(value) }\n } catch {\n return { matched: false }\n }\n}\n\nfunction rawJsonUtf8Length(value: string): number {\n // Raw JSON is already escaped source text. Count its encoded bytes directly without allocating\n // a second encoded buffer proportional to the caller-controlled payload.\n let bytes = 0\n for (let index = 0; index < value.length; index += 1) {\n const code = value.charCodeAt(index)\n if (code <= 0x7f) {\n bytes += 1\n } else if (code <= 0x7ff) {\n bytes += 2\n } else if (code >= 0xd800 && code <= 0xdbff) {\n const next = value.charCodeAt(index + 1)\n if (next >= 0xdc00 && next <= 0xdfff) {\n bytes += 4\n index += 1\n } else {\n bytes += 3\n }\n } else {\n bytes += 3\n }\n }\n return bytes\n}\n\nfunction jsonStringUtf8Length(value: string): number {\n let bytes = 2\n for (let index = 0; index < value.length; index += 1) {\n const code = value.charCodeAt(index)\n if (code === 0x22 || code === 0x5c) {\n bytes += 2\n } else if (code <= 0x1f) {\n bytes +=\n code === 0x08 || code === 0x09 || code === 0x0a || code === 0x0c || code === 0x0d ? 2 : 6\n } else if (code <= 0x7f) {\n bytes += 1\n } else if (code <= 0x7ff) {\n bytes += 2\n } else if (code >= 0xd800 && code <= 0xdbff) {\n const next = value.charCodeAt(index + 1)\n if (next >= 0xdc00 && next <= 0xdfff) {\n bytes += 4\n index += 1\n } else {\n bytes += 6\n }\n } else if (code >= 0xdc00 && code <= 0xdfff) {\n bytes += 6\n } else {\n bytes += 3\n }\n }\n return bytes\n}\n\nfunction isObject(value: unknown): value is object {\n return typeof value === \"object\" && value !== null\n}\n\nfunction positiveSafeInteger(value: unknown, name: string): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0) {\n throw new Error(`[Sixb] ${name} must be a positive safe integer.`)\n }\n return value\n}\n",
9
- "import type { Principal } from \"../auth/types\"\n\n/** User or service account that may initiate or authorize an execution. */\nexport type AuthorizablePrincipal = Extract<Principal, { readonly type: \"user\" | \"serviceAccount\" }>\n\n/** Registered primitive kinds that may receive internal trusted authority. */\nexport type TrustedPrimitiveKind =\n | \"action\"\n | \"pipeline\"\n | \"projection\"\n | \"rule\"\n | \"sync\"\n | \"webhook\"\n | \"workflow\"\n\nexport interface TrustedPrimitiveRef {\n readonly kind: TrustedPrimitiveKind\n readonly id: string\n readonly runId: string\n}\n\n/** Durable provenance for authority delegated by one shared-access browser session. */\nexport interface SharedAccessDelegationRef {\n readonly kind: \"share\"\n readonly grantId: string\n readonly sessionId: string\n}\n\nexport type KernelOperation =\n | { readonly type: \"ontology.recover\"; readonly recoveryId: string }\n | { readonly type: \"ontology.indexVectors\"; readonly indexingId: string }\n\n/** Workload currently executing. This is provenance and never grants authority by itself. */\nexport type ExecutionExecutor =\n | { readonly type: \"request\"; readonly requestId: string }\n | {\n readonly type: \"primitive\"\n readonly kind: TrustedPrimitiveKind\n readonly id: string\n readonly runId: string\n }\n | { readonly type: \"agent\"; readonly actorId?: string; readonly runId: string }\n | { readonly type: \"kernel\"; readonly operation: KernelOperation }\n\n/**\n * Occurrence that directly triggered an execution.\n *\n * An `execution` source is the single logical parent of a nested execution.\n */\nexport type ExecutionSource =\n | { readonly type: \"ontologyCommit\"; readonly commitId: string }\n | { readonly type: \"http\"; readonly requestId: string }\n | { readonly type: \"webhook\"; readonly deliveryId: string }\n | { readonly type: \"schedule\"; readonly eventId: string }\n | { readonly type: \"event\"; readonly eventId: string }\n | { readonly type: \"datasetVersion\"; readonly datasetId: string; readonly versionId: string }\n | { readonly type: \"execution\"; readonly executionId: string }\n\n/** Immutable provenance for one request, primitive run, agent run, or kernel operation. */\nexport interface ExecutionContext {\n readonly id: string\n readonly projectId: string\n readonly requestedBy?: AuthorizablePrincipal\n readonly executor: ExecutionExecutor\n readonly source: ExecutionSource\n readonly correlationId: string\n}\n\n/** Durable descriptor used to rebuild authority. A reference is never authoritative by itself. */\nexport type AuthorizationRef =\n | {\n readonly type: \"principal\"\n readonly principal: AuthorizablePrincipal\n readonly credential?:\n | { readonly type: \"session\"; readonly id: string }\n | { readonly type: \"accessToken\"; readonly id: string }\n }\n | { readonly type: \"trustedPrimitive\"; readonly primitive: TrustedPrimitiveRef }\n | { readonly type: \"delegated\"; readonly delegation: SharedAccessDelegationRef }\n | { readonly type: \"kernel\"; readonly operation: KernelOperation }\n | { readonly type: \"disabled\" }\n\nclass RuntimeAuthorizationCapability {\n readonly #runtimeAuthorization = true\n\n private constructor() {}\n\n static create(): RuntimeAuthorizationCapability {\n const capability = new RuntimeAuthorizationCapability()\n Object.freeze(capability)\n return capability\n }\n\n static is(value: unknown): value is RuntimeAuthorizationCapability {\n return typeof value === \"object\" && value !== null && #runtimeAuthorization in value\n }\n}\n\n/**\n * Opaque, process-local authority.\n *\n * The private class makes it nominal in TypeScript; Core registry membership makes it authoritative\n * at runtime. The capability itself is never persisted.\n */\nexport type RuntimeAuthorization = RuntimeAuthorizationCapability\n\n/** Execution provenance paired with the process-local authority that permits its operations. */\nexport interface ExecutionScope {\n readonly execution: ExecutionContext\n readonly authorization: RuntimeAuthorization\n}\n\n/** Internal constructor; the package root exports only the opaque type. */\nexport function createRuntimeAuthorizationCapability(): RuntimeAuthorization {\n return RuntimeAuthorizationCapability.create()\n}\n\n/** Internal runtime guard; registry membership remains the source of authority. */\nexport function isRuntimeAuthorizationCapability(value: unknown): value is RuntimeAuthorization {\n return RuntimeAuthorizationCapability.is(value)\n}\n",
10
- "/** Thrown when a scoped operation is not covered by the principal's grants. Maps to HTTP 403. */\nexport class AuthorizationError extends Error {\n readonly name = \"AuthorizationError\"\n\n constructor(\n /** Stable key of the missing grant, e.g. `view:object:Contract`. */\n readonly grantKey: string,\n message: string\n ) {\n super(message)\n }\n}\n",
11
- "/**\n * Authorization decisions for the core data path.\n *\n * `evaluate` is the single place that maps a request to the resolved grant\n * index. `can` (boolean) and `assertAuthorized` (throw) are the two ways to\n * consume a decision; every enforcement site goes through one of them.\n *\n * Every protected leaf first resolves the opaque runtime capability. Missing, forged, or\n * unregistered authority is denied; only an explicitly registered trusted or disabled execution\n * is unrestricted.\n */\n\nimport type { AuthSessionAudience } from \"../auth/audience\"\nimport {\n type ResolvedRuntimeAuthorization,\n resolveExecutionScopeAuthorization,\n resolveRuntimeAuthorizationForProject,\n} from \"../execution/authorization\"\nimport type { ExecutionContext, RuntimeAuthorization } from \"../execution/types\"\nimport { AuthorizationError } from \"./errors\"\nimport type { GrantKind } from \"./grant-kinds\"\nimport type { AuthorizationContext, GrantIndex } from \"./types\"\n\n/** Something a principal may attempt, paired with the resource it targets. */\nexport type AuthzRequest =\n | { readonly kind: \"application.access\"; readonly audience: AuthSessionAudience }\n | { readonly kind: \"object.view\"; readonly objectTypeId: string }\n | { readonly kind: \"dataset.view\"; readonly datasetId: string }\n | { readonly kind: \"object.edit\"; readonly objectTypeId: string }\n | { readonly kind: \"telemetry.append\"; readonly objectTypeId: string }\n | { readonly kind: \"action.apply\"; readonly actionId: string }\n | { readonly kind: \"share.manage\"; readonly shareId: string }\n | { readonly kind: \"workflow.run\"; readonly workflowId: string }\n | { readonly kind: \"sync.run\"; readonly syncId: string }\n | { readonly kind: \"pipeline.run\"; readonly pipelineId: string }\n | { readonly kind: \"agent.run\" }\n | { readonly kind: \"logs.observe\" }\n | { readonly kind: \"aiUsage.observe\" }\n | { readonly kind: \"aiUsage.manage\" }\n | { readonly kind: \"connector.manage\"; readonly connectorId: string }\n | { readonly kind: \"object.query\"; readonly touchedObjectTypeIds: readonly string[] }\n\nexport interface AuthzDecision {\n readonly allowed: boolean\n /** Grant keys the request needs, e.g. `view:object:quote`. */\n readonly requirements: readonly string[]\n /** Required keys the principal lacks; empty when allowed. */\n readonly missing: readonly string[]\n}\n\ninterface AuthorizedRuntime {\n readonly projectId: string\n readonly runtimeAuthorization?: RuntimeAuthorization\n readonly authorization?: AuthorizationContext\n}\n\n// A request expands to one or more atomic (grant kind, id) checks. The atom is\n// the single unit that both names a requirement and tests the grant index, so\n// the two can never drift. `kind` is the resolved-index key, so enforcement is\n// a direct lookup with no per-target dispatch.\ntype Atom =\n | { readonly kind: \"run:agent\" }\n | { readonly kind: Exclude<GrantKind, \"run:agent\">; readonly id: string }\n\nfunction atomsFor(request: AuthzRequest): readonly Atom[] {\n switch (request.kind) {\n case \"application.access\":\n return [{ kind: \"access:application\", id: request.audience }]\n case \"object.view\":\n return [{ kind: \"view:object\", id: request.objectTypeId }]\n case \"dataset.view\":\n return [{ kind: \"view:dataset\", id: request.datasetId }]\n case \"object.edit\":\n return [{ kind: \"edit:object\", id: request.objectTypeId }]\n case \"telemetry.append\":\n return [{ kind: \"append:telemetry\", id: request.objectTypeId }]\n case \"action.apply\":\n return [{ kind: \"apply:action\", id: request.actionId }]\n case \"share.manage\":\n return [{ kind: \"share:share\", id: request.shareId }]\n case \"workflow.run\":\n return [{ kind: \"run:workflow\", id: request.workflowId }]\n case \"sync.run\":\n return [{ kind: \"run:sync\", id: request.syncId }]\n case \"pipeline.run\":\n return [{ kind: \"run:pipeline\", id: request.pipelineId }]\n case \"agent.run\":\n return [{ kind: \"run:agent\" }]\n case \"logs.observe\":\n return [{ kind: \"observe:logs\", id: \"logs\" }]\n case \"aiUsage.observe\":\n return [{ kind: \"observe:aiUsage\", id: \"aiUsage\" }]\n case \"aiUsage.manage\":\n return [{ kind: \"manage:aiUsage\", id: \"aiUsage\" }]\n case \"connector.manage\":\n return [{ kind: \"manage:connector\", id: request.connectorId }]\n case \"object.query\":\n return request.touchedObjectTypeIds.map((id) => ({ kind: \"view:object\", id }))\n }\n}\n\nfunction atomKey(atom: Atom): string {\n if (atom.kind === \"run:agent\") return atom.kind\n if (\n atom.kind === \"observe:logs\" ||\n atom.kind === \"observe:aiUsage\" ||\n atom.kind === \"manage:aiUsage\"\n ) {\n return atom.kind\n }\n return `${atom.kind}:${atom.id}`\n}\n\nfunction holds(grants: GrantIndex, atom: Atom): boolean {\n if (atom.kind === \"run:agent\") return grants[atom.kind]\n return grants[atom.kind].has(atom.id)\n}\n\n/** Resolve a request against a principal's grants. Never throws. */\nexport function evaluate(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): AuthzDecision {\n const atoms = atomsFor(request)\n const requirements = atoms.map(atomKey)\n const missing = authorization\n ? atoms.filter((atom) => !holds(authorization.grants, atom)).map(atomKey)\n : []\n return { allowed: missing.length === 0, requirements, missing }\n}\n\nexport function isAllowed(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): boolean {\n return evaluate(authorization, request).allowed\n}\n\nexport function assertAuthorized(runtime: AuthorizedRuntime, request: AuthzRequest): void {\n const resolved = assertRuntimeAuthorizationBound(runtime)\n if (resolved.type === \"delegated\") {\n throw new AuthorizationError(\n `delegated:${request.kind}`,\n `[Sixb] Operation '${request.kind}' is not covered by delegated authorization.`\n )\n }\n const authorization = resolved.type === \"principal\" ? resolved.context : undefined\n const decision = evaluate(authorization, request)\n if (decision.allowed) {\n return\n }\n\n throw new AuthorizationError(\n decision.missing[0] ?? request.kind,\n deniedMessage(authorization, request)\n )\n}\n\n/** Runtime catalogs never infer unrestricted access from an absent principal context. */\nexport function isRuntimeAllowed(runtime: AuthorizedRuntime, request: AuthzRequest): boolean {\n const authority = resolveRuntimeAuthorizationForProject(runtime)\n if (authority.type === \"denied\" || authority.type === \"delegated\") return false\n return authority.type === \"unrestricted\" || isAllowed(authority.context, request)\n}\n\n/** Resolve registered process-local authority before a protected leaf makes a decision. */\nexport function assertRuntimeAuthorizationBound(\n runtime: AuthorizedRuntime\n): Exclude<ResolvedRuntimeAuthorization, { readonly type: \"denied\" }> {\n const resolved = resolveRuntimeAuthorizationForProject(runtime)\n if (resolved.type === \"denied\") {\n throw new AuthorizationError(\n \"runtime:unbound\",\n \"[Sixb] Protected operations require a registered execution scope.\"\n )\n }\n return resolved\n}\n\n/**\n * Assert a principal may write objects of this type.\n *\n * Requires `view:object` as well as `edit:object`, and that is not belt-and-braces: an upsert\n * returns the *merged* row, which the Materializer reconciles against source authority, so the\n * response can carry properties the caller never sent. Granting the write without the read would\n * leak them.\n *\n * The pairing is asserted here rather than implied during resolution: `resolveRoleGrants` has no\n * notion of one grant entailing another, and giving it one would put ids in the resolved index that\n * no role granted — an index that no longer answers \"what was actually granted\".\n *\n * Telemetry append is deliberately *not* paired this way; see {@link assertCanAppendTelemetry}.\n */\nexport function assertCanEdit(runtime: AuthorizedRuntime, objectTypeId: string): void {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n assertAuthorized(runtime, { kind: \"object.edit\", objectTypeId })\n}\n\n/**\n * Assert a principal may append telemetry points to objects of this type.\n *\n * No `view:object` requirement, unlike {@link assertCanEdit}: an append answers with no object\n * state, so there is nothing to leak. That is what makes a write-only principal — a device, an\n * ingestion service — expressible at all, and it is the reason telemetry has its own grant.\n */\nexport function assertCanAppendTelemetry(runtime: AuthorizedRuntime, objectTypeId: string): void {\n assertAuthorized(runtime, { kind: \"telemetry.append\", objectTypeId })\n}\n\n/** Assert a principal may manage lifecycle state for this connector definition. */\nexport function assertCanManageConnector(runtime: AuthorizedRuntime, connectorId: string): void {\n assertAuthorized(runtime, { kind: \"connector.manage\", connectorId })\n}\n\n/**\n * Fail closed for operations that have no grant semantics yet.\n *\n * One caller left — `listLinks`, whose rows reveal target types that no read grant covers. Object,\n * link, and telemetry writes moved to {@link assertCanEdit} / {@link assertCanAppendTelemetry}.\n * Keeps unsupported surfaces denied even if a principal-bound runtime context reaches a code path\n * the execution SDK does not expose.\n */\nexport function assertPrivileged(runtime: AuthorizedRuntime, operation: string): void {\n const resolved = assertRuntimeAuthorizationBound(runtime)\n if (resolved.type === \"unrestricted\") {\n return\n }\n\n throw new AuthorizationError(\n `privileged:${operation}`,\n `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`\n )\n}\n\n/**\n * Assert access to process providers that trusted executions and genuine agent runs may use.\n *\n * Agent provenance alone is not authority: the registered capability must be bound to the exact\n * same immutable execution before this check succeeds.\n */\nexport function assertProviderAccess(\n runtime: AuthorizedRuntime & { readonly runtimeAuthorization: RuntimeAuthorization },\n execution: ExecutionContext,\n operation: string\n): void {\n const resolved = resolveExecutionScopeAuthorization(runtime.projectId, {\n execution,\n authorization: runtime.runtimeAuthorization,\n })\n if (resolved.type === \"unrestricted\") {\n return\n }\n\n if (execution.executor.type === \"agent\") {\n return\n }\n\n throw new AuthorizationError(\n `privileged:${operation}`,\n `[Sixb] Operation '${operation}' is not covered by scoped authorization grants.`\n )\n}\n\nfunction deniedMessage(\n authorization: AuthorizationContext | null | undefined,\n request: AuthzRequest\n): string {\n const principalId = authorization?.principal.id ?? \"unknown\"\n switch (request.kind) {\n case \"application.access\":\n return `[Sixb] Principal '${principalId}' is not allowed to access application '${request.audience}'.`\n case \"object.view\":\n return `[Sixb] Principal '${principalId}' is not allowed to view object type '${request.objectTypeId}'.`\n case \"dataset.view\":\n return `[Sixb] Principal '${principalId}' is not allowed to view dataset '${request.datasetId}'.`\n case \"object.edit\":\n return `[Sixb] Principal '${principalId}' is not allowed to write object type '${request.objectTypeId}'.`\n case \"telemetry.append\":\n return `[Sixb] Principal '${principalId}' is not allowed to append telemetry for object type '${request.objectTypeId}'.`\n case \"action.apply\":\n return `[Sixb] Principal '${principalId}' is not allowed to apply action '${request.actionId}'.`\n case \"share.manage\":\n return `[Sixb] Principal '${principalId}' is not allowed to manage Share '${request.shareId}'.`\n case \"workflow.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run workflow '${request.workflowId}'.`\n case \"sync.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run sync '${request.syncId}'.`\n case \"pipeline.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run pipeline '${request.pipelineId}'.`\n case \"agent.run\":\n return `[Sixb] Principal '${principalId}' is not allowed to run the project Agent.`\n case \"logs.observe\":\n return `[Sixb] Principal '${principalId}' is not allowed to observe project logs.`\n case \"aiUsage.observe\":\n return `[Sixb] Principal '${principalId}' is not allowed to observe project AI usage.`\n case \"aiUsage.manage\":\n return `[Sixb] Principal '${principalId}' is not allowed to manage project AI usage limits.`\n case \"connector.manage\":\n return `[Sixb] Principal '${principalId}' is not allowed to manage connector '${request.connectorId}'.`\n case \"object.query\": {\n // Name the first touched type the principal cannot view.\n const blocked = request.touchedObjectTypeIds.find(\n (objectTypeId) => !isAllowed(authorization, { kind: \"object.view\", objectTypeId })\n )\n return `[Sixb] Principal '${principalId}' is not allowed to view object type '${blocked}'.`\n }\n }\n}\n",
12
- "import type { AuthSessionAudience } from \"../auth/audience\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext, ResolvedRole } from \"./types\"\n\n/** Whether declaring roles has enabled an allowlist for an application. */\nexport function isApplicationAccessControlled(\n roles: readonly ResolvedRole[],\n audience: AuthSessionAudience\n): boolean {\n return roles.some((role) => role.grants[\"access:application\"].has(audience))\n}\n\n/**\n * Whether this principal may open this application.\n *\n * KNOWN LIMITATION (0.1.x): application access is the one capability that is **not** deny-by-default.\n * While no role mentions an application, every authenticated principal may open it; the allowlist only\n * switches on once some role grants it. Every other capability — `view`, `apply`, `run`, `observe` —\n * denies unless granted, so this is the single asymmetry in the model.\n *\n * It is deliberate for now: flipping it would lock every project out of Atlas until it declares a role,\n * including projects with no security definitions at all. Closing it means shipping a default grant with\n * the scaffold first, and it is a breaking change for any project relying on the open default.\n */\nexport function canAccessApplication(\n authorization: AuthorizationContext,\n roles: readonly ResolvedRole[],\n audience: AuthSessionAudience\n): boolean {\n return (\n !isApplicationAccessControlled(roles, audience) ||\n isAllowed(authorization, { kind: \"application.access\", audience })\n )\n}\n",
13
- "/**\n * Event visibility derived from grants.\n *\n * There is no standalone \"view events\" capability: a principal sees a domain\n * event only when it can view/apply/run the event's subject. A privileged\n * caller (no authorization context) sees everything.\n *\n * The topic switch is fail-closed: an unrecognized topic is hidden, because a\n * topic we don't yet model may carry a subject the principal is not allowed to\n * see. Adding an event topic therefore requires an explicit visibility decision\n * here, never a silent default.\n */\n\nimport type { StoredDomainEvent } from \"../events\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext } from \"./types\"\n\nexport function canViewEvent(\n authorization: AuthorizationContext | null | undefined,\n event: StoredDomainEvent\n): boolean {\n if (!authorization) {\n return true\n }\n\n switch (event.topic) {\n case \"objects\":\n case \"telemetry\":\n return isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.objectTypeId,\n })\n case \"links\":\n return (\n isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.sourceTypeId,\n }) &&\n isAllowed(authorization, { kind: \"object.view\", objectTypeId: event.payload.targetTypeId })\n )\n case \"actions\": {\n // Apply is necessary; for object-bound actions the principal must also be\n // able to view the subject type, or the event would leak a hidden\n // object's id/type — mirroring the rule in `canListAction`.\n if (!isAllowed(authorization, { kind: \"action.apply\", actionId: event.payload.actionId })) {\n return false\n }\n const subject = event.payload.subject\n return subject.kind === \"object\"\n ? isAllowed(authorization, { kind: \"object.view\", objectTypeId: subject.objectTypeId })\n : true\n }\n case \"workflows\":\n return isAllowed(authorization, {\n kind: \"workflow.run\",\n workflowId: event.payload.workflowId,\n })\n case \"rules\":\n // Rule events carry the object they fired on, so gate on viewing it —\n // otherwise they leak the existence and id of hidden-type objects.\n return isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: event.payload.subject.objectTypeId,\n })\n // Run grant gates the operational stream. These payloads may also carry the\n // produced datasetId/versionId; that target is already visible to a runner\n // through the sync/pipeline catalog (`sync.target.dataset`), so surfacing it\n // here discloses nothing new.\n case \"syncs\":\n return isAllowed(authorization, {\n kind: \"sync.run\",\n syncId: event.payload.syncId,\n })\n case \"pipelines\":\n return isAllowed(authorization, {\n kind: \"pipeline.run\",\n pipelineId: event.payload.pipelineId,\n })\n case \"schedules\":\n // Infra topics with no object/action/workflow/dataset subject: no grant\n // governs them yet, so they stay visible to any authorized reader. When\n // they gain their own grants, add the checks here.\n return true\n case \"datasets\":\n // dataset.view alone. The payload's `producer` (the sync/pipeline that\n // produced the version, plus its runId) is intentionally visible to any\n // dataset viewer as provenance — the same identity the versions API\n // already serializes for that principal. This is distinct from the\n // operational `references` in the dataset catalog (which syncs/pipelines\n // are wired to a dataset), which stays gated on the run grants.\n return isAllowed(authorization, {\n kind: \"dataset.view\",\n datasetId: event.payload.datasetId,\n })\n default:\n // Fail closed: an unmodeled topic may carry a subject we don't yet gate.\n return false\n }\n}\n",
14
- "import type { Principal } from \"../auth/types\"\nimport type { RoleDefinition, Selection } from \"../security\"\nimport {\n emptyGrantSets,\n GRANT_KINDS,\n type GrantUniverse,\n grantKindOf,\n TARGETED_GRANT_KIND_KEYS,\n} from \"./grant-kinds\"\nimport type { AuthorizationContext, GrantIndex, ResolvedRole } from \"./types\"\n\n/**\n * Resolve a role's grants once at startup.\n *\n * Broad grants (`every.object().except([...])`) expand against the registered\n * universe; object-type grants also expand to subtypes. Resource grants become\n * id sets; the project Agent grant becomes a boolean.\n * The per-kind universe and subtype rules come from the `GRANT_KINDS` table, so\n * this loop never enumerates targets by hand.\n */\nexport function resolveRoleGrants(role: RoleDefinition, universe: GrantUniverse): GrantIndex {\n const grants = emptyGrantSets()\n\n for (const grant of role.grants) {\n if (grant.capability === \"run\" && grant.target === \"agent\") {\n grants[\"run:agent\"] = true\n continue\n }\n const kind = grantKindOf(grant)\n const spec = GRANT_KINDS[kind]\n expandSelection(\n grant.selection,\n universe[spec.universeKey],\n grants[kind],\n spec.expandsSubtypes ? universe.getSubTypes : undefined\n )\n }\n\n return grants\n}\n\nfunction expandSelection(\n selection: Selection,\n universe: ReadonlySet<string>,\n into: Set<string>,\n expand?: (id: string) => readonly string[]\n): void {\n if (selection.all) {\n const except = new Set(selection.except)\n for (const id of universe) {\n if (!except.has(id)) {\n into.add(id)\n }\n }\n return\n }\n\n for (const id of selection.ids) {\n into.add(id)\n if (expand) {\n for (const subTypeId of expand(id)) {\n into.add(subTypeId)\n }\n }\n }\n}\n\n/**\n * Resolve a principal's authorization context from its group memberships.\n *\n * Pure set-union over pre-resolved roles: roles match when their grantedTo\n * groups intersect the principal's memberships, and their concrete id sets\n * union into the principal's grant index.\n */\nexport function resolveAuthorizationContext(input: {\n readonly principal: Principal\n readonly sessionId?: string\n readonly groupIds: readonly string[]\n readonly roles: readonly ResolvedRole[]\n}): AuthorizationContext {\n const memberGroupIds = new Set(input.groupIds)\n const roleIds: string[] = []\n const grants = emptyGrantSets()\n\n for (const role of input.roles) {\n if (!role.grantedToGroupIds.some((groupId) => memberGroupIds.has(groupId))) {\n continue\n }\n\n roleIds.push(role.id)\n if (role.grants[\"run:agent\"]) {\n grants[\"run:agent\"] = true\n }\n for (const kind of TARGETED_GRANT_KIND_KEYS) {\n for (const id of role.grants[kind]) {\n grants[kind].add(id)\n }\n }\n }\n\n return {\n principal: input.principal,\n ...(input.sessionId !== undefined ? { sessionId: input.sessionId } : {}),\n groupIds: input.groupIds,\n roleIds,\n grants,\n }\n}\n",
15
- "export class ProjectionValidationError extends Error {\n readonly name = \"ProjectionValidationError\"\n}\n",
16
- "import { compareStrings } from \"../json\"\nimport type { OntologyDefinitionCatalog } from \"../ontology\"\nimport { ProjectionValidationError } from \"./errors\"\nimport type { ProjectionDefinition, ProjectionOwnership } from \"./types\"\n\nexport function computeProjectionOwnership(\n projection: ProjectionDefinition,\n ontology: OntologyDefinitionCatalog\n): ProjectionOwnership {\n if (projection._tag === \"ObjectProjectionDefinition\") {\n const primaryId = ontology.getPrimaryPropertyId(projection.objectTypeId)\n return freezeOwnership({\n objects: [\n {\n objectTypeId: projection.objectTypeId,\n existence: true,\n propertyIds: Object.keys(projection.properties)\n .filter((propertyId) => propertyId !== primaryId)\n .sort(compareStrings),\n },\n ],\n links: Object.keys(projection.links)\n .sort(compareStrings)\n .map((linkId) => ({ sourceObjectTypeId: projection.objectTypeId, linkId })),\n telemetry: [],\n })\n }\n\n if (projection._tag === \"LinkProjectionDefinition\") {\n return freezeOwnership({\n objects: [],\n links: [\n {\n sourceObjectTypeId: projection.sourceObjectTypeId,\n linkId: projection.linkId,\n },\n ],\n telemetry: [],\n })\n }\n\n return freezeOwnership({\n objects: [],\n links: [],\n telemetry: Object.keys(projection.properties)\n .sort(compareStrings)\n .map((propertyId) => ({\n objectTypeId: projection.objectTypeId,\n propertyId,\n })),\n })\n}\n\nexport interface ProjectionOwnershipRecord<\n TDefinition extends ProjectionDefinition = ProjectionDefinition,\n> {\n readonly definition: TDefinition\n readonly ownership: ProjectionOwnership\n}\n\nexport function validateProjectionOwnership(\n projections: readonly ProjectionOwnershipRecord[]\n): void {\n const existenceOwners = new Map<string, string>()\n const propertyOwners = new Map<string, string>()\n const linkOwners = new Map<string, string>()\n const telemetryOwners = new Map<string, string>()\n\n for (const { definition, ownership } of projections) {\n for (const object of ownership.objects) {\n if (object.existence) {\n registerOwner(\n existenceOwners,\n object.objectTypeId,\n definition.id,\n `object type '${object.objectTypeId}' existence`\n )\n }\n for (const propertyId of object.propertyIds) {\n registerOwner(\n propertyOwners,\n JSON.stringify([object.objectTypeId, propertyId]),\n definition.id,\n `property '${object.objectTypeId}.${propertyId}'`\n )\n }\n }\n for (const link of ownership.links) {\n registerOwner(\n linkOwners,\n JSON.stringify([link.sourceObjectTypeId, link.linkId]),\n definition.id,\n `link scope '${link.sourceObjectTypeId}.${link.linkId}'`\n )\n }\n for (const telemetry of ownership.telemetry) {\n registerOwner(\n telemetryOwners,\n JSON.stringify([telemetry.objectTypeId, telemetry.propertyId]),\n definition.id,\n `telemetry source '${telemetry.objectTypeId}.${telemetry.propertyId}'`\n )\n }\n }\n}\n\nfunction registerOwner(\n owners: Map<string, string>,\n key: string,\n projectionId: string,\n description: string\n): void {\n const existing = owners.get(key)\n if (existing !== undefined) {\n throw new ProjectionValidationError(\n `[Sixb] Projection '${projectionId}' overlaps ${description} owned by projection '${existing}'.`\n )\n }\n owners.set(key, projectionId)\n}\n\nfunction freezeOwnership(ownership: ProjectionOwnership): ProjectionOwnership {\n return Object.freeze({\n objects: Object.freeze(\n ownership.objects.map((object) =>\n Object.freeze({ ...object, propertyIds: Object.freeze([...object.propertyIds]) })\n )\n ),\n links: Object.freeze(ownership.links.map((link) => Object.freeze({ ...link }))),\n telemetry: Object.freeze(\n ownership.telemetry.map((telemetry) => Object.freeze({ ...telemetry }))\n ),\n })\n}\n",
17
- "/**\n * Build-time validation helpers for projection definitions.\n *\n * These run eagerly inside builder calls (not deferred to `.build()`).\n * They are also reusable by Increment 7 for startup validation.\n */\n\nimport type { DatasetDefinition } from \"../datasets\"\nimport type { OntologyDefinitionCatalog } from \"../ontology\"\nimport type { ObjectType, Property, ValueType } from \"../ontology/types\"\nimport { resolveSemanticType } from \"../ontology/validation\"\nimport { ProjectionValidationError } from \"./errors\"\nimport {\n computeProjectionOwnership,\n type ProjectionOwnershipRecord,\n validateProjectionOwnership,\n} from \"./ownership\"\nimport type {\n ForeignKeyDescriptor,\n LinkProjectionDefinition,\n ObjectProjectionDefinition,\n ProjectionDefinition,\n TelemetryProjectionDefinition,\n} from \"./types\"\n\n/**\n * Validates the property mapping for an object projection.\n *\n * Rules:\n * 1. All keys must be valid property ids on the object type.\n * 2. The object type must have exactly one primary property.\n * 3. The primary property must be included in the mapping.\n */\nexport function validatePropertyMapping(\n objectType: ObjectType,\n mapping: Record<string, string>\n): void {\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n const mappingKeys = Object.keys(mapping)\n\n // Rule 1: all keys are valid property ids\n for (const key of mappingKeys) {\n if (!propertyIds.has(key)) {\n const available = [...propertyIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Property '${key}' does not exist on object type '${objectType.id}'. ` +\n `Available properties: ${available}`\n )\n }\n }\n\n // Rule 2: exactly one primary property\n const primaryProperties = objectType.properties.filter((p) => p.primary === true)\n if (primaryProperties.length !== 1) {\n throw new ProjectionValidationError(\n `Object type '${objectType.id}' must have exactly one primary property, ` +\n `found ${primaryProperties.length}.`\n )\n }\n\n // Rule 3: primary property is in the mapping\n const primaryId = primaryProperties[0].id\n if (!(primaryId in mapping)) {\n throw new ProjectionValidationError(\n `Primary property '${primaryId}' of object type '${objectType.id}' ` +\n `must be included in the property mapping.`\n )\n }\n}\n\n/**\n * Validates the link mapping for an object projection and returns a validated copy.\n *\n * Rules:\n * 1. All keys must be valid link ids on the object type.\n * 2. Record key must match descriptor.linkId.\n * 3. Link target must be a single concrete type (not polymorphic or wildcard).\n * 4. The descriptor must use exactly one source: sourcePropertyId or sourceField.\n * 5. Source properties must exist and be present in the property mapping.\n * Source fields are validated later against the projection dataset.\n */\nexport function validateAndLowerLinkMapping(\n objectType: ObjectType,\n linkMapping: Record<string, ForeignKeyDescriptor>,\n propertyMapping: Record<string, string>\n): Record<string, ForeignKeyDescriptor> {\n const linkIds = new Set(objectType.links.map((l) => l.id))\n const linksById = new Map(objectType.links.map((l) => [l.id, l]))\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n\n for (const [key, descriptor] of Object.entries(linkMapping)) {\n // Rule 1: valid link id\n if (!linkIds.has(key)) {\n const available = [...linkIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Link '${key}' does not exist on object type '${objectType.id}'. ` +\n `Available links: ${available}`\n )\n }\n\n // Rule 2: key matches descriptor.linkId\n if (key !== descriptor.linkId) {\n throw new ProjectionValidationError(\n `Link mapping key '${key}' does not match descriptor linkId '${descriptor.linkId}'.`\n )\n }\n\n // Rule 3: single concrete target\n const link = linksById.get(key)!\n if (Array.isArray(link.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `Link '${key}' on object type '${objectType.id}' has a polymorphic target. ` +\n `FK projection of polymorphic links is not yet supported.`\n )\n }\n if (link.targetObjectTypeId === \"*\") {\n throw new ProjectionValidationError(\n `Link '${key}' on object type '${objectType.id}' has a wildcard target. ` +\n `FK projection of wildcard links is not supported.`\n )\n }\n\n const sourcePropertyId = descriptor.sourcePropertyId\n const sourceField = descriptor.sourceField\n if (sourcePropertyId && sourceField) {\n throw new ProjectionValidationError(\n `FK link '${key}' must use either sourceProperty or sourceField, not both.`\n )\n }\n if (!sourcePropertyId && !sourceField) {\n throw new ProjectionValidationError(\n `FK link '${key}' must declare sourceProperty or sourceField.`\n )\n }\n\n if (!sourcePropertyId) {\n continue\n }\n\n // Rule 4: source property exists on the type\n if (!propertyIds.has(sourcePropertyId)) {\n const available = [...propertyIds].sort().join(\", \")\n throw new ProjectionValidationError(\n `Source property '${sourcePropertyId}' does not exist on ` +\n `object type '${objectType.id}'. Available properties: ${available}`\n )\n }\n\n // Rule 5: source property is in the property mapping\n if (!(sourcePropertyId in propertyMapping)) {\n throw new ProjectionValidationError(\n `Source property '${sourcePropertyId}' for link '${key}' ` +\n `must be included in the property mapping.`\n )\n }\n }\n\n return Object.fromEntries(\n Object.entries(linkMapping).map(([linkId, descriptor]) => [\n linkId,\n {\n linkId: descriptor.linkId,\n ...(descriptor.sourcePropertyId !== undefined\n ? { sourcePropertyId: descriptor.sourcePropertyId }\n : {}),\n ...(descriptor.sourceField !== undefined ? { sourceField: descriptor.sourceField } : {}),\n targetObjectTypeId: descriptor.targetObjectTypeId,\n },\n ])\n )\n}\n\n/**\n * Validates that a link token points to a single concrete target type.\n *\n * Rules:\n * 1. Not an array (polymorphic).\n * 2. Not wildcard (\"*\").\n */\nexport function validateLinkProjectionTarget(linkToken: {\n readonly id: string\n readonly targetObjectTypeId: string | readonly string[]\n}): void {\n if (Array.isArray(linkToken.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `Link '${linkToken.id}' has a polymorphic target. ` +\n `Link projection of polymorphic links is not yet supported.`\n )\n }\n if (linkToken.targetObjectTypeId === \"*\") {\n throw new ProjectionValidationError(\n `Link '${linkToken.id}' has a wildcard target. ` +\n `Link projection of wildcard links is not supported.`\n )\n }\n}\n\n/**\n * Validates a telemetry projection's field mapping against its dataset columns\n * and object type: every mapped property exists and is telemetry-enabled, and\n * every mapped field (objectId/at/value/unit) resolves to a real dataset column.\n *\n * Owned here so startup validation and the projection worker's pre-execution\n * check share one implementation and cannot drift; the worker layers\n * dataset-version column type compatibility on top of these rules. Returns the\n * resolved telemetry properties for callers that need their schemas.\n */\nexport function validateTelemetryProjectionFieldMapping(\n projection: TelemetryProjectionDefinition,\n objectType: { readonly id: string; readonly properties: readonly Property[] },\n datasetColumnNames: ReadonlySet<string>,\n valueTypesById: ReadonlyMap<string, ValueType>,\n prefix: string\n): ReadonlyMap<string, Property> {\n const mappedProperties = Object.entries(projection.properties)\n if (mappedProperties.length === 0) {\n throw new ProjectionValidationError(`${prefix}: must map at least one telemetry property`)\n }\n\n const mappedFields = [\n [\"objectId\", projection.objectIdField],\n [\"at\", projection.atField],\n ] as const\n for (const [fieldRole, columnName] of mappedFields) {\n if (!datasetColumnNames.has(columnName)) {\n throw new ProjectionValidationError(\n `${prefix}: ${fieldRole} field \"${columnName}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n }\n\n const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]))\n const resolvedProperties = new Map<string, Property>()\n for (const [propertyId, mapping] of mappedProperties) {\n const property = propertiesById.get(propertyId)\n if (!property) {\n throw new ProjectionValidationError(\n `${prefix}: unknown property \"${propertyId}\" on type \"${projection.objectTypeId}\"`\n )\n }\n if (property.mode !== \"telemetry\") {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propertyId}\" on type \"${projection.objectTypeId}\" must be telemetry-enabled`\n )\n }\n\n for (const [fieldRole, columnName] of [\n [\"value\", mapping.valueField],\n ...(mapping.unitField !== undefined ? ([[\"unit\", mapping.unitField]] as const) : []),\n ] as const) {\n if (!datasetColumnNames.has(columnName)) {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propertyId}\" ${fieldRole} field \"${columnName}\" references ` +\n `unknown dataset column on dataset \"${projection.datasetId}\"`\n )\n }\n }\n\n const semanticType = resolveSemanticType(property, valueTypesById)\n if (semanticType !== undefined && mapping.unitField === undefined) {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propertyId}\" requires a unit field because it uses semantic type \"${semanticType}\"`\n )\n }\n if (semanticType === undefined && mapping.unitField !== undefined) {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propertyId}\" cannot map a unit field because it has no semantic type`\n )\n }\n\n resolvedProperties.set(propertyId, property)\n }\n\n return resolvedProperties\n}\n\n/**\n * Validates all registered projections against the ontology at startup.\n *\n * For object projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. `objectTypeId` exists in the type registry.\n * 3. All property mapping keys are valid property ids on the type.\n * 4. All mapped dataset columns exist in the referenced dataset.\n * 5. The primary property is included in the property mapping.\n * 6. FK link descriptors reference valid links, valid source properties (present in mapping),\n * and valid target types with primaries.\n *\n * For link projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. Source and target types exist.\n * 3. The link exists on the source type.\n * 4. Source and target fields exist in the referenced dataset.\n * 5. Both source and target types have primary properties.\n *\n * For telemetry projections:\n * 1. `datasetId` exists in the dataset registry.\n * 2. `objectTypeId` exists in the type registry.\n * 3. Every mapped property exists on the object type and is telemetry-enabled.\n * 4. Point mapping fields exist in the referenced dataset.\n * 5. Unit mappings match each property's semantic type requirements.\n */\nexport interface ValidatedProjectionRecord<TDefinition extends ProjectionDefinition>\n extends ProjectionOwnershipRecord<TDefinition> {\n readonly dataset: DatasetDefinition\n}\n\nexport interface ProjectionValidationInput {\n readonly objectProjections: readonly ObjectProjectionDefinition[]\n readonly linkProjections: readonly LinkProjectionDefinition[]\n readonly telemetryProjections: readonly TelemetryProjectionDefinition[]\n}\n\nexport interface ValidatedProjectionCatalog {\n readonly objectProjections: readonly ValidatedProjectionRecord<ObjectProjectionDefinition>[]\n readonly linkProjections: readonly ValidatedProjectionRecord<LinkProjectionDefinition>[]\n readonly telemetryProjections: readonly ValidatedProjectionRecord<TelemetryProjectionDefinition>[]\n}\n\nexport function validateProjectionsAtStartup(\n projections: ProjectionValidationInput,\n ontology: OntologyDefinitionCatalog,\n datasetsById: ReadonlyMap<string, DatasetDefinition>\n): ValidatedProjectionCatalog {\n const { objectProjections, linkProjections, telemetryProjections } = projections\n const objectTypesById = ontology.getObjectTypesById()\n const primaryByTypeId = ontology.getPrimaryByTypeId()\n const validatedObjectProjections: ValidatedProjectionRecord<ObjectProjectionDefinition>[] = []\n const validatedLinkProjections: ValidatedProjectionRecord<LinkProjectionDefinition>[] = []\n const validatedTelemetryProjections: ValidatedProjectionRecord<TelemetryProjectionDefinition>[] =\n []\n\n validateMaterializationOntologyConstraints(ontology)\n\n for (const projection of objectProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n const objectType = objectTypesById.get(projection.objectTypeId)\n if (!objectType) {\n throw new ProjectionValidationError(\n `${prefix}: unknown object type \"${projection.objectTypeId}\"`\n )\n }\n\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n const conflictResolution = projection.conflictResolution ?? { strategy: \"editsWin\" }\n if (conflictResolution.strategy === \"mostRecent\") {\n const sourceTimestamp = dataset.schema.columns.find(\n (column) => column.name === conflictResolution.sourceTimestamp\n )\n if (!sourceTimestamp) {\n throw new ProjectionValidationError(\n `${prefix}: source timestamp \"${conflictResolution.sourceTimestamp}\" references unknown ` +\n `dataset column on dataset \"${projection.datasetId}\"`\n )\n }\n if (sourceTimestamp.type !== \"timestamp\") {\n throw new ProjectionValidationError(\n `${prefix}: source timestamp \"${conflictResolution.sourceTimestamp}\" must reference a ` +\n `timestamp dataset column`\n )\n }\n if (sourceTimestamp.nullable === true) {\n throw new ProjectionValidationError(\n `${prefix}: source timestamp \"${conflictResolution.sourceTimestamp}\" must reference a ` +\n `non-null timestamp dataset column`\n )\n }\n }\n const propertyIds = new Set(objectType.properties.map((p) => p.id))\n for (const [propId, columnName] of Object.entries(projection.properties)) {\n if (!propertyIds.has(propId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown property \"${propId}\" on type \"${projection.objectTypeId}\"`\n )\n }\n if (!datasetColumnNames.has(columnName)) {\n throw new ProjectionValidationError(\n `${prefix}: property \"${propId}\" references unknown dataset column \"${columnName}\" ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n const property = objectType.properties.find((candidate) => candidate.id === propId)\n if (property?.mode === \"telemetry\") {\n throw new ProjectionValidationError(\n `[Sixb] ${prefix}: source mappings cannot own telemetry property \"${projection.objectTypeId}.${propId}\"`\n )\n }\n }\n\n const primaryId = primaryByTypeId.get(projection.objectTypeId)!\n if (!(primaryId in projection.properties)) {\n throw new ProjectionValidationError(\n `${prefix}: primary property \"${primaryId}\" must be in property mapping`\n )\n }\n\n const linkIds = new Set(objectType.links.map((l) => l.id))\n for (const [linkId, fk] of Object.entries(projection.links)) {\n if (!linkIds.has(linkId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" references unknown link on type \"${projection.objectTypeId}\"`\n )\n }\n if (fk.linkId !== linkId) {\n throw new ProjectionValidationError(\n `${prefix}: FK link mapping key \"${linkId}\" does not match descriptor linkId \"${fk.linkId}\"`\n )\n }\n const sourcePropertyId = fk.sourcePropertyId\n const sourceField = fk.sourceField\n if (sourcePropertyId && sourceField) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" must use either sourcePropertyId or sourceField, not both`\n )\n }\n if (!sourcePropertyId && !sourceField) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" must declare sourcePropertyId or sourceField`\n )\n }\n if (sourcePropertyId && !propertyIds.has(sourcePropertyId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source property \"${sourcePropertyId}\" does not exist on type \"${projection.objectTypeId}\"`\n )\n }\n if (sourcePropertyId && !(sourcePropertyId in projection.properties)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source property \"${sourcePropertyId}\" must be in property mapping`\n )\n }\n if (sourceField && !datasetColumnNames.has(sourceField)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" source field \"${sourceField}\" references unknown dataset column on dataset \"${projection.datasetId}\"`\n )\n }\n if (!objectTypesById.has(fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" is unknown`\n )\n }\n if (!primaryByTypeId.has(fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" has no primary property`\n )\n }\n const link = objectType.links.find((candidate) => candidate.id === linkId)!\n if (!ontology.isValidLinkTarget(link.targetObjectTypeId, fk.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: FK link \"${linkId}\" target type \"${fk.targetObjectTypeId}\" is not compatible with its declared target`\n )\n }\n }\n\n validatedObjectProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n for (const projection of linkProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n if (!objectTypesById.has(projection.sourceObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown source type \"${projection.sourceObjectTypeId}\"`\n )\n }\n if (!objectTypesById.has(projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: unknown target type \"${projection.targetObjectTypeId}\"`\n )\n }\n const sourceType = objectTypesById.get(projection.sourceObjectTypeId)!\n const link = sourceType.links.find((candidate) => candidate.id === projection.linkId)\n if (!link) {\n throw new ProjectionValidationError(\n `${prefix}: link \"${projection.linkId}\" does not exist on source type \"${projection.sourceObjectTypeId}\"`\n )\n }\n if (!ontology.isValidLinkTarget(link.targetObjectTypeId, projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: target type \"${projection.targetObjectTypeId}\" is not compatible with link \"${projection.linkId}\"`\n )\n }\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n if (!datasetColumnNames.has(projection.sourceField)) {\n throw new ProjectionValidationError(\n `${prefix}: source field \"${projection.sourceField}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n if (!datasetColumnNames.has(projection.targetField)) {\n throw new ProjectionValidationError(\n `${prefix}: target field \"${projection.targetField}\" references unknown dataset column ` +\n `on dataset \"${projection.datasetId}\"`\n )\n }\n if (!primaryByTypeId.has(projection.sourceObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: source type \"${projection.sourceObjectTypeId}\" has no primary property`\n )\n }\n if (!primaryByTypeId.has(projection.targetObjectTypeId)) {\n throw new ProjectionValidationError(\n `${prefix}: target type \"${projection.targetObjectTypeId}\" has no primary property`\n )\n }\n\n validatedLinkProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n for (const projection of telemetryProjections) {\n const prefix = `Projection \"${projection.id}\"`\n const dataset = datasetsById.get(projection.datasetId)\n if (!dataset) {\n throw new ProjectionValidationError(\n `${prefix}: unknown dataset \"${projection.datasetId}\". ` +\n `Add it to 'datasets' in createSixb() or export it from 'datasets/'.`\n )\n }\n\n const objectType = objectTypesById.get(projection.objectTypeId)\n if (!objectType) {\n throw new ProjectionValidationError(\n `${prefix}: unknown object type \"${projection.objectTypeId}\"`\n )\n }\n\n const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name))\n validateTelemetryProjectionFieldMapping(\n projection,\n objectType,\n datasetColumnNames,\n ontology.getValueTypesById(),\n prefix\n )\n validatedTelemetryProjections.push({\n definition: projection,\n dataset,\n ownership: computeProjectionOwnership(projection, ontology),\n })\n }\n\n const validatedProjections = [\n ...validatedObjectProjections,\n ...validatedLinkProjections,\n ...validatedTelemetryProjections,\n ]\n validateProjectionOwnership(validatedProjections)\n return {\n objectProjections: validatedObjectProjections,\n linkProjections: validatedLinkProjections,\n telemetryProjections: validatedTelemetryProjections,\n }\n}\n\nfunction validateMaterializationOntologyConstraints(ontology: OntologyDefinitionCatalog): void {\n for (const objectType of ontology.getObjectTypesById().values()) {\n for (const property of objectType.properties) {\n if (property.mode === \"telemetry\" && property.required === true) {\n throw new ProjectionValidationError(\n `[Sixb] Telemetry property '${objectType.id}.${property.id}' cannot be required.`\n )\n }\n }\n for (const link of objectType.links) {\n for (const property of link.properties ?? []) {\n if (property.mode === \"telemetry\") {\n throw new ProjectionValidationError(\n `[Sixb] Link property '${objectType.id}.${link.id}.${property.id}' cannot use telemetry mode.`\n )\n }\n }\n }\n }\n}\n",
18
- "/**\n * Projection DSL builders, helpers, and type guards.\n *\n * Uses the same fluent builder style as the other definition APIs.\n */\n\nimport type {\n DatasetColumnDefinitionOf,\n DatasetColumnNameOf,\n DatasetColumnType,\n DatasetColumnTypeOf,\n DatasetDefinition,\n} from \"../datasets\"\nimport type { LinkToken, PropertyToken } from \"../ontology/tokens\"\nimport type { ObjectLink, ObjectType, Property, Schema } from \"../ontology/types\"\nimport { ProjectionValidationError } from \"./errors\"\nimport type {\n ForeignKeyDescriptor,\n LinkProjectionDefinition,\n LinkProjectionTarget,\n ObjectProjectionDefinition,\n ObjectProjectionTarget,\n ProjectionDefinition,\n ProjectionTarget,\n SourceEditConflictResolution,\n TelemetryProjectionDefinition,\n TelemetryProjectionPropertyMapping,\n} from \"./types\"\nimport {\n validateAndLowerLinkMapping,\n validateLinkProjectionTarget,\n validatePropertyMapping,\n} from \"./validation\"\n\n// ── Internal helpers ─────────────────────────────────────────\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new ProjectionValidationError(`Projection ${field} must not be empty.`)\n }\n}\n\nfunction assertProjectionDataset(dataset: DatasetDefinition): void {\n if (!dataset || dataset.kind !== \"dataset\" || typeof dataset.id !== \"string\") {\n throw new ProjectionValidationError(\"Projection dataset must be a dataset definition.\")\n }\n assertNonEmpty(dataset.id, \"dataset id\")\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\n// ── Type utilities ───────────────────────────────────────────\n\n/** Union of property ids from an ObjectType. */\ntype PropertyIdOf<T extends ObjectType> = T[\"properties\"][number][\"id\"]\n\n/** Property definition by id from an ObjectType. */\ntype PropertyById<T extends ObjectType, TPropertyId extends PropertyIdOf<T>> = Extract<\n T[\"properties\"][number],\n { id: TPropertyId }\n>\n\n/** Union of link ids from an ObjectType. */\ntype LinkIdOf<T extends ObjectType> = T[\"links\"][number][\"id\"]\n\ntype LinkById<T extends ObjectType, TLinkId extends LinkIdOf<T>> = Extract<\n T[\"links\"][number],\n { id: TLinkId }\n>\n\ntype SingleTargetIdOf<TLink extends ObjectLink> = TLink[\"targetObjectTypeId\"] extends string\n ? TLink[\"targetObjectTypeId\"]\n : never\n\ntype ResolvedProjectionSchema<TSchema extends Schema> = TSchema extends {\n type: \"valueTypeRef\"\n _resolved: infer TResolved extends Schema\n}\n ? ResolvedProjectionSchema<TResolved>\n : TSchema extends { type: \"valueTypeRef\" }\n ? never\n : TSchema\n\ntype StringCompatibleProjectionSchema =\n | \"string\"\n | \"uuid\"\n | { type: \"enum\"; values: readonly string[] }\n\ntype IntegerCompatibleProjectionSchema =\n | \"integer\"\n | \"double\"\n | \"decimal\"\n | { type: \"enum\"; values: readonly number[] }\n\ntype JsonCompatibleProjectionSchema = { type: \"object\" | \"array\" | \"map\" | \"enum\" }\n\ntype ProjectionSchemaByDatasetColumnType = {\n readonly string: StringCompatibleProjectionSchema\n readonly boolean: \"boolean\"\n readonly int64: IntegerCompatibleProjectionSchema\n readonly float64: \"double\"\n readonly decimal: \"decimal\" | \"double\"\n readonly date: \"date\"\n readonly timestamp: \"timestamp\"\n readonly json: JsonCompatibleProjectionSchema\n readonly fileRef: \"fileRef\"\n}\n\ntype DatasetColumnCompatibleWithSchema<\n TColumnType extends DatasetColumnType,\n TSchema extends Schema,\n> = [ResolvedProjectionSchema<TSchema>] extends [never]\n ? false\n : ResolvedProjectionSchema<TSchema> extends ProjectionSchemaByDatasetColumnType[TColumnType]\n ? true\n : false\n\ntype DatasetColumnNameCompatibleWithSchema<\n TDataset extends DatasetDefinition,\n TSchema extends Schema,\n> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnCompatibleWithSchema<\n DatasetColumnTypeOf<TDataset, TColumnName>,\n TSchema\n > extends true\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype StringDatasetColumnNameOf<TDataset extends DatasetDefinition> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnTypeOf<\n TDataset,\n TColumnName\n > extends \"string\"\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype DateLikeDatasetColumnNameOf<TDataset extends DatasetDefinition> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnTypeOf<\n TDataset,\n TColumnName\n > extends \"string\" | \"date\" | \"timestamp\"\n ? TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype TimestampDatasetColumnNameOf<TDataset extends DatasetDefinition> =\n string extends DatasetColumnNameOf<TDataset>\n ? string\n : {\n [TColumnName in DatasetColumnNameOf<TDataset>]: DatasetColumnTypeOf<\n TDataset,\n TColumnName\n > extends \"timestamp\"\n ? DatasetColumnDefinitionOf<TDataset, TColumnName> extends { readonly nullable: true }\n ? never\n : TColumnName\n : never\n }[DatasetColumnNameOf<TDataset>]\n\ntype ProjectionMappingFor<TObjectType extends ObjectType, TDataset extends DatasetDefinition> = {\n readonly [TPropertyId in PropertyIdOf<TObjectType>]?: DatasetColumnNameCompatibleWithSchema<\n TDataset,\n PropertyById<TObjectType, TPropertyId>[\"schema\"]\n >\n}\n\ntype ExactProjectionMapping<TObjectType extends ObjectType, TMapping> = TMapping & {\n readonly [TKey in Exclude<keyof TMapping, PropertyIdOf<TObjectType>>]: never\n}\n\ntype TelemetryPropertyToken<TObjectTypeId extends string = string> = PropertyToken<\n TObjectTypeId,\n string,\n Property & { readonly mode: \"telemetry\" }\n>\n\ntype TelemetryPropertyOf<TObjectType extends ObjectType> = Extract<\n TObjectType[\"properties\"][number],\n { readonly mode: \"telemetry\" }\n>\n\ntype TelemetryPropertyIdOf<TObjectType extends ObjectType> = TelemetryPropertyOf<TObjectType>[\"id\"]\n\ntype TelemetryPropertyById<\n TObjectType extends ObjectType,\n TPropertyId extends TelemetryPropertyIdOf<TObjectType>,\n> = Extract<TelemetryPropertyOf<TObjectType>, { readonly id: TPropertyId }>\n\ntype TelemetryProjectionPointMapping<\n TPropertyToken extends TelemetryPropertyToken,\n TDataset extends DatasetDefinition,\n> = {\n readonly objectId: StringDatasetColumnNameOf<TDataset>\n readonly at: DateLikeDatasetColumnNameOf<TDataset>\n readonly value: DatasetColumnNameCompatibleWithSchema<\n TDataset,\n TPropertyToken[\"property\"][\"schema\"]\n >\n readonly unit?: StringDatasetColumnNameOf<TDataset>\n}\n\ntype ExactTelemetryProjectionPointMapping<TMapping> = TMapping & {\n readonly [TKey in Exclude<keyof TMapping, \"objectId\" | \"at\" | \"value\" | \"unit\">]: never\n}\n\ntype TelemetryProjectionPropertyInput<\n TProperty extends Property,\n TDataset extends DatasetDefinition,\n> =\n | DatasetColumnNameCompatibleWithSchema<TDataset, TProperty[\"schema\"]>\n | {\n readonly value: DatasetColumnNameCompatibleWithSchema<TDataset, TProperty[\"schema\"]>\n readonly unit: StringDatasetColumnNameOf<TDataset>\n }\n\ntype TelemetryProjectionPropertiesMapping<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n> = {\n readonly [TPropertyId in TelemetryPropertyIdOf<TObjectType>]?: TelemetryProjectionPropertyInput<\n TelemetryPropertyById<TObjectType, TPropertyId>,\n TDataset\n >\n}\n\ntype ExactTelemetryProjectionPropertiesMapping<\n TObjectType extends ObjectType,\n TMapping,\n> = TMapping & {\n readonly [TKey in Exclude<keyof TMapping, TelemetryPropertyIdOf<TObjectType>>]: never\n}\n\ntype ExactTelemetryProjectionPropertyInputs<TMapping> = {\n readonly [TPropertyId in keyof TMapping]: TMapping[TPropertyId] extends object\n ? TMapping[TPropertyId] & {\n readonly [TKey in Exclude<keyof TMapping[TPropertyId], \"value\" | \"unit\">]: never\n }\n : TMapping[TPropertyId]\n}\n\ntype NonEmptyTelemetryProjectionProperties<TMapping> = keyof TMapping extends never\n ? never\n : TMapping\n\ntype TelemetryProjectionPropertiesPointMapping<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n TProperties,\n> = {\n readonly objectId: StringDatasetColumnNameOf<TDataset>\n readonly at: DateLikeDatasetColumnNameOf<TDataset>\n readonly properties: NonEmptyTelemetryProjectionProperties<\n ExactTelemetryProjectionPropertiesMapping<TObjectType, TProperties> &\n ExactTelemetryProjectionPropertyInputs<TProperties>\n >\n}\n\ntype ForeignKeyFromSourceProperty = Omit<\n ForeignKeyDescriptor,\n \"sourcePropertyId\" | \"sourceField\"\n> & {\n readonly sourcePropertyId: string\n readonly sourceField?: never\n}\n\ntype ForeignKeyFromSourceField<TSourceField extends string = string> = Omit<\n ForeignKeyDescriptor,\n \"sourcePropertyId\" | \"sourceField\"\n> & {\n readonly sourcePropertyId?: never\n readonly sourceField: TSourceField\n}\n\ntype ProjectionForeignKeyDescriptor<TDataset extends DatasetDefinition> =\n | ForeignKeyFromSourceProperty\n | ForeignKeyFromSourceField<StringDatasetColumnNameOf<TDataset>>\n\ntype ProjectionForeignKeyTokenInput<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n TLinkId extends LinkIdOf<TObjectType>,\n> =\n | {\n readonly link: LinkToken<\n TObjectType[\"id\"],\n TLinkId,\n SingleTargetIdOf<LinkById<TObjectType, TLinkId>>\n >\n readonly sourceProperty: PropertyToken<TObjectType[\"id\"]>\n readonly target: ObjectType &\n (\n | { id: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n | { extends: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n )\n }\n | {\n readonly link: LinkToken<\n TObjectType[\"id\"],\n TLinkId,\n SingleTargetIdOf<LinkById<TObjectType, TLinkId>>\n >\n readonly sourceField: StringDatasetColumnNameOf<TDataset>\n readonly target: ObjectType &\n (\n | { id: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n | { extends: NoInfer<SingleTargetIdOf<LinkById<TObjectType, TLinkId>>> }\n )\n }\n\nexport type ProjectionForeignKeyInput<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n TLinkId extends LinkIdOf<TObjectType>,\n> =\n | ProjectionForeignKeyDescriptor<TDataset>\n | ProjectionForeignKeyTokenInput<TObjectType, TDataset, TLinkId>\n\nfunction lowerForeignKeyMapping<TObjectType extends ObjectType, TDataset extends DatasetDefinition>(\n mapping: {\n [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K>\n }\n): Record<string, ForeignKeyDescriptor> {\n const lowered: Record<string, ForeignKeyDescriptor> = {}\n for (const [linkId, descriptor] of Object.entries(mapping)) {\n if (!descriptor) continue\n lowered[linkId] = isForeignKeyDescriptor(descriptor)\n ? descriptor\n : fromForeignKey(descriptor as Parameters<typeof fromForeignKey>[0])\n }\n return lowered\n}\n\nfunction isForeignKeyDescriptor(value: unknown): value is ForeignKeyDescriptor {\n return isRecord(value) && typeof value.linkId === \"string\"\n}\n\n// ── defineProjection ─────────────────────────────────────────\n\ninterface ObjectTypeProjectionSourceBuilder<TObjectType extends ObjectType> {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): ObjectTypeProjectionDatasetBuilder<TObjectType, TDataset>\n}\n\ninterface ObjectTypeProjectionDatasetBuilder<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n> {\n properties<const TMapping extends ProjectionMappingFor<TObjectType, TDataset>>(\n mapping: ExactProjectionMapping<TObjectType, TMapping>\n ): ObjectProjectionBuilder<TObjectType, TDataset>\n points<const TProperties extends TelemetryProjectionPropertiesMapping<TObjectType, TDataset>>(\n mapping: TelemetryProjectionPropertiesPointMapping<TObjectType, TDataset, TProperties>\n ): TelemetryProjectionDefinition\n}\n\nexport type ObjectProjectionConflictResolution<TDataset extends DatasetDefinition> =\n | { readonly strategy: \"editsWin\" }\n | {\n readonly strategy: \"mostRecent\"\n readonly sourceTimestamp: TimestampDatasetColumnNameOf<TDataset>\n }\n\nexport interface ObjectProjectionBuilder<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n> extends ObjectProjectionDefinition {\n readonly conflictResolution: SourceEditConflictResolution\n withLinks(\n mapping: { [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K> }\n ): ObjectProjectionBuilder<TObjectType, TDataset>\n resolveConflicts(\n resolution: ObjectProjectionConflictResolution<TDataset>\n ): ObjectProjectionBuilder<TObjectType, TDataset>\n}\n\n/**\n * Defines an object, link, or telemetry projection from its ontology target.\n *\n * ```ts\n * defineProjection(\"room-projection\", Room)\n * .fromDataset(canonicalRoomsDataset)\n * .properties({ id: \"room_id\", name: \"room_name\" })\n * .withLinks({\n * inBuilding: {\n * link: Room.l.inBuilding,\n * sourceField: \"building_id\",\n * target: Building,\n * },\n * })\n * ```\n */\nexport function defineProjection<const TObjectType extends ObjectType>(\n id: string,\n objectType: TObjectType\n): ObjectTypeProjectionSourceBuilder<TObjectType>\nexport function defineProjection<\n TObjectTypeId extends string,\n TLinkId extends string,\n TTargetObjectTypeId extends string,\n>(\n id: string,\n linkToken: LinkToken<TObjectTypeId, TLinkId, TTargetObjectTypeId>\n): LinkProjectionSourceBuilder\nexport function defineProjection<const TPropertyToken extends TelemetryPropertyToken>(\n id: string,\n propertyToken: TPropertyToken\n): TelemetryProjectionSourceBuilder<TPropertyToken>\nexport function defineProjection(\n id: string,\n target: ObjectType | LinkToken<string, string, string> | TelemetryPropertyToken\n):\n | ObjectTypeProjectionSourceBuilder<ObjectType>\n | LinkProjectionSourceBuilder\n | TelemetryProjectionSourceBuilder<TelemetryPropertyToken> {\n if (\"link\" in target) return buildLinkProjection(id, target)\n if (\"property\" in target) return buildTelemetryProjection(id, target)\n return buildObjectTypeProjection(id, target)\n}\n\nfunction buildObjectTypeProjection<const TObjectType extends ObjectType>(\n id: string,\n objectType: TObjectType\n): ObjectTypeProjectionSourceBuilder<TObjectType> {\n assertNonEmpty(id, \"id\")\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): ObjectTypeProjectionDatasetBuilder<TObjectType, TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n properties<const TMapping extends ProjectionMappingFor<TObjectType, TDataset>>(\n mapping: ExactProjectionMapping<TObjectType, TMapping>\n ): ObjectProjectionBuilder<TObjectType, TDataset> {\n const propertyMapping = mapping as Record<string, string>\n validatePropertyMapping(objectType, propertyMapping)\n\n return objectProjectionBuilder({\n id,\n objectType,\n datasetId,\n propertyMapping,\n links: {},\n conflictResolution: { strategy: \"editsWin\" },\n })\n },\n points<\n const TProperties extends TelemetryProjectionPropertiesMapping<TObjectType, TDataset>,\n >(\n mapping: TelemetryProjectionPropertiesPointMapping<TObjectType, TDataset, TProperties>\n ): TelemetryProjectionDefinition {\n const pointMapping = lowerTelemetryPropertiesPointMapping(\n objectType,\n mapping as {\n readonly objectId?: string\n readonly at?: string\n readonly properties?: Readonly<Record<string, unknown>>\n }\n )\n return {\n _tag: \"TelemetryProjectionDefinition\",\n id,\n objectTypeId: objectType.id,\n datasetId,\n objectIdField: pointMapping.objectId,\n atField: pointMapping.at,\n properties: pointMapping.properties,\n }\n },\n }\n },\n }\n}\n\nfunction objectProjectionBuilder<\n TObjectType extends ObjectType,\n TDataset extends DatasetDefinition,\n>(input: {\n readonly id: string\n readonly objectType: TObjectType\n readonly datasetId: string\n readonly propertyMapping: Readonly<Record<string, string>>\n readonly links: Readonly<Record<string, ForeignKeyDescriptor>>\n readonly conflictResolution: SourceEditConflictResolution\n}): ObjectProjectionBuilder<TObjectType, TDataset> {\n const definition: ObjectProjectionDefinition & {\n readonly conflictResolution: SourceEditConflictResolution\n } = {\n _tag: \"ObjectProjectionDefinition\",\n id: input.id,\n objectTypeId: input.objectType.id,\n datasetId: input.datasetId,\n properties: { ...input.propertyMapping },\n links: { ...input.links },\n conflictResolution: { ...input.conflictResolution },\n }\n\n return Object.assign(definition, {\n withLinks(\n linkMapping: {\n [K in LinkIdOf<TObjectType>]?: ProjectionForeignKeyInput<TObjectType, TDataset, K>\n }\n ): ObjectProjectionBuilder<TObjectType, TDataset> {\n const loweredLinkMapping = lowerForeignKeyMapping(linkMapping)\n const validatedLinks = validateAndLowerLinkMapping(\n input.objectType,\n loweredLinkMapping,\n input.propertyMapping as Record<string, string>\n )\n return objectProjectionBuilder({ ...input, links: validatedLinks })\n },\n resolveConflicts(\n resolution: ObjectProjectionConflictResolution<TDataset>\n ): ObjectProjectionBuilder<TObjectType, TDataset> {\n validateConflictResolution(resolution)\n return objectProjectionBuilder({\n ...input,\n conflictResolution: resolution as SourceEditConflictResolution,\n })\n },\n })\n}\n\nfunction validateConflictResolution(resolution: SourceEditConflictResolution): void {\n if (resolution.strategy === \"editsWin\") return\n assertNonEmpty(resolution.sourceTimestamp, \"source timestamp field\")\n}\n\n// ── Telemetry projection ────────────────────────────────────\n\ninterface TelemetryProjectionSourceBuilder<TPropertyToken extends TelemetryPropertyToken> {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): TelemetryProjectionMappingBuilder<TPropertyToken, TDataset>\n}\n\ninterface TelemetryProjectionMappingBuilder<\n TPropertyToken extends TelemetryPropertyToken,\n TDataset extends DatasetDefinition,\n> {\n points<const TMapping extends TelemetryProjectionPointMapping<TPropertyToken, TDataset>>(\n mapping: ExactTelemetryProjectionPointMapping<TMapping>\n ): TelemetryProjectionDefinition\n}\n\n/**\n * Fluent builder for {@link TelemetryProjectionDefinition}.\n *\n * ```ts\n * defineProjection(\"room-temperatures\", Room.p.temperature)\n * .fromDataset(roomReadingsDataset)\n * .points({\n * objectId: \"room_id\",\n * at: \"observed_at\",\n * value: \"temperature\",\n * unit: \"unit\",\n * })\n * ```\n */\nfunction buildTelemetryProjection<const TPropertyToken extends TelemetryPropertyToken>(\n id: string,\n propertyToken: TPropertyToken\n): TelemetryProjectionSourceBuilder<TPropertyToken> {\n assertNonEmpty(id, \"id\")\n validateTelemetryProjectionProperty(propertyToken)\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): TelemetryProjectionMappingBuilder<TPropertyToken, TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n points<const TMapping extends TelemetryProjectionPointMapping<TPropertyToken, TDataset>>(\n mapping: ExactTelemetryProjectionPointMapping<TMapping>\n ): TelemetryProjectionDefinition {\n const pointMapping = lowerTelemetryPointMapping(mapping)\n return {\n _tag: \"TelemetryProjectionDefinition\",\n id,\n objectTypeId: propertyToken.objectTypeId,\n datasetId,\n objectIdField: pointMapping.objectId,\n atField: pointMapping.at,\n properties: {\n [propertyToken.id]: {\n valueField: pointMapping.value,\n ...(pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}),\n },\n },\n }\n },\n }\n },\n }\n}\n\nfunction validateTelemetryProjectionProperty(propertyToken: PropertyToken): void {\n if (propertyToken.property.mode !== \"telemetry\") {\n throw new ProjectionValidationError(\n `Projection property '${propertyToken.objectTypeId}.${propertyToken.id}' must be telemetry-enabled.`\n )\n }\n}\n\nfunction lowerTelemetryPointMapping(mapping: {\n readonly objectId?: string\n readonly at?: string\n readonly value?: string\n readonly unit?: string\n}): {\n readonly objectId: string\n readonly at: string\n readonly value: string\n readonly unit?: string\n} {\n const allowedKeys = new Set([\"objectId\", \"at\", \"value\", \"unit\"])\n for (const key of Object.keys(mapping)) {\n if (!allowedKeys.has(key)) {\n throw new ProjectionValidationError(\n `Telemetry projection point mapping contains unknown key '${key}'.`\n )\n }\n }\n\n if (mapping.objectId === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires objectId.\")\n }\n if (mapping.at === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires at.\")\n }\n if (mapping.value === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires value.\")\n }\n\n assertNonEmpty(mapping.objectId, \"objectId field\")\n assertNonEmpty(mapping.at, \"at field\")\n assertNonEmpty(mapping.value, \"value field\")\n if (mapping.unit !== undefined) {\n assertNonEmpty(mapping.unit, \"unit field\")\n }\n\n return {\n objectId: mapping.objectId,\n at: mapping.at,\n value: mapping.value,\n ...(mapping.unit !== undefined ? { unit: mapping.unit } : {}),\n }\n}\n\nfunction lowerTelemetryPropertiesPointMapping(\n objectType: ObjectType,\n mapping: {\n readonly objectId?: string\n readonly at?: string\n readonly properties?: Readonly<Record<string, unknown>>\n }\n): {\n readonly objectId: string\n readonly at: string\n readonly properties: Readonly<Record<string, TelemetryProjectionPropertyMapping>>\n} {\n const allowedKeys = new Set([\"objectId\", \"at\", \"properties\"])\n for (const key of Object.keys(mapping)) {\n if (!allowedKeys.has(key)) {\n throw new ProjectionValidationError(\n `Telemetry projection point mapping contains unknown key '${key}'.`\n )\n }\n }\n\n if (mapping.objectId === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires objectId.\")\n }\n if (mapping.at === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires at.\")\n }\n if (mapping.properties === undefined) {\n throw new ProjectionValidationError(\"Telemetry projection point mapping requires properties.\")\n }\n if (!isRecord(mapping.properties)) {\n throw new ProjectionValidationError(\n \"Telemetry projection point mapping properties must be an object.\"\n )\n }\n\n assertNonEmpty(mapping.objectId, \"objectId field\")\n assertNonEmpty(mapping.at, \"at field\")\n\n const propertyEntries = Object.entries(mapping.properties)\n if (propertyEntries.length === 0) {\n throw new ProjectionValidationError(\n \"Telemetry projection point mapping requires at least one property.\"\n )\n }\n\n const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]))\n const properties: Record<string, TelemetryProjectionPropertyMapping> = {}\n for (const [propertyId, input] of propertyEntries) {\n const property = propertiesById.get(propertyId)\n if (!property) {\n throw new ProjectionValidationError(\n `Property '${propertyId}' does not exist on object type '${objectType.id}'.`\n )\n }\n if (property.mode !== \"telemetry\") {\n throw new ProjectionValidationError(\n `Projection property '${objectType.id}.${propertyId}' must be telemetry-enabled.`\n )\n }\n properties[propertyId] = lowerTelemetryPropertyMapping(propertyId, input)\n }\n\n return { objectId: mapping.objectId, at: mapping.at, properties }\n}\n\nfunction lowerTelemetryPropertyMapping(\n propertyId: string,\n input: unknown\n): TelemetryProjectionPropertyMapping {\n if (typeof input === \"string\") {\n assertNonEmpty(input, `property '${propertyId}' value field`)\n return { valueField: input }\n }\n if (!isRecord(input)) {\n throw new ProjectionValidationError(\n `Telemetry projection property '${propertyId}' must map a value column or value/unit columns.`\n )\n }\n\n const allowedKeys = new Set([\"value\", \"unit\"])\n for (const key of Object.keys(input)) {\n if (!allowedKeys.has(key)) {\n throw new ProjectionValidationError(\n `Telemetry projection property '${propertyId}' contains unknown key '${key}'.`\n )\n }\n }\n if (typeof input.value !== \"string\") {\n throw new ProjectionValidationError(\n `Telemetry projection property '${propertyId}' requires a value field.`\n )\n }\n if (typeof input.unit !== \"string\") {\n throw new ProjectionValidationError(\n `Telemetry projection property '${propertyId}' requires a unit field.`\n )\n }\n assertNonEmpty(input.value, `property '${propertyId}' value field`)\n assertNonEmpty(input.unit, `property '${propertyId}' unit field`)\n return { valueField: input.value, unitField: input.unit }\n}\n\n// ── fromForeignKey ───────────────────────────────────────────\n\n/**\n * Creates a {@link ForeignKeyDescriptor} from typed tokens.\n *\n * Compile-time constraints:\n * - `TObjectTypeId` ties `link` and `sourceProperty` to the same object type\n * when a projected source property is used.\n * - `TTargetObjectTypeId` (inferred from the link token) constrains `target`\n * to an ObjectType whose `id` or `extends` matches the link's declared target.\n * This covers exact type match and direct subtypes. Multi-level inheritance\n * is validated at Sixb startup when the full type graph is available.\n *\n * ```ts\n * fromForeignKey({\n * link: Room.l.inBuilding,\n * sourceProperty: Room.p.buildingRef,\n * target: Building,\n * })\n * ```\n */\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceProperty: PropertyToken<TObjectTypeId>\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyFromSourceProperty\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n const TSourceField extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceField: TSourceField\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyFromSourceField<TSourceField>\nexport function fromForeignKey<\n TObjectTypeId extends string,\n TTargetObjectTypeId extends string,\n>(input: {\n link: LinkToken<TObjectTypeId, string, TTargetObjectTypeId>\n sourceProperty?: PropertyToken<TObjectTypeId>\n sourceField?: string\n target: ObjectType &\n ({ id: NoInfer<TTargetObjectTypeId> } | { extends: NoInfer<TTargetObjectTypeId> })\n}): ForeignKeyDescriptor {\n validateLinkProjectionTarget(input.link)\n\n if (input.sourceProperty) {\n return {\n linkId: input.link.id,\n sourcePropertyId: input.sourceProperty.id,\n targetObjectTypeId: input.target.id,\n }\n }\n\n if (input.sourceField === undefined) {\n throw new ProjectionValidationError(\"Foreign key sourceField is required.\")\n }\n assertNonEmpty(input.sourceField, \"source field\")\n return {\n linkId: input.link.id,\n sourceField: input.sourceField,\n targetObjectTypeId: input.target.id,\n }\n}\n\n// ── Link projection ─────────────────────────────────────────\n\ninterface LinkProjectionSourceBuilder {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): LinkProjectionFieldBuilder<TDataset>\n}\n\ninterface LinkProjectionFieldBuilder<TDataset extends DatasetDefinition> {\n sourceField(\n columnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionTargetBuilder<TDataset>\n}\n\ninterface LinkProjectionTargetBuilder<TDataset extends DatasetDefinition> {\n targetField(columnName: StringDatasetColumnNameOf<TDataset>): LinkProjectionDefinition\n}\n\n/**\n * Fluent builder for {@link LinkProjectionDefinition} (many-to-many join datasets).\n *\n * ```ts\n * defineProjection(\"room-sensor-links\", Room.l.hasSensors)\n * .fromDataset(roomSensorsDataset)\n * .sourceField(\"room_id\")\n * .targetField(\"sensor_id\")\n * ```\n */\nfunction buildLinkProjection<\n TObjectTypeId extends string,\n TLinkId extends string,\n TTargetObjectTypeId extends string,\n>(\n id: string,\n linkToken: LinkToken<TObjectTypeId, TLinkId, TTargetObjectTypeId>\n): LinkProjectionSourceBuilder {\n assertNonEmpty(id, \"id\")\n validateLinkProjectionTarget(linkToken)\n\n return {\n fromDataset<const TDataset extends DatasetDefinition>(\n dataset: TDataset\n ): LinkProjectionFieldBuilder<TDataset> {\n assertProjectionDataset(dataset)\n const datasetId = dataset.id\n\n return {\n sourceField(\n columnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionTargetBuilder<TDataset> {\n assertNonEmpty(columnName, \"source field\")\n\n return {\n targetField(\n targetColumnName: StringDatasetColumnNameOf<TDataset>\n ): LinkProjectionDefinition {\n assertNonEmpty(targetColumnName, \"target field\")\n\n return {\n _tag: \"LinkProjectionDefinition\",\n id,\n linkId: linkToken.id,\n sourceObjectTypeId: linkToken.objectTypeId,\n targetObjectTypeId: linkToken.targetObjectTypeId as string,\n datasetId,\n sourceField: columnName,\n targetField: targetColumnName,\n }\n },\n }\n },\n }\n },\n }\n}\n\n// ── Type guards ──────────────────────────────────────────────\n\n/** Runtime type guard for {@link ObjectProjectionDefinition}. */\nexport function isObjectProjectionDefinition(value: unknown): value is ObjectProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"ObjectProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.objectTypeId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n isRecord(value.properties) &&\n isRecord(value.links) &&\n isSourceEditConflictResolution(value.conflictResolution)\n )\n}\n\nfunction isSourceEditConflictResolution(value: unknown): boolean {\n if (value === undefined) return true\n if (!isRecord(value) || typeof value.strategy !== \"string\") return false\n if (value.strategy === \"editsWin\") return value.sourceTimestamp === undefined\n return value.strategy === \"mostRecent\" && typeof value.sourceTimestamp === \"string\"\n}\n\n/** Runtime type guard for {@link LinkProjectionDefinition}. */\nexport function isLinkProjectionDefinition(value: unknown): value is LinkProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"LinkProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.linkId === \"string\" &&\n typeof value.sourceObjectTypeId === \"string\" &&\n typeof value.targetObjectTypeId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n typeof value.sourceField === \"string\" &&\n typeof value.targetField === \"string\"\n )\n}\n\n/** Runtime type guard for {@link TelemetryProjectionDefinition}. */\nexport function isTelemetryProjectionDefinition(\n value: unknown\n): value is TelemetryProjectionDefinition {\n if (!isRecord(value)) return false\n return (\n value._tag === \"TelemetryProjectionDefinition\" &&\n typeof value.id === \"string\" &&\n typeof value.objectTypeId === \"string\" &&\n typeof value.datasetId === \"string\" &&\n typeof value.objectIdField === \"string\" &&\n typeof value.atField === \"string\" &&\n isTelemetryProjectionProperties(value.properties)\n )\n}\n\nfunction isTelemetryProjectionProperties(value: unknown): boolean {\n if (!isRecord(value) || Object.keys(value).length === 0) return false\n return Object.values(value).every(\n (mapping) =>\n isRecord(mapping) &&\n typeof mapping.valueField === \"string\" &&\n (mapping.unitField === undefined || typeof mapping.unitField === \"string\")\n )\n}\n\n/** Runtime type guard for any {@link ProjectionDefinition}. */\nexport function isProjectionDefinition(value: unknown): value is ProjectionDefinition {\n return (\n isObjectProjectionDefinition(value) ||\n isLinkProjectionDefinition(value) ||\n isTelemetryProjectionDefinition(value)\n )\n}\n\n/**\n * Extracts the object type id(s) a projection targets, used to authorize run\n * visibility (`object.view`). Link projections require both ends; object and\n * telemetry projections target a single type.\n */\nexport function projectionTargetOf(projection: LinkProjectionDefinition): LinkProjectionTarget\nexport function projectionTargetOf(\n projection: ObjectProjectionDefinition | TelemetryProjectionDefinition\n): ObjectProjectionTarget\nexport function projectionTargetOf(projection: ProjectionDefinition): ProjectionTarget\nexport function projectionTargetOf(projection: ProjectionDefinition): ProjectionTarget {\n return projection._tag === \"LinkProjectionDefinition\"\n ? {\n sourceObjectTypeId: projection.sourceObjectTypeId,\n targetObjectTypeId: projection.targetObjectTypeId,\n }\n : { objectTypeId: projection.objectTypeId }\n}\n\n// ── Categorization ──────────────────────────────────────────\n\n/** Splits a mixed list of projection definitions into typed arrays by tag. */\nexport function categorizeProjections(projections: readonly ProjectionDefinition[]): {\n objectProjections: ObjectProjectionDefinition[]\n linkProjections: LinkProjectionDefinition[]\n telemetryProjections: TelemetryProjectionDefinition[]\n} {\n const objectProjections: ObjectProjectionDefinition[] = []\n const linkProjections: LinkProjectionDefinition[] = []\n const telemetryProjections: TelemetryProjectionDefinition[] = []\n for (const projection of projections) {\n if (isObjectProjectionDefinition(projection)) {\n objectProjections.push(projection)\n } else if (isLinkProjectionDefinition(projection)) {\n linkProjections.push(projection)\n } else if (isTelemetryProjectionDefinition(projection)) {\n telemetryProjections.push(projection)\n }\n }\n return { objectProjections, linkProjections, telemetryProjections }\n}\n",
19
- "import type { ProjectionDefinition, ProjectionTarget } from \"../projections\"\nimport { projectionTargetOf } from \"../projections/builders\"\nimport type { ActionRunRecord } from \"../storage/action-runs\"\nimport type { PipelineRunRecord } from \"../storage/pipeline-runs\"\nimport type { WorkflowInterventionRecord } from \"../storage/workflow-interventions\"\nimport type { WorkflowRunRecord } from \"../storage/workflow-runs\"\nimport { isAllowed } from \"./decision\"\nimport type { AuthorizationContext } from \"./types\"\n\nexport function canViewActionRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<ActionRunRecord, \"actionId\" | \"subject\">\n): boolean {\n if (!authorization) {\n return true\n }\n\n if (!isAllowed(authorization, { kind: \"action.apply\", actionId: run.actionId })) {\n return false\n }\n\n return run.subject.kind !== \"object\"\n ? true\n : isAllowed(authorization, {\n kind: \"object.view\",\n objectTypeId: run.subject.objectTypeId,\n })\n}\n\nexport function canViewWorkflowRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<WorkflowRunRecord, \"workflowId\">\n): boolean {\n return (\n !authorization || isAllowed(authorization, { kind: \"workflow.run\", workflowId: run.workflowId })\n )\n}\n\nexport function canViewWorkflowIntervention(\n authorization: AuthorizationContext | null | undefined,\n intervention: Pick<WorkflowInterventionRecord, \"workflowId\">\n): boolean {\n return (\n !authorization ||\n isAllowed(authorization, { kind: \"workflow.run\", workflowId: intervention.workflowId })\n )\n}\n\nexport function canViewPipelineRun(\n authorization: AuthorizationContext | null | undefined,\n run: Pick<PipelineRunRecord, \"pipelineId\">\n): boolean {\n return (\n !authorization || isAllowed(authorization, { kind: \"pipeline.run\", pipelineId: run.pipelineId })\n )\n}\n\n/** A projection run is viewable when its target object type(s) are viewable. */\nexport function canViewProjectionRun(\n authorization: AuthorizationContext | null | undefined,\n target: ProjectionTarget\n): boolean {\n if (!authorization) return true\n const canView = (objectTypeId: string) =>\n isAllowed(authorization, { kind: \"object.view\", objectTypeId })\n if (\"sourceObjectTypeId\" in target) {\n return canView(target.sourceObjectTypeId) && canView(target.targetObjectTypeId)\n }\n return canView(target.objectTypeId)\n}\n\n/** Whether a principal may see a projection definition (and its run history). */\nexport function canViewProjection(\n authorization: AuthorizationContext | null | undefined,\n projection: ProjectionDefinition\n): boolean {\n return canViewProjectionRun(authorization, projectionTargetOf(projection))\n}\n",
20
- "/**\n * Authorization context types.\n *\n * The context is plain, immutable data resolved once per request\n * (`principal -> groups -> roles -> grants`). Grants resolve eagerly into set\n * lookups so enforcement on the hot path is synchronous and allocation-free.\n * Group and role ids are retained so decisions stay explainable.\n */\n\nimport type { Principal } from \"../auth/types\"\nimport { emptyGrantSets, type GrantKind, type SingletonGrantKind } from \"./grant-kinds\"\n\n/**\n * Grants keyed by kind (`view:object`, `run:sync`, …). Resource selections resolve\n * to id sets; project-wide singleton capabilities resolve to booleans.\n * Broad grants and object subtypes are already expanded. Keyed by `GrantKind`\n * so a new grant family adds one key, not a new bucket every consumer must\n * learn.\n */\nexport type GrantIndex = Readonly<{\n [TKind in GrantKind]: TKind extends SingletonGrantKind ? boolean : ReadonlySet<string>\n}>\n\n/**\n * A grant index that grants nothing, as the base for a hand-built context — typically in tests.\n *\n * This is the read-only face of `emptyGrantSets()`, the mutable builder resolution fills in and which\n * stays internal. A factory rather than a shared constant, because the sets are only `ReadonlySet` to\n * the type system: one frozen instance would be aliased into every context that spreads it.\n *\n * Writing the literal by hand is what this avoids. `GrantIndex` is deliberately a total `Record` so\n * that `grants[kind].has(id)` cannot be misspelled into a silent `undefined` — with an optional index\n * every enforcement site would read `?.has(id) ?? false`, where a typo denies instead of failing to\n * compile. The cost of totality is that a literal breaks whenever a grant family is added.\n */\nexport function emptyGrantIndex(): GrantIndex {\n return emptyGrantSets()\n}\n\n/** A role with its grants pre-expanded to concrete id sets at startup. */\nexport interface ResolvedRole {\n readonly id: string\n readonly grantedToGroupIds: readonly string[]\n readonly grants: GrantIndex\n}\n\nexport interface AuthorizationContext {\n readonly principal: Principal\n readonly sessionId?: string\n readonly groupIds: readonly string[]\n /** Roles whose grantedTo groups intersect the principal's memberships. */\n readonly roleIds: readonly string[]\n readonly grants: GrantIndex\n}\n"
21
- ],
22
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;ACCO,SAAS,sBAAqB,CAAC,SAAyB;AAAA,EAC7D,OAAO,aAAa;AAAA;;;ACuEf,IAAM,cAIT;AAAA,EACF,sBAAsB;AAAA,IACpB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AAAA,EACA,eAAe;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,IACL,iBAAiB;AAAA,EACnB;AAAA,EACA,gBAAgB;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AAAA,EAIA,eAAe;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AAAA,EACA,oBAAoB;AAAA,IAClB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AAAA,EACA,gBAAgB;AAAA,IACd,aAAa;AAAA,IACb,SAAS;A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