@sixb/core 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (910) hide show
  1. package/dist/actions/builders/params.d.ts +1 -22
  2. package/dist/actions/builders/params.d.ts.map +1 -1
  3. package/dist/actions/index.d.ts +2 -2
  4. package/dist/actions/index.d.ts.map +1 -1
  5. package/dist/actions/index.js +33 -30
  6. package/dist/actions/index.js.map +1 -1
  7. package/dist/actions/read-facade.d.ts +14 -16
  8. package/dist/actions/read-facade.d.ts.map +1 -1
  9. package/dist/actions/request.d.ts.map +1 -1
  10. package/dist/actions/run-dispatch.d.ts +2 -0
  11. package/dist/actions/run-dispatch.d.ts.map +1 -1
  12. package/dist/actions/types/context.d.ts +18 -31
  13. package/dist/actions/types/context.d.ts.map +1 -1
  14. package/dist/actions/types/params.d.ts +11 -44
  15. package/dist/actions/types/params.d.ts.map +1 -1
  16. package/dist/actions/validation.d.ts.map +1 -1
  17. package/dist/actions/worker.js +3 -2
  18. package/dist/actions/worker.js.map +2 -2
  19. package/dist/agents/errors.d.ts +1 -1
  20. package/dist/agents/errors.d.ts.map +1 -1
  21. package/dist/agents/execution.d.ts +15 -9
  22. package/dist/agents/execution.d.ts.map +1 -1
  23. package/dist/agents/ids.d.ts +2 -0
  24. package/dist/agents/ids.d.ts.map +1 -1
  25. package/dist/agents/index.d.ts +1 -1
  26. package/dist/agents/index.d.ts.map +1 -1
  27. package/dist/agents/index.js +52 -44
  28. package/dist/agents/index.js.map +1 -1
  29. package/dist/agents/request.d.ts.map +1 -1
  30. package/dist/agents/sandbox.d.ts +5 -0
  31. package/dist/agents/sandbox.d.ts.map +1 -0
  32. package/dist/agents/streams/index.js +4 -3
  33. package/dist/agents/streams/index.js.map +1 -1
  34. package/dist/agents/streams/internal.js +4 -3
  35. package/dist/agents/streams/internal.js.map +1 -1
  36. package/dist/agents/validation.d.ts.map +1 -1
  37. package/dist/assert-never.d.ts +6 -0
  38. package/dist/assert-never.d.ts.map +1 -0
  39. package/dist/auth/client-address.d.ts +3 -0
  40. package/dist/auth/client-address.d.ts.map +1 -0
  41. package/dist/auth/csrf.d.ts +5 -1
  42. package/dist/auth/csrf.d.ts.map +1 -1
  43. package/dist/auth/index.d.ts +3 -2
  44. package/dist/auth/index.d.ts.map +1 -1
  45. package/dist/auth/index.js +15 -7
  46. package/dist/auth/index.js.map +1 -1
  47. package/dist/auth/runtime.d.ts +58 -41
  48. package/dist/auth/runtime.d.ts.map +1 -1
  49. package/dist/auth/session-cache.d.ts +10 -3
  50. package/dist/auth/session-cache.d.ts.map +1 -1
  51. package/dist/auth/sessions.d.ts +12 -0
  52. package/dist/auth/sessions.d.ts.map +1 -1
  53. package/dist/auth/strategy.js +1 -1
  54. package/dist/auth/types.d.ts +8 -15
  55. package/dist/auth/types.d.ts.map +1 -1
  56. package/dist/authorization/index.js +5 -4
  57. package/dist/authorization/index.js.map +1 -1
  58. package/dist/bootstrap/index.d.ts +1 -1
  59. package/dist/bootstrap/index.d.ts.map +1 -1
  60. package/dist/bootstrap/index.js +54 -48
  61. package/dist/bootstrap/index.js.map +1 -1
  62. package/dist/bootstrap/ontology-type-manifest.d.ts +8 -0
  63. package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
  64. package/dist/{chunk-q5gz3g2j.js → chunk-0321g649.js} +2 -16
  65. package/dist/{chunk-q5gz3g2j.js.map → chunk-0321g649.js.map} +2 -2
  66. package/dist/{chunk-d63nnr5b.js → chunk-04h4t2b5.js} +39 -53
  67. package/dist/{chunk-d63nnr5b.js.map → chunk-04h4t2b5.js.map} +5 -6
  68. package/dist/chunk-2fv8sajb.js +84 -0
  69. package/dist/chunk-2fv8sajb.js.map +10 -0
  70. package/dist/{chunk-1yefycb1.js → chunk-2hbhn1ff.js} +2 -2
  71. package/dist/{chunk-ap0g1g74.js → chunk-3nx8vj5a.js} +43 -6
  72. package/dist/chunk-3nx8vj5a.js.map +12 -0
  73. package/dist/{chunk-wjasrj67.js → chunk-3qpcrcj8.js} +1 -1
  74. package/dist/{chunk-0y39rgsb.js → chunk-4tnrzqqh.js} +1 -1
  75. package/dist/chunk-58geavnf.js +29 -0
  76. package/dist/chunk-58geavnf.js.map +10 -0
  77. package/dist/{chunk-01kj2pbh.js → chunk-63fp9x3q.js} +97 -67
  78. package/dist/chunk-63fp9x3q.js.map +20 -0
  79. package/dist/{chunk-7bs40fe1.js → chunk-69266efg.js} +83 -2
  80. package/dist/chunk-69266efg.js.map +12 -0
  81. package/dist/{chunk-sepyxgpc.js → chunk-693f3zn8.js} +70 -28
  82. package/dist/chunk-693f3zn8.js.map +15 -0
  83. package/dist/{chunk-7zgecwy1.js → chunk-6x0pqh32.js} +12 -1
  84. package/dist/{chunk-7zgecwy1.js.map → chunk-6x0pqh32.js.map} +3 -3
  85. package/dist/{chunk-c5rkjrgp.js → chunk-7ytf06d3.js} +1 -1
  86. package/dist/{chunk-a0e6x5hd.js → chunk-898y24dd.js} +165 -90
  87. package/dist/chunk-898y24dd.js.map +15 -0
  88. package/dist/{chunk-mrp7k0pw.js → chunk-91kcnbf0.js} +9 -14
  89. package/dist/chunk-91kcnbf0.js.map +10 -0
  90. package/dist/{chunk-z0s4axeh.js → chunk-91wthfwe.js} +97 -21
  91. package/dist/{chunk-z0s4axeh.js.map → chunk-91wthfwe.js.map} +8 -7
  92. package/dist/{chunk-yv79ncbv.js → chunk-96yw3pwd.js} +3 -3
  93. package/dist/chunk-96yw3pwd.js.map +10 -0
  94. package/dist/chunk-98cw09sw.js.map +2 -2
  95. package/dist/{chunk-g00bfdq6.js → chunk-9pfw47qx.js} +318 -257
  96. package/dist/chunk-9pfw47qx.js.map +44 -0
  97. package/dist/{chunk-5hz0fnca.js → chunk-a0073121.js} +64 -60
  98. package/dist/chunk-a0073121.js.map +12 -0
  99. package/dist/{chunk-cfvakeax.js → chunk-a69fkrtr.js} +5 -5
  100. package/dist/{chunk-72w2pxk7.js → chunk-bdhfn0ww.js} +11 -3
  101. package/dist/{chunk-72w2pxk7.js.map → chunk-bdhfn0ww.js.map} +3 -3
  102. package/dist/chunk-bep5rrdq.js +81 -0
  103. package/dist/chunk-bep5rrdq.js.map +10 -0
  104. package/dist/chunk-bxx3ms5t.js +29 -0
  105. package/dist/chunk-bxx3ms5t.js.map +10 -0
  106. package/dist/{chunk-v2vcg0w6.js → chunk-cbn96bve.js} +2 -2
  107. package/dist/{chunk-860dwwy0.js → chunk-cd234ba4.js} +22 -12
  108. package/dist/chunk-cd234ba4.js.map +14 -0
  109. package/dist/{chunk-gq8vhakp.js → chunk-cvrbhvtr.js} +292 -104
  110. package/dist/chunk-cvrbhvtr.js.map +46 -0
  111. package/dist/{chunk-ms2tmn1k.js → chunk-d8yes9yx.js} +355 -100
  112. package/dist/chunk-d8yes9yx.js.map +20 -0
  113. package/dist/{chunk-pr2h4bv4.js → chunk-darm7eeg.js} +9 -9
  114. package/dist/{chunk-pr2h4bv4.js.map → chunk-darm7eeg.js.map} +3 -3
  115. package/dist/chunk-dmn70ztd.js.map +2 -2
  116. package/dist/chunk-drz59ve0.js +57 -0
  117. package/dist/chunk-drz59ve0.js.map +10 -0
  118. package/dist/{chunk-skz0hst3.js → chunk-dsfw1bdr.js} +6 -86
  119. package/dist/{chunk-skz0hst3.js.map → chunk-dsfw1bdr.js.map} +3 -3
  120. package/dist/{chunk-g6cke204.js → chunk-f85hpqnm.js} +1 -1
  121. package/dist/{chunk-vsj3mdfj.js → chunk-fc5zfxy1.js} +1 -1
  122. package/dist/chunk-ffwvdgk1.js +85 -0
  123. package/dist/chunk-ffwvdgk1.js.map +10 -0
  124. package/dist/chunk-gbcrz0gr.js +552 -0
  125. package/dist/chunk-gbcrz0gr.js.map +17 -0
  126. package/dist/{chunk-gqm76kse.js → chunk-gc226ten.js} +434 -177
  127. package/dist/chunk-gc226ten.js.map +62 -0
  128. package/dist/{chunk-awbhdqyc.js → chunk-gmt22nxx.js} +10 -16
  129. package/dist/chunk-gmt22nxx.js.map +10 -0
  130. package/dist/chunk-h89wz928.js +42 -0
  131. package/dist/chunk-h89wz928.js.map +10 -0
  132. package/dist/{chunk-aa6z4a19.js → chunk-hgqpcmyr.js} +2 -1
  133. package/dist/chunk-hgqpcmyr.js.map +12 -0
  134. package/dist/{chunk-gqh45d2n.js → chunk-ht4a7mjg.js} +76 -6
  135. package/dist/chunk-ht4a7mjg.js.map +15 -0
  136. package/dist/{chunk-x9m9x2eq.js → chunk-jhyc777j.js} +3 -3
  137. package/dist/{chunk-fh8kgex1.js → chunk-jmwy25mf.js} +76 -58
  138. package/dist/{chunk-fh8kgex1.js.map → chunk-jmwy25mf.js.map} +3 -3
  139. package/dist/{chunk-rb1xx120.js → chunk-k4kkp58d.js} +25 -8
  140. package/dist/chunk-k4kkp58d.js.map +11 -0
  141. package/dist/{chunk-jsy70480.js → chunk-ky7zpbtt.js} +366 -98
  142. package/dist/chunk-ky7zpbtt.js.map +19 -0
  143. package/dist/chunk-m4ehq95f.js +9 -0
  144. package/dist/chunk-m4ehq95f.js.map +10 -0
  145. package/dist/{chunk-17kfctj6.js → chunk-m8zkvep1.js} +2 -2
  146. package/dist/{chunk-z0271qkp.js → chunk-mdnw7nj8.js} +8 -6
  147. package/dist/chunk-mdnw7nj8.js.map +15 -0
  148. package/dist/{chunk-4zhmdsx6.js → chunk-mf6hwpzh.js} +121 -28
  149. package/dist/{chunk-4zhmdsx6.js.map → chunk-mf6hwpzh.js.map} +6 -6
  150. package/dist/{chunk-z30bv4ga.js → chunk-mr60an99.js} +5 -3
  151. package/dist/{chunk-z30bv4ga.js.map → chunk-mr60an99.js.map} +3 -3
  152. package/dist/chunk-n33e8dz8.js +191 -0
  153. package/dist/chunk-n33e8dz8.js.map +11 -0
  154. package/dist/chunk-p1683c0v.js +104 -0
  155. package/dist/chunk-p1683c0v.js.map +11 -0
  156. package/dist/{chunk-9qsh3p5y.js → chunk-rb143ggb.js} +1 -1
  157. package/dist/{chunk-653vwrzr.js → chunk-rdghfsss.js} +1 -1
  158. package/dist/chunk-rdghfsss.js.map +10 -0
  159. package/dist/{chunk-ftv470j8.js → chunk-rqtdtm43.js} +365 -67
  160. package/dist/chunk-rqtdtm43.js.map +50 -0
  161. package/dist/{chunk-dz5h08xv.js → chunk-rzcjp5m2.js} +28 -9
  162. package/dist/chunk-rzcjp5m2.js.map +25 -0
  163. package/dist/{chunk-f4w3yp4f.js → chunk-rzkr70gr.js} +108 -21
  164. package/dist/chunk-rzkr70gr.js.map +13 -0
  165. package/dist/{chunk-3ckk0xfj.js → chunk-s24qbp32.js} +18 -13
  166. package/dist/{chunk-3ckk0xfj.js.map → chunk-s24qbp32.js.map} +3 -3
  167. package/dist/{chunk-f0rwz2vh.js → chunk-t6f3tdnr.js} +2 -54
  168. package/dist/chunk-t6f3tdnr.js.map +10 -0
  169. package/dist/{chunk-93csa55g.js → chunk-tw03bsmb.js} +11 -5
  170. package/dist/chunk-tw03bsmb.js.map +11 -0
  171. package/dist/chunk-vef6qa14.js +363 -0
  172. package/dist/chunk-vef6qa14.js.map +14 -0
  173. package/dist/{chunk-92vk7gta.js → chunk-vn3yh259.js} +1 -1
  174. package/dist/{chunk-g91qxjj0.js → chunk-w9bp61e7.js} +5 -5
  175. package/dist/{chunk-b19g04jk.js → chunk-xgptywp0.js} +4 -3
  176. package/dist/chunk-xgptywp0.js.map +11 -0
  177. package/dist/{chunk-g53f0e4j.js → chunk-xnx96gfy.js} +45 -17
  178. package/dist/{chunk-g53f0e4j.js.map → chunk-xnx96gfy.js.map} +3 -3
  179. package/dist/{chunk-1824gssz.js → chunk-y487ywrv.js} +4 -4
  180. package/dist/{chunk-7apz6hg4.js → chunk-y6vnvayj.js} +8 -4
  181. package/dist/chunk-y6vnvayj.js.map +10 -0
  182. package/dist/{chunk-wf88w4kp.js → chunk-ypj2wqtj.js} +3 -6
  183. package/dist/{chunk-wf88w4kp.js.map → chunk-ypj2wqtj.js.map} +4 -4
  184. package/dist/chunk-z3y5kg1x.js +14 -0
  185. package/dist/chunk-z3y5kg1x.js.map +10 -0
  186. package/dist/{chunk-38zv5rkr.js → chunk-z9h698s8.js} +1 -1
  187. package/dist/{chunk-38zv5rkr.js.map → chunk-z9h698s8.js.map} +2 -2
  188. package/dist/{chunk-8vj0rjgs.js → chunk-zdkcdshk.js} +3 -36
  189. package/dist/{chunk-8vj0rjgs.js.map → chunk-zdkcdshk.js.map} +3 -4
  190. package/dist/{chunk-358caqf5.js → chunk-znw0zvy4.js} +2 -2
  191. package/dist/datasets/validation.d.ts +4 -0
  192. package/dist/datasets/validation.d.ts.map +1 -1
  193. package/dist/datasets/write.d.ts.map +1 -1
  194. package/dist/datasets/write.js +5 -4
  195. package/dist/datasets/write.js.map +1 -1
  196. package/dist/edits/types.d.ts +19 -19
  197. package/dist/edits/types.d.ts.map +1 -1
  198. package/dist/error-reporting/capability.d.ts +3 -2
  199. package/dist/error-reporting/capability.d.ts.map +1 -1
  200. package/dist/error-reporting/internal.js +5 -4
  201. package/dist/error-reporting/internal.js.map +1 -1
  202. package/dist/error-reporting/reports.d.ts +10 -0
  203. package/dist/error-reporting/reports.d.ts.map +1 -1
  204. package/dist/error-reporting/types.d.ts +10 -2
  205. package/dist/error-reporting/types.d.ts.map +1 -1
  206. package/dist/errors/catalog.d.ts +16 -0
  207. package/dist/errors/catalog.d.ts.map +1 -1
  208. package/dist/errors/failure-message.d.ts +8 -0
  209. package/dist/errors/failure-message.d.ts.map +1 -0
  210. package/dist/errors/internal.d.ts.map +1 -1
  211. package/dist/errors/internal.js +3 -2
  212. package/dist/errors/internal.js.map +1 -1
  213. package/dist/events/envelope.d.ts +0 -12
  214. package/dist/events/envelope.d.ts.map +1 -1
  215. package/dist/events/index.d.ts +1 -1
  216. package/dist/events/index.d.ts.map +1 -1
  217. package/dist/events/index.js +5 -4
  218. package/dist/events/index.js.map +1 -1
  219. package/dist/events/service.d.ts +1 -2
  220. package/dist/events/service.d.ts.map +1 -1
  221. package/dist/events/toStoredEvent.d.ts +1 -2
  222. package/dist/events/toStoredEvent.d.ts.map +1 -1
  223. package/dist/events/types/index.d.ts +2 -1
  224. package/dist/events/types/index.d.ts.map +1 -1
  225. package/dist/execution/agent.d.ts +1 -2
  226. package/dist/execution/agent.d.ts.map +1 -1
  227. package/dist/execution/agent.js +48 -43
  228. package/dist/execution/agent.js.map +1 -1
  229. package/dist/execution/authorization.d.ts.map +1 -1
  230. package/dist/execution/authorized-object-reader.d.ts +3 -0
  231. package/dist/execution/authorized-object-reader.d.ts.map +1 -1
  232. package/dist/execution/kernel-operation.d.ts +4 -0
  233. package/dist/execution/kernel-operation.d.ts.map +1 -0
  234. package/dist/execution/primitive.d.ts +1 -2
  235. package/dist/execution/primitive.d.ts.map +1 -1
  236. package/dist/execution/primitive.js +47 -42
  237. package/dist/execution/primitive.js.map +3 -3
  238. package/dist/execution/request.d.ts +1 -2
  239. package/dist/execution/request.d.ts.map +1 -1
  240. package/dist/execution/request.js +48 -43
  241. package/dist/execution/request.js.map +3 -3
  242. package/dist/execution/types.d.ts +6 -0
  243. package/dist/execution/types.d.ts.map +1 -1
  244. package/dist/index.d.ts +20 -10
  245. package/dist/index.d.ts.map +1 -1
  246. package/dist/index.js +77 -62
  247. package/dist/index.js.map +1 -1
  248. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  249. package/dist/lake-storage/index.js +5 -4
  250. package/dist/lake-storage/index.js.map +1 -1
  251. package/dist/maintenance/ontology-maintenance.d.ts +11 -1
  252. package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
  253. package/dist/materialization/errors.d.ts +4 -2
  254. package/dist/materialization/errors.d.ts.map +1 -1
  255. package/dist/materialization/events.d.ts +27 -2
  256. package/dist/materialization/events.d.ts.map +1 -1
  257. package/dist/materialization/index.d.ts +1 -0
  258. package/dist/materialization/index.d.ts.map +1 -1
  259. package/dist/materialization/index.js +3 -3
  260. package/dist/materialization/model.d.ts +2 -0
  261. package/dist/materialization/model.d.ts.map +1 -1
  262. package/dist/materialization/vectors.d.ts +19 -0
  263. package/dist/materialization/vectors.d.ts.map +1 -0
  264. package/dist/materializer/context.d.ts.map +1 -1
  265. package/dist/materializer/edits/commit.d.ts.map +1 -1
  266. package/dist/materializer/edits/operations.d.ts +2 -1
  267. package/dist/materializer/edits/operations.d.ts.map +1 -1
  268. package/dist/materializer/edits/plan.d.ts +2 -2
  269. package/dist/materializer/edits/plan.d.ts.map +1 -1
  270. package/dist/materializer/edits/user-refs.d.ts +30 -0
  271. package/dist/materializer/edits/user-refs.d.ts.map +1 -0
  272. package/dist/materializer/edits/vector-authority.d.ts +6 -0
  273. package/dist/materializer/edits/vector-authority.d.ts.map +1 -0
  274. package/dist/materializer/edits/vectors.d.ts +6 -0
  275. package/dist/materializer/edits/vectors.d.ts.map +1 -0
  276. package/dist/materializer/effective/build-events.d.ts +2 -2
  277. package/dist/materializer/effective/build-events.d.ts.map +1 -1
  278. package/dist/materializer/effective/validate.d.ts.map +1 -1
  279. package/dist/materializer/effective/vector-indexing.d.ts +7 -0
  280. package/dist/materializer/effective/vector-indexing.d.ts.map +1 -0
  281. package/dist/materializer/effective/vectors.d.ts +6 -0
  282. package/dist/materializer/effective/vectors.d.ts.map +1 -0
  283. package/dist/materializer/execution/scope.d.ts +11 -3
  284. package/dist/materializer/execution/scope.d.ts.map +1 -1
  285. package/dist/materializer/execution/work-executor.d.ts +2 -1
  286. package/dist/materializer/execution/work-executor.d.ts.map +1 -1
  287. package/dist/materializer/index.js +30 -27
  288. package/dist/materializer/index.js.map +1 -1
  289. package/dist/materializer/projections/replacement-plan.d.ts +2 -0
  290. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  291. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  292. package/dist/materializer/telemetry/plan.d.ts +2 -2
  293. package/dist/materializer/telemetry/plan.d.ts.map +1 -1
  294. package/dist/models/catalog-index.d.ts +15 -0
  295. package/dist/models/catalog-index.d.ts.map +1 -0
  296. package/dist/models/catalog.d.ts +27 -6
  297. package/dist/models/catalog.d.ts.map +1 -1
  298. package/dist/models/decision/catalog.d.ts +12 -0
  299. package/dist/models/decision/catalog.d.ts.map +1 -0
  300. package/dist/models/decision/errors.d.ts +7 -0
  301. package/dist/models/decision/errors.d.ts.map +1 -0
  302. package/dist/models/decision/output.d.ts +50 -0
  303. package/dist/models/decision/output.d.ts.map +1 -0
  304. package/dist/models/decision/questions.d.ts +14 -0
  305. package/dist/models/decision/questions.d.ts.map +1 -0
  306. package/dist/models/decision/runtime.d.ts +7 -0
  307. package/dist/models/decision/runtime.d.ts.map +1 -0
  308. package/dist/models/decision/types.d.ts +92 -0
  309. package/dist/models/decision/types.d.ts.map +1 -0
  310. package/dist/models/decision/validation.d.ts +7 -0
  311. package/dist/models/decision/validation.d.ts.map +1 -0
  312. package/dist/models/definitions.d.ts +1 -1
  313. package/dist/models/definitions.d.ts.map +1 -1
  314. package/dist/models/embedding-model.d.ts +60 -0
  315. package/dist/models/embedding-model.d.ts.map +1 -0
  316. package/dist/models/execution/binding.d.ts +2 -0
  317. package/dist/models/execution/binding.d.ts.map +1 -1
  318. package/dist/models/execution/embedding.d.ts +5 -0
  319. package/dist/models/execution/embedding.d.ts.map +1 -0
  320. package/dist/models/execution/index.js +32 -27
  321. package/dist/models/execution/index.js.map +1 -1
  322. package/dist/models/execution/model-call-recorder.d.ts +5 -1
  323. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  324. package/dist/models/execution/session.d.ts +21 -0
  325. package/dist/models/execution/session.d.ts.map +1 -0
  326. package/dist/models/execution.d.ts.map +1 -1
  327. package/dist/models/generation-types.d.ts +2 -0
  328. package/dist/models/generation-types.d.ts.map +1 -1
  329. package/dist/models/index.d.ts +9 -1
  330. package/dist/models/index.d.ts.map +1 -1
  331. package/dist/models/index.js +17 -7
  332. package/dist/models/index.js.map +1 -1
  333. package/dist/models/pricing.d.ts +3 -2
  334. package/dist/models/pricing.d.ts.map +1 -1
  335. package/dist/objects/authorized-ontology-view.d.ts.map +1 -1
  336. package/dist/objects/execution.d.ts +21 -26
  337. package/dist/objects/execution.d.ts.map +1 -1
  338. package/dist/objects/index.js +33 -30
  339. package/dist/objects/index.js.map +1 -1
  340. package/dist/objects/query/executor.d.ts +3 -0
  341. package/dist/objects/query/executor.d.ts.map +1 -1
  342. package/dist/objects/query/index.d.ts +2 -0
  343. package/dist/objects/query/index.d.ts.map +1 -1
  344. package/dist/objects/query/index.js +42 -30
  345. package/dist/objects/query/index.js.map +1 -1
  346. package/dist/objects/query/ir.d.ts +14 -3
  347. package/dist/objects/query/ir.d.ts.map +1 -1
  348. package/dist/objects/query/normalize.d.ts.map +1 -1
  349. package/dist/objects/query/scalar-values.d.ts.map +1 -1
  350. package/dist/objects/query/validate.d.ts.map +1 -1
  351. package/dist/objects/sdk/object-handle.d.ts +6 -2
  352. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  353. package/dist/objects/sdk/object-set.d.ts +2 -3
  354. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  355. package/dist/objects/sdk/query-builder.d.ts +8 -10
  356. package/dist/objects/sdk/query-builder.d.ts.map +1 -1
  357. package/dist/objects/sdk/query-executor.d.ts +2 -0
  358. package/dist/objects/sdk/query-executor.d.ts.map +1 -1
  359. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  360. package/dist/objects/sdk/telemetry-channel.d.ts +1 -2
  361. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  362. package/dist/objects/sdk/where.d.ts +2 -3
  363. package/dist/objects/sdk/where.d.ts.map +1 -1
  364. package/dist/objects/vectors/handle.d.ts +4 -0
  365. package/dist/objects/vectors/handle.d.ts.map +1 -0
  366. package/dist/objects/vectors/indexing-batch.d.ts +6 -0
  367. package/dist/objects/vectors/indexing-batch.d.ts.map +1 -0
  368. package/dist/objects/vectors/indexing-generate.d.ts +11 -0
  369. package/dist/objects/vectors/indexing-generate.d.ts.map +1 -0
  370. package/dist/objects/vectors/indexing-runtime.d.ts +7 -0
  371. package/dist/objects/vectors/indexing-runtime.d.ts.map +1 -0
  372. package/dist/objects/vectors/indexing-shared.d.ts +17 -0
  373. package/dist/objects/vectors/indexing-shared.d.ts.map +1 -0
  374. package/dist/objects/vectors/indexing-single.d.ts +4 -0
  375. package/dist/objects/vectors/indexing-single.d.ts.map +1 -0
  376. package/dist/objects/vectors/indexing-store-batch.d.ts +6 -0
  377. package/dist/objects/vectors/indexing-store-batch.d.ts.map +1 -0
  378. package/dist/objects/vectors/indexing.d.ts +7 -0
  379. package/dist/objects/vectors/indexing.d.ts.map +1 -0
  380. package/dist/objects/vectors/profile.d.ts +13 -0
  381. package/dist/objects/vectors/profile.d.ts.map +1 -0
  382. package/dist/objects/vectors/query.d.ts +5 -0
  383. package/dist/objects/vectors/query.d.ts.map +1 -0
  384. package/dist/objects/vectors/resolve-query.d.ts +6 -0
  385. package/dist/objects/vectors/resolve-query.d.ts.map +1 -0
  386. package/dist/objects/vectors/types.d.ts +11 -0
  387. package/dist/objects/vectors/types.d.ts.map +1 -0
  388. package/dist/ontology/builders.d.ts +11 -10
  389. package/dist/ontology/builders.d.ts.map +1 -1
  390. package/dist/ontology/index.d.ts +5 -2
  391. package/dist/ontology/index.d.ts.map +1 -1
  392. package/dist/ontology/index.js +7 -5
  393. package/dist/ontology/index.js.map +1 -1
  394. package/dist/ontology/inference/index.d.ts +34 -22
  395. package/dist/ontology/inference/index.d.ts.map +1 -1
  396. package/dist/ontology/internal.d.ts +1 -0
  397. package/dist/ontology/internal.d.ts.map +1 -1
  398. package/dist/ontology/internal.js +10 -7
  399. package/dist/ontology/internal.js.map +1 -1
  400. package/dist/ontology/primitives.d.ts +38 -0
  401. package/dist/ontology/primitives.d.ts.map +1 -0
  402. package/dist/ontology/query-capabilities.d.ts +38 -0
  403. package/dist/ontology/query-capabilities.d.ts.map +1 -0
  404. package/dist/ontology/refs.d.ts +23 -2
  405. package/dist/ontology/refs.d.ts.map +1 -1
  406. package/dist/ontology/registered.d.ts +16 -0
  407. package/dist/ontology/registered.d.ts.map +1 -0
  408. package/dist/ontology/registry.d.ts.map +1 -1
  409. package/dist/ontology/tokens.d.ts +35 -1
  410. package/dist/ontology/tokens.d.ts.map +1 -1
  411. package/dist/ontology/types.d.ts +26 -13
  412. package/dist/ontology/types.d.ts.map +1 -1
  413. package/dist/ontology/user-ref.d.ts +35 -0
  414. package/dist/ontology/user-ref.d.ts.map +1 -0
  415. package/dist/ontology/validation/definition.d.ts +3 -0
  416. package/dist/ontology/validation/definition.d.ts.map +1 -0
  417. package/dist/ontology/validation/index.d.ts +1 -1
  418. package/dist/ontology/validation/index.d.ts.map +1 -1
  419. package/dist/ontology/validation/normalize.d.ts.map +1 -1
  420. package/dist/ontology/validation/properties.d.ts +6 -1
  421. package/dist/ontology/validation/properties.d.ts.map +1 -1
  422. package/dist/ontology/validation/query.d.ts.map +1 -1
  423. package/dist/ontology/validation/schema.d.ts +1 -1
  424. package/dist/ontology/validation/schema.d.ts.map +1 -1
  425. package/dist/ontology/vector-profiles.d.ts +4 -0
  426. package/dist/ontology/vector-profiles.d.ts.map +1 -0
  427. package/dist/pipelines/index.js +32 -29
  428. package/dist/pipelines/index.js.map +1 -1
  429. package/dist/predicates/types.d.ts +53 -3
  430. package/dist/predicates/types.d.ts.map +1 -1
  431. package/dist/projections/builders.d.ts +19 -1
  432. package/dist/projections/builders.d.ts.map +1 -1
  433. package/dist/projections/internal.js +28 -25
  434. package/dist/projections/internal.js.map +1 -1
  435. package/dist/projections/validation.d.ts.map +1 -1
  436. package/dist/query.js +2 -2
  437. package/dist/queues/in-memory.d.ts +3 -2
  438. package/dist/queues/in-memory.d.ts.map +1 -1
  439. package/dist/queues/index.d.ts +1 -1
  440. package/dist/queues/index.d.ts.map +1 -1
  441. package/dist/queues/index.js +1 -1
  442. package/dist/queues/types.d.ts +5 -0
  443. package/dist/queues/types.d.ts.map +1 -1
  444. package/dist/runtime/create.d.ts +4 -3
  445. package/dist/runtime/create.d.ts.map +1 -1
  446. package/dist/runtime/host.d.ts +10 -7
  447. package/dist/runtime/host.d.ts.map +1 -1
  448. package/dist/runtime/index.d.ts +1 -1
  449. package/dist/runtime/index.d.ts.map +1 -1
  450. package/dist/runtime/internal.d.ts +3 -0
  451. package/dist/runtime/internal.d.ts.map +1 -1
  452. package/dist/runtime/internal.js +49 -1
  453. package/dist/runtime/internal.js.map +1 -1
  454. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  455. package/dist/runtime/sixb.d.ts +11 -6
  456. package/dist/runtime/sixb.d.ts.map +1 -1
  457. package/dist/runtime/types.d.ts +182 -187
  458. package/dist/runtime/types.d.ts.map +1 -1
  459. package/dist/sandboxes/auth.d.ts +16 -0
  460. package/dist/sandboxes/auth.d.ts.map +1 -0
  461. package/dist/sandboxes/config.d.ts +5 -0
  462. package/dist/sandboxes/config.d.ts.map +1 -0
  463. package/dist/sandboxes/configuration.d.ts +41 -0
  464. package/dist/sandboxes/configuration.d.ts.map +1 -0
  465. package/dist/sandboxes/environment.d.ts +13 -0
  466. package/dist/sandboxes/environment.d.ts.map +1 -0
  467. package/dist/sandboxes/errors.d.ts +1 -1
  468. package/dist/sandboxes/errors.d.ts.map +1 -1
  469. package/dist/sandboxes/index.d.ts +6 -1
  470. package/dist/sandboxes/index.d.ts.map +1 -1
  471. package/dist/sandboxes/index.js +16 -3
  472. package/dist/sandboxes/index.js.map +1 -1
  473. package/dist/sandboxes/sandbox.d.ts +39 -4
  474. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  475. package/dist/shared/params/builders.d.ts +25 -0
  476. package/dist/shared/params/builders.d.ts.map +1 -0
  477. package/dist/shared/params/types.d.ts +48 -0
  478. package/dist/shared/params/types.d.ts.map +1 -0
  479. package/dist/shared/params/user-refs.d.ts +19 -0
  480. package/dist/shared/params/user-refs.d.ts.map +1 -0
  481. package/dist/shared/params/validation.d.ts +15 -0
  482. package/dist/shared/params/validation.d.ts.map +1 -0
  483. package/dist/shares/compiler.d.ts.map +1 -1
  484. package/dist/shares/internal.js +29 -26
  485. package/dist/shares/internal.js.map +2 -2
  486. package/dist/storage/action-runs/failure.js +4 -3
  487. package/dist/storage/action-runs/failure.js.map +1 -1
  488. package/dist/storage/action-runs/provider.js +1 -1
  489. package/dist/storage/action-runs/types.d.ts +1 -1
  490. package/dist/storage/action-runs/types.d.ts.map +1 -1
  491. package/dist/storage/agents/in-memory.d.ts +2 -1
  492. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  493. package/dist/storage/agents/index.d.ts +1 -1
  494. package/dist/storage/agents/index.d.ts.map +1 -1
  495. package/dist/storage/agents/provider.d.ts +5 -1
  496. package/dist/storage/agents/provider.d.ts.map +1 -1
  497. package/dist/storage/agents/provider.js +8 -4
  498. package/dist/storage/agents/provider.js.map +1 -1
  499. package/dist/storage/agents/types.d.ts +49 -0
  500. package/dist/storage/agents/types.d.ts.map +1 -1
  501. package/dist/storage/ai-cost/analytics.d.ts +1 -0
  502. package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
  503. package/dist/storage/ai-cost/index.d.ts +1 -1
  504. package/dist/storage/ai-cost/index.d.ts.map +1 -1
  505. package/dist/storage/ai-cost/provider.js +2 -2
  506. package/dist/storage/ai-cost/types.d.ts +14 -2
  507. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  508. package/dist/storage/ai-limits/enforcement.js +4 -3
  509. package/dist/storage/ai-limits/enforcement.js.map +1 -1
  510. package/dist/storage/auth/in-memory/access-tokens.d.ts.map +1 -1
  511. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  512. package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -1
  513. package/dist/storage/auth/in-memory/sessions.d.ts +8 -1
  514. package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
  515. package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
  516. package/dist/storage/auth/index.d.ts +1 -1
  517. package/dist/storage/auth/index.d.ts.map +1 -1
  518. package/dist/storage/auth/types.d.ts +62 -13
  519. package/dist/storage/auth/types.d.ts.map +1 -1
  520. package/dist/storage/connector-connections/provider.js +3 -2
  521. package/dist/storage/connector-connections/provider.js.map +2 -2
  522. package/dist/storage/executions/provider.d.ts +3 -3
  523. package/dist/storage/executions/provider.d.ts.map +1 -1
  524. package/dist/storage/executions/provider.js +13 -11
  525. package/dist/storage/executions/provider.js.map +3 -3
  526. package/dist/storage/executions/types.d.ts +3 -0
  527. package/dist/storage/executions/types.d.ts.map +1 -1
  528. package/dist/storage/executions/validation.d.ts.map +1 -1
  529. package/dist/storage/file-upload-sessions/in-memory.d.ts +9 -18
  530. package/dist/storage/file-upload-sessions/in-memory.d.ts.map +1 -1
  531. package/dist/storage/file-upload-sessions/index.d.ts +1 -1
  532. package/dist/storage/file-upload-sessions/index.d.ts.map +1 -1
  533. package/dist/storage/file-upload-sessions/provider.d.ts +52 -0
  534. package/dist/storage/file-upload-sessions/provider.d.ts.map +1 -0
  535. package/dist/storage/file-upload-sessions/provider.js +24 -0
  536. package/dist/storage/file-upload-sessions/provider.js.map +9 -0
  537. package/dist/storage/file-upload-sessions/types.d.ts +19 -1
  538. package/dist/storage/file-upload-sessions/types.d.ts.map +1 -1
  539. package/dist/storage/file-upload-sessions/utils.d.ts +8 -2
  540. package/dist/storage/file-upload-sessions/utils.d.ts.map +1 -1
  541. package/dist/storage/index.d.ts +8 -6
  542. package/dist/storage/index.d.ts.map +1 -1
  543. package/dist/storage/index.js +37 -30
  544. package/dist/storage/index.js.map +1 -1
  545. package/dist/storage/internal.js +11 -9
  546. package/dist/storage/internal.js.map +1 -1
  547. package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
  548. package/dist/storage/objects/in-memory/read-source.d.ts +5 -0
  549. package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -1
  550. package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -1
  551. package/dist/storage/objects/in-memory/storage.d.ts +7 -0
  552. package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
  553. package/dist/storage/objects/types.d.ts +2 -0
  554. package/dist/storage/objects/types.d.ts.map +1 -1
  555. package/dist/storage/ontology/commits.d.ts +7 -2
  556. package/dist/storage/ontology/commits.d.ts.map +1 -1
  557. package/dist/storage/ontology/in-memory/index.d.ts +4 -0
  558. package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
  559. package/dist/storage/ontology/in-memory/materializations.d.ts +2 -0
  560. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  561. package/dist/storage/ontology/in-memory/shared-state.d.ts +7 -0
  562. package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
  563. package/dist/storage/ontology/in-memory/vector-indexing.d.ts +44 -0
  564. package/dist/storage/ontology/in-memory/vector-indexing.d.ts.map +1 -0
  565. package/dist/storage/ontology/in-memory/vectors.d.ts +31 -0
  566. package/dist/storage/ontology/in-memory/vectors.d.ts.map +1 -0
  567. package/dist/storage/ontology/index.d.ts +6 -0
  568. package/dist/storage/ontology/index.d.ts.map +1 -1
  569. package/dist/storage/ontology/provider-work.d.ts.map +1 -1
  570. package/dist/storage/ontology/provider.d.ts +14 -1
  571. package/dist/storage/ontology/provider.d.ts.map +1 -1
  572. package/dist/storage/ontology/provider.js +9 -3
  573. package/dist/storage/ontology/provider.js.map +1 -1
  574. package/dist/storage/ontology/vector-indexing.d.ts +94 -0
  575. package/dist/storage/ontology/vector-indexing.d.ts.map +1 -0
  576. package/dist/storage/ontology/vectors.d.ts +56 -0
  577. package/dist/storage/ontology/vectors.d.ts.map +1 -0
  578. package/dist/storage/operation-scope.d.ts.map +1 -1
  579. package/dist/storage/operation-scope.js +1 -1
  580. package/dist/storage/projection-runs/provider.js +4 -3
  581. package/dist/storage/projection-runs/provider.js.map +1 -1
  582. package/dist/storage/types.d.ts +2 -2
  583. package/dist/storage/types.d.ts.map +1 -1
  584. package/dist/storage/workflow-interventions/index.d.ts +1 -1
  585. package/dist/storage/workflow-interventions/index.d.ts.map +1 -1
  586. package/dist/storage/workflow-interventions/types.d.ts +5 -8
  587. package/dist/storage/workflow-interventions/types.d.ts.map +1 -1
  588. package/dist/storage/workflow-runs/provider.js +10 -8
  589. package/dist/storage/workflow-runs/provider.js.map +1 -1
  590. package/dist/syncs/index.js +33 -30
  591. package/dist/syncs/index.js.map +1 -1
  592. package/dist/testing/action-execution.d.ts +4 -0
  593. package/dist/testing/action-execution.d.ts.map +1 -1
  594. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  595. package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
  596. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  597. package/dist/testing/execution.d.ts +1 -2
  598. package/dist/testing/execution.d.ts.map +1 -1
  599. package/dist/testing/file-upload-session-storage-contract.d.ts +12 -0
  600. package/dist/testing/file-upload-session-storage-contract.d.ts.map +1 -0
  601. package/dist/testing/index.d.ts +2 -0
  602. package/dist/testing/index.d.ts.map +1 -1
  603. package/dist/testing/index.js +2351 -1263
  604. package/dist/testing/index.js.map +19 -17
  605. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  606. package/dist/testing/object-query-contract.d.ts.map +1 -1
  607. package/dist/testing/object-read-scope-contract.d.ts.map +1 -1
  608. package/dist/testing/ontology-contract-fixture.d.ts +8 -0
  609. package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
  610. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  611. package/dist/testing/queues-contract.d.ts.map +1 -1
  612. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  613. package/dist/testing/workflow-intervention-storage-contract.d.ts +8 -0
  614. package/dist/testing/workflow-intervention-storage-contract.d.ts.map +1 -0
  615. package/dist/webhooks/internal.js +29 -26
  616. package/dist/webhooks/internal.js.map +2 -2
  617. package/dist/webhooks/types.d.ts +2 -2
  618. package/dist/webhooks/types.d.ts.map +1 -1
  619. package/dist/workers/index.js +3 -2
  620. package/dist/workers/index.js.map +2 -2
  621. package/dist/workflows/failure.d.ts.map +1 -1
  622. package/dist/workflows/index.js +51 -45
  623. package/dist/workflows/index.js.map +1 -1
  624. package/dist/workflows/run-dispatch.d.ts.map +1 -1
  625. package/dist/workflows/types.d.ts +2 -2
  626. package/dist/workflows/types.d.ts.map +1 -1
  627. package/package.json +7 -1
  628. package/src/actions/builders/params.ts +1 -48
  629. package/src/actions/index.ts +0 -3
  630. package/src/actions/read-facade.ts +102 -62
  631. package/src/actions/request.ts +13 -0
  632. package/src/actions/run-dispatch.ts +3 -0
  633. package/src/actions/types/context.ts +17 -65
  634. package/src/actions/types/params.ts +16 -75
  635. package/src/actions/validation.ts +7 -84
  636. package/src/agents/authority.ts +1 -1
  637. package/src/agents/errors.ts +3 -0
  638. package/src/agents/execution.ts +67 -15
  639. package/src/agents/ids.ts +8 -0
  640. package/src/agents/index.ts +1 -0
  641. package/src/agents/request.ts +11 -0
  642. package/src/agents/sandbox.ts +44 -0
  643. package/src/agents/validation.ts +2 -108
  644. package/src/assert-never.ts +7 -0
  645. package/src/auth/client-address.ts +12 -0
  646. package/src/auth/csrf.ts +14 -5
  647. package/src/auth/index.ts +3 -2
  648. package/src/auth/runtime.ts +299 -277
  649. package/src/auth/session-cache.ts +18 -6
  650. package/src/auth/sessions.ts +30 -0
  651. package/src/auth/types.ts +7 -17
  652. package/src/bootstrap/index.ts +1 -0
  653. package/src/bootstrap/ontology-type-manifest.ts +112 -60
  654. package/src/datasets/validation.ts +40 -11
  655. package/src/datasets/write.ts +8 -11
  656. package/src/edits/types.ts +47 -63
  657. package/src/error-reporting/capability.ts +11 -0
  658. package/src/error-reporting/reports.ts +23 -0
  659. package/src/error-reporting/types.ts +12 -1
  660. package/src/errors/catalog.ts +16 -0
  661. package/src/errors/failure-message.ts +15 -0
  662. package/src/errors/internal.ts +57 -25
  663. package/src/events/envelope.ts +0 -13
  664. package/src/events/index.ts +1 -1
  665. package/src/events/service.ts +1 -11
  666. package/src/events/toStoredEvent.ts +1 -3
  667. package/src/events/types/index.ts +1 -1
  668. package/src/execution/agent.ts +1 -2
  669. package/src/execution/authorization.ts +12 -5
  670. package/src/execution/authorized-object-reader.ts +42 -9
  671. package/src/execution/kernel-operation.ts +27 -0
  672. package/src/execution/primitive.ts +1 -2
  673. package/src/execution/request.ts +1 -2
  674. package/src/execution/scopes.ts +2 -0
  675. package/src/execution/types.ts +4 -4
  676. package/src/index.ts +68 -8
  677. package/src/lake-storage/in-memory.ts +5 -3
  678. package/src/maintenance/ontology-maintenance.ts +77 -1
  679. package/src/materialization/errors.ts +4 -2
  680. package/src/materialization/events.ts +27 -2
  681. package/src/materialization/index.ts +1 -0
  682. package/src/materialization/model.ts +2 -0
  683. package/src/materialization/vectors.ts +18 -0
  684. package/src/materializer/README.md +16 -0
  685. package/src/materializer/context.ts +10 -0
  686. package/src/materializer/edits/commit.ts +29 -13
  687. package/src/materializer/edits/operations.ts +32 -4
  688. package/src/materializer/edits/plan.ts +4 -5
  689. package/src/materializer/edits/user-refs.ts +115 -0
  690. package/src/materializer/edits/vector-authority.ts +108 -0
  691. package/src/materializer/edits/vectors.ts +100 -0
  692. package/src/materializer/effective/build-events.ts +4 -5
  693. package/src/materializer/effective/validate.ts +10 -3
  694. package/src/materializer/effective/vector-indexing.ts +84 -0
  695. package/src/materializer/effective/vectors.ts +47 -0
  696. package/src/materializer/execution/scope.ts +40 -7
  697. package/src/materializer/execution/work-executor.ts +11 -3
  698. package/src/materializer/projections/replace.ts +3 -1
  699. package/src/materializer/projections/replacement-plan.ts +4 -0
  700. package/src/materializer/shared/normalize.ts +11 -0
  701. package/src/materializer/telemetry/append.ts +5 -13
  702. package/src/materializer/telemetry/plan.ts +4 -5
  703. package/src/models/catalog-index.ts +38 -0
  704. package/src/models/catalog.ts +66 -38
  705. package/src/models/decision/catalog.ts +32 -0
  706. package/src/models/decision/errors.ts +18 -0
  707. package/src/models/decision/output.ts +101 -0
  708. package/src/models/decision/questions.ts +29 -0
  709. package/src/models/decision/runtime.ts +188 -0
  710. package/src/models/decision/types.ts +109 -0
  711. package/src/models/decision/validation.ts +335 -0
  712. package/src/models/definitions.ts +1 -1
  713. package/src/models/embedding-model.ts +129 -0
  714. package/src/models/execution/README.md +63 -0
  715. package/src/models/execution/binding.ts +2 -0
  716. package/src/models/execution/embedding.ts +133 -0
  717. package/src/models/execution/model-call-recorder.ts +42 -30
  718. package/src/models/execution/session.ts +81 -0
  719. package/src/models/execution.ts +10 -52
  720. package/src/models/generation-types.ts +2 -0
  721. package/src/models/index.ts +37 -0
  722. package/src/models/pricing.ts +1 -2
  723. package/src/objects/authorized-ontology-view.ts +12 -8
  724. package/src/objects/execution.ts +34 -61
  725. package/src/objects/query/executor.ts +25 -7
  726. package/src/objects/query/explain.ts +7 -2
  727. package/src/objects/query/index.ts +2 -0
  728. package/src/objects/query/ir.ts +13 -2
  729. package/src/objects/query/normalize.ts +5 -1
  730. package/src/objects/query/planner.ts +1 -0
  731. package/src/objects/query/scalar-values.ts +19 -0
  732. package/src/objects/query/validate.ts +129 -117
  733. package/src/objects/sdk/object-handle.ts +11 -8
  734. package/src/objects/sdk/object-set.ts +9 -15
  735. package/src/objects/sdk/query-builder.ts +66 -72
  736. package/src/objects/sdk/query-executor.ts +2 -1
  737. package/src/objects/sdk/runtime-query-executor.ts +6 -2
  738. package/src/objects/sdk/telemetry-channel.ts +6 -7
  739. package/src/objects/sdk/where.ts +6 -13
  740. package/src/objects/vectors/README.md +59 -0
  741. package/src/objects/vectors/handle.ts +91 -0
  742. package/src/objects/vectors/indexing-batch.ts +163 -0
  743. package/src/objects/vectors/indexing-generate.ts +184 -0
  744. package/src/objects/vectors/indexing-runtime.ts +17 -0
  745. package/src/objects/vectors/indexing-shared.ts +188 -0
  746. package/src/objects/vectors/indexing-single.ts +51 -0
  747. package/src/objects/vectors/indexing-store-batch.ts +62 -0
  748. package/src/objects/vectors/indexing.ts +23 -0
  749. package/src/objects/vectors/profile.ts +64 -0
  750. package/src/objects/vectors/query.ts +16 -0
  751. package/src/objects/vectors/resolve-query.ts +89 -0
  752. package/src/objects/vectors/types.ts +10 -0
  753. package/src/ontology/builders.ts +15 -11
  754. package/src/ontology/index.ts +6 -0
  755. package/src/ontology/inference/index.ts +56 -36
  756. package/src/ontology/internal.ts +1 -0
  757. package/src/ontology/json-schema.ts +12 -0
  758. package/src/ontology/primitives.ts +91 -0
  759. package/src/ontology/query-capabilities.ts +136 -0
  760. package/src/ontology/refs.ts +33 -6
  761. package/src/ontology/registered.ts +22 -0
  762. package/src/ontology/registry.ts +14 -3
  763. package/src/ontology/tokens.ts +41 -2
  764. package/src/ontology/types.ts +28 -12
  765. package/src/ontology/user-ref.ts +120 -0
  766. package/src/ontology/validation/definition.ts +93 -0
  767. package/src/ontology/validation/index.ts +1 -0
  768. package/src/ontology/validation/normalize.ts +39 -3
  769. package/src/ontology/validation/properties.ts +109 -23
  770. package/src/ontology/validation/query.ts +44 -92
  771. package/src/ontology/validation/schema.ts +101 -23
  772. package/src/ontology/vector-profiles.ts +35 -0
  773. package/src/predicates/types.ts +43 -33
  774. package/src/projections/builders.ts +24 -3
  775. package/src/projections/validation.ts +15 -1
  776. package/src/queues/in-memory.ts +5 -0
  777. package/src/queues/index.ts +1 -0
  778. package/src/queues/types.ts +10 -0
  779. package/src/runtime/create.ts +7 -6
  780. package/src/runtime/host.ts +44 -10
  781. package/src/runtime/index.ts +3 -2
  782. package/src/runtime/internal.ts +3 -0
  783. package/src/runtime/resolve-definitions.ts +19 -1
  784. package/src/runtime/sixb.ts +25 -17
  785. package/src/runtime/types.ts +288 -478
  786. package/src/sandboxes/README.md +41 -0
  787. package/src/sandboxes/auth.ts +17 -0
  788. package/src/sandboxes/config.ts +37 -0
  789. package/src/sandboxes/configuration.ts +268 -0
  790. package/src/sandboxes/environment.ts +107 -0
  791. package/src/sandboxes/errors.ts +1 -1
  792. package/src/sandboxes/index.ts +15 -0
  793. package/src/sandboxes/sandbox.ts +42 -4
  794. package/src/shared/params/builders.ts +50 -0
  795. package/src/shared/params/types.ts +85 -0
  796. package/src/shared/params/user-refs.ts +48 -0
  797. package/src/shared/params/validation.ts +114 -0
  798. package/src/shares/compiler.ts +6 -16
  799. package/src/storage/action-runs/types.ts +1 -0
  800. package/src/storage/agents/in-memory.ts +25 -1
  801. package/src/storage/agents/index.ts +3 -0
  802. package/src/storage/agents/provider.ts +105 -0
  803. package/src/storage/agents/types.ts +54 -0
  804. package/src/storage/ai-cost/analytics.ts +59 -21
  805. package/src/storage/ai-cost/index.ts +1 -0
  806. package/src/storage/ai-cost/types.ts +19 -2
  807. package/src/storage/auth/in-memory/access-tokens.ts +5 -2
  808. package/src/storage/auth/in-memory/auth-storage.ts +5 -8
  809. package/src/storage/auth/in-memory/device-authorizations.ts +0 -2
  810. package/src/storage/auth/in-memory/sessions.ts +69 -1
  811. package/src/storage/auth/in-memory/shared.ts +13 -7
  812. package/src/storage/auth/index.ts +2 -1
  813. package/src/storage/auth/types.ts +57 -13
  814. package/src/storage/executions/provider.ts +24 -12
  815. package/src/storage/executions/types.ts +1 -0
  816. package/src/storage/executions/validation.ts +8 -4
  817. package/src/storage/file-upload-sessions/in-memory.ts +64 -113
  818. package/src/storage/file-upload-sessions/index.ts +1 -0
  819. package/src/storage/file-upload-sessions/provider.ts +258 -0
  820. package/src/storage/file-upload-sessions/types.ts +20 -1
  821. package/src/storage/file-upload-sessions/utils.ts +25 -9
  822. package/src/storage/index.ts +18 -3
  823. package/src/storage/objects/in-memory/query.ts +38 -14
  824. package/src/storage/objects/in-memory/read-scope.ts +9 -2
  825. package/src/storage/objects/in-memory/read-source.ts +5 -0
  826. package/src/storage/objects/in-memory/selected-reader.ts +5 -1
  827. package/src/storage/objects/in-memory/storage.ts +19 -1
  828. package/src/storage/objects/types.ts +2 -0
  829. package/src/storage/ontology/commits.ts +7 -2
  830. package/src/storage/ontology/in-memory/index.ts +20 -0
  831. package/src/storage/ontology/in-memory/materializations.ts +19 -34
  832. package/src/storage/ontology/in-memory/shared-state.ts +9 -0
  833. package/src/storage/ontology/in-memory/vector-indexing.ts +179 -0
  834. package/src/storage/ontology/in-memory/vectors.ts +73 -0
  835. package/src/storage/ontology/index.ts +14 -0
  836. package/src/storage/ontology/provider-header-validation.ts +57 -0
  837. package/src/storage/ontology/provider-work.ts +15 -3
  838. package/src/storage/ontology/provider.ts +59 -1
  839. package/src/storage/ontology/vector-indexing.ts +98 -0
  840. package/src/storage/ontology/vectors.ts +48 -0
  841. package/src/storage/operation-scope.ts +2 -0
  842. package/src/storage/types.ts +3 -1
  843. package/src/storage/workflow-interventions/index.ts +0 -1
  844. package/src/storage/workflow-interventions/types.ts +5 -9
  845. package/src/testing/action-execution.ts +13 -3
  846. package/src/testing/agent-storage-contract.ts +246 -0
  847. package/src/testing/ai-cost-storage-contract.ts +134 -0
  848. package/src/testing/auth-storage-contract.ts +149 -62
  849. package/src/testing/execution-storage-contract.ts +1 -2
  850. package/src/testing/execution.ts +4 -7
  851. package/src/testing/file-upload-session-storage-contract.ts +335 -0
  852. package/src/testing/index.ts +8 -0
  853. package/src/testing/materializer-storage-contract.ts +86 -4
  854. package/src/testing/object-query-contract.ts +162 -27
  855. package/src/testing/object-read-scope-contract.ts +1 -5
  856. package/src/testing/ontology-contract-fixture.ts +23 -3
  857. package/src/testing/ontology-storage-contract.ts +58 -0
  858. package/src/testing/queues-contract.ts +31 -0
  859. package/src/testing/sandboxes-contract.ts +27 -0
  860. package/src/testing/workflow-intervention-storage-contract.ts +203 -0
  861. package/src/webhooks/types.ts +2 -2
  862. package/src/workflows/failure.ts +10 -4
  863. package/src/workflows/run-dispatch.ts +12 -1
  864. package/src/workflows/snapshot.ts +16 -7
  865. package/src/workflows/types.ts +2 -2
  866. package/src/workflows/validation.ts +2 -2
  867. package/dist/chunk-01kj2pbh.js.map +0 -19
  868. package/dist/chunk-5hz0fnca.js.map +0 -12
  869. package/dist/chunk-653vwrzr.js.map +0 -10
  870. package/dist/chunk-7apz6hg4.js.map +0 -10
  871. package/dist/chunk-7bs40fe1.js.map +0 -12
  872. package/dist/chunk-860dwwy0.js.map +0 -14
  873. package/dist/chunk-93csa55g.js.map +0 -11
  874. package/dist/chunk-a0e6x5hd.js.map +0 -14
  875. package/dist/chunk-aa6z4a19.js.map +0 -12
  876. package/dist/chunk-ap0g1g74.js.map +0 -11
  877. package/dist/chunk-awbhdqyc.js.map +0 -10
  878. package/dist/chunk-b19g04jk.js.map +0 -11
  879. package/dist/chunk-dz5h08xv.js.map +0 -25
  880. package/dist/chunk-f0rwz2vh.js.map +0 -11
  881. package/dist/chunk-f4w3yp4f.js.map +0 -12
  882. package/dist/chunk-ftv470j8.js.map +0 -45
  883. package/dist/chunk-g00bfdq6.js.map +0 -43
  884. package/dist/chunk-gq8vhakp.js.map +0 -44
  885. package/dist/chunk-gqh45d2n.js.map +0 -15
  886. package/dist/chunk-gqm76kse.js.map +0 -58
  887. package/dist/chunk-jsy70480.js.map +0 -15
  888. package/dist/chunk-mrp7k0pw.js.map +0 -10
  889. package/dist/chunk-ms2tmn1k.js.map +0 -17
  890. package/dist/chunk-rb1xx120.js.map +0 -11
  891. package/dist/chunk-sepyxgpc.js.map +0 -15
  892. package/dist/chunk-yv79ncbv.js.map +0 -10
  893. package/dist/chunk-z0271qkp.js.map +0 -15
  894. package/dist/chunk-z3y411fq.js +0 -99
  895. package/dist/chunk-z3y411fq.js.map +0 -11
  896. /package/dist/{chunk-1yefycb1.js.map → chunk-2hbhn1ff.js.map} +0 -0
  897. /package/dist/{chunk-wjasrj67.js.map → chunk-3qpcrcj8.js.map} +0 -0
  898. /package/dist/{chunk-0y39rgsb.js.map → chunk-4tnrzqqh.js.map} +0 -0
  899. /package/dist/{chunk-c5rkjrgp.js.map → chunk-7ytf06d3.js.map} +0 -0
  900. /package/dist/{chunk-cfvakeax.js.map → chunk-a69fkrtr.js.map} +0 -0
  901. /package/dist/{chunk-v2vcg0w6.js.map → chunk-cbn96bve.js.map} +0 -0
  902. /package/dist/{chunk-g6cke204.js.map → chunk-f85hpqnm.js.map} +0 -0
  903. /package/dist/{chunk-vsj3mdfj.js.map → chunk-fc5zfxy1.js.map} +0 -0
  904. /package/dist/{chunk-x9m9x2eq.js.map → chunk-jhyc777j.js.map} +0 -0
  905. /package/dist/{chunk-17kfctj6.js.map → chunk-m8zkvep1.js.map} +0 -0
  906. /package/dist/{chunk-9qsh3p5y.js.map → chunk-rb143ggb.js.map} +0 -0
  907. /package/dist/{chunk-92vk7gta.js.map → chunk-vn3yh259.js.map} +0 -0
  908. /package/dist/{chunk-g91qxjj0.js.map → chunk-w9bp61e7.js.map} +0 -0
  909. /package/dist/{chunk-1824gssz.js.map → chunk-y487ywrv.js.map} +0 -0
  910. /package/dist/{chunk-358caqf5.js.map → chunk-znw0zvy4.js.map} +0 -0
@@ -3,30 +3,32 @@ import {
3
3
  createSixbError2,
4
4
  toSixbFailure2,
5
5
  parseSixbFailure2
6
- } from "./chunk-f4w3yp4f.js";
6
+ } from "./chunk-rzkr70gr.js";
7
7
  import {
8
8
  parseActionRunFailure2
9
- } from "./chunk-b19g04jk.js";
9
+ } from "./chunk-xgptywp0.js";
10
10
  import {
11
11
  ActionRunError2,
12
12
  assertActionRunExecution2
13
- } from "./chunk-vsj3mdfj.js";
13
+ } from "./chunk-fc5zfxy1.js";
14
+ import {
15
+ paginate,
16
+ InMemoryAuthStorage2,
17
+ principalsEqual2
18
+ } from "./chunk-9pfw47qx.js";
14
19
  import {
15
20
  ObjectReadLimitExceededError2,
16
21
  snapshotObjectReadExecutionLimits2,
17
22
  assertObjectReadFacetCount2,
18
23
  assertObjectReadOutputWithinLimit2
19
- } from "./chunk-dz5h08xv.js";
24
+ } from "./chunk-rzcjp5m2.js";
20
25
  import {
21
26
  assertObjectReaderProject2
22
27
  } from "./chunk-v4jbb3rs.js";
23
- import {
24
- paginate,
25
- InMemoryAuthStorage2,
26
- principalsEqual2
27
- } from "./chunk-g00bfdq6.js";
28
28
  import {
29
29
  AgentStorageError2,
30
+ transitionAgentThreadSandbox2,
31
+ snapshotAgentThreadSandboxParams2,
30
32
  assertConversationAgentRunSpec2,
31
33
  assertAgentRunExecution2,
32
34
  assertCreateSubagentRunInput2,
@@ -37,7 +39,7 @@ import {
37
39
  assertAgentContextCheckpointAnchors2,
38
40
  assertAgentContextCheckpointReplayState2,
39
41
  agentContextCheckpointMatchesCreateInput2
40
- } from "./chunk-7bs40fe1.js";
42
+ } from "./chunk-69266efg.js";
41
43
  import {
42
44
  InMemoryAiUsageStorage2,
43
45
  buildAiAccountingOverview,
@@ -46,7 +48,7 @@ import {
46
48
  buildAiModelCallGroups,
47
49
  normalizeAiModelCallCostRecord2,
48
50
  aiModelCallCostMatchesUsage2
49
- } from "./chunk-g53f0e4j.js";
51
+ } from "./chunk-xnx96gfy.js";
50
52
  import {
51
53
  AiLimitStorageError2,
52
54
  aiLimitCalendarMonth2,
@@ -73,38 +75,19 @@ import {
73
75
  cloneValidDate2
74
76
  } from "./chunk-jgwb25gc.js";
75
77
  import {
76
- actionSubjectsEqual2,
77
- actionRunPhaseRecordsEqual2,
78
- canRequeueActionRunAfterEnqueueFailure2,
79
- isTerminalActionRun2,
80
- StorageTransactionError2,
81
- createFileUploadId2,
82
- principalKey,
83
- isFileUploadSessionExpired,
84
- shouldDeleteFileUploadSession,
85
- isTerminalFileUploadSessionExpired,
86
- canRequeuePipelineRunAfterEnqueueFailure2,
87
- canRequeueSyncRunAfterEnqueueFailure2,
88
- createTransactionStorageProxy2,
89
- throwNestedStorageTransaction2
90
- } from "./chunk-8vj0rjgs.js";
78
+ isAbandonedFileUploadSession,
79
+ shouldDeleteFileUploadSession
80
+ } from "./chunk-h89wz928.js";
81
+ import {
82
+ DurableFileUploadSessions2
83
+ } from "./chunk-n33e8dz8.js";
91
84
  import {
92
85
  ExecutionStorageError2,
93
86
  prepareExecutionRecord2,
94
87
  cloneExecutionRecord
95
- } from "./chunk-93csa55g.js";
96
- import {
97
- objectRefKey2,
98
- linkRefKey2,
99
- projectionEntityKey2,
100
- telemetryPointKey2,
101
- objectRefSortKey2,
102
- linkRefSortKey2,
103
- linkScopeKey,
104
- linkScopeSortKey2,
105
- telemetryPointSortKey2
106
- } from "./chunk-c5rkjrgp.js";
88
+ } from "./chunk-tw03bsmb.js";
107
89
  import {
90
+ sha256Canonical2,
108
91
  createEventId2,
109
92
  assertTimestamp2,
110
93
  invalidCorrelation2,
@@ -123,6 +106,9 @@ import {
123
106
  finishScopeAccumulator2,
124
107
  ProviderMaterializationTransactionLifecycle2,
125
108
  uniqueSorted2,
109
+ assertExpectedObjectRevision2,
110
+ assertExpectedLinkRevision2,
111
+ assertExpectedLinkScopeRevision2,
126
112
  sourceStageRoots2,
127
113
  sourceMaterializationIdentity2,
128
114
  assertSourceBeginInput2,
@@ -133,7 +119,18 @@ import {
133
119
  assertSourceStagedRow2,
134
120
  isExactStagingManifest2,
135
121
  sourceConflict2
136
- } from "./chunk-gqh45d2n.js";
122
+ } from "./chunk-ht4a7mjg.js";
123
+ import {
124
+ objectRefKey2,
125
+ linkRefKey2,
126
+ projectionEntityKey2,
127
+ telemetryPointKey2,
128
+ objectRefSortKey2,
129
+ linkRefSortKey2,
130
+ linkScopeKey,
131
+ linkScopeSortKey2,
132
+ telemetryPointSortKey2
133
+ } from "./chunk-7ytf06d3.js";
137
134
  import {
138
135
  createStorageOperationScope2,
139
136
  createOperationScopedFacade2,
@@ -142,7 +139,7 @@ import {
142
139
  createOntologyOperationScope2,
143
140
  createObjectOperationScope2,
144
141
  createWorkflowRunOperationScope2
145
- } from "./chunk-z30bv4ga.js";
142
+ } from "./chunk-mr60an99.js";
146
143
  import {
147
144
  PipelineRunError2,
148
145
  assertPipelineRunExecution2
@@ -175,7 +172,7 @@ import {
175
172
  assertProjectionMissingTarget2,
176
173
  requireTelemetryProjectionRun2,
177
174
  assertProjectionRunDurableExecution2
178
- } from "./chunk-358caqf5.js";
175
+ } from "./chunk-znw0zvy4.js";
179
176
  import {
180
177
  SyncRunError2,
181
178
  assertSyncRunExecution2
@@ -188,7 +185,18 @@ import {
188
185
  WorkflowRunError2,
189
186
  assertWorkflowRunExecution2,
190
187
  assertWorkflowAgentNodeRunExecution2
191
- } from "./chunk-pr2h4bv4.js";
188
+ } from "./chunk-darm7eeg.js";
189
+ import {
190
+ actionSubjectsEqual2,
191
+ actionRunPhaseRecordsEqual2,
192
+ canRequeueActionRunAfterEnqueueFailure2,
193
+ isTerminalActionRun2,
194
+ StorageTransactionError2,
195
+ canRequeuePipelineRunAfterEnqueueFailure2,
196
+ canRequeueSyncRunAfterEnqueueFailure2,
197
+ createTransactionStorageProxy2,
198
+ throwNestedStorageTransaction2
199
+ } from "./chunk-zdkcdshk.js";
192
200
  import {
193
201
  ShareGrantStorageError2,
194
202
  normalizeShareGrantCreate2,
@@ -213,11 +221,11 @@ import {
213
221
  } from "./chunk-2c4j899j.js";
214
222
  import {
215
223
  assertPinnedDatasetWatermark2
216
- } from "./chunk-wjasrj67.js";
224
+ } from "./chunk-3qpcrcj8.js";
217
225
  import {
218
226
  MaterializationValidationError2,
219
227
  MaterializationConflictError2
220
- } from "./chunk-yv79ncbv.js";
228
+ } from "./chunk-96yw3pwd.js";
221
229
  import {
222
230
  AGENT_RUN_FAILURE_CODES2
223
231
  } from "./chunk-98cw09sw.js";
@@ -517,7 +525,7 @@ function normalizeFailure(failure) {
517
525
  return failure ? parseSixbFailure2(failure, AGENT_RUN_FAILURE_CODES2) : undefined;
518
526
  }
519
527
  function key(projectId, id) {
520
- return `${projectId}:${id}`;
528
+ return JSON.stringify([projectId, id]);
521
529
  }
522
530
  function clone(value) {
523
531
  return structuredClone(value);
@@ -544,7 +552,18 @@ class InMemoryAgentThreadStore {
544
552
  constructor(state) {
545
553
  this.state = state;
546
554
  }
555
+ async transitionSandbox(input) {
556
+ const threadKey = key(input.projectId, input.id);
557
+ const thread = this.state.threads.get(threadKey) ?? null;
558
+ const run = input.action === "recreate" ? null : this.state.runs.get(key(input.projectId, input.runId)) ?? null;
559
+ const sandboxState = transitionAgentThreadSandbox2(thread, run, input);
560
+ if (!thread)
561
+ throw new AgentStorageError2("thread_not_found", "[Sixb] Thread not found.");
562
+ this.state.threads.set(threadKey, { ...thread, sandboxState: clone(sandboxState) });
563
+ return clone(sandboxState);
564
+ }
547
565
  async create(input) {
566
+ const sandboxParams = input.sandboxParams === undefined ? undefined : snapshotAgentThreadSandboxParams2(input.sandboxParams);
548
567
  const threadKey = key(input.projectId, input.id);
549
568
  if (this.state.threads.has(threadKey)) {
550
569
  throw new AgentStorageError2("duplicate_id", `[Sixb] Agent thread '${input.id}' already exists for project '${input.projectId}'.`);
@@ -554,6 +573,7 @@ class InMemoryAgentThreadStore {
554
573
  id: input.id,
555
574
  projectId: input.projectId,
556
575
  ownerPrincipal: clone(input.ownerPrincipal),
576
+ ...sandboxParams === undefined ? {} : { sandboxParams },
557
577
  ...input.title === undefined ? {} : { title: input.title },
558
578
  status: input.status ?? "active",
559
579
  activeRunId: null,
@@ -2410,18 +2430,18 @@ function applyStagedCredentials(record, staged, now, input) {
2410
2430
  updatedAt: now
2411
2431
  };
2412
2432
  }
2413
- // src/storage/file-upload-sessions/errors.ts
2414
- class FileUploadSessionError2 extends Error {
2415
- reason;
2416
- name = "FileUploadSessionError";
2417
- constructor(reason, message) {
2418
- super(message);
2419
- this.reason = reason;
2420
- }
2421
- }
2422
2433
  // src/storage/file-upload-sessions/in-memory.ts
2423
- class InMemoryFileUploadSessions2 {
2424
- sessionsById = new Map;
2434
+ class InMemoryFileUploadSessions2 extends DurableFileUploadSessions2 {
2435
+ sessionsById;
2436
+ constructor() {
2437
+ const sessionsById = new Map;
2438
+ super(new InMemoryFileUploadSessionBackend(sessionsById));
2439
+ this.sessionsById = sessionsById;
2440
+ }
2441
+ async create(input) {
2442
+ await this.cleanupExpired();
2443
+ return super.create(input);
2444
+ }
2425
2445
  snapshot() {
2426
2446
  return structuredClone(this.sessionsById);
2427
2447
  }
@@ -2431,86 +2451,50 @@ class InMemoryFileUploadSessions2 {
2431
2451
  this.sessionsById.set(id, structuredClone(session));
2432
2452
  }
2433
2453
  }
2434
- async create(input) {
2435
- await this.cleanupExpired();
2436
- const session = {
2437
- id: input.id ?? createFileUploadId2(),
2438
- projectId: input.projectId,
2439
- principalKey: principalKey(input.principal),
2440
- strategy: input.strategy,
2441
- status: "pending",
2442
- ...input.fileName === undefined ? {} : { fileName: input.fileName },
2443
- ...input.mediaType === undefined ? {} : { mediaType: input.mediaType },
2444
- ...input.logicalPath === undefined ? {} : { logicalPath: input.logicalPath },
2445
- ...input.expectedSizeBytes === undefined ? {} : { expectedSizeBytes: input.expectedSizeBytes },
2446
- ...input.expectedDigest === undefined ? {} : { expectedDigest: input.expectedDigest },
2447
- ...input.providerUpload === undefined ? {} : { providerUpload: input.providerUpload },
2448
- signedParts: [],
2449
- createdAt: new Date,
2450
- expiresAt: input.expiresAt
2451
- };
2452
- this.sessionsById.set(session.id, session);
2453
- return session;
2454
+ }
2455
+
2456
+ class InMemoryFileUploadSessionBackend {
2457
+ persistence;
2458
+ tail = Promise.resolve();
2459
+ constructor(sessionsById) {
2460
+ this.persistence = new InMemoryFileUploadSessionPersistence(sessionsById);
2461
+ }
2462
+ read(run) {
2463
+ return run(this.persistence);
2464
+ }
2465
+ transaction(run) {
2466
+ const result = this.tail.then(() => run(this.persistence));
2467
+ this.tail = result.catch(() => {
2468
+ return;
2469
+ });
2470
+ return result;
2454
2471
  }
2455
- async getForPrincipal(uploadId, principal) {
2456
- const session = this.sessionsById.get(uploadId);
2457
- if (!session || session.principalKey !== principalKey(principal)) {
2458
- throw new FileUploadSessionError2("not_found", "File upload session not found.");
2459
- }
2460
- const nowMs = Date.now();
2461
- if (isFileUploadSessionExpired(session, nowMs)) {
2462
- this.sessionsById.delete(uploadId);
2463
- throw new FileUploadSessionError2("expired", "File upload session has expired.");
2464
- }
2465
- if (isTerminalFileUploadSessionExpired(session, nowMs)) {
2466
- this.sessionsById.delete(uploadId);
2467
- throw new FileUploadSessionError2("not_found", "File upload session not found.");
2468
- }
2469
- return session;
2472
+ }
2473
+
2474
+ class InMemoryFileUploadSessionPersistence {
2475
+ sessionsById;
2476
+ constructor(sessionsById) {
2477
+ this.sessionsById = sessionsById;
2470
2478
  }
2471
- async markUploaded(uploadId, fileRef) {
2472
- const session = this.requirePending(uploadId);
2473
- const updated = {
2474
- ...session,
2475
- fileRef
2476
- };
2477
- this.sessionsById.set(uploadId, updated);
2478
- return updated;
2479
+ async now() {
2480
+ return new Date;
2479
2481
  }
2480
- async addSignedPart(uploadId, part) {
2481
- const session = this.requirePending(uploadId);
2482
- const updated = {
2483
- ...session,
2484
- signedParts: [
2485
- ...session.signedParts.filter((candidate) => candidate.partNumber !== part.partNumber),
2486
- part
2487
- ].sort((left, right) => left.partNumber - right.partNumber)
2488
- };
2489
- this.sessionsById.set(uploadId, updated);
2490
- return updated;
2482
+ async insert(session) {
2483
+ if (this.sessionsById.has(session.id))
2484
+ return false;
2485
+ this.sessionsById.set(session.id, session);
2486
+ return true;
2491
2487
  }
2492
- async complete(uploadId, fileRef) {
2493
- const session = this.requirePending(uploadId);
2494
- const updated = {
2495
- ...session,
2496
- status: "completed",
2497
- fileRef,
2498
- completedAt: new Date
2499
- };
2500
- this.sessionsById.set(uploadId, updated);
2501
- return updated;
2488
+ async get(uploadId) {
2489
+ return this.sessionsById.get(uploadId) ?? null;
2502
2490
  }
2503
- async abort(uploadId) {
2504
- const session = this.requirePending(uploadId);
2505
- const updated = {
2506
- ...session,
2507
- status: "aborted",
2508
- abortedAt: new Date
2509
- };
2510
- this.sessionsById.set(uploadId, updated);
2511
- return updated;
2491
+ async update(session) {
2492
+ this.sessionsById.set(session.id, session);
2512
2493
  }
2513
- async cleanupExpired(now = new Date) {
2494
+ async listAbandoned(input) {
2495
+ return [...this.sessionsById.values()].filter((session) => session.projectId === input.projectId && isAbandonedFileUploadSession(session, input.now.getTime())).sort((left, right) => left.expiresAt.getTime() - right.expiresAt.getTime()).slice(0, input.limit);
2496
+ }
2497
+ async deleteReapable(now) {
2514
2498
  let deleted = 0;
2515
2499
  for (const [id, session] of this.sessionsById) {
2516
2500
  if (shouldDeleteFileUploadSession(session, now.getTime())) {
@@ -2520,16 +2504,6 @@ class InMemoryFileUploadSessions2 {
2520
2504
  }
2521
2505
  return deleted;
2522
2506
  }
2523
- requirePending(uploadId) {
2524
- const session = this.sessionsById.get(uploadId);
2525
- if (!session) {
2526
- throw new FileUploadSessionError2("not_found", "File upload session not found.");
2527
- }
2528
- if (session.status !== "pending") {
2529
- throw new FileUploadSessionError2(session.status === "completed" ? "already_completed" : "already_aborted", `File upload session is already ${session.status}.`);
2530
- }
2531
- return session;
2532
- }
2533
2507
  }
2534
2508
  // src/storage/in-memory/index.ts
2535
2509
  import { AsyncLocalStorage } from "async_hooks";
@@ -2585,6 +2559,25 @@ class InMemoryExecutionStorage {
2585
2559
  }
2586
2560
  }
2587
2561
 
2562
+ // src/objects/vectors/query.ts
2563
+ function hasVectorProfile2(query) {
2564
+ if (query.kind === "vector")
2565
+ return true;
2566
+ if (query.kind === "set")
2567
+ return query.inputs.some(hasVectorProfile2);
2568
+ return "input" in query && hasVectorProfile2(query.input);
2569
+ }
2570
+ function isVectorProfileQuery2(query) {
2571
+ if (query.kind === "limit" || query.kind === "project")
2572
+ return isVectorProfileQuery2(query.input);
2573
+ if (query.kind !== "vector" || !query.profile)
2574
+ return false;
2575
+ let input = query.input;
2576
+ while (input.kind === "filter")
2577
+ input = input.input;
2578
+ return input.kind === "start" && !input.includeSubtypes;
2579
+ }
2580
+
2588
2581
  // src/storage/objects/keys.ts
2589
2582
  function objectBatchKey2(objectTypeId, primaryId) {
2590
2583
  return JSON.stringify([objectTypeId, primaryId]);
@@ -2665,6 +2658,8 @@ function compareQueryScalarValues(left, right, scalarKind) {
2665
2658
  case "date":
2666
2659
  case "timestamp":
2667
2660
  return compareTemporalValues(left, right);
2661
+ case "userRef":
2662
+ return Number.NaN;
2668
2663
  }
2669
2664
  }
2670
2665
  function queryScalarValuesEqual(left, right, scalarKind) {
@@ -2676,10 +2671,20 @@ function queryScalarValuesEqual(left, right, scalarKind) {
2676
2671
  const comparison = compareTemporalValues(left, right);
2677
2672
  return !Number.isNaN(comparison) && comparison === 0;
2678
2673
  }
2674
+ if (scalarKind === "userRef")
2675
+ return userRefsEqual(left, right);
2679
2676
  if (scalarKind !== undefined)
2680
2677
  return Object.is(left, right);
2681
2678
  return runtimeValuesEqual(left, right);
2682
2679
  }
2680
+ function userRefsEqual(left, right) {
2681
+ if (left === null || right === null)
2682
+ return left === right;
2683
+ return isRecord(left) && isRecord(right) && left.type === right.type && typeof left.id === "string" && left.id === right.id;
2684
+ }
2685
+ function isRecord(value) {
2686
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2687
+ }
2683
2688
  function compareRuntimeValues(left, right) {
2684
2689
  if (typeof left === "number" && typeof right === "number")
2685
2690
  return left - right;
@@ -2725,6 +2730,54 @@ function compareStrings2(left, right) {
2725
2730
  return 0;
2726
2731
  }
2727
2732
 
2733
+ // src/objects/vectors/profile.ts
2734
+ var MAX_VECTOR_K = 1000;
2735
+ var VECTOR_INPUT_VERSION = 1;
2736
+ function vectorConfiguration(profile) {
2737
+ return sha256Canonical2({
2738
+ format: VECTOR_INPUT_VERSION,
2739
+ sources: [...profile.source],
2740
+ provider: profile.model.providerId,
2741
+ model: profile.model.modelId,
2742
+ representation: profile.model.definition.representation ?? { name: profile.model.modelId },
2743
+ dimensions: profile.model.definition.dimensions,
2744
+ metric: "cosine",
2745
+ precision: "float32",
2746
+ normalization: "l2-v1"
2747
+ });
2748
+ }
2749
+ function vectorSources(source, properties) {
2750
+ const values = Object.create(null);
2751
+ for (const key of source) {
2752
+ const value = properties[key];
2753
+ if (value !== undefined && value !== null && typeof value !== "string") {
2754
+ throw new MaterializationValidationError2(`Vector source must be text: ${key}`);
2755
+ }
2756
+ values[key] = typeof value === "string" ? value : null;
2757
+ }
2758
+ const text = JSON.stringify(source.map((key) => [key, values[key]]));
2759
+ return { text, sourceFingerprint: sha256Canonical2(text) };
2760
+ }
2761
+ function normalizeVector2(values, dimensions) {
2762
+ if (!Array.isArray(values) || values.length !== dimensions) {
2763
+ throw new MaterializationValidationError2(`Vector dimension mismatch; expected ${dimensions}`);
2764
+ }
2765
+ const normalized = Array.from(values, (value) => {
2766
+ if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(Math.fround(value))) {
2767
+ throw new MaterializationValidationError2("Vector values must be finite float32 numbers.");
2768
+ }
2769
+ return Math.fround(value);
2770
+ });
2771
+ if (!normalized.some((value) => value !== 0)) {
2772
+ throw new MaterializationValidationError2("Cosine search requires a nonzero vector.");
2773
+ }
2774
+ const norm = Math.hypot(...normalized);
2775
+ return Object.freeze(normalized.map((value) => Math.fround(value / norm)));
2776
+ }
2777
+ function vectorSearchCandidateLimit2(dimensions) {
2778
+ return Math.min(1e4, Math.floor(16000000 / dimensions));
2779
+ }
2780
+
2728
2781
  // src/storage/objects/in-memory/query.ts
2729
2782
  var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
2730
2783
  queryObjects: true,
@@ -2779,7 +2832,8 @@ var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
2779
2832
  double: { equality: true, ordering: true },
2780
2833
  decimal: { equality: true, ordering: true },
2781
2834
  date: { equality: true, ordering: true },
2782
- timestamp: { equality: true, ordering: true }
2835
+ timestamp: { equality: true, ordering: true },
2836
+ userRef: { equality: true }
2783
2837
  },
2784
2838
  limits: {
2785
2839
  totalCount: true,
@@ -2812,17 +2866,23 @@ function evaluateObjectQuery(query, source) {
2812
2866
  return completeEvaluation(scoredEntries);
2813
2867
  }
2814
2868
  case "vector": {
2869
+ if (typeof query.vector === "string")
2870
+ throw new Error("[Sixb] Vector search text must be embedded before storage execution.");
2871
+ const vector = query.vector;
2815
2872
  const input = evaluateObjectQuery(query.input, source);
2816
2873
  const scoredEntries = input.entries.flatMap((entry) => {
2817
- const score = vectorSimilarity(entry.row.properties[query.propertyId], query.vector);
2818
- return score === null ? [] : [{ ...entry, score: entry.score + score }];
2874
+ const stored = source.getVector?.(entry.row, query.profile);
2875
+ if (!stored || !query.configuration || stored.configuration !== query.configuration || vectorSources(stored.source, entry.row.properties).sourceFingerprint !== stored.sourceFingerprint)
2876
+ return [];
2877
+ const score = vectorSimilarity(stored.values, vector);
2878
+ return score === null ? [] : [{ ...entry, score: entry.score + Math.max(-1, Math.min(1, score)) }];
2819
2879
  });
2820
- scoredEntries.sort(compareEntriesByRelevance);
2880
+ scoredEntries.sort((a, b) => b.score - a.score || Buffer.compare(Buffer.from(a.row.objectTypeId), Buffer.from(b.row.objectTypeId)) || Buffer.compare(Buffer.from(a.row.primaryId), Buffer.from(b.row.primaryId)));
2821
2881
  const limit = Math.max(0, query.k);
2822
2882
  return {
2823
2883
  entries: scoredEntries.slice(0, limit),
2824
- total: scoredEntries.length,
2825
- hasMore: limit < scoredEntries.length
2884
+ total: Math.min(limit, scoredEntries.length),
2885
+ hasMore: false
2826
2886
  };
2827
2887
  }
2828
2888
  case "traverse": {
@@ -3000,15 +3060,15 @@ function matchesPredicate(row, predicate) {
3000
3060
  return predicate.value ? exists : !exists;
3001
3061
  }
3002
3062
  case "contains":
3003
- return containsValue(row.properties[predicate.propertyId], predicate.value);
3063
+ return containsValue(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind);
3004
3064
  }
3005
3065
  }
3006
- function containsValue(actual, expected) {
3066
+ function containsValue(actual, expected, itemScalarKind) {
3007
3067
  if (typeof actual === "string" && typeof expected === "string") {
3008
3068
  return actual.includes(expected);
3009
3069
  }
3010
3070
  if (Array.isArray(actual)) {
3011
- return actual.some((item) => queryScalarValuesEqual(item, expected));
3071
+ return actual.some((item) => queryScalarValuesEqual(item, expected, itemScalarKind));
3012
3072
  }
3013
3073
  if (isPlainObject(actual) && typeof expected === "string") {
3014
3074
  return Object.hasOwn(actual, expected);
@@ -3101,9 +3161,6 @@ function compareSortField(left, right, field) {
3101
3161
  return 0;
3102
3162
  return field.direction === "desc" ? -comparison : comparison;
3103
3163
  }
3104
- function compareEntriesByRelevance(left, right) {
3105
- return right.score - left.score || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
3106
- }
3107
3164
  function projectRow(row, properties) {
3108
3165
  const projected = {};
3109
3166
  for (const propertyId of properties) {
@@ -3346,9 +3403,10 @@ function resolveSelectedReadUniverse(source, plan, limits) {
3346
3403
  }
3347
3404
  links.set(key, redactLinkRow(selected.row, selected.propertyIds));
3348
3405
  }
3349
- return createReadUniverse(source.projectId, objects, links, objectProperties);
3406
+ return createReadUniverse(source, objects, links, objectProperties);
3350
3407
  }
3351
- function createReadUniverse(projectId, objects, links, objectProperties) {
3408
+ function createReadUniverse(source, objects, links, objectProperties) {
3409
+ const projectId = source.projectId;
3352
3410
  const linksBySource = new Map;
3353
3411
  for (const link of links.values()) {
3354
3412
  const key = sourceLinkBucketKey(link.projectId, link.sourceTypeId, link.sourceId);
@@ -3362,6 +3420,13 @@ function createReadUniverse(projectId, objects, links, objectProperties) {
3362
3420
  links,
3363
3421
  linksBySource,
3364
3422
  objectProperties,
3423
+ getVector: (ref, profile) => {
3424
+ const key = rowIdentityKeyParts(ref.objectTypeId, ref.primaryId);
3425
+ if (!objects.has(key))
3426
+ return;
3427
+ const value = source.getVector?.(ref, profile);
3428
+ return value?.source.every((id) => objectProperties.get(key)?.has(id)) ? value : undefined;
3429
+ },
3365
3430
  objectsOfType: (objectTypeId) => [...objects.values()].filter((row) => row.objectTypeId === objectTypeId),
3366
3431
  getObject: (objectTypeId, primaryId) => objects.get(rowIdentityKeyParts(objectTypeId, primaryId)),
3367
3432
  outgoingLinks: (objectTypeId, primaryId) => linksBySource.get(sourceLinkBucketKey(projectId, objectTypeId, primaryId)) ?? [],
@@ -3425,7 +3490,10 @@ function createInMemorySelectedReader(source, params, queryCapabilities) {
3425
3490
  const universe = resolveSelectedReadUniverse(source, plan, limits);
3426
3491
  const result = evaluateObjectQuery(input.query, universe);
3427
3492
  return visible({
3428
- objects: result.entries.map((entry) => structuredClone(entry.row)),
3493
+ objects: result.entries.map((entry) => ({
3494
+ ...structuredClone(entry.row),
3495
+ ...hasVectorProfile2(input.query) ? { score: entry.score } : {}
3496
+ })),
3429
3497
  hasMore: result.hasMore,
3430
3498
  nextPageToken: result.nextPageToken,
3431
3499
  ...input.includeTotal === false ? {} : { total: result.total }
@@ -3553,8 +3621,12 @@ function getInMemoryObjectMaterializerAdapter(storage) {
3553
3621
  class InMemoryObjectStorage {
3554
3622
  rows = new Map;
3555
3623
  links = new Map;
3624
+ vectorReader;
3556
3625
  constructor() {
3557
3626
  materializerAdapters.set(this, {
3627
+ setVectorReader: (reader) => {
3628
+ this.vectorReader = reader;
3629
+ },
3558
3630
  getExactObjectRow: (projectId, objectTypeId, primaryId) => this.getExactObjectRow(projectId, objectTypeId, primaryId),
3559
3631
  getExactLinkRow: (projectId, ref) => this.getExactLinkRow(projectId, ref),
3560
3632
  applyExactObject: (row, projectId) => this.applyExactObject(row, projectId),
@@ -3651,6 +3723,7 @@ class InMemoryObjectStorage {
3651
3723
  readSource(projectId) {
3652
3724
  return {
3653
3725
  projectId,
3726
+ getVector: (ref, profile) => this.vectorReader?.(projectId, ref, profile),
3654
3727
  objectsOfType: (objectTypeId) => [
3655
3728
  ...this.rows.get(objectRowKey(projectId, objectTypeId))?.values() ?? []
3656
3729
  ],
@@ -3662,7 +3735,10 @@ class InMemoryObjectStorage {
3662
3735
  async queryObjects(params) {
3663
3736
  const result = evaluateObjectQuery(params.query, this.readSource(params.projectId));
3664
3737
  return {
3665
- objects: result.entries.map((entry) => entry.row),
3738
+ objects: result.entries.map((entry) => ({
3739
+ ...entry.row,
3740
+ ...hasVectorProfile2(params.query) ? { score: entry.score } : {}
3741
+ })),
3666
3742
  hasMore: result.hasMore,
3667
3743
  nextPageToken: result.nextPageToken,
3668
3744
  ...params.includeTotal === false ? {} : { total: result.total }
@@ -3854,6 +3930,8 @@ function* allLinkRows(buckets) {
3854
3930
  // src/storage/ontology/in-memory/shared-state.ts
3855
3931
  function createInMemoryOntologyState() {
3856
3932
  return {
3933
+ vectors: new Map,
3934
+ vectorIndexing: new Map,
3857
3935
  commitsById: new Map,
3858
3936
  commitIdByIdempotency: new Map,
3859
3937
  commitIdByOrigin: new Map,
@@ -4696,9 +4774,7 @@ class InMemoryOntologyMaterializationStorage {
4696
4774
  const key = linkScopeSortKey2(expected.source, expected.linkId);
4697
4775
  const current = expectedScopeRevisions.get(key) ?? this.computeEffectiveLinkScope(input.commit.projectId, expected.source, expected.linkId);
4698
4776
  expectedScopeRevisions.set(key, current);
4699
- if (current.fingerprint !== expected.fingerprint) {
4700
- throw new MaterializationConflictError2("effective-state", `Expected link scope changed for ${expected.source.objectTypeId}:${expected.source.primaryId}.${expected.linkId}.`);
4701
- }
4777
+ assertExpectedLinkScopeRevision2(current.fingerprint, expected);
4702
4778
  }
4703
4779
  for (const expected of input.expected.points)
4704
4780
  this.assertPoint(expected, input.commit.projectId);
@@ -5140,6 +5216,12 @@ class InMemoryOntologyMaterializationStorage {
5140
5216
  this.releaseSession(session);
5141
5217
  return { commit: structuredClone(record) };
5142
5218
  }
5219
+ assertVectorSession(session, projectId, commitId) {
5220
+ const active = this.requireSession(session);
5221
+ if (active.header.commit.projectId !== projectId || commitId !== undefined && active.header.commit.id !== commitId) {
5222
+ throw new MaterializationValidationError2("Vector mutation does not belong to this materialization session.");
5223
+ }
5224
+ }
5143
5225
  requireSession(session) {
5144
5226
  const value = this.sessions.get(session.providerToken);
5145
5227
  if (!value || !value.active || !this.getTransactionToken() || this.getTransactionToken() !== value.transactionToken) {
@@ -5279,14 +5361,7 @@ class InMemoryOntologyMaterializationStorage {
5279
5361
  }
5280
5362
  assertObjectSync(expected, projectId) {
5281
5363
  const row = getInMemoryObjectMaterializerAdapter(this.objects).getExactObjectRow(projectId, expected.ref.objectTypeId, expected.ref.primaryId);
5282
- if (!expected.exists) {
5283
- if (row)
5284
- throw new MaterializationConflictError2("effective-state", `Expected object ${objectRefKey2(expected.ref)} to be absent.`);
5285
- return;
5286
- }
5287
- if (!row || row.version !== expected.version || row.lastCommitId !== expected.lastCommitId) {
5288
- throw new MaterializationConflictError2("effective-state", `Expected object ${objectRefKey2(expected.ref)} changed.`);
5289
- }
5364
+ assertExpectedObjectRevision2(row ?? null, expected);
5290
5365
  }
5291
5366
  async assertLink(expected, projectId) {
5292
5367
  this.assertLinkSync(expected, projectId);
@@ -5299,14 +5374,7 @@ class InMemoryOntologyMaterializationStorage {
5299
5374
  targetTypeId: expected.ref.target.objectTypeId,
5300
5375
  targetId: expected.ref.target.primaryId
5301
5376
  });
5302
- if (!expected.exists) {
5303
- if (row)
5304
- throw new MaterializationConflictError2("effective-state", `Expected link ${linkRefKey2(expected.ref)} to be absent.`);
5305
- return;
5306
- }
5307
- if (!row || row.lastCommitId !== expected.lastCommitId) {
5308
- throw new MaterializationConflictError2("effective-state", `Expected link ${linkRefKey2(expected.ref)} changed.`);
5309
- }
5377
+ assertExpectedLinkRevision2(row?.lastCommitId, expected);
5310
5378
  }
5311
5379
  assertPoint(expected, projectId) {
5312
5380
  const point = getInMemoryTimeseriesMaterializerAdapter(this.timeseries).getExactPoint(projectId, expected.series, expected.at);
@@ -6000,9 +6068,188 @@ function registerInMemoryOntologyStorageTestingAdapter(storage, adapter) {
6000
6068
  testingAdapters.set(storage, adapter);
6001
6069
  }
6002
6070
 
6071
+ // src/storage/ontology/in-memory/vector-indexing.ts
6072
+ class InMemoryVectorIndexingStorage {
6073
+ state;
6074
+ assertSession;
6075
+ run;
6076
+ constructor(state, assertSession, run) {
6077
+ this.state = state;
6078
+ this.assertSession = assertSession;
6079
+ this.run = run;
6080
+ }
6081
+ async schedule(input) {
6082
+ this.assertSession(input.session, input.projectId);
6083
+ if (input.deleted.length) {
6084
+ const deleted = new Set(input.deleted.map((ref) => JSON.stringify([ref.objectTypeId, ref.primaryId])));
6085
+ for (const [key, work] of this.state) {
6086
+ if (work.projectId === input.projectId && deleted.has(JSON.stringify([work.ref.objectTypeId, work.ref.primaryId])))
6087
+ this.state.delete(key);
6088
+ }
6089
+ }
6090
+ for (const request of input.requests) {
6091
+ const key = JSON.stringify([
6092
+ input.projectId,
6093
+ request.ref.objectTypeId,
6094
+ request.ref.primaryId,
6095
+ request.profile
6096
+ ]);
6097
+ this.state.set(key, structuredClone({
6098
+ ...request,
6099
+ projectId: input.projectId,
6100
+ status: "pending",
6101
+ availableAt: input.availableAt,
6102
+ dispatchAt: input.availableAt
6103
+ }));
6104
+ }
6105
+ }
6106
+ async complete(input) {
6107
+ this.assertSession(input.session, input.projectId);
6108
+ for (const entry of input.entries) {
6109
+ const key = JSON.stringify([
6110
+ input.projectId,
6111
+ entry.ref.objectTypeId,
6112
+ entry.ref.primaryId,
6113
+ entry.profile
6114
+ ]);
6115
+ const work = this.state.get(key);
6116
+ if (work?.configuration === entry.configuration && work.sourceFingerprint === entry.sourceFingerprint) {
6117
+ this.state.delete(key);
6118
+ }
6119
+ }
6120
+ }
6121
+ async dispatched(input) {
6122
+ await this.run(() => {
6123
+ for (const [key, work] of this.state)
6124
+ if (work.projectId === input.projectId && input.ids.includes(work.id))
6125
+ this.state.set(key, { ...work, dispatchAt: input.nextDispatchAt });
6126
+ });
6127
+ }
6128
+ async get(input) {
6129
+ return this.run(() => structuredClone([...this.state.values()].find((work) => work.projectId === input.projectId && work.id === input.id) ?? null));
6130
+ }
6131
+ async getBatch(input) {
6132
+ return this.run(() => structuredClone([...this.state.values()].filter((work) => work.projectId === input.projectId && work.batchId === input.batchId).sort((a, b) => a.id.localeCompare(b.id))));
6133
+ }
6134
+ async getBatchMember(input) {
6135
+ return this.run(() => {
6136
+ const work = this.state.get(JSON.stringify([
6137
+ input.projectId,
6138
+ input.ref.objectTypeId,
6139
+ input.ref.primaryId,
6140
+ input.profile
6141
+ ]));
6142
+ return work?.batchId === input.batchId ? structuredClone(work) : null;
6143
+ });
6144
+ }
6145
+ async updateBatch(input) {
6146
+ return this.run(() => {
6147
+ const updates = new Map(input.updates.map((update) => [update.id, update]));
6148
+ const matches = [...this.state.entries()].filter(([, work]) => work.projectId === input.projectId && updates.get(work.id)?.expectedStatus === work.status);
6149
+ if (input.requireAll && matches.length !== input.updates.length)
6150
+ return false;
6151
+ for (const [key, work] of matches) {
6152
+ const update = updates.get(work.id);
6153
+ this.state.set(key, structuredClone({
6154
+ ...work,
6155
+ status: update.status,
6156
+ availableAt: update.availableAt,
6157
+ values: update.values ?? work.values,
6158
+ error: update.error
6159
+ }));
6160
+ }
6161
+ return true;
6162
+ });
6163
+ }
6164
+ async listDue(input) {
6165
+ return this.run(() => [...this.state.values()].filter((work) => work.projectId === input.projectId && work.status !== "failed" && work.dispatchAt <= input.now).sort((a, b) => a.dispatchAt.localeCompare(b.dispatchAt) || a.id.localeCompare(b.id)).slice(0, input.limit).map(({ values: _values, ...work }) => structuredClone(work)));
6166
+ }
6167
+ async update(input) {
6168
+ return this.run(() => {
6169
+ for (const [key, work] of this.state) {
6170
+ if (work.projectId !== input.projectId || work.id !== input.id || work.status !== input.expectedStatus)
6171
+ continue;
6172
+ this.state.set(key, structuredClone({
6173
+ ...work,
6174
+ status: input.status,
6175
+ availableAt: input.availableAt,
6176
+ values: input.values ?? work.values,
6177
+ error: input.error
6178
+ }));
6179
+ return true;
6180
+ }
6181
+ return false;
6182
+ });
6183
+ }
6184
+ async remove(input) {
6185
+ await this.run(() => {
6186
+ for (const [key, work] of this.state)
6187
+ if (work.projectId === input.projectId && work.id === input.id)
6188
+ this.state.delete(key);
6189
+ });
6190
+ }
6191
+ }
6192
+
6193
+ // src/storage/ontology/in-memory/vectors.ts
6194
+ function vectorObjectKey(projectId, ref) {
6195
+ return JSON.stringify([projectId, ref.objectTypeId, ref.primaryId]);
6196
+ }
6197
+
6198
+ class InMemoryOntologyVectorStorage {
6199
+ state;
6200
+ assertSession;
6201
+ runRootOperation;
6202
+ constructor(state, assertSession, runRootOperation) {
6203
+ this.state = state;
6204
+ this.assertSession = assertSession;
6205
+ this.runRootOperation = runRootOperation;
6206
+ }
6207
+ async list(input) {
6208
+ return this.listBatch({ projectId: input.projectId, refs: [input.ref] });
6209
+ }
6210
+ async listBatch(input) {
6211
+ return this.runRootOperation(() => [...new Set(input.refs.map((ref) => vectorObjectKey(input.projectId, ref)))].flatMap((key) => [...this.state.get(key)?.values() ?? []].map(({ values: _values, ...metadata }) => structuredClone(metadata))));
6212
+ }
6213
+ async removeBatch(input) {
6214
+ this.assertSession(input.session, input.projectId);
6215
+ for (const entry of input.entries) {
6216
+ await this.remove({ session: input.session, projectId: input.projectId, ...entry });
6217
+ }
6218
+ }
6219
+ async write(input) {
6220
+ this.assertSession(input.session, input.projectId, input.value.lastCommitId);
6221
+ const key = vectorObjectKey(input.projectId, input.value.ref);
6222
+ const profiles = this.state.get(key) ?? new Map;
6223
+ this.assertRevision(profiles.get(input.value.profile), input.expectedCommitId);
6224
+ profiles.set(input.value.profile, structuredClone(input.value));
6225
+ this.state.set(key, profiles);
6226
+ }
6227
+ async writeBatch(input) {
6228
+ for (const entry of input.entries) {
6229
+ await this.write({ session: input.session, projectId: input.projectId, ...entry });
6230
+ }
6231
+ }
6232
+ async remove(input) {
6233
+ this.assertSession(input.session, input.projectId);
6234
+ const key = vectorObjectKey(input.projectId, input.ref);
6235
+ const profiles = this.state.get(key);
6236
+ this.assertRevision(profiles?.get(input.profile), input.expectedCommitId);
6237
+ profiles?.delete(input.profile);
6238
+ if (profiles?.size === 0)
6239
+ this.state.delete(key);
6240
+ }
6241
+ assertRevision(current, expected) {
6242
+ if ((current?.lastCommitId ?? null) !== expected) {
6243
+ throw new MaterializationConflictError2("effective-state", "Vector changed since it was prepared.");
6244
+ }
6245
+ }
6246
+ }
6247
+
6003
6248
  // src/storage/ontology/in-memory/index.ts
6004
6249
  class InMemoryOntologyStorage {
6005
6250
  state = createInMemoryOntologyState();
6251
+ vectorIndexing;
6252
+ vectors;
6006
6253
  commits;
6007
6254
  sources;
6008
6255
  materializations;
@@ -6013,6 +6260,9 @@ class InMemoryOntologyStorage {
6013
6260
  snapshot: () => this.snapshot()
6014
6261
  };
6015
6262
  constructor(objects, timeseries, options) {
6263
+ this.vectorIndexing = new InMemoryVectorIndexingStorage(this.state.vectorIndexing, (session, projectId) => this.materializations.assertVectorSession(session, projectId), options.runRootOperation);
6264
+ this.vectors = new InMemoryOntologyVectorStorage(this.state.vectors, (session, projectId, commitId) => this.materializations.assertVectorSession(session, projectId, commitId), options.runRootOperation);
6265
+ getInMemoryObjectMaterializerAdapter(objects).setVectorReader((projectId, ref, profile) => this.state.vectors.get(vectorObjectKey(projectId, ref))?.get(profile));
6016
6266
  this.commits = new InMemoryOntologyCommitStorage(this.state, options.runRootOperation);
6017
6267
  this.sources = new InMemoryOntologySourceStorage(this.state, options.runRootOperation, options.assertSourceMaterializationExecution);
6018
6268
  this.outbox = new InMemoryOntologyOutboxStorage(this.state, options.runRootOperation);
@@ -8320,6 +8570,13 @@ function assertAppliedPrefix(migrations, rows) {
8320
8570
  }
8321
8571
  return [...rows].sort((a, b) => a.version - b.version);
8322
8572
  }
8323
- export { InMemoryActionRunStorage2, AGENT_MESSAGE_CONTENT_VERSION2, InMemoryAgentStorage2, AiCostStorageError2, InMemoryAiCostStorage2, InMemoryAiLimitStorage2, InMemoryConnectorConnectionStorage2, FileUploadSessionError2, InMemoryFileUploadSessions2, objectBatchKey2, linkBatchKey2, objectLinkCursor2, compareQueryScalarValues, queryScalarValuesEqual, PIPELINE_RUN_FAILURE_CODES2, InMemoryPipelineRunStorage2, InMemoryProjectionRunStorage2, InMemoryRulesStorage2, InMemoryShareGrantStorage2, InMemoryShareSessionStorage2, SYNC_RUN_FAILURE_CODES2, InMemorySyncRunStorage2, WEBHOOK_RUN_FAILURE_CODES2, canRetryWebhookRun2, InMemoryWebhookRunStorage2, WorkflowInterventionError2, InMemoryWorkflowInterventionStorage2, WORKFLOW_RUN_FAILURE_CODES2, InMemoryWorkflowRunStorage2, InMemoryWorkflowNodeRunStorage2, InMemoryWorkflowAgentNodeRunStorage2, InMemoryStorage2, isMigrationCapableStorage2, migrateStorage2, checkStorageSchema2, step2, defineMigrations2, runMigrationSet2, describeMigrationHistory2 };
8573
+ // src/storage/ontology/vector-indexing.ts
8574
+ var VECTOR_INDEXING_FAILURE_CODES2 = [
8575
+ "vector.model_unavailable",
8576
+ "vector.response_invalid",
8577
+ "vector.outcome_unknown",
8578
+ "internal.unexpected"
8579
+ ];
8580
+ export { InMemoryActionRunStorage2, AGENT_MESSAGE_CONTENT_VERSION2, InMemoryAgentStorage2, AiCostStorageError2, InMemoryAiCostStorage2, InMemoryAiLimitStorage2, InMemoryConnectorConnectionStorage2, InMemoryFileUploadSessions2, hasVectorProfile2, isVectorProfileQuery2, objectBatchKey2, linkBatchKey2, objectLinkCursor2, compareQueryScalarValues, queryScalarValuesEqual, MAX_VECTOR_K, vectorConfiguration, vectorSources, normalizeVector2, vectorSearchCandidateLimit2, PIPELINE_RUN_FAILURE_CODES2, InMemoryPipelineRunStorage2, InMemoryProjectionRunStorage2, InMemoryRulesStorage2, InMemoryShareGrantStorage2, InMemoryShareSessionStorage2, SYNC_RUN_FAILURE_CODES2, InMemorySyncRunStorage2, WEBHOOK_RUN_FAILURE_CODES2, canRetryWebhookRun2, InMemoryWebhookRunStorage2, WorkflowInterventionError2, InMemoryWorkflowInterventionStorage2, WORKFLOW_RUN_FAILURE_CODES2, InMemoryWorkflowRunStorage2, InMemoryWorkflowNodeRunStorage2, InMemoryWorkflowAgentNodeRunStorage2, InMemoryStorage2, isMigrationCapableStorage2, migrateStorage2, checkStorageSchema2, step2, defineMigrations2, runMigrationSet2, describeMigrationHistory2, VECTOR_INDEXING_FAILURE_CODES2 };
8324
8581
 
8325
- //# debugId=1AE2F63489E4A4EB64756E2164756E21
8582
+ //# debugId=1A5AE33B23C6729064756E2164756E21