@sixb/core 0.1.19 → 0.1.21

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 (765) hide show
  1. package/dist/actions/execution.d.ts.map +1 -1
  2. package/dist/actions/index.js +54 -47
  3. package/dist/actions/index.js.map +1 -1
  4. package/dist/actions/request.d.ts.map +1 -1
  5. package/dist/actions/run-authorization.d.ts +9 -0
  6. package/dist/actions/run-authorization.d.ts.map +1 -1
  7. package/dist/activity/connection.d.ts +62 -0
  8. package/dist/activity/connection.d.ts.map +1 -0
  9. package/dist/activity/device.d.ts +8 -0
  10. package/dist/activity/device.d.ts.map +1 -0
  11. package/dist/activity/execution.d.ts +48 -0
  12. package/dist/activity/execution.d.ts.map +1 -0
  13. package/dist/activity/service.d.ts +79 -0
  14. package/dist/activity/service.d.ts.map +1 -0
  15. package/dist/activity/shares.d.ts +24 -0
  16. package/dist/activity/shares.d.ts.map +1 -0
  17. package/dist/activity/timeline.d.ts +96 -0
  18. package/dist/activity/timeline.d.ts.map +1 -0
  19. package/dist/agents/index.d.ts +2 -1
  20. package/dist/agents/index.d.ts.map +1 -1
  21. package/dist/agents/index.js +63 -50
  22. package/dist/agents/index.js.map +1 -1
  23. package/dist/agents/request.d.ts.map +1 -1
  24. package/dist/agents/skills.d.ts.map +1 -1
  25. package/dist/agents/streams/index.js +3 -3
  26. package/dist/agents/streams/internal.js +3 -3
  27. package/dist/agents/types.d.ts +8 -8
  28. package/dist/agents/types.d.ts.map +1 -1
  29. package/dist/agents/validation.d.ts +1 -1
  30. package/dist/agents/validation.d.ts.map +1 -1
  31. package/dist/artifacts/address.d.ts +48 -0
  32. package/dist/artifacts/address.d.ts.map +1 -0
  33. package/dist/artifacts/csv.d.ts +22 -0
  34. package/dist/artifacts/csv.d.ts.map +1 -0
  35. package/dist/artifacts/errors.d.ts +11 -0
  36. package/dist/artifacts/errors.d.ts.map +1 -0
  37. package/dist/artifacts/execution.d.ts +43 -0
  38. package/dist/artifacts/execution.d.ts.map +1 -0
  39. package/dist/artifacts/frames/assets.d.ts +28 -0
  40. package/dist/artifacts/frames/assets.d.ts.map +1 -0
  41. package/dist/artifacts/frames/grants.d.ts +37 -0
  42. package/dist/artifacts/frames/grants.d.ts.map +1 -0
  43. package/dist/artifacts/frames/index.d.ts +10 -0
  44. package/dist/artifacts/frames/index.d.ts.map +1 -0
  45. package/dist/artifacts/frames/index.js +892 -0
  46. package/dist/artifacts/frames/index.js.map +14 -0
  47. package/dist/artifacts/frames/kit.d.ts +66 -0
  48. package/dist/artifacts/frames/kit.d.ts.map +1 -0
  49. package/dist/artifacts/frames/probe.d.ts +41 -0
  50. package/dist/artifacts/frames/probe.d.ts.map +1 -0
  51. package/dist/artifacts/frames/protocol.d.ts +98 -0
  52. package/dist/artifacts/frames/protocol.d.ts.map +1 -0
  53. package/dist/artifacts/frames/runtime.d.ts +13 -0
  54. package/dist/artifacts/frames/runtime.d.ts.map +1 -0
  55. package/dist/artifacts/html.d.ts +6 -0
  56. package/dist/artifacts/html.d.ts.map +1 -0
  57. package/dist/artifacts/ids.d.ts +5 -0
  58. package/dist/artifacts/ids.d.ts.map +1 -0
  59. package/dist/artifacts/index.d.ts +16 -0
  60. package/dist/artifacts/index.d.ts.map +1 -0
  61. package/dist/artifacts/index.js +125 -0
  62. package/dist/artifacts/index.js.map +10 -0
  63. package/dist/artifacts/kinds.d.ts +5 -0
  64. package/dist/artifacts/kinds.d.ts.map +1 -0
  65. package/dist/artifacts/limits.d.ts +28 -0
  66. package/dist/artifacts/limits.d.ts.map +1 -0
  67. package/dist/artifacts/outline.d.ts +44 -0
  68. package/dist/artifacts/outline.d.ts.map +1 -0
  69. package/dist/artifacts/publish/files.d.ts +15 -0
  70. package/dist/artifacts/publish/files.d.ts.map +1 -0
  71. package/dist/artifacts/publish/index.d.ts +5 -0
  72. package/dist/artifacts/publish/index.d.ts.map +1 -0
  73. package/dist/artifacts/publish/index.js +36 -0
  74. package/dist/artifacts/publish/index.js.map +9 -0
  75. package/dist/artifacts/publish/publish.d.ts +52 -0
  76. package/dist/artifacts/publish/publish.d.ts.map +1 -0
  77. package/dist/artifacts/publish/references.d.ts +27 -0
  78. package/dist/artifacts/publish/references.d.ts.map +1 -0
  79. package/dist/artifacts/publish/validate/document.d.ts +17 -0
  80. package/dist/artifacts/publish/validate/document.d.ts.map +1 -0
  81. package/dist/artifacts/publish/validate/file.d.ts +8 -0
  82. package/dist/artifacts/publish/validate/file.d.ts.map +1 -0
  83. package/dist/artifacts/publish/validate/sheet.d.ts +15 -0
  84. package/dist/artifacts/publish/validate/sheet.d.ts.map +1 -0
  85. package/dist/artifacts/publish/validate/slides.d.ts +21 -0
  86. package/dist/artifacts/publish/validate/slides.d.ts.map +1 -0
  87. package/dist/artifacts/references.d.ts +12 -0
  88. package/dist/artifacts/references.d.ts.map +1 -0
  89. package/dist/artifacts/resolve.d.ts +41 -0
  90. package/dist/artifacts/resolve.d.ts.map +1 -0
  91. package/dist/artifacts/theme.d.ts +19 -0
  92. package/dist/artifacts/theme.d.ts.map +1 -0
  93. package/dist/artifacts/warnings.d.ts +11 -0
  94. package/dist/artifacts/warnings.d.ts.map +1 -0
  95. package/dist/artifacts/workbook.d.ts +64 -0
  96. package/dist/artifacts/workbook.d.ts.map +1 -0
  97. package/dist/auth/cookies.d.ts +2 -4
  98. package/dist/auth/cookies.d.ts.map +1 -1
  99. package/dist/auth/index.d.ts +0 -2
  100. package/dist/auth/index.d.ts.map +1 -1
  101. package/dist/auth/index.js +14 -20
  102. package/dist/auth/index.js.map +1 -1
  103. package/dist/auth/runtime.d.ts +8 -10
  104. package/dist/auth/runtime.d.ts.map +1 -1
  105. package/dist/auth/session-cache.d.ts +1 -5
  106. package/dist/auth/session-cache.d.ts.map +1 -1
  107. package/dist/auth/strategy.js +1 -1
  108. package/dist/auth/types.d.ts +4 -8
  109. package/dist/auth/types.d.ts.map +1 -1
  110. package/dist/auth/validation.d.ts +0 -1
  111. package/dist/auth/validation.d.ts.map +1 -1
  112. package/dist/authorization/decision.d.ts +2 -4
  113. package/dist/authorization/decision.d.ts.map +1 -1
  114. package/dist/authorization/grant-kinds.d.ts +6 -8
  115. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  116. package/dist/authorization/index.d.ts +0 -1
  117. package/dist/authorization/index.d.ts.map +1 -1
  118. package/dist/authorization/index.js +7 -11
  119. package/dist/authorization/index.js.map +1 -1
  120. package/dist/authorization/resolve.d.ts +1 -1
  121. package/dist/authorization/resolve.d.ts.map +1 -1
  122. package/dist/blob-storage/browser.js +1 -1
  123. package/dist/blob-storage/index.js +2 -2
  124. package/dist/blob-storage/internal.d.ts +1 -1
  125. package/dist/blob-storage/internal.d.ts.map +1 -1
  126. package/dist/blob-storage/internal.js +11 -5
  127. package/dist/blob-storage/internal.js.map +1 -1
  128. package/dist/blob-storage/media-type.d.ts +12 -0
  129. package/dist/blob-storage/media-type.d.ts.map +1 -1
  130. package/dist/bootstrap/index.js +54 -48
  131. package/dist/bootstrap/index.js.map +2 -2
  132. package/dist/{chunk-t6vq7bff.js → chunk-0bphap9y.js} +5 -5
  133. package/dist/{chunk-7mbzgd9m.js → chunk-1cc1xaf3.js} +3 -3
  134. package/dist/chunk-3jms7je7.js +14 -0
  135. package/dist/chunk-3jms7je7.js.map +10 -0
  136. package/dist/{chunk-s54c868q.js → chunk-3qct2mdc.js} +3 -13
  137. package/dist/chunk-3qct2mdc.js.map +12 -0
  138. package/dist/{chunk-6gmfggss.js → chunk-431pyp2c.js} +3 -3
  139. package/dist/{chunk-c85m1hyj.js → chunk-447a5c0p.js} +2 -2
  140. package/dist/chunk-48qjhh6v.js +185 -0
  141. package/dist/chunk-48qjhh6v.js.map +13 -0
  142. package/dist/{chunk-80mc0971.js → chunk-561r0yc9.js} +8 -8
  143. package/dist/{chunk-5e43w60z.js → chunk-5948n82c.js} +2 -2
  144. package/dist/{chunk-yzwja0mj.js → chunk-5hx48dnn.js} +2 -2
  145. package/dist/{chunk-tjb1mk5t.js → chunk-5vems3nx.js} +5 -6
  146. package/dist/{chunk-tjb1mk5t.js.map → chunk-5vems3nx.js.map} +3 -3
  147. package/dist/{chunk-aff7cyea.js → chunk-61y5xs4p.js} +563 -167
  148. package/dist/{chunk-aff7cyea.js.map → chunk-61y5xs4p.js.map} +12 -9
  149. package/dist/chunk-65abf64x.js +13 -0
  150. package/dist/chunk-65abf64x.js.map +10 -0
  151. package/dist/{chunk-z3y5kg1x.js → chunk-6eqsgvxk.js} +3 -3
  152. package/dist/{chunk-z3y5kg1x.js.map → chunk-6eqsgvxk.js.map} +2 -2
  153. package/dist/chunk-6rqgmkde.js +2028 -0
  154. package/dist/chunk-6rqgmkde.js.map +29 -0
  155. package/dist/{chunk-y7rqfrgg.js → chunk-6vb4st8k.js} +29 -38
  156. package/dist/chunk-6vb4st8k.js.map +23 -0
  157. package/dist/chunk-7q8t23v4.js +467 -0
  158. package/dist/chunk-7q8t23v4.js.map +14 -0
  159. package/dist/{chunk-kyzq4wy9.js → chunk-858emn8m.js} +17 -17
  160. package/dist/chunk-858emn8m.js.map +18 -0
  161. package/dist/{chunk-hvsb78a1.js → chunk-8frc8a4j.js} +26 -26
  162. package/dist/{chunk-hvsb78a1.js.map → chunk-8frc8a4j.js.map} +2 -2
  163. package/dist/{chunk-3zxk45er.js → chunk-8ncg20rd.js} +3 -68
  164. package/dist/{chunk-3zxk45er.js.map → chunk-8ncg20rd.js.map} +4 -5
  165. package/dist/{chunk-j2bp5ryw.js → chunk-918wwnaa.js} +495 -28
  166. package/dist/{chunk-j2bp5ryw.js.map → chunk-918wwnaa.js.map} +14 -12
  167. package/dist/{chunk-1f7wpmyp.js → chunk-9j4jw7as.js} +103 -110
  168. package/dist/chunk-9j4jw7as.js.map +14 -0
  169. package/dist/chunk-9kgkfg6v.js +502 -0
  170. package/dist/chunk-9kgkfg6v.js.map +14 -0
  171. package/dist/chunk-a3faa34j.js +74 -0
  172. package/dist/chunk-a3faa34j.js.map +10 -0
  173. package/dist/{chunk-ey3pyej1.js → chunk-akzryx9h.js} +347 -1174
  174. package/dist/{chunk-ey3pyej1.js.map → chunk-akzryx9h.js.map} +19 -25
  175. package/dist/chunk-arns890k.js +10 -0
  176. package/dist/chunk-arns890k.js.map +10 -0
  177. package/dist/{chunk-zrmy8zvw.js → chunk-bk9svbcq.js} +11 -11
  178. package/dist/{chunk-zrmy8zvw.js.map → chunk-bk9svbcq.js.map} +2 -2
  179. package/dist/{chunk-hkc3jct7.js → chunk-c06hmxyy.js} +2 -10
  180. package/dist/chunk-c06hmxyy.js.map +10 -0
  181. package/dist/{chunk-q1vkr2ys.js → chunk-c1rxbz5y.js} +3 -3
  182. package/dist/chunk-cfj9dfbb.js +288 -0
  183. package/dist/chunk-cfj9dfbb.js.map +12 -0
  184. package/dist/{chunk-4tcx876c.js → chunk-cn0fwwhy.js} +19 -19
  185. package/dist/{chunk-4tcx876c.js.map → chunk-cn0fwwhy.js.map} +1 -1
  186. package/dist/{chunk-gc4ntf7d.js → chunk-cwdzcv37.js} +1 -1
  187. package/dist/{chunk-fa02jy15.js → chunk-cy4mbddw.js} +1 -1
  188. package/dist/{chunk-7kg3k1m9.js → chunk-d09e3rax.js} +1 -1
  189. package/dist/chunk-d5rjr8c0.js +176 -0
  190. package/dist/chunk-d5rjr8c0.js.map +12 -0
  191. package/dist/{chunk-rhg02hxq.js → chunk-d7dnxdep.js} +3 -3
  192. package/dist/{chunk-b38szspf.js → chunk-dhcv7yxc.js} +1 -1
  193. package/dist/{chunk-b38szspf.js.map → chunk-dhcv7yxc.js.map} +1 -1
  194. package/dist/{chunk-enpsx8k5.js → chunk-dhdha526.js} +23 -21
  195. package/dist/chunk-dhdha526.js.map +10 -0
  196. package/dist/{chunk-8mx7qw3y.js → chunk-dvd2fp9q.js} +2 -2
  197. package/dist/{chunk-8mx7qw3y.js.map → chunk-dvd2fp9q.js.map} +3 -3
  198. package/dist/{chunk-bwjcehza.js → chunk-e17zdm62.js} +6 -12
  199. package/dist/{chunk-bwjcehza.js.map → chunk-e17zdm62.js.map} +3 -4
  200. package/dist/{chunk-tpn40322.js → chunk-e6k4thh5.js} +11 -10
  201. package/dist/{chunk-tpn40322.js.map → chunk-e6k4thh5.js.map} +3 -3
  202. package/dist/{chunk-tw03bsmb.js → chunk-eptrvnby.js} +224 -3
  203. package/dist/chunk-eptrvnby.js.map +12 -0
  204. package/dist/{chunk-xt1zt7gv.js → chunk-f4pamkt9.js} +30 -23
  205. package/dist/chunk-f4pamkt9.js.map +12 -0
  206. package/dist/chunk-ff5xkv0p.js +211 -0
  207. package/dist/chunk-ff5xkv0p.js.map +10 -0
  208. package/dist/{chunk-bpgy64fw.js → chunk-g257jwnc.js} +10 -4
  209. package/dist/{chunk-bpgy64fw.js.map → chunk-g257jwnc.js.map} +3 -3
  210. package/dist/chunk-g5bvzyyr.js +32 -0
  211. package/dist/chunk-g5bvzyyr.js.map +10 -0
  212. package/dist/{chunk-2jntasmh.js → chunk-hcbyfxbe.js} +25 -49
  213. package/dist/chunk-hcbyfxbe.js.map +12 -0
  214. package/dist/chunk-hke9aeen.js +9 -0
  215. package/dist/chunk-hke9aeen.js.map +10 -0
  216. package/dist/{chunk-1sr8ryzk.js → chunk-hwksyjks.js} +122 -1
  217. package/dist/{chunk-1sr8ryzk.js.map → chunk-hwksyjks.js.map} +3 -3
  218. package/dist/chunk-jcfw4h7m.js +9 -0
  219. package/dist/chunk-jcfw4h7m.js.map +10 -0
  220. package/dist/{chunk-85yvv5n0.js → chunk-k43ct2ke.js} +20 -11
  221. package/dist/chunk-k43ct2ke.js.map +12 -0
  222. package/dist/{chunk-dnmadg9k.js → chunk-kge7k6ey.js} +40 -8
  223. package/dist/chunk-kge7k6ey.js.map +15 -0
  224. package/dist/{chunk-wz0xs816.js → chunk-ky3j490c.js} +2 -2
  225. package/dist/chunk-mjddfa7k.js +129 -0
  226. package/dist/chunk-mjddfa7k.js.map +12 -0
  227. package/dist/{chunk-3gnrh4ve.js → chunk-nn5xnx3s.js} +86 -111
  228. package/dist/chunk-nn5xnx3s.js.map +40 -0
  229. package/dist/{chunk-rz53yb4v.js → chunk-q5e5tv4b.js} +35 -7
  230. package/dist/{chunk-rz53yb4v.js.map → chunk-q5e5tv4b.js.map} +3 -3
  231. package/dist/{chunk-vyf9kfqf.js → chunk-q7gn29y3.js} +1 -1
  232. package/dist/{chunk-d2ync1v3.js → chunk-rmakanzx.js} +10 -12
  233. package/dist/{chunk-d2ync1v3.js.map → chunk-rmakanzx.js.map} +3 -4
  234. package/dist/{chunk-v9xd5wzd.js → chunk-s7jg7pmn.js} +1 -1
  235. package/dist/chunk-tbc1ngpd.js +642 -0
  236. package/dist/chunk-tbc1ngpd.js.map +18 -0
  237. package/dist/chunk-twe4dx8p.js +676 -0
  238. package/dist/chunk-twe4dx8p.js.map +15 -0
  239. package/dist/{chunk-nre82s12.js → chunk-vf57cr4t.js} +2 -2
  240. package/dist/{chunk-9ybhtmg4.js → chunk-vvxtn22d.js} +1 -1
  241. package/dist/{chunk-jhm3zsa7.js → chunk-wkv3h3q7.js} +64 -2
  242. package/dist/{chunk-jhm3zsa7.js.map → chunk-wkv3h3q7.js.map} +3 -3
  243. package/dist/chunk-x0v3jd47.js +124 -0
  244. package/dist/chunk-x0v3jd47.js.map +10 -0
  245. package/dist/{chunk-7t429e3f.js → chunk-xvsc5m8n.js} +1 -1
  246. package/dist/{chunk-kg5j6fct.js → chunk-y5tah2kf.js} +1 -1
  247. package/dist/{chunk-52bk93x8.js → chunk-z58tm0hm.js} +2 -2
  248. package/dist/datasets/builders.d.ts +15 -2
  249. package/dist/datasets/builders.d.ts.map +1 -1
  250. package/dist/datasets/column-index.d.ts +7 -0
  251. package/dist/datasets/column-index.d.ts.map +1 -0
  252. package/dist/datasets/execution.d.ts +3 -2
  253. package/dist/datasets/execution.d.ts.map +1 -1
  254. package/dist/datasets/write.js +8 -8
  255. package/dist/deploy/internal.js +4 -3
  256. package/dist/deploy/internal.js.map +4 -4
  257. package/dist/deploy/services.d.ts.map +1 -1
  258. package/dist/deploy/types.d.ts +1 -2
  259. package/dist/deploy/types.d.ts.map +1 -1
  260. package/dist/error-reporting/internal.js +4 -4
  261. package/dist/errors/internal.d.ts +1 -0
  262. package/dist/errors/internal.d.ts.map +1 -1
  263. package/dist/errors/internal.js +7 -4
  264. package/dist/errors/internal.js.map +1 -1
  265. package/dist/events/execution.d.ts +12 -2
  266. package/dist/events/execution.d.ts.map +1 -1
  267. package/dist/events/index.js +4 -4
  268. package/dist/execution/agent.js +56 -49
  269. package/dist/execution/agent.js.map +1 -1
  270. package/dist/execution/authorization.d.ts.map +1 -1
  271. package/dist/execution/authorized-object-reader.d.ts +52 -11
  272. package/dist/execution/authorized-object-reader.d.ts.map +1 -1
  273. package/dist/execution/object-reader-clearance.d.ts +41 -0
  274. package/dist/execution/object-reader-clearance.d.ts.map +1 -0
  275. package/dist/execution/object-reader-ontology.d.ts +12 -0
  276. package/dist/execution/object-reader-ontology.d.ts.map +1 -0
  277. package/dist/execution/object-reader-security.d.ts +45 -0
  278. package/dist/execution/object-reader-security.d.ts.map +1 -0
  279. package/dist/execution/primitive.js +54 -47
  280. package/dist/execution/primitive.js.map +1 -1
  281. package/dist/execution/request.js +49 -42
  282. package/dist/execution/request.js.map +2 -2
  283. package/dist/http/api-routes.d.ts.map +1 -1
  284. package/dist/http/index.js +1 -1
  285. package/dist/index.d.ts +23 -7
  286. package/dist/index.d.ts.map +1 -1
  287. package/dist/index.js +111 -109
  288. package/dist/index.js.map +1 -1
  289. package/dist/lake-storage/in-memory.d.ts +1 -0
  290. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  291. package/dist/lake-storage/index.d.ts +6 -3
  292. package/dist/lake-storage/index.d.ts.map +1 -1
  293. package/dist/lake-storage/index.js +21 -13
  294. package/dist/lake-storage/index.js.map +1 -1
  295. package/dist/lake-storage/lineage.d.ts +94 -0
  296. package/dist/lake-storage/lineage.d.ts.map +1 -0
  297. package/dist/lake-storage/sql-transforms.d.ts +45 -0
  298. package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
  299. package/dist/lake-storage/types.d.ts +55 -1
  300. package/dist/lake-storage/types.d.ts.map +1 -1
  301. package/dist/lake-storage/version-inputs.d.ts +14 -3
  302. package/dist/lake-storage/version-inputs.d.ts.map +1 -1
  303. package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
  304. package/dist/materializer/index.js +31 -30
  305. package/dist/materializer/index.js.map +1 -1
  306. package/dist/models/execution/index.js +26 -25
  307. package/dist/models/execution/index.js.map +1 -1
  308. package/dist/objects/clearance-redaction.d.ts +27 -0
  309. package/dist/objects/clearance-redaction.d.ts.map +1 -0
  310. package/dist/objects/index.js +54 -47
  311. package/dist/objects/index.js.map +1 -1
  312. package/dist/objects/link/authorization.d.ts +8 -5
  313. package/dist/objects/link/authorization.d.ts.map +1 -1
  314. package/dist/objects/link/upsert-batch.d.ts.map +1 -1
  315. package/dist/objects/object/delete.d.ts.map +1 -1
  316. package/dist/objects/object/upsert-batch.d.ts.map +1 -1
  317. package/dist/objects/object/upsert.d.ts.map +1 -1
  318. package/dist/objects/property-clearance.d.ts +47 -24
  319. package/dist/objects/property-clearance.d.ts.map +1 -1
  320. package/dist/objects/query/clearance-admission.d.ts +10 -0
  321. package/dist/objects/query/clearance-admission.d.ts.map +1 -0
  322. package/dist/objects/query/index.js +29 -28
  323. package/dist/objects/query/index.js.map +1 -1
  324. package/dist/objects/query/link-query-clearance.d.ts +21 -0
  325. package/dist/objects/query/link-query-clearance.d.ts.map +1 -0
  326. package/dist/objects/vectors/handle.d.ts.map +1 -1
  327. package/dist/objects/vectors/profile.d.ts +5 -0
  328. package/dist/objects/vectors/profile.d.ts.map +1 -1
  329. package/dist/ontology/builders.d.ts.map +1 -1
  330. package/dist/ontology/docs-markdown.d.ts +1 -1
  331. package/dist/ontology/docs-markdown.d.ts.map +1 -1
  332. package/dist/ontology/index.js +7 -7
  333. package/dist/ontology/internal.js +4 -4
  334. package/dist/ontology/internal.js.map +1 -1
  335. package/dist/pipelines/index.d.ts +2 -0
  336. package/dist/pipelines/index.d.ts.map +1 -1
  337. package/dist/pipelines/index.js +47 -35
  338. package/dist/pipelines/index.js.map +1 -1
  339. package/dist/pipelines/lineage.d.ts +17 -0
  340. package/dist/pipelines/lineage.d.ts.map +1 -0
  341. package/dist/projections/internal.d.ts +2 -2
  342. package/dist/projections/internal.js +30 -29
  343. package/dist/projections/internal.js.map +1 -1
  344. package/dist/runtime/create.d.ts +3 -0
  345. package/dist/runtime/create.d.ts.map +1 -1
  346. package/dist/runtime/host.d.ts +6 -0
  347. package/dist/runtime/host.d.ts.map +1 -1
  348. package/dist/runtime/internal.d.ts +2 -0
  349. package/dist/runtime/internal.d.ts.map +1 -1
  350. package/dist/runtime/internal.js +46 -42
  351. package/dist/runtime/internal.js.map +1 -1
  352. package/dist/runtime/ontology-mutations.d.ts +2 -0
  353. package/dist/runtime/ontology-mutations.d.ts.map +1 -1
  354. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  355. package/dist/runtime/sixb.d.ts +8 -0
  356. package/dist/runtime/sixb.d.ts.map +1 -1
  357. package/dist/sandboxes/auth.d.ts +16 -0
  358. package/dist/sandboxes/auth.d.ts.map +1 -1
  359. package/dist/sandboxes/config.d.ts.map +1 -1
  360. package/dist/sandboxes/configuration.d.ts +26 -0
  361. package/dist/sandboxes/configuration.d.ts.map +1 -1
  362. package/dist/sandboxes/index.d.ts +1 -1
  363. package/dist/sandboxes/index.d.ts.map +1 -1
  364. package/dist/sandboxes/index.js +14 -13
  365. package/dist/sandboxes/index.js.map +1 -1
  366. package/dist/sandboxes/sandbox.d.ts +28 -5
  367. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  368. package/dist/security/applied-markings-contribution.d.ts +58 -0
  369. package/dist/security/applied-markings-contribution.d.ts.map +1 -0
  370. package/dist/security/applied-markings-host.d.ts +10 -0
  371. package/dist/security/applied-markings-host.d.ts.map +1 -0
  372. package/dist/security/applied-markings-snapshot.d.ts +67 -0
  373. package/dist/security/applied-markings-snapshot.d.ts.map +1 -0
  374. package/dist/security/applied-markings.d.ts +73 -0
  375. package/dist/security/applied-markings.d.ts.map +1 -0
  376. package/dist/security/builders.d.ts.map +1 -1
  377. package/dist/security/dataset-version-markings.d.ts +47 -0
  378. package/dist/security/dataset-version-markings.d.ts.map +1 -0
  379. package/dist/security/every.d.ts +1 -4
  380. package/dist/security/every.d.ts.map +1 -1
  381. package/dist/security/grants.d.ts +4 -5
  382. package/dist/security/grants.d.ts.map +1 -1
  383. package/dist/security/index.d.ts +2 -2
  384. package/dist/security/index.d.ts.map +1 -1
  385. package/dist/security/internal.d.ts +15 -0
  386. package/dist/security/internal.d.ts.map +1 -0
  387. package/dist/security/internal.js +135 -0
  388. package/dist/security/internal.js.map +10 -0
  389. package/dist/security/marking-propagation.d.ts +62 -0
  390. package/dist/security/marking-propagation.d.ts.map +1 -0
  391. package/dist/security/marking-sets.d.ts +14 -0
  392. package/dist/security/marking-sets.d.ts.map +1 -0
  393. package/dist/security/markings.d.ts +6 -3
  394. package/dist/security/markings.d.ts.map +1 -1
  395. package/dist/security/membership-policies.d.ts.map +1 -1
  396. package/dist/security/pipeline-markings.d.ts +20 -0
  397. package/dist/security/pipeline-markings.d.ts.map +1 -0
  398. package/dist/security/project.d.ts +4 -0
  399. package/dist/security/project.d.ts.map +1 -0
  400. package/dist/security/projection-markings.d.ts +71 -0
  401. package/dist/security/projection-markings.d.ts.map +1 -0
  402. package/dist/security/public.d.ts +10 -0
  403. package/dist/security/public.d.ts.map +1 -0
  404. package/dist/security/public.js +10 -0
  405. package/dist/security/public.js.map +9 -0
  406. package/dist/security/redactions.d.ts +4 -1
  407. package/dist/security/redactions.d.ts.map +1 -1
  408. package/dist/security/registry.d.ts +0 -1
  409. package/dist/security/registry.d.ts.map +1 -1
  410. package/dist/security/types.d.ts +34 -19
  411. package/dist/security/types.d.ts.map +1 -1
  412. package/dist/security/validation.d.ts +0 -6
  413. package/dist/security/validation.d.ts.map +1 -1
  414. package/dist/shares/internal.js +25 -24
  415. package/dist/shares/internal.js.map +2 -2
  416. package/dist/storage/action-runs/failure.js +3 -3
  417. package/dist/storage/action-runs/in-memory.d.ts +4 -0
  418. package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
  419. package/dist/storage/action-runs/types.d.ts +8 -0
  420. package/dist/storage/action-runs/types.d.ts.map +1 -1
  421. package/dist/storage/activity/in-memory.d.ts +55 -0
  422. package/dist/storage/activity/in-memory.d.ts.map +1 -0
  423. package/dist/storage/activity/index.d.ts +3 -0
  424. package/dist/storage/activity/index.d.ts.map +1 -0
  425. package/dist/storage/activity/policy.d.ts +96 -0
  426. package/dist/storage/activity/policy.d.ts.map +1 -0
  427. package/dist/storage/activity/types.d.ts +191 -0
  428. package/dist/storage/activity/types.d.ts.map +1 -0
  429. package/dist/storage/agents/in-memory.d.ts +4 -0
  430. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  431. package/dist/storage/agents/provider.d.ts.map +1 -1
  432. package/dist/storage/agents/provider.js +2 -5
  433. package/dist/storage/agents/provider.js.map +1 -1
  434. package/dist/storage/agents/types.d.ts +10 -9
  435. package/dist/storage/agents/types.d.ts.map +1 -1
  436. package/dist/storage/ai-limits/enforcement.js +3 -3
  437. package/dist/storage/artifacts/errors.d.ts +8 -0
  438. package/dist/storage/artifacts/errors.d.ts.map +1 -0
  439. package/dist/storage/artifacts/in-memory.d.ts +34 -0
  440. package/dist/storage/artifacts/in-memory.d.ts.map +1 -0
  441. package/dist/storage/artifacts/index.d.ts +5 -0
  442. package/dist/storage/artifacts/index.d.ts.map +1 -0
  443. package/dist/storage/artifacts/record.d.ts +17 -0
  444. package/dist/storage/artifacts/record.d.ts.map +1 -0
  445. package/dist/storage/artifacts/types.d.ts +184 -0
  446. package/dist/storage/artifacts/types.d.ts.map +1 -0
  447. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  448. package/dist/storage/auth/in-memory/magic-links.d.ts.map +1 -1
  449. package/dist/storage/auth/in-memory/oidc-attempts.d.ts.map +1 -1
  450. package/dist/storage/auth/in-memory/sessions.d.ts +2 -11
  451. package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
  452. package/dist/storage/auth/in-memory/shared.d.ts +1 -2
  453. package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
  454. package/dist/storage/auth/index.d.ts +1 -1
  455. package/dist/storage/auth/index.d.ts.map +1 -1
  456. package/dist/storage/auth/types.d.ts +20 -17
  457. package/dist/storage/auth/types.d.ts.map +1 -1
  458. package/dist/storage/connector-connections/provider.js +2 -2
  459. package/dist/storage/executions/in-memory.d.ts +2 -1
  460. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  461. package/dist/storage/executions/index.d.ts +1 -1
  462. package/dist/storage/executions/index.d.ts.map +1 -1
  463. package/dist/storage/executions/provider.d.ts +2 -0
  464. package/dist/storage/executions/provider.d.ts.map +1 -1
  465. package/dist/storage/executions/provider.js +9 -223
  466. package/dist/storage/executions/provider.js.map +3 -4
  467. package/dist/storage/executions/types.d.ts +31 -0
  468. package/dist/storage/executions/types.d.ts.map +1 -1
  469. package/dist/storage/file-upload-sessions/provider.js +12 -12
  470. package/dist/storage/in-memory/index.d.ts +8 -0
  471. package/dist/storage/in-memory/index.d.ts.map +1 -1
  472. package/dist/storage/index.d.ts +6 -4
  473. package/dist/storage/index.d.ts.map +1 -1
  474. package/dist/storage/index.js +47 -46
  475. package/dist/storage/index.js.map +1 -1
  476. package/dist/storage/internal.d.ts +3 -0
  477. package/dist/storage/internal.d.ts.map +1 -1
  478. package/dist/storage/internal.js +66 -16
  479. package/dist/storage/internal.js.map +1 -1
  480. package/dist/storage/ontology/in-memory/sources.d.ts +2 -1
  481. package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
  482. package/dist/storage/ontology/index.d.ts +1 -1
  483. package/dist/storage/ontology/index.d.ts.map +1 -1
  484. package/dist/storage/ontology/sources.d.ts +15 -0
  485. package/dist/storage/ontology/sources.d.ts.map +1 -1
  486. package/dist/storage/projection-runs/provider.js +3 -3
  487. package/dist/storage/share-grants/in-memory.d.ts +2 -1
  488. package/dist/storage/share-grants/in-memory.d.ts.map +1 -1
  489. package/dist/storage/share-grants/index.d.ts +1 -1
  490. package/dist/storage/share-grants/index.d.ts.map +1 -1
  491. package/dist/storage/share-grants/types.d.ts +6 -0
  492. package/dist/storage/share-grants/types.d.ts.map +1 -1
  493. package/dist/storage/types.d.ts +4 -0
  494. package/dist/storage/types.d.ts.map +1 -1
  495. package/dist/storage/workflow-runs/in-memory.d.ts +4 -0
  496. package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
  497. package/dist/storage/workflow-runs/provider.js +14 -13
  498. package/dist/storage/workflow-runs/provider.js.map +1 -1
  499. package/dist/storage/workflow-runs/types.d.ts +5 -0
  500. package/dist/storage/workflow-runs/types.d.ts.map +1 -1
  501. package/dist/syncs/index.js +35 -34
  502. package/dist/syncs/index.js.map +1 -1
  503. package/dist/testing/action-run-storage-contract.d.ts.map +1 -1
  504. package/dist/testing/activity-storage-contract.d.ts +14 -0
  505. package/dist/testing/activity-storage-contract.d.ts.map +1 -0
  506. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  507. package/dist/testing/artifact-storage-contract.d.ts +13 -0
  508. package/dist/testing/artifact-storage-contract.d.ts.map +1 -0
  509. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  510. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  511. package/dist/testing/index.d.ts +2 -0
  512. package/dist/testing/index.d.ts.map +1 -1
  513. package/dist/testing/index.js +4493 -3225
  514. package/dist/testing/index.js.map +14 -12
  515. package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
  516. package/dist/testing/lake-storage-contract.d.ts +2 -0
  517. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  518. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  519. package/dist/testing/share-grant-storage-contract.d.ts.map +1 -1
  520. package/dist/webhooks/internal.js +28 -27
  521. package/dist/webhooks/internal.js.map +2 -2
  522. package/dist/workers/index.js +2 -2
  523. package/dist/workflows/builders.d.ts.map +1 -1
  524. package/dist/workflows/index.js +57 -51
  525. package/dist/workflows/index.js.map +1 -1
  526. package/dist/workflows/types.d.ts +9 -0
  527. package/dist/workflows/types.d.ts.map +1 -1
  528. package/dist/workflows/validation.d.ts +7 -0
  529. package/dist/workflows/validation.d.ts.map +1 -1
  530. package/package.json +32 -2
  531. package/src/actions/execution.ts +18 -13
  532. package/src/actions/request.ts +18 -3
  533. package/src/actions/run-authorization.ts +23 -0
  534. package/src/activity/README.md +155 -0
  535. package/src/activity/connection.ts +217 -0
  536. package/src/activity/device.ts +41 -0
  537. package/src/activity/execution.ts +210 -0
  538. package/src/activity/service.ts +274 -0
  539. package/src/activity/shares.ts +62 -0
  540. package/src/activity/timeline.ts +424 -0
  541. package/src/agents/index.ts +8 -3
  542. package/src/agents/request.ts +5 -0
  543. package/src/agents/skills.ts +6 -0
  544. package/src/agents/types.ts +8 -8
  545. package/src/agents/validation.ts +2 -0
  546. package/src/artifacts/address.ts +132 -0
  547. package/src/artifacts/csv.ts +108 -0
  548. package/src/artifacts/errors.ts +21 -0
  549. package/src/artifacts/execution.ts +153 -0
  550. package/src/artifacts/frames/assets.ts +88 -0
  551. package/src/artifacts/frames/grants.ts +124 -0
  552. package/src/artifacts/frames/index.ts +15 -0
  553. package/src/artifacts/frames/kit.ts +392 -0
  554. package/src/artifacts/frames/probe.ts +309 -0
  555. package/src/artifacts/frames/protocol.ts +174 -0
  556. package/src/artifacts/frames/runtime.ts +213 -0
  557. package/src/artifacts/html.ts +25 -0
  558. package/src/artifacts/ids.ts +18 -0
  559. package/src/artifacts/index.ts +61 -0
  560. package/src/artifacts/kinds.ts +8 -0
  561. package/src/artifacts/limits.ts +27 -0
  562. package/src/artifacts/outline.ts +62 -0
  563. package/src/artifacts/publish/files.ts +87 -0
  564. package/src/artifacts/publish/index.ts +12 -0
  565. package/src/artifacts/publish/publish.ts +250 -0
  566. package/src/artifacts/publish/references.ts +130 -0
  567. package/src/artifacts/publish/validate/document.ts +114 -0
  568. package/src/artifacts/publish/validate/file.ts +19 -0
  569. package/src/artifacts/publish/validate/sheet.ts +251 -0
  570. package/src/artifacts/publish/validate/slides.ts +134 -0
  571. package/src/artifacts/references.ts +11 -0
  572. package/src/artifacts/resolve.ts +97 -0
  573. package/src/artifacts/theme.ts +116 -0
  574. package/src/artifacts/warnings.ts +10 -0
  575. package/src/artifacts/workbook.ts +315 -0
  576. package/src/auth/cookies.ts +3 -20
  577. package/src/auth/index.ts +0 -6
  578. package/src/auth/runtime.ts +59 -76
  579. package/src/auth/session-cache.ts +2 -9
  580. package/src/auth/types.ts +4 -8
  581. package/src/auth/validation.ts +0 -2
  582. package/src/authorization/decision.ts +13 -23
  583. package/src/authorization/grant-kinds.ts +33 -28
  584. package/src/authorization/index.ts +0 -1
  585. package/src/authorization/resolve.ts +10 -6
  586. package/src/blob-storage/internal.ts +1 -1
  587. package/src/blob-storage/media-type.ts +69 -0
  588. package/src/datasets/builders.ts +66 -2
  589. package/src/datasets/column-index.ts +19 -0
  590. package/src/datasets/execution.ts +23 -9
  591. package/src/deploy/services.ts +0 -1
  592. package/src/deploy/types.ts +1 -2
  593. package/src/deploy/validation.ts +3 -1
  594. package/src/errors/internal.ts +1 -0
  595. package/src/events/execution.ts +134 -21
  596. package/src/execution/authorization.ts +11 -5
  597. package/src/execution/authorized-object-reader.ts +270 -256
  598. package/src/execution/object-reader-clearance.ts +91 -0
  599. package/src/execution/object-reader-ontology.ts +63 -0
  600. package/src/execution/object-reader-security.ts +146 -0
  601. package/src/http/api-routes.ts +125 -0
  602. package/src/index.ts +72 -17
  603. package/src/lake-storage/in-memory.ts +26 -3
  604. package/src/lake-storage/index.ts +13 -1
  605. package/src/lake-storage/lineage.ts +385 -0
  606. package/src/lake-storage/sql-transforms.ts +45 -0
  607. package/src/lake-storage/types.ts +59 -1
  608. package/src/lake-storage/version-inputs.ts +35 -6
  609. package/src/maintenance/ontology-maintenance.ts +15 -0
  610. package/src/models/execution/embedding.ts +6 -6
  611. package/src/objects/clearance-redaction.ts +138 -0
  612. package/src/objects/link/authorization.ts +27 -7
  613. package/src/objects/link/remove.ts +2 -2
  614. package/src/objects/link/upsert-batch.ts +7 -5
  615. package/src/objects/link/upsert.ts +2 -2
  616. package/src/objects/object/delete.ts +2 -0
  617. package/src/objects/object/upsert-batch.ts +2 -4
  618. package/src/objects/object/upsert.ts +2 -3
  619. package/src/objects/property-clearance.ts +171 -152
  620. package/src/objects/query/clearance-admission.ts +112 -0
  621. package/src/objects/query/link-query-clearance.ts +73 -0
  622. package/src/objects/vectors/README.md +4 -0
  623. package/src/objects/vectors/handle.ts +11 -2
  624. package/src/objects/vectors/indexing-generate.ts +2 -2
  625. package/src/objects/vectors/profile.ts +5 -0
  626. package/src/ontology/builders.ts +12 -1
  627. package/src/ontology/docs-markdown.ts +1 -1
  628. package/src/pipelines/index.ts +2 -0
  629. package/src/pipelines/lineage.ts +45 -0
  630. package/src/projections/internal.ts +2 -2
  631. package/src/runtime/create.ts +4 -0
  632. package/src/runtime/host.ts +55 -0
  633. package/src/runtime/internal.ts +2 -0
  634. package/src/runtime/ontology-mutations.ts +19 -4
  635. package/src/runtime/resolve-definitions.ts +66 -3
  636. package/src/runtime/sixb.ts +18 -1
  637. package/src/sandboxes/README.md +29 -7
  638. package/src/sandboxes/auth.ts +16 -0
  639. package/src/sandboxes/config.ts +2 -7
  640. package/src/sandboxes/configuration.ts +61 -7
  641. package/src/sandboxes/index.ts +1 -0
  642. package/src/sandboxes/sandbox.ts +27 -5
  643. package/src/security/applied-markings-contribution.ts +277 -0
  644. package/src/security/applied-markings-host.ts +41 -0
  645. package/src/security/applied-markings-snapshot.ts +235 -0
  646. package/src/security/applied-markings.ts +405 -0
  647. package/src/security/builders.ts +7 -2
  648. package/src/security/dataset-version-markings.ts +163 -0
  649. package/src/security/every.ts +0 -4
  650. package/src/security/grants.ts +42 -27
  651. package/src/security/index.ts +3 -3
  652. package/src/security/internal.ts +18 -0
  653. package/src/security/marking-propagation.ts +255 -0
  654. package/src/security/marking-sets.ts +42 -0
  655. package/src/security/markings.ts +29 -178
  656. package/src/security/membership-policies.ts +3 -1
  657. package/src/security/pipeline-markings.ts +175 -0
  658. package/src/security/project.ts +8 -0
  659. package/src/security/projection-markings.ts +421 -0
  660. package/src/security/public.ts +10 -0
  661. package/src/security/redactions.ts +7 -2
  662. package/src/security/registry.ts +0 -8
  663. package/src/security/types.ts +38 -26
  664. package/src/security/validation.ts +28 -19
  665. package/src/storage/action-runs/in-memory.ts +18 -0
  666. package/src/storage/action-runs/types.ts +8 -0
  667. package/src/storage/activity/in-memory.ts +374 -0
  668. package/src/storage/activity/index.ts +27 -0
  669. package/src/storage/activity/policy.ts +430 -0
  670. package/src/storage/activity/types.ts +211 -0
  671. package/src/storage/agents/in-memory.ts +10 -0
  672. package/src/storage/agents/provider.ts +2 -13
  673. package/src/storage/agents/types.ts +10 -17
  674. package/src/storage/artifacts/errors.ts +16 -0
  675. package/src/storage/artifacts/in-memory.ts +240 -0
  676. package/src/storage/artifacts/index.ts +30 -0
  677. package/src/storage/artifacts/record.ts +200 -0
  678. package/src/storage/artifacts/types.ts +209 -0
  679. package/src/storage/auth/in-memory/auth-storage.ts +0 -18
  680. package/src/storage/auth/in-memory/magic-links.ts +0 -3
  681. package/src/storage/auth/in-memory/oidc-attempts.ts +0 -3
  682. package/src/storage/auth/in-memory/sessions.ts +22 -25
  683. package/src/storage/auth/in-memory/shared.ts +1 -10
  684. package/src/storage/auth/index.ts +2 -0
  685. package/src/storage/auth/types.ts +20 -18
  686. package/src/storage/executions/in-memory.ts +61 -1
  687. package/src/storage/executions/index.ts +3 -0
  688. package/src/storage/executions/provider.ts +12 -0
  689. package/src/storage/executions/types.ts +30 -0
  690. package/src/storage/in-memory/index.ts +16 -0
  691. package/src/storage/index.ts +63 -0
  692. package/src/storage/internal.ts +30 -0
  693. package/src/storage/ontology/in-memory/sources.ts +23 -0
  694. package/src/storage/ontology/index.ts +2 -0
  695. package/src/storage/ontology/sources.ts +17 -0
  696. package/src/storage/share-grants/in-memory.ts +8 -0
  697. package/src/storage/share-grants/index.ts +1 -0
  698. package/src/storage/share-grants/types.ts +8 -0
  699. package/src/storage/types.ts +4 -0
  700. package/src/storage/workflow-runs/in-memory.ts +16 -0
  701. package/src/storage/workflow-runs/types.ts +5 -0
  702. package/src/testing/action-run-storage-contract.ts +25 -0
  703. package/src/testing/activity-storage-contract.ts +840 -0
  704. package/src/testing/agent-storage-contract.ts +22 -21
  705. package/src/testing/artifact-storage-contract.ts +517 -0
  706. package/src/testing/auth-storage-contract.ts +61 -107
  707. package/src/testing/execution-storage-contract.ts +147 -3
  708. package/src/testing/index.ts +9 -0
  709. package/src/testing/lake-merge-storage-contract.ts +38 -0
  710. package/src/testing/lake-storage-contract.ts +247 -2
  711. package/src/testing/materializer-storage-contract.ts +1 -0
  712. package/src/testing/ontology-storage-contract.ts +57 -2
  713. package/src/testing/share-grant-storage-contract.ts +15 -0
  714. package/src/workflows/builders.ts +14 -0
  715. package/src/workflows/types.ts +9 -0
  716. package/src/workflows/validation.ts +72 -0
  717. package/dist/auth/audience.d.ts +0 -8
  718. package/dist/auth/audience.d.ts.map +0 -1
  719. package/dist/authorization/application-access.d.ts +0 -18
  720. package/dist/authorization/application-access.d.ts.map +0 -1
  721. package/dist/chunk-1f7wpmyp.js.map +0 -14
  722. package/dist/chunk-1k89ecfr.js +0 -85
  723. package/dist/chunk-1k89ecfr.js.map +0 -10
  724. package/dist/chunk-2jntasmh.js.map +0 -13
  725. package/dist/chunk-3gnrh4ve.js.map +0 -40
  726. package/dist/chunk-85yvv5n0.js.map +0 -12
  727. package/dist/chunk-9gyp8hg1.js +0 -363
  728. package/dist/chunk-9gyp8hg1.js.map +0 -14
  729. package/dist/chunk-dnmadg9k.js.map +0 -15
  730. package/dist/chunk-enpsx8k5.js.map +0 -10
  731. package/dist/chunk-hkc3jct7.js.map +0 -10
  732. package/dist/chunk-kyzq4wy9.js.map +0 -18
  733. package/dist/chunk-s16apyk9.js +0 -256
  734. package/dist/chunk-s16apyk9.js.map +0 -16
  735. package/dist/chunk-s54c868q.js.map +0 -12
  736. package/dist/chunk-tw03bsmb.js.map +0 -11
  737. package/dist/chunk-wwdfe68s.js +0 -128
  738. package/dist/chunk-wwdfe68s.js.map +0 -11
  739. package/dist/chunk-xt1zt7gv.js.map +0 -13
  740. package/dist/chunk-y7rqfrgg.js.map +0 -24
  741. package/dist/security/applications.d.ts +0 -15
  742. package/dist/security/applications.d.ts.map +0 -1
  743. package/src/auth/audience.ts +0 -28
  744. package/src/authorization/application-access.ts +0 -34
  745. package/src/security/applications.ts +0 -11
  746. /package/dist/{chunk-t6vq7bff.js.map → chunk-0bphap9y.js.map} +0 -0
  747. /package/dist/{chunk-7mbzgd9m.js.map → chunk-1cc1xaf3.js.map} +0 -0
  748. /package/dist/{chunk-6gmfggss.js.map → chunk-431pyp2c.js.map} +0 -0
  749. /package/dist/{chunk-c85m1hyj.js.map → chunk-447a5c0p.js.map} +0 -0
  750. /package/dist/{chunk-80mc0971.js.map → chunk-561r0yc9.js.map} +0 -0
  751. /package/dist/{chunk-5e43w60z.js.map → chunk-5948n82c.js.map} +0 -0
  752. /package/dist/{chunk-yzwja0mj.js.map → chunk-5hx48dnn.js.map} +0 -0
  753. /package/dist/{chunk-q1vkr2ys.js.map → chunk-c1rxbz5y.js.map} +0 -0
  754. /package/dist/{chunk-gc4ntf7d.js.map → chunk-cwdzcv37.js.map} +0 -0
  755. /package/dist/{chunk-fa02jy15.js.map → chunk-cy4mbddw.js.map} +0 -0
  756. /package/dist/{chunk-7kg3k1m9.js.map → chunk-d09e3rax.js.map} +0 -0
  757. /package/dist/{chunk-rhg02hxq.js.map → chunk-d7dnxdep.js.map} +0 -0
  758. /package/dist/{chunk-wz0xs816.js.map → chunk-ky3j490c.js.map} +0 -0
  759. /package/dist/{chunk-vyf9kfqf.js.map → chunk-q7gn29y3.js.map} +0 -0
  760. /package/dist/{chunk-v9xd5wzd.js.map → chunk-s7jg7pmn.js.map} +0 -0
  761. /package/dist/{chunk-nre82s12.js.map → chunk-vf57cr4t.js.map} +0 -0
  762. /package/dist/{chunk-9ybhtmg4.js.map → chunk-vvxtn22d.js.map} +0 -0
  763. /package/dist/{chunk-7t429e3f.js.map → chunk-xvsc5m8n.js.map} +0 -0
  764. /package/dist/{chunk-kg5j6fct.js.map → chunk-y5tah2kf.js.map} +0 -0
  765. /package/dist/{chunk-52bk93x8.js.map → chunk-z58tm0hm.js.map} +0 -0
@@ -1,256 +0,0 @@
1
- // @bun
2
- import {
3
- ACTION_RUN_PHASES2,
4
- parseActionRunFailure2
5
- } from "./chunk-b38szspf.js";
6
- import {
7
- isFileRef2
8
- } from "./chunk-jhm3zsa7.js";
9
- import {
10
- createObjectOperationScope2
11
- } from "./chunk-qczk96d9.js";
12
- import {
13
- ActionRunError2
14
- } from "./chunk-y0c4e6ex.js";
15
- import {
16
- assertJsonValue2,
17
- cloneJsonValue2,
18
- stableJsonStringify2
19
- } from "./chunk-wy0qdqfm.js";
20
-
21
- // src/storage/action-runs/idempotency.ts
22
- function actionSubjectsEqual(left, right) {
23
- if (left.kind !== right.kind)
24
- return false;
25
- if (left.kind === "none")
26
- return true;
27
- if (right.kind === "none")
28
- return false;
29
- return left.objectTypeId === right.objectTypeId && left.primaryId === right.primaryId;
30
- }
31
- function actionRunParamsEqual(left, right) {
32
- return stableJsonStringify2(left) === stableJsonStringify2(right);
33
- }
34
- function actionRunRequestsEqual(left, right) {
35
- return left.actionId === right.actionId && actionSubjectsEqual(left.subject, right.subject) && actionRunParamsEqual(left.params, right.params);
36
- }
37
- function actionRunPhaseRecordsEqual(left, right) {
38
- return actionRunParamsEqual(stripPhaseRecordCompletedAt(left), stripPhaseRecordCompletedAt(right));
39
- }
40
- function stripPhaseRecordCompletedAt(record) {
41
- const { completedAt: _completedAt, ...stableRecord } = record;
42
- return stableRecord;
43
- }
44
-
45
- // src/storage/action-runs/record.ts
46
- function normalizeRecordActionRunInput2(input) {
47
- const label = `[Sixb] Action run '${input.id}'`;
48
- for (const field of ["id", "projectId", "executionId", "actionId", "idempotencyKey"]) {
49
- if (typeof input[field] !== "string" || input[field].trim().length === 0) {
50
- throw new ActionRunError2(`${label} must have a nonblank ${field}.`);
51
- }
52
- }
53
- const status = input.status;
54
- if (status !== "succeeded" && status !== "failed") {
55
- throw new ActionRunError2(`${label} has unknown status '${status}'.`);
56
- }
57
- if (!ACTION_RUN_PHASES2.includes(input.phase)) {
58
- throw new ActionRunError2(`${label} has unknown phase '${input.phase}'.`);
59
- }
60
- if (input.phase === "effects") {
61
- throw new ActionRunError2(`${label} is recorded before its effects run.`);
62
- }
63
- const startedAt = requireDate(input.startedAt, `${label} startedAt`);
64
- const finishedAt = requireDate(input.finishedAt, `${label} finishedAt`);
65
- if (finishedAt < startedAt) {
66
- throw new ActionRunError2(`${label} cannot finish before it started.`);
67
- }
68
- assertJsonValue2(input.params, `${label} params`);
69
- const fields = {
70
- id: input.id,
71
- projectId: input.projectId,
72
- executionId: input.executionId,
73
- actionId: input.actionId,
74
- subject: structuredClone(input.subject),
75
- phase: input.phase,
76
- startedAt,
77
- finishedAt,
78
- params: structuredClone(input.params),
79
- idempotencyKey: input.idempotencyKey,
80
- ...input.writeback === undefined ? {} : { writeback: normalizeWriteback(input.writeback, label) }
81
- };
82
- if (input.status === "succeeded") {
83
- if (input.error !== undefined) {
84
- throw new ActionRunError2(`${label} succeeded, so it cannot record a failure.`);
85
- }
86
- return { ...fields, status: "succeeded" };
87
- }
88
- const error = parseActionRunFailure2(input.error, input.phase);
89
- if (error.details.runId !== input.id || error.details.actionId !== input.actionId) {
90
- throw new ActionRunError2(`${label} records the failure of another run.`);
91
- }
92
- return { ...fields, status: "failed", error };
93
- }
94
- function resolveActionRunEffects2(existing, input) {
95
- const label = `[Sixb] Action run '${input.id}'`;
96
- if (!existing) {
97
- throw new ActionRunError2(`${label} not found for project '${input.projectId}'.`);
98
- }
99
- const completedAt = requireDate(input.completedAt ?? new Date, `${label} effects`);
100
- const effects = input.status === "succeeded" ? { status: "succeeded", completedAt } : { status: "failed", completedAt, error: parseActionRunFailure2(input.error, "effects") };
101
- if (existing.effects) {
102
- if (actionRunPhaseRecordsEqual(existing.effects, effects))
103
- return { run: existing, effects: null };
104
- throw new ActionRunError2(`${label} already has a different effects record.`);
105
- }
106
- if (existing.status !== "succeeded" || existing.phase !== "commit") {
107
- throw new ActionRunError2(`${label} cannot record effects: it ended '${existing.status}' in phase '${existing.phase}'.`);
108
- }
109
- return { run: existing, effects };
110
- }
111
- function normalizeWriteback(writeback, label) {
112
- const completedAt = requireDate(writeback.completedAt, `${label} writeback`);
113
- if (writeback.status === "succeeded") {
114
- assertJsonValue2(writeback.result, `${label} writeback result`);
115
- return { status: "succeeded", completedAt, result: cloneJsonValue2(writeback.result) };
116
- }
117
- return {
118
- status: "failed",
119
- completedAt,
120
- error: parseActionRunFailure2(writeback.error, "writeback")
121
- };
122
- }
123
- function requireDate(value, label) {
124
- const date = value instanceof Date ? new Date(value) : new Date(Number.NaN);
125
- if (!Number.isFinite(date.getTime())) {
126
- throw new ActionRunError2(`${label} must be a valid date.`);
127
- }
128
- return date;
129
- }
130
-
131
- // src/storage/errors.ts
132
- class ObjectNotFoundError2 extends Error {
133
- objectTypeId;
134
- primaryId;
135
- context;
136
- name = "ObjectNotFoundError";
137
- constructor(objectTypeId, primaryId, context) {
138
- super(`[Sixb] ${context}: ${objectTypeId}:${primaryId}`);
139
- this.objectTypeId = objectTypeId;
140
- this.primaryId = primaryId;
141
- this.context = context;
142
- }
143
- }
144
-
145
- class ObjectStorageError2 extends Error {
146
- name = "ObjectStorageError";
147
- }
148
-
149
- class StorageTransactionError2 extends Error {
150
- name = "StorageTransactionError";
151
- code;
152
- cause;
153
- constructor(message, options = {}) {
154
- super(message);
155
- this.code = options.code;
156
- this.cause = options.cause;
157
- }
158
- }
159
- function isStorageSerializationFailure2(error) {
160
- return error instanceof StorageTransactionError2 && error.code === "serialization_failure";
161
- }
162
-
163
- // src/storage/file-download-grants/record.ts
164
- function parseFileDownloadGrantRow2(row) {
165
- const id = text(row.id, "id", String(row.id));
166
- const file = typeof row.file === "string" ? JSON.parse(row.file) : row.file;
167
- if (!isFileRef2(file))
168
- throw corrupt(id, "file is not a file reference");
169
- return {
170
- id,
171
- projectId: text(row.projectId, "projectId", id),
172
- tokenHash: text(row.tokenHash, "tokenHash", id),
173
- file,
174
- executionId: text(row.executionId, "executionId", id),
175
- createdAt: date(row.createdAt, "createdAt", id),
176
- expiresAt: date(row.expiresAt, "expiresAt", id),
177
- ...row.revokedAt == null ? {} : { revokedAt: date(row.revokedAt, "revokedAt", id) }
178
- };
179
- }
180
- function cloneFileDownloadGrantRecord(record) {
181
- return structuredClone(record);
182
- }
183
- function text(value, column, id) {
184
- if (typeof value !== "string" || value.length === 0)
185
- throw corrupt(id, `${column} is not text`);
186
- return value;
187
- }
188
- function date(value, column, id) {
189
- const parsed = value instanceof Date || typeof value === "string" ? new Date(value) : null;
190
- if (!parsed || !Number.isFinite(parsed.getTime()))
191
- throw corrupt(id, `${column} is not a date`);
192
- return parsed;
193
- }
194
- function corrupt(id, reason) {
195
- return new Error(`[Sixb] Stored file download grant '${id}' is invalid: ${reason}.`);
196
- }
197
-
198
- // src/storage/pipeline-runs/idempotency.ts
199
- function canRequeuePipelineRunAfterEnqueueFailure2(existing, input) {
200
- return existing.status === "failed" && existing.error?.code === "queue.enqueue_failed" && existing.error.retryable && existing.executionId === input.executionId && existing.pipelineId === input.pipelineId;
201
- }
202
-
203
- // src/storage/sync-runs/idempotency.ts
204
- function canRequeueSyncRunAfterEnqueueFailure2(existing, input) {
205
- return existing.status === "failed" && existing.error?.code === "queue.enqueue_failed" && existing.error.retryable && existing.executionId === input.executionId && existing.syncId === input.syncId && existing.datasetId === input.datasetId && existing.mode === input.mode && existing.expectedLatestVersionId === input.expectedLatestVersionId && existing.commitMessage === input.commitMessage;
206
- }
207
-
208
- // src/storage/transaction.ts
209
- function createTransactionStorageProxy2(target, isActive) {
210
- const proxies = new WeakMap;
211
- const objectStorage = createObjectOperationScope2(target.objects, {
212
- assertAvailable: () => assertTransactionActive2(isActive),
213
- run: async (operation) => {
214
- assertTransactionActive2(isActive);
215
- return operation();
216
- }
217
- });
218
- const wrap = (value) => {
219
- const existing = proxies.get(value);
220
- if (existing)
221
- return existing;
222
- const proxy = new Proxy(value, {
223
- get(current, property, receiver) {
224
- assertTransactionActive2(isActive);
225
- const result = current === target && property === "objects" ? objectStorage : Reflect.get(current, property, receiver);
226
- if (typeof result === "function") {
227
- return (...args) => {
228
- assertTransactionActive2(isActive);
229
- return result.apply(current, args);
230
- };
231
- }
232
- if (result && typeof result === "object") {
233
- return wrap(result);
234
- }
235
- return result;
236
- }
237
- });
238
- proxies.set(value, proxy);
239
- return proxy;
240
- };
241
- return wrap(target);
242
- }
243
- function assertTransactionActive2(isActive) {
244
- if (!isActive()) {
245
- throw new StorageTransactionError2("[Sixb] Transaction storage cannot be used after transaction completion.", { code: "transaction_inactive" });
246
- }
247
- }
248
- function throwNestedStorageTransaction2() {
249
- throw new StorageTransactionError2("[Sixb] Nested storage transactions are not supported yet.", {
250
- code: "nested_transaction"
251
- });
252
- }
253
-
254
- export { actionSubjectsEqual, actionRunRequestsEqual, normalizeRecordActionRunInput2, resolveActionRunEffects2, ObjectNotFoundError2, ObjectStorageError2, StorageTransactionError2, isStorageSerializationFailure2, parseFileDownloadGrantRow2, cloneFileDownloadGrantRecord, canRequeuePipelineRunAfterEnqueueFailure2, canRequeueSyncRunAfterEnqueueFailure2, createTransactionStorageProxy2, assertTransactionActive2, throwNestedStorageTransaction2 };
255
-
256
- //# debugId=B710291DEE8F3A1864756E2164756E21
@@ -1,16 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/storage/action-runs/idempotency.ts", "../src/storage/action-runs/record.ts", "../src/storage/errors.ts", "../src/storage/file-download-grants/record.ts", "../src/storage/pipeline-runs/idempotency.ts", "../src/storage/sync-runs/idempotency.ts", "../src/storage/transaction.ts"],
4
- "sourcesContent": [
5
- "import type { ActionSubject } from \"../../actions\"\nimport { stableJsonStringify } from \"../../json\"\nimport type { ActionRunEffectsRecord, ActionRunRecord, ActionRunWritebackRecord } from \"./types\"\n\nexport function actionSubjectsEqual(left: ActionSubject, right: ActionSubject): boolean {\n if (left.kind !== right.kind) return false\n if (left.kind === \"none\") return true\n if (right.kind === \"none\") return false\n return left.objectTypeId === right.objectTypeId && left.primaryId === right.primaryId\n}\n\nexport function actionRunParamsEqual(left: unknown, right: unknown): boolean {\n return stableJsonStringify(left) === stableJsonStringify(right)\n}\n\n/** Whether two runs carry the same request: the same Action, subject, and params. */\nexport function actionRunRequestsEqual(\n left: Pick<ActionRunRecord, \"actionId\" | \"subject\" | \"params\">,\n right: Pick<ActionRunRecord, \"actionId\" | \"subject\" | \"params\">\n): boolean {\n return (\n left.actionId === right.actionId &&\n actionSubjectsEqual(left.subject, right.subject) &&\n actionRunParamsEqual(left.params, right.params)\n )\n}\n\nexport type ActionRunPhaseRecord = ActionRunWritebackRecord | ActionRunEffectsRecord\n\nexport function actionRunPhaseRecordsEqual(\n left: ActionRunPhaseRecord,\n right: ActionRunPhaseRecord\n): boolean {\n return actionRunParamsEqual(stripPhaseRecordCompletedAt(left), stripPhaseRecordCompletedAt(right))\n}\n\nfunction stripPhaseRecordCompletedAt(\n record: ActionRunPhaseRecord\n): Omit<ActionRunPhaseRecord, \"completedAt\"> {\n const { completedAt: _completedAt, ...stableRecord } = record\n return stableRecord\n}\n",
6
- "import { assertJsonValue, cloneJsonValue } from \"../../json\"\nimport { ActionRunError } from \"./errors\"\nimport { parseActionRunFailure } from \"./failure\"\nimport { actionRunPhaseRecordsEqual } from \"./idempotency\"\nimport type {\n ActionRunEffectsRecord,\n ActionRunRecord,\n ActionRunWritebackRecord,\n RecordActionEffectsInput,\n RecordActionRunInput,\n} from \"./types\"\nimport { ACTION_RUN_PHASES } from \"./types\"\n\n/**\n * Validate a terminal run record before a provider inserts it, and detach it from the caller.\n *\n * Every provider records through this, so a stored run always reads back as the record that was\n * written: a failed run carries the failure of the phase it ended in, and a succeeded one none. A\n * run is recorded before its effects run, so no record starts in the `effects` phase.\n */\nexport function normalizeRecordActionRunInput(input: RecordActionRunInput): RecordActionRunInput {\n const label = `[Sixb] Action run '${input.id}'`\n for (const field of [\"id\", \"projectId\", \"executionId\", \"actionId\", \"idempotencyKey\"] as const) {\n if (typeof input[field] !== \"string\" || input[field].trim().length === 0) {\n throw new ActionRunError(`${label} must have a nonblank ${field}.`)\n }\n }\n const status: string = input.status\n if (status !== \"succeeded\" && status !== \"failed\") {\n throw new ActionRunError(`${label} has unknown status '${status}'.`)\n }\n if (!(ACTION_RUN_PHASES as readonly string[]).includes(input.phase)) {\n throw new ActionRunError(`${label} has unknown phase '${input.phase}'.`)\n }\n if (input.phase === \"effects\") {\n throw new ActionRunError(`${label} is recorded before its effects run.`)\n }\n const startedAt = requireDate(input.startedAt, `${label} startedAt`)\n const finishedAt = requireDate(input.finishedAt, `${label} finishedAt`)\n if (finishedAt < startedAt) {\n throw new ActionRunError(`${label} cannot finish before it started.`)\n }\n assertJsonValue(input.params, `${label} params`)\n\n const fields = {\n id: input.id,\n projectId: input.projectId,\n executionId: input.executionId,\n actionId: input.actionId,\n subject: structuredClone(input.subject),\n phase: input.phase,\n startedAt,\n finishedAt,\n params: structuredClone(input.params),\n idempotencyKey: input.idempotencyKey,\n ...(input.writeback === undefined\n ? {}\n : { writeback: normalizeWriteback(input.writeback, label) }),\n }\n\n if (input.status === \"succeeded\") {\n if (input.error !== undefined) {\n throw new ActionRunError(`${label} succeeded, so it cannot record a failure.`)\n }\n return { ...fields, status: \"succeeded\" }\n }\n const error = parseActionRunFailure(input.error, input.phase)\n if (error.details.runId !== input.id || error.details.actionId !== input.actionId) {\n throw new ActionRunError(`${label} records the failure of another run.`)\n }\n return { ...fields, status: \"failed\", error }\n}\n\n/**\n * Resolve what recording effects does to the stored run: write `effects`, or nothing (`null`) when\n * an equal outcome is already recorded.\n *\n * Effects run only after a succeeded run committed its edits, and their outcome is recorded once.\n */\nexport function resolveActionRunEffects(\n existing: ActionRunRecord | null,\n input: RecordActionEffectsInput\n): { readonly run: ActionRunRecord; readonly effects: ActionRunEffectsRecord | null } {\n const label = `[Sixb] Action run '${input.id}'`\n if (!existing) {\n throw new ActionRunError(`${label} not found for project '${input.projectId}'.`)\n }\n const completedAt = requireDate(input.completedAt ?? new Date(), `${label} effects`)\n const effects: ActionRunEffectsRecord =\n input.status === \"succeeded\"\n ? { status: \"succeeded\", completedAt }\n : { status: \"failed\", completedAt, error: parseActionRunFailure(input.error, \"effects\") }\n\n if (existing.effects) {\n if (actionRunPhaseRecordsEqual(existing.effects, effects))\n return { run: existing, effects: null }\n throw new ActionRunError(`${label} already has a different effects record.`)\n }\n if (existing.status !== \"succeeded\" || existing.phase !== \"commit\") {\n throw new ActionRunError(\n `${label} cannot record effects: it ended '${existing.status}' in phase '${existing.phase}'.`\n )\n }\n return { run: existing, effects }\n}\n\nfunction normalizeWriteback(\n writeback: ActionRunWritebackRecord,\n label: string\n): ActionRunWritebackRecord {\n const completedAt = requireDate(writeback.completedAt, `${label} writeback`)\n if (writeback.status === \"succeeded\") {\n assertJsonValue(writeback.result, `${label} writeback result`)\n return { status: \"succeeded\", completedAt, result: cloneJsonValue(writeback.result) }\n }\n return {\n status: \"failed\",\n completedAt,\n error: parseActionRunFailure(writeback.error, \"writeback\"),\n }\n}\n\n/** A detached copy of `value`, which must be a valid date. */\nfunction requireDate(value: Date, label: string): Date {\n const date = value instanceof Date ? new Date(value) : new Date(Number.NaN)\n if (!Number.isFinite(date.getTime())) {\n throw new ActionRunError(`${label} must be a valid date.`)\n }\n return date\n}\n",
7
- "/**\n * Thrown when a storage lookup by primary ID finds no matching object.\n * Carries structured context so callers can discriminate without string parsing.\n */\nexport class ObjectNotFoundError extends Error {\n readonly name = \"ObjectNotFoundError\"\n\n constructor(\n readonly objectTypeId: string,\n readonly primaryId: string,\n readonly context: string\n ) {\n super(`[Sixb] ${context}: ${objectTypeId}:${primaryId}`)\n }\n}\n\nexport class ObjectStorageError extends Error {\n readonly name = \"ObjectStorageError\"\n}\n\nexport type StorageTransactionErrorCode =\n | \"nested_transaction\"\n | \"serialization_failure\"\n | \"transaction_inactive\"\n\nexport interface StorageTransactionErrorOptions {\n readonly cause?: unknown\n readonly code?: StorageTransactionErrorCode\n}\n\nexport class StorageTransactionError extends Error {\n readonly name = \"StorageTransactionError\"\n readonly code?: StorageTransactionErrorCode\n override readonly cause?: unknown\n\n constructor(message: string, options: StorageTransactionErrorOptions = {}) {\n super(message)\n this.code = options.code\n this.cause = options.cause\n }\n}\n\nexport function isStorageSerializationFailure(error: unknown): boolean {\n return error instanceof StorageTransactionError && error.code === \"serialization_failure\"\n}\n",
8
- "import { isFileRef } from \"../../blob-storage\"\nimport type { FileDownloadGrantRecord } from \"./types\"\n\n/**\n * Rebuilds a grant from a provider row with camelCase keys. `file` may arrive parsed (jsonb) or\n * as text (SQLite), and timestamps as `Date` or ISO text. Fails closed on corruption: a grant that\n * cannot be read must not serve a file.\n */\nexport function parseFileDownloadGrantRow(row: {\n readonly [column: string]: unknown\n}): FileDownloadGrantRecord {\n const id = text(row.id, \"id\", String(row.id))\n const file = typeof row.file === \"string\" ? JSON.parse(row.file) : row.file\n if (!isFileRef(file)) throw corrupt(id, \"file is not a file reference\")\n\n return {\n id,\n projectId: text(row.projectId, \"projectId\", id),\n tokenHash: text(row.tokenHash, \"tokenHash\", id),\n file,\n executionId: text(row.executionId, \"executionId\", id),\n createdAt: date(row.createdAt, \"createdAt\", id),\n expiresAt: date(row.expiresAt, \"expiresAt\", id),\n ...(row.revokedAt == null ? {} : { revokedAt: date(row.revokedAt, \"revokedAt\", id) }),\n }\n}\n\nexport function cloneFileDownloadGrantRecord(\n record: FileDownloadGrantRecord\n): FileDownloadGrantRecord {\n return structuredClone(record)\n}\n\nfunction text(value: unknown, column: string, id: string): string {\n if (typeof value !== \"string\" || value.length === 0) throw corrupt(id, `${column} is not text`)\n return value\n}\n\nfunction date(value: unknown, column: string, id: string): Date {\n const parsed = value instanceof Date || typeof value === \"string\" ? new Date(value) : null\n if (!parsed || !Number.isFinite(parsed.getTime())) throw corrupt(id, `${column} is not a date`)\n return parsed\n}\n\nfunction corrupt(id: string, reason: string): Error {\n return new Error(`[Sixb] Stored file download grant '${id}' is invalid: ${reason}.`)\n}\n",
9
- "import type { PipelineRunRecord, QueuePipelineRunInput } from \"./types\"\n\nexport function canRequeuePipelineRunAfterEnqueueFailure(\n existing: PipelineRunRecord,\n input: QueuePipelineRunInput\n): boolean {\n return (\n existing.status === \"failed\" &&\n existing.error?.code === \"queue.enqueue_failed\" &&\n existing.error.retryable &&\n existing.executionId === input.executionId &&\n existing.pipelineId === input.pipelineId\n )\n}\n",
10
- "import type { QueueSyncRunInput, SyncRunRecord } from \"./types\"\n\nexport function canRequeueSyncRunAfterEnqueueFailure(\n existing: SyncRunRecord,\n input: QueueSyncRunInput\n): boolean {\n return (\n existing.status === \"failed\" &&\n existing.error?.code === \"queue.enqueue_failed\" &&\n existing.error.retryable &&\n existing.executionId === input.executionId &&\n existing.syncId === input.syncId &&\n existing.datasetId === input.datasetId &&\n existing.mode === input.mode &&\n existing.expectedLatestVersionId === input.expectedLatestVersionId &&\n existing.commitMessage === input.commitMessage\n )\n}\n",
11
- "import { StorageTransactionError } from \"./errors\"\nimport { createObjectOperationScope } from \"./operation-scope\"\nimport type { Storage } from \"./types\"\n\ntype ObjectLike = Record<PropertyKey, unknown>\n\nexport function createTransactionStorageProxy<T extends Storage>(\n target: T,\n isActive: () => boolean\n): T {\n const proxies = new WeakMap<object, object>()\n const objectStorage = createObjectOperationScope(target.objects, {\n assertAvailable: () => assertTransactionActive(isActive),\n run: async <TResult>(operation: () => Promise<TResult> | TResult): Promise<TResult> => {\n assertTransactionActive(isActive)\n return operation()\n },\n })\n\n const wrap = <TValue extends object>(value: TValue): TValue => {\n const existing = proxies.get(value)\n if (existing) return existing as TValue\n\n const proxy = new Proxy(value as ObjectLike, {\n // The guard runs on property access and on call. Its purpose is to fail fast when a\n // transaction handle (`tx`) leaks past the transaction's lifetime — using it afterward is a\n // bug, not a recoverable state. Overhead is bounded: only the storage namespaces reachable\n // from `tx` are wrapped (a handful), not the row/link data graph, and never per-record.\n get(current, property, receiver) {\n assertTransactionActive(isActive)\n const result =\n current === target && property === \"objects\"\n ? objectStorage\n : Reflect.get(current, property, receiver)\n if (typeof result === \"function\") {\n return (...args: unknown[]) => {\n assertTransactionActive(isActive)\n return result.apply(current, args)\n }\n }\n if (result && typeof result === \"object\") {\n return wrap(result)\n }\n return result\n },\n })\n\n proxies.set(value, proxy)\n return proxy as TValue\n }\n\n return wrap(target)\n}\n\nexport function assertTransactionActive(isActive: () => boolean): void {\n if (!isActive()) {\n throw new StorageTransactionError(\n \"[Sixb] Transaction storage cannot be used after transaction completion.\",\n { code: \"transaction_inactive\" }\n )\n }\n}\n\nexport function throwNestedStorageTransaction(): never {\n throw new StorageTransactionError(\"[Sixb] Nested storage transactions are not supported yet.\", {\n code: \"nested_transaction\",\n })\n}\n"
12
- ],
13
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,mBAAmB,CAAC,MAAqB,OAA+B;AAAA,EACtF,IAAI,KAAK,SAAS,MAAM;AAAA,IAAM,OAAO;AAAA,EACrC,IAAI,KAAK,SAAS;AAAA,IAAQ,OAAO;AAAA,EACjC,IAAI,MAAM,SAAS;AAAA,IAAQ,OAAO;AAAA,EAClC,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,KAAK,cAAc,MAAM;AAAA;AAGvE,SAAS,oBAAoB,CAAC,MAAe,OAAyB;AAAA,EAC3E,OAAO,qBAAoB,IAAI,MAAM,qBAAoB,KAAK;AAAA;AAIzD,SAAS,sBAAsB,CACpC,MACA,OACS;AAAA,EACT,OACE,KAAK,aAAa,MAAM,YACxB,oBAAoB,KAAK,SAAS,MAAM,OAAO,KAC/C,qBAAqB,K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YAAY,UAAU,aAAa,YAC/B,gBACA,QAAQ,IAAI,SAAS,UAAU,QAAQ;AAAA,QAC7C,IAAI,OAAO,WAAW,YAAY;AAAA,UAChC,OAAO,IAAI,SAAoB;AAAA,YAC7B,yBAAwB,QAAQ;AAAA,YAChC,OAAO,OAAO,MAAM,SAAS,IAAI;AAAA;AAAA,QAErC;AAAA,QACA,IAAI,UAAU,OAAO,WAAW,UAAU;AAAA,UACxC,OAAO,KAAK,MAAM;AAAA,QACpB;AAAA,QACA,OAAO;AAAA;AAAA,IAEX,CAAC;AAAA,IAED,QAAQ,IAAI,OAAO,KAAK;AAAA,IACxB,OAAO;AAAA;AAAA,EAGT,OAAO,KAAK,MAAM;AAAA;AAGb,SAAS,wBAAuB,CAAC,UAA+B;AAAA,EACrE,IAAI,CAAC,SAAS,GAAG;AAAA,IACf,MAAM,IAAI,yBACR,2EACA,EAAE,MAAM,uBAAuB,CACjC;AAAA,EACF;AAAA;AAGK,SAAS,8BAA6B,GAAU;AAAA,EACrD,MAAM,IAAI,yBAAwB,6DAA6D;AAAA,IAC7F,MAAM;AAAA,EACR,CAAC;AAAA;",
14
- "debugId": "B710291DEE8F3A1864756E2164756E21",
15
- "names": []
16
- }
@@ -1,12 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/storage/agents/provider.ts", "../src/agents/types.ts", "../src/storage/agents/errors.ts"],
4
- "sourcesContent": [
5
- "import { isDeepStrictEqual } from \"node:util\"\nimport { AGENT_REASONING_LEVELS } from \"../../agents/types\"\nimport { isFileRef } from \"../../blob-storage\"\nimport { isJsonObject, isPlainRecord } from \"../../json\"\nimport { isModelReasoning } from \"../../models/language-model\"\nimport type { ExecutionRecord, ExecutionStorage } from \"../executions\"\nimport { findAgentRunExecution } from \"../executions/run-link\"\nimport { AgentStorageError } from \"./errors\"\nimport type {\n AgentContextCheckpointRecord,\n AgentMessageRecord,\n AgentRunRecord,\n AgentThreadRecord,\n AgentThreadSandboxParams,\n AgentThreadSandboxState,\n ConversationAgentRunSpec,\n CreateAgentContextCheckpointInput,\n CreateSubagentRunInput,\n SubagentRunRecord,\n SubagentRunResult,\n TransitionAgentThreadSandboxInput,\n} from \"./types\"\n\n/** Shared state machine. Providers must lock the run, then thread, around this decision/write. */\nexport function transitionAgentThreadSandbox(\n thread: AgentThreadRecord | null,\n run: AgentRunRecord | null,\n input: TransitionAgentThreadSandboxInput\n): AgentThreadSandboxState {\n const fail = (message: string): never => {\n throw new AgentStorageError(\"invalid_state\", `[Sixb] Sandbox ${message}`)\n }\n if (!thread?.sandboxParams) return fail(\"is not configured on this thread.\")\n if (!/^[a-zA-Z0-9-]{1,80}$/.test(input.name)) return fail(\"name is invalid.\")\n const state = thread.sandboxState\n if (input.action === \"recreate\") {\n if (thread.activeRunId !== null) return fail(\"cannot be recreated during an active run.\")\n if (!state || state.name !== input.expectedSandboxName || input.name === state.name)\n return fail(\"changed; reload before recreating.\")\n if (![\"busy\", \"blocked\", \"unavailable\"].includes(state.status)) {\n return fail(\"does not require recovery.\")\n }\n return {\n name: input.name,\n status: \"new\",\n initialized: false,\n resetAt: new Date().toISOString(),\n }\n }\n if (\n run?.kind !== \"conversation\" ||\n run.threadId !== thread.id ||\n run.status !== \"running\" ||\n thread.activeRunId !== run.id ||\n run.id !== input.runId ||\n run.execution?.token !== input.executionToken ||\n run.execution.queueLeaseExpiresAt.getTime() <= Date.now()\n ) {\n throw new AgentStorageError(\"execution_lost\", \"[Sixb] Sandbox execution ownership was lost.\")\n }\n if (input.action === \"acquire\") {\n if (state && state.status !== \"new\" && state.status !== \"ready\") {\n return fail(\"requires recovery; previous operations may still be in flight.\")\n }\n if (state && state.name !== input.name) return fail(\"name changed.\")\n if (!/^[a-f0-9]{64}$/.test(input.sourceFingerprint))\n return fail(\"source fingerprint is invalid.\")\n if (state?.sourceFingerprint && state.sourceFingerprint !== input.sourceFingerprint) {\n return fail(\"source identity changed; the existing checkout was not opened.\")\n }\n return {\n name: input.name,\n status: \"busy\",\n initialized: state?.initialized ?? false,\n ...(state?.resetAt ? { resetAt: state.resetAt } : {}),\n sourceFingerprint: input.sourceFingerprint,\n owner: { runId: input.runId, executionToken: input.executionToken },\n }\n }\n if (\n state?.status !== \"busy\" ||\n state.name !== input.name ||\n state.owner?.runId !== input.runId ||\n state.owner.executionToken !== input.executionToken\n ) {\n return fail(\"is not owned by this execution.\")\n }\n if (input.action === \"replace\") {\n if (\n !state.initialized ||\n input.nextName === state.name ||\n !/^[a-zA-Z0-9-]{1,80}$/.test(input.nextName)\n ) {\n return fail(\"replacement requires initialized state and a fresh valid name.\")\n }\n // Only the owning worker may report confirmed loss; retain its fence across replacement.\n return {\n ...state,\n name: input.nextName,\n initialized: false,\n resetAt: new Date().toISOString(),\n }\n }\n if (input.status === \"ready\" && !input.initialized) return fail(\"initialization is incomplete.\")\n return {\n name: state.name,\n status: input.status,\n initialized: input.initialized,\n sourceFingerprint: state.sourceFingerprint,\n ...(state.resetAt ? { resetAt: state.resetAt } : {}),\n }\n}\n\n/** Snapshot application parameters independently of worker-owned sandbox state. */\nexport function snapshotAgentThreadSandboxParams(value: unknown): AgentThreadSandboxParams {\n if (!isPlainRecord(value) || !isJsonObject(value)) {\n throw new AgentStorageError(\n \"invalid_input\",\n \"[Sixb] Thread sandbox must contain only JSON params.\"\n )\n }\n return structuredClone(value)\n}\n\n/** Validate the provider-neutral model selection captured for a conversational turn. */\nexport function assertConversationAgentRunSpec(\n spec: ConversationAgentRunSpec,\n prefix = \"Sixb\"\n): void {\n if (!isRecord(spec) || !isRecord(spec.model)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent run spec must contain a model reference.`\n )\n }\n for (const [name, value] of [\n [\"model.provider\", spec.model.provider],\n [\"model.modelId\", spec.model.modelId],\n ] as const) {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent run '${name}' must not be empty.`\n )\n }\n }\n if (spec.reasoning !== undefined && !isModelReasoning(spec.reasoning)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent reasoning must be one of: ${AGENT_REASONING_LEVELS.join(\", \")}, or a nonnegative budgetTokens object.`\n )\n }\n for (const [name, value] of [\n [\"timeZone\", spec.timeZone],\n [\"locale\", spec.locale],\n ] as const) {\n if (value !== undefined && (typeof value !== \"string\" || value.trim().length === 0)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Conversational Agent run '${name}' must be a non-empty string.`\n )\n }\n }\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\n/** Validate the semantic link between a conversational Agent run and its immutable execution. */\nexport async function assertAgentRunExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n}): Promise<ExecutionRecord> {\n const execution = await findAgentRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n runId: input.runId,\n authority: { type: \"inherited\" },\n })\n if (!execution) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[Sixb] Execution '${input.executionId}' does not authorize Agent run '${input.runId}'.`\n )\n }\n return execution\n}\n\n/** Validate the provider-neutral payload of an idempotent child admission. */\nexport function assertCreateSubagentRunInput(input: CreateSubagentRunInput, prefix = \"Sixb\"): void {\n for (const [name, value] of [\n [\"id\", input.id],\n [\"projectId\", input.projectId],\n [\"executionId\", input.executionId],\n [\"parentRunId\", input.parentRunId],\n [\"parentExecutionToken\", input.parentExecutionToken],\n [\"spawnKey\", input.spawnKey],\n [\"model.provider\", input.spec.model.provider],\n [\"model.modelId\", input.spec.model.modelId],\n [\"task\", input.spec.task],\n ] as const) {\n if (value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${name}' must not be empty.`\n )\n }\n }\n if (input.spawnKey.length > 128) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent spawn key must not exceed 128 characters.`\n )\n }\n for (const [name, value] of [\n [\"maxActiveChildren\", input.maxActiveChildren],\n [\"spec.maxSteps\", input.spec.maxSteps],\n ] as const) {\n if (!Number.isSafeInteger(value) || value < 1) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${name}' must be a positive safe integer.`\n )\n }\n }\n if (new Set(input.spec.toolNames).size !== input.spec.toolNames.length) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run tool names must be unique.`\n )\n }\n if (input.spec.reasoning !== undefined && !isModelReasoning(input.spec.reasoning)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent reasoning must be one of: ${AGENT_REASONING_LEVELS.join(\", \")}, or a nonnegative budgetTokens object.`\n )\n }\n if (input.spec.toolNames.some((name) => !name.trim())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run tool names must not be empty.`\n )\n }\n if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run createdAt must be a valid date.`\n )\n }\n}\n\n/** Exact semantic match required when a durable spawn key is replayed. */\nexport function subagentRunMatchesCreateInput(\n run: AgentRunRecord,\n input: CreateSubagentRunInput\n): run is SubagentRunRecord {\n return (\n run.kind === \"subagent\" &&\n run.id === input.id &&\n run.projectId === input.projectId &&\n run.executionId === input.executionId &&\n run.parentRunId === input.parentRunId &&\n run.spawnKey === input.spawnKey &&\n isDeepStrictEqual(run.spec, input.spec)\n )\n}\n\n/** Validate the small durable result returned by a successful child. */\nexport function assertSubagentRunResult(\n result: SubagentRunResult | undefined,\n runId: string,\n prefix = \"Sixb\"\n): asserts result is SubagentRunResult {\n const text = result?.text\n const files = result?.files\n const hasText = typeof text === \"string\" && text.trim().length > 0\n const hasFiles = Array.isArray(files) && files.length > 0 && files.every(isFileRef)\n if (!result || (!hasText && !hasFiles)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Succeeded subagent run '${runId}' requires text or files.`\n )\n }\n if ((text !== undefined && !hasText) || (files !== undefined && !hasFiles)) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Subagent run '${runId}' has an invalid result.`\n )\n }\n}\n\n/** Validate provider-independent checkpoint fields before entering a storage critical section. */\nexport function assertCreateAgentContextCheckpointInput(\n input: CreateAgentContextCheckpointInput,\n prefix = \"Sixb\"\n): void {\n for (const [name, value] of [\n [\"id\", input.id],\n [\"projectId\", input.projectId],\n [\"threadId\", input.threadId],\n [\"createdByRunId\", input.createdByRunId],\n [\"executionToken\", input.executionToken],\n [\"summary\", input.summary],\n [\"summaryModelId\", input.summaryModelId],\n ] as const) {\n if (value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must not be empty.`\n )\n }\n }\n\n if (input.summaryFormatVersion !== 1) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint summary format version must be 1.`\n )\n }\n if (input.reason !== \"threshold\" && input.reason !== \"overflow\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint reason must be 'threshold' or 'overflow'.`\n )\n }\n if (\n input.expectedPreviousCheckpointId !== null &&\n input.expectedPreviousCheckpointId.trim().length === 0\n ) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint expected previous id must not be empty.`\n )\n }\n if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint createdAt must be a valid date.`\n )\n }\n\n for (const [name, value, minimum] of [\n [\"expectedHeadSeq\", input.expectedHeadSeq, 1],\n [\"summarizedThroughSeq\", input.summarizedThroughSeq, 1],\n [\"observedHeadSeq\", input.observedHeadSeq, 1],\n [\"estimatedInputTokensBefore\", input.estimatedInputTokensBefore, 0],\n [\"estimatedInputTokensAfter\", input.estimatedInputTokensAfter, 0],\n ] as const) {\n if (!Number.isSafeInteger(value) || value < minimum) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must be a safe integer greater than or equal to ${minimum}.`\n )\n }\n }\n\n if (input.observedHeadSeq !== input.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint observed head must equal its expected message head.`\n )\n }\n if (input.summarizedThroughSeq >= input.observedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain the triggering head message.`\n )\n }\n}\n\n/** Assert that the current delivery still owns the active conversational run. */\nexport function assertAgentContextCheckpointAuthority(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly run: AgentRunRecord | null\n readonly thread: AgentThreadRecord | null\n readonly prefix?: string\n}): asserts input is typeof input & {\n readonly run: AgentRunRecord\n readonly thread: AgentThreadRecord\n} {\n const { create, run, thread } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (!run) {\n throw new AgentStorageError(\n \"run_not_found\",\n `[${prefix}] Agent run '${create.createdByRunId}' not found for project '${create.projectId}'.`\n )\n }\n if (!thread) {\n throw new AgentStorageError(\n \"thread_not_found\",\n `[${prefix}] Agent thread '${create.threadId}' not found for project '${create.projectId}'.`\n )\n }\n if (run.kind !== \"conversation\" || run.threadId !== create.threadId) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent run '${run.id}' does not belong to thread '${create.threadId}'.`\n )\n }\n if (run.status !== \"running\") {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' is not running (status '${run.status}').`\n )\n }\n if (!run.execution || run.execution.token !== create.executionToken) {\n throw new AgentStorageError(\n \"execution_lost\",\n `[${prefix}] Execution token is no longer current on agent run '${run.id}'.`\n )\n }\n if (thread.activeRunId !== run.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' no longer owns thread '${thread.id}'.`\n )\n }\n}\n\n/** Assert both compare-and-swap anchors and the retained-turn boundary. */\nexport function assertAgentContextCheckpointAnchors(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly firstRetained: AgentMessageRecord | null\n readonly prefix?: string\n}): void {\n const { create, latest, headSeq, firstRetained } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (headSeq !== create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' message head changed from ${create.expectedHeadSeq} to ${headSeq}.`\n )\n }\n\n const latestId = latest?.id ?? null\n if (latestId !== create.expectedPreviousCheckpointId) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' checkpoint head changed.`\n )\n }\n if (latest && create.summarizedThroughSeq <= latest.summarizedThroughSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint boundary must advance beyond sequence ${latest.summarizedThroughSeq}.`\n )\n }\n if (!firstRetained || firstRetained.seq !== create.summarizedThroughSeq + 1) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent context checkpoint boundary does not align with stored thread messages.`\n )\n }\n if (firstRetained.role !== \"user\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain a complete turn beginning with a user message.`\n )\n }\n}\n\n/** Validate the mutable anchors again before returning an idempotently created checkpoint. */\nexport function assertAgentContextCheckpointReplayState(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly existing: AgentContextCheckpointRecord\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly prefix?: string\n}): void {\n const prefix = input.prefix ?? \"Sixb\"\n if (input.headSeq !== input.create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' message head changed from ${input.create.expectedHeadSeq} to ${input.headSeq}.`\n )\n }\n if (input.latest?.id !== input.existing.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' checkpoint head changed after '${input.existing.id}'.`\n )\n }\n}\n\n/** Compare the durable semantic payload; delivery token and generated timestamp are not content. */\nexport function agentContextCheckpointMatchesCreateInput(\n record: AgentContextCheckpointRecord,\n input: CreateAgentContextCheckpointInput\n): boolean {\n return (\n record.id === input.id &&\n record.projectId === input.projectId &&\n record.threadId === input.threadId &&\n record.createdByRunId === input.createdByRunId &&\n (record.previousCheckpointId ?? null) === input.expectedPreviousCheckpointId &&\n record.reason === input.reason &&\n record.summary === input.summary &&\n record.summaryFormatVersion === input.summaryFormatVersion &&\n record.summarizedThroughSeq === input.summarizedThroughSeq &&\n record.observedHeadSeq === input.observedHeadSeq &&\n record.estimatedInputTokensBefore === input.estimatedInputTokensBefore &&\n record.estimatedInputTokensAfter === input.estimatedInputTokensAfter &&\n record.summaryModelId === input.summaryModelId\n )\n}\n",
6
- "import type { ActionsRuntime } from \"../actions/execution\"\nimport type { BlobBody, FileRef, OpenedFileRef } from \"../blob-storage\"\nimport type { ConnectorRuntime } from \"../connectors\"\nimport type { JsonPrimitive, JsonValue, ReadonlyJsonValue } from \"../json\"\nimport type { Logger } from \"../logging\"\nimport { type LanguageModelRef, MODEL_REASONING_LEVELS, type ModelReasoning } from \"../models\"\nimport type { ModelsRuntime } from \"../models/generation-types\"\nimport type { InferSchema } from \"../ontology/inference\"\nimport type { Schema } from \"../ontology/types\"\nimport type { ObjectReader } from \"../runtime/types\"\n\nexport type {\n AgentContextEntryInput,\n AgentContextInput,\n AgentContextOrigin,\n AgentContextPart,\n} from \"./context/entries\"\n\n/** Public capability reference used by security grants such as `can.run(agent)`. */\nexport interface AgentReference {\n readonly kind: \"agent\"\n readonly usage: AgentUsageReference\n}\n\n/** Project-wide AI accounting and limit capability, independent of permission to run the Agent. */\nexport interface AgentUsageReference {\n readonly kind: \"aiUsage\"\n}\n\n/** Public metadata for the project's conversational Agent. */\nexport interface AgentDescriptor {\n readonly name: string\n readonly model: LanguageModelRef\n}\n\nexport type AgentReasoning = ModelReasoning\n\nexport const AGENT_REASONING_LEVELS = MODEL_REASONING_LEVELS\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {}\ntype JsonifyAgentToolInput<T> = unknown extends T\n ? ReadonlyJsonValue\n : T extends Date\n ? string\n : T extends readonly (infer TItem)[]\n ? readonly JsonifyAgentToolInput<TItem>[]\n : T extends JsonPrimitive\n ? T\n : T extends object\n ? { readonly [K in keyof T]: JsonifyAgentToolInput<T[K]> }\n : never\n\n/** A model-facing object shape expressed with Sixb's schema DSL. */\nexport type AgentToolInputSchema = Readonly<Record<string, Schema>>\n\n/** Infer the handler input represented by an agent tool schema. */\nexport type InferAgentToolInputSchema<TInput extends AgentToolInputSchema> =\n string extends keyof TInput\n ? Readonly<Record<string, unknown>>\n : Simplify<{\n readonly [K in keyof TInput]: JsonifyAgentToolInput<InferSchema<TInput[K]>>\n }>\n\n/** Identifies the conversational, workflow, or child Agent execution that invoked a tool. */\nexport type AgentToolRunInfo =\n | {\n readonly kind: \"conversation\"\n readonly id: string\n readonly threadId: string\n }\n | {\n readonly kind: \"subagent\"\n readonly id: string\n readonly parentRunId: string\n }\n | {\n readonly kind: \"workflow\"\n readonly id: string\n readonly workflowId: string\n readonly stepId: string\n }\n\n/** Input accepted by the run-scoped artifact publisher exposed to agent tools. */\nexport interface AgentToolArtifactPutInput {\n readonly body: BlobBody\n readonly fileName: string\n readonly mediaType?: string\n}\n\n/** A durable artifact and its path inside the current run sandbox. */\nexport interface AgentToolArtifact {\n readonly fileRef: FileRef\n readonly sandboxPath: string\n}\n\n/** The narrow artifact-writing surface available to an agent tool call. */\nexport interface AgentToolArtifacts {\n put(input: AgentToolArtifactPutInput): Promise<AgentToolArtifact>\n}\n\n/**\n * The files attached to the run that invoked a tool: the messages of a chat's thread, or the input\n * files of a workflow AI task. A child Agent has none.\n */\nexport interface AgentToolAttachments {\n /**\n * Open an attachment by the `key` the Agent sees in `$SIXB_ATTACHMENTS`. Returns null when its\n * stored file is gone, and throws an `AgentToolPublicError` for a key that is not one of this\n * run's attachments.\n */\n open(key: string): Promise<OpenedFileRef | null>\n}\n\nexport type AgentToolTextContent = {\n readonly type: \"text\"\n readonly text: string\n}\n\nexport type AgentToolFileContent = {\n readonly type: \"file\"\n readonly fileRef: FileRef\n}\n\n/** Durable model-facing content returned by a file-aware tool. */\nexport type AgentToolContent = AgentToolTextContent | AgentToolFileContent\n\n/**\n * A file-aware tool result. The tag distinguishes this envelope from an ordinary JSON result while\n * keeping the whole value safe to persist in the durable tool-call trace.\n */\nexport type AgentToolResult = {\n readonly kind: \"agentToolResult\"\n readonly content: readonly AgentToolContent[]\n}\n\n/**\n * The run's domain SDK as an agent tool sees it. Unlike workflow steps and actions, it acts as the\n * run's requester: the signed-in user in a chat, that same user in a child Agent, and the step's\n * groups in a workflow AI task.\n *\n * A structural view of the public `Sixb` SDK, like `WorkflowRuntimeFacade`: the handler receives the\n * run's bound SDK, and this type guides it to what a tool should do. It reads objects and changes\n * them by requesting actions, which validate and record the change. Authority comes from the run,\n * not from this view.\n */\nexport interface AgentToolRuntimeFacade extends ObjectReader {\n readonly actions: ActionsRuntime\n readonly models: ModelsRuntime\n readonly connector: ConnectorRuntime\n}\n\n/** The narrow, run-scoped surface passed to an agent tool handler. */\nexport interface AgentToolRunContext<\n TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n> {\n readonly input: TInput\n readonly toolCallId: string\n readonly signal: AbortSignal\n readonly run: AgentToolRunInfo\n readonly sixb: AgentToolRuntimeFacade\n readonly logger: Logger\n readonly artifacts: AgentToolArtifacts\n readonly attachments: AgentToolAttachments\n}\n\n/** Agent tool handlers may return only values safe to persist in agent messages. */\nexport type AgentToolHandlerResult =\n | ReadonlyJsonValue\n | AgentToolResult\n | Promise<ReadonlyJsonValue | AgentToolResult>\n\nexport type AgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = (\n context: AgentToolRunContext<TInput>\n) => AgentToolHandlerResult\n\n/**\n * Runtime definitions are stored heterogeneously. Keep variance erasure at this\n * boundary only; authoring through `run()` remains strictly contravariant.\n */\ntype StoredAgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = {\n bivarianceHack(context: AgentToolRunContext<TInput>): JsonValue | Promise<JsonValue>\n}[\"bivarianceHack\"]\n\n/** A reusable, inert model tool definition selected explicitly by an agent. */\nexport interface AgentToolDefinition<\n TName extends string = string,\n TInput extends AgentToolInputSchema = AgentToolInputSchema,\n> {\n readonly kind: \"agentTool\"\n readonly name: TName\n readonly description: string\n readonly input: TInput\n readonly handler: StoredAgentToolHandler<InferAgentToolInputSchema<TInput>>\n}\n\n/** Infer the input received by a tool definition's handler. */\nexport type InferAgentToolInput<TTool extends AgentToolDefinition> = InferAgentToolInputSchema<\n TTool[\"input\"]\n>\n\nexport interface AgentToolRunBuilder<TName extends string, TInput extends AgentToolInputSchema> {\n run(\n handler: AgentToolHandler<InferAgentToolInputSchema<TInput>>\n ): AgentToolDefinition<TName, TInput>\n}\n\nexport interface AgentToolInputBuilder<TName extends string> {\n input<const TInput extends AgentToolInputSchema>(\n input: TInput\n ): AgentToolRunBuilder<TName, TInput>\n}\n\nexport interface AgentToolDescriptionBuilder<TName extends string> {\n description(description: string): AgentToolInputBuilder<TName>\n}\n",
7
- "export type AgentStorageErrorCode =\n | \"thread_not_found\"\n | \"active_run_exists\"\n | \"active_child_limit\"\n | \"run_not_found\"\n | \"invalid_input\"\n | \"invalid_state\"\n | \"execution_lost\"\n | \"duplicate_id\"\n\n/**\n * Error for agent-storage invariants and invalid state transitions (single-flight, execution\n * ownership, run lifecycle, message append). Callers branch on `code` rather than message text.\n */\nexport class AgentStorageError extends Error {\n readonly name = \"AgentStorageError\"\n\n constructor(\n readonly code: AgentStorageErrorCode,\n message: string\n ) {\n super(message)\n }\n}\n"
8
- ],
9
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;ACqCO,IAAM,0BAAyB;;;ACvB/B,MAAM,2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AS,MAAM,UAAU;AAAA,EAC/B,IAAI,MAAM,YAAY,MAAM,OAAO,iBAAiB;AAAA,IAClD,MAAM,IAAI,mBACR,iBACA,IAAI,yBAAyB,MAAM,OAAO,uCAAuC,MAAM,OAAO,sBAAsB,MAAM,UAC5H;AAAA,EACF;AAAA,EACA,IAAI,MAAM,QAAQ,OAAO,MAAM,SAAS,IAAI;AAAA,IAC1C,MAAM,IAAI,mBACR,iBACA,IAAI,yBAAyB,MAAM,OAAO,4CAA4C,MAAM,SAAS,MACvG;AAAA,EACF;AAAA;AAIK,SAAS,yCAAwC,CACtD,QACA,OACS;AAAA,EACT,OACE,OAAO,OAAO,MAAM,MACpB,OAAO,cAAc,MAAM,aAC3B,OAAO,aAAa,MAAM,YAC1B,OAAO,mBAAmB,MAAM,mBAC/B,OAAO,wBAAwB,UAAU,MAAM,gCAChD,OAAO,WAAW,MAAM,UACxB,OAAO,YAAY,MAAM,WACzB,OAAO,yBAAyB,MAAM,wBACtC,OAAO,yBAAyB,MAAM,wBACtC,OAAO,oBAAoB,MAAM,mBACjC,OAAO,+BAA+B,MAAM,8BAC5C,OAAO,8BAA8B,MAAM,6BAC3C,OAAO,mBAAmB,MAAM;AAAA;",
10
- "debugId": "1F52FEF450649B4C64756E2164756E21",
11
- "names": []
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/storage/executions/errors.ts", "../src/storage/executions/validation.ts"],
4
- "sourcesContent": [
5
- "export type ExecutionStorageErrorCode =\n | \"duplicate_execution\"\n | \"invalid_credential\"\n | \"invalid_input\"\n | \"invalid_parent_execution\"\n | \"missing_credential\"\n | \"missing_parent_execution\"\n | \"missing_principal\"\n\n/** Stable error raised when an execution record would violate ledger invariants. */\nexport class ExecutionStorageError extends Error {\n readonly name = \"ExecutionStorageError\"\n\n constructor(\n readonly code: ExecutionStorageErrorCode,\n message: string,\n options: ErrorOptions = {}\n ) {\n super(message, options)\n }\n}\n",
6
- "import { isDeepStrictEqual } from \"node:util\"\nimport { normalizeRequesterGroupIds, snapshotRequesterGroupIds } from \"../../auth/attribution\"\nimport { kernelOperationId } from \"../../execution/kernel-operation\"\nimport type {\n AuthorizablePrincipal,\n AuthorizationRef,\n KernelOperation,\n} from \"../../execution/types\"\nimport type { AuthStorage } from \"../auth\"\nimport { ExecutionStorageError } from \"./errors\"\nimport type {\n CreateExecutionInput,\n DurableExecutionExecutor,\n DurableExecutionSource,\n ExecutionRecord,\n} from \"./types\"\n\nexport interface ExecutionValidationLookup {\n readonly auth: AuthStorage\n getExecution(params: {\n readonly projectId: string\n readonly id: string\n }): Promise<ExecutionRecord | null>\n getShareSession(params: {\n readonly projectId: string\n readonly id: string\n }): Promise<{ readonly grantId: string } | null>\n}\n\n/** Capture accounting attribution at the same storage boundary that admits the execution. */\nexport async function prepareExecutionRecord(\n input: CreateExecutionInput,\n lookup: ExecutionValidationLookup\n): Promise<ExecutionRecord> {\n let groups = input.requesterGroupIds\n if (groups === undefined && input.source.type === \"execution\") {\n const parent = await lookup.getExecution({\n projectId: input.projectId,\n id: input.source.executionId,\n })\n groups = parent?.requesterGroupIds\n } else if (groups === undefined && input.requestedBy) {\n groups = await snapshotRequesterGroupIds({\n auth: lookup.auth,\n projectId: input.projectId,\n principal: input.requestedBy,\n })\n }\n const record = normalizeExecutionRecord({ ...input, requesterGroupIds: groups ?? [] })\n await validateExecutionRecordReferences(record, lookup)\n return record\n}\n\nexport function normalizeExecutionRecord(\n input: CreateExecutionInput,\n createdAt: Date = new Date()\n): ExecutionRecord {\n const record: ExecutionRecord = {\n id: input.id,\n projectId: input.projectId,\n requesterGroupIds: normalizeRequesterGroupIds(input.requesterGroupIds ?? []),\n ...(input.requestedBy === undefined ? {} : { requestedBy: structuredClone(input.requestedBy) }),\n executor: structuredClone(input.executor),\n source: structuredClone(input.source),\n correlationId: input.correlationId,\n authorizationRef: structuredClone(input.authorizationRef),\n createdAt: new Date(createdAt),\n }\n\n assertRecordShape(record)\n assertExecutorAuthority(record)\n return record\n}\n\nexport async function validateExecutionRecordReferences(\n record: ExecutionRecord,\n lookup: ExecutionValidationLookup\n): Promise<void> {\n await validatePrincipal(record.requestedBy, record.projectId, \"Requested-by principal\", lookup)\n\n if (record.authorizationRef.type === \"principal\") {\n await validatePrincipal(\n record.authorizationRef.principal,\n record.projectId,\n \"Authority principal\",\n lookup\n )\n await validateCredential(record, lookup)\n }\n if (record.authorizationRef.type === \"delegated\") {\n await validateDelegation(record, lookup)\n }\n\n await validateParent(record, lookup)\n}\n\nexport function cloneExecutionRecord(record: ExecutionRecord): ExecutionRecord {\n return structuredClone(record)\n}\n\nfunction assertRecordShape(record: ExecutionRecord): void {\n assertNonBlank(record.id, \"Execution id\")\n assertNonBlank(record.projectId, \"Execution project id\")\n assertNonBlank(record.correlationId, \"Execution correlation id\")\n assertValidDate(record.createdAt, \"Execution createdAt\")\n\n if (record.requestedBy) {\n assertPrincipal(record.requestedBy, \"Requested-by principal\")\n }\n\n assertExecutor(record.executor)\n assertSource(record.source)\n assertAuthorizationRef(record.authorizationRef)\n}\n\nfunction assertExecutor(executor: DurableExecutionExecutor): void {\n switch (executor.type) {\n case \"request\":\n assertNonBlank(executor.requestId, \"Executor request id\")\n return\n case \"primitive\":\n assertTrustedPrimitiveKind(executor.kind, \"Executor primitive kind\")\n assertNonBlank(executor.runId, \"Executor primitive run id\")\n return\n case \"agent\":\n assertNonBlank(executor.runId, \"Executor agent run id\")\n return\n case \"kernel\":\n assertKernelOperation(executor.operation, \"Executor kernel operation\")\n return\n default:\n invalid(`Unknown execution executor type '${String((executor as { type?: unknown }).type)}'.`)\n }\n}\n\nfunction assertSource(source: DurableExecutionSource): void {\n switch (source.type) {\n case \"ontologyCommit\":\n assertNonBlank(source.commitId, \"Execution source commit id\")\n return\n case \"http\":\n assertNonBlank(source.requestId, \"Execution source request id\")\n return\n case \"webhook\":\n assertNonBlank(source.deliveryId, \"Execution source delivery id\")\n return\n case \"schedule\":\n case \"event\":\n assertNonBlank(source.eventId, \"Execution source event id\")\n return\n case \"datasetVersion\":\n assertNonBlank(source.datasetId, \"Execution source dataset id\")\n assertNonBlank(source.versionId, \"Execution source dataset version id\")\n return\n case \"execution\":\n assertNonBlank(source.executionId, \"Execution source execution id\")\n return\n default:\n invalid(\n `Execution source type '${String((source as { type?: unknown }).type)}' is not durable.`\n )\n }\n}\n\nfunction assertAuthorizationRef(ref: AuthorizationRef): void {\n switch (ref.type) {\n case \"principal\":\n assertPrincipal(ref.principal, \"Authority principal\")\n if (ref.credential) {\n if (ref.credential.type !== \"session\" && ref.credential.type !== \"accessToken\") {\n invalid(\n `Unknown authority credential type '${String(\n (ref.credential as { type?: unknown }).type\n )}'.`\n )\n }\n assertNonBlank(ref.credential.id, \"Authority credential id\")\n }\n return\n case \"trustedPrimitive\":\n assertTrustedPrimitiveKind(ref.primitive.kind, \"Authority primitive kind\")\n assertNonBlank(ref.primitive.id, \"Authority primitive id\")\n assertNonBlank(ref.primitive.runId, \"Authority primitive run id\")\n return\n case \"delegated\":\n if (ref.delegation.kind !== \"share\") {\n invalid(\n `Unknown authority delegation kind '${String(\n (ref.delegation as { kind?: unknown }).kind\n )}'.`\n )\n }\n assertNonBlank(ref.delegation.grantId, \"Authority delegation grant id\")\n assertNonBlank(ref.delegation.sessionId, \"Authority delegation session id\")\n return\n case \"kernel\":\n assertKernelOperation(ref.operation, \"Authority kernel operation\")\n return\n case \"disabled\":\n return\n default:\n invalid(`Unknown authorization reference type '${String((ref as { type?: unknown }).type)}'.`)\n }\n}\n\nfunction assertExecutorAuthority(record: ExecutionRecord): void {\n const { executor, authorizationRef, requestedBy, source } = record\n\n switch (executor.type) {\n case \"request\": {\n if (source.type !== \"http\" || source.requestId !== executor.requestId) {\n invalid(\"Request executions require a matching HTTP source request id.\")\n }\n if (authorizationRef.type === \"principal\") {\n if (!principalsEqual(requestedBy, authorizationRef.principal)) {\n invalid(\"Request authority must match its requested-by principal.\")\n }\n return\n }\n if (authorizationRef.type === \"disabled\") {\n if (requestedBy !== undefined) {\n invalid(\"Auth-disabled request executions cannot have a requested-by principal.\")\n }\n return\n }\n if (authorizationRef.type === \"delegated\") {\n if (requestedBy !== undefined) {\n invalid(\"Delegated request executions cannot have a requested-by principal.\")\n }\n return\n }\n invalid(\"Request executions require principal, delegated, or explicitly disabled authority.\")\n break\n }\n case \"primitive\": {\n if (authorizationRef.type !== \"trustedPrimitive\") {\n invalid(\"Primitive executions require trusted primitive authority.\")\n }\n if (\n authorizationRef.primitive.kind !== executor.kind ||\n authorizationRef.primitive.runId !== executor.runId\n ) {\n invalid(\"Trusted primitive authority must match the executor kind and run id.\")\n }\n return\n }\n case \"agent\": {\n if (source.type !== \"execution\") {\n invalid(\"Agent executions require a parent execution source.\")\n }\n if (\n authorizationRef.type === \"principal\" &&\n authorizationRef.principal.type === \"serviceAccount\" &&\n authorizationRef.credential === undefined\n ) {\n return\n }\n if (\n authorizationRef.type === \"principal\" &&\n authorizationRef.principal.type === \"user\" &&\n authorizationRef.credential !== undefined\n ) {\n return\n }\n if (authorizationRef.type === \"disabled\") return\n invalid(\n \"Agent executions require managed service-account, credentialed user, or explicitly disabled authority.\"\n )\n break\n }\n case \"kernel\": {\n if (\n authorizationRef.type !== \"kernel\" ||\n !kernelOperationsEqual(authorizationRef.operation, executor.operation)\n ) {\n invalid(\"Kernel authority must match the executor operation.\")\n }\n if (requestedBy !== undefined) {\n invalid(\"Kernel executions cannot have a requested-by principal.\")\n }\n return\n }\n }\n}\n\nasync function validatePrincipal(\n principal: AuthorizablePrincipal | undefined,\n projectId: string,\n label: string,\n lookup: ExecutionValidationLookup\n): Promise<void> {\n if (!principal) return\n\n const record =\n principal.type === \"user\"\n ? await lookup.auth.users.getById({ projectId, id: principal.id })\n : await lookup.auth.serviceAccounts.getById({ projectId, id: principal.id })\n if (!record) {\n throw new ExecutionStorageError(\n \"missing_principal\",\n `[Sixb] ${label} '${principal.id}' does not exist in project '${projectId}'.`\n )\n }\n}\n\nasync function validateCredential(\n record: ExecutionRecord,\n lookup: ExecutionValidationLookup\n): Promise<void> {\n if (record.authorizationRef.type !== \"principal\" || !record.authorizationRef.credential) return\n\n const { principal, credential } = record.authorizationRef\n if (credential.type === \"session\") {\n const session = await lookup.auth.sessions.getById({\n projectId: record.projectId,\n id: credential.id,\n })\n if (!session) {\n throw new ExecutionStorageError(\n \"missing_credential\",\n `[Sixb] Authority session '${credential.id}' does not exist in project '${record.projectId}'.`\n )\n }\n if (principal.type !== \"user\" || session.userId !== principal.id) {\n throw new ExecutionStorageError(\n \"invalid_credential\",\n `[Sixb] Authority session '${credential.id}' does not belong to principal '${principal.id}'.`\n )\n }\n return\n }\n\n const token = await lookup.auth.accessTokens.getById({\n projectId: record.projectId,\n id: credential.id,\n })\n if (!token) {\n throw new ExecutionStorageError(\n \"missing_credential\",\n `[Sixb] Authority access token '${credential.id}' does not exist in project '${record.projectId}'.`\n )\n }\n if (!principalsEqual(token.subject, principal)) {\n throw new ExecutionStorageError(\n \"invalid_credential\",\n `[Sixb] Authority access token '${credential.id}' does not belong to principal '${principal.id}'.`\n )\n }\n}\n\nasync function validateDelegation(\n record: ExecutionRecord,\n lookup: ExecutionValidationLookup\n): Promise<void> {\n if (record.authorizationRef.type !== \"delegated\") return\n const { grantId, sessionId } = record.authorizationRef.delegation\n const session = await lookup.getShareSession({ projectId: record.projectId, id: sessionId })\n if (!session) {\n throw new ExecutionStorageError(\n \"missing_credential\",\n `[Sixb] Authority shared session '${sessionId}' does not exist in project '${record.projectId}'.`\n )\n }\n if (session.grantId !== grantId) {\n throw new ExecutionStorageError(\n \"invalid_credential\",\n `[Sixb] Authority shared session '${sessionId}' does not belong to grant '${grantId}'.`\n )\n }\n}\n\nasync function validateParent(\n record: ExecutionRecord,\n lookup: ExecutionValidationLookup\n): Promise<void> {\n if (record.source.type !== \"execution\") return\n const parentExecutionId = record.source.executionId\n\n const parent = await lookup.getExecution({\n projectId: record.projectId,\n id: parentExecutionId,\n })\n if (!parent) {\n throw new ExecutionStorageError(\n \"missing_parent_execution\",\n `[Sixb] Parent execution '${parentExecutionId}' does not exist in project '${record.projectId}'.`\n )\n }\n if (parent.correlationId !== record.correlationId) {\n throw new ExecutionStorageError(\n \"invalid_parent_execution\",\n `[Sixb] Child execution '${record.id}' must preserve its parent correlation id.`\n )\n }\n if (!principalsEqual(parent.requestedBy, record.requestedBy)) {\n throw new ExecutionStorageError(\n \"invalid_parent_execution\",\n `[Sixb] Child execution '${record.id}' must preserve its parent requested-by principal.`\n )\n }\n if (!isDeepStrictEqual(parent.requesterGroupIds, record.requesterGroupIds)) {\n throw new ExecutionStorageError(\n \"invalid_parent_execution\",\n `[Sixb] Child execution '${record.id}' must preserve its parent requester-group snapshot.`\n )\n }\n if (\n record.executor.type === \"agent\" &&\n isInheritedAgentAuthority(record.authorizationRef) &&\n !isDeepStrictEqual(parent.authorizationRef, record.authorizationRef)\n ) {\n throw new ExecutionStorageError(\n \"invalid_parent_execution\",\n `[Sixb] Child Agent execution '${record.id}' must inherit its parent's authorization reference.`\n )\n }\n}\n\nfunction isInheritedAgentAuthority(ref: AuthorizationRef): boolean {\n return (\n ref.type === \"disabled\" ||\n (ref.type === \"principal\" && ref.principal.type === \"user\" && ref.credential !== undefined)\n )\n}\n\nfunction assertPrincipal(principal: AuthorizablePrincipal, label: string): void {\n if (principal.type !== \"user\" && principal.type !== \"serviceAccount\") {\n invalid(`${label} has unsupported type '${String((principal as { type?: unknown }).type)}'.`)\n }\n assertNonBlank(principal.id, `${label} id`)\n}\n\nfunction assertKernelOperation(operation: KernelOperation, label: string): void {\n if (operation.type !== \"ontology.recover\" && operation.type !== \"ontology.indexVectors\") {\n invalid(`${label} has unsupported type '${String((operation as { type?: unknown }).type)}'.`)\n }\n assertNonBlank(kernelOperationId(operation), `${label} operation id`)\n}\n\nfunction assertTrustedPrimitiveKind(value: string, label: string): void {\n if (!TRUSTED_PRIMITIVE_KINDS.has(value)) {\n invalid(`${label} '${value}' is not supported.`)\n }\n}\n\nfunction assertNonBlank(value: string, label: string): void {\n if (typeof value !== \"string\" || !value.trim()) {\n invalid(`${label} must be a non-empty string.`)\n }\n}\n\nfunction assertValidDate(value: Date, label: string): void {\n if (!(value instanceof Date) || !Number.isFinite(value.getTime())) {\n invalid(`${label} must be a valid date.`)\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 kernelOperationsEqual(left: KernelOperation, right: KernelOperation): boolean {\n return left.type === right.type && kernelOperationId(left) === kernelOperationId(right)\n}\n\nfunction invalid(message: string): never {\n throw new ExecutionStorageError(\"invalid_input\", `[Sixb] ${message}`)\n}\n\nconst TRUSTED_PRIMITIVE_KINDS = new Set([\n \"action\",\n \"pipeline\",\n \"projection\",\n \"rule\",\n \"sync\",\n \"webhook\",\n \"workflow\",\n])\n"
7
- ],
8
- "mappings": ";;;;;;;;;;AAUO,MAAM,+BAA8B,MAAM;AAAA,EAIpC;AAAA,EAHF,OAAO;AAAA,EAEhB,WAAW,CACA,MACT,SACA,UAAwB,CAAC,GACzB;AAAA,IACA,MAAM,SAAS,OAAO;AAAA,IAJb;AAAA;AAMb;;;ACpBA;AA8BA,eAAsB,uBAAsB,CAC1C,OACA,QAC0B;AAAA,EAC1B,IAAI,SAAS,MAAM;AAAA,EACnB,IAAI,WAAW,aAAa,MAAM,OAAO,SAAS,aAAa;AAAA,IAC7D,MAAM,SAAS,MAAM,OAAO,aAAa;AAAA,MACvC,WAAW,MAAM;AAAA,MACjB,IAAI,MAAM,OAAO;AAAA,IACnB,CAAC;AAAA,IACD,SAAS,QAAQ;AAAA,EACnB,EAAO,SAAI,WAAW,aAAa,MAAM,aAAa;AAAA,IACpD,SAAS,MAAM,0BAA0B;AAAA,MACvC,MAAM,OAAO;AAAA,MACb,WAAW,MAAM;AAAA,MACjB,WAAW,MAAM;AAAA,IACnB,CAAC;AAAA,EACH;AAAA,EACA,MAAM,SAAS,0BAAyB,KAAK,OAAO,m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AAAA,EAC1C;AAAA;AAGF,SAAS,eAAe,CACtB,MACA,OACS;AAAA,EACT,OAAO,MAAM,SAAS,OAAO,QAAQ,MAAM,OAAO,OAAO;AAAA;AAG3D,SAAS,qBAAqB,CAAC,MAAuB,OAAiC;AAAA,EACrF,OAAO,KAAK,SAAS,MAAM,QAAQ,kBAAkB,IAAI,MAAM,kBAAkB,KAAK;AAAA;AAGxF,SAAS,OAAO,CAAC,SAAwB;AAAA,EACvC,MAAM,IAAI,uBAAsB,iBAAiB,UAAU,SAAS;AAAA;AAGtE,IAAM,0BAA0B,IAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
9
- "debugId": "12B08F503967185464756E2164756E21",
10
- "names": []
11
- }
@@ -1,128 +0,0 @@
1
- // @bun
2
- import {
3
- requireAccountingCapabilities,
4
- createAiModelCallLimitController2,
5
- AiModelCallRecorder2,
6
- enqueueAiModelCallRecovery2
7
- } from "./chunk-7mbzgd9m.js";
8
- import {
9
- executionRecordInputFromRuntime,
10
- ensureExecutionRecord2
11
- } from "./chunk-nre82s12.js";
12
-
13
- // src/runtime/ontology-mutations.ts
14
- var ontologyMutationRuntimeKey = Symbol("sixb.ontologyMutationRuntime");
15
- function registerOntologyMutationRuntime2(owner, runtime) {
16
- const registered = owner[ontologyMutationRuntimeKey];
17
- if (registered && registered !== runtime) {
18
- throw new Error("[Sixb] Ontology mutation runtime is already registered for this owner.");
19
- }
20
- Object.defineProperty(owner, ontologyMutationRuntimeKey, {
21
- configurable: false,
22
- enumerable: true,
23
- value: runtime,
24
- writable: false
25
- });
26
- }
27
- function getOntologyMutationRuntime2(owner) {
28
- const runtime = owner[ontologyMutationRuntimeKey];
29
- if (runtime)
30
- return runtime;
31
- throw new Error("[Sixb] Ontology mutation runtime is not registered for this runtime context.");
32
- }
33
- function shareOntologyMutationRuntime2(source, target) {
34
- registerOntologyMutationRuntime2(target, getOntologyMutationRuntime2(source));
35
- }
36
- function createOntologyMutationRuntime2(input) {
37
- const runtime = {
38
- getProjectionSource: (source) => input.materializer.projections.getActive(source),
39
- commitEdits: (command) => commitAndNotify(() => input.materializer.edits.commit(command), input.notifyCommittedFacts),
40
- replaceProjection: (command) => commitAndNotify(() => input.materializer.projections.replace(command), input.notifyCommittedFacts),
41
- finishProjection: (command) => input.materializer.projections.finishRun(command),
42
- appendTelemetry: (command) => commitAndNotify(() => input.materializer.telemetry.append(command), input.notifyCommittedFacts)
43
- };
44
- return Object.freeze(runtime);
45
- }
46
- async function commitAndNotify(commit, notify) {
47
- const result = await commit();
48
- if (result.eventCount > 0)
49
- notifyWithoutAffectingCommit(notify);
50
- return result;
51
- }
52
- function notifyWithoutAffectingCommit(notify) {
53
- try {
54
- notify();
55
- } catch (error) {
56
- console.error("[Sixb] Failed to wake the ontology outbox dispatcher:", error);
57
- }
58
- }
59
-
60
- // src/models/execution/session.ts
61
- class ModelExecutionSession {
62
- runtime;
63
- execution;
64
- binding;
65
- recorder;
66
- constructor(runtime, execution) {
67
- this.runtime = runtime;
68
- this.execution = execution;
69
- }
70
- bind(input) {
71
- if (this.binding)
72
- throw new Error("[SixbModels] Execution attempt is already bound.");
73
- this.binding = { ...input };
74
- }
75
- signal(signal) {
76
- const binding = this.requireBinding();
77
- return signal ? AbortSignal.any([binding.signal, signal]) : binding.signal;
78
- }
79
- async admitEmbeddingCall(admit) {
80
- const admission = this.requireBinding().embeddingAdmission;
81
- if (admission)
82
- await admission(admit);
83
- else
84
- await admit();
85
- }
86
- accounting() {
87
- const { accounting } = this.requireBinding();
88
- this.recorder ??= accounting ? Promise.resolve(accounting) : this.createRecorder();
89
- return this.recorder;
90
- }
91
- requireBinding() {
92
- if (!this.binding) {
93
- throw new Error("[SixbModels] Model calls require a bound request or worker execution attempt.");
94
- }
95
- return this.binding;
96
- }
97
- async createRecorder() {
98
- const runtime = this.runtime;
99
- const execution = this.execution;
100
- const { attempt } = this.requireBinding();
101
- const storage = {
102
- ...requireAccountingCapabilities(runtime.storage),
103
- transaction: runtime.storage.transaction.bind(runtime.storage)
104
- };
105
- const { requesterGroupIds } = await ensureExecutionRecord2(runtime.storage.executions, executionRecordInputFromRuntime({
106
- execution,
107
- runtimeAuthorization: runtime.runtimeAuthorization
108
- }));
109
- return new AiModelCallRecorder2({
110
- storage,
111
- projectId: runtime.projectId,
112
- executionId: execution.id,
113
- attempt,
114
- requesterGroupIds,
115
- limits: createAiModelCallLimitController2({
116
- storage,
117
- projectId: runtime.projectId,
118
- requestedBy: execution.requestedBy,
119
- requesterGroupIds
120
- }),
121
- recoverAiModelCall: (input) => enqueueAiModelCallRecovery2(runtime.queues.agents, input)
122
- });
123
- }
124
- }
125
-
126
- export { registerOntologyMutationRuntime2, getOntologyMutationRuntime2, shareOntologyMutationRuntime2, createOntologyMutationRuntime2, ModelExecutionSession };
127
-
128
- //# debugId=68E7C49FC6F738D764756E2164756E21