@sixb/core 0.1.26 → 0.2.1

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 (617) hide show
  1. package/dist/actions/index.js +47 -47
  2. package/dist/actions/request.d.ts.map +1 -1
  3. package/dist/actions/run/context.d.ts +1 -0
  4. package/dist/actions/run/context.d.ts.map +1 -1
  5. package/dist/actions/run/execute.d.ts +3 -0
  6. package/dist/actions/run/execute.d.ts.map +1 -1
  7. package/dist/actions/run/executor.d.ts +3 -0
  8. package/dist/actions/run/executor.d.ts.map +1 -1
  9. package/dist/actions/run/types.d.ts +5 -0
  10. package/dist/actions/run/types.d.ts.map +1 -1
  11. package/dist/actions/types/context.d.ts +11 -0
  12. package/dist/actions/types/context.d.ts.map +1 -1
  13. package/dist/agents/adapters.d.ts +30 -4
  14. package/dist/agents/adapters.d.ts.map +1 -1
  15. package/dist/agents/approvals.d.ts +8 -0
  16. package/dist/agents/approvals.d.ts.map +1 -1
  17. package/dist/agents/context-budget.d.ts +48 -0
  18. package/dist/agents/context-budget.d.ts.map +1 -0
  19. package/dist/agents/context-compaction.d.ts +89 -9
  20. package/dist/agents/context-compaction.d.ts.map +1 -1
  21. package/dist/agents/context-files.d.ts +12 -0
  22. package/dist/agents/context-files.d.ts.map +1 -0
  23. package/dist/agents/context-parts.d.ts +41 -0
  24. package/dist/agents/context-parts.d.ts.map +1 -0
  25. package/dist/agents/context-request.d.ts +47 -0
  26. package/dist/agents/context-request.d.ts.map +1 -0
  27. package/dist/agents/context-token-rate.d.ts +98 -0
  28. package/dist/agents/context-token-rate.d.ts.map +1 -0
  29. package/dist/agents/context-use.d.ts +51 -0
  30. package/dist/agents/context-use.d.ts.map +1 -0
  31. package/dist/agents/dispatch.d.ts.map +1 -1
  32. package/dist/agents/execution.d.ts +13 -1
  33. package/dist/agents/execution.d.ts.map +1 -1
  34. package/dist/agents/index.d.ts +21 -7
  35. package/dist/agents/index.d.ts.map +1 -1
  36. package/dist/agents/index.js +109 -55
  37. package/dist/agents/index.js.map +1 -1
  38. package/dist/agents/inline-images.d.ts +17 -0
  39. package/dist/agents/inline-images.d.ts.map +1 -0
  40. package/dist/agents/message.d.ts +55 -0
  41. package/dist/agents/message.d.ts.map +1 -1
  42. package/dist/agents/model-loop.d.ts +23 -3
  43. package/dist/agents/model-loop.d.ts.map +1 -1
  44. package/dist/agents/request.d.ts +6 -1
  45. package/dist/agents/request.d.ts.map +1 -1
  46. package/dist/agents/run-events.d.ts +3 -2
  47. package/dist/agents/run-events.d.ts.map +1 -1
  48. package/dist/agents/run-plan.d.ts +12 -2
  49. package/dist/agents/run-plan.d.ts.map +1 -1
  50. package/dist/agents/run-session-http.d.ts +6 -3
  51. package/dist/agents/run-session-http.d.ts.map +1 -1
  52. package/dist/agents/run-session-serve.d.ts +18 -2
  53. package/dist/agents/run-session-serve.d.ts.map +1 -1
  54. package/dist/agents/run-session.d.ts +3 -1
  55. package/dist/agents/run-session.d.ts.map +1 -1
  56. package/dist/agents/run-tools.d.ts +7 -0
  57. package/dist/agents/run-tools.d.ts.map +1 -1
  58. package/dist/agents/run-turn.d.ts +39 -4
  59. package/dist/agents/run-turn.d.ts.map +1 -1
  60. package/dist/agents/skills.d.ts +9 -2
  61. package/dist/agents/skills.d.ts.map +1 -1
  62. package/dist/agents/step-limits.d.ts +18 -0
  63. package/dist/agents/step-limits.d.ts.map +1 -0
  64. package/dist/agents/streams/index.d.ts +1 -1
  65. package/dist/agents/streams/index.d.ts.map +1 -1
  66. package/dist/agents/streams/index.js +2 -2
  67. package/dist/agents/streams/internal.d.ts +1 -1
  68. package/dist/agents/streams/internal.d.ts.map +1 -1
  69. package/dist/agents/streams/internal.js +7 -3
  70. package/dist/agents/streams/internal.js.map +1 -1
  71. package/dist/agents/streams/protocol.d.ts +36 -1
  72. package/dist/agents/streams/protocol.d.ts.map +1 -1
  73. package/dist/agents/thread-context-projection.d.ts +10 -0
  74. package/dist/agents/thread-context-projection.d.ts.map +1 -1
  75. package/dist/agents/tool-files.d.ts +22 -0
  76. package/dist/agents/tool-files.d.ts.map +1 -1
  77. package/dist/artifacts/publish/index.js +26 -26
  78. package/dist/auth/index.js +12 -12
  79. package/dist/auth/index.js.map +1 -1
  80. package/dist/auth/runtime.d.ts +2 -0
  81. package/dist/auth/runtime.d.ts.map +1 -1
  82. package/dist/auth/types.d.ts +5 -0
  83. package/dist/auth/types.d.ts.map +1 -1
  84. package/dist/authorization/decision.d.ts +2 -0
  85. package/dist/authorization/decision.d.ts.map +1 -1
  86. package/dist/authorization/grant-kinds.d.ts +2 -2
  87. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  88. package/dist/authorization/index.d.ts +1 -1
  89. package/dist/authorization/index.d.ts.map +1 -1
  90. package/dist/authorization/index.js +7 -5
  91. package/dist/authorization/index.js.map +1 -1
  92. package/dist/authorization/run-visibility.d.ts +17 -0
  93. package/dist/authorization/run-visibility.d.ts.map +1 -1
  94. package/dist/bootstrap/index.js +55 -55
  95. package/dist/{chunk-t3brw0wd.js → chunk-0g5nyx0k.js} +181 -30
  96. package/dist/chunk-0g5nyx0k.js.map +14 -0
  97. package/dist/{chunk-fakrpfy3.js → chunk-0k1h5hmr.js} +2 -1
  98. package/dist/{chunk-fakrpfy3.js.map → chunk-0k1h5hmr.js.map} +3 -3
  99. package/dist/{chunk-c0vk1djt.js → chunk-165c9wm6.js} +1 -1
  100. package/dist/{chunk-8mb7mt8n.js → chunk-21q0j5f2.js} +2 -2
  101. package/dist/{chunk-hn76sanm.js → chunk-23s66j86.js} +1 -1
  102. package/dist/{chunk-h1na2cxc.js → chunk-2g0r46hy.js} +2 -2
  103. package/dist/{chunk-8v6xzwgr.js → chunk-3x3bebz7.js} +95 -19
  104. package/dist/{chunk-8v6xzwgr.js.map → chunk-3x3bebz7.js.map} +10 -9
  105. package/dist/{chunk-tdxfsg1c.js → chunk-47e09r7z.js} +2 -2
  106. package/dist/{chunk-73j0v4qv.js → chunk-4zm1k3xj.js} +14 -2
  107. package/dist/{chunk-73j0v4qv.js.map → chunk-4zm1k3xj.js.map} +3 -3
  108. package/dist/{chunk-fntqb7qy.js → chunk-57g0215c.js} +1 -1
  109. package/dist/{chunk-npcr0228.js → chunk-5kyvrtjh.js} +1 -1
  110. package/dist/{chunk-zhh1jd89.js → chunk-5taem5aw.js} +1 -1
  111. package/dist/{chunk-tnhqtfea.js → chunk-6b61s40c.js} +1 -1
  112. package/dist/{chunk-4ymrcdbm.js → chunk-7hd2ez3q.js} +1 -1
  113. package/dist/{chunk-315qye3g.js → chunk-80nh73br.js} +1 -1
  114. package/dist/{chunk-b6ghvap7.js → chunk-8yzhjawq.js} +7 -7
  115. package/dist/{chunk-2vjnyz1s.js → chunk-9rh8ncs5.js} +2 -2
  116. package/dist/{chunk-pgrf64hp.js → chunk-agn8d8ys.js} +1 -1
  117. package/dist/{chunk-6qn7nmd3.js → chunk-aqyjb86c.js} +9 -9
  118. package/dist/{chunk-4jq2bg8t.js → chunk-ax10ft8d.js} +6 -6
  119. package/dist/{chunk-mqx25wwh.js → chunk-b7a97n8b.js} +12 -10
  120. package/dist/{chunk-mqx25wwh.js.map → chunk-b7a97n8b.js.map} +3 -3
  121. package/dist/{chunk-8v5a54qz.js → chunk-cb21tx14.js} +165 -42
  122. package/dist/{chunk-8v5a54qz.js.map → chunk-cb21tx14.js.map} +12 -12
  123. package/dist/{chunk-7ex2p3zp.js → chunk-cgznz22f.js} +2 -2
  124. package/dist/{chunk-vhbw5sqm.js → chunk-d7v97qxq.js} +7 -1
  125. package/dist/chunk-d7v97qxq.js.map +10 -0
  126. package/dist/chunk-de5sfbc3.js +3 -0
  127. package/dist/{chunk-ratkv4zc.js.map → chunk-de5sfbc3.js.map} +1 -1
  128. package/dist/{chunk-qgvbxfqv.js → chunk-djs3hw9p.js} +1 -1
  129. package/dist/{chunk-ye5c8016.js → chunk-dz7a4t3a.js} +26 -5
  130. package/dist/{chunk-ye5c8016.js.map → chunk-dz7a4t3a.js.map} +4 -4
  131. package/dist/{chunk-fe8zwt8b.js → chunk-e6xgz4h4.js} +22 -4
  132. package/dist/{chunk-fe8zwt8b.js.map → chunk-e6xgz4h4.js.map} +5 -3
  133. package/dist/{chunk-dgtd0836.js → chunk-e7v3trpz.js} +1 -1
  134. package/dist/{chunk-z9mg7wya.js → chunk-edx8xcsm.js} +111 -11
  135. package/dist/chunk-edx8xcsm.js.map +13 -0
  136. package/dist/{chunk-0bc3w0zq.js → chunk-epyfm23v.js} +38 -11
  137. package/dist/chunk-epyfm23v.js.map +11 -0
  138. package/dist/{chunk-zbc929zg.js → chunk-escedwyt.js} +9 -1
  139. package/dist/{chunk-zbc929zg.js.map → chunk-escedwyt.js.map} +3 -3
  140. package/dist/{chunk-jt3r6thp.js → chunk-fg1db9xx.js} +46 -6
  141. package/dist/chunk-fg1db9xx.js.map +10 -0
  142. package/dist/{chunk-73v685wb.js → chunk-frsz8wxd.js} +4 -4
  143. package/dist/{chunk-73v685wb.js.map → chunk-frsz8wxd.js.map} +3 -3
  144. package/dist/{chunk-axb4ss9a.js → chunk-h05rg3bx.js} +43 -12
  145. package/dist/chunk-h05rg3bx.js.map +12 -0
  146. package/dist/{chunk-06sg8s4z.js → chunk-j1ny5fwh.js} +37 -13
  147. package/dist/chunk-j1ny5fwh.js.map +15 -0
  148. package/dist/{chunk-59kf345w.js → chunk-jbw70d6t.js} +2 -2
  149. package/dist/{chunk-cbcgs9f7.js → chunk-jftd33rc.js} +21 -21
  150. package/dist/chunk-jftd33rc.js.map +11 -0
  151. package/dist/{chunk-78ymxrn0.js → chunk-jhbk10wf.js} +1 -1
  152. package/dist/{chunk-phm3c7b9.js → chunk-jjmggm9a.js} +2 -2
  153. package/dist/{chunk-18sk89cg.js → chunk-jk97v21j.js} +7 -2
  154. package/dist/chunk-jk97v21j.js.map +10 -0
  155. package/dist/chunk-kcqpk9w1.js.map +2 -2
  156. package/dist/{chunk-xm8qgbqm.js → chunk-ks87m383.js} +55 -45
  157. package/dist/{chunk-xm8qgbqm.js.map → chunk-ks87m383.js.map} +5 -5
  158. package/dist/{chunk-ft3w5ahs.js → chunk-m3qe54bb.js} +1 -1
  159. package/dist/{chunk-y7j6x4h0.js → chunk-neftrg0n.js} +3 -3
  160. package/dist/{chunk-07kkp2e1.js → chunk-nghc7eq0.js} +2 -2
  161. package/dist/{chunk-vx4e4zv4.js → chunk-nqnfz3jg.js} +4 -4
  162. package/dist/{chunk-1xvqgg88.js → chunk-nz7815t3.js} +18 -2
  163. package/dist/chunk-nz7815t3.js.map +14 -0
  164. package/dist/{chunk-e24fvw8g.js → chunk-qbrmpgvv.js} +1 -1
  165. package/dist/{chunk-dp0cdtj2.js → chunk-qsg8rw04.js} +2 -2
  166. package/dist/{chunk-0kk2wt0h.js → chunk-r1cxq7vv.js} +2 -2
  167. package/dist/{chunk-yd00vzqr.js → chunk-ratj7t3t.js} +1009 -354
  168. package/dist/chunk-ratj7t3t.js.map +45 -0
  169. package/dist/{chunk-yavhtnac.js → chunk-rjeeyssy.js} +89 -43
  170. package/dist/{chunk-yavhtnac.js.map → chunk-rjeeyssy.js.map} +3 -3
  171. package/dist/{chunk-kyjcwqz6.js → chunk-rtkqczbr.js} +3 -1
  172. package/dist/{chunk-kyjcwqz6.js.map → chunk-rtkqczbr.js.map} +3 -3
  173. package/dist/{chunk-9mab3dvg.js → chunk-s038wa5v.js} +9 -1
  174. package/dist/{chunk-9mab3dvg.js.map → chunk-s038wa5v.js.map} +3 -3
  175. package/dist/{chunk-2adz0h75.js → chunk-s7xqfxs9.js} +35 -3
  176. package/dist/chunk-s7xqfxs9.js.map +11 -0
  177. package/dist/{chunk-g663fahq.js → chunk-scyq22td.js} +1 -1
  178. package/dist/{chunk-8xnz9vvp.js → chunk-t5daew4g.js} +23 -19
  179. package/dist/chunk-t5daew4g.js.map +12 -0
  180. package/dist/{chunk-7wn5z7mq.js → chunk-t9xyr7y9.js} +5 -5
  181. package/dist/{chunk-qst145py.js → chunk-tvbmh7tj.js} +24 -14
  182. package/dist/chunk-tvbmh7tj.js.map +18 -0
  183. package/dist/{chunk-pdt5cw8z.js → chunk-tvefbgvw.js} +5 -2
  184. package/dist/{chunk-pdt5cw8z.js.map → chunk-tvefbgvw.js.map} +3 -3
  185. package/dist/{chunk-45ngkxkp.js → chunk-w122ymx4.js} +2 -2
  186. package/dist/{chunk-jn3ysaf2.js → chunk-w53trr0c.js} +12 -12
  187. package/dist/{chunk-jn3ysaf2.js.map → chunk-w53trr0c.js.map} +1 -1
  188. package/dist/{chunk-48jezz3j.js → chunk-w976a4me.js} +1 -1
  189. package/dist/{chunk-qtzftvxa.js → chunk-wx7smkn2.js} +1 -1
  190. package/dist/{chunk-c14ap3s9.js → chunk-y2x2935j.js} +3 -3
  191. package/dist/{chunk-7hf6tkgs.js → chunk-ytzcxtpt.js} +5 -5
  192. package/dist/{chunk-7hf6tkgs.js.map → chunk-ytzcxtpt.js.map} +1 -1
  193. package/dist/{chunk-mdxmt0n3.js → chunk-z3evap21.js} +1074 -122
  194. package/dist/chunk-z3evap21.js.map +129 -0
  195. package/dist/datasets/execution.d.ts +26 -1
  196. package/dist/datasets/execution.d.ts.map +1 -1
  197. package/dist/datasets/index.d.ts +1 -1
  198. package/dist/datasets/index.d.ts.map +1 -1
  199. package/dist/datasets/lineage.d.ts +55 -0
  200. package/dist/datasets/lineage.d.ts.map +1 -0
  201. package/dist/datasets/write.js +5 -5
  202. package/dist/deploy/types.d.ts +8 -1
  203. package/dist/deploy/types.d.ts.map +1 -1
  204. package/dist/env/index.d.ts +36 -0
  205. package/dist/env/index.d.ts.map +1 -0
  206. package/dist/env/index.js +17 -0
  207. package/dist/env/index.js.map +10 -0
  208. package/dist/error-reporting/internal.js +3 -3
  209. package/dist/errors/catalog.d.ts +8 -0
  210. package/dist/errors/catalog.d.ts.map +1 -1
  211. package/dist/errors/internal.js +1 -1
  212. package/dist/events/index.js +4 -4
  213. package/dist/events/selectors/index.js +1 -1
  214. package/dist/events/selectors/predicate.d.ts.map +1 -1
  215. package/dist/events/types/datasets.d.ts +6 -0
  216. package/dist/events/types/datasets.d.ts.map +1 -1
  217. package/dist/execution/agent.js +47 -47
  218. package/dist/execution/index.d.ts +1 -0
  219. package/dist/execution/index.d.ts.map +1 -1
  220. package/dist/execution/primitive.js +47 -47
  221. package/dist/execution/request-client.d.ts +21 -0
  222. package/dist/execution/request-client.d.ts.map +1 -0
  223. package/dist/execution/request.d.ts.map +1 -1
  224. package/dist/execution/request.js +49 -47
  225. package/dist/execution/request.js.map +3 -3
  226. package/dist/http/api-routes.d.ts.map +1 -1
  227. package/dist/http/index.js +1 -1
  228. package/dist/index.d.ts +7 -5
  229. package/dist/index.d.ts.map +1 -1
  230. package/dist/index.js +67 -67
  231. package/dist/index.js.map +1 -1
  232. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  233. package/dist/lake-storage/index.d.ts +2 -2
  234. package/dist/lake-storage/index.d.ts.map +1 -1
  235. package/dist/lake-storage/index.js +10 -6
  236. package/dist/lake-storage/index.js.map +1 -1
  237. package/dist/lake-storage/source-ordering.d.ts +7 -0
  238. package/dist/lake-storage/source-ordering.d.ts.map +1 -1
  239. package/dist/lake-storage/types.d.ts +18 -0
  240. package/dist/lake-storage/types.d.ts.map +1 -1
  241. package/dist/lake-storage/version-inputs.d.ts +11 -3
  242. package/dist/lake-storage/version-inputs.d.ts.map +1 -1
  243. package/dist/lineage/commits.d.ts +45 -0
  244. package/dist/lineage/commits.d.ts.map +1 -0
  245. package/dist/lineage/executors.d.ts +14 -0
  246. package/dist/lineage/executors.d.ts.map +1 -0
  247. package/dist/lineage/link.d.ts +10 -0
  248. package/dist/lineage/link.d.ts.map +1 -0
  249. package/dist/lineage/object.d.ts +10 -0
  250. package/dist/lineage/object.d.ts.map +1 -0
  251. package/dist/lineage/projections.d.ts +34 -0
  252. package/dist/lineage/projections.d.ts.map +1 -0
  253. package/dist/lineage/reader.d.ts +34 -0
  254. package/dist/lineage/reader.d.ts.map +1 -0
  255. package/dist/lineage/sources.d.ts +62 -0
  256. package/dist/lineage/sources.d.ts.map +1 -0
  257. package/dist/lineage/types.d.ts +140 -0
  258. package/dist/lineage/types.d.ts.map +1 -0
  259. package/dist/materializer/effective/resolve.d.ts +63 -6
  260. package/dist/materializer/effective/resolve.d.ts.map +1 -1
  261. package/dist/materializer/index.js +27 -27
  262. package/dist/models/errors.d.ts +8 -0
  263. package/dist/models/errors.d.ts.map +1 -1
  264. package/dist/models/events.d.ts +10 -0
  265. package/dist/models/events.d.ts.map +1 -1
  266. package/dist/models/execution/index.d.ts +1 -0
  267. package/dist/models/execution/index.d.ts.map +1 -1
  268. package/dist/models/execution/index.js +34 -31
  269. package/dist/models/execution/index.js.map +1 -1
  270. package/dist/models/execution/model-call-recorder.d.ts +2 -0
  271. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  272. package/dist/models/index.d.ts +2 -1
  273. package/dist/models/index.d.ts.map +1 -1
  274. package/dist/models/index.js +3 -3
  275. package/dist/models/language-model.d.ts +29 -2
  276. package/dist/models/language-model.d.ts.map +1 -1
  277. package/dist/objects/execution.d.ts +4 -1
  278. package/dist/objects/execution.d.ts.map +1 -1
  279. package/dist/objects/index.js +47 -47
  280. package/dist/objects/query/executor.d.ts.map +1 -1
  281. package/dist/objects/query/index.d.ts +1 -0
  282. package/dist/objects/query/index.d.ts.map +1 -1
  283. package/dist/objects/query/index.js +30 -28
  284. package/dist/objects/query/index.js.map +1 -1
  285. package/dist/objects/query/ir.d.ts +16 -0
  286. package/dist/objects/query/ir.d.ts.map +1 -1
  287. package/dist/objects/query/link-endpoints.d.ts +11 -0
  288. package/dist/objects/query/link-endpoints.d.ts.map +1 -0
  289. package/dist/objects/query/normalize.d.ts.map +1 -1
  290. package/dist/objects/query/planner.d.ts +5 -0
  291. package/dist/objects/query/planner.d.ts.map +1 -1
  292. package/dist/objects/query/validate.d.ts +2 -0
  293. package/dist/objects/query/validate.d.ts.map +1 -1
  294. package/dist/objects/sdk/object-set.d.ts +2 -0
  295. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  296. package/dist/ontology/index.js +5 -5
  297. package/dist/ontology/internal.js +3 -3
  298. package/dist/pipelines/index.js +33 -33
  299. package/dist/pipelines/run-dispatch.d.ts +2 -0
  300. package/dist/pipelines/run-dispatch.d.ts.map +1 -1
  301. package/dist/projections/internal.js +27 -27
  302. package/dist/query.js +2 -2
  303. package/dist/queues/in-memory.d.ts +1 -1
  304. package/dist/queues/in-memory.d.ts.map +1 -1
  305. package/dist/runtime/create.d.ts +3 -0
  306. package/dist/runtime/create.d.ts.map +1 -1
  307. package/dist/runtime/internal.js +33 -33
  308. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  309. package/dist/runtime/types.d.ts +16 -0
  310. package/dist/runtime/types.d.ts.map +1 -1
  311. package/dist/sandboxes/exec.d.ts.map +1 -1
  312. package/dist/sandboxes/index.js +5 -5
  313. package/dist/schedules/index.js +2 -2
  314. package/dist/security/grants.d.ts +1 -1
  315. package/dist/security/grants.d.ts.map +1 -1
  316. package/dist/security/internal.js +1 -1
  317. package/dist/security/project.d.ts.map +1 -1
  318. package/dist/security/public.js +2 -2
  319. package/dist/security/types.d.ts +10 -3
  320. package/dist/security/types.d.ts.map +1 -1
  321. package/dist/security/validation.d.ts.map +1 -1
  322. package/dist/shares/execution.d.ts +9 -0
  323. package/dist/shares/execution.d.ts.map +1 -1
  324. package/dist/shares/index.d.ts +1 -1
  325. package/dist/shares/index.d.ts.map +1 -1
  326. package/dist/shares/internal.js +24 -24
  327. package/dist/storage/action-runs/failure.js +2 -2
  328. package/dist/storage/agents/in-memory.d.ts +38 -1
  329. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  330. package/dist/storage/agents/index.d.ts +1 -1
  331. package/dist/storage/agents/index.d.ts.map +1 -1
  332. package/dist/storage/agents/provider.d.ts +43 -5
  333. package/dist/storage/agents/provider.d.ts.map +1 -1
  334. package/dist/storage/agents/provider.js +30 -6
  335. package/dist/storage/agents/provider.js.map +1 -1
  336. package/dist/storage/agents/types.d.ts +132 -10
  337. package/dist/storage/agents/types.d.ts.map +1 -1
  338. package/dist/storage/ai-cost/analytics.d.ts +13 -5
  339. package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
  340. package/dist/storage/ai-cost/groups.d.ts +19 -2
  341. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  342. package/dist/storage/ai-cost/in-memory.d.ts +6 -1
  343. package/dist/storage/ai-cost/in-memory.d.ts.map +1 -1
  344. package/dist/storage/ai-cost/index.d.ts +1 -1
  345. package/dist/storage/ai-cost/index.d.ts.map +1 -1
  346. package/dist/storage/ai-cost/provider.d.ts +1 -1
  347. package/dist/storage/ai-cost/provider.d.ts.map +1 -1
  348. package/dist/storage/ai-cost/provider.js +7 -5
  349. package/dist/storage/ai-cost/provider.js.map +1 -1
  350. package/dist/storage/ai-cost/types.d.ts +65 -9
  351. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  352. package/dist/storage/ai-limits/enforcement.js +4 -4
  353. package/dist/storage/ai-limits/provider.js +2 -2
  354. package/dist/storage/connector-connections/provider.js +1 -1
  355. package/dist/storage/file-upload-sessions/provider.js +10 -10
  356. package/dist/storage/in-memory/index.d.ts.map +1 -1
  357. package/dist/storage/index.d.ts +3 -3
  358. package/dist/storage/index.d.ts.map +1 -1
  359. package/dist/storage/index.js +31 -31
  360. package/dist/storage/index.js.map +1 -1
  361. package/dist/storage/internal.d.ts +2 -0
  362. package/dist/storage/internal.d.ts.map +1 -1
  363. package/dist/storage/internal.js +11 -7
  364. package/dist/storage/internal.js.map +1 -1
  365. package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
  366. package/dist/storage/objects/query-preparation.d.ts +5 -0
  367. package/dist/storage/objects/query-preparation.d.ts.map +1 -1
  368. package/dist/storage/ontology/commits.d.ts +6 -1
  369. package/dist/storage/ontology/commits.d.ts.map +1 -1
  370. package/dist/storage/ontology/in-memory/commits.d.ts.map +1 -1
  371. package/dist/storage/ontology/in-memory/materializations.d.ts +2 -1
  372. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  373. package/dist/storage/ontology/index.d.ts +1 -1
  374. package/dist/storage/ontology/index.d.ts.map +1 -1
  375. package/dist/storage/ontology/materializations.d.ts +16 -0
  376. package/dist/storage/ontology/materializations.d.ts.map +1 -1
  377. package/dist/storage/ontology/provider.d.ts +6 -1
  378. package/dist/storage/ontology/provider.d.ts.map +1 -1
  379. package/dist/storage/ontology/provider.js +4 -2
  380. package/dist/storage/ontology/provider.js.map +1 -1
  381. package/dist/storage/operation-scope.d.ts +10 -0
  382. package/dist/storage/operation-scope.d.ts.map +1 -1
  383. package/dist/storage/operation-scope.js +7 -3
  384. package/dist/storage/operation-scope.js.map +1 -1
  385. package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
  386. package/dist/storage/pipeline-runs/transitions.d.ts +7 -0
  387. package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -0
  388. package/dist/storage/projection-runs/provider.js +2 -2
  389. package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
  390. package/dist/storage/sync-runs/transitions.d.ts +7 -0
  391. package/dist/storage/sync-runs/transitions.d.ts.map +1 -0
  392. package/dist/storage/workflow-runs/provider.js +10 -10
  393. package/dist/syncs/index.js +34 -34
  394. package/dist/syncs/run-dispatch.d.ts +2 -0
  395. package/dist/syncs/run-dispatch.d.ts.map +1 -1
  396. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  397. package/dist/testing/agent-token-rate-storage-contract.d.ts +14 -0
  398. package/dist/testing/agent-token-rate-storage-contract.d.ts.map +1 -0
  399. package/dist/testing/ai-model-call-groups-contract.d.ts +1 -1
  400. package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
  401. package/dist/testing/dataset-sequence-contract.d.ts.map +1 -1
  402. package/dist/testing/index.d.ts +1 -0
  403. package/dist/testing/index.d.ts.map +1 -1
  404. package/dist/testing/index.js +4514 -3530
  405. package/dist/testing/index.js.map +13 -12
  406. package/dist/testing/lake-changes-contract.d.ts.map +1 -1
  407. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  408. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  409. package/dist/testing/object-query-contract.d.ts.map +1 -1
  410. package/dist/testing/ontology-contract-fixture.d.ts +3 -3
  411. package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
  412. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  413. package/dist/webhooks/internal.js +25 -25
  414. package/dist/workers/index.d.ts +1 -0
  415. package/dist/workers/index.d.ts.map +1 -1
  416. package/dist/workers/index.js +13 -3
  417. package/dist/workers/index.js.map +5 -4
  418. package/dist/workers/unstarted-run.d.ts +10 -0
  419. package/dist/workers/unstarted-run.d.ts.map +1 -0
  420. package/dist/workflows/builders.d.ts.map +1 -1
  421. package/dist/workflows/index.js +54 -54
  422. package/dist/workflows/types.d.ts +6 -0
  423. package/dist/workflows/types.d.ts.map +1 -1
  424. package/dist/workflows/validation.d.ts.map +1 -1
  425. package/package.json +7 -1
  426. package/src/actions/request.ts +6 -0
  427. package/src/actions/run/context.ts +6 -0
  428. package/src/actions/run/execute.ts +8 -2
  429. package/src/actions/run/executor.ts +4 -0
  430. package/src/actions/run/types.ts +5 -0
  431. package/src/actions/types/context.ts +11 -0
  432. package/src/agents/README.md +11 -3
  433. package/src/agents/adapters.ts +73 -23
  434. package/src/agents/approvals.ts +22 -0
  435. package/src/agents/context-budget.ts +121 -0
  436. package/src/agents/context-compaction.ts +317 -150
  437. package/src/agents/context-files.ts +48 -0
  438. package/src/agents/context-parts.ts +219 -0
  439. package/src/agents/context-request.ts +100 -0
  440. package/src/agents/context-token-rate.ts +224 -0
  441. package/src/agents/context-use.ts +187 -0
  442. package/src/agents/dispatch.ts +2 -0
  443. package/src/agents/execution.ts +105 -0
  444. package/src/agents/index.ts +46 -2
  445. package/src/agents/inline-images.ts +17 -0
  446. package/src/agents/message.ts +70 -1
  447. package/src/agents/model-loop.ts +192 -61
  448. package/src/agents/request.ts +18 -1
  449. package/src/agents/run-events.ts +3 -2
  450. package/src/agents/run-plan.ts +22 -3
  451. package/src/agents/run-session-http.ts +8 -5
  452. package/src/agents/run-session-serve.ts +133 -9
  453. package/src/agents/run-session.ts +30 -4
  454. package/src/agents/run-tools.ts +10 -2
  455. package/src/agents/run-turn.ts +116 -26
  456. package/src/agents/skills.ts +9 -2
  457. package/src/agents/step-limits.ts +27 -0
  458. package/src/agents/streams/index.ts +2 -0
  459. package/src/agents/streams/internal.ts +2 -0
  460. package/src/agents/streams/protocol.ts +125 -2
  461. package/src/agents/thread-context-projection.ts +25 -17
  462. package/src/agents/tool-files.ts +41 -3
  463. package/src/auth/runtime.ts +30 -1
  464. package/src/auth/types.ts +5 -0
  465. package/src/authorization/decision.ts +5 -0
  466. package/src/authorization/grant-kinds.ts +8 -0
  467. package/src/authorization/index.ts +2 -0
  468. package/src/authorization/run-visibility.ts +37 -0
  469. package/src/datasets/execution.ts +91 -2
  470. package/src/datasets/index.ts +1 -0
  471. package/src/datasets/lineage.ts +194 -0
  472. package/src/deploy/types.ts +8 -1
  473. package/src/env/index.ts +46 -0
  474. package/src/errors/catalog.ts +12 -0
  475. package/src/events/selectors/predicate.ts +15 -0
  476. package/src/events/types/datasets.ts +6 -0
  477. package/src/execution/index.ts +1 -0
  478. package/src/execution/request-client.ts +44 -0
  479. package/src/execution/request.ts +2 -0
  480. package/src/http/api-routes.ts +24 -25
  481. package/src/index.ts +32 -0
  482. package/src/lake-storage/in-memory.ts +30 -20
  483. package/src/lake-storage/index.ts +2 -1
  484. package/src/lake-storage/source-ordering.ts +31 -4
  485. package/src/lake-storage/types.ts +18 -0
  486. package/src/lake-storage/version-inputs.ts +21 -5
  487. package/src/lineage/README.md +107 -0
  488. package/src/lineage/commits.ts +173 -0
  489. package/src/lineage/executors.ts +103 -0
  490. package/src/lineage/link.ts +138 -0
  491. package/src/lineage/object.ts +218 -0
  492. package/src/lineage/projections.ts +174 -0
  493. package/src/lineage/reader.ts +89 -0
  494. package/src/lineage/sources.ts +156 -0
  495. package/src/lineage/types.ts +149 -0
  496. package/src/materializer/effective/resolve.ts +198 -50
  497. package/src/models/errors.ts +10 -0
  498. package/src/models/events.ts +13 -1
  499. package/src/models/execution/index.ts +1 -0
  500. package/src/models/execution/model-call-recorder.ts +7 -1
  501. package/src/models/index.ts +3 -0
  502. package/src/models/language-model.ts +34 -2
  503. package/src/objects/execution.ts +6 -1
  504. package/src/objects/query/executor.ts +28 -13
  505. package/src/objects/query/index.ts +1 -0
  506. package/src/objects/query/ir.ts +16 -0
  507. package/src/objects/query/link-endpoints.ts +29 -0
  508. package/src/objects/query/normalize.ts +3 -0
  509. package/src/objects/query/planner.ts +5 -0
  510. package/src/objects/query/validate.ts +73 -3
  511. package/src/objects/sdk/object-set.ts +33 -1
  512. package/src/pipelines/run-dispatch.ts +53 -6
  513. package/src/runtime/create.ts +6 -0
  514. package/src/runtime/resolve-definitions.ts +7 -0
  515. package/src/runtime/sixb.ts +4 -1
  516. package/src/runtime/types.ts +18 -0
  517. package/src/sandboxes/exec.ts +19 -0
  518. package/src/security/grants.ts +3 -0
  519. package/src/security/project.ts +1 -0
  520. package/src/security/types.ts +8 -3
  521. package/src/security/validation.ts +5 -4
  522. package/src/shares/execution.ts +35 -3
  523. package/src/shares/index.ts +1 -0
  524. package/src/storage/agents/in-memory.ts +179 -8
  525. package/src/storage/agents/index.ts +8 -0
  526. package/src/storage/agents/provider.ts +219 -6
  527. package/src/storage/agents/types.ts +145 -9
  528. package/src/storage/ai-cost/analytics.ts +177 -10
  529. package/src/storage/ai-cost/groups.ts +122 -35
  530. package/src/storage/ai-cost/in-memory.ts +10 -4
  531. package/src/storage/ai-cost/index.ts +5 -0
  532. package/src/storage/ai-cost/provider.ts +5 -1
  533. package/src/storage/ai-cost/types.ts +65 -9
  534. package/src/storage/in-memory/index.ts +10 -0
  535. package/src/storage/index.ts +15 -0
  536. package/src/storage/internal.ts +2 -0
  537. package/src/storage/objects/in-memory/query.ts +5 -1
  538. package/src/storage/objects/query-preparation.ts +10 -0
  539. package/src/storage/ontology/commits.ts +6 -1
  540. package/src/storage/ontology/in-memory/commits.ts +7 -0
  541. package/src/storage/ontology/in-memory/materializations.ts +24 -0
  542. package/src/storage/ontology/index.ts +2 -0
  543. package/src/storage/ontology/materializations.ts +21 -0
  544. package/src/storage/ontology/provider.ts +41 -1
  545. package/src/storage/operation-scope.ts +41 -0
  546. package/src/storage/pipeline-runs/in-memory.ts +2 -5
  547. package/src/storage/pipeline-runs/transitions.ts +14 -0
  548. package/src/storage/sync-runs/in-memory.ts +2 -5
  549. package/src/storage/sync-runs/transitions.ts +11 -0
  550. package/src/syncs/run-dispatch.ts +68 -13
  551. package/src/testing/agent-storage-contract.ts +426 -20
  552. package/src/testing/agent-token-rate-storage-contract.ts +171 -0
  553. package/src/testing/ai-model-call-groups-contract.ts +225 -7
  554. package/src/testing/dataset-sequence-contract.ts +81 -0
  555. package/src/testing/index.ts +5 -0
  556. package/src/testing/lake-changes-contract.ts +2 -1
  557. package/src/testing/lake-storage-contract.ts +112 -0
  558. package/src/testing/materializer-storage-contract.ts +294 -10
  559. package/src/testing/object-query-contract.ts +48 -0
  560. package/src/testing/ontology-contract-fixture.ts +18 -7
  561. package/src/testing/ontology-storage-contract.ts +42 -0
  562. package/src/workers/index.ts +1 -0
  563. package/src/workers/unstarted-run.ts +18 -0
  564. package/src/workflows/builders.ts +8 -1
  565. package/src/workflows/types.ts +6 -0
  566. package/src/workflows/validation.ts +1 -0
  567. package/dist/chunk-06sg8s4z.js.map +0 -15
  568. package/dist/chunk-0bc3w0zq.js.map +0 -11
  569. package/dist/chunk-18sk89cg.js.map +0 -10
  570. package/dist/chunk-1xvqgg88.js.map +0 -14
  571. package/dist/chunk-2adz0h75.js.map +0 -11
  572. package/dist/chunk-8xnz9vvp.js.map +0 -12
  573. package/dist/chunk-axb4ss9a.js.map +0 -12
  574. package/dist/chunk-cbcgs9f7.js.map +0 -11
  575. package/dist/chunk-jt3r6thp.js.map +0 -10
  576. package/dist/chunk-mdxmt0n3.js.map +0 -120
  577. package/dist/chunk-qst145py.js.map +0 -18
  578. package/dist/chunk-ratkv4zc.js +0 -3
  579. package/dist/chunk-t3brw0wd.js.map +0 -14
  580. package/dist/chunk-vhbw5sqm.js.map +0 -10
  581. package/dist/chunk-yd00vzqr.js.map +0 -37
  582. package/dist/chunk-z9mg7wya.js.map +0 -13
  583. /package/dist/{chunk-c0vk1djt.js.map → chunk-165c9wm6.js.map} +0 -0
  584. /package/dist/{chunk-8mb7mt8n.js.map → chunk-21q0j5f2.js.map} +0 -0
  585. /package/dist/{chunk-hn76sanm.js.map → chunk-23s66j86.js.map} +0 -0
  586. /package/dist/{chunk-h1na2cxc.js.map → chunk-2g0r46hy.js.map} +0 -0
  587. /package/dist/{chunk-tdxfsg1c.js.map → chunk-47e09r7z.js.map} +0 -0
  588. /package/dist/{chunk-fntqb7qy.js.map → chunk-57g0215c.js.map} +0 -0
  589. /package/dist/{chunk-npcr0228.js.map → chunk-5kyvrtjh.js.map} +0 -0
  590. /package/dist/{chunk-zhh1jd89.js.map → chunk-5taem5aw.js.map} +0 -0
  591. /package/dist/{chunk-tnhqtfea.js.map → chunk-6b61s40c.js.map} +0 -0
  592. /package/dist/{chunk-4ymrcdbm.js.map → chunk-7hd2ez3q.js.map} +0 -0
  593. /package/dist/{chunk-315qye3g.js.map → chunk-80nh73br.js.map} +0 -0
  594. /package/dist/{chunk-b6ghvap7.js.map → chunk-8yzhjawq.js.map} +0 -0
  595. /package/dist/{chunk-2vjnyz1s.js.map → chunk-9rh8ncs5.js.map} +0 -0
  596. /package/dist/{chunk-pgrf64hp.js.map → chunk-agn8d8ys.js.map} +0 -0
  597. /package/dist/{chunk-6qn7nmd3.js.map → chunk-aqyjb86c.js.map} +0 -0
  598. /package/dist/{chunk-4jq2bg8t.js.map → chunk-ax10ft8d.js.map} +0 -0
  599. /package/dist/{chunk-7ex2p3zp.js.map → chunk-cgznz22f.js.map} +0 -0
  600. /package/dist/{chunk-qgvbxfqv.js.map → chunk-djs3hw9p.js.map} +0 -0
  601. /package/dist/{chunk-dgtd0836.js.map → chunk-e7v3trpz.js.map} +0 -0
  602. /package/dist/{chunk-59kf345w.js.map → chunk-jbw70d6t.js.map} +0 -0
  603. /package/dist/{chunk-78ymxrn0.js.map → chunk-jhbk10wf.js.map} +0 -0
  604. /package/dist/{chunk-phm3c7b9.js.map → chunk-jjmggm9a.js.map} +0 -0
  605. /package/dist/{chunk-ft3w5ahs.js.map → chunk-m3qe54bb.js.map} +0 -0
  606. /package/dist/{chunk-y7j6x4h0.js.map → chunk-neftrg0n.js.map} +0 -0
  607. /package/dist/{chunk-07kkp2e1.js.map → chunk-nghc7eq0.js.map} +0 -0
  608. /package/dist/{chunk-vx4e4zv4.js.map → chunk-nqnfz3jg.js.map} +0 -0
  609. /package/dist/{chunk-e24fvw8g.js.map → chunk-qbrmpgvv.js.map} +0 -0
  610. /package/dist/{chunk-dp0cdtj2.js.map → chunk-qsg8rw04.js.map} +0 -0
  611. /package/dist/{chunk-0kk2wt0h.js.map → chunk-r1cxq7vv.js.map} +0 -0
  612. /package/dist/{chunk-g663fahq.js.map → chunk-scyq22td.js.map} +0 -0
  613. /package/dist/{chunk-7wn5z7mq.js.map → chunk-t9xyr7y9.js.map} +0 -0
  614. /package/dist/{chunk-45ngkxkp.js.map → chunk-w122ymx4.js.map} +0 -0
  615. /package/dist/{chunk-48jezz3j.js.map → chunk-w976a4me.js.map} +0 -0
  616. /package/dist/{chunk-qtzftvxa.js.map → chunk-wx7smkn2.js.map} +0 -0
  617. /package/dist/{chunk-c14ap3s9.js.map → chunk-y2x2935j.js.map} +0 -0
@@ -30,11 +30,11 @@ import {
30
30
  normalizeLinkProperties2,
31
31
  validateLinkProperties2,
32
32
  assertTelemetryProperty2
33
- } from "./chunk-qgvbxfqv.js";
33
+ } from "./chunk-djs3hw9p.js";
34
34
  import {
35
35
  isObjectRefSchema2,
36
36
  validateSchemaOrRefValue2
37
- } from "./chunk-dgtd0836.js";
37
+ } from "./chunk-e7v3trpz.js";
38
38
  import {
39
39
  ActionValidationError2,
40
40
  SIXB_ERROR_CODES2,
@@ -43,7 +43,7 @@ import {
43
43
  isSixbError2,
44
44
  toSixbFailure2,
45
45
  summarizeErrorMessage2
46
- } from "./chunk-zbc929zg.js";
46
+ } from "./chunk-escedwyt.js";
47
47
  import {
48
48
  agentServiceAccountId2,
49
49
  ObjectReadLimitExceededError2,
@@ -65,19 +65,17 @@ import {
65
65
  assertModelAccess2,
66
66
  canAccessModels2,
67
67
  canViewEvent2,
68
+ projectionTargetOf2,
68
69
  canViewWorkflowRun2,
69
70
  canViewWorkflowIntervention2,
70
71
  canViewPipelineRun2,
71
72
  canViewProjectionRun2,
73
+ canViewPrimitiveRun2,
72
74
  canViewProjection2
73
- } from "./chunk-ye5c8016.js";
75
+ } from "./chunk-dz7a4t3a.js";
74
76
  import {
75
77
  compileSelectedObjectReadScope2
76
78
  } from "./chunk-31khg3g0.js";
77
- import {
78
- ACTION_RUN_FAILURE_CODES2,
79
- parseActionRunFailure2
80
- } from "./chunk-c0vk1djt.js";
81
79
  import {
82
80
  ActionDefinitionError2,
83
81
  missingActionMutationMessage,
@@ -89,6 +87,7 @@ import {
89
87
  coerceActionParamsToTyped,
90
88
  validateActionSubject,
91
89
  resolveObjectActionSubject,
90
+ getRequestClientAddress2,
92
91
  INDEXING_EMBEDDING_TIMEOUT_MS,
93
92
  vectorConfiguration,
94
93
  vectorSources,
@@ -97,11 +96,15 @@ import {
97
96
  createUsersRuntime,
98
97
  SYSTEM_PRINCIPAL2,
99
98
  principalsEqual2
100
- } from "./chunk-8v6xzwgr.js";
99
+ } from "./chunk-3x3bebz7.js";
100
+ import {
101
+ ACTION_RUN_FAILURE_CODES2,
102
+ parseActionRunFailure2
103
+ } from "./chunk-165c9wm6.js";
101
104
  import {
102
105
  isModelReasoning2,
103
106
  modelReasoningSupportIssue2
104
- } from "./chunk-pdt5cw8z.js";
107
+ } from "./chunk-tvefbgvw.js";
105
108
  import {
106
109
  TranscriptionModelResponseError2,
107
110
  SpeechModelResponseError2,
@@ -122,7 +125,7 @@ import {
122
125
  question2,
123
126
  ImageModelResponseError2,
124
127
  estimateModelCall
125
- } from "./chunk-tdxfsg1c.js";
128
+ } from "./chunk-47e09r7z.js";
126
129
  import {
127
130
  AgentStorageError2,
128
131
  createAgentThreadId2,
@@ -130,14 +133,15 @@ import {
130
133
  createAgentRunId2,
131
134
  createAgentMessageId2,
132
135
  AGENT_REASONING_LEVELS2,
136
+ movesComputerPlace2,
133
137
  isAgentApprovalMode2,
134
138
  agentApprovalHoldsRun2
135
- } from "./chunk-z9mg7wya.js";
139
+ } from "./chunk-edx8xcsm.js";
136
140
  import {
137
141
  actionRunRequestsEqual,
138
142
  ObjectNotFoundError2,
139
143
  ArtifactStorageError
140
- } from "./chunk-fe8zwt8b.js";
144
+ } from "./chunk-e6xgz4h4.js";
141
145
  import {
142
146
  ExecutionStorageError2
143
147
  } from "./chunk-eptrvnby.js";
@@ -151,17 +155,17 @@ import {
151
155
  objectBatchKey2,
152
156
  matchesPredicate,
153
157
  WORKFLOW_RUN_FAILURE_CODES2
154
- } from "./chunk-8v5a54qz.js";
158
+ } from "./chunk-cb21tx14.js";
155
159
  import {
156
160
  WorkflowRunError2,
157
161
  missingClearanceRedactions,
158
162
  resolveAgentExecutionAuthorization2,
159
163
  userCanRunAgent2,
160
164
  resolveInheritedAgentExecutionAuthorization2
161
- } from "./chunk-y7j6x4h0.js";
165
+ } from "./chunk-neftrg0n.js";
162
166
  import {
163
167
  explainObjectQuery2
164
- } from "./chunk-qst145py.js";
168
+ } from "./chunk-tvbmh7tj.js";
165
169
  import {
166
170
  redactDomainEvent,
167
171
  uniqueLookupKeyOf,
@@ -170,12 +174,12 @@ import {
170
174
  readerClearance,
171
175
  readerEventClearance,
172
176
  readerViewConditions
173
- } from "./chunk-b6ghvap7.js";
177
+ } from "./chunk-8yzhjawq.js";
174
178
  import {
175
179
  shareSixbErrorReporter2,
176
180
  reportActionPhaseFailure2,
177
181
  reportRunFailure2
178
- } from "./chunk-48jezz3j.js";
182
+ } from "./chunk-w976a4me.js";
179
183
  import {
180
184
  getOntologyMutationRuntime2,
181
185
  shareOntologyMutationRuntime2,
@@ -192,13 +196,14 @@ import {
192
196
  createActivityCaptureRuntime,
193
197
  registerActivityCaptureRuntime,
194
198
  ModelExecutionSession
195
- } from "./chunk-4jq2bg8t.js";
199
+ } from "./chunk-ax10ft8d.js";
196
200
  import {
201
+ publishAgentThreadMoved2,
197
202
  publishAgentApprovalActivity,
198
203
  publishAgentRunActivity2,
199
204
  publishAgentRunCancel2,
200
205
  publishAgentRunFinished2
201
- } from "./chunk-jt3r6thp.js";
206
+ } from "./chunk-fg1db9xx.js";
202
207
  import {
203
208
  createArtifactId
204
209
  } from "./chunk-3fqxbn31.js";
@@ -208,13 +213,13 @@ import {
208
213
  agentThreadViews,
209
214
  createRuntimeArtifactAccessRule,
210
215
  createArtifactsRuntime
211
- } from "./chunk-7wn5z7mq.js";
216
+ } from "./chunk-t9xyr7y9.js";
212
217
  import {
213
218
  aiLimitSubjectsFromAttribution2,
214
219
  applicableAiLimitPolicyStatuses2,
215
220
  aiUsageLimitExceededError2,
216
221
  aiUsageLimitUnavailableError2
217
- } from "./chunk-dp0cdtj2.js";
222
+ } from "./chunk-qsg8rw04.js";
218
223
  import {
219
224
  normalizeAgentContextEntries2
220
225
  } from "./chunk-sgx82nnt.js";
@@ -227,20 +232,26 @@ import {
227
232
  } from "./chunk-5a4a52tq.js";
228
233
  import {
229
234
  createConnectorRuntime
230
- } from "./chunk-2vjnyz1s.js";
235
+ } from "./chunk-9rh8ncs5.js";
231
236
  import {
232
237
  writeDataset2
233
- } from "./chunk-59kf345w.js";
238
+ } from "./chunk-jbw70d6t.js";
234
239
  import {
235
240
  AI_MODEL_CALL_OUTPUT_TOKEN_ALLOWANCE,
236
241
  aiModelCallOutputTokenAllowance,
237
242
  ModelUsageRecordingError2,
238
243
  LanguageModelCallMeter
239
- } from "./chunk-mqx25wwh.js";
244
+ } from "./chunk-b7a97n8b.js";
240
245
  import {
241
246
  createLinkScopeFingerprint2,
242
- normalizeJsonProperties2
243
- } from "./chunk-yavhtnac.js";
247
+ normalizeJsonProperties2,
248
+ usableLinkSlotOverride,
249
+ explainEffectiveObject,
250
+ storedObjectEditedAt,
251
+ resolveEffectiveLink,
252
+ resolveEffectiveLinkSlotMember,
253
+ linkCardinality
254
+ } from "./chunk-rjeeyssy.js";
244
255
  import {
245
256
  resolveLoggingService2
246
257
  } from "./chunk-1vg43g9q.js";
@@ -251,61 +262,69 @@ import {
251
262
  import {
252
263
  SyncValidationError2,
253
264
  requestSyncRun2
254
- } from "./chunk-axb4ss9a.js";
265
+ } from "./chunk-h05rg3bx.js";
255
266
  import {
256
267
  SandboxError2,
257
268
  sandboxCredentialIssue2,
258
269
  staticSandboxRecipe2
259
- } from "./chunk-0kk2wt0h.js";
270
+ } from "./chunk-r1cxq7vv.js";
260
271
  import {
261
272
  compileShareAccessPlan
262
- } from "./chunk-7ex2p3zp.js";
273
+ } from "./chunk-cgznz22f.js";
263
274
  import {
264
275
  schemaRecordToJsonSchema2
265
276
  } from "./chunk-e5wf5vz0.js";
266
277
  import {
267
278
  requestPipelineRun2
268
- } from "./chunk-0bc3w0zq.js";
279
+ } from "./chunk-epyfm23v.js";
269
280
  import {
270
281
  PipelineError2
271
282
  } from "./chunk-hke9aeen.js";
272
283
  import {
273
284
  createObjectQueryBuilder2,
274
285
  decorateObjectQueryExecutor
275
- } from "./chunk-315qye3g.js";
286
+ } from "./chunk-80nh73br.js";
287
+ import {
288
+ lineageColumn,
289
+ isUnknownLineage,
290
+ versionLineage
291
+ } from "./chunk-ff5xkv0p.js";
276
292
  import {
277
293
  executionRecordInputFromRuntime,
278
294
  ensureExecutionRecord2,
279
295
  createPrimitiveExecutionRecord,
280
296
  restoreTrustedPrimitiveExecutionScope
281
- } from "./chunk-e24fvw8g.js";
297
+ } from "./chunk-qbrmpgvv.js";
282
298
  import {
283
299
  resolveLanguageModel2
284
- } from "./chunk-07kkp2e1.js";
300
+ } from "./chunk-nghc7eq0.js";
285
301
  import {
286
302
  getDatasetPrimaryKeyColumns2
287
- } from "./chunk-tnhqtfea.js";
303
+ } from "./chunk-6b61s40c.js";
288
304
  import {
289
305
  ShareGrantStorageError2,
290
306
  objectReadScopeForAccessPlan
291
307
  } from "./chunk-2pk5hjj9.js";
308
+ import {
309
+ ActionRunError2
310
+ } from "./chunk-3gbefjg5.js";
292
311
  import {
293
312
  AI_USAGE_FIELDS,
294
313
  normalizeAiModelCallUsage2,
295
314
  aggregateAiModelCallUsage2
296
- } from "./chunk-pgrf64hp.js";
297
- import {
298
- ActionRunError2
299
- } from "./chunk-3gbefjg5.js";
315
+ } from "./chunk-agn8d8ys.js";
300
316
  import {
301
317
  RuntimeError2
302
318
  } from "./chunk-m4ehq95f.js";
319
+ import {
320
+ eventAttribution2
321
+ } from "./chunk-mzx71snp.js";
303
322
  import {
304
323
  normalizeParams
305
- } from "./chunk-8mb7mt8n.js";
324
+ } from "./chunk-21q0j5f2.js";
306
325
  import {
307
326
  ObjectQueryPlanningError2
308
- } from "./chunk-fakrpfy3.js";
327
+ } from "./chunk-0k1h5hmr.js";
309
328
  import {
310
329
  MaterializationValidationError2,
311
330
  MaterializationObjectNotFoundError2,
@@ -322,14 +341,14 @@ import {
322
341
  UnsupportedModelFeatureError2,
323
342
  StructuredOutputError2,
324
343
  sameEmbeddingModel
325
- } from "./chunk-kyjcwqz6.js";
344
+ } from "./chunk-rtkqczbr.js";
326
345
  import {
327
346
  AgentRequestError2,
328
347
  AgentMemoryError2
329
348
  } from "./chunk-9wr3yajk.js";
330
349
  import {
331
350
  AGENT_APPROVAL_MODES2
332
- } from "./chunk-18sk89cg.js";
351
+ } from "./chunk-jk97v21j.js";
333
352
  import {
334
353
  resolveFileRefAtPath2,
335
354
  openFileRef2,
@@ -633,6 +652,23 @@ class ActionRegistry2 {
633
652
  return null;
634
653
  }
635
654
  }
655
+ // src/execution/request-client.ts
656
+ var MAX_USER_AGENT_LENGTH = 512;
657
+ var requestClients = new WeakMap;
658
+ function bindRequestClient(execution, request) {
659
+ if (execution.executor.type !== "request") {
660
+ throw new Error("[Sixb] Only a request execution has a request client.");
661
+ }
662
+ const userAgent = request.headers.get("user-agent")?.trim();
663
+ requestClients.set(execution, Object.freeze({
664
+ address: getRequestClientAddress2(request),
665
+ userAgent: userAgent ? userAgent.slice(0, MAX_USER_AGENT_LENGTH) : undefined
666
+ }));
667
+ }
668
+ function getRequestClient(execution) {
669
+ return requestClients.get(execution);
670
+ }
671
+
636
672
  // src/shared/params/user-refs.ts
637
673
  async function assertParamUsersActive(input) {
638
674
  const references = [];
@@ -1222,6 +1258,21 @@ async function turnPausesOnHeldCalls2(agents, run) {
1222
1258
  return true;
1223
1259
  return !await hasActiveChildren2(agents, run);
1224
1260
  }
1261
+ async function threadHoldsPausedTurn(agents, thread) {
1262
+ const { projectId, id: threadId } = thread;
1263
+ const { runs } = await agents.runs.list({
1264
+ projectId,
1265
+ threadId,
1266
+ kinds: ["conversation"],
1267
+ order: "desc",
1268
+ limit: 1
1269
+ });
1270
+ const latest = runs[0];
1271
+ if (!isAwaitingApprovalRun2(latest) || !latest)
1272
+ return false;
1273
+ const approvals = await listTurnApprovals2(agents, { projectId, runId: latest.id });
1274
+ return turnResumeReadiness2(approvals) !== "closed";
1275
+ }
1225
1276
  async function hasActiveChildren2(agents, run) {
1226
1277
  const active = await agents.runs.list({
1227
1278
  projectId: run.projectId,
@@ -2457,7 +2508,8 @@ async function dispatchQueuedAgentRuns2(input) {
2457
2508
  kinds: ["conversation"],
2458
2509
  statuses: ["queued"],
2459
2510
  order: "asc",
2460
- limit
2511
+ limit,
2512
+ excludeComputerTurns: true
2461
2513
  })).runs;
2462
2514
  const queued = runs.filter((run) => run.kind === "conversation" && run.status === "queued" && run.spec?.runsOn !== "computer");
2463
2515
  if (queued.length === 0) {
@@ -2544,6 +2596,8 @@ async function requestAgentRun2(runtime, execution, models, input) {
2544
2596
  if (input.runsOn !== undefined && input.runsOn !== "computer") {
2545
2597
  throw new AgentRequestError2("invalid_message", `[Sixb] 'runsOn' must be "computer" or omitted.`);
2546
2598
  }
2599
+ if (!existingThread)
2600
+ assertComputerPlaceRequest(input.runsOn, input.computer);
2547
2601
  const runsOn = existingThread ? existingThread.runsOn : input.runsOn;
2548
2602
  const approvalMode = input.approvalMode ?? (await resolveAgentApprovalMode(agents, { projectId, principal, threadId: existingThread?.id })).approvalMode;
2549
2603
  const selected = "router" in requested ? await routedConversationRunSpec(agents, {
@@ -2564,7 +2618,8 @@ async function requestAgentRun2(runtime, execution, models, input) {
2564
2618
  threadId: input.threadId,
2565
2619
  title: input.title,
2566
2620
  principal,
2567
- runsOn
2621
+ runsOn,
2622
+ ...input.computer === undefined ? {} : { computer: input.computer }
2568
2623
  });
2569
2624
  const triggerMessageId = input.messageId ?? createAgentMessageId2();
2570
2625
  let run;
@@ -3005,9 +3060,15 @@ function createThread(agents, params) {
3005
3060
  projectId: params.projectId,
3006
3061
  ownerPrincipal: params.principal,
3007
3062
  ...params.title === undefined ? {} : { title: params.title },
3008
- ...params.runsOn === undefined ? {} : { runsOn: params.runsOn }
3063
+ ...params.runsOn === undefined ? {} : { runsOn: params.runsOn },
3064
+ ...params.computer === undefined ? {} : { computer: params.computer }
3009
3065
  });
3010
3066
  }
3067
+ function assertComputerPlaceRequest(runsOn, computer) {
3068
+ if (runsOn === "computer" !== (computer !== undefined)) {
3069
+ throw new AgentRequestError2("invalid_message", `[Sixb] A thread that runs on a computer names it and its folder: send 'runsOn: "computer"' with 'computer', or neither.`);
3070
+ }
3071
+ }
3011
3072
  function requireAgentStorage(runtime) {
3012
3073
  const agents = runtime.storage.agents;
3013
3074
  if (!agents) {
@@ -3289,6 +3350,40 @@ function createAgentRuntime(runtime, execution, models, decision, sandbox, secur
3289
3350
  return preferences.get();
3290
3351
  }
3291
3352
  };
3353
+ const ownedComputerThread = async (threadId) => {
3354
+ const readable = await rule.read(threadId);
3355
+ if (!readable)
3356
+ throw new AgentRequestError2("thread_not_found", "[Sixb] Agent thread not found.");
3357
+ if (readable.access !== "owner") {
3358
+ throw new AgentRequestError2("not_thread_owner", `[Sixb] Only the owner of Agent thread '${threadId}' moves it.`);
3359
+ }
3360
+ if (readable.thread.runsOn !== "computer") {
3361
+ throw new AgentRequestError2("invalid_message", `[Sixb] Agent thread '${threadId}' runs in the cloud, on no computer.`);
3362
+ }
3363
+ return readable.thread;
3364
+ };
3365
+ const moveThread = (thread, moves, move) => runtime.storage.transaction(async (tx) => {
3366
+ const agents = tx.agents;
3367
+ if (!agents) {
3368
+ throw new AgentRequestError2("storage_unavailable", "[Sixb] Agent storage is not configured.");
3369
+ }
3370
+ const moved = await move(agents).catch((error) => {
3371
+ throw error instanceof AgentStorageError2 && error.code === "active_run_exists" ? new AgentRequestError2("active_run_exists", "[Sixb] A turn is running on the computer: stop it, or let it end, first.") : error;
3372
+ });
3373
+ if (moves && await threadHoldsPausedTurn(agents, thread)) {
3374
+ throw new AgentRequestError2("active_run_exists", "[Sixb] A turn is waiting for your approval: answer or stop it first.");
3375
+ }
3376
+ return moved;
3377
+ });
3378
+ const announceThreadMoved = async (thread) => {
3379
+ await publishAgentThreadMoved2(runtime.broker, {
3380
+ projectId: runtime.projectId,
3381
+ ownerPrincipal: thread.ownerPrincipal,
3382
+ threadId: thread.id
3383
+ }).catch((error) => {
3384
+ console.error(`[Sixb] Could not announce the move of Agent thread '${thread.id}'.`, error);
3385
+ });
3386
+ };
3292
3387
  const agentRuntime = {
3293
3388
  get: getAgent,
3294
3389
  memory: createAgentMemoryRuntime(runtime),
@@ -3317,6 +3412,24 @@ function createAgentRuntime(runtime, execution, models, decision, sandbox, secur
3317
3412
  const [view] = await agentThreadViews(runtime, [{ ...thread, sandboxState }]);
3318
3413
  return view ?? thread;
3319
3414
  },
3415
+ moveToComputer: async (threadId, computer) => {
3416
+ const thread = await ownedComputerThread(threadId);
3417
+ const moves = movesComputerPlace2(thread, computer);
3418
+ const moved = await moveThread(thread, moves, (agents) => agents.threads.assignComputer({ projectId: runtime.projectId, id: threadId, computer }));
3419
+ if (moves)
3420
+ await announceThreadMoved(thread);
3421
+ const [view] = await agentThreadViews(runtime, [moved]);
3422
+ return view ?? moved;
3423
+ },
3424
+ moveToCloud: async (threadId) => {
3425
+ const thread = await ownedComputerThread(threadId);
3426
+ const { thread: moved, queued } = await moveThread(thread, true, (agents) => agents.threads.moveToCloud({ projectId: runtime.projectId, id: threadId }));
3427
+ if (queued)
3428
+ await dispatchAgentRun(runtime, requireAgents(), queued.id);
3429
+ await announceThreadMoved(thread);
3430
+ const [view] = await agentThreadViews(runtime, [moved]);
3431
+ return view ?? moved;
3432
+ },
3320
3433
  create: async (input) => {
3321
3434
  assertNoAgentSelector(input);
3322
3435
  const agent = getAgent();
@@ -3330,6 +3443,7 @@ function createAgentRuntime(runtime, execution, models, decision, sandbox, secur
3330
3443
  if (input.runsOn !== undefined && input.runsOn !== "computer") {
3331
3444
  throw new AgentRequestError2("invalid_message", `[Sixb] 'runsOn' must be "computer" or omitted.`);
3332
3445
  }
3446
+ assertComputerPlaceRequest(input.runsOn, input.computer);
3333
3447
  if (input.runsOn === "computer" && input.sandbox !== undefined) {
3334
3448
  throw new AgentRequestError2("invalid_sandbox_params", "[Sixb] A thread that runs on a computer works in its folder: it takes no sandbox.");
3335
3449
  }
@@ -3343,7 +3457,8 @@ function createAgentRuntime(runtime, execution, models, decision, sandbox, secur
3343
3457
  projectId: runtime.projectId,
3344
3458
  ownerPrincipal: principal,
3345
3459
  ...input.title === undefined ? {} : { title: input.title },
3346
- ...input.runsOn === undefined ? {} : { runsOn: input.runsOn }
3460
+ ...input.runsOn === undefined ? {} : { runsOn: input.runsOn },
3461
+ ...input.computer === undefined ? {} : { computer: input.computer }
3347
3462
  });
3348
3463
  return { ...created, participants: [] };
3349
3464
  },
@@ -3759,6 +3874,95 @@ function commandContext(runtime, execution, connectorId) {
3759
3874
  });
3760
3875
  }
3761
3876
 
3877
+ // src/datasets/lineage.ts
3878
+ var DEFAULT_LINEAGE_DEPTH = 5;
3879
+ var MAX_LINEAGE_DEPTH = 20;
3880
+ var MAX_DATASET_LINEAGE_NODES = 100;
3881
+ function datasetLineageDepth(depth) {
3882
+ if (depth === undefined)
3883
+ return DEFAULT_LINEAGE_DEPTH;
3884
+ if (!Number.isInteger(depth) || depth < 1 || depth > MAX_LINEAGE_DEPTH) {
3885
+ throw new Error(`[Sixb] Dataset lineage depth must be an integer between 1 and ${MAX_LINEAGE_DEPTH}, received ${depth}.`);
3886
+ }
3887
+ return depth;
3888
+ }
3889
+ async function walkDatasetLineage(runtime, lakeStorage, root, depth) {
3890
+ const canViewDataset = (datasetId) => isRuntimeAllowed2(runtime, { kind: "dataset.view", datasetId });
3891
+ const nodes = new Map([
3892
+ [versionKey(root), lineageVersion(runtime, root)]
3893
+ ]);
3894
+ const hidden = new Set;
3895
+ const edges = [];
3896
+ let truncated = false;
3897
+ let frontier = [root];
3898
+ for (let step = 1;frontier.length > 0; step++) {
3899
+ const reached = new Map;
3900
+ for (const version of frontier) {
3901
+ for (const input of distinctInputs(version)) {
3902
+ const key = versionKey(input);
3903
+ if (hidden.has(key))
3904
+ continue;
3905
+ if (!nodes.has(key) && !reached.has(key)) {
3906
+ if (step > depth || nodes.size + reached.size >= MAX_DATASET_LINEAGE_NODES) {
3907
+ truncated = true;
3908
+ continue;
3909
+ }
3910
+ if (!canViewDataset(input.datasetId)) {
3911
+ hidden.add(key);
3912
+ continue;
3913
+ }
3914
+ reached.set(key, input);
3915
+ }
3916
+ edges.push({ from: versionRef(input), to: versionRef(version) });
3917
+ }
3918
+ }
3919
+ const refs = [...reached.values()];
3920
+ const versions = await Promise.all(refs.map((ref) => lakeStorage.getVersion(ref.datasetId, ref.versionId)));
3921
+ frontier = versions.filter((version) => version !== null);
3922
+ refs.forEach((ref, index) => {
3923
+ const version = versions[index];
3924
+ nodes.set(versionKey(ref), version ? lineageVersion(runtime, version) : { ...versionRef(ref), expired: true });
3925
+ });
3926
+ }
3927
+ return { nodes: [...nodes.values()], edges, restricted: hidden.size, truncated };
3928
+ }
3929
+ function lineageVersion(runtime, version) {
3930
+ return {
3931
+ ...versionRef(version),
3932
+ mode: version.mode,
3933
+ createdAt: version.createdAt,
3934
+ ...version.parentVersionId === undefined ? {} : { parentVersionId: version.parentVersionId },
3935
+ ...version.producer === undefined ? {} : { producer: visibleProducer(runtime, version.producer) }
3936
+ };
3937
+ }
3938
+ function visibleProducer(runtime, producer) {
3939
+ const { kind, id } = producer;
3940
+ if (id === undefined || kind === "ingest")
3941
+ return { kind };
3942
+ const authority = resolveRuntimeAuthorizationForProject(runtime);
3943
+ const visible = authority.type === "unrestricted" || authority.type === "principal" && canViewPrimitiveRun2(authority.context, { kind, id });
3944
+ if (!visible)
3945
+ return { kind };
3946
+ return {
3947
+ kind,
3948
+ id,
3949
+ ...producer.runId === undefined ? {} : { runId: producer.runId },
3950
+ ...producer.stepId === undefined ? {} : { stepId: producer.stepId }
3951
+ };
3952
+ }
3953
+ function distinctInputs(version) {
3954
+ const inputs = new Map;
3955
+ for (const input of version.inputs ?? [])
3956
+ inputs.set(versionKey(input), input);
3957
+ return [...inputs.values()];
3958
+ }
3959
+ function versionRef(ref) {
3960
+ return { datasetId: ref.datasetId, versionId: ref.versionId };
3961
+ }
3962
+ function versionKey(ref) {
3963
+ return JSON.stringify([ref.datasetId, ref.versionId]);
3964
+ }
3965
+
3762
3966
  // src/datasets/execution.ts
3763
3967
  function createDatasetsRuntime(runtime, execution, source, lakeStorage, blobStorage, versionMarkings) {
3764
3968
  const authority = resolveRuntimeAuthorizationForProject(runtime);
@@ -3771,6 +3975,22 @@ function createDatasetsRuntime(runtime, execution, source, lakeStorage, blobStor
3771
3975
  const dataset = source.getById(datasetId);
3772
3976
  return dataset && allowed(datasetId) ? dataset : null;
3773
3977
  },
3978
+ async listVersions(dataset, input = {}) {
3979
+ assertAuthorized2(runtime, { kind: "dataset.view", datasetId: dataset.id });
3980
+ const registered = source.getById(dataset.id);
3981
+ if (!registered)
3982
+ throw new Error(`[Sixb] Dataset '${dataset.id}' is not registered.`);
3983
+ const versions = await lakeStorage.listVersions(registered.id, input.limit);
3984
+ return versions.map((version) => readerVersion(runtime, version));
3985
+ },
3986
+ async getVersion(dataset, versionId) {
3987
+ assertAuthorized2(runtime, { kind: "dataset.view", datasetId: dataset.id });
3988
+ const registered = source.getById(dataset.id);
3989
+ if (!registered)
3990
+ throw new Error(`[Sixb] Dataset '${dataset.id}' is not registered.`);
3991
+ const version = await lakeStorage.getVersion(registered.id, versionId);
3992
+ return version && readerVersion(runtime, version);
3993
+ },
3774
3994
  async readRows(dataset, input = {}) {
3775
3995
  assertAuthorized2(runtime, { kind: "dataset.view", datasetId: dataset.id });
3776
3996
  const registered = source.getById(dataset.id);
@@ -3792,12 +4012,24 @@ function createDatasetsRuntime(runtime, execution, source, lakeStorage, blobStor
3792
4012
  });
3793
4013
  const rows = columns.length === selected.length ? read(input.columns) : columns.length > 0 ? read(columns) : emptyRows(read(selected.slice(0, 1)));
3794
4014
  return {
3795
- version,
4015
+ version: readerVersion(runtime, version),
3796
4016
  columns,
3797
4017
  ...redacted.size > 0 ? { redactions: missingClearanceRedactions(redacted) } : {},
3798
4018
  rows
3799
4019
  };
3800
4020
  },
4021
+ async lineage(dataset, input = {}) {
4022
+ const depth = datasetLineageDepth(input.depth);
4023
+ if (!allowed(dataset.id))
4024
+ return null;
4025
+ const registered = source.getById(dataset.id);
4026
+ if (!registered)
4027
+ throw new Error(`[Sixb] Dataset '${dataset.id}' is not registered.`);
4028
+ const version = input.versionId === undefined ? await lakeStorage.getLatestVersion(registered.id) : await lakeStorage.getVersion(registered.id, input.versionId);
4029
+ if (!version)
4030
+ return null;
4031
+ return walkDatasetLineage(runtime, lakeStorage, version, depth);
4032
+ },
3801
4033
  async ingest(dataset, input) {
3802
4034
  assertPrivileged2(runtime, "datasets.ingest");
3803
4035
  const registered = source.getById(dataset.id);
@@ -3831,7 +4063,9 @@ function createDatasetsRuntime(runtime, execution, source, lakeStorage, blobStor
3831
4063
  datasetId: registered.id,
3832
4064
  versionId: result.version.versionId,
3833
4065
  createdAt: result.version.createdAt.toISOString(),
3834
- producer
4066
+ producer,
4067
+ rowsChanged: result.version.rowsChanged,
4068
+ lineageChanged: result.version.lineageChanged
3835
4069
  }
3836
4070
  }
3837
4071
  ],
@@ -3842,6 +4076,16 @@ function createDatasetsRuntime(runtime, execution, source, lakeStorage, blobStor
3842
4076
  }
3843
4077
  };
3844
4078
  }
4079
+ function readerVersion(runtime, version) {
4080
+ const { lineage: _lineage, producer, inputs, ...rest } = version;
4081
+ return {
4082
+ ...rest,
4083
+ ...producer === undefined ? {} : { producer: visibleProducer(runtime, producer) },
4084
+ ...inputs === undefined ? {} : {
4085
+ inputs: inputs.filter((input) => isRuntimeAllowed2(runtime, { kind: "dataset.view", datasetId: input.datasetId }))
4086
+ }
4087
+ };
4088
+ }
3845
4089
  function selectColumns(version, requested) {
3846
4090
  const available = version.schema.columns.map((column) => column.name);
3847
4091
  if (requested === undefined || requested.length === 0)
@@ -4156,7 +4400,7 @@ function isStepDefinition2(value) {
4156
4400
  return isRecord(value) && value.kind === "step" && typeof value.id === "string" && isRecord(value.input) && isRecord(value.output) && typeof value.handler === "function";
4157
4401
  }
4158
4402
  function isAgentStepDefinition2(value) {
4159
- return isRecord(value) && value.kind === "agentStep" && typeof value.id === "string" && (value.model === undefined || isLanguageModelTier2(value.model) || isLanguageModel(value.model)) && (value.reasoning === undefined || isModelReasoning2(value.reasoning)) && typeof value.instructions === "string" && isStringArray(value.groupIds) && isStringArray(value.toolNames) && isStringArray(value.skillNames) && isRecord(value.input) && isRecord(value.output) && typeof value.prompt === "function";
4403
+ return isRecord(value) && value.kind === "agentStep" && typeof value.id === "string" && (value.model === undefined || isLanguageModelTier2(value.model) || isLanguageModel(value.model)) && (value.reasoning === undefined || isModelReasoning2(value.reasoning)) && (value.maxSteps === undefined || Number.isSafeInteger(value.maxSteps)) && typeof value.instructions === "string" && isStringArray(value.groupIds) && isStringArray(value.toolNames) && isStringArray(value.skillNames) && isRecord(value.input) && isRecord(value.output) && typeof value.prompt === "function";
4160
4404
  }
4161
4405
  function isInterventionDefinition2(value) {
4162
4406
  return isRecord(value) && value.kind === "intervention" && typeof value.id === "string" && isRecord(value.input) && isRecord(value.response) && (value.defaults === undefined || typeof value.defaults === "function");
@@ -5288,14 +5532,17 @@ async function runModelLoop2(input) {
5288
5532
  }
5289
5533
  await input.onEvent?.({ type: "start-step" });
5290
5534
  let requestMessages;
5535
+ let requestMaxOutputTokens;
5291
5536
  try {
5292
5537
  const prepared = await input.prepareStep?.({
5293
5538
  stepIndex,
5294
5539
  messages,
5540
+ steps,
5295
5541
  model: input.model,
5296
5542
  signal: input.signal
5297
5543
  });
5298
5544
  requestMessages = prepared?.messages ?? messages;
5545
+ requestMaxOutputTokens = prepared?.maxOutputTokens;
5299
5546
  } catch (error) {
5300
5547
  if (!input.signal.aborted && !isAbortError2(error))
5301
5548
  throw error;
@@ -5304,64 +5551,64 @@ async function runModelLoop2(input) {
5304
5551
  if (input.signal.aborted) {
5305
5552
  return { status: "aborted", steps, partialContent: [] };
5306
5553
  }
5307
- const callId = generateCallId();
5308
- if (!callId || callIds.has(callId)) {
5309
- throw new ModelStreamError2(`[SixbModels] Model call IDs must be nonempty and unique.`);
5310
- }
5311
- callIds.add(callId);
5312
- const accumulator = new StreamAccumulator(input.onEvent);
5313
- let accepted = false;
5314
- let cost = { status: "unpriceable", reason: "missing-usage" };
5315
- let terminalStreamError;
5316
- try {
5317
- const stream = await input.model.stream({
5554
+ let callId;
5555
+ let cost;
5556
+ let completed;
5557
+ for (let attempt = 0;; attempt += 1) {
5558
+ callId = generateCallId();
5559
+ if (!callId || callIds.has(callId)) {
5560
+ throw new ModelStreamError2(`[SixbModels] Model call IDs must be nonempty and unique.`);
5561
+ }
5562
+ callIds.add(callId);
5563
+ const accumulator = new StreamAccumulator(input.onEvent);
5564
+ const call = await callModel(input, {
5318
5565
  callId,
5319
5566
  messages: requestMessages,
5320
5567
  tools: toolSpecifications,
5321
- ...input.reasoning === undefined ? {} : { reasoning: input.reasoning },
5322
- ...input.maxOutputTokens === undefined ? {} : { maxOutputTokens: input.maxOutputTokens },
5323
- ...input.caching === undefined ? {} : { caching: input.caching },
5324
- ...input.output === undefined ? {} : {
5325
- responseFormat: {
5326
- type: "json",
5327
- name: input.output.name,
5328
- ...input.output.description === undefined ? {} : { description: input.output.description },
5329
- schema: input.output.schema
5330
- }
5331
- },
5332
- signal: input.signal
5568
+ accumulator,
5569
+ ...requestMaxOutputTokens === undefined ? {} : { maxOutputTokens: requestMaxOutputTokens }
5333
5570
  });
5334
- accepted = true;
5335
- for await (const event of stream.events) {
5336
- await accumulator.accept(event);
5571
+ cost = call.cost;
5572
+ if (call.aborted) {
5573
+ return { status: "aborted", steps, partialContent: accumulator.partialContent() };
5337
5574
  }
5338
- } catch (error) {
5339
- if (error instanceof ModelUsageRecordingError2)
5340
- throw error;
5341
- const aborted = input.signal.aborted || isAbortError2(error);
5342
- if (accumulator.isFinished()) {
5343
- if (!aborted)
5344
- terminalStreamError = { error };
5345
- } else if (!aborted) {
5346
- throw error;
5347
- } else {
5348
- return {
5349
- status: "aborted",
5350
- steps,
5351
- partialContent: accumulator.partialContent()
5352
- };
5575
+ const finished = call.failure && !accumulator.isFinished() ? undefined : accumulator.complete();
5576
+ const failure = call.failure ?? (finished?.finishReason === "length" && finished.contextWindowExceeded ? {
5577
+ error: new ModelProviderError2("[SixbModels] The answer filled the model's context window.", input.model.providerId, input.model.modelId, { reason: "context-window-exceeded" })
5578
+ } : undefined);
5579
+ if (failure && attempt === 0 && input.recoverStep) {
5580
+ let recovered;
5581
+ try {
5582
+ recovered = await input.recoverStep({
5583
+ stepIndex,
5584
+ messages: requestMessages,
5585
+ steps,
5586
+ model: input.model,
5587
+ signal: input.signal,
5588
+ error: failure.error,
5589
+ ...finished ? { usage: finished.usage } : {}
5590
+ });
5591
+ } catch (error) {
5592
+ if (!input.signal.aborted && !isAbortError2(error))
5593
+ throw error;
5594
+ return { status: "aborted", steps, partialContent: [] };
5595
+ }
5596
+ if (input.signal.aborted)
5597
+ return { status: "aborted", steps, partialContent: [] };
5598
+ if (recovered?.messages) {
5599
+ requestMessages = recovered.messages;
5600
+ requestMaxOutputTokens = recovered.maxOutputTokens;
5601
+ if (accumulator.streamed)
5602
+ await input.onEvent?.({ type: "start-step", retry: true });
5603
+ continue;
5604
+ }
5353
5605
  }
5354
- } finally {
5355
- if (accepted)
5356
- cost = accumulator.meter.end({ model: input.model, callId }).cost;
5357
- }
5358
- if (input.signal.aborted && !accumulator.isFinished()) {
5359
- return { status: "aborted", steps, partialContent: accumulator.partialContent() };
5606
+ if (call.failure)
5607
+ throw call.failure.error;
5608
+ completed = finished;
5609
+ break;
5360
5610
  }
5361
- const completed = accumulator.complete();
5362
5611
  const responseId = completed.responseId ?? `${callId}:response`;
5363
- if (terminalStreamError)
5364
- throw terminalStreamError.error;
5365
5612
  if (completed.projectionError)
5366
5613
  throw completed.projectionError;
5367
5614
  if (input.signal.aborted) {
@@ -5462,11 +5709,63 @@ async function runModelLoop2(input) {
5462
5709
  throw new StructuredOutputError2("[SixbModels] Model reached the step limit without structured output.", structuredOutputErrorContext(input, response, responseId, cost, responseText(response)));
5463
5710
  }
5464
5711
  const output = responseText(response);
5465
- return { status: "completed", output, steps, finishReason: response.finishReason };
5712
+ return {
5713
+ status: "completed",
5714
+ output,
5715
+ steps,
5716
+ finishReason: response.finishReason,
5717
+ stepLimitReached: true
5718
+ };
5466
5719
  }
5467
5720
  }
5468
5721
  throw new ModelStreamError2("[SixbModels] Model loop exited without a terminal result.");
5469
5722
  }
5723
+ async function callModel(input, call) {
5724
+ const { accumulator } = call;
5725
+ const maxOutputTokens = call.maxOutputTokens === undefined ? input.maxOutputTokens : Math.min(call.maxOutputTokens, input.maxOutputTokens ?? Number.POSITIVE_INFINITY);
5726
+ let accepted = false;
5727
+ let cost = { status: "unpriceable", reason: "missing-usage" };
5728
+ let failure;
5729
+ let cancelled = false;
5730
+ try {
5731
+ const stream = await input.model.stream({
5732
+ callId: call.callId,
5733
+ messages: call.messages,
5734
+ tools: call.tools,
5735
+ ...input.reasoning === undefined ? {} : { reasoning: input.reasoning },
5736
+ ...maxOutputTokens === undefined ? {} : { maxOutputTokens },
5737
+ ...input.caching === undefined ? {} : { caching: input.caching },
5738
+ ...input.output === undefined ? {} : {
5739
+ responseFormat: {
5740
+ type: "json",
5741
+ name: input.output.name,
5742
+ ...input.output.description === undefined ? {} : { description: input.output.description },
5743
+ schema: input.output.schema
5744
+ }
5745
+ },
5746
+ signal: input.signal
5747
+ });
5748
+ accepted = true;
5749
+ for await (const event of stream.events) {
5750
+ await accumulator.accept(event);
5751
+ }
5752
+ } catch (error) {
5753
+ if (error instanceof ModelUsageRecordingError2)
5754
+ throw error;
5755
+ if (input.signal.aborted || isAbortError2(error))
5756
+ cancelled = true;
5757
+ else
5758
+ failure = { error };
5759
+ } finally {
5760
+ if (accepted)
5761
+ cost = accumulator.meter.end({ model: input.model, callId: call.callId }).cost;
5762
+ }
5763
+ return {
5764
+ cost,
5765
+ aborted: (cancelled || input.signal.aborted) && !accumulator.isFinished(),
5766
+ ...failure === undefined ? {} : { failure }
5767
+ };
5768
+ }
5470
5769
  function assertLoopInput(input) {
5471
5770
  if (input.maxOutputTokens !== undefined && (!Number.isSafeInteger(input.maxOutputTokens) || input.maxOutputTokens <= 0)) {
5472
5771
  throw new TypeError("[SixbModels] maxOutputTokens must be a positive safe integer.");
@@ -5648,7 +5947,7 @@ function toolErrorResult(part, errorText) {
5648
5947
  }
5649
5948
 
5650
5949
  class StreamAccumulator {
5651
- onEvent;
5950
+ reader;
5652
5951
  parts = [];
5653
5952
  spans = new Map;
5654
5953
  toolCalls = new Map;
@@ -5656,10 +5955,16 @@ class StreamAccumulator {
5656
5955
  finished = false;
5657
5956
  finishReason;
5658
5957
  rawFinishReason;
5958
+ contextWindowExceeded = false;
5959
+ streamed = false;
5659
5960
  meter = new LanguageModelCallMeter;
5660
5961
  projectionError;
5661
- constructor(onEvent) {
5662
- this.onEvent = onEvent;
5962
+ constructor(reader) {
5963
+ this.reader = reader;
5964
+ }
5965
+ async onEvent(chunk) {
5966
+ this.streamed = true;
5967
+ await this.reader?.(chunk);
5663
5968
  }
5664
5969
  isFinished() {
5665
5970
  return this.finished;
@@ -5731,6 +6036,7 @@ class StreamAccumulator {
5731
6036
  this.finished = true;
5732
6037
  this.finishReason = event.finishReason;
5733
6038
  this.rawFinishReason = event.rawFinishReason;
6039
+ this.contextWindowExceeded = event.contextWindowExceeded === true;
5734
6040
  this.meter.accept(event);
5735
6041
  return;
5736
6042
  case "error":
@@ -5758,6 +6064,7 @@ class StreamAccumulator {
5758
6064
  toolCalls: parsed.toolCalls,
5759
6065
  finishReason: this.finishReason,
5760
6066
  ...this.rawFinishReason === undefined ? {} : { rawFinishReason: this.rawFinishReason },
6067
+ ...this.contextWindowExceeded ? { contextWindowExceeded: true } : {},
5761
6068
  ...this.meter.facts(),
5762
6069
  ...this.projectionError === undefined ? {} : { projectionError: this.projectionError }
5763
6070
  };
@@ -5840,7 +6147,7 @@ class StreamAccumulator {
5840
6147
  };
5841
6148
  this.spans.set(event.id, part);
5842
6149
  this.parts.push(part);
5843
- await this.onEvent?.({ type: "text-start", id: event.id });
6150
+ await this.onEvent({ type: "text-start", id: event.id });
5844
6151
  }
5845
6152
  async startReasoning(event) {
5846
6153
  this.requireStarted(event.type);
@@ -5854,7 +6161,7 @@ class StreamAccumulator {
5854
6161
  };
5855
6162
  this.spans.set(event.id, part);
5856
6163
  this.parts.push(part);
5857
- await this.onEvent?.({ type: "reasoning-start", id: event.id });
6164
+ await this.onEvent({ type: "reasoning-start", id: event.id });
5858
6165
  }
5859
6166
  async appendText(event, expected) {
5860
6167
  const part = this.spans.get(event.id);
@@ -5862,7 +6169,7 @@ class StreamAccumulator {
5862
6169
  throw new ModelStreamError2(`[SixbModels] ${event.type} references unopened ${expected} span '${event.id}'.`);
5863
6170
  }
5864
6171
  part.text += event.delta;
5865
- await this.onEvent?.({ type: event.type, id: event.id, delta: event.delta });
6172
+ await this.onEvent({ type: event.type, id: event.id, delta: event.delta });
5866
6173
  }
5867
6174
  async endText(event, expected) {
5868
6175
  const part = this.spans.get(event.id);
@@ -5872,7 +6179,7 @@ class StreamAccumulator {
5872
6179
  part.providerData = mergeProviderData(part.providerData, this.captureProviderData(event.providerData));
5873
6180
  part.complete = true;
5874
6181
  this.spans.delete(event.id);
5875
- await this.onEvent?.({ type: event.type, id: event.id });
6182
+ await this.onEvent({ type: event.type, id: event.id });
5876
6183
  }
5877
6184
  async startTool(event) {
5878
6185
  this.requireStarted(event.type);
@@ -5895,7 +6202,7 @@ class StreamAccumulator {
5895
6202
  };
5896
6203
  this.toolCalls.set(event.id, part);
5897
6204
  this.parts.push(part);
5898
- await this.onEvent?.({
6205
+ await this.onEvent({
5899
6206
  type: "tool-input-start",
5900
6207
  toolCallId: event.id,
5901
6208
  toolName: event.toolName
@@ -5907,7 +6214,7 @@ class StreamAccumulator {
5907
6214
  throw new ModelStreamError2(`[SixbModels] tool-input-delta references unopened tool call '${event.id}'.`);
5908
6215
  }
5909
6216
  part.inputText += event.delta;
5910
- await this.onEvent?.({
6217
+ await this.onEvent({
5911
6218
  type: "tool-input-delta",
5912
6219
  toolCallId: event.id,
5913
6220
  toolName: part.toolName,
@@ -7820,6 +8127,612 @@ function createObjectByIdHandle(ctx, primaryId) {
7820
8127
  };
7821
8128
  return objectHandle;
7822
8129
  }
8130
+ // src/lineage/reader.ts
8131
+ class LineageReader {
8132
+ runtime;
8133
+ authority;
8134
+ #restricted = new Set;
8135
+ constructor(runtime, authority) {
8136
+ this.runtime = runtime;
8137
+ this.authority = authority;
8138
+ }
8139
+ static for(runtime) {
8140
+ const authority = resolveRuntimeAuthorizationForProject(runtime);
8141
+ switch (authority.type) {
8142
+ case "denied":
8143
+ case "delegated":
8144
+ return null;
8145
+ case "principal":
8146
+ case "unrestricted":
8147
+ return new LineageReader(runtime, authority);
8148
+ }
8149
+ }
8150
+ get restricted() {
8151
+ return this.#restricted.size;
8152
+ }
8153
+ restrict(step) {
8154
+ this.#restricted.add(step);
8155
+ }
8156
+ canViewDataset(datasetId) {
8157
+ return isRuntimeAllowed2(this.runtime, { kind: "dataset.view", datasetId });
8158
+ }
8159
+ canViewRun(run) {
8160
+ return this.authority.type === "unrestricted" || canViewPrimitiveRun2(this.authority.context, run);
8161
+ }
8162
+ async readObjects(refs) {
8163
+ try {
8164
+ const rows = await this.runtime.objectReader.getByPrimaryIdBatch({ items: refs });
8165
+ const found = refs.map((ref) => rows.get(objectBatchKey2(ref.objectTypeId, ref.primaryId)));
8166
+ return found.every((row) => row !== undefined) ? found : null;
8167
+ } catch (error) {
8168
+ if (error instanceof AuthorizationError2)
8169
+ return null;
8170
+ throw error;
8171
+ }
8172
+ }
8173
+ async canReadLink(sourceTypeId, linkId) {
8174
+ try {
8175
+ await this.runtime.objectReader.assertReadable({
8176
+ objectTypeIds: [],
8177
+ links: [{ objectTypeId: sourceTypeId, linkId }]
8178
+ });
8179
+ return true;
8180
+ } catch (error) {
8181
+ if (error instanceof AuthorizationError2)
8182
+ return false;
8183
+ throw error;
8184
+ }
8185
+ }
8186
+ }
8187
+
8188
+ // src/lineage/executors.ts
8189
+ function executorRunKey(executor) {
8190
+ switch (executor.type) {
8191
+ case "primitive":
8192
+ return `${executor.kind}-run:${executor.runId}`;
8193
+ case "agent":
8194
+ return `agent-run:${executor.runId}`;
8195
+ case "request":
8196
+ case "kernel":
8197
+ return;
8198
+ }
8199
+ }
8200
+ async function viewableExecutorRuns(reader, projections, executors) {
8201
+ const runs = new Map;
8202
+ for (const executor of executors) {
8203
+ const key = executorRunKey(executor);
8204
+ if (key !== undefined)
8205
+ runs.set(key, executor);
8206
+ }
8207
+ const decided = await Promise.all([...runs].map(async ([key, executor]) => {
8208
+ const viewable = await canViewExecutorRun(reader, projections, executor);
8209
+ return viewable ? [key] : [];
8210
+ }));
8211
+ return new Set(decided.flat());
8212
+ }
8213
+ async function canViewExecutorRun(reader, projections, executor) {
8214
+ if (reader.authority.type === "unrestricted")
8215
+ return true;
8216
+ switch (executor.type) {
8217
+ case "request":
8218
+ case "kernel":
8219
+ return true;
8220
+ case "agent":
8221
+ return canViewAgentRun(reader, executor.runId);
8222
+ case "primitive":
8223
+ break;
8224
+ }
8225
+ switch (executor.kind) {
8226
+ case "action":
8227
+ return canViewActionRun(reader, executor.runId);
8228
+ case "projection": {
8229
+ const definition = projections.getById(executor.id);
8230
+ return definition !== null && reader.canViewRun({ kind: "projection", target: projectionTargetOf2(definition) });
8231
+ }
8232
+ default:
8233
+ return reader.canViewRun({ kind: executor.kind, id: executor.id });
8234
+ }
8235
+ }
8236
+ async function canViewActionRun(reader, runId) {
8237
+ const { projectId, storage, objectReader } = reader.runtime;
8238
+ if (reader.authority.type !== "principal")
8239
+ return false;
8240
+ const run = await storage.actionRuns?.getById({ projectId, id: runId });
8241
+ if (!run)
8242
+ return false;
8243
+ const [viewable] = await viewableActionRuns(objectReader, reader.authority.context, [run]);
8244
+ return viewable !== undefined && await canReadActionRunSubject(objectReader, run);
8245
+ }
8246
+ async function canViewAgentRun(reader, runId) {
8247
+ const { projectId, storage } = reader.runtime;
8248
+ const run = await storage.agents?.runs.getById({ projectId, id: runId });
8249
+ if (!run)
8250
+ return false;
8251
+ const rule = createAgentThreadAccessRule(reader.runtime, reader.authority);
8252
+ return await rule.read(run.threadId) !== null;
8253
+ }
8254
+
8255
+ // src/lineage/commits.ts
8256
+ async function editCommitsAt(reader, instants) {
8257
+ const { projectId, storage } = reader.runtime;
8258
+ const found = await Promise.all([...instants].map(async (committedAt) => {
8259
+ const { commits } = await storage.ontology.commits.list({ projectId, committedAt });
8260
+ return [committedAt, commits.filter(isEditCommit)];
8261
+ }));
8262
+ return new Map(found);
8263
+ }
8264
+ function editCommitFor(commits, object, change) {
8265
+ const objectKey = objectRefKey2(object);
8266
+ const made = commits.filter((commit) => commit.result.changes.objects.some((effective) => objectRefKey2(effective.ref) === objectKey && (change === "created" ? effective.kind === "created" : Object.hasOwn(effective.propertyChanges, change.propertyId))));
8267
+ const candidates = made.length > 0 ? made : commits;
8268
+ return candidates.length === 1 ? candidates[0] : null;
8269
+ }
8270
+ async function commitsById(reader, commitIds) {
8271
+ const { projectId, storage } = reader.runtime;
8272
+ const found = await Promise.all([...commitIds].map(async (id) => {
8273
+ const commit = await storage.ontology.commits.getById({ projectId, id });
8274
+ if (!commit)
8275
+ throw new Error(`[Sixb] Ontology commit '${id}', which state names, is missing.`);
8276
+ return [id, commit];
8277
+ }));
8278
+ return new Map(found);
8279
+ }
8280
+ async function attributeCommits(reader, projections, commits) {
8281
+ const { projectId, storage } = reader.runtime;
8282
+ const distinct = [...new Map(commits.map((commit) => [commit.id, commit])).values()];
8283
+ const executionIds = [...new Set(distinct.map((commit) => commit.executionId))];
8284
+ const executions = await Promise.all(executionIds.map((id) => storage.executions.getById({ projectId, id })));
8285
+ const attributions = new Map(executions.flatMap((execution) => execution ? [[execution.id, eventAttribution2(execution)]] : []));
8286
+ const executors = [...attributions.values()].map(({ executor }) => executor);
8287
+ const viewable = await viewableExecutorRuns(reader, projections, executors);
8288
+ const shows = (executor) => {
8289
+ const key = executorRunKey(executor);
8290
+ if (key === undefined || viewable.has(key))
8291
+ return true;
8292
+ reader.restrict(key);
8293
+ return false;
8294
+ };
8295
+ return new Map(distinct.map((commit) => {
8296
+ const attribution = attributions.get(commit.executionId);
8297
+ if (!attribution) {
8298
+ throw new Error(`[Sixb] Ontology commit '${commit.id}' has no execution '${commit.executionId}'.`);
8299
+ }
8300
+ const { requestedBy, executor } = attribution;
8301
+ const requester = requestedBy === undefined ? {} : { requestedBy };
8302
+ if (!shows(executor))
8303
+ return [commit.id, requester];
8304
+ const origin = commit.origin;
8305
+ if (origin.kind !== "action")
8306
+ return [commit.id, { ...requester, executor }];
8307
+ const action = { actionId: origin.actionId, runId: origin.runId };
8308
+ return [commit.id, { ...requester, executor, action }];
8309
+ }));
8310
+ }
8311
+ function editSource(commit, attribution) {
8312
+ return { kind: "edit", commitId: commit.id, committedAt: commit.committedAt, ...attribution };
8313
+ }
8314
+ function telemetrySource(commit, attribution) {
8315
+ const projectionId = commit.intent.kind === "telemetry" && commit.intent.source.kind === "projection" ? commit.intent.source.projection.projectionId : undefined;
8316
+ return {
8317
+ kind: "telemetry",
8318
+ commitId: commit.id,
8319
+ committedAt: commit.committedAt,
8320
+ ...projectionId === undefined ? {} : { projectionId },
8321
+ ...attribution
8322
+ };
8323
+ }
8324
+ function isEditCommit(commit) {
8325
+ return commit.intent.kind === "edit";
8326
+ }
8327
+
8328
+ // src/lineage/projections.ts
8329
+ async function describeProjection(reader, dependencies, stored) {
8330
+ const { projectId, storage } = reader.runtime;
8331
+ const { projectionId } = stored.source;
8332
+ const active = await storage.ontology.sources.getActive({ projectId, source: stored.source });
8333
+ const definition = dependencies.projections.getById(projectionId);
8334
+ const target = definition ? projectionTargetOf2(definition) : rootTarget(stored.root);
8335
+ const showsRun = active !== null && reader.canViewRun({ kind: "projection", target });
8336
+ if (active && !showsRun)
8337
+ reader.restrict(`projection-run:${active.projectionRunId}`);
8338
+ const version = active?.datasetVersion;
8339
+ const showsVersion = version !== undefined && reader.canViewDataset(version.datasetId);
8340
+ if (version && !showsVersion) {
8341
+ reader.restrict(`dataset-version:${version.datasetId}:${version.versionId}`);
8342
+ }
8343
+ const lineage = showsVersion ? await columnLineage(dependencies.lakeStorage, version) : undefined;
8344
+ const rowOrigins = lineage && visibleRefs(reader, lineage.rows);
8345
+ const columns = showsVersion && definition?.datasetId === version.datasetId ? definition : null;
8346
+ return {
8347
+ key: `projection:${projectionId}`,
8348
+ source: {
8349
+ kind: "projection",
8350
+ projectionId,
8351
+ ...showsRun ? { projectionRunId: active.projectionRunId } : {},
8352
+ ...showsVersion ? { datasetVersion: { datasetId: version.datasetId, versionId: version.versionId } } : {},
8353
+ ...rowOrigins === undefined ? {} : { rowOrigins }
8354
+ },
8355
+ propertyColumn: (propertyId) => columns?._tag === "ObjectProjectionDefinition" ? ownValue(columns.properties, propertyId) : undefined,
8356
+ linkColumns: (linkId) => columns ? linkColumns(columns, linkId) : undefined,
8357
+ origins: (names) => lineage ? visibleOrigins(reader, lineage, names) : undefined
8358
+ };
8359
+ }
8360
+ async function columnLineage(lakeStorage, pinned) {
8361
+ const version = await lakeStorage.getVersion(pinned.datasetId, pinned.versionId);
8362
+ if (!version)
8363
+ return;
8364
+ const lineage = versionLineage(version, lakeStorage);
8365
+ return isUnknownLineage(lineage) ? undefined : lineage;
8366
+ }
8367
+ function visibleOrigins(reader, lineage, columns) {
8368
+ const origins = new Map;
8369
+ for (const column of columns) {
8370
+ const refs = lineageColumn(lineage, column);
8371
+ if (refs === undefined)
8372
+ return;
8373
+ for (const ref of refs) {
8374
+ origins.set(JSON.stringify([ref.datasetId, ref.column]), ref);
8375
+ }
8376
+ }
8377
+ return visibleRefs(reader, [...origins.values()]);
8378
+ }
8379
+ function visibleRefs(reader, refs) {
8380
+ return refs.filter((ref) => {
8381
+ if (reader.canViewDataset(ref.datasetId))
8382
+ return true;
8383
+ reader.restrict(`dataset:${ref.datasetId}`);
8384
+ return false;
8385
+ });
8386
+ }
8387
+ function linkColumns(definition, linkId) {
8388
+ switch (definition._tag) {
8389
+ case "ObjectProjectionDefinition": {
8390
+ const foreignKey = ownValue(definition.links, linkId);
8391
+ if (!foreignKey)
8392
+ return;
8393
+ const column = foreignKey.sourceField ?? (foreignKey.sourcePropertyId === undefined ? undefined : ownValue(definition.properties, foreignKey.sourcePropertyId));
8394
+ return column === undefined ? undefined : [column];
8395
+ }
8396
+ case "LinkProjectionDefinition":
8397
+ return definition.linkId === linkId ? [definition.sourceField, definition.targetField] : undefined;
8398
+ case "TelemetryProjectionDefinition":
8399
+ return;
8400
+ }
8401
+ }
8402
+ function rootTarget(root) {
8403
+ return root.kind === "object" ? { objectTypeId: root.ref.objectTypeId } : {
8404
+ sourceObjectTypeId: root.ref.source.objectTypeId,
8405
+ targetObjectTypeId: root.ref.target.objectTypeId
8406
+ };
8407
+ }
8408
+ function ownValue(record, key) {
8409
+ return Object.hasOwn(record, key) ? record[key] : undefined;
8410
+ }
8411
+
8412
+ // src/lineage/sources.ts
8413
+ class LineageCommitReads {
8414
+ instants = new Set;
8415
+ commitIds = new Set;
8416
+ edit(lookup) {
8417
+ if (lookup.kind === "at")
8418
+ this.instants.add(lookup.instant);
8419
+ if (lookup.kind === "named")
8420
+ this.commitIds.add(lookup.commitId);
8421
+ }
8422
+ telemetry(commitId) {
8423
+ this.commitIds.add(commitId);
8424
+ }
8425
+ }
8426
+
8427
+ class LineageSources {
8428
+ projection;
8429
+ object;
8430
+ commitsAt;
8431
+ commitsNamed;
8432
+ attributions;
8433
+ #cited = {};
8434
+ constructor(projection, object, commitsAt, commitsNamed, attributions) {
8435
+ this.projection = projection;
8436
+ this.object = object;
8437
+ this.commitsAt = commitsAt;
8438
+ this.commitsNamed = commitsNamed;
8439
+ this.attributions = attributions;
8440
+ }
8441
+ static async read(input) {
8442
+ const { reader, dependencies, object, stored, reads } = input;
8443
+ const [projection, commitsAt, commitsNamed] = await Promise.all([
8444
+ stored ? describeProjection(reader, dependencies, stored) : null,
8445
+ editCommitsAt(reader, reads.instants),
8446
+ commitsById(reader, reads.commitIds)
8447
+ ]);
8448
+ const commits = [...[...commitsAt.values()].flat(), ...commitsNamed.values()];
8449
+ const attributions = await attributeCommits(reader, dependencies.projections, commits);
8450
+ return new LineageSources(projection, object, commitsAt, commitsNamed, attributions);
8451
+ }
8452
+ get cited() {
8453
+ return this.#cited;
8454
+ }
8455
+ citeProjection() {
8456
+ const projection = this.projection;
8457
+ if (!projection)
8458
+ throw new Error("[Sixb] Lineage cites a source row it did not read.");
8459
+ return this.#cite(projection.key, () => projection.source);
8460
+ }
8461
+ citeEdit(lookup) {
8462
+ switch (lookup.kind) {
8463
+ case "named":
8464
+ return this.#citeEditCommit(this.#named(lookup.commitId));
8465
+ case "at": {
8466
+ const commits = this.commitsAt.get(lookup.instant) ?? [];
8467
+ const commit = editCommitFor(commits, this.object, lookup.change);
8468
+ return commit ? this.#citeEditCommit(commit) : this.#citeUnknownEdit(lookup.instant);
8469
+ }
8470
+ case "unknown":
8471
+ return this.#citeUnknownEdit(lookup.instant);
8472
+ }
8473
+ }
8474
+ citeTelemetry(commitId) {
8475
+ const commit = this.#named(commitId);
8476
+ return this.#cite(`telemetry:${commit.id}`, () => telemetrySource(commit, this.attributions.get(commit.id)));
8477
+ }
8478
+ citeIdentity() {
8479
+ return this.#cite("identity", () => ({ kind: "identity" }));
8480
+ }
8481
+ #citeEditCommit(commit) {
8482
+ return this.#cite(`commit:${commit.id}`, () => editSource(commit, this.attributions.get(commit.id)));
8483
+ }
8484
+ #citeUnknownEdit(instant) {
8485
+ return this.#cite(`commit@${instant}`, () => ({
8486
+ kind: "edit",
8487
+ commitId: null,
8488
+ committedAt: instant
8489
+ }));
8490
+ }
8491
+ #cite(key, describe) {
8492
+ this.#cited[key] ??= describe();
8493
+ return key;
8494
+ }
8495
+ #named(commitId) {
8496
+ const commit = this.commitsNamed.get(commitId);
8497
+ if (!commit)
8498
+ throw new Error(`[Sixb] Lineage cites commit '${commitId}' it did not read.`);
8499
+ return commit;
8500
+ }
8501
+ }
8502
+
8503
+ // src/lineage/link.ts
8504
+ async function explainLink(runtime, dependencies, ref) {
8505
+ const reader = LineageReader.for(runtime);
8506
+ if (!reader)
8507
+ return null;
8508
+ const endpoints = await reader.readObjects([ref.source, ref.target]);
8509
+ if (!endpoints || !await reader.canReadLink(ref.source.objectTypeId, ref.linkId))
8510
+ return null;
8511
+ const state = await runtime.storage.ontology.materializations.readState({
8512
+ projectId: runtime.projectId,
8513
+ objects: [ref.source, ref.target],
8514
+ links: [ref],
8515
+ linkScopes: []
8516
+ });
8517
+ const link = state.links[0];
8518
+ if (!link)
8519
+ return null;
8520
+ const effective = new Set(state.objects.flatMap((object) => object.effective ? [objectRefKey2(object.ref)] : []));
8521
+ const cardinality = linkCardinality(runtime.ontology, ref);
8522
+ const authority = linkAuthority(cardinality, link, (object) => effective.has(objectRefKey2(object)));
8523
+ if (!authority)
8524
+ return null;
8525
+ const override = cardinality === "one" ? link.slotOverride : link.override;
8526
+ const reads = new LineageCommitReads;
8527
+ if (authority === "override" && override) {
8528
+ reads.edit({ kind: "named", commitId: override.lastCommitId });
8529
+ }
8530
+ const sources = await LineageSources.read({
8531
+ reader,
8532
+ dependencies,
8533
+ object: ref.source,
8534
+ stored: authority === "source" ? link.source : null,
8535
+ reads
8536
+ });
8537
+ return {
8538
+ sourceTypeId: ref.source.objectTypeId,
8539
+ sourceId: ref.source.primaryId,
8540
+ linkId: ref.linkId,
8541
+ targetTypeId: ref.target.objectTypeId,
8542
+ targetId: ref.target.primaryId,
8543
+ existence: existence(sources, authority, override?.lastCommitId, ref.linkId),
8544
+ sources: sources.cited,
8545
+ restricted: reader.restricted
8546
+ };
8547
+ }
8548
+ function linkAuthority(cardinality, link, endpointExists) {
8549
+ let authority = null;
8550
+ const record = (decided) => {
8551
+ authority = decided;
8552
+ };
8553
+ const resolved = cardinality === "one" ? resolveEffectiveLinkSlotMember({
8554
+ ref: link.ref,
8555
+ source: link.source,
8556
+ override: usableLinkSlotOverride(link.slotOverride),
8557
+ endpointExists
8558
+ }, record) : resolveEffectiveLink({
8559
+ ref: link.ref,
8560
+ source: link.source,
8561
+ override: link.override?.value ?? null,
8562
+ sourceEndpointExists: endpointExists(link.ref.source),
8563
+ targetEndpointExists: endpointExists(link.ref.target)
8564
+ }, record);
8565
+ return resolved ? authority : null;
8566
+ }
8567
+ function existence(sources, authority, overrideCommitId, linkId) {
8568
+ if (authority === "override") {
8569
+ if (overrideCommitId === undefined) {
8570
+ throw new Error("[Sixb] Lineage found a link override authority without its override.");
8571
+ }
8572
+ return { source: sources.citeEdit({ kind: "named", commitId: overrideCommitId }) };
8573
+ }
8574
+ const columns = sources.projection?.linkColumns(linkId);
8575
+ const origins = columns === undefined ? undefined : sources.projection?.origins(columns);
8576
+ return {
8577
+ source: sources.citeProjection(),
8578
+ ...columns === undefined ? {} : { columns },
8579
+ ...origins === undefined ? {} : { origins }
8580
+ };
8581
+ }
8582
+
8583
+ // src/lineage/object.ts
8584
+ async function explainObject(runtime, dependencies, ref) {
8585
+ const reader = LineageReader.for(runtime);
8586
+ if (!reader)
8587
+ return null;
8588
+ const [row] = await reader.readObjects([ref]) ?? [];
8589
+ if (!row)
8590
+ return null;
8591
+ const { objects } = await runtime.storage.ontology.materializations.readState({
8592
+ projectId: runtime.projectId,
8593
+ objects: [ref],
8594
+ links: [],
8595
+ linkScopes: []
8596
+ });
8597
+ const state = objects[0];
8598
+ if (!state?.effective)
8599
+ return null;
8600
+ const explained = explainEffectiveObject({
8601
+ ref,
8602
+ primaryPropertyId: runtime.ontology.getPrimaryPropertyId(ref.objectTypeId),
8603
+ source: state.source,
8604
+ override: state.override?.value ?? null,
8605
+ editedAt: storedObjectEditedAt(state.override),
8606
+ latestTelemetry: state.latestTelemetry
8607
+ });
8608
+ if (!explained)
8609
+ return null;
8610
+ const redacted = new Set(Object.keys(row.redactions ?? {}));
8611
+ const decided = inTypeOrder(runtime, ref.objectTypeId, explained.properties).filter(([propertyId]) => !redacted.has(propertyId));
8612
+ const override = state.override;
8613
+ const created = {
8614
+ kind: "at",
8615
+ instant: state.effective.createdAt,
8616
+ change: "created"
8617
+ };
8618
+ const reads = new LineageCommitReads;
8619
+ if (explained.existence === "create")
8620
+ reads.edit(created);
8621
+ for (const [propertyId, authority] of decided) {
8622
+ if (authority.kind === "telemetry")
8623
+ reads.telemetry(authority.point.lastCommitId);
8624
+ if (authority.kind === "edit" || authority.kind === "source" && authority.wonOver) {
8625
+ reads.edit(editLookup(override, propertyId));
8626
+ }
8627
+ }
8628
+ const sources = await LineageSources.read({
8629
+ reader,
8630
+ dependencies,
8631
+ object: ref,
8632
+ stored: state.source,
8633
+ reads
8634
+ });
8635
+ const existence = explained.existence === "source" ? sources.citeProjection() : sources.citeEdit(created);
8636
+ const properties = Object.fromEntries(decided.map(([propertyId, authority]) => [
8637
+ propertyId,
8638
+ propertyLineage({ sources, explained, override, propertyId, authority })
8639
+ ]));
8640
+ return {
8641
+ objectTypeId: ref.objectTypeId,
8642
+ primaryId: ref.primaryId,
8643
+ existence: { source: existence },
8644
+ sources: sources.cited,
8645
+ properties,
8646
+ restricted: reader.restricted
8647
+ };
8648
+ }
8649
+ function propertyLineage(input) {
8650
+ const { sources, explained, override, propertyId, authority } = input;
8651
+ const edit = () => sources.citeEdit(editLookup(override, propertyId));
8652
+ const removed = Object.hasOwn(explained.value.properties, propertyId) ? {} : { removed: true };
8653
+ switch (authority.kind) {
8654
+ case "identity":
8655
+ return { source: sources.citeIdentity() };
8656
+ case "telemetry":
8657
+ return {
8658
+ source: sources.citeTelemetry(authority.point.lastCommitId),
8659
+ at: authority.point.at
8660
+ };
8661
+ case "source": {
8662
+ const column = sources.projection?.propertyColumn(propertyId);
8663
+ const origins = column === undefined ? undefined : sources.projection?.origins([column]);
8664
+ const lineage = {
8665
+ source: sources.citeProjection(),
8666
+ ...column === undefined ? {} : { column },
8667
+ ...origins === undefined ? {} : { origins },
8668
+ ...removed
8669
+ };
8670
+ const { wonOver } = authority;
8671
+ if (!wonOver)
8672
+ return lineage;
8673
+ return {
8674
+ ...lineage,
8675
+ replaced: { source: edit(), ...candidateValue(wonOver.candidate) },
8676
+ resolution: {
8677
+ strategy: "mostRecent",
8678
+ sourceUpdatedAt: wonOver.sourceUpdatedAt,
8679
+ editedAt: wonOver.editedAt
8680
+ }
8681
+ };
8682
+ }
8683
+ case "edit": {
8684
+ const { wonOver } = authority;
8685
+ if (!wonOver)
8686
+ return { source: edit(), ...removed };
8687
+ const column = sources.projection?.propertyColumn(propertyId);
8688
+ return {
8689
+ source: edit(),
8690
+ ...removed,
8691
+ replaced: {
8692
+ source: sources.citeProjection(),
8693
+ ...column === undefined ? {} : { column },
8694
+ ...candidateValue(wonOver.candidate)
8695
+ },
8696
+ resolution: resolution(wonOver.sourceUpdatedAt, authority.editedAt)
8697
+ };
8698
+ }
8699
+ }
8700
+ }
8701
+ function editLookup(override, propertyId) {
8702
+ if (!override) {
8703
+ throw new Error(`[Sixb] Lineage found an edit of '${propertyId}' with no override.`);
8704
+ }
8705
+ const instant = override.editedAt?.[propertyId];
8706
+ if (instant === undefined)
8707
+ return { kind: "unknown", instant: override.updatedAt };
8708
+ return { kind: "at", instant, change: { propertyId } };
8709
+ }
8710
+ function resolution(sourceUpdatedAt, editedAt) {
8711
+ if (sourceUpdatedAt === undefined)
8712
+ return { strategy: "editsWin" };
8713
+ return {
8714
+ strategy: "mostRecent",
8715
+ sourceUpdatedAt,
8716
+ ...editedAt === undefined ? {} : { editedAt }
8717
+ };
8718
+ }
8719
+ function candidateValue(candidate) {
8720
+ return candidate.present ? { value: candidate.value } : {};
8721
+ }
8722
+ function inTypeOrder(runtime, objectTypeId, properties) {
8723
+ const ordered = new Map;
8724
+ for (const { id } of runtime.ontology.resolveObjectType(objectTypeId).properties) {
8725
+ const authority = properties.get(id);
8726
+ if (authority)
8727
+ ordered.set(id, authority);
8728
+ }
8729
+ for (const [id, authority] of properties) {
8730
+ if (!ordered.has(id))
8731
+ ordered.set(id, authority);
8732
+ }
8733
+ return [...ordered];
8734
+ }
8735
+
7823
8736
  // src/objects/context/resolve.ts
7824
8737
  function requireLinkDefinition2(objectType, linkId) {
7825
8738
  const def = objectType.links.find((l) => l.id === linkId);
@@ -8019,6 +8932,16 @@ function createObjectSet2(params) {
8019
8932
  targetTypeId: input.targetTypeId,
8020
8933
  targetId: input.targetId
8021
8934
  });
8935
+ },
8936
+ lineage: (id) => explainObject(params, params.lineage, { objectTypeId: objectType.id, primaryId: id }),
8937
+ linkLineage: async (input) => {
8938
+ const linkDefinition = requireLinkDefinition2(objectType, input.linkId);
8939
+ assertLinkTargetType2(objectType.id, input.linkId, linkDefinition, input.targetTypeId, (expected, actual) => ontology.isValidLinkTarget(expected, actual));
8940
+ return explainLink(params, params.lineage, {
8941
+ source: { objectTypeId: objectType.id, primaryId: input.sourceId },
8942
+ linkId: input.linkId,
8943
+ target: { objectTypeId: input.targetTypeId, primaryId: input.targetId }
8944
+ });
8022
8945
  }
8023
8946
  };
8024
8947
  return objectSet;
@@ -8108,7 +9031,7 @@ async function appendTelemetry(runtime, objectTypeId, items) {
8108
9031
  await appendTelemetryBatch2(ctx, items);
8109
9032
  }
8110
9033
  // src/objects/execution.ts
8111
- function createObjectsRuntime(runtime, execution, blobStorage) {
9034
+ function createObjectsRuntime(runtime, execution, blobStorage, lineage) {
8112
9035
  const runtimeAuthorization = runtime.runtimeAuthorization;
8113
9036
  const objectReader = runtime.objectReader;
8114
9037
  assertAuthorizedObjectReaderBinding({
@@ -8140,7 +9063,8 @@ function createObjectsRuntime(runtime, execution, blobStorage) {
8140
9063
  ...capturedRuntime,
8141
9064
  execution,
8142
9065
  objectType,
8143
- blobStorage
9066
+ blobStorage,
9067
+ lineage
8144
9068
  });
8145
9069
  }, {
8146
9070
  listTypes: () => ontologyView().listObjectTypes(),
@@ -8470,6 +9394,7 @@ class ShareError2 extends Error {
8470
9394
  this.reason = reason;
8471
9395
  }
8472
9396
  }
9397
+ var REVOKING_PRIMITIVE_KINDS = new Set(["action", "workflow"]);
8473
9398
  function createSharesRuntime(runtime, execution, definitions) {
8474
9399
  const managementPrincipal = () => {
8475
9400
  const authority = resolveExecutionScopeAuthorization(runtime.projectId, {
@@ -8484,6 +9409,18 @@ function createSharesRuntime(runtime, execution, definitions) {
8484
9409
  id: authority.context.principal.id
8485
9410
  };
8486
9411
  };
9412
+ const revocationActor = () => {
9413
+ const authority = resolveExecutionScopeAuthorization(runtime.projectId, {
9414
+ execution,
9415
+ authorization: runtime.runtimeAuthorization
9416
+ });
9417
+ if (authority.type === "unrestricted" && authority.ref.type === "trustedPrimitive") {
9418
+ const { kind, id } = authority.ref.primitive;
9419
+ if (REVOKING_PRIMITIVE_KINDS.has(kind))
9420
+ return { type: "system", id: `${kind}:${id}` };
9421
+ }
9422
+ return managementPrincipal();
9423
+ };
8487
9424
  const canManage = (shareId) => {
8488
9425
  try {
8489
9426
  managementPrincipal();
@@ -8607,7 +9544,7 @@ function createSharesRuntime(runtime, execution, definitions) {
8607
9544
  });
8608
9545
  },
8609
9546
  revoke: async (grantId) => {
8610
- const actor = managementPrincipal();
9547
+ const actor = revocationActor();
8611
9548
  const storage = requireShareStorage(runtime);
8612
9549
  if (typeof grantId !== "string" || !grantId.trim()) {
8613
9550
  throw new ShareError2("invalid_input", "[Sixb] Shared access grant id must not be empty.");
@@ -8620,7 +9557,7 @@ function createSharesRuntime(runtime, execution, definitions) {
8620
9557
  }
8621
9558
  if (!current)
8622
9559
  return null;
8623
- if (!definitions.getById(current.definitionId) || !canManage(current.definitionId)) {
9560
+ if (!definitions.getById(current.definitionId) || actor.type !== "system" && !canManage(current.definitionId)) {
8624
9561
  return null;
8625
9562
  }
8626
9563
  try {
@@ -9009,7 +9946,10 @@ function createExecutionFacades(runtime, execution, dependencies) {
9009
9946
  const session = runtime.modelExecution ?? new ModelExecutionSession(runtime, execution);
9010
9947
  const agent = createAgentRuntime(runtime, execution, dependencies.definitions.models, createDecisionRuntime(runtime, execution, dependencies.definitions.models, session, "agent.run"), dependencies.sandbox, dependencies.definitions.security);
9011
9948
  return {
9012
- objects: createObjectsRuntime(runtime, execution, dependencies.blobStorage),
9949
+ objects: createObjectsRuntime(runtime, execution, dependencies.blobStorage, {
9950
+ projections: dependencies.definitions.projections,
9951
+ lakeStorage: dependencies.lakeStorage
9952
+ }),
9013
9953
  actions,
9014
9954
  datasets: createDatasetsRuntime(runtime, execution, dependencies.definitions.datasets, dependencies.lakeStorage, dependencies.blobStorage, dependencies.datasetVersionMarkings),
9015
9955
  workflows,
@@ -9324,6 +10264,11 @@ function toActionRuntimeFacade(runtime) {
9324
10264
  connector: runtime.sixb.connector,
9325
10265
  models: runtime.sixb.models,
9326
10266
  users: runtime.sixb.users,
10267
+ shares: {
10268
+ revoke(grantId) {
10269
+ return runtime.sixb.shares.revoke(grantId);
10270
+ }
10271
+ },
9327
10272
  objects(objectType) {
9328
10273
  return {
9329
10274
  appendTelemetryBatch(items) {
@@ -9364,7 +10309,8 @@ function createBasePhaseContext(input) {
9364
10309
  logger: input.logger,
9365
10310
  params: coerceActionParamsToTyped(input.action.params, run.params, input.runtime.sixb.objects.getValueTypesById()),
9366
10311
  subject: run.subject,
9367
- requestedBy: input.runtime.requestedBy
10312
+ requestedBy: input.runtime.requestedBy,
10313
+ client: input.runtime.client
9368
10314
  };
9369
10315
  }
9370
10316
  async function loadObjectTarget(input) {
@@ -10319,7 +11265,7 @@ async function executeActionRun(host, input) {
10319
11265
  primitive: { kind: "action", id: run.actionId, runId: run.id }
10320
11266
  });
10321
11267
  return await runAction({
10322
- runtime: buildActionContext(host, actionRuns, bound, input.readSubjectAsRequester),
11268
+ runtime: buildActionContext(host, actionRuns, bound, input),
10323
11269
  run,
10324
11270
  signals
10325
11271
  });
@@ -10334,14 +11280,16 @@ function requireActionRunStorage(host, runId) {
10334
11280
  }
10335
11281
  return actionRuns;
10336
11282
  }
10337
- function buildActionContext(host, actionRunsStorage, execution, readSubjectAsRequester) {
11283
+ function buildActionContext(host, actionRunsStorage, execution, input) {
11284
+ const { readSubjectAsRequester } = input;
10338
11285
  const sixb = {
10339
11286
  models: execution.sixb.models,
10340
11287
  objects: execution.sixb.objects,
10341
11288
  actions: execution.sixb.actions,
10342
11289
  connector: execution.sixb.connector,
10343
11290
  blobs: execution.sixb.blobs,
10344
- users: execution.sixb.users
11291
+ users: execution.sixb.users,
11292
+ shares: execution.sixb.shares
10345
11293
  };
10346
11294
  return {
10347
11295
  id: host.id,
@@ -10353,6 +11301,7 @@ function buildActionContext(host, actionRunsStorage, execution, readSubjectAsReq
10353
11301
  sixb,
10354
11302
  actions: host.definitions.actions,
10355
11303
  requestedBy: execution.sixb.execution.requestedBy,
11304
+ client: input.client,
10356
11305
  ...readSubjectAsRequester === undefined ? {} : { readSubjectAsRequester }
10357
11306
  };
10358
11307
  }
@@ -10440,7 +11389,8 @@ class ActionRunExecutor {
10440
11389
  run,
10441
11390
  execution,
10442
11391
  signal: request.signal,
10443
- ...request.readSubjectAsRequester === undefined ? {} : { readSubjectAsRequester: request.readSubjectAsRequester }
11392
+ ...request.readSubjectAsRequester === undefined ? {} : { readSubjectAsRequester: request.readSubjectAsRequester },
11393
+ ...request.client === undefined ? {} : { client: request.client }
10444
11394
  });
10445
11395
  } catch (error) {
10446
11396
  throw this.failRequest(run, error);
@@ -10573,6 +11523,7 @@ async function requestAction3(runtime, execution, input) {
10573
11523
  }
10574
11524
  });
10575
11525
  const conditioned = authorization.type === "principal" && subject.kind === "object" && objectReader.viewsThroughCondition(subject.objectTypeId);
11526
+ const client = getRequestClient(execution);
10576
11527
  const run = await executor.request({
10577
11528
  runId,
10578
11529
  payload,
@@ -10580,6 +11531,7 @@ async function requestAction3(runtime, execution, input) {
10580
11531
  assertCanReuse,
10581
11532
  signal: request.signal,
10582
11533
  onRequested: request.onRequested,
11534
+ ...client === undefined ? {} : { client },
10583
11535
  ...conditioned ? {
10584
11536
  readSubjectAsRequester: ({ objectTypeId, primaryId }) => objectReader.getByPrimaryId({ objectTypeId, primaryId })
10585
11537
  } : {}
@@ -10747,6 +11699,6 @@ function snapshotActionRequest(input) {
10747
11699
  ...onRequested === undefined ? {} : { onRequested }
10748
11700
  };
10749
11701
  }
10750
- export { defineAction2, param2, optional2, ActionRegistry2, bindModelExecutionAttempt, canInheritAgentRequestAuthorization2, createAgentExecutionRecord2, createInheritedAgentExecutionRecord2, bindDurableAgentExecution2, bindAgentRunRequestExecution2, bindAgentModelExecution2, restoreAgentExecutionScope2, assertAgentExecutionRecord2, resumeDecidedAgentTurn2, agentRunApprovalMode2, holdAgentApprovalCall2, approvalCallSummary2, listChildApprovalsAwaiting2, isAwaitingApprovalRun2, isPausedSubagentRun2, AGENT_APPROVAL_EXECUTION_LEASE_MS2, turnResumeReadiness2, turnPausesOnHeldCalls2, hasActiveChildren2, listTurnApprovals2, stopAgentTurn2, announceAgentApprovals2, agentApprovalCallers2, AgentRunScopeError2, resolveAgentRunExecutionScope2, createAgentApprovalExecutor, registerAgentApprovalExecutor, getAgentApprovalExecutor2, requestAgentRunCancel2, isAwaitingAnswerRun2, deferredChildQuestion2, listSubagentThreadRuns2, subagentSandboxFiles2, assertTurnModelRouting, DEFAULT_PROJECT_LOCALE, DEFAULT_PROJECT_TIME_ZONE, canonicalLocale, canonicalTimeZone, resolveAgentContextParts2, agentRunQueueJobId2, workflowAgentNodeQueueJobId2, dispatchQueuedAgentRuns2, assertNoAgentDefinitions, requestAgentRun2, isRetryableAgentRun2, retryAgentRun2, WorkflowDefinitionError2, WorkflowValidationError2, assertNonEmpty, isStepDefinition2, isAgentStepDefinition2, isInterventionDefinition2, isWorkflowDefinition2, validateWorkflowDefinition2, validateWorkflowsAtStartup2, validateWorkflowAgentStepGroupReferences2, validateWorkflowInput2, validateWorkflowStepInput2, validateWorkflowStepOutput2, validateWorkflowInterventionInput2, validateWorkflowInterventionResponse2, validateWorkflowInterventionDefaultResponse2, assertAgentStepSandbox, validateWorkflowAgentStepInput2, validateWorkflowAgentStepOutput2, snapshotWorkflowAgentStepInput2, snapshotWorkflowAgentStepOutput2, snapshotWorkflowInput2, snapshotWorkflowStepInput2, snapshotWorkflowStepOutput2, snapshotWorkflowInterventionInput2, snapshotWorkflowInterventionResponse2, snapshotWorkflowInterventionDefaultResponse2, snapshotWorkflowActionInput2, WorkflowRunDispatcher2, requestWorkflowRun2, prepareBoundActionRequest2, prepareBoundWorkflowRequest2, runModelLoop2, requestAction2, ObjectError2, removeLink2, upsertLink2, upsertLinkBatch2, deleteObject2, restoreObject2, upsertObject2, upsertObjectBatch2, writeTelemetryBatch2, appendTelemetryBatch2, getTelemetryHistoryBatch2, requireLinkDefinition2, resolveObjectContext2, resolveLinkContext2, createObjectSet2, exports_service, ShareError2, createBoundSixb, isBoundSixb, bindDurablePrimitiveExecution2, ACTION_RUN_DRAIN_TIMEOUT_MS2, ActionRunExecutor, registerActionRunExecutor, drainActionRuns2, requestAction3 };
11702
+ export { defineAction2, param2, optional2, ActionRegistry2, bindRequestClient, bindModelExecutionAttempt, canInheritAgentRequestAuthorization2, createAgentExecutionRecord2, createInheritedAgentExecutionRecord2, bindDurableAgentExecution2, bindAgentRunRequestExecution2, bindAgentModelExecution2, restoreAgentExecutionScope2, assertAgentExecutionRecord2, resumeDecidedAgentTurn2, agentRunApprovalMode2, holdAgentApprovalCall2, approvalCallSummary2, listChildApprovalsAwaiting2, isAwaitingApprovalRun2, isPausedSubagentRun2, AGENT_APPROVAL_EXECUTION_LEASE_MS2, turnResumeReadiness2, turnPausesOnHeldCalls2, hasActiveChildren2, listTurnApprovals2, stopAgentTurn2, announceAgentApprovals2, agentApprovalCallers2, AgentRunScopeError2, resolveAgentRunExecutionScope2, createAgentApprovalExecutor, registerAgentApprovalExecutor, getAgentApprovalExecutor2, requestAgentRunCancel2, isAwaitingAnswerRun2, deferredChildQuestion2, listSubagentThreadRuns2, subagentSandboxFiles2, assertTurnModelRouting, DEFAULT_PROJECT_LOCALE, DEFAULT_PROJECT_TIME_ZONE, canonicalLocale, canonicalTimeZone, resolveAgentContextParts2, agentRunQueueJobId2, workflowAgentNodeQueueJobId2, dispatchQueuedAgentRuns2, assertNoAgentDefinitions, requestAgentRun2, isRetryableAgentRun2, retryAgentRun2, WorkflowDefinitionError2, WorkflowValidationError2, assertNonEmpty, isStepDefinition2, isAgentStepDefinition2, isInterventionDefinition2, isWorkflowDefinition2, validateWorkflowDefinition2, validateWorkflowsAtStartup2, validateWorkflowAgentStepGroupReferences2, validateWorkflowInput2, validateWorkflowStepInput2, validateWorkflowStepOutput2, validateWorkflowInterventionInput2, validateWorkflowInterventionResponse2, validateWorkflowInterventionDefaultResponse2, assertAgentStepSandbox, validateWorkflowAgentStepInput2, validateWorkflowAgentStepOutput2, snapshotWorkflowAgentStepInput2, snapshotWorkflowAgentStepOutput2, snapshotWorkflowInput2, snapshotWorkflowStepInput2, snapshotWorkflowStepOutput2, snapshotWorkflowInterventionInput2, snapshotWorkflowInterventionResponse2, snapshotWorkflowInterventionDefaultResponse2, snapshotWorkflowActionInput2, WorkflowRunDispatcher2, requestWorkflowRun2, prepareBoundActionRequest2, prepareBoundWorkflowRequest2, runModelLoop2, requestAction2, ObjectError2, removeLink2, upsertLink2, upsertLinkBatch2, deleteObject2, restoreObject2, upsertObject2, upsertObjectBatch2, writeTelemetryBatch2, appendTelemetryBatch2, getTelemetryHistoryBatch2, requireLinkDefinition2, resolveObjectContext2, resolveLinkContext2, createObjectSet2, exports_service, ShareError2, createBoundSixb, isBoundSixb, bindDurablePrimitiveExecution2, ACTION_RUN_DRAIN_TIMEOUT_MS2, ActionRunExecutor, registerActionRunExecutor, drainActionRuns2, requestAction3 };
10751
11703
 
10752
- //# debugId=0B9B06CB5085066064756E2164756E21
11704
+ //# debugId=5EDF0A17BE0A577564756E2164756E21