@sixb/core 0.1.3 → 0.1.5

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 (271) hide show
  1. package/dist/actions/index.d.ts +2 -2
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +17 -18
  4. package/dist/actions/index.js.map +1 -1
  5. package/dist/actions/read-facade.d.ts +10 -2
  6. package/dist/actions/read-facade.d.ts.map +1 -1
  7. package/dist/actions/types/context.d.ts +45 -2
  8. package/dist/actions/types/context.d.ts.map +1 -1
  9. package/dist/actions/worker.js +4 -4
  10. package/dist/actions/worker.js.map +1 -1
  11. package/dist/agents/context-compaction.d.ts +40 -0
  12. package/dist/agents/context-compaction.d.ts.map +1 -0
  13. package/dist/agents/ids.d.ts +2 -0
  14. package/dist/agents/ids.d.ts.map +1 -1
  15. package/dist/agents/index.d.ts +6 -5
  16. package/dist/agents/index.d.ts.map +1 -1
  17. package/dist/agents/index.js +42 -37
  18. package/dist/agents/index.js.map +1 -1
  19. package/dist/agents/streams.d.ts +17 -1
  20. package/dist/agents/streams.d.ts.map +1 -1
  21. package/dist/agents/streams.js +4 -2
  22. package/dist/agents/streams.js.map +1 -1
  23. package/dist/agents/types.d.ts +11 -0
  24. package/dist/agents/types.d.ts.map +1 -1
  25. package/dist/agents/validation.d.ts +1 -1
  26. package/dist/agents/validation.d.ts.map +1 -1
  27. package/dist/auth/index.js +7 -3
  28. package/dist/auth/index.js.map +1 -1
  29. package/dist/authorization/index.js +6 -2
  30. package/dist/authorization/index.js.map +1 -1
  31. package/dist/bootstrap/index.js +30 -31
  32. package/dist/bootstrap/index.js.map +1 -1
  33. package/dist/{chunk-d6y2wsfg.js → chunk-1q02e95s.js} +12 -7
  34. package/dist/{chunk-d6y2wsfg.js.map → chunk-1q02e95s.js.map} +4 -3
  35. package/dist/{chunk-c6cfqydk.js → chunk-4h947jd8.js} +1 -1
  36. package/dist/{chunk-gqdd7508.js → chunk-4rh2m6zg.js} +1 -1
  37. package/dist/{chunk-f1cyvnrk.js → chunk-6d5xdj1q.js} +259 -9
  38. package/dist/chunk-6d5xdj1q.js.map +14 -0
  39. package/dist/{chunk-fmx1sz2h.js → chunk-72q2y8hn.js} +3 -3
  40. package/dist/{chunk-fmx1sz2h.js.map → chunk-72q2y8hn.js.map} +3 -3
  41. package/dist/{chunk-ttba8x6z.js → chunk-78c6xvyr.js} +68 -3
  42. package/dist/chunk-78c6xvyr.js.map +15 -0
  43. package/dist/{chunk-wb4051cx.js → chunk-819wnjz8.js} +11 -5
  44. package/dist/chunk-819wnjz8.js.map +12 -0
  45. package/dist/{chunk-177ed2mp.js → chunk-84h6qhmp.js} +233 -97
  46. package/dist/{chunk-177ed2mp.js.map → chunk-84h6qhmp.js.map} +9 -9
  47. package/dist/{chunk-pxtrxm3p.js → chunk-a09jx26t.js} +1 -1
  48. package/dist/{chunk-bv41fmjn.js → chunk-am6eczah.js} +59 -22
  49. package/dist/{chunk-bv41fmjn.js.map → chunk-am6eczah.js.map} +8 -7
  50. package/dist/{chunk-zpw39qhj.js → chunk-dm72y8wt.js} +25 -2
  51. package/dist/chunk-dm72y8wt.js.map +10 -0
  52. package/dist/{chunk-kqxgf6kv.js → chunk-drjqm1aa.js} +16 -1
  53. package/dist/{chunk-kqxgf6kv.js.map → chunk-drjqm1aa.js.map} +3 -3
  54. package/dist/chunk-dysw7nsm.js.map +1 -1
  55. package/dist/{chunk-4p9rh7jj.js → chunk-ea73pzk7.js} +1 -1
  56. package/dist/{chunk-4aw0jwk0.js → chunk-f6erf2vv.js} +1 -1
  57. package/dist/{chunk-4z3n1dzt.js → chunk-f83ka50g.js} +131 -25
  58. package/dist/chunk-f83ka50g.js.map +23 -0
  59. package/dist/{chunk-c8bw2b6c.js → chunk-gadsm794.js} +2 -2
  60. package/dist/{chunk-1ywq4hzk.js → chunk-h6h91mfy.js} +8 -10
  61. package/dist/{chunk-1ywq4hzk.js.map → chunk-h6h91mfy.js.map} +2 -2
  62. package/dist/{chunk-n5x5y80a.js → chunk-nzw7sm3b.js} +2 -2
  63. package/dist/{chunk-63te770v.js → chunk-qewtks41.js} +8 -8
  64. package/dist/{chunk-63te770v.js.map → chunk-qewtks41.js.map} +2 -2
  65. package/dist/{chunk-261ag4t4.js → chunk-r0rry8dn.js} +3 -3
  66. package/dist/{chunk-88ppkr54.js → chunk-rte5sm3z.js} +26 -2
  67. package/dist/chunk-rte5sm3z.js.map +12 -0
  68. package/dist/chunk-t0jjkep3.js.map +1 -1
  69. package/dist/{chunk-ettb0cy4.js → chunk-tbv03sx2.js} +59 -29
  70. package/dist/{chunk-ettb0cy4.js.map → chunk-tbv03sx2.js.map} +5 -5
  71. package/dist/{chunk-d2adj15j.js → chunk-tkdscva6.js} +1 -1
  72. package/dist/{chunk-xmggaxg4.js → chunk-v0egge8b.js} +201 -38
  73. package/dist/{chunk-xmggaxg4.js.map → chunk-v0egge8b.js.map} +8 -6
  74. package/dist/{chunk-z8j83gzd.js → chunk-x2yw73hy.js} +1 -1
  75. package/dist/{chunk-qer6am8w.js → chunk-xdf9yswn.js} +1 -1
  76. package/dist/{chunk-3rsf30p4.js → chunk-z3ga9q5m.js} +18 -21
  77. package/dist/{chunk-3rsf30p4.js.map → chunk-z3ga9q5m.js.map} +4 -5
  78. package/dist/{chunk-km4rkj4t.js → chunk-zp2v2rv6.js} +3 -3
  79. package/dist/execution/agent.js +26 -27
  80. package/dist/execution/agent.js.map +1 -1
  81. package/dist/execution/primitive.js +26 -27
  82. package/dist/execution/primitive.js.map +2 -2
  83. package/dist/execution/request.js +27 -28
  84. package/dist/execution/request.js.map +2 -2
  85. package/dist/http/index.js +1 -1
  86. package/dist/index.d.ts +6 -5
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +54 -55
  89. package/dist/index.js.map +1 -1
  90. package/dist/lake-storage/types.d.ts +2 -1
  91. package/dist/lake-storage/types.d.ts.map +1 -1
  92. package/dist/materializer/index.js +15 -16
  93. package/dist/materializer/index.js.map +1 -1
  94. package/dist/models/index.d.ts +40 -0
  95. package/dist/models/index.d.ts.map +1 -0
  96. package/dist/objects/execution.d.ts +6 -1
  97. package/dist/objects/execution.d.ts.map +1 -1
  98. package/dist/objects/index.js +19 -20
  99. package/dist/objects/index.js.map +1 -1
  100. package/dist/objects/link/endpoints.d.ts.map +1 -1
  101. package/dist/objects/query/executor.d.ts +1 -0
  102. package/dist/objects/query/executor.d.ts.map +1 -1
  103. package/dist/objects/query/explain.d.ts +1 -0
  104. package/dist/objects/query/explain.d.ts.map +1 -1
  105. package/dist/objects/query/index.d.ts +3 -1
  106. package/dist/objects/query/index.d.ts.map +1 -1
  107. package/dist/objects/query/index.js +30 -5
  108. package/dist/objects/query/index.js.map +1 -1
  109. package/dist/objects/query/ir.d.ts +14 -1
  110. package/dist/objects/query/ir.d.ts.map +1 -1
  111. package/dist/objects/query/links.d.ts +25 -0
  112. package/dist/objects/query/links.d.ts.map +1 -0
  113. package/dist/objects/query/normalize.d.ts.map +1 -1
  114. package/dist/objects/query/planner.d.ts.map +1 -1
  115. package/dist/objects/query/validate.d.ts +1 -0
  116. package/dist/objects/query/validate.d.ts.map +1 -1
  117. package/dist/ontology/internal.d.ts +1 -1
  118. package/dist/ontology/internal.d.ts.map +1 -1
  119. package/dist/ontology/internal.js +14 -6
  120. package/dist/ontology/internal.js.map +3 -3
  121. package/dist/ontology/json-schema.d.ts +10 -0
  122. package/dist/ontology/json-schema.d.ts.map +1 -1
  123. package/dist/pipelines/index.js +15 -16
  124. package/dist/pipelines/index.js.map +1 -1
  125. package/dist/projections/builders.d.ts +33 -4
  126. package/dist/projections/builders.d.ts.map +1 -1
  127. package/dist/projections/index.d.ts +1 -1
  128. package/dist/projections/index.d.ts.map +1 -1
  129. package/dist/projections/internal.js +15 -16
  130. package/dist/projections/internal.js.map +1 -1
  131. package/dist/projections/run-dispatch.d.ts +1 -0
  132. package/dist/projections/run-dispatch.d.ts.map +1 -1
  133. package/dist/projections/types.d.ts +12 -9
  134. package/dist/projections/types.d.ts.map +1 -1
  135. package/dist/projections/validation.d.ts +6 -5
  136. package/dist/projections/validation.d.ts.map +1 -1
  137. package/dist/query.d.ts +2 -1
  138. package/dist/query.d.ts.map +1 -1
  139. package/dist/query.js +2 -2
  140. package/dist/runtime/create.d.ts +3 -0
  141. package/dist/runtime/create.d.ts.map +1 -1
  142. package/dist/runtime/definitions.d.ts +3 -0
  143. package/dist/runtime/definitions.d.ts.map +1 -1
  144. package/dist/runtime/host.d.ts +2 -0
  145. package/dist/runtime/host.d.ts.map +1 -1
  146. package/dist/runtime/resolve-definitions.d.ts +2 -0
  147. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  148. package/dist/storage/agents/in-memory.d.ts +4 -0
  149. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  150. package/dist/storage/agents/provider.js +9 -5
  151. package/dist/storage/agents/provider.js.map +1 -1
  152. package/dist/storage/agents/types.d.ts +5 -0
  153. package/dist/storage/agents/types.d.ts.map +1 -1
  154. package/dist/storage/ai-cost/provider.js +1 -1
  155. package/dist/storage/ai-usage/in-memory.d.ts +2 -1
  156. package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
  157. package/dist/storage/ai-usage/index.d.ts +1 -1
  158. package/dist/storage/ai-usage/index.d.ts.map +1 -1
  159. package/dist/storage/ai-usage/types.d.ts +6 -0
  160. package/dist/storage/ai-usage/types.d.ts.map +1 -1
  161. package/dist/storage/index.d.ts +3 -2
  162. package/dist/storage/index.d.ts.map +1 -1
  163. package/dist/storage/index.js +19 -14
  164. package/dist/storage/index.js.map +1 -1
  165. package/dist/storage/objects/in-memory.d.ts +6 -3
  166. package/dist/storage/objects/in-memory.d.ts.map +1 -1
  167. package/dist/storage/objects/index.d.ts +3 -1
  168. package/dist/storage/objects/index.d.ts.map +1 -1
  169. package/dist/storage/objects/keys.d.ts +16 -0
  170. package/dist/storage/objects/keys.d.ts.map +1 -0
  171. package/dist/storage/objects/types.d.ts +33 -6
  172. package/dist/storage/objects/types.d.ts.map +1 -1
  173. package/dist/storage/ontology/provider.js +1 -1
  174. package/dist/storage/workflow-runs/provider.js +9 -5
  175. package/dist/storage/workflow-runs/provider.js.map +1 -1
  176. package/dist/syncs/index.js +15 -16
  177. package/dist/syncs/index.js.map +1 -1
  178. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  179. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
  180. package/dist/testing/effective-storage-contract.d.ts +1 -1
  181. package/dist/testing/effective-storage-contract.d.ts.map +1 -1
  182. package/dist/testing/index.js +455 -40
  183. package/dist/testing/index.js.map +7 -7
  184. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  185. package/dist/testing/object-query-contract.d.ts +1 -1
  186. package/dist/testing/object-query-contract.d.ts.map +1 -1
  187. package/dist/webhooks/internal.js +13 -14
  188. package/dist/webhooks/internal.js.map +2 -2
  189. package/dist/workflows/index.js +27 -28
  190. package/dist/workflows/index.js.map +1 -1
  191. package/package.json +1 -1
  192. package/src/actions/index.ts +10 -1
  193. package/src/actions/read-facade.ts +125 -3
  194. package/src/actions/types/context.ts +69 -2
  195. package/src/agents/builders.ts +3 -3
  196. package/src/agents/context-compaction.ts +261 -0
  197. package/src/agents/ids.ts +5 -0
  198. package/src/agents/index.ts +18 -9
  199. package/src/agents/streams.ts +56 -0
  200. package/src/agents/types.ts +12 -0
  201. package/src/agents/validation.ts +39 -5
  202. package/src/http/api-routes.ts +7 -7
  203. package/src/index.ts +19 -0
  204. package/src/lake-storage/types.ts +2 -1
  205. package/src/materializer/telemetry/append.ts +33 -16
  206. package/src/models/index.ts +71 -0
  207. package/src/objects/execution.ts +20 -0
  208. package/src/objects/link/endpoints.ts +2 -1
  209. package/src/objects/query/executor.ts +42 -11
  210. package/src/objects/query/explain.ts +11 -0
  211. package/src/objects/query/index.ts +6 -0
  212. package/src/objects/query/ir.ts +16 -0
  213. package/src/objects/query/links.ts +308 -0
  214. package/src/objects/query/normalize.ts +40 -1
  215. package/src/objects/query/planner.ts +5 -0
  216. package/src/objects/query/validate.ts +58 -2
  217. package/src/ontology/internal.ts +1 -1
  218. package/src/ontology/json-schema.ts +27 -5
  219. package/src/projections/builders.ts +220 -15
  220. package/src/projections/index.ts +1 -0
  221. package/src/projections/ownership.ts +5 -5
  222. package/src/projections/registry.ts +9 -3
  223. package/src/projections/revision.ts +31 -5
  224. package/src/projections/run-dispatch.ts +10 -1
  225. package/src/projections/types.ts +13 -9
  226. package/src/projections/validation.ts +61 -19
  227. package/src/query.ts +2 -0
  228. package/src/runtime/create.ts +4 -0
  229. package/src/runtime/definitions.ts +3 -0
  230. package/src/runtime/host.ts +2 -0
  231. package/src/runtime/resolve-definitions.ts +28 -0
  232. package/src/storage/agents/in-memory.ts +15 -0
  233. package/src/storage/agents/types.ts +5 -0
  234. package/src/storage/ai-usage/in-memory.ts +23 -0
  235. package/src/storage/ai-usage/index.ts +1 -0
  236. package/src/storage/ai-usage/types.ts +10 -0
  237. package/src/storage/index.ts +11 -0
  238. package/src/storage/objects/in-memory.ts +103 -16
  239. package/src/storage/objects/index.ts +9 -0
  240. package/src/storage/objects/keys.ts +36 -0
  241. package/src/storage/objects/types.ts +34 -6
  242. package/src/storage/ontology/provider-header-validation.ts +2 -2
  243. package/src/storage/timeseries/store.ts +6 -6
  244. package/src/testing/agent-storage-contract.ts +12 -0
  245. package/src/testing/ai-usage-storage-contract.ts +35 -0
  246. package/src/testing/effective-storage-contract.ts +194 -4
  247. package/src/testing/lake-storage-contract.ts +56 -0
  248. package/src/testing/object-query-contract.ts +208 -1
  249. package/dist/agents/prompt.d.ts +0 -21
  250. package/dist/agents/prompt.d.ts.map +0 -1
  251. package/dist/chunk-4z3n1dzt.js.map +0 -23
  252. package/dist/chunk-6wetht33.js +0 -89
  253. package/dist/chunk-6wetht33.js.map +0 -10
  254. package/dist/chunk-88ppkr54.js.map +0 -12
  255. package/dist/chunk-f1cyvnrk.js.map +0 -13
  256. package/dist/chunk-ttba8x6z.js.map +0 -15
  257. package/dist/chunk-wb4051cx.js.map +0 -12
  258. package/dist/chunk-zpw39qhj.js.map +0 -10
  259. package/src/agents/prompt.ts +0 -85
  260. /package/dist/{chunk-c6cfqydk.js.map → chunk-4h947jd8.js.map} +0 -0
  261. /package/dist/{chunk-gqdd7508.js.map → chunk-4rh2m6zg.js.map} +0 -0
  262. /package/dist/{chunk-pxtrxm3p.js.map → chunk-a09jx26t.js.map} +0 -0
  263. /package/dist/{chunk-4p9rh7jj.js.map → chunk-ea73pzk7.js.map} +0 -0
  264. /package/dist/{chunk-4aw0jwk0.js.map → chunk-f6erf2vv.js.map} +0 -0
  265. /package/dist/{chunk-c8bw2b6c.js.map → chunk-gadsm794.js.map} +0 -0
  266. /package/dist/{chunk-n5x5y80a.js.map → chunk-nzw7sm3b.js.map} +0 -0
  267. /package/dist/{chunk-261ag4t4.js.map → chunk-r0rry8dn.js.map} +0 -0
  268. /package/dist/{chunk-d2adj15j.js.map → chunk-tkdscva6.js.map} +0 -0
  269. /package/dist/{chunk-z8j83gzd.js.map → chunk-x2yw73hy.js.map} +0 -0
  270. /package/dist/{chunk-qer6am8w.js.map → chunk-xdf9yswn.js.map} +0 -0
  271. /package/dist/{chunk-km4rkj4t.js.map → chunk-zp2v2rv6.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"lake-storage-contract.d.ts","sourceRoot":"","sources":["../../src/testing/lake-storage-contract.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEpE,MAAM,MAAM,oCAAoC,GAAG,QAAQ,GAAG,oBAAoB,CAAA;AAElF,MAAM,WAAW,+BAA+B,CAAC,QAAQ,SAAS,WAAW,GAAG,WAAW;IACzF,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1D,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,oCAAoC,CAAA;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACnC;AA2CD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,SAAS,WAAW,EACtE,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,+BAA+B,CAAC,QAAQ,CAAC,GACjD,IAAI,CA2nBN"}
1
+ {"version":3,"file":"lake-storage-contract.d.ts","sourceRoot":"","sources":["../../src/testing/lake-storage-contract.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEpE,MAAM,MAAM,oCAAoC,GAAG,QAAQ,GAAG,oBAAoB,CAAA;AAElF,MAAM,WAAW,+BAA+B,CAAC,QAAQ,SAAS,WAAW,GAAG,WAAW;IACzF,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1D,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,oCAAoC,CAAA;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACnC;AA2CD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,SAAS,WAAW,EACtE,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,+BAA+B,CAAC,QAAQ,CAAC,GACjD,IAAI,CAmrBN"}
@@ -13,7 +13,7 @@ export declare const objectQueryContractOntology: OntologyRegistry;
13
13
  *
14
14
  * The contract defines the portable V1 query surface: capability declarations,
15
15
  * validation/normalization handoff, provider pushdown, bounded fallback,
16
- * traversal, set operations, pagination, search profile defaults, and stable
16
+ * canonical reference sets, traversal, set operations, pagination, search profile defaults, and stable
17
17
  * structured rejections for features outside a provider's capability map.
18
18
  */
19
19
  export declare function runObjectQueryProviderContractSuite<TStorage extends Storage>(label: string, options: ObjectQueryProviderContractSuiteOptions<TStorage>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"object-query-contract.d.ts","sourceRoot":"","sources":["../../src/testing/object-query-contract.ts"],"names":[],"mappings":"AAaA,OAAO,EAA0B,gBAAgB,EAAoB,MAAM,aAAa,CAAA;AAExF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,uCAAuC,CAAC,QAAQ,SAAS,OAAO;IAC/E,kFAAkF;IAClF,QAAQ,CAAC,aAAa,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1D,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AA8GD,eAAO,MAAM,2BAA2B,kBAEtC,CAAA;AAEF;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,OAAO,EAC1E,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,uCAAuC,CAAC,QAAQ,CAAC,GACzD,IAAI,CAw4BN;AAED,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2EjG"}
1
+ {"version":3,"file":"object-query-contract.d.ts","sourceRoot":"","sources":["../../src/testing/object-query-contract.ts"],"names":[],"mappings":"AAcA,OAAO,EAA0B,gBAAgB,EAAoB,MAAM,aAAa,CAAA;AAExF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,uCAAuC,CAAC,QAAQ,SAAS,OAAO;IAC/E,kFAAkF;IAClF,QAAQ,CAAC,aAAa,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1D,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AA8GD,eAAO,MAAM,2BAA2B,kBAEtC,CAAA;AAEF;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,OAAO,EAC1E,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,uCAAuC,CAAC,QAAQ,CAAC,GACzD,IAAI,CAslCN;AAED,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2EjG"}
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  createPrimitiveExecutionRecord
4
- } from "../chunk-4aw0jwk0.js";
4
+ } from "../chunk-f6erf2vv.js";
5
5
  import {
6
6
  canRetryWebhookRun,
7
7
  isStorageSerializationFailure
8
- } from "../chunk-xmggaxg4.js";
9
- import"../chunk-fmx1sz2h.js";
8
+ } from "../chunk-v0egge8b.js";
9
+ import"../chunk-72q2y8hn.js";
10
10
  import"../chunk-xc7hq65b.js";
11
11
  import"../chunk-cy0n5dms.js";
12
12
  import"../chunk-dysw7nsm.js";
@@ -14,13 +14,13 @@ import"../chunk-62c7t4jc.js";
14
14
  import {
15
15
  WebhookRunError
16
16
  } from "../chunk-ezake7g1.js";
17
- import"../chunk-pxtrxm3p.js";
17
+ import"../chunk-a09jx26t.js";
18
18
  import"../chunk-htq0qh7z.js";
19
19
  import"../chunk-xkthy56g.js";
20
- import"../chunk-qer6am8w.js";
21
- import"../chunk-n5x5y80a.js";
20
+ import"../chunk-xdf9yswn.js";
21
+ import"../chunk-nzw7sm3b.js";
22
22
  import"../chunk-t9xghkva.js";
23
- import"../chunk-kqxgf6kv.js";
23
+ import"../chunk-drjqm1aa.js";
24
24
  import"../chunk-5gd7tpv6.js";
25
25
  import {
26
26
  ExecutionStorageError
@@ -28,19 +28,18 @@ import {
28
28
  import"../chunk-9dzba0f2.js";
29
29
  import"../chunk-vybf6pkp.js";
30
30
  import"../chunk-ry24jbr1.js";
31
- import"../chunk-6wetht33.js";
32
31
  import"../chunk-3j7573mj.js";
33
32
  import"../chunk-4gz41why.js";
34
33
  import"../chunk-zcnhxkvd.js";
34
+ import"../chunk-t0jjkep3.js";
35
+ import"../chunk-tkdscva6.js";
36
+ import"../chunk-rhrbz7d4.js";
37
+ import"../chunk-xwnf87e1.js";
38
+ import"../chunk-f83ka50g.js";
35
39
  import"../chunk-rnshztfq.js";
36
40
  import"../chunk-04b07a9q.js";
37
41
  import"../chunk-dktq02ne.js";
38
42
  import"../chunk-zqysyfjt.js";
39
- import"../chunk-t0jjkep3.js";
40
- import"../chunk-d2adj15j.js";
41
- import"../chunk-rhrbz7d4.js";
42
- import"../chunk-xwnf87e1.js";
43
- import"../chunk-4z3n1dzt.js";
44
43
  import"../chunk-0172wgm9.js";
45
44
  import"../chunk-t8t39h7v.js";
46
45
  import"../chunk-y64skrwp.js";
@@ -149,4 +148,4 @@ export {
149
148
  admitWebhookRun
150
149
  };
151
150
 
152
- //# debugId=A21F13420826A31E64756E2164756E21
151
+ //# debugId=1789834E3012281164756E2164756E21
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "import { randomUUID } from \"node:crypto\"\nimport { createPrimitiveExecutionRecord } from \"../execution/durable\"\nimport type { ExecutionRecord, Storage, WebhookRunRecord } from \"../storage\"\nimport {\n canRetryWebhookRun,\n ExecutionStorageError,\n isStorageSerializationFailure,\n WebhookRunError,\n} from \"../storage\"\n\nconst MAX_ADMISSION_ATTEMPTS = 3\n\nexport interface AdmitWebhookRunInput {\n readonly projectId: string\n readonly storage: Storage\n readonly runId: string\n readonly connectorId: string\n readonly webhookId: string\n readonly method: string\n readonly route: string\n readonly requestBodyBytes: number\n readonly requestBodySha256: string\n readonly idempotencyKey?: string\n}\n\nexport type AdmitWebhookRunResult =\n | {\n readonly status: \"admitted\"\n readonly run: WebhookRunRecord\n readonly execution: ExecutionRecord\n readonly retried: boolean\n }\n | {\n readonly status: \"duplicate\" | \"in_progress\"\n readonly run: WebhookRunRecord\n }\n\n/** Persist or reclaim one verified Webhook delivery before its protected handler executes. */\nexport async function admitWebhookRun(input: AdmitWebhookRunInput): Promise<AdmitWebhookRunResult> {\n assertAdmissionInput(input)\n let attempt = 0\n\n // Concurrent deliveries may both observe no run before one transaction commits. Retry only\n // serialization and uniqueness races so the loser can reload the winning run; every other error\n // fails immediately, and repeated contention remains bounded by MAX_ADMISSION_ATTEMPTS.\n while (true) {\n attempt += 1\n try {\n return await input.storage.transaction((tx) => admitWebhookRunTransaction(tx, input), {\n isolation: \"serializable\",\n })\n } catch (error) {\n if (attempt >= MAX_ADMISSION_ATTEMPTS || !isConcurrentAdmissionConflict(error)) {\n throw error\n }\n }\n }\n}\n\nasync function admitWebhookRunTransaction(\n storage: Storage,\n input: AdmitWebhookRunInput\n): Promise<AdmitWebhookRunResult> {\n const runs = requireWebhookRunStorage(storage)\n const existing = input.idempotencyKey\n ? await runs.getByDelivery({\n projectId: input.projectId,\n connectorId: input.connectorId,\n webhookId: input.webhookId,\n idempotencyKey: input.idempotencyKey,\n })\n : null\n\n if (existing) {\n assertSameDelivery(existing, input)\n if (existing.status === \"running\") return { status: \"in_progress\", run: existing }\n if (!canRetryWebhookRun(existing)) return { status: \"duplicate\", run: existing }\n\n const execution = await requireWebhookExecution(storage, existing)\n const run = await runs.restart({\n projectId: input.projectId,\n id: existing.id,\n })\n return { status: \"admitted\", run, execution, retried: true }\n }\n\n const executionInput = createPrimitiveExecutionRecord({\n id: `exec_${randomUUID()}`,\n primitive: { kind: \"webhook\", id: input.route, runId: input.runId },\n origin: {\n type: \"automatic\",\n projectId: input.projectId,\n source: { type: \"webhook\", deliveryId: input.runId },\n correlationId: input.runId,\n },\n })\n const execution = await storage.executions.create(executionInput)\n const run = await runs.start({\n id: input.runId,\n projectId: input.projectId,\n executionId: execution.id,\n connectorId: input.connectorId,\n webhookId: input.webhookId,\n method: input.method,\n route: input.route,\n requestBodyBytes: input.requestBodyBytes,\n requestBodySha256: input.requestBodySha256,\n idempotencyKey: input.idempotencyKey,\n })\n return { status: \"admitted\", run, execution, retried: false }\n}\n\nfunction assertSameDelivery(existing: WebhookRunRecord, input: AdmitWebhookRunInput): void {\n if (\n existing.connectorId !== input.connectorId ||\n existing.webhookId !== input.webhookId ||\n existing.method !== input.method ||\n existing.route !== input.route ||\n existing.requestBodyBytes !== input.requestBodyBytes ||\n existing.requestBodySha256 !== input.requestBodySha256\n ) {\n throw new WebhookRunError(\n `[Sixb] Webhook delivery '${input.idempotencyKey}' conflicts with run '${existing.id}'.`,\n \"delivery_conflict\"\n )\n }\n}\n\nasync function requireWebhookExecution(\n storage: Storage,\n run: WebhookRunRecord\n): Promise<ExecutionRecord> {\n const execution = await storage.executions.getById({\n projectId: run.projectId,\n id: run.executionId,\n })\n if (!execution) {\n throw new WebhookRunError(\n `[Sixb] Execution '${run.executionId}' for Webhook run '${run.id}' was not found.`,\n \"invalid_execution\"\n )\n }\n return execution\n}\n\nfunction requireWebhookRunStorage(storage: Storage): NonNullable<Storage[\"webhookRuns\"]> {\n if (!storage.webhookRuns) {\n throw new WebhookRunError(\"[Sixb] Webhook run storage is not configured.\")\n }\n return storage.webhookRuns\n}\n\nfunction assertAdmissionInput(input: AdmitWebhookRunInput): void {\n if (input.idempotencyKey !== undefined && !input.idempotencyKey.trim()) {\n throw new WebhookRunError(\"[Sixb] Webhook idempotency key must not be empty.\")\n }\n if (!Number.isSafeInteger(input.requestBodyBytes) || input.requestBodyBytes < 0) {\n throw new WebhookRunError(\"[Sixb] Webhook request body bytes must be a non-negative integer.\")\n }\n if (!/^[a-f0-9]{64}$/.test(input.requestBodySha256)) {\n throw new WebhookRunError(\"[Sixb] Webhook request body SHA-256 must be lowercase hexadecimal.\")\n }\n}\n\nfunction isConcurrentAdmissionConflict(error: unknown): boolean {\n return (\n isStorageSerializationFailure(error) ||\n (error instanceof ExecutionStorageError && error.code === \"duplicate_execution\") ||\n (error instanceof WebhookRunError &&\n (error.code === \"duplicate_run\" || error.code === \"invalid_transition\"))\n )\n}\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAUA,IAAM,yBAAyB;AA4B/B,eAAsB,eAAe,CAAC,OAA6D;AAAA,EACjG,qBAAqB,KAAK;AAAA,EAC1B,IAAI,UAAU;AAAA,EAKd,OAAO,MAAM;AAAA,IACX,WAAW;AAAA,IACX,IAAI;AAAA,MACF,OAAO,MAAM,MAAM,QAAQ,YAAY,CAAC,OAAO,2BAA2B,IAAI,KAAK,GAAG;AAAA,QACpF,WAAW;AAAA,MACb,CAAC;AAAA,MACD,OAAO,OAAO;AAAA,MACd,IAAI,WAAW,0BAA0B,CAAC,8BAA8B,KAAK,GAAG;AAAA,QAC9E,MAAM;AAAA,MACR;AAAA;AAAA,EAEJ;AAAA;AAGF,eAAe,0BAA0B,CACvC,SACA,OACgC;AAAA,EAChC,MAAM,OAAO,yBAAyB,OAAO;AAAA,EAC7C,MAAM,WAAW,MAAM,iBACnB,MAAM,KAAK,cAAc;AAAA,IACvB,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,WAAW,MAAM;AAAA,IACjB,gBAAgB,MAAM;AAAA,EACxB,CAAC,IACD;AAAA,EAEJ,IAAI,UAAU;AAAA,IACZ,mBAAmB,UAAU,KAAK;AAAA,IAClC,IAAI,SAAS,WAAW;AAAA,MAAW,OAAO,EAAE,QA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ACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAGT,SAAS,wBAAwB,CAAC,SAAuD;AAAA,EACvF,IAAI,CAAC,QAAQ,aAAa;AAAA,IACxB,MAAM,IAAI,gBAAgB,+CAA+C;AAAA,EAC3E;AAAA,EACA,OAAO,QAAQ;AAAA;AAGjB,SAAS,oBAAoB,CAAC,OAAmC;AAAA,EAC/D,IAAI,MAAM,mBAAmB,aAAa,CAAC,MAAM,eAAe,KAAK,GAAG;AAAA,IACtE,MAAM,IAAI,gBAAgB,mDAAmD;AAAA,EAC/E;AAAA,EACA,IAAI,CAAC,OAAO,cAAc,MAAM,gBAAgB,KAAK,MAAM,mBAAmB,GAAG;AAAA,IAC/E,MAAM,IAAI,gBAAgB,mEAAmE;AAAA,EAC/F;AAAA,EACA,IAAI,CAAC,iBAAiB,KAAK,MAAM,iBAAiB,GAAG;AAAA,IACnD,MAAM,IAAI,gBAAgB,oEAAoE;AAAA,EAChG;AAAA;AAGF,SAAS,6BAA6B,CAAC,OAAyB;AAAA,EAC9D,OACE,8BAA8B,KAAK,KAClC,iBAAiB,yBAAyB,MAAM,SAAS,yBACzD,iBAAiB,oBACf,MAAM,SAAS,mBAAmB,MAAM,SAAS;AAAA;",
8
+ "debugId": "1789834E3012281164756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -7,7 +7,7 @@ import {
7
7
  defineWorkflowStep,
8
8
  interventionField,
9
9
  unwrapWorkflowNodeFailure
10
- } from "../chunk-c8bw2b6c.js";
10
+ } from "../chunk-gadsm794.js";
11
11
  import"../chunk-5sz8ta9r.js";
12
12
  import"../chunk-979ww6b3.js";
13
13
  import"../chunk-74drx9gd.js";
@@ -40,62 +40,61 @@ import {
40
40
  validateWorkflowStepInput,
41
41
  validateWorkflowStepOutput,
42
42
  validateWorkflowsAtStartup
43
- } from "../chunk-177ed2mp.js";
44
- import"../chunk-km4rkj4t.js";
45
- import"../chunk-261ag4t4.js";
46
- import"../chunk-3rsf30p4.js";
47
- import"../chunk-gqdd7508.js";
43
+ } from "../chunk-84h6qhmp.js";
44
+ import"../chunk-zp2v2rv6.js";
45
+ import"../chunk-r0rry8dn.js";
46
+ import"../chunk-z3ga9q5m.js";
47
+ import"../chunk-4rh2m6zg.js";
48
48
  import"../chunk-xhy826cz.js";
49
- import"../chunk-f1cyvnrk.js";
50
- import"../chunk-88ppkr54.js";
51
- import"../chunk-63te770v.js";
49
+ import"../chunk-6d5xdj1q.js";
50
+ import"../chunk-rte5sm3z.js";
51
+ import"../chunk-qewtks41.js";
52
52
  import"../chunk-8b55ygje.js";
53
53
  import"../chunk-51fjndv0.js";
54
54
  import"../chunk-8m5ejdpn.js";
55
55
  import"../chunk-nf4r78r4.js";
56
- import"../chunk-ttba8x6z.js";
57
- import"../chunk-d6y2wsfg.js";
58
- import"../chunk-ettb0cy4.js";
56
+ import"../chunk-78c6xvyr.js";
57
+ import"../chunk-1q02e95s.js";
58
+ import"../chunk-tbv03sx2.js";
59
59
  import"../chunk-96swp2wd.js";
60
- import"../chunk-4aw0jwk0.js";
61
- import"../chunk-xmggaxg4.js";
62
- import"../chunk-fmx1sz2h.js";
60
+ import"../chunk-f6erf2vv.js";
61
+ import"../chunk-v0egge8b.js";
62
+ import"../chunk-72q2y8hn.js";
63
63
  import"../chunk-xc7hq65b.js";
64
64
  import"../chunk-cy0n5dms.js";
65
65
  import"../chunk-dysw7nsm.js";
66
66
  import"../chunk-62c7t4jc.js";
67
67
  import"../chunk-ezake7g1.js";
68
- import"../chunk-pxtrxm3p.js";
68
+ import"../chunk-a09jx26t.js";
69
69
  import"../chunk-htq0qh7z.js";
70
70
  import"../chunk-xkthy56g.js";
71
- import"../chunk-qer6am8w.js";
72
- import"../chunk-n5x5y80a.js";
71
+ import"../chunk-xdf9yswn.js";
72
+ import"../chunk-nzw7sm3b.js";
73
73
  import"../chunk-t9xghkva.js";
74
- import"../chunk-kqxgf6kv.js";
74
+ import"../chunk-drjqm1aa.js";
75
75
  import"../chunk-5gd7tpv6.js";
76
76
  import"../chunk-h9kxd41f.js";
77
77
  import"../chunk-9dzba0f2.js";
78
78
  import"../chunk-vybf6pkp.js";
79
79
  import"../chunk-ry24jbr1.js";
80
- import"../chunk-6wetht33.js";
81
80
  import"../chunk-3j7573mj.js";
82
81
  import"../chunk-4gz41why.js";
83
82
  import"../chunk-zcnhxkvd.js";
84
83
  import"../chunk-1evzqhks.js";
85
84
  import"../chunk-dsrkgtnh.js";
86
85
  import"../chunk-bhxaq2nn.js";
87
- import"../chunk-rnshztfq.js";
88
- import"../chunk-04b07a9q.js";
89
- import"../chunk-dktq02ne.js";
90
- import"../chunk-zqysyfjt.js";
91
86
  import"../chunk-yt8wphsx.js";
92
87
  import"../chunk-rdeagz6b.js";
93
- import"../chunk-zpw39qhj.js";
88
+ import"../chunk-dm72y8wt.js";
94
89
  import"../chunk-t0jjkep3.js";
95
- import"../chunk-d2adj15j.js";
90
+ import"../chunk-tkdscva6.js";
96
91
  import"../chunk-rhrbz7d4.js";
97
92
  import"../chunk-xwnf87e1.js";
98
- import"../chunk-4z3n1dzt.js";
93
+ import"../chunk-f83ka50g.js";
94
+ import"../chunk-rnshztfq.js";
95
+ import"../chunk-04b07a9q.js";
96
+ import"../chunk-dktq02ne.js";
97
+ import"../chunk-zqysyfjt.js";
99
98
  import"../chunk-0172wgm9.js";
100
99
  import"../chunk-t8t39h7v.js";
101
100
  import"../chunk-y64skrwp.js";
@@ -136,4 +135,4 @@ export {
136
135
  WorkflowDefinitionError
137
136
  };
138
137
 
139
- //# debugId=28B83A3228FF218964756E2164756E21
138
+ //# debugId=49C4A15FE91A2DE064756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "28B83A3228FF218964756E2164756E21",
7
+ "debugId": "49C4A15FE91A2DE064756E2164756E21",
8
8
  "names": []
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "The ontology-first runtime for Sixb — objects, links, telemetry, actions, and provider contracts",
5
5
  "keywords": [
6
6
  "sixb",
@@ -7,7 +7,11 @@ export type {
7
7
  } from "./commit-edits"
8
8
  export { commitActionEdits, findActionEditCommit } from "./commit-edits"
9
9
  export { ActionDefinitionError, ActionEditCommitError } from "./errors"
10
- export type { ActionReadFacadeOptions, ActionReadObjectSetSource } from "./read-facade"
10
+ export type {
11
+ ActionReadFacadeOptions,
12
+ ActionReadObjectSetSource,
13
+ ActionTelemetryReadSource,
14
+ } from "./read-facade"
11
15
  export { ActionReadRecorder, createActionReadFacade } from "./read-facade"
12
16
  export type { ActionDefinitionCatalog, ActionRegistryOptions } from "./registry"
13
17
  export { ActionRegistry } from "./registry"
@@ -40,7 +44,12 @@ export type {
40
44
  ActionRuntimeFacade,
41
45
  ActionSubject,
42
46
  ActionTargetObject,
47
+ ActionTelemetryHistoryBatchInput,
48
+ ActionTelemetryHistoryBatchResult,
49
+ ActionTelemetryHistorySeriesInput,
43
50
  ActionTelemetryObjectSet,
51
+ ActionTelemetryPropertyToken,
52
+ ActionTelemetryReadFacade,
44
53
  ActionValidationContext,
45
54
  ActionValidator,
46
55
  ActionWritebackContext,
@@ -8,12 +8,28 @@ import type {
8
8
  OntologyObjectRef,
9
9
  } from "../materializer"
10
10
  import { createLinkScopeFingerprint } from "../materializer"
11
+ import { OntologyValidationError } from "../ontology/errors"
11
12
  import type { ObjectTypeWithPropertyTokens } from "../ontology/tokens"
12
13
  import type { ValueType } from "../ontology/types"
14
+ import {
15
+ assertPropertyTokenBelongsToObjectType,
16
+ assertTelemetryProperty,
17
+ } from "../ontology/validation"
18
+ import { RuntimeError } from "../runtime/errors"
13
19
  import type { ObjectSetListInput } from "../runtime/types"
14
- import type { ObjectLinkRow, ObjectRow } from "../storage"
20
+ import type {
21
+ ObjectLinkRow,
22
+ ObjectRow,
23
+ TimeseriesHistoryBatchInput,
24
+ TimeseriesHistoryBatchResult,
25
+ } from "../storage"
15
26
  import type { ActionReadDependencies } from "./commit-edits"
16
- import type { ActionReadFacade, ActionReadObjectSet } from "./types"
27
+ import type {
28
+ ActionReadFacade,
29
+ ActionReadObjectSet,
30
+ ActionTelemetryHistorySeriesInput,
31
+ ActionTelemetryReadFacade,
32
+ } from "./types"
17
33
 
18
34
  export type ActionReadObjectSetSource = {
19
35
  get(id: string): Promise<unknown>
@@ -25,13 +41,22 @@ export type ActionReadObjectSetSource = {
25
41
  }
26
42
  }
27
43
 
44
+ /** Runtime leaves used by the Action telemetry read adapter. */
45
+ export interface ActionTelemetryReadSource {
46
+ readonly resolveObjectType: (objectTypeId: string) => ObjectTypeWithPropertyTokens
47
+ readonly getHistoryBatch: (
48
+ input: Omit<TimeseriesHistoryBatchInput, "projectId">
49
+ ) => Promise<readonly TimeseriesHistoryBatchResult[]>
50
+ }
51
+
28
52
  /**
29
53
  * Records the exact state an Action handler observed while reading.
30
54
  *
31
55
  * A handler that reads one dependency twice keeps the first observation: the commit must fail when
32
56
  * current state no longer matches what the decision was made against, and the later read may already
33
57
  * reflect the handler's own intent. Arbitrary query phantoms stay out of this release — `query()` and
34
- * `list()` results are not turned into dependencies.
58
+ * `list()` results are not turned into dependencies. Telemetry history is also a call-level snapshot,
59
+ * not an edit dependency.
35
60
  */
36
61
  export class ActionReadRecorder {
37
62
  private readonly objects = new Map<string, ExpectedObjectRevision>()
@@ -130,6 +155,8 @@ export interface ActionReadFacadeOptions {
130
155
  * recorded scopes.
131
156
  */
132
157
  readonly resolveLinkIds: (objectTypeId: string) => readonly string[]
158
+ /** Canonical authorized telemetry history leaf. Omitted only by isolated facade consumers. */
159
+ readonly telemetry?: ActionTelemetryReadSource
133
160
  }
134
161
 
135
162
  export function createActionReadFacade(
@@ -139,6 +166,7 @@ export function createActionReadFacade(
139
166
  options?: ActionReadFacadeOptions
140
167
  ): ActionReadFacade {
141
168
  const facade = {
169
+ telemetry: createActionTelemetryReadFacade(options?.telemetry),
142
170
  objects<const TObjectType extends ObjectTypeWithPropertyTokens>(objectType: TObjectType) {
143
171
  return createActionReadObjectSetAdapter<TObjectType>(
144
172
  objectType,
@@ -151,6 +179,100 @@ export function createActionReadFacade(
151
179
  return facade as ActionReadFacade
152
180
  }
153
181
 
182
+ function createActionTelemetryReadFacade(
183
+ source: ActionTelemetryReadSource | undefined
184
+ ): ActionTelemetryReadFacade<readonly ValueType[]> {
185
+ const facade = {
186
+ async historyBatch(input: {
187
+ readonly series: readonly ActionTelemetryHistorySeriesInput[]
188
+ readonly from?: Date
189
+ readonly to?: Date
190
+ readonly limitPerSeries?: number
191
+ readonly order?: "asc" | "desc"
192
+ }) {
193
+ if (!source) {
194
+ throw new RuntimeError(
195
+ "[Sixb] Action telemetry history requires a configured telemetry read source."
196
+ )
197
+ }
198
+ if (input.series.length === 0) {
199
+ return []
200
+ }
201
+
202
+ const requestedSeries = input.series.map((entry) => {
203
+ const objectType = source.resolveObjectType(entry.property.objectTypeId)
204
+ assertPropertyTokenBelongsToObjectType(objectType, entry.property)
205
+ const registeredProperty = objectType.properties.find(
206
+ (property) => property.id === entry.property.id
207
+ )
208
+ if (!registeredProperty) {
209
+ throw new OntologyValidationError(
210
+ `[Sixb] Unknown property '${entry.property.id}' for object type '${objectType.id}'`
211
+ )
212
+ }
213
+ assertTelemetryProperty(registeredProperty)
214
+ return {
215
+ objectTypeId: objectType.id,
216
+ objectId: entry.objectId,
217
+ propertyId: registeredProperty.id,
218
+ }
219
+ })
220
+
221
+ const results = await source.getHistoryBatch({
222
+ series: requestedSeries,
223
+ ...(input.from !== undefined ? { from: input.from } : {}),
224
+ ...(input.to !== undefined ? { to: input.to } : {}),
225
+ ...(input.limitPerSeries !== undefined ? { limitPerSeries: input.limitPerSeries } : {}),
226
+ ...(input.order !== undefined ? { order: input.order } : {}),
227
+ })
228
+ assertTelemetryBatchResultMatchesRequest(requestedSeries, results)
229
+
230
+ return input.series.map((entry, index) => ({
231
+ objectId: entry.objectId,
232
+ property: entry.property,
233
+ points: results[index].points.map((point) => ({
234
+ value: point.value,
235
+ at: point.at,
236
+ ...(point.unit !== undefined ? { unit: point.unit } : {}),
237
+ })),
238
+ }))
239
+ },
240
+ }
241
+
242
+ // Cast needed at the generic token boundary: the implementation deliberately manipulates raw
243
+ // provider values while the public facade maps every tuple position back to its property token.
244
+ return facade as unknown as ActionTelemetryReadFacade<readonly ValueType[]>
245
+ }
246
+
247
+ function assertTelemetryBatchResultMatchesRequest(
248
+ requested: readonly {
249
+ readonly objectTypeId: string
250
+ readonly objectId: string
251
+ readonly propertyId: string
252
+ }[],
253
+ results: readonly TimeseriesHistoryBatchResult[]
254
+ ): void {
255
+ if (results.length !== requested.length) {
256
+ throw new RuntimeError(
257
+ `[Sixb] Telemetry history provider returned ${results.length} batch results for ${requested.length} requested series.`
258
+ )
259
+ }
260
+
261
+ for (let index = 0; index < requested.length; index += 1) {
262
+ const expected = requested[index]
263
+ const actual = results[index]
264
+ if (
265
+ actual.objectTypeId !== expected.objectTypeId ||
266
+ actual.objectId !== expected.objectId ||
267
+ actual.propertyId !== expected.propertyId
268
+ ) {
269
+ throw new RuntimeError(
270
+ `[Sixb] Telemetry history provider returned an unexpected series at batch index ${index}.`
271
+ )
272
+ }
273
+ }
274
+ }
275
+
154
276
  function createActionReadObjectSetAdapter<TObjectType extends ObjectTypeWithPropertyTokens>(
155
277
  objectType: TObjectType,
156
278
  objectSet: ActionReadObjectSetSource,
@@ -7,8 +7,9 @@ import type {
7
7
  EffectiveObjectChange,
8
8
  OntologyOperationOutcome,
9
9
  } from "../../materializer"
10
- import type { ObjectType, ValueType } from "../../ontology"
11
- import type { LinkToken, ObjectTypeWithPropertyTokens } from "../../ontology/tokens"
10
+ import type { ObjectType, Property, ValueType } from "../../ontology"
11
+ import type { InferPropertyUnit, InferPropertyValue } from "../../ontology/inference"
12
+ import type { LinkToken, ObjectTypeWithPropertyTokens, PropertyToken } from "../../ontology/tokens"
12
13
  import type {
13
14
  ListResult,
14
15
  ObjectQueryBuilder,
@@ -103,7 +104,73 @@ export interface ActionReadObjectSet<
103
104
  byId(id: string): ActionReadObjectByIdHandle<TObjectType, TValueTypes>
104
105
  }
105
106
 
107
+ /** A telemetry-mode ontology property accepted by Action history reads. */
108
+ export type ActionTelemetryPropertyToken = PropertyToken<
109
+ string,
110
+ string,
111
+ Property & { readonly mode: "telemetry" }
112
+ >
113
+
114
+ export type ActionTelemetryHistorySeriesInput<
115
+ TProperty extends ActionTelemetryPropertyToken = ActionTelemetryPropertyToken,
116
+ > = {
117
+ readonly objectId: string
118
+ readonly property: TProperty
119
+ }
120
+
121
+ export interface ActionTelemetryHistoryBatchInput<
122
+ TSeries extends
123
+ readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
124
+ > {
125
+ /** Series are returned in this exact order, including duplicate entries. */
126
+ readonly series: TSeries
127
+ readonly from?: Date
128
+ readonly to?: Date
129
+ /** Optional cap applied independently to every requested series. */
130
+ readonly limitPerSeries?: number
131
+ /** Points are oldest first by default. */
132
+ readonly order?: "asc" | "desc"
133
+ }
134
+
135
+ /**
136
+ * One batch result per requested series, preserving tuple positions and property-specific types.
137
+ */
138
+ export type ActionTelemetryHistoryBatchResult<
139
+ TSeries extends
140
+ readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
141
+ TValueTypes extends readonly ValueType[] = readonly ValueType[],
142
+ > = {
143
+ readonly [TIndex in keyof TSeries]: TSeries[TIndex] extends ActionTelemetryHistorySeriesInput<
144
+ infer TProperty
145
+ >
146
+ ? {
147
+ readonly objectId: TSeries[TIndex]["objectId"]
148
+ readonly property: TProperty
149
+ readonly points: readonly {
150
+ readonly value: InferPropertyValue<TProperty["property"], TValueTypes>
151
+ readonly at: Date
152
+ readonly unit?: InferPropertyUnit<TProperty["property"], TValueTypes>
153
+ }[]
154
+ }
155
+ : never
156
+ }
157
+
158
+ export type ActionTelemetryReadFacade<
159
+ TValueTypes extends readonly ValueType[] = readonly ValueType[],
160
+ > = {
161
+ /**
162
+ * Read several telemetry series in one provider call.
163
+ *
164
+ * This is a snapshot read for the call. It is intentionally not added to the Action edit
165
+ * dependency fence; use a fixed `to` cutoff to keep the report window stable across retries.
166
+ */
167
+ historyBatch<const TSeries extends readonly ActionTelemetryHistorySeriesInput[]>(
168
+ input: ActionTelemetryHistoryBatchInput<TSeries>
169
+ ): Promise<ActionTelemetryHistoryBatchResult<TSeries, TValueTypes>>
170
+ }
171
+
106
172
  export interface ActionReadFacade<TValueTypes extends readonly ValueType[] = readonly ValueType[]> {
173
+ readonly telemetry: ActionTelemetryReadFacade<TValueTypes>
107
174
  objects<const TObjectType extends ObjectTypeWithPropertyTokens>(
108
175
  objectType: TObjectType
109
176
  ): ActionReadObjectSet<TObjectType, TValueTypes, ObjectTypeWithPropertyTokens>
@@ -16,10 +16,10 @@ import {
16
16
  assertValidAgentToolDescription,
17
17
  assertValidAgentToolInput,
18
18
  assertValidAgentToolName,
19
- assertValidLoopConfig,
20
19
  assertValidProviderOptions,
21
20
  assertValidReasoningLevel,
22
21
  groupIdsFromDefinitions,
22
+ resolveAgentLoopConfig,
23
23
  } from "./validation"
24
24
 
25
25
  /**
@@ -76,7 +76,7 @@ export function defineAgent<const TId extends string>(
76
76
  }
77
77
  assertValidReasoningLevel(config.reasoning)
78
78
  assertValidProviderOptions(config.providerOptions)
79
- assertValidLoopConfig(config.loop)
79
+ const loop = resolveAgentLoopConfig(config.loop)
80
80
  const groupIds = groupIdsFromDefinitions(id, config.groups)
81
81
  const tools = toolsFromDefinitions(id, config.tools)
82
82
 
@@ -91,6 +91,6 @@ export function defineAgent<const TId extends string>(
91
91
  groupIds,
92
92
  tools,
93
93
  ...(config.description !== undefined ? { description: config.description } : {}),
94
- ...(config.loop !== undefined ? { loop: config.loop } : {}),
94
+ ...(loop !== undefined ? { loop } : {}),
95
95
  })
96
96
  }