@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
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ resolveSemanticType
4
+ } from "./chunk-rnshztfq.js";
2
5
  import {
3
6
  createSixbError
4
7
  } from "./chunk-0172wgm9.js";
@@ -615,12 +618,10 @@ function computeProjectionOwnership(projection, ontology) {
615
618
  return freezeOwnership({
616
619
  objects: [],
617
620
  links: [],
618
- telemetry: [
619
- {
620
- objectTypeId: projection.objectTypeId,
621
- propertyId: projection.propertyId
622
- }
623
- ]
621
+ telemetry: Object.keys(projection.properties).sort(compareStrings).map((propertyId) => ({
622
+ objectTypeId: projection.objectTypeId,
623
+ propertyId
624
+ }))
624
625
  });
625
626
  }
626
627
  function validateProjectionOwnership(projections) {
@@ -735,26 +736,48 @@ function validateLinkProjectionTarget(linkToken) {
735
736
  throw new ProjectionValidationError(`Link '${linkToken.id}' has a wildcard target. ` + `Link projection of wildcard links is not supported.`);
736
737
  }
737
738
  }
738
- function validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, prefix) {
739
- const property = objectType.properties.find((candidate) => candidate.id === projection.propertyId);
740
- if (!property) {
741
- throw new ProjectionValidationError(`${prefix}: unknown property "${projection.propertyId}" on type "${projection.objectTypeId}"`);
742
- }
743
- if (property.mode !== "telemetry") {
744
- throw new ProjectionValidationError(`${prefix}: property "${projection.propertyId}" on type "${projection.objectTypeId}" must be telemetry-enabled`);
739
+ function validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, valueTypesById, prefix) {
740
+ const mappedProperties = Object.entries(projection.properties);
741
+ if (mappedProperties.length === 0) {
742
+ throw new ProjectionValidationError(`${prefix}: must map at least one telemetry property`);
745
743
  }
746
744
  const mappedFields = [
747
745
  ["objectId", projection.objectIdField],
748
- ["at", projection.atField],
749
- ["value", projection.valueField],
750
- ...projection.unitField !== undefined ? [["unit", projection.unitField]] : []
746
+ ["at", projection.atField]
751
747
  ];
752
748
  for (const [fieldRole, columnName] of mappedFields) {
753
749
  if (!datasetColumnNames.has(columnName)) {
754
750
  throw new ProjectionValidationError(`${prefix}: ${fieldRole} field "${columnName}" references unknown dataset column ` + `on dataset "${projection.datasetId}"`);
755
751
  }
756
752
  }
757
- return property;
753
+ const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
754
+ const resolvedProperties = new Map;
755
+ for (const [propertyId, mapping] of mappedProperties) {
756
+ const property = propertiesById.get(propertyId);
757
+ if (!property) {
758
+ throw new ProjectionValidationError(`${prefix}: unknown property "${propertyId}" on type "${projection.objectTypeId}"`);
759
+ }
760
+ if (property.mode !== "telemetry") {
761
+ throw new ProjectionValidationError(`${prefix}: property "${propertyId}" on type "${projection.objectTypeId}" must be telemetry-enabled`);
762
+ }
763
+ for (const [fieldRole, columnName] of [
764
+ ["value", mapping.valueField],
765
+ ...mapping.unitField !== undefined ? [["unit", mapping.unitField]] : []
766
+ ]) {
767
+ if (!datasetColumnNames.has(columnName)) {
768
+ throw new ProjectionValidationError(`${prefix}: property "${propertyId}" ${fieldRole} field "${columnName}" references ` + `unknown dataset column on dataset "${projection.datasetId}"`);
769
+ }
770
+ }
771
+ const semanticType = resolveSemanticType(property, valueTypesById);
772
+ if (semanticType !== undefined && mapping.unitField === undefined) {
773
+ throw new ProjectionValidationError(`${prefix}: property "${propertyId}" requires a unit field because it uses semantic type "${semanticType}"`);
774
+ }
775
+ if (semanticType === undefined && mapping.unitField !== undefined) {
776
+ throw new ProjectionValidationError(`${prefix}: property "${propertyId}" cannot map a unit field because it has no semantic type`);
777
+ }
778
+ resolvedProperties.set(propertyId, property);
779
+ }
780
+ return resolvedProperties;
758
781
  }
759
782
  function validateProjectionsAtStartup(projections, ontology, datasetsById) {
760
783
  const { objectProjections, linkProjections, telemetryProjections } = projections;
@@ -775,6 +798,19 @@ function validateProjectionsAtStartup(projections, ontology, datasetsById) {
775
798
  throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
776
799
  }
777
800
  const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
801
+ const conflictResolution = projection.conflictResolution ?? { strategy: "editsWin" };
802
+ if (conflictResolution.strategy === "mostRecent") {
803
+ const sourceTimestamp = dataset.schema.columns.find((column) => column.name === conflictResolution.sourceTimestamp);
804
+ if (!sourceTimestamp) {
805
+ throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" references unknown ` + `dataset column on dataset "${projection.datasetId}"`);
806
+ }
807
+ if (sourceTimestamp.type !== "timestamp") {
808
+ throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `timestamp dataset column`);
809
+ }
810
+ if (sourceTimestamp.nullable === true) {
811
+ throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `non-null timestamp dataset column`);
812
+ }
813
+ }
778
814
  const propertyIds = new Set(objectType.properties.map((p) => p.id));
779
815
  for (const [propId, columnName] of Object.entries(projection.properties)) {
780
816
  if (!propertyIds.has(propId)) {
@@ -884,7 +920,7 @@ function validateProjectionsAtStartup(projections, ontology, datasetsById) {
884
920
  throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
885
921
  }
886
922
  const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
887
- validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, prefix);
923
+ validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, ontology.getValueTypesById(), prefix);
888
924
  validatedTelemetryProjections.push({
889
925
  definition: projection,
890
926
  dataset,
@@ -952,9 +988,9 @@ function defineProjection(id, target) {
952
988
  return buildLinkProjection(id, target);
953
989
  if ("property" in target)
954
990
  return buildTelemetryProjection(id, target);
955
- return buildObjectProjection(id, target);
991
+ return buildObjectTypeProjection(id, target);
956
992
  }
957
- function buildObjectProjection(id, objectType) {
993
+ function buildObjectTypeProjection(id, objectType) {
958
994
  assertNonEmpty2(id, "id");
959
995
  return {
960
996
  fromDataset(dataset) {
@@ -964,33 +1000,61 @@ function buildObjectProjection(id, objectType) {
964
1000
  properties(mapping) {
965
1001
  const propertyMapping = mapping;
966
1002
  validatePropertyMapping(objectType, propertyMapping);
967
- const definition = {
968
- _tag: "ObjectProjectionDefinition",
1003
+ return objectProjectionBuilder({
1004
+ id,
1005
+ objectType,
1006
+ datasetId,
1007
+ propertyMapping,
1008
+ links: {},
1009
+ conflictResolution: { strategy: "editsWin" }
1010
+ });
1011
+ },
1012
+ points(mapping) {
1013
+ const pointMapping = lowerTelemetryPropertiesPointMapping(objectType, mapping);
1014
+ return {
1015
+ _tag: "TelemetryProjectionDefinition",
969
1016
  id,
970
1017
  objectTypeId: objectType.id,
971
1018
  datasetId,
972
- properties: { ...propertyMapping },
973
- links: {}
1019
+ objectIdField: pointMapping.objectId,
1020
+ atField: pointMapping.at,
1021
+ properties: pointMapping.properties
974
1022
  };
975
- return Object.assign(definition, {
976
- withLinks(linkMapping) {
977
- const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
978
- const validatedLinks = validateAndLowerLinkMapping(objectType, loweredLinkMapping, propertyMapping);
979
- return {
980
- _tag: "ObjectProjectionDefinition",
981
- id,
982
- objectTypeId: objectType.id,
983
- datasetId,
984
- properties: { ...propertyMapping },
985
- links: validatedLinks
986
- };
987
- }
988
- });
989
1023
  }
990
1024
  };
991
1025
  }
992
1026
  };
993
1027
  }
1028
+ function objectProjectionBuilder(input) {
1029
+ const definition = {
1030
+ _tag: "ObjectProjectionDefinition",
1031
+ id: input.id,
1032
+ objectTypeId: input.objectType.id,
1033
+ datasetId: input.datasetId,
1034
+ properties: { ...input.propertyMapping },
1035
+ links: { ...input.links },
1036
+ conflictResolution: { ...input.conflictResolution }
1037
+ };
1038
+ return Object.assign(definition, {
1039
+ withLinks(linkMapping) {
1040
+ const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
1041
+ const validatedLinks = validateAndLowerLinkMapping(input.objectType, loweredLinkMapping, input.propertyMapping);
1042
+ return objectProjectionBuilder({ ...input, links: validatedLinks });
1043
+ },
1044
+ resolveConflicts(resolution) {
1045
+ validateConflictResolution(resolution);
1046
+ return objectProjectionBuilder({
1047
+ ...input,
1048
+ conflictResolution: resolution
1049
+ });
1050
+ }
1051
+ });
1052
+ }
1053
+ function validateConflictResolution(resolution) {
1054
+ if (resolution.strategy === "editsWin")
1055
+ return;
1056
+ assertNonEmpty2(resolution.sourceTimestamp, "source timestamp field");
1057
+ }
994
1058
  function buildTelemetryProjection(id, propertyToken) {
995
1059
  assertNonEmpty2(id, "id");
996
1060
  validateTelemetryProjectionProperty(propertyToken);
@@ -1005,12 +1069,15 @@ function buildTelemetryProjection(id, propertyToken) {
1005
1069
  _tag: "TelemetryProjectionDefinition",
1006
1070
  id,
1007
1071
  objectTypeId: propertyToken.objectTypeId,
1008
- propertyId: propertyToken.id,
1009
1072
  datasetId,
1010
1073
  objectIdField: pointMapping.objectId,
1011
1074
  atField: pointMapping.at,
1012
- valueField: pointMapping.value,
1013
- ...pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}
1075
+ properties: {
1076
+ [propertyToken.id]: {
1077
+ valueField: pointMapping.value,
1078
+ ...pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}
1079
+ }
1080
+ }
1014
1081
  };
1015
1082
  }
1016
1083
  };
@@ -1051,6 +1118,69 @@ function lowerTelemetryPointMapping(mapping) {
1051
1118
  ...mapping.unit !== undefined ? { unit: mapping.unit } : {}
1052
1119
  };
1053
1120
  }
1121
+ function lowerTelemetryPropertiesPointMapping(objectType, mapping) {
1122
+ const allowedKeys = new Set(["objectId", "at", "properties"]);
1123
+ for (const key of Object.keys(mapping)) {
1124
+ if (!allowedKeys.has(key)) {
1125
+ throw new ProjectionValidationError(`Telemetry projection point mapping contains unknown key '${key}'.`);
1126
+ }
1127
+ }
1128
+ if (mapping.objectId === undefined) {
1129
+ throw new ProjectionValidationError("Telemetry projection point mapping requires objectId.");
1130
+ }
1131
+ if (mapping.at === undefined) {
1132
+ throw new ProjectionValidationError("Telemetry projection point mapping requires at.");
1133
+ }
1134
+ if (mapping.properties === undefined) {
1135
+ throw new ProjectionValidationError("Telemetry projection point mapping requires properties.");
1136
+ }
1137
+ if (!isRecord(mapping.properties)) {
1138
+ throw new ProjectionValidationError("Telemetry projection point mapping properties must be an object.");
1139
+ }
1140
+ assertNonEmpty2(mapping.objectId, "objectId field");
1141
+ assertNonEmpty2(mapping.at, "at field");
1142
+ const propertyEntries = Object.entries(mapping.properties);
1143
+ if (propertyEntries.length === 0) {
1144
+ throw new ProjectionValidationError("Telemetry projection point mapping requires at least one property.");
1145
+ }
1146
+ const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
1147
+ const properties = {};
1148
+ for (const [propertyId, input] of propertyEntries) {
1149
+ const property = propertiesById.get(propertyId);
1150
+ if (!property) {
1151
+ throw new ProjectionValidationError(`Property '${propertyId}' does not exist on object type '${objectType.id}'.`);
1152
+ }
1153
+ if (property.mode !== "telemetry") {
1154
+ throw new ProjectionValidationError(`Projection property '${objectType.id}.${propertyId}' must be telemetry-enabled.`);
1155
+ }
1156
+ properties[propertyId] = lowerTelemetryPropertyMapping(propertyId, input);
1157
+ }
1158
+ return { objectId: mapping.objectId, at: mapping.at, properties };
1159
+ }
1160
+ function lowerTelemetryPropertyMapping(propertyId, input) {
1161
+ if (typeof input === "string") {
1162
+ assertNonEmpty2(input, `property '${propertyId}' value field`);
1163
+ return { valueField: input };
1164
+ }
1165
+ if (!isRecord(input)) {
1166
+ throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' must map a value column or value/unit columns.`);
1167
+ }
1168
+ const allowedKeys = new Set(["value", "unit"]);
1169
+ for (const key of Object.keys(input)) {
1170
+ if (!allowedKeys.has(key)) {
1171
+ throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' contains unknown key '${key}'.`);
1172
+ }
1173
+ }
1174
+ if (typeof input.value !== "string") {
1175
+ throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a value field.`);
1176
+ }
1177
+ if (typeof input.unit !== "string") {
1178
+ throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a unit field.`);
1179
+ }
1180
+ assertNonEmpty2(input.value, `property '${propertyId}' value field`);
1181
+ assertNonEmpty2(input.unit, `property '${propertyId}' unit field`);
1182
+ return { valueField: input.value, unitField: input.unit };
1183
+ }
1054
1184
  function fromForeignKey(input) {
1055
1185
  validateLinkProjectionTarget(input.link);
1056
1186
  if (input.sourceProperty) {
@@ -1103,7 +1233,16 @@ function buildLinkProjection(id, linkToken) {
1103
1233
  function isObjectProjectionDefinition(value) {
1104
1234
  if (!isRecord(value))
1105
1235
  return false;
1106
- return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links);
1236
+ return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links) && isSourceEditConflictResolution(value.conflictResolution);
1237
+ }
1238
+ function isSourceEditConflictResolution(value) {
1239
+ if (value === undefined)
1240
+ return true;
1241
+ if (!isRecord(value) || typeof value.strategy !== "string")
1242
+ return false;
1243
+ if (value.strategy === "editsWin")
1244
+ return value.sourceTimestamp === undefined;
1245
+ return value.strategy === "mostRecent" && typeof value.sourceTimestamp === "string";
1107
1246
  }
1108
1247
  function isLinkProjectionDefinition(value) {
1109
1248
  if (!isRecord(value))
@@ -1113,7 +1252,12 @@ function isLinkProjectionDefinition(value) {
1113
1252
  function isTelemetryProjectionDefinition(value) {
1114
1253
  if (!isRecord(value))
1115
1254
  return false;
1116
- return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.propertyId === "string" && typeof value.datasetId === "string" && typeof value.objectIdField === "string" && typeof value.atField === "string" && typeof value.valueField === "string" && (value.unitField === undefined || typeof value.unitField === "string");
1255
+ return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && typeof value.objectIdField === "string" && typeof value.atField === "string" && isTelemetryProjectionProperties(value.properties);
1256
+ }
1257
+ function isTelemetryProjectionProperties(value) {
1258
+ if (!isRecord(value) || Object.keys(value).length === 0)
1259
+ return false;
1260
+ return Object.values(value).every((mapping) => isRecord(mapping) && typeof mapping.valueField === "string" && (mapping.unitField === undefined || typeof mapping.unitField === "string"));
1117
1261
  }
1118
1262
  function isProjectionDefinition(value) {
1119
1263
  return isObjectProjectionDefinition(value) || isLinkProjectionDefinition(value) || isTelemetryProjectionDefinition(value);
@@ -1165,4 +1309,4 @@ function emptyGrantIndex() {
1165
1309
  }
1166
1310
  export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, GRANT_KINDS, grantKindOf, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, getAuthorizationRef, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
1167
1311
 
1168
- //# debugId=EA88C5F91530A04564756E2164756E21
1312
+ //# debugId=48D20BF42F9CD3F464756E2164756E21