@sixb/core 0.1.2 → 0.1.4

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 (383) hide show
  1. package/dist/actions/index.js +19 -17
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/worker.js +4 -4
  4. package/dist/actions/worker.js.map +1 -1
  5. package/dist/agents/adapters.d.ts +11 -1
  6. package/dist/agents/adapters.d.ts.map +1 -1
  7. package/dist/agents/context-compaction.d.ts +40 -0
  8. package/dist/agents/context-compaction.d.ts.map +1 -0
  9. package/dist/agents/context.js +1 -1
  10. package/dist/agents/errors.d.ts +1 -1
  11. package/dist/agents/errors.d.ts.map +1 -1
  12. package/dist/agents/execution.d.ts +3 -0
  13. package/dist/agents/execution.d.ts.map +1 -1
  14. package/dist/agents/ids.d.ts +2 -0
  15. package/dist/agents/ids.d.ts.map +1 -1
  16. package/dist/agents/index.d.ts +10 -6
  17. package/dist/agents/index.d.ts.map +1 -1
  18. package/dist/agents/index.js +51 -35
  19. package/dist/agents/index.js.map +1 -1
  20. package/dist/agents/request.d.ts.map +1 -1
  21. package/dist/agents/streams.d.ts +17 -1
  22. package/dist/agents/streams.d.ts.map +1 -1
  23. package/dist/agents/streams.js +5 -3
  24. package/dist/agents/streams.js.map +1 -1
  25. package/dist/agents/thread-context-projection.d.ts +19 -0
  26. package/dist/agents/thread-context-projection.d.ts.map +1 -0
  27. package/dist/agents/tool-definition.d.ts.map +1 -1
  28. package/dist/agents/tool-result.d.ts +6 -0
  29. package/dist/agents/tool-result.d.ts.map +1 -0
  30. package/dist/agents/types.d.ts +46 -1
  31. package/dist/agents/types.d.ts.map +1 -1
  32. package/dist/agents/validation.d.ts +2 -2
  33. package/dist/agents/validation.d.ts.map +1 -1
  34. package/dist/auth/index.js +11 -5
  35. package/dist/auth/index.js.map +1 -1
  36. package/dist/authorization/index.js +6 -2
  37. package/dist/authorization/index.js.map +1 -1
  38. package/dist/bootstrap/index.js +33 -31
  39. package/dist/bootstrap/index.js.map +1 -1
  40. package/dist/{chunk-ys1nse2v.js → chunk-1wk20wn3.js} +438 -246
  41. package/dist/{chunk-ys1nse2v.js.map → chunk-1wk20wn3.js.map} +11 -11
  42. package/dist/{chunk-sa4340y1.js → chunk-1yz3x65y.js} +7 -7
  43. package/dist/{chunk-gqdd7508.js → chunk-4rh2m6zg.js} +1 -1
  44. package/dist/{chunk-fmx1sz2h.js → chunk-72q2y8hn.js} +3 -3
  45. package/dist/{chunk-fmx1sz2h.js.map → chunk-72q2y8hn.js.map} +4 -4
  46. package/dist/{chunk-nnyp53zt.js → chunk-7gw7mepb.js} +259 -9
  47. package/dist/chunk-7gw7mepb.js.map +14 -0
  48. package/dist/{chunk-nten49ta.js → chunk-819wnjz8.js} +11 -5
  49. package/dist/chunk-819wnjz8.js.map +12 -0
  50. package/dist/chunk-96swp2wd.js +47 -0
  51. package/dist/chunk-96swp2wd.js.map +10 -0
  52. package/dist/{chunk-4x43bkbp.js → chunk-a09jx26t.js} +1 -1
  53. package/dist/{chunk-st4xgxey.js → chunk-afjpa2hs.js} +205 -48
  54. package/dist/chunk-afjpa2hs.js.map +45 -0
  55. package/dist/{chunk-0mbx247x.js → chunk-c43qr6s0.js} +427 -99
  56. package/dist/chunk-c43qr6s0.js.map +46 -0
  57. package/dist/{chunk-zg9yryhz.js → chunk-cbkm2vam.js} +3 -3
  58. package/dist/{chunk-57zpb99z.js → chunk-dm72y8wt.js} +26 -3
  59. package/dist/chunk-dm72y8wt.js.map +10 -0
  60. package/dist/chunk-drjqm1aa.js +913 -0
  61. package/dist/chunk-drjqm1aa.js.map +15 -0
  62. package/dist/chunk-dysw7nsm.js.map +1 -1
  63. package/dist/{chunk-8ryen3p3.js → chunk-f6erf2vv.js} +1 -1
  64. package/dist/{chunk-34bqh420.js → chunk-f83ka50g.js} +188 -44
  65. package/dist/chunk-f83ka50g.js.map +23 -0
  66. package/dist/{chunk-bct7hmfc.js → chunk-g13869yf.js} +3 -3
  67. package/dist/{chunk-0k4avqr2.js → chunk-hbeh8j9w.js} +2 -2
  68. package/dist/{chunk-qvybnnpe.js → chunk-nzw7sm3b.js} +2 -2
  69. package/dist/{chunk-k9pts48t.js → chunk-pn8n8sba.js} +16 -15
  70. package/dist/{chunk-k9pts48t.js.map → chunk-pn8n8sba.js.map} +3 -3
  71. package/dist/{chunk-63te770v.js → chunk-qewtks41.js} +8 -8
  72. package/dist/{chunk-63te770v.js.map → chunk-qewtks41.js.map} +2 -2
  73. package/dist/{chunk-85j5ybfj.js → chunk-rdeagz6b.js} +2 -2
  74. package/dist/{chunk-85j5ybfj.js.map → chunk-rdeagz6b.js.map} +3 -3
  75. package/dist/chunk-rhrbz7d4.js +36 -0
  76. package/dist/chunk-rhrbz7d4.js.map +10 -0
  77. package/dist/{chunk-bh6k3nc6.js → chunk-rs1wbvy6.js} +1 -1
  78. package/dist/{chunk-88ppkr54.js → chunk-rte5sm3z.js} +26 -2
  79. package/dist/chunk-rte5sm3z.js.map +12 -0
  80. package/dist/{chunk-n8herkry.js → chunk-s31d0qmq.js} +57 -20
  81. package/dist/{chunk-n8herkry.js.map → chunk-s31d0qmq.js.map} +8 -7
  82. package/dist/{chunk-7pc8b818.js → chunk-sxwk41qa.js} +1 -1
  83. package/dist/{chunk-663csy96.js → chunk-t0jjkep3.js} +2 -1
  84. package/dist/chunk-t0jjkep3.js.map +10 -0
  85. package/dist/{chunk-c6qd89g5.js → chunk-tek1qwgm.js} +6 -6
  86. package/dist/{chunk-c6qd89g5.js.map → chunk-tek1qwgm.js.map} +1 -1
  87. package/dist/{chunk-jaj13078.js → chunk-tkdscva6.js} +3 -33
  88. package/dist/{chunk-jaj13078.js.map → chunk-tkdscva6.js.map} +3 -4
  89. package/dist/{chunk-5egfka8j.js → chunk-tycbzedm.js} +2 -2
  90. package/dist/{chunk-g9t3kdtx.js → chunk-x2yw73hy.js} +1 -1
  91. package/dist/{chunk-57r1cpxx.js → chunk-xc7hq65b.js} +3 -2
  92. package/dist/{chunk-57r1cpxx.js.map → chunk-xc7hq65b.js.map} +3 -3
  93. package/dist/chunk-xdf9yswn.js +133 -0
  94. package/dist/chunk-xdf9yswn.js.map +11 -0
  95. package/dist/execution/agent.js +29 -27
  96. package/dist/execution/agent.js.map +1 -1
  97. package/dist/execution/primitive.js +29 -27
  98. package/dist/execution/primitive.js.map +2 -2
  99. package/dist/execution/request.js +30 -28
  100. package/dist/execution/request.js.map +2 -2
  101. package/dist/http/index.js +1 -1
  102. package/dist/index.d.ts +6 -5
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +60 -58
  105. package/dist/index.js.map +1 -1
  106. package/dist/lake-storage/types.d.ts +2 -1
  107. package/dist/lake-storage/types.d.ts.map +1 -1
  108. package/dist/materialization/model.d.ts +4 -0
  109. package/dist/materialization/model.d.ts.map +1 -1
  110. package/dist/materializer/edits/apply.d.ts +6 -1
  111. package/dist/materializer/edits/apply.d.ts.map +1 -1
  112. package/dist/materializer/edits/working-state.d.ts +2 -0
  113. package/dist/materializer/edits/working-state.d.ts.map +1 -1
  114. package/dist/materializer/effective/resolve.d.ts +3 -1
  115. package/dist/materializer/effective/resolve.d.ts.map +1 -1
  116. package/dist/materializer/execution/work-records.d.ts.map +1 -1
  117. package/dist/materializer/index.js +19 -17
  118. package/dist/materializer/index.js.map +1 -1
  119. package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
  120. package/dist/materializer/shared/normalize.d.ts.map +1 -1
  121. package/dist/models/index.d.ts +40 -0
  122. package/dist/models/index.d.ts.map +1 -0
  123. package/dist/objects/execution.d.ts +6 -1
  124. package/dist/objects/execution.d.ts.map +1 -1
  125. package/dist/objects/index.js +21 -19
  126. package/dist/objects/index.js.map +1 -1
  127. package/dist/objects/link/endpoints.d.ts.map +1 -1
  128. package/dist/objects/query/executor.d.ts +1 -0
  129. package/dist/objects/query/executor.d.ts.map +1 -1
  130. package/dist/objects/query/explain.d.ts +1 -0
  131. package/dist/objects/query/explain.d.ts.map +1 -1
  132. package/dist/objects/query/index.d.ts +3 -1
  133. package/dist/objects/query/index.d.ts.map +1 -1
  134. package/dist/objects/query/index.js +30 -5
  135. package/dist/objects/query/index.js.map +1 -1
  136. package/dist/objects/query/ir.d.ts +14 -1
  137. package/dist/objects/query/ir.d.ts.map +1 -1
  138. package/dist/objects/query/links.d.ts +25 -0
  139. package/dist/objects/query/links.d.ts.map +1 -0
  140. package/dist/objects/query/normalize.d.ts.map +1 -1
  141. package/dist/objects/query/planner.d.ts.map +1 -1
  142. package/dist/objects/query/validate.d.ts +1 -0
  143. package/dist/objects/query/validate.d.ts.map +1 -1
  144. package/dist/pipelines/index.js +16 -15
  145. package/dist/pipelines/index.js.map +1 -1
  146. package/dist/projections/builders.d.ts +52 -10
  147. package/dist/projections/builders.d.ts.map +1 -1
  148. package/dist/projections/index.d.ts +2 -1
  149. package/dist/projections/index.d.ts.map +1 -1
  150. package/dist/projections/internal.d.ts +4 -1
  151. package/dist/projections/internal.d.ts.map +1 -1
  152. package/dist/projections/internal.js +22 -17
  153. package/dist/projections/internal.js.map +1 -1
  154. package/dist/projections/run-dispatch.d.ts +1 -0
  155. package/dist/projections/run-dispatch.d.ts.map +1 -1
  156. package/dist/projections/timestamp.d.ts +3 -0
  157. package/dist/projections/timestamp.d.ts.map +1 -0
  158. package/dist/projections/types.d.ts +21 -9
  159. package/dist/projections/types.d.ts.map +1 -1
  160. package/dist/projections/validation.d.ts +6 -5
  161. package/dist/projections/validation.d.ts.map +1 -1
  162. package/dist/query.d.ts +2 -1
  163. package/dist/query.d.ts.map +1 -1
  164. package/dist/query.js +2 -2
  165. package/dist/queues/index.d.ts +1 -1
  166. package/dist/queues/index.d.ts.map +1 -1
  167. package/dist/queues/types.d.ts +7 -0
  168. package/dist/queues/types.d.ts.map +1 -1
  169. package/dist/runtime/ai-cost.d.ts +8 -0
  170. package/dist/runtime/ai-cost.d.ts.map +1 -0
  171. package/dist/runtime/create.d.ts +3 -0
  172. package/dist/runtime/create.d.ts.map +1 -1
  173. package/dist/runtime/definitions.d.ts +3 -0
  174. package/dist/runtime/definitions.d.ts.map +1 -1
  175. package/dist/runtime/host.d.ts +2 -0
  176. package/dist/runtime/host.d.ts.map +1 -1
  177. package/dist/runtime/resolve-definitions.d.ts +2 -0
  178. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  179. package/dist/storage/agents/in-memory.d.ts +22 -4
  180. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  181. package/dist/storage/agents/index.d.ts +1 -1
  182. package/dist/storage/agents/index.d.ts.map +1 -1
  183. package/dist/storage/agents/provider.d.ts +31 -0
  184. package/dist/storage/agents/provider.d.ts.map +1 -1
  185. package/dist/storage/agents/provider.js +22 -7
  186. package/dist/storage/agents/provider.js.map +1 -1
  187. package/dist/storage/agents/types.d.ts +75 -4
  188. package/dist/storage/agents/types.d.ts.map +1 -1
  189. package/dist/storage/ai-cost/analytics.d.ts +61 -0
  190. package/dist/storage/ai-cost/analytics.d.ts.map +1 -0
  191. package/dist/storage/ai-cost/codec.d.ts +14 -0
  192. package/dist/storage/ai-cost/codec.d.ts.map +1 -0
  193. package/dist/storage/ai-cost/errors.d.ts +7 -0
  194. package/dist/storage/ai-cost/errors.d.ts.map +1 -0
  195. package/dist/storage/ai-cost/in-memory.d.ts +32 -0
  196. package/dist/storage/ai-cost/in-memory.d.ts.map +1 -0
  197. package/dist/storage/ai-cost/index.d.ts +6 -0
  198. package/dist/storage/ai-cost/index.d.ts.map +1 -0
  199. package/dist/storage/ai-cost/provider.d.ts +7 -0
  200. package/dist/storage/ai-cost/provider.d.ts.map +1 -0
  201. package/dist/storage/ai-cost/provider.js +132 -0
  202. package/dist/storage/ai-cost/provider.js.map +10 -0
  203. package/dist/storage/ai-cost/types.d.ts +154 -0
  204. package/dist/storage/ai-cost/types.d.ts.map +1 -0
  205. package/dist/storage/ai-cost/validation.d.ts +7 -0
  206. package/dist/storage/ai-cost/validation.d.ts.map +1 -0
  207. package/dist/storage/ai-usage/in-memory.d.ts +2 -1
  208. package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
  209. package/dist/storage/ai-usage/index.d.ts +1 -1
  210. package/dist/storage/ai-usage/index.d.ts.map +1 -1
  211. package/dist/storage/ai-usage/types.d.ts +6 -0
  212. package/dist/storage/ai-usage/types.d.ts.map +1 -1
  213. package/dist/storage/in-memory/index.d.ts +5 -0
  214. package/dist/storage/in-memory/index.d.ts.map +1 -1
  215. package/dist/storage/index.d.ts +6 -3
  216. package/dist/storage/index.d.ts.map +1 -1
  217. package/dist/storage/index.js +33 -21
  218. package/dist/storage/index.js.map +1 -1
  219. package/dist/storage/objects/in-memory.d.ts +6 -3
  220. package/dist/storage/objects/in-memory.d.ts.map +1 -1
  221. package/dist/storage/objects/index.d.ts +3 -1
  222. package/dist/storage/objects/index.d.ts.map +1 -1
  223. package/dist/storage/objects/keys.d.ts +16 -0
  224. package/dist/storage/objects/keys.d.ts.map +1 -0
  225. package/dist/storage/objects/types.d.ts +33 -6
  226. package/dist/storage/objects/types.d.ts.map +1 -1
  227. package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
  228. package/dist/storage/ontology/materializations.d.ts +3 -0
  229. package/dist/storage/ontology/materializations.d.ts.map +1 -1
  230. package/dist/storage/ontology/provider.js +1 -1
  231. package/dist/storage/operation-scope.d.ts.map +1 -1
  232. package/dist/storage/operation-scope.js +1 -1
  233. package/dist/storage/types.d.ts +2 -0
  234. package/dist/storage/types.d.ts.map +1 -1
  235. package/dist/storage/workflow-runs/provider.js +10 -5
  236. package/dist/storage/workflow-runs/provider.js.map +1 -1
  237. package/dist/syncs/index.js +16 -15
  238. package/dist/syncs/index.js.map +1 -1
  239. package/dist/testing/agent-storage-contract.d.ts +3 -2
  240. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  241. package/dist/testing/ai-cost-storage-contract.d.ts +12 -0
  242. package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -0
  243. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
  244. package/dist/testing/effective-storage-contract.d.ts +1 -1
  245. package/dist/testing/effective-storage-contract.d.ts.map +1 -1
  246. package/dist/testing/index.d.ts +1 -0
  247. package/dist/testing/index.d.ts.map +1 -1
  248. package/dist/testing/index.js +2525 -1480
  249. package/dist/testing/index.js.map +10 -9
  250. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  251. package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
  252. package/dist/testing/object-query-contract.d.ts +1 -1
  253. package/dist/testing/object-query-contract.d.ts.map +1 -1
  254. package/dist/webhooks/internal.js +14 -13
  255. package/dist/webhooks/internal.js.map +2 -2
  256. package/dist/workers/index.js +12 -2
  257. package/dist/workers/index.js.map +3 -3
  258. package/dist/workers/queue-worker.d.ts +2 -0
  259. package/dist/workers/queue-worker.d.ts.map +1 -1
  260. package/dist/workflows/execution.d.ts +3 -0
  261. package/dist/workflows/execution.d.ts.map +1 -1
  262. package/dist/workflows/index.js +30 -28
  263. package/dist/workflows/index.js.map +1 -1
  264. package/package.json +7 -1
  265. package/src/agents/adapters.ts +64 -23
  266. package/src/agents/builders.ts +3 -3
  267. package/src/agents/context-compaction.ts +261 -0
  268. package/src/agents/errors.ts +2 -2
  269. package/src/agents/execution.ts +14 -2
  270. package/src/agents/ids.ts +5 -0
  271. package/src/agents/index.ts +32 -6
  272. package/src/agents/request.ts +5 -0
  273. package/src/agents/streams.ts +56 -0
  274. package/src/agents/thread-context-projection.ts +93 -0
  275. package/src/agents/tool-definition.ts +17 -2
  276. package/src/agents/tool-result.ts +61 -0
  277. package/src/agents/types.ts +57 -1
  278. package/src/agents/validation.ts +36 -6
  279. package/src/http/api-routes.ts +7 -7
  280. package/src/index.ts +27 -0
  281. package/src/lake-storage/types.ts +2 -1
  282. package/src/materialization/model.ts +4 -0
  283. package/src/materializer/edits/apply.ts +55 -2
  284. package/src/materializer/edits/operations.ts +8 -1
  285. package/src/materializer/edits/working-state.ts +7 -0
  286. package/src/materializer/effective/resolve.ts +78 -9
  287. package/src/materializer/execution/work-records.ts +3 -1
  288. package/src/materializer/projections/entry-validator.ts +23 -1
  289. package/src/materializer/projections/replacement-plan.ts +2 -0
  290. package/src/materializer/shared/normalize.ts +16 -0
  291. package/src/materializer/telemetry/append.ts +33 -16
  292. package/src/models/index.ts +71 -0
  293. package/src/objects/execution.ts +20 -0
  294. package/src/objects/link/endpoints.ts +2 -1
  295. package/src/objects/query/executor.ts +42 -11
  296. package/src/objects/query/explain.ts +11 -0
  297. package/src/objects/query/index.ts +6 -0
  298. package/src/objects/query/ir.ts +16 -0
  299. package/src/objects/query/links.ts +308 -0
  300. package/src/objects/query/normalize.ts +40 -1
  301. package/src/objects/query/planner.ts +5 -0
  302. package/src/objects/query/validate.ts +58 -2
  303. package/src/projections/builders.ts +320 -50
  304. package/src/projections/index.ts +7 -0
  305. package/src/projections/internal.ts +4 -1
  306. package/src/projections/ownership.ts +5 -5
  307. package/src/projections/registry.ts +16 -3
  308. package/src/projections/revision.ts +35 -5
  309. package/src/projections/run-dispatch.ts +10 -1
  310. package/src/projections/timestamp.ts +66 -0
  311. package/src/projections/types.ts +20 -9
  312. package/src/projections/validation.ts +85 -19
  313. package/src/query.ts +2 -0
  314. package/src/queues/index.ts +1 -0
  315. package/src/queues/types.ts +8 -0
  316. package/src/runtime/ai-cost.ts +15 -0
  317. package/src/runtime/create.ts +4 -0
  318. package/src/runtime/definitions.ts +3 -0
  319. package/src/runtime/host.ts +2 -0
  320. package/src/runtime/resolve-definitions.ts +28 -0
  321. package/src/storage/agents/in-memory.ts +186 -4
  322. package/src/storage/agents/index.ts +5 -0
  323. package/src/storage/agents/provider.ts +225 -0
  324. package/src/storage/agents/types.ts +82 -3
  325. package/src/storage/ai-cost/analytics.ts +602 -0
  326. package/src/storage/ai-cost/codec.ts +136 -0
  327. package/src/storage/ai-cost/errors.ts +12 -0
  328. package/src/storage/ai-cost/in-memory.ts +164 -0
  329. package/src/storage/ai-cost/index.ts +35 -0
  330. package/src/storage/ai-cost/provider.ts +20 -0
  331. package/src/storage/ai-cost/types.ts +193 -0
  332. package/src/storage/ai-cost/validation.ts +337 -0
  333. package/src/storage/ai-usage/in-memory.ts +23 -0
  334. package/src/storage/ai-usage/index.ts +1 -0
  335. package/src/storage/ai-usage/types.ts +10 -0
  336. package/src/storage/in-memory/index.ts +50 -0
  337. package/src/storage/index.ts +48 -0
  338. package/src/storage/objects/in-memory.ts +103 -16
  339. package/src/storage/objects/index.ts +9 -0
  340. package/src/storage/objects/keys.ts +36 -0
  341. package/src/storage/objects/types.ts +34 -6
  342. package/src/storage/ontology/in-memory/materializations.ts +1 -0
  343. package/src/storage/ontology/materializations.ts +3 -0
  344. package/src/storage/ontology/provider-header-validation.ts +2 -2
  345. package/src/storage/operation-scope.ts +1 -0
  346. package/src/storage/types.ts +2 -0
  347. package/src/testing/agent-storage-contract.ts +353 -2
  348. package/src/testing/ai-cost-storage-contract.ts +320 -0
  349. package/src/testing/ai-usage-storage-contract.ts +35 -0
  350. package/src/testing/effective-storage-contract.ts +194 -4
  351. package/src/testing/index.ts +5 -0
  352. package/src/testing/lake-storage-contract.ts +56 -0
  353. package/src/testing/materializer-storage-contract.ts +120 -2
  354. package/src/testing/object-query-contract.ts +208 -1
  355. package/src/workers/queue-worker.ts +14 -1
  356. package/src/workflows/execution.ts +31 -10
  357. package/dist/agents/prompt.d.ts +0 -15
  358. package/dist/agents/prompt.d.ts.map +0 -1
  359. package/dist/chunk-0mbx247x.js.map +0 -43
  360. package/dist/chunk-34bqh420.js.map +0 -23
  361. package/dist/chunk-57zpb99z.js.map +0 -10
  362. package/dist/chunk-663csy96.js.map +0 -10
  363. package/dist/chunk-6wetht33.js +0 -89
  364. package/dist/chunk-6wetht33.js.map +0 -10
  365. package/dist/chunk-88ppkr54.js.map +0 -12
  366. package/dist/chunk-nnyp53zt.js.map +0 -13
  367. package/dist/chunk-nten49ta.js.map +0 -12
  368. package/dist/chunk-st4xgxey.js.map +0 -45
  369. package/dist/chunk-vp1vc6ee.js +0 -35
  370. package/dist/chunk-vp1vc6ee.js.map +0 -11
  371. package/src/agents/prompt.ts +0 -57
  372. /package/dist/{chunk-sa4340y1.js.map → chunk-1yz3x65y.js.map} +0 -0
  373. /package/dist/{chunk-gqdd7508.js.map → chunk-4rh2m6zg.js.map} +0 -0
  374. /package/dist/{chunk-4x43bkbp.js.map → chunk-a09jx26t.js.map} +0 -0
  375. /package/dist/{chunk-zg9yryhz.js.map → chunk-cbkm2vam.js.map} +0 -0
  376. /package/dist/{chunk-8ryen3p3.js.map → chunk-f6erf2vv.js.map} +0 -0
  377. /package/dist/{chunk-bct7hmfc.js.map → chunk-g13869yf.js.map} +0 -0
  378. /package/dist/{chunk-0k4avqr2.js.map → chunk-hbeh8j9w.js.map} +0 -0
  379. /package/dist/{chunk-qvybnnpe.js.map → chunk-nzw7sm3b.js.map} +0 -0
  380. /package/dist/{chunk-bh6k3nc6.js.map → chunk-rs1wbvy6.js.map} +0 -0
  381. /package/dist/{chunk-7pc8b818.js.map → chunk-sxwk41qa.js.map} +0 -0
  382. /package/dist/{chunk-5egfka8j.js.map → chunk-tycbzedm.js.map} +0 -0
  383. /package/dist/{chunk-g9t3kdtx.js.map → chunk-x2yw73hy.js.map} +0 -0
@@ -4,6 +4,7 @@ import type { SixbFailure } from "../errors/types"
4
4
  import { isJsonValue, isPlainRecord, type JsonValue } from "../json"
5
5
  import {
6
6
  AGENT_RUN_FAILURE_CODES,
7
+ type AgentContextCheckpointReason,
7
8
  type AgentRunFailureCode,
8
9
  type AgentRunRecord,
9
10
  } from "../storage/agents/types"
@@ -189,11 +190,35 @@ export async function subscribeAgentRunCancel(
189
190
  /** Exact portable failure exposed by a terminal Agent run stream event. */
190
191
  export type AgentRunFailure = SixbFailure<AgentRunFailureCode>
191
192
 
193
+ export const AGENT_COMPACTION_FAILURE_CODES = [
194
+ "context_limit_exceeded",
195
+ "summary_failed",
196
+ "checkpoint_failed",
197
+ ] as const
198
+ export type AgentCompactionFailureCode = (typeof AGENT_COMPACTION_FAILURE_CODES)[number]
199
+
192
200
  export type AgentRunStreamEvent =
193
201
  | (AgentRunStreamEventBase & {
194
202
  readonly type: "agent.run.started"
195
203
  readonly modelId?: string
196
204
  })
205
+ | (AgentRunStreamEventBase & {
206
+ readonly type: "agent.compaction.started"
207
+ readonly reason: AgentContextCheckpointReason
208
+ readonly estimatedInputTokensBefore: number
209
+ })
210
+ | (AgentRunStreamEventBase & {
211
+ readonly type: "agent.compaction.completed"
212
+ readonly reason: AgentContextCheckpointReason
213
+ readonly checkpointId: string
214
+ readonly estimatedInputTokensBefore: number
215
+ readonly estimatedInputTokensAfter: number
216
+ })
217
+ | (AgentRunStreamEventBase & {
218
+ readonly type: "agent.compaction.failed"
219
+ readonly reason: AgentContextCheckpointReason
220
+ readonly errorCode: AgentCompactionFailureCode
221
+ })
197
222
  | (AgentRunStreamEventBase & {
198
223
  readonly type: "agent.ui.chunk"
199
224
  readonly chunkIndex: number
@@ -263,6 +288,23 @@ export function isAgentRunStreamEvent(value: unknown): value is AgentRunStreamEv
263
288
  switch (value.type) {
264
289
  case "agent.run.started":
265
290
  return value.modelId === undefined || typeof value.modelId === "string"
291
+ case "agent.compaction.started":
292
+ return (
293
+ isAgentContextCheckpointReason(value.reason) &&
294
+ isTokenEstimate(value.estimatedInputTokensBefore)
295
+ )
296
+ case "agent.compaction.completed":
297
+ return (
298
+ isAgentContextCheckpointReason(value.reason) &&
299
+ typeof value.checkpointId === "string" &&
300
+ isTokenEstimate(value.estimatedInputTokensBefore) &&
301
+ isTokenEstimate(value.estimatedInputTokensAfter)
302
+ )
303
+ case "agent.compaction.failed":
304
+ return (
305
+ isAgentContextCheckpointReason(value.reason) &&
306
+ AGENT_COMPACTION_FAILURE_CODES.includes(value.errorCode as AgentCompactionFailureCode)
307
+ )
266
308
  case "agent.ui.chunk":
267
309
  return (
268
310
  Number.isInteger(value.chunkIndex) &&
@@ -282,6 +324,14 @@ export function isAgentRunStreamEvent(value: unknown): value is AgentRunStreamEv
282
324
  }
283
325
  }
284
326
 
327
+ function isAgentContextCheckpointReason(value: unknown): value is AgentContextCheckpointReason {
328
+ return value === "threshold" || value === "overflow"
329
+ }
330
+
331
+ function isTokenEstimate(value: unknown): value is number {
332
+ return Number.isSafeInteger(value) && (value as number) >= 0
333
+ }
334
+
285
335
  function isTerminalAgentRunStatus(value: unknown): value is "succeeded" | "failed" | "cancelled" {
286
336
  return value === "succeeded" || value === "failed" || value === "cancelled"
287
337
  }
@@ -305,6 +355,12 @@ export function agentRunStreamIdempotencyKey(event: AgentRunStreamEvent): string
305
355
  switch (event.type) {
306
356
  case "agent.run.started":
307
357
  return `${event.runId}:${event.attempt}:started`
358
+ case "agent.compaction.started":
359
+ return `${event.runId}:${event.attempt}:compaction:${event.reason}:started`
360
+ case "agent.compaction.completed":
361
+ return `${event.runId}:${event.attempt}:compaction:${event.checkpointId}:completed`
362
+ case "agent.compaction.failed":
363
+ return `${event.runId}:${event.attempt}:compaction:${event.reason}:failed:${event.errorCode}`
308
364
  case "agent.ui.chunk":
309
365
  return `${event.runId}:${event.attempt}:chunk:${event.chunkIndex}`
310
366
  case "agent.message.finalized":
@@ -0,0 +1,93 @@
1
+ import type { AgentContextCheckpointRecord, AgentMessageRecord } from "../storage/agents/types"
2
+ import type { AgentMessage } from "./message"
3
+
4
+ /** A model-only message. Persisted tail messages carry `id`; the synthetic summary does not. */
5
+ export interface AgentThreadModelContextMessage extends AgentMessage {
6
+ readonly id?: string
7
+ }
8
+
9
+ export interface ProjectAgentThreadModelContextInput {
10
+ readonly checkpoint: AgentContextCheckpointRecord | null
11
+ /** Complete retained tail, ordered by ascending per-thread sequence. */
12
+ readonly messages: readonly AgentMessageRecord[]
13
+ }
14
+
15
+ /**
16
+ * Build the bounded, model-only view of a durable thread.
17
+ *
18
+ * The function is deliberately pure: storage chooses the latest checkpoint and reads its retained
19
+ * tail; this function validates that projection and prepends one synthetic user-role summary.
20
+ */
21
+ export function projectAgentThreadModelContext(
22
+ input: ProjectAgentThreadModelContextInput
23
+ ): readonly AgentThreadModelContextMessage[] {
24
+ const { checkpoint, messages } = input
25
+ if (!checkpoint) return messages
26
+
27
+ assertConsistentCheckpointProjection(checkpoint, messages)
28
+ return [
29
+ {
30
+ role: "user",
31
+ parts: [{ type: "text", text: serializeThreadSummary(checkpoint.summary) }],
32
+ },
33
+ ...messages,
34
+ ]
35
+ }
36
+
37
+ function assertConsistentCheckpointProjection(
38
+ checkpoint: AgentContextCheckpointRecord,
39
+ messages: readonly AgentMessageRecord[]
40
+ ): void {
41
+ if (checkpoint.summaryFormatVersion !== 1 || checkpoint.summary.trim().length === 0) {
42
+ throw projectionError(checkpoint, "has an invalid summary")
43
+ }
44
+ if (checkpoint.summarizedThroughSeq >= checkpoint.observedHeadSeq) {
45
+ throw projectionError(checkpoint, "does not retain its observed head")
46
+ }
47
+ if (messages.length === 0) {
48
+ throw projectionError(checkpoint, "has no retained messages")
49
+ }
50
+
51
+ let expectedSeq = checkpoint.summarizedThroughSeq + 1
52
+ for (const message of messages) {
53
+ if (message.projectId !== checkpoint.projectId || message.threadId !== checkpoint.threadId) {
54
+ throw projectionError(checkpoint, "contains a message from another thread")
55
+ }
56
+ if (message.seq !== expectedSeq) {
57
+ throw projectionError(checkpoint, `has a sequence gap before message '${message.id}'`)
58
+ }
59
+ expectedSeq += 1
60
+ }
61
+
62
+ if (messages[0]?.role !== "user") {
63
+ throw projectionError(checkpoint, "does not begin at a user turn boundary")
64
+ }
65
+ if ((messages.at(-1)?.seq ?? 0) < checkpoint.observedHeadSeq) {
66
+ throw projectionError(checkpoint, "ends before the checkpoint's observed head")
67
+ }
68
+ }
69
+
70
+ function serializeThreadSummary(summary: string): string {
71
+ return [
72
+ "The earlier conversation was compacted into this continuation summary.",
73
+ "",
74
+ "<sixb_thread_summary>",
75
+ escapeXml(summary),
76
+ "</sixb_thread_summary>",
77
+ ].join("\n")
78
+ }
79
+
80
+ function projectionError(checkpoint: AgentContextCheckpointRecord, detail: string): Error {
81
+ return new Error(
82
+ `[Sixb] Agent context checkpoint '${checkpoint.id}' for thread '${checkpoint.threadId}' ${detail}.`
83
+ )
84
+ }
85
+
86
+ function escapeXml(value: string): string {
87
+ return value
88
+ .replaceAll("&", "&amp;")
89
+ .replaceAll("<", "&lt;")
90
+ .replaceAll(">", "&gt;")
91
+ .replaceAll('"', "&quot;")
92
+ .replaceAll("'", "&apos;")
93
+ }
@@ -1,5 +1,11 @@
1
- import { cloneJsonValue, getInvalidJsonValueReason } from "../json"
1
+ import {
2
+ cloneJsonValue,
3
+ getInvalidJsonValueReason,
4
+ type JsonValue,
5
+ type ReadonlyJsonValue,
6
+ } from "../json"
2
7
  import { AgentDefinitionError, AgentToolResultValidationError } from "./errors"
8
+ import { getInvalidAgentToolResultReason } from "./tool-result"
3
9
  import type {
4
10
  AgentToolDefinition,
5
11
  AgentToolHandler,
@@ -41,8 +47,12 @@ export function createAgentToolDefinition<
41
47
  input,
42
48
  handler: async (context) => {
43
49
  const result = await definition.handler(context)
50
+ let snapshot: JsonValue
44
51
  try {
45
- return cloneJsonValue(result, "result")
52
+ // AgentToolResult is intentionally expressed with FileRef instead of a duplicate JSON-only
53
+ // shape. Runtime validation below proves that the complete envelope crosses the same JSON
54
+ // boundary as legacy results.
55
+ snapshot = cloneJsonValue(result as ReadonlyJsonValue, "result")
46
56
  } catch (cause) {
47
57
  throw new AgentToolResultValidationError(
48
58
  definition.name,
@@ -50,6 +60,11 @@ export function createAgentToolDefinition<
50
60
  { cause }
51
61
  )
52
62
  }
63
+ const richResultReason = getInvalidAgentToolResultReason(snapshot)
64
+ if (richResultReason) {
65
+ throw new AgentToolResultValidationError(definition.name, richResultReason)
66
+ }
67
+ return snapshot
53
68
  },
54
69
  }
55
70
 
@@ -0,0 +1,61 @@
1
+ import { isFileRef } from "../blob-storage/validation"
2
+ import { isPlainRecord } from "../json"
3
+ import type { AgentToolResult } from "./types"
4
+
5
+ /** Narrow a durable JSON tool output to Sixb's file-aware result envelope. */
6
+ export function isAgentToolResult(value: unknown): value is AgentToolResult {
7
+ return (
8
+ isPlainRecord(value) &&
9
+ value.kind === "agentToolResult" &&
10
+ getInvalidAgentToolResultReason(value) === undefined
11
+ )
12
+ }
13
+
14
+ /** Return a precise path when a tagged result does not satisfy the public rich-result contract. */
15
+ export function getInvalidAgentToolResultReason(value: unknown): string | undefined {
16
+ if (!isPlainRecord(value) || value.kind !== "agentToolResult") {
17
+ return undefined
18
+ }
19
+
20
+ if (!Array.isArray(value.content)) {
21
+ return "result.content must be an array"
22
+ }
23
+ const unsupportedKey = Object.keys(value).find((key) => key !== "kind" && key !== "content")
24
+ if (unsupportedKey) {
25
+ return `result.${unsupportedKey} is not supported`
26
+ }
27
+ if (value.content.length === 0) {
28
+ return "result.content must contain at least one content part"
29
+ }
30
+
31
+ for (let index = 0; index < value.content.length; index += 1) {
32
+ const part = value.content[index]
33
+ const path = `result.content[${index}]`
34
+ if (!isPlainRecord(part)) {
35
+ return `${path} must be a text or file content part`
36
+ }
37
+ if (part.type === "text") {
38
+ if (typeof part.text !== "string") {
39
+ return `${path}.text must be a string`
40
+ }
41
+ const unsupportedKey = Object.keys(part).find((key) => key !== "type" && key !== "text")
42
+ if (unsupportedKey) {
43
+ return `${path}.${unsupportedKey} is not supported`
44
+ }
45
+ continue
46
+ }
47
+ if (part.type === "file") {
48
+ if (!isFileRef(part.fileRef)) {
49
+ return `${path}.fileRef must be a valid FileRef`
50
+ }
51
+ const unsupportedKey = Object.keys(part).find((key) => key !== "type" && key !== "fileRef")
52
+ if (unsupportedKey) {
53
+ return `${path}.${unsupportedKey} is not supported`
54
+ }
55
+ continue
56
+ }
57
+ return `${path}.type must be 'text' or 'file'`
58
+ }
59
+
60
+ return undefined
61
+ }
@@ -1,4 +1,5 @@
1
1
  import type { LanguageModelV4, LanguageModelV4CallOptions } from "@ai-sdk/provider"
2
+ import type { BlobBody, FileRef } from "../blob-storage"
2
3
  import type { ConnectorRuntime } from "../connectors"
3
4
  import type { JsonPrimitive, JsonValue, ReadonlyJsonValue } from "../json"
4
5
  import type { Logger } from "../logging"
@@ -25,6 +26,15 @@ export const AGENT_REASONING_LEVELS = [
25
26
  "xhigh",
26
27
  ] as const satisfies readonly AgentReasoningLevel[]
27
28
 
29
+ export interface AgentContextConfig {
30
+ /** Override the provider context-window size inferred by the agent worker. */
31
+ readonly windowTokens?: number
32
+ /** Tokens reserved for the next response and compaction work. */
33
+ readonly reserveTokens?: number
34
+ /** Approximate recent-message budget retained verbatim after compaction. */
35
+ readonly keepRecentTokens?: number
36
+ }
37
+
28
38
  /**
29
39
  * Loop / stop controls for an agent run.
30
40
  *
@@ -34,6 +44,7 @@ export interface AgentLoopConfig {
34
44
  readonly stopWhen?: {
35
45
  readonly maxSteps?: number
36
46
  }
47
+ readonly context?: AgentContextConfig
37
48
  }
38
49
 
39
50
  type Simplify<T> = { [K in keyof T]: T[K] } & {}
@@ -67,19 +78,64 @@ export interface AgentToolRunInfo {
67
78
  readonly threadId?: string
68
79
  }
69
80
 
81
+ /** Input accepted by the run-scoped artifact publisher exposed to agent tools. */
82
+ export interface AgentToolArtifactPutInput {
83
+ readonly body: BlobBody
84
+ readonly fileName: string
85
+ readonly mediaType?: string
86
+ }
87
+
88
+ /** A durable artifact and its path inside the current run sandbox. */
89
+ export interface AgentToolArtifact {
90
+ readonly fileRef: FileRef
91
+ readonly sandboxPath: string
92
+ }
93
+
94
+ /** The narrow artifact-writing surface available to an agent tool call. */
95
+ export interface AgentToolArtifacts {
96
+ put(input: AgentToolArtifactPutInput): Promise<AgentToolArtifact>
97
+ }
98
+
99
+ export type AgentToolTextContent = {
100
+ readonly type: "text"
101
+ readonly text: string
102
+ }
103
+
104
+ export type AgentToolFileContent = {
105
+ readonly type: "file"
106
+ readonly fileRef: FileRef
107
+ }
108
+
109
+ /** Durable model-facing content returned by a file-aware tool. */
110
+ export type AgentToolContent = AgentToolTextContent | AgentToolFileContent
111
+
112
+ /**
113
+ * A file-aware tool result. The tag distinguishes this envelope from an ordinary JSON result while
114
+ * keeping the whole value safe to persist in the durable tool-call trace.
115
+ */
116
+ export type AgentToolResult = {
117
+ readonly kind: "agentToolResult"
118
+ readonly content: readonly AgentToolContent[]
119
+ }
120
+
70
121
  /** The narrow, run-scoped surface passed to an agent tool handler. */
71
122
  export interface AgentToolRunContext<
72
123
  TInput extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,
73
124
  > {
74
125
  readonly input: TInput
126
+ readonly toolCallId: string
75
127
  readonly signal: AbortSignal
76
128
  readonly run: AgentToolRunInfo
77
129
  readonly connector: ConnectorRuntime
78
130
  readonly logger: Logger
131
+ readonly artifacts: AgentToolArtifacts
79
132
  }
80
133
 
81
134
  /** Agent tool handlers may return only values safe to persist in agent messages. */
82
- export type AgentToolHandlerResult = ReadonlyJsonValue | Promise<ReadonlyJsonValue>
135
+ export type AgentToolHandlerResult =
136
+ | ReadonlyJsonValue
137
+ | AgentToolResult
138
+ | Promise<ReadonlyJsonValue | AgentToolResult>
83
139
 
84
140
  export type AgentToolHandler<TInput extends Readonly<Record<string, unknown>>> = (
85
141
  context: AgentToolRunContext<TInput>
@@ -10,6 +10,7 @@ import type { GroupDefinition, SecurityDefinitionCatalog } from "../security"
10
10
  import { AgentDefinitionError } from "./errors"
11
11
  import {
12
12
  AGENT_REASONING_LEVELS,
13
+ type AgentContextConfig,
13
14
  type AgentDefinition,
14
15
  type AgentLoopConfig,
15
16
  type AgentReasoningLevel,
@@ -31,7 +32,7 @@ const AGENT_TOOL_PRIMITIVE_SCHEMAS = new Set([
31
32
  "fileRef",
32
33
  ])
33
34
 
34
- export const AGENT_RESERVED_TOOL_NAMES = ["bash", "read"] as const
35
+ export const AGENT_RESERVED_TOOL_NAMES = ["bash", "read", "view_file"] as const
35
36
 
36
37
  export function assertNonEmpty(value: string, field: string): void {
37
38
  if (!value.trim()) {
@@ -159,14 +160,43 @@ export function validateAgentToolsAtStartup(agents: readonly AgentDefinition[]):
159
160
  }
160
161
  }
161
162
 
162
- export function assertValidLoopConfig(loop: AgentLoopConfig | undefined): void {
163
+ export function resolveAgentLoopConfig(
164
+ loop: AgentLoopConfig | undefined
165
+ ): AgentLoopConfig | undefined {
166
+ if (loop === undefined) return undefined
167
+
163
168
  const maxSteps = loop?.stopWhen?.maxSteps
164
- if (maxSteps === undefined) {
165
- return
169
+ if (maxSteps !== undefined && (!Number.isSafeInteger(maxSteps) || maxSteps <= 0)) {
170
+ throw new AgentDefinitionError(
171
+ "[Sixb] Agent loop.stopWhen.maxSteps must be a positive safe integer."
172
+ )
173
+ }
174
+
175
+ const context = loop.context ? snapshotAgentContextConfig(loop.context) : undefined
176
+ return Object.freeze({
177
+ ...(loop.stopWhen === undefined
178
+ ? {}
179
+ : { stopWhen: Object.freeze({ ...(maxSteps === undefined ? {} : { maxSteps }) }) }),
180
+ ...(context === undefined ? {} : { context }),
181
+ })
182
+ }
183
+
184
+ function snapshotAgentContextConfig(context: AgentContextConfig): AgentContextConfig {
185
+ const snapshot: Record<string, number> = {}
186
+ for (const field of ["windowTokens", "reserveTokens", "keepRecentTokens"] as const) {
187
+ const value = context[field]
188
+ if (value === undefined) continue
189
+ assertPositiveSafeInteger(value, field)
190
+ snapshot[field] = value
166
191
  }
167
- if (!Number.isInteger(maxSteps) || maxSteps <= 0) {
192
+
193
+ return Object.freeze(snapshot)
194
+ }
195
+
196
+ function assertPositiveSafeInteger(value: unknown, field: string): asserts value is number {
197
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
168
198
  throw new AgentDefinitionError(
169
- "[Sixb] Agent loop.stopWhen.maxSteps must be a positive finite integer."
199
+ `[Sixb] Agent loop.context.${field} must be a positive safe integer.`
170
200
  )
171
201
  }
172
202
  }
@@ -131,6 +131,13 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
131
131
  accessToken: true,
132
132
  agentApi: true,
133
133
  },
134
+ {
135
+ operationId: "queryObjectLinks",
136
+ method: "POST",
137
+ path: "/api/objects/query/links",
138
+ accessToken: true,
139
+ agentApi: true,
140
+ },
134
141
  {
135
142
  operationId: "countObjects",
136
143
  method: "POST",
@@ -159,13 +166,6 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
159
166
  accessToken: true,
160
167
  agentApi: true,
161
168
  },
162
- {
163
- operationId: "listObjectLinks",
164
- method: "GET",
165
- path: "/api/objects/:objectTypeId/:objectId/links",
166
- accessToken: true,
167
- agentApi: true,
168
- },
169
169
  // The four write routes. Bearer-capable because their execution facade enforces authorization
170
170
  // (`edit:object` / `append:telemetry`), which is exactly the precondition this table requires.
171
171
  // NOT agent-proxied: letting an agent turn write objects on its own is a separate decision, and
package/src/index.ts CHANGED
@@ -574,6 +574,7 @@ export type {
574
574
  ObjectQueryPredicateIn,
575
575
  ObjectQueryPredicateNot,
576
576
  ObjectQueryProject,
577
+ ObjectQueryRefs,
577
578
  ObjectQueryResultShape,
578
579
  ObjectQuerySet,
579
580
  ObjectQuerySetOperation,
@@ -854,6 +855,8 @@ export type {
854
855
  export type {
855
856
  ExecutionObjectByIdHandle,
856
857
  ExecutionObjectSet,
858
+ ObjectQueryLinksInput,
859
+ ObjectQueryLinksResult,
857
860
  ObjectsRuntime,
858
861
  } from "./objects/execution"
859
862
  export type { PipelineRunsRuntime, PipelinesRuntime } from "./pipelines/execution"
@@ -917,6 +920,7 @@ export type {
917
920
  ActionRunFailureCode,
918
921
  ActionRunPhase,
919
922
  AgentRunFailureCode,
923
+ AiCostSummary,
920
924
  PipelineRunFailureCode,
921
925
  ProjectionRunFailureCode,
922
926
  SyncRunFailureCode,
@@ -940,6 +944,7 @@ export type {
940
944
  // ── Agents ──────────────────────────────────────────────────
941
945
 
942
946
  export type {
947
+ AgentContextConfig,
943
948
  AgentContextEntryInput,
944
949
  AgentContextInput,
945
950
  AgentContextOrigin,
@@ -968,17 +973,25 @@ export type {
968
973
  AgentRequestErrorCode,
969
974
  AgentStepStartPart,
970
975
  AgentTextPart,
976
+ AgentToolArtifact,
977
+ AgentToolArtifactPutInput,
978
+ AgentToolArtifacts,
971
979
  AgentToolCallPart,
972
980
  AgentToolCallState,
981
+ AgentToolContent,
973
982
  AgentToolDefinition,
974
983
  AgentToolDescriptionBuilder,
984
+ AgentToolFileContent,
975
985
  AgentToolHandler,
976
986
  AgentToolHandlerResult,
977
987
  AgentToolInputBuilder,
978
988
  AgentToolInputSchema,
989
+ AgentToolResult,
990
+ AgentToolResultFileResolverInput,
979
991
  AgentToolRunBuilder,
980
992
  AgentToolRunContext,
981
993
  AgentToolRunInfo,
994
+ AgentToolTextContent,
982
995
  AgentUiMessage,
983
996
  AgentUiMessagePart,
984
997
  AgentUiToolPart,
@@ -1004,6 +1017,15 @@ export {
1004
1017
  requestAgentRun,
1005
1018
  } from "./agents"
1006
1019
 
1020
+ // ── Models ──────────────────────────────────────────────────
1021
+
1022
+ export type {
1023
+ LanguageModelCatalog,
1024
+ LanguageModelEntry,
1025
+ ModelCatalog,
1026
+ ModelCatalogInput,
1027
+ } from "./models"
1028
+
1007
1029
  // ── Scheduling ──────────────────────────────────────────────
1008
1030
 
1009
1031
  export { CronValidationError } from "./schedules"
@@ -1014,13 +1036,18 @@ export type {
1014
1036
  ForeignKeyDescriptor,
1015
1037
  LinkProjectionDefinition,
1016
1038
  LinkProjectionTarget,
1039
+ ObjectProjectionBuilder,
1040
+ ObjectProjectionConflictResolution,
1017
1041
  ObjectProjectionDefinition,
1018
1042
  ObjectProjectionTarget,
1019
1043
  ProjectionDefinition,
1020
1044
  ProjectionDefinitionCatalog,
1045
+ ProjectionForeignKeyInput,
1021
1046
  ProjectionTarget,
1022
1047
  ProjectionTargetByKind,
1048
+ SourceEditConflictResolution,
1023
1049
  TelemetryProjectionDefinition,
1050
+ TelemetryProjectionPropertyMapping,
1024
1051
  } from "./projections"
1025
1052
 
1026
1053
  export {
@@ -84,7 +84,8 @@ export interface DatasetWriteCommitResult extends DatasetVersion {
84
84
  * report `unchanged` and reuse it for commits that cannot change visible
85
85
  * dataset content: a snapshot whose rows equal the latest visible rows
86
86
  * (order-insensitive, with equal duplicate counts), or an append of zero
87
- * rows.
87
+ * rows. Without a latest version, an empty snapshot or append still creates
88
+ * the first addressable dataset version.
88
89
  */
89
90
  readonly outcome: "created" | "unchanged"
90
91
  }
@@ -152,6 +152,10 @@ export type ProjectionSourceAssertion =
152
152
  readonly kind: "object"
153
153
  readonly ref: OntologyObjectRef
154
154
  readonly properties: Readonly<Record<string, JsonValue>>
155
+ /** Canonical source-system update time. Presence after validation pins `mostRecent`. */
156
+ readonly sourceUpdatedAt?: string
157
+ /** Projected properties represented by an absence candidate in this source row. */
158
+ readonly absentSourcePropertyIds?: readonly string[]
155
159
  }
156
160
  | {
157
161
  readonly kind: "link"
@@ -25,6 +25,8 @@ interface ObjectEditInput {
25
25
  readonly operation: ObjectEditOperation
26
26
  readonly sourceProperties: Readonly<Record<string, JsonValue>> | null
27
27
  readonly authority: ObjectOverride | null
28
+ readonly editedAt: Readonly<Record<string, string>>
29
+ readonly committedAt: string
28
30
  readonly effectiveExists: boolean
29
31
  readonly normalizedProperties?: Readonly<Record<string, JsonValue>>
30
32
  readonly normalizedSet?: Readonly<Record<string, JsonValue>>
@@ -43,7 +45,11 @@ export interface AuthorityTransition<T> {
43
45
  readonly changed: boolean
44
46
  }
45
47
 
46
- export function applyObjectEdit(input: ObjectEditInput): AuthorityTransition<ObjectOverride> {
48
+ export interface ObjectAuthorityTransition extends AuthorityTransition<ObjectOverride> {
49
+ readonly editedAt: Readonly<Record<string, string>>
50
+ }
51
+
52
+ export function applyObjectEdit(input: ObjectEditInput): ObjectAuthorityTransition {
47
53
  const current = input.authority
48
54
  let next: ObjectOverride | null
49
55
 
@@ -67,7 +73,54 @@ export function applyObjectEdit(input: ObjectEditInput): AuthorityTransition<Obj
67
73
  throw new MaterializationValidationError("Expected an object edit operation.")
68
74
  }
69
75
 
70
- return transition(current, next)
76
+ const editedAt = applyObjectEditTimes(input, next)
77
+ const authority = transition(current, next)
78
+ return {
79
+ ...authority,
80
+ editedAt,
81
+ changed: authority.changed || !sameStringRecord(input.editedAt, editedAt),
82
+ }
83
+ }
84
+
85
+ function applyObjectEditTimes(
86
+ input: ObjectEditInput,
87
+ next: ObjectOverride | null
88
+ ): Readonly<Record<string, string>> {
89
+ if (!next || next.kind === "delete") return {}
90
+ const editedAt =
91
+ input.operation.kind === "object.create" || input.authority?.kind === "delete"
92
+ ? {}
93
+ : { ...input.editedAt }
94
+
95
+ switch (input.operation.kind) {
96
+ case "object.create":
97
+ case "object.upsert": {
98
+ const properties = input.normalizedProperties ?? input.operation.properties
99
+ for (const propertyId of Object.keys(properties)) editedAt[propertyId] = input.committedAt
100
+ break
101
+ }
102
+ case "object.patch":
103
+ for (const propertyId of input.operation.reset) delete editedAt[propertyId]
104
+ for (const propertyId of input.operation.unset) editedAt[propertyId] = input.committedAt
105
+ for (const propertyId of Object.keys(input.normalizedSet ?? input.operation.set)) {
106
+ editedAt[propertyId] = input.committedAt
107
+ }
108
+ break
109
+ case "object.delete":
110
+ return editedAt
111
+ case "object.restore":
112
+ break
113
+ }
114
+ return editedAt
115
+ }
116
+
117
+ function sameStringRecord(
118
+ left: Readonly<Record<string, string>>,
119
+ right: Readonly<Record<string, string>>
120
+ ): boolean {
121
+ const leftKeys = Object.keys(left)
122
+ if (leftKeys.length !== Object.keys(right).length) return false
123
+ return leftKeys.every((key) => left[key] === right[key])
71
124
  }
72
125
 
73
126
  function applyObjectCreate(