@graphrefly/ts 0.0.1 → 0.0.2

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 (330) hide show
  1. package/dist/actions-types-CSC3NMDl.d.ts +657 -0
  2. package/dist/actions-types-wl9Mgkmr.d.cts +657 -0
  3. package/dist/adapters/index.cjs +5157 -2951
  4. package/dist/adapters/index.cjs.map +1 -1
  5. package/dist/adapters/index.d.cts +207 -70
  6. package/dist/adapters/index.d.ts +207 -70
  7. package/dist/adapters/index.js +3738 -1688
  8. package/dist/adapters/index.js.map +1 -1
  9. package/dist/adapters/nestjs/microservices.cjs +841 -0
  10. package/dist/adapters/nestjs/microservices.cjs.map +1 -0
  11. package/dist/adapters/nestjs/microservices.d.cts +45 -0
  12. package/dist/adapters/nestjs/microservices.d.ts +45 -0
  13. package/dist/adapters/nestjs/microservices.js +206 -0
  14. package/dist/adapters/nestjs/microservices.js.map +1 -0
  15. package/dist/adapters/nestjs/native.cjs +1391 -0
  16. package/dist/adapters/nestjs/native.cjs.map +1 -0
  17. package/dist/adapters/nestjs/native.d.cts +111 -0
  18. package/dist/adapters/nestjs/native.d.ts +111 -0
  19. package/dist/adapters/nestjs/native.js +577 -0
  20. package/dist/adapters/nestjs/native.js.map +1 -0
  21. package/dist/adapters/nestjs/websockets.cjs +924 -0
  22. package/dist/adapters/nestjs/websockets.cjs.map +1 -0
  23. package/dist/adapters/nestjs/websockets.d.cts +47 -0
  24. package/dist/adapters/nestjs/websockets.d.ts +47 -0
  25. package/dist/adapters/nestjs/websockets.js +286 -0
  26. package/dist/adapters/nestjs/websockets.js.map +1 -0
  27. package/dist/adapters/nestjs.cjs +1085 -0
  28. package/dist/adapters/nestjs.cjs.map +1 -0
  29. package/dist/adapters/nestjs.d.cts +385 -0
  30. package/dist/adapters/nestjs.d.ts +385 -0
  31. package/dist/adapters/nestjs.js +112 -0
  32. package/dist/adapters/nestjs.js.map +1 -0
  33. package/dist/adapters/observe-storage.d.cts +3 -3
  34. package/dist/adapters/observe-storage.d.ts +3 -3
  35. package/dist/adapters/observe-storage.js +4 -4
  36. package/dist/adapters/react.cjs.map +1 -1
  37. package/dist/adapters/react.d.cts +2 -2
  38. package/dist/adapters/react.d.ts +2 -2
  39. package/dist/adapters/react.js +1 -1
  40. package/dist/adapters/solid.cjs.map +1 -1
  41. package/dist/adapters/solid.d.cts +2 -2
  42. package/dist/adapters/solid.d.ts +2 -2
  43. package/dist/adapters/solid.js +1 -1
  44. package/dist/adapters/svelte.cjs.map +1 -1
  45. package/dist/adapters/svelte.d.cts +2 -2
  46. package/dist/adapters/svelte.d.ts +2 -2
  47. package/dist/adapters/svelte.js +1 -1
  48. package/dist/adapters/vue.cjs.map +1 -1
  49. package/dist/adapters/vue.d.cts +2 -2
  50. package/dist/adapters/vue.d.ts +2 -2
  51. package/dist/adapters/vue.js +1 -1
  52. package/dist/{agent-runtime-DZTJ3C-p.d.cts → agent-runtime-types-core-CaXfKNtY.d.cts} +171 -320
  53. package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-hU299uIC.d.ts} +171 -320
  54. package/dist/agent-runtime-types-tool-BEpSINol.d.ts +695 -0
  55. package/dist/agent-runtime-types-tool-DninPEzk.d.cts +695 -0
  56. package/dist/agentic-memory-retention-BmGX368S.d.ts +14 -0
  57. package/dist/agentic-memory-retention-Ih1qhX9Z.d.cts +14 -0
  58. package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-CVSUS6XR.d.ts} +13 -57
  59. package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-FnnYlVUs.d.cts} +13 -57
  60. package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-BW2CziT6.d.ts} +3 -3
  61. package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-lwSecxXs.d.cts} +3 -3
  62. package/dist/chunk-2KUAG2GZ.js +9693 -0
  63. package/dist/chunk-2KUAG2GZ.js.map +1 -0
  64. package/dist/chunk-2NJP6GO4.js +1320 -0
  65. package/dist/chunk-2NJP6GO4.js.map +1 -0
  66. package/dist/{chunk-YDSIVHRR.js → chunk-4NWSNI4K.js} +1598 -1584
  67. package/dist/chunk-4NWSNI4K.js.map +1 -0
  68. package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
  69. package/dist/chunk-6E76H4OU.js +132 -0
  70. package/dist/chunk-6E76H4OU.js.map +1 -0
  71. package/dist/chunk-7GOTIIQ7.js +819 -0
  72. package/dist/chunk-7GOTIIQ7.js.map +1 -0
  73. package/dist/{chunk-IXZBUWSP.js → chunk-7HZRJMN6.js} +2 -2
  74. package/dist/{chunk-SS2A464I.js → chunk-CJIFGJQG.js} +3 -3
  75. package/dist/{chunk-V7CIJE4B.js → chunk-CX6B6PO2.js} +92 -9
  76. package/dist/chunk-CX6B6PO2.js.map +1 -0
  77. package/dist/{chunk-FBUU43PM.js → chunk-E4QCH32M.js} +448 -446
  78. package/dist/chunk-E4QCH32M.js.map +1 -0
  79. package/dist/{chunk-HKK2JD7Z.js → chunk-ECURQ3HD.js} +12 -125
  80. package/dist/chunk-ECURQ3HD.js.map +1 -0
  81. package/dist/{chunk-3JR3EDB2.js → chunk-EOKT4QFF.js} +121 -115
  82. package/dist/chunk-EOKT4QFF.js.map +1 -0
  83. package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
  84. package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
  85. package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
  86. package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
  87. package/dist/chunk-K7FB3JTD.js.map +1 -0
  88. package/dist/{chunk-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
  89. package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
  90. package/dist/{chunk-YXMZ2N6J.js → chunk-M7J6Z4IJ.js} +1071 -1025
  91. package/dist/chunk-M7J6Z4IJ.js.map +1 -0
  92. package/dist/chunk-MQEQMS7B.js +1009 -0
  93. package/dist/chunk-MQEQMS7B.js.map +1 -0
  94. package/dist/chunk-MTELVIYR.js +1421 -0
  95. package/dist/chunk-MTELVIYR.js.map +1 -0
  96. package/dist/{chunk-QFY4AFY4.js → chunk-PVC7WDKI.js} +58 -52
  97. package/dist/chunk-PVC7WDKI.js.map +1 -0
  98. package/dist/{chunk-VTHLCFN4.js → chunk-RAHNUYA5.js} +2 -2
  99. package/dist/{chunk-XKXWK2KP.js → chunk-SHZDP2MQ.js} +1157 -1021
  100. package/dist/chunk-SHZDP2MQ.js.map +1 -0
  101. package/dist/{chunk-CZNV3VXM.js → chunk-SIDJO2T4.js} +11 -11
  102. package/dist/chunk-STXRMPW4.js +4131 -0
  103. package/dist/chunk-STXRMPW4.js.map +1 -0
  104. package/dist/{chunk-2747WN4Y.js → chunk-TPND5MJS.js} +3 -3
  105. package/dist/chunk-TQPCAIQI.js +612 -0
  106. package/dist/chunk-TQPCAIQI.js.map +1 -0
  107. package/dist/{chunk-43BKLFZU.js → chunk-YDWBXXQZ.js} +10 -10
  108. package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
  109. package/dist/composition/index.cjs +1228 -1076
  110. package/dist/composition/index.cjs.map +1 -1
  111. package/dist/composition/index.d.cts +3 -3
  112. package/dist/composition/index.d.ts +3 -3
  113. package/dist/composition/index.js +4 -4
  114. package/dist/core/index.cjs +1198 -1046
  115. package/dist/core/index.cjs.map +1 -1
  116. package/dist/core/index.d.cts +1 -1
  117. package/dist/core/index.d.ts +1 -1
  118. package/dist/core/index.js +2 -2
  119. package/dist/cqrs/index.d.cts +3 -3
  120. package/dist/cqrs/index.d.ts +3 -3
  121. package/dist/cqrs/messaging.d.cts +4 -4
  122. package/dist/cqrs/messaging.d.ts +4 -4
  123. package/dist/cqrs/work-queue.d.cts +5 -5
  124. package/dist/cqrs/work-queue.d.ts +5 -5
  125. package/dist/data-structures/index.cjs +1226 -1074
  126. package/dist/data-structures/index.cjs.map +1 -1
  127. package/dist/data-structures/index.d.cts +8 -7
  128. package/dist/data-structures/index.d.ts +8 -7
  129. package/dist/data-structures/index.js +6 -5
  130. package/dist/{describe-BpyJuWkw.d.ts → describe-B_A5fbXH.d.ts} +1 -1
  131. package/dist/{describe-DYMw_l1C.d.cts → describe-CQRrkv-Q.d.cts} +1 -1
  132. package/dist/executors/tool-provider-adapters.cjs +3091 -0
  133. package/dist/executors/tool-provider-adapters.cjs.map +1 -0
  134. package/dist/executors/tool-provider-adapters.d.cts +174 -0
  135. package/dist/executors/tool-provider-adapters.d.ts +174 -0
  136. package/dist/executors/tool-provider-adapters.js +1336 -0
  137. package/dist/executors/tool-provider-adapters.js.map +1 -0
  138. package/dist/executors/tool-provider-runtime.cjs +5178 -0
  139. package/dist/executors/tool-provider-runtime.cjs.map +1 -0
  140. package/dist/executors/tool-provider-runtime.d.cts +17 -0
  141. package/dist/executors/tool-provider-runtime.d.ts +17 -0
  142. package/dist/executors/tool-provider-runtime.js +15 -0
  143. package/dist/executors/tool-provider-runtime.js.map +1 -0
  144. package/dist/executors/tool-provider.cjs +6392 -0
  145. package/dist/executors/tool-provider.cjs.map +1 -0
  146. package/dist/executors/tool-provider.d.cts +60 -0
  147. package/dist/executors/tool-provider.d.ts +60 -0
  148. package/dist/executors/tool-provider.js +89 -0
  149. package/dist/executors/tool-provider.js.map +1 -0
  150. package/dist/executors/work-queue.d.cts +6 -6
  151. package/dist/executors/work-queue.d.ts +6 -6
  152. package/dist/graph/index.cjs +1499 -1341
  153. package/dist/graph/index.cjs.map +1 -1
  154. package/dist/graph/index.d.cts +9 -8
  155. package/dist/graph/index.d.ts +9 -8
  156. package/dist/graph/index.js +23 -22
  157. package/dist/{graph-DCEWh4T2.d.cts → graph-CWK3HLPB.d.cts} +133 -131
  158. package/dist/{graph-D-1-SQeC.d.ts → graph-ho5sotHP.d.ts} +133 -131
  159. package/dist/{index-Bmxeu0nK.d.ts → index-CQWcE0Dw.d.ts} +18 -4
  160. package/dist/{index-72VZC0-E.d.cts → index-DHA1i67c.d.cts} +18 -4
  161. package/dist/index.cjs +3397 -3140
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +12 -9
  164. package/dist/index.d.ts +12 -9
  165. package/dist/index.js +110 -109
  166. package/dist/inspection/boundary.d.cts +4 -4
  167. package/dist/inspection/boundary.d.ts +4 -4
  168. package/dist/measurements-C0mAvWU1.d.cts +164 -0
  169. package/dist/measurements-OMpCeBwh.d.ts +164 -0
  170. package/dist/messaging/index.cjs +57 -51
  171. package/dist/messaging/index.cjs.map +1 -1
  172. package/dist/messaging/index.d.cts +11 -276
  173. package/dist/messaging/index.d.ts +11 -276
  174. package/dist/messaging/index.js +1 -1
  175. package/dist/operators/index.cjs +1228 -1076
  176. package/dist/operators/index.cjs.map +1 -1
  177. package/dist/operators/index.d.cts +5 -5
  178. package/dist/operators/index.d.ts +5 -5
  179. package/dist/operators/index.js +5 -5
  180. package/dist/orchestration/index.cjs +8844 -6071
  181. package/dist/orchestration/index.cjs.map +1 -1
  182. package/dist/orchestration/index.d.cts +171 -224
  183. package/dist/orchestration/index.d.ts +171 -224
  184. package/dist/orchestration/index.js +42 -991
  185. package/dist/orchestration/index.js.map +1 -1
  186. package/dist/orchestration/messaging.d.cts +5 -8
  187. package/dist/orchestration/messaging.d.ts +5 -8
  188. package/dist/orchestration/work-queue.cjs +1243 -5
  189. package/dist/orchestration/work-queue.cjs.map +1 -1
  190. package/dist/orchestration/work-queue.d.cts +121 -10
  191. package/dist/orchestration/work-queue.d.ts +121 -10
  192. package/dist/orchestration/work-queue.js +1067 -4
  193. package/dist/orchestration/work-queue.js.map +1 -1
  194. package/dist/patterns/event-flow.cjs +6 -20
  195. package/dist/patterns/event-flow.cjs.map +1 -1
  196. package/dist/patterns/event-flow.d.cts +4 -4
  197. package/dist/patterns/event-flow.d.ts +4 -4
  198. package/dist/patterns/event-flow.js +2 -2
  199. package/dist/patterns/index.cjs +453 -465
  200. package/dist/patterns/index.cjs.map +1 -1
  201. package/dist/patterns/index.d.cts +6 -5
  202. package/dist/patterns/index.d.ts +6 -5
  203. package/dist/patterns/index.js +3 -3
  204. package/dist/process-types-C9uMYz3i.d.ts +200 -0
  205. package/dist/process-types-h3uRlzDc.d.cts +200 -0
  206. package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-B9R0Bl1P.d.cts} +4 -34
  207. package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-BXFrH0U2.d.ts} +4 -34
  208. package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BLGv8Xp8.d.cts} +5 -5
  209. package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-a4zD3665.d.ts} +5 -5
  210. package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-C_8sOfdS.d.cts} +3 -2
  211. package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-jle5dnok.d.ts} +3 -2
  212. package/dist/render/index.d.cts +2 -2
  213. package/dist/render/index.d.ts +2 -2
  214. package/dist/scheduled-readiness-5rwQlyjV.d.ts +91 -0
  215. package/dist/scheduled-readiness-DpRY8jI0.d.cts +91 -0
  216. package/dist/semantic-memory-graph-C2ZUwIlq.d.ts +30 -0
  217. package/dist/semantic-memory-graph-DlZBD_Eu.d.cts +30 -0
  218. package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-BvzdqmkY.d.cts} +2 -28
  219. package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-Ci-OtahO.d.ts} +2 -28
  220. package/dist/solutions/index.cjs +6353 -6169
  221. package/dist/solutions/index.cjs.map +1 -1
  222. package/dist/solutions/index.d.cts +12 -10
  223. package/dist/solutions/index.d.ts +12 -10
  224. package/dist/solutions/index.js +5 -5
  225. package/dist/solutions/reactive-layout/browser/index.cjs +116 -108
  226. package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
  227. package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
  228. package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
  229. package/dist/solutions/reactive-layout/browser/index.js +3 -3
  230. package/dist/solutions/reactive-layout/index.cjs +3578 -3350
  231. package/dist/solutions/reactive-layout/index.cjs.map +1 -1
  232. package/dist/solutions/reactive-layout/index.d.cts +32 -576
  233. package/dist/solutions/reactive-layout/index.d.ts +32 -576
  234. package/dist/solutions/reactive-layout/index.js +65 -5
  235. package/dist/solutions/reactive-layout/node-canvas/index.cjs +127 -117
  236. package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
  237. package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
  238. package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
  239. package/dist/solutions/reactive-layout/node-canvas/index.js +3 -3
  240. package/dist/solutions/reactive-layout/react-native/index.cjs +127 -117
  241. package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
  242. package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
  243. package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
  244. package/dist/solutions/reactive-layout/react-native/index.js +3 -3
  245. package/dist/solutions/reactive-layout/skia/index.cjs +127 -117
  246. package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
  247. package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
  248. package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
  249. package/dist/solutions/reactive-layout/skia/index.js +3 -3
  250. package/dist/solutions/work-item/actions.cjs +1609 -1428
  251. package/dist/solutions/work-item/actions.cjs.map +1 -1
  252. package/dist/solutions/work-item/actions.d.cts +23 -184
  253. package/dist/solutions/work-item/actions.d.ts +23 -184
  254. package/dist/solutions/work-item/actions.js +1558 -934
  255. package/dist/solutions/work-item/actions.js.map +1 -1
  256. package/dist/solutions/work-item/scheduling.cjs +9181 -1838
  257. package/dist/solutions/work-item/scheduling.cjs.map +1 -1
  258. package/dist/solutions/work-item/scheduling.d.cts +1763 -328
  259. package/dist/solutions/work-item/scheduling.d.ts +1763 -328
  260. package/dist/solutions/work-item/scheduling.js +117 -3
  261. package/dist/solutions/work-item/work-queue.d.cts +7 -7
  262. package/dist/solutions/work-item/work-queue.d.ts +7 -7
  263. package/dist/sources/browser.cjs +1318 -1083
  264. package/dist/sources/browser.cjs.map +1 -1
  265. package/dist/sources/browser.d.cts +4 -4
  266. package/dist/sources/browser.d.ts +4 -4
  267. package/dist/sources/browser.js +4 -4
  268. package/dist/sources/index.cjs +1318 -1083
  269. package/dist/sources/index.cjs.map +1 -1
  270. package/dist/sources/index.d.cts +4 -4
  271. package/dist/sources/index.d.ts +4 -4
  272. package/dist/sources/index.js +4 -4
  273. package/dist/sources/node.d.cts +3 -3
  274. package/dist/sources/node.d.ts +3 -3
  275. package/dist/storage/browser.cjs +16 -0
  276. package/dist/storage/browser.cjs.map +1 -1
  277. package/dist/storage/browser.js +3 -3
  278. package/dist/storage/index.cjs +16 -0
  279. package/dist/storage/index.cjs.map +1 -1
  280. package/dist/storage/index.d.cts +5 -4
  281. package/dist/storage/index.d.ts +5 -4
  282. package/dist/storage/index.js +6 -6
  283. package/dist/storage/node.cjs +16 -0
  284. package/dist/storage/node.cjs.map +1 -1
  285. package/dist/storage/node.js +3 -3
  286. package/dist/{store-C-joM4gh.d.ts → store-BmtEs9mG.d.ts} +1 -1
  287. package/dist/{store-CNJwmT-h.d.cts → store-PAAsYvML.d.cts} +1 -1
  288. package/dist/types-BRNKoFHj.d.ts +357 -0
  289. package/dist/{types-CcPIn7sy.d.cts → types-BS6CyR-x.d.cts} +27 -108
  290. package/dist/types-BWK2ay3e.d.cts +457 -0
  291. package/dist/types-BXKSAoE1.d.cts +357 -0
  292. package/dist/types-BaPpZItj.d.ts +457 -0
  293. package/dist/types-BhveCMg5.d.cts +274 -0
  294. package/dist/{types-BsJvElYZ.d.ts → types-C9NOgNJw.d.ts} +27 -108
  295. package/dist/types-CTsQ8Ww4.d.ts +274 -0
  296. package/dist/types-DL_05n2M.d.ts +34 -0
  297. package/dist/types-XDoqxYO9.d.cts +34 -0
  298. package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-BqtWnSCS.d.ts} +3 -93
  299. package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-CHO03AKh.d.cts} +3 -93
  300. package/dist/work-queue/index.cjs +957 -953
  301. package/dist/work-queue/index.cjs.map +1 -1
  302. package/dist/work-queue/index.d.cts +9 -357
  303. package/dist/work-queue/index.d.ts +9 -357
  304. package/dist/work-queue/index.js +957 -953
  305. package/dist/work-queue/index.js.map +1 -1
  306. package/package.json +603 -513
  307. package/dist/chunk-3JR3EDB2.js.map +0 -1
  308. package/dist/chunk-4VLAQHZI.js.map +0 -1
  309. package/dist/chunk-6XAIOL3X.js +0 -2407
  310. package/dist/chunk-6XAIOL3X.js.map +0 -1
  311. package/dist/chunk-FBUU43PM.js.map +0 -1
  312. package/dist/chunk-HKK2JD7Z.js.map +0 -1
  313. package/dist/chunk-PC3BTTBE.js +0 -3217
  314. package/dist/chunk-PC3BTTBE.js.map +0 -1
  315. package/dist/chunk-QFY4AFY4.js.map +0 -1
  316. package/dist/chunk-V7CIJE4B.js.map +0 -1
  317. package/dist/chunk-XKXWK2KP.js.map +0 -1
  318. package/dist/chunk-YDSIVHRR.js.map +0 -1
  319. package/dist/chunk-YXMZ2N6J.js.map +0 -1
  320. /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
  321. /package/dist/{chunk-IXZBUWSP.js.map → chunk-7HZRJMN6.js.map} +0 -0
  322. /package/dist/{chunk-SS2A464I.js.map → chunk-CJIFGJQG.js.map} +0 -0
  323. /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
  324. /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
  325. /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
  326. /package/dist/{chunk-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
  327. /package/dist/{chunk-CZNV3VXM.js.map → chunk-SIDJO2T4.js.map} +0 -0
  328. /package/dist/{chunk-2747WN4Y.js.map → chunk-TPND5MJS.js.map} +0 -0
  329. /package/dist/{chunk-43BKLFZU.js.map → chunk-YDWBXXQZ.js.map} +0 -0
  330. /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
@@ -55,7 +55,12 @@ function depLatest(ctx, depIndex) {
55
55
  return ctx[CTX_DEP_CACHE]?.latest[depIndex];
56
56
  }
57
57
 
58
- // src/messaging/index.ts
58
+ // src/messaging/utils.ts
59
+ function isObjectRecord(value) {
60
+ return typeof value === "object" && value !== null && !Array.isArray(value);
61
+ }
62
+
63
+ // src/messaging/event-message.ts
59
64
  function eventMessageIssue(value) {
60
65
  if (!isObjectRecord(value)) {
61
66
  return eventIssue("event message must be an object");
@@ -80,25 +85,6 @@ function eventIssue(message) {
80
85
  source: "messageBus.eventMessage"
81
86
  };
82
87
  }
83
- var PROMPTS_TOPIC = "prompts";
84
- var RESPONSES_TOPIC = "responses";
85
- var INJECTIONS_TOPIC = "injections";
86
- var DEFERRED_TOPIC = "deferred";
87
- var SPAWNS_TOPIC = "spawns";
88
- var CONTEXT_TOPIC = "context";
89
- var TODOS_TOPIC = "todos";
90
- var STANDARD_TOPICS = Object.freeze([
91
- PROMPTS_TOPIC,
92
- RESPONSES_TOPIC,
93
- INJECTIONS_TOPIC,
94
- DEFERRED_TOPIC,
95
- SPAWNS_TOPIC,
96
- CONTEXT_TOPIC,
97
- TODOS_TOPIC
98
- ]);
99
- function isObjectRecord(value) {
100
- return typeof value === "object" && value !== null && !Array.isArray(value);
101
- }
102
88
 
103
89
  // src/patterns/event-flow.ts
104
90
  function eventFlow(graph, opts) {
@@ -624,466 +610,158 @@ function scoreAtLeast(score, min) {
624
610
  return Number.isFinite(score) && score >= min;
625
611
  }
626
612
 
627
- // src/patterns/semantic-memory-graph.ts
628
- function memoryRetrievalBundle(graph, opts) {
629
- const name = opts.name ?? "memoryRetrieval";
630
- const { fragments, query } = opts;
631
- const snapshot = graph.node(
632
- [fragments, query],
633
- (ctx) => {
634
- const state = ctx.state.get() ?? { evaluation: 0 };
635
- state.evaluation += 1;
636
- const rawFragments = depLatest(ctx, 0);
637
- const rawQuery = depLatest(ctx, 1);
638
- const queryValidation = validateMemoryRetrievalQuery(rawQuery);
639
- const currentQuery = queryValidation.query;
640
- const valid = [];
641
- const seenIds = /* @__PURE__ */ new Set();
642
- const errors = [...queryValidation.errors];
643
- if (!Array.isArray(rawFragments)) {
644
- errors.push({
645
- code: "invalid-fragments-input",
646
- message: "memoryRetrievalBundle: fragments input must be an array",
647
- fragment: rawFragments
648
- });
649
- } else {
650
- const length = safeArrayLength(rawFragments);
651
- if (length === void 0) {
652
- errors.push({
653
- code: "invalid-fragments-input",
654
- message: "memoryRetrievalBundle: fragments input length could not be read",
655
- fragment: rawFragments
656
- });
613
+ // src/patterns/semantic-memory-graph-utils.ts
614
+ function validateKnowledgeGraphPolicy(value) {
615
+ if (value === void 0) return { policy: void 0, errors: [] };
616
+ if (!isPlainObject(value)) {
617
+ return {
618
+ errors: [
619
+ {
620
+ code: "invalid-policy",
621
+ message: "knowledgeGraphReducerBundle: policy must be an object",
622
+ assertion: value
657
623
  }
658
- for (let i = 0; i < (length ?? 0); i += 1) {
659
- const result = validateAndSnapshotFragment(rawFragments, i);
660
- if (result.error !== void 0) {
661
- errors.push(result.error);
662
- continue;
663
- }
664
- const fragment = result.fragment;
665
- if (seenIds.has(fragment.id)) {
666
- errors.push({
667
- code: "duplicate-fragment-id",
668
- message: "memoryRetrievalBundle: duplicate fragment id",
669
- index: i,
670
- fragment,
671
- validationErrors: [`duplicate fragment id '${fragment.id}'`]
672
- });
673
- continue;
674
- }
675
- seenIds.add(fragment.id);
676
- valid.push(fragment);
624
+ ]
625
+ };
626
+ }
627
+ const errors = [];
628
+ const policy = value;
629
+ if (policy.allowedPredicates !== void 0 && !isDenseArrayOf2(policy.allowedPredicates, (item) => typeof item === "string")) {
630
+ errors.push("allowedPredicates must be a readonly string array");
631
+ }
632
+ if (policy.requireEntityTypes !== void 0 && typeof policy.requireEntityTypes !== "boolean") {
633
+ errors.push("requireEntityTypes must be a boolean when present");
634
+ }
635
+ if (errors.length > 0) {
636
+ return {
637
+ errors: [
638
+ {
639
+ code: "invalid-policy",
640
+ message: "knowledgeGraphReducerBundle: policy is invalid",
641
+ assertion: value,
642
+ validationErrors: Object.freeze(errors)
677
643
  }
678
- }
679
- const ranked = errors.some((error) => !isRecoverableFragmentError(error)) ? [] : rankFragments(valid, currentQuery);
680
- const cursor = Object.freeze({
681
- evaluation: state.evaluation,
682
- validFragments: valid.length,
683
- invalidFragments: errors.filter(
684
- (error) => error.code === "invalid-fragment" || error.code === "duplicate-fragment-id"
685
- ).length,
686
- resultCount: ranked.length
687
- });
688
- ctx.state.set(state);
689
- const answer = Object.freeze({
690
- query: currentQuery,
691
- results: Object.freeze(ranked)
692
- });
693
- const status = Object.freeze({
694
- state: statusState(errors, ranked.length),
695
- query: currentQuery,
696
- cursor
697
- });
698
- const indexed = Object.freeze({
699
- ids: Object.freeze(valid.map((fragment) => fragment.id)),
700
- byId: indexById(valid),
701
- cursor
644
+ ]
645
+ };
646
+ }
647
+ return {
648
+ policy: Object.freeze({
649
+ ...policy.allowedPredicates === void 0 ? {} : { allowedPredicates: Object.freeze([...policy.allowedPredicates]) },
650
+ ...policy.requireEntityTypes === void 0 ? {} : { requireEntityTypes: policy.requireEntityTypes }
651
+ }),
652
+ errors: []
653
+ };
654
+ }
655
+ function reduceKnowledgeAssertions(value, policy) {
656
+ const assertions = [];
657
+ const errors = [];
658
+ const seenAssertions = /* @__PURE__ */ new Set();
659
+ if (!Array.isArray(value)) {
660
+ return {
661
+ assertions,
662
+ entities: [],
663
+ relations: [],
664
+ topics: [],
665
+ index: emptyKnowledgeGraphIndex(),
666
+ errors: [
667
+ {
668
+ code: "invalid-assertions-input",
669
+ message: "knowledgeGraphReducerBundle: assertions input must be an array",
670
+ assertion: value
671
+ }
672
+ ],
673
+ invalidAssertions: 0
674
+ };
675
+ }
676
+ const length = safeArrayLength(value);
677
+ if (length === void 0) {
678
+ return {
679
+ assertions,
680
+ entities: [],
681
+ relations: [],
682
+ topics: [],
683
+ index: emptyKnowledgeGraphIndex(),
684
+ errors: [
685
+ {
686
+ code: "invalid-assertions-input",
687
+ message: "knowledgeGraphReducerBundle: assertions input length could not be read",
688
+ assertion: value
689
+ }
690
+ ],
691
+ invalidAssertions: 0
692
+ };
693
+ }
694
+ for (let i = 0; i < length; i += 1) {
695
+ const result = validateKnowledgeAssertion(value[i], i, policy);
696
+ if (result.error !== void 0) {
697
+ errors.push(result.error);
698
+ continue;
699
+ }
700
+ const assertion = result.assertion;
701
+ if (seenAssertions.has(assertion.id)) {
702
+ errors.push({
703
+ code: "duplicate-assertion-id",
704
+ message: "knowledgeGraphReducerBundle: duplicate assertion id",
705
+ index: i,
706
+ assertionId: assertion.id,
707
+ assertion,
708
+ validationErrors: Object.freeze([`duplicate assertion id '${assertion.id}'`])
702
709
  });
703
- const errorFacts = Object.freeze(
704
- errors.map(
705
- (error) => Object.freeze({
706
- ...error,
707
- ...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
708
- cursor
709
- })
710
- )
711
- );
712
- ctx.down([
713
- [
714
- "DATA",
715
- Object.freeze({
716
- fragments: Object.freeze([...valid]),
717
- indexed,
718
- ranked: answer,
719
- status,
720
- errors: errorFacts,
721
- cursor
722
- })
723
- ]
724
- ]);
725
- },
726
- {
727
- name: `${name}/snapshot`,
728
- factory: "memoryRetrievalSnapshot",
729
- completeWhenDepsComplete: false,
730
- errorWhenDepsError: false
710
+ continue;
731
711
  }
732
- );
712
+ seenAssertions.add(assertion.id);
713
+ assertions.push(assertion);
714
+ }
715
+ const materialized = materializeKnowledgeGraph(assertions);
733
716
  return {
734
- input: { fragments, query },
735
- snapshot,
736
- fragments: retrievalProjection(
737
- graph,
738
- snapshot,
739
- `${name}/fragments`,
740
- "memoryRetrievalFragments",
741
- (fact) => fact.fragments
742
- ),
743
- indexed: retrievalProjection(
744
- graph,
745
- snapshot,
746
- `${name}/indexed`,
747
- "memoryRetrievalIndexed",
748
- (fact) => fact.indexed
749
- ),
750
- ranked: retrievalProjection(
751
- graph,
752
- snapshot,
753
- `${name}/ranked`,
754
- "memoryRetrievalRanked",
755
- (fact) => fact.ranked
756
- ),
757
- status: retrievalProjection(
758
- graph,
759
- snapshot,
760
- `${name}/status`,
761
- "memoryRetrievalStatus",
762
- (fact) => fact.status
763
- ),
764
- errors: retrievalProjection(
765
- graph,
766
- snapshot,
767
- `${name}/errors`,
768
- "memoryRetrievalErrors",
769
- (fact) => fact.errors
770
- ),
771
- cursor: retrievalProjection(
772
- graph,
773
- snapshot,
774
- `${name}/cursor`,
775
- "memoryRetrievalCursor",
776
- (fact) => fact.cursor
777
- )
717
+ assertions: Object.freeze(assertions),
718
+ ...materialized,
719
+ errors,
720
+ invalidAssertions: errors.filter((error) => error.code !== "invalid-policy").length
778
721
  };
779
722
  }
780
- function knowledgeGraphReducerBundle(graph, opts) {
781
- const name = opts.name ?? "knowledgeGraph";
782
- const deps = opts.policy === void 0 ? [opts.assertions] : [opts.assertions, opts.policy];
783
- const snapshot = graph.node(
784
- deps,
785
- (ctx) => {
786
- const state = ctx.state.get() ?? { evaluation: 0 };
787
- state.evaluation += 1;
788
- const policy = validateKnowledgeGraphPolicy(
789
- opts.policy === void 0 ? void 0 : depLatest(ctx, 1)
790
- );
791
- const reduced = reduceKnowledgeAssertions(depLatest(ctx, 0), policy.policy);
792
- const pendingErrors = [...policy.errors, ...reduced.errors];
793
- const cursor = Object.freeze({
794
- evaluation: state.evaluation,
795
- validAssertions: reduced.assertions.length,
796
- invalidAssertions: reduced.invalidAssertions,
797
- entityCount: reduced.entities.length,
798
- relationCount: reduced.relations.length,
799
- predicateCount: reduced.topics.length
800
- });
801
- const errors = Object.freeze(
802
- pendingErrors.map(
803
- (error) => Object.freeze({
804
- ...error,
805
- ...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
806
- cursor
807
- })
808
- )
809
- );
810
- const status = Object.freeze({
811
- state: reduced.assertions.length === 0 && errors.length === 0 ? "empty" : errors.length === 0 ? "ready" : reduced.assertions.length > 0 ? "partial" : "error",
812
- cursor
813
- });
814
- ctx.state.set(state);
815
- ctx.down([
816
- [
817
- "DATA",
818
- Object.freeze({
819
- assertions: Object.freeze(reduced.assertions),
820
- entities: Object.freeze(reduced.entities),
821
- relations: Object.freeze(reduced.relations),
822
- topics: Object.freeze(reduced.topics),
823
- index: reduced.index,
824
- status,
825
- errors,
826
- cursor
827
- })
828
- ]
829
- ]);
830
- },
831
- {
832
- name: `${name}/snapshot`,
833
- factory: "knowledgeGraphReducerSnapshot",
834
- completeWhenDepsComplete: false,
835
- errorWhenDepsError: false
836
- }
837
- );
838
- return {
839
- input: {
840
- assertions: opts.assertions,
841
- ...opts.policy === void 0 ? {} : { policy: opts.policy }
842
- },
843
- snapshot,
844
- assertions: kgProjection(
845
- graph,
846
- snapshot,
847
- `${name}/assertions`,
848
- "knowledgeGraphAssertions",
849
- (fact) => fact.assertions
850
- ),
851
- entities: kgProjection(
852
- graph,
853
- snapshot,
854
- `${name}/entities`,
855
- "knowledgeGraphEntities",
856
- (fact) => fact.entities
857
- ),
858
- relations: kgProjection(
859
- graph,
860
- snapshot,
861
- `${name}/relations`,
862
- "knowledgeGraphRelations",
863
- (fact) => fact.relations
864
- ),
865
- topics: kgProjection(
866
- graph,
867
- snapshot,
868
- `${name}/topics`,
869
- "knowledgeGraphTopics",
870
- (fact) => fact.topics
871
- ),
872
- index: kgProjection(
873
- graph,
874
- snapshot,
875
- `${name}/index`,
876
- "knowledgeGraphIndex",
877
- (fact) => fact.index
878
- ),
879
- status: kgProjection(
880
- graph,
881
- snapshot,
882
- `${name}/status`,
883
- "knowledgeGraphStatus",
884
- (fact) => fact.status
885
- ),
886
- errors: kgProjection(
887
- graph,
888
- snapshot,
889
- `${name}/errors`,
890
- "knowledgeGraphErrors",
891
- (fact) => fact.errors
892
- ),
893
- cursor: kgProjection(
894
- graph,
895
- snapshot,
896
- `${name}/cursor`,
897
- "knowledgeGraphCursor",
898
- (fact) => fact.cursor
899
- )
900
- };
901
- }
902
- function retrievalProjection(graph, snapshot, name, factory, select) {
903
- return graph.node(
904
- [snapshot],
905
- (ctx) => {
906
- for (const raw of depBatch(ctx, 0) ?? []) {
907
- const fact = raw;
908
- const selected = select(fact);
909
- if (selected !== void 0) ctx.down([["DATA", selected]]);
910
- }
911
- },
912
- {
913
- name,
914
- factory,
915
- completeWhenDepsComplete: false,
916
- errorWhenDepsError: false
917
- }
918
- );
919
- }
920
- function kgProjection(graph, snapshot, name, factory, select) {
921
- return graph.node(
922
- [snapshot],
923
- (ctx) => {
924
- for (const raw of depBatch(ctx, 0) ?? []) {
925
- ctx.down([["DATA", select(raw)]]);
926
- }
927
- },
928
- {
929
- name,
930
- factory,
931
- completeWhenDepsComplete: false,
932
- errorWhenDepsError: false
933
- }
934
- );
935
- }
936
- function validateKnowledgeGraphPolicy(value) {
937
- if (value === void 0) return { policy: void 0, errors: [] };
723
+ function validateKnowledgeAssertion(value, index, policy) {
938
724
  if (!isPlainObject(value)) {
939
- return {
940
- errors: [
941
- {
942
- code: "invalid-policy",
943
- message: "knowledgeGraphReducerBundle: policy must be an object",
944
- assertion: value
945
- }
946
- ]
947
- };
725
+ return invalidKnowledgeAssertion(index, value, ["assertion must be an object"]);
948
726
  }
727
+ const raw = value;
949
728
  const errors = [];
950
- const policy = value;
951
- if (policy.allowedPredicates !== void 0 && !isDenseArrayOf2(policy.allowedPredicates, (item) => typeof item === "string")) {
952
- errors.push("allowedPredicates must be a readonly string array");
729
+ if (!isNonEmptyString(raw.id)) errors.push("id must be a non-empty string");
730
+ if (!isKnowledgeSubject(raw.subject)) errors.push("subject.id must be a non-empty string");
731
+ if (!isNonEmptyString(raw.predicate)) errors.push("predicate must be a non-empty string");
732
+ if (!isKnowledgeObject(raw.object)) errors.push("object shape is invalid");
733
+ if (raw.confidence !== void 0 && (!Number.isFinite(raw.confidence) || raw.confidence < 0 || raw.confidence > 1)) {
734
+ errors.push("confidence must be a finite number in [0, 1] when present");
953
735
  }
954
- if (policy.requireEntityTypes !== void 0 && typeof policy.requireEntityTypes !== "boolean") {
955
- errors.push("requireEntityTypes must be a boolean when present");
736
+ if (raw.sources !== void 0 && !isDenseArrayOf2(raw.sources, isNonEmptyString)) {
737
+ errors.push("sources must be a readonly non-empty string array when present");
738
+ }
739
+ if (policy?.allowedPredicates !== void 0 && !policy.allowedPredicates.includes(raw.predicate ?? "")) {
740
+ errors.push(`predicate '${String(raw.predicate)}' is not allowed by policy`);
741
+ }
742
+ if (policy?.requireEntityTypes === true) {
743
+ if (isKnowledgeSubject(raw.subject) && raw.subject.type === void 0) {
744
+ errors.push("subject.type is required by policy");
745
+ }
746
+ if (isKnowledgeObject(raw.object) && raw.object.kind === "entity" && raw.object.type === void 0) {
747
+ errors.push("object.type is required by policy for entity objects");
748
+ }
956
749
  }
957
750
  if (errors.length > 0) {
958
- return {
959
- errors: [
960
- {
961
- code: "invalid-policy",
962
- message: "knowledgeGraphReducerBundle: policy is invalid",
963
- assertion: value,
964
- validationErrors: Object.freeze(errors)
965
- }
966
- ]
967
- };
751
+ return invalidKnowledgeAssertion(index, value, errors, raw.id);
968
752
  }
969
753
  return {
970
- policy: Object.freeze({
971
- ...policy.allowedPredicates === void 0 ? {} : { allowedPredicates: Object.freeze([...policy.allowedPredicates]) },
972
- ...policy.requireEntityTypes === void 0 ? {} : { requireEntityTypes: policy.requireEntityTypes }
973
- }),
974
- errors: []
975
- };
976
- }
977
- function reduceKnowledgeAssertions(value, policy) {
978
- const assertions = [];
979
- const errors = [];
980
- const seenAssertions = /* @__PURE__ */ new Set();
981
- if (!Array.isArray(value)) {
982
- return {
983
- assertions,
984
- entities: [],
985
- relations: [],
986
- topics: [],
987
- index: emptyKnowledgeGraphIndex(),
988
- errors: [
989
- {
990
- code: "invalid-assertions-input",
991
- message: "knowledgeGraphReducerBundle: assertions input must be an array",
992
- assertion: value
993
- }
994
- ],
995
- invalidAssertions: 0
996
- };
997
- }
998
- const length = safeArrayLength(value);
999
- if (length === void 0) {
1000
- return {
1001
- assertions,
1002
- entities: [],
1003
- relations: [],
1004
- topics: [],
1005
- index: emptyKnowledgeGraphIndex(),
1006
- errors: [
1007
- {
1008
- code: "invalid-assertions-input",
1009
- message: "knowledgeGraphReducerBundle: assertions input length could not be read",
1010
- assertion: value
1011
- }
1012
- ],
1013
- invalidAssertions: 0
1014
- };
1015
- }
1016
- for (let i = 0; i < length; i += 1) {
1017
- const result = validateKnowledgeAssertion(value[i], i, policy);
1018
- if (result.error !== void 0) {
1019
- errors.push(result.error);
1020
- continue;
1021
- }
1022
- const assertion = result.assertion;
1023
- if (seenAssertions.has(assertion.id)) {
1024
- errors.push({
1025
- code: "duplicate-assertion-id",
1026
- message: "knowledgeGraphReducerBundle: duplicate assertion id",
1027
- index: i,
1028
- assertionId: assertion.id,
1029
- assertion,
1030
- validationErrors: Object.freeze([`duplicate assertion id '${assertion.id}'`])
1031
- });
1032
- continue;
1033
- }
1034
- seenAssertions.add(assertion.id);
1035
- assertions.push(assertion);
1036
- }
1037
- const materialized = materializeKnowledgeGraph(assertions);
1038
- return {
1039
- assertions: Object.freeze(assertions),
1040
- ...materialized,
1041
- errors,
1042
- invalidAssertions: errors.filter((error) => error.code !== "invalid-policy").length
1043
- };
1044
- }
1045
- function validateKnowledgeAssertion(value, index, policy) {
1046
- if (!isPlainObject(value)) {
1047
- return invalidKnowledgeAssertion(index, value, ["assertion must be an object"]);
1048
- }
1049
- const raw = value;
1050
- const errors = [];
1051
- if (!isNonEmptyString(raw.id)) errors.push("id must be a non-empty string");
1052
- if (!isKnowledgeSubject(raw.subject)) errors.push("subject.id must be a non-empty string");
1053
- if (!isNonEmptyString(raw.predicate)) errors.push("predicate must be a non-empty string");
1054
- if (!isKnowledgeObject(raw.object)) errors.push("object shape is invalid");
1055
- if (raw.confidence !== void 0 && (!Number.isFinite(raw.confidence) || raw.confidence < 0 || raw.confidence > 1)) {
1056
- errors.push("confidence must be a finite number in [0, 1] when present");
1057
- }
1058
- if (raw.sources !== void 0 && !isDenseArrayOf2(raw.sources, isNonEmptyString)) {
1059
- errors.push("sources must be a readonly non-empty string array when present");
1060
- }
1061
- if (policy?.allowedPredicates !== void 0 && !policy.allowedPredicates.includes(raw.predicate ?? "")) {
1062
- errors.push(`predicate '${String(raw.predicate)}' is not allowed by policy`);
1063
- }
1064
- if (policy?.requireEntityTypes === true) {
1065
- if (isKnowledgeSubject(raw.subject) && raw.subject.type === void 0) {
1066
- errors.push("subject.type is required by policy");
1067
- }
1068
- if (isKnowledgeObject(raw.object) && raw.object.kind === "entity" && raw.object.type === void 0) {
1069
- errors.push("object.type is required by policy for entity objects");
1070
- }
1071
- }
1072
- if (errors.length > 0) {
1073
- return invalidKnowledgeAssertion(index, value, errors, raw.id);
1074
- }
1075
- return {
1076
- assertion: Object.freeze({
1077
- id: raw.id,
1078
- ...raw.recordId === void 0 ? {} : { recordId: raw.recordId },
1079
- ...raw.fragmentId === void 0 ? {} : { fragmentId: raw.fragmentId },
1080
- subject: snapshotSubject(raw.subject),
1081
- predicate: raw.predicate,
1082
- object: snapshotObject(raw.object),
1083
- ...raw.confidence === void 0 ? {} : { confidence: raw.confidence },
1084
- sources: Object.freeze([...raw.sources ?? []]),
1085
- ...raw.provenance === void 0 ? {} : { provenance: raw.provenance }
1086
- })
754
+ assertion: Object.freeze({
755
+ id: raw.id,
756
+ ...raw.recordId === void 0 ? {} : { recordId: raw.recordId },
757
+ ...raw.fragmentId === void 0 ? {} : { fragmentId: raw.fragmentId },
758
+ subject: snapshotSubject(raw.subject),
759
+ predicate: raw.predicate,
760
+ object: snapshotObject(raw.object),
761
+ ...raw.confidence === void 0 ? {} : { confidence: raw.confidence },
762
+ sources: Object.freeze([...raw.sources ?? []]),
763
+ ...raw.provenance === void 0 ? {} : { provenance: raw.provenance }
764
+ })
1087
765
  };
1088
766
  }
1089
767
  function invalidKnowledgeAssertion(index, assertion, validationErrors, assertionId) {
@@ -1430,6 +1108,316 @@ function compareBigIntDesc2(a, b) {
1430
1108
  if (a === b) return 0;
1431
1109
  return a > b ? -1 : 1;
1432
1110
  }
1111
+
1112
+ // src/patterns/semantic-memory-graph.ts
1113
+ function memoryRetrievalBundle(graph, opts) {
1114
+ const name = opts.name ?? "memoryRetrieval";
1115
+ const { fragments, query } = opts;
1116
+ const snapshot = graph.node(
1117
+ [fragments, query],
1118
+ (ctx) => {
1119
+ const state = ctx.state.get() ?? { evaluation: 0 };
1120
+ state.evaluation += 1;
1121
+ const rawFragments = depLatest(ctx, 0);
1122
+ const rawQuery = depLatest(ctx, 1);
1123
+ const queryValidation = validateMemoryRetrievalQuery(rawQuery);
1124
+ const currentQuery = queryValidation.query;
1125
+ const valid = [];
1126
+ const seenIds = /* @__PURE__ */ new Set();
1127
+ const errors = [...queryValidation.errors];
1128
+ if (!Array.isArray(rawFragments)) {
1129
+ errors.push({
1130
+ code: "invalid-fragments-input",
1131
+ message: "memoryRetrievalBundle: fragments input must be an array",
1132
+ fragment: rawFragments
1133
+ });
1134
+ } else {
1135
+ const length = safeArrayLength(rawFragments);
1136
+ if (length === void 0) {
1137
+ errors.push({
1138
+ code: "invalid-fragments-input",
1139
+ message: "memoryRetrievalBundle: fragments input length could not be read",
1140
+ fragment: rawFragments
1141
+ });
1142
+ }
1143
+ for (let i = 0; i < (length ?? 0); i += 1) {
1144
+ const result = validateAndSnapshotFragment(rawFragments, i);
1145
+ if (result.error !== void 0) {
1146
+ errors.push(result.error);
1147
+ continue;
1148
+ }
1149
+ const fragment = result.fragment;
1150
+ if (seenIds.has(fragment.id)) {
1151
+ errors.push({
1152
+ code: "duplicate-fragment-id",
1153
+ message: "memoryRetrievalBundle: duplicate fragment id",
1154
+ index: i,
1155
+ fragment,
1156
+ validationErrors: [`duplicate fragment id '${fragment.id}'`]
1157
+ });
1158
+ continue;
1159
+ }
1160
+ seenIds.add(fragment.id);
1161
+ valid.push(fragment);
1162
+ }
1163
+ }
1164
+ const ranked = errors.some((error) => !isRecoverableFragmentError(error)) ? [] : rankFragments(valid, currentQuery);
1165
+ const cursor = Object.freeze({
1166
+ evaluation: state.evaluation,
1167
+ validFragments: valid.length,
1168
+ invalidFragments: errors.filter(
1169
+ (error) => error.code === "invalid-fragment" || error.code === "duplicate-fragment-id"
1170
+ ).length,
1171
+ resultCount: ranked.length
1172
+ });
1173
+ ctx.state.set(state);
1174
+ const answer = Object.freeze({
1175
+ query: currentQuery,
1176
+ results: Object.freeze(ranked)
1177
+ });
1178
+ const status = Object.freeze({
1179
+ state: statusState(errors, ranked.length),
1180
+ query: currentQuery,
1181
+ cursor
1182
+ });
1183
+ const indexed = Object.freeze({
1184
+ ids: Object.freeze(valid.map((fragment) => fragment.id)),
1185
+ byId: indexById(valid),
1186
+ cursor
1187
+ });
1188
+ const errorFacts = Object.freeze(
1189
+ errors.map(
1190
+ (error) => Object.freeze({
1191
+ ...error,
1192
+ ...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
1193
+ cursor
1194
+ })
1195
+ )
1196
+ );
1197
+ ctx.down([
1198
+ [
1199
+ "DATA",
1200
+ Object.freeze({
1201
+ fragments: Object.freeze([...valid]),
1202
+ indexed,
1203
+ ranked: answer,
1204
+ status,
1205
+ errors: errorFacts,
1206
+ cursor
1207
+ })
1208
+ ]
1209
+ ]);
1210
+ },
1211
+ {
1212
+ name: `${name}/snapshot`,
1213
+ factory: "memoryRetrievalSnapshot",
1214
+ completeWhenDepsComplete: false,
1215
+ errorWhenDepsError: false
1216
+ }
1217
+ );
1218
+ return {
1219
+ input: { fragments, query },
1220
+ snapshot,
1221
+ fragments: retrievalProjection(
1222
+ graph,
1223
+ snapshot,
1224
+ `${name}/fragments`,
1225
+ "memoryRetrievalFragments",
1226
+ (fact) => fact.fragments
1227
+ ),
1228
+ indexed: retrievalProjection(
1229
+ graph,
1230
+ snapshot,
1231
+ `${name}/indexed`,
1232
+ "memoryRetrievalIndexed",
1233
+ (fact) => fact.indexed
1234
+ ),
1235
+ ranked: retrievalProjection(
1236
+ graph,
1237
+ snapshot,
1238
+ `${name}/ranked`,
1239
+ "memoryRetrievalRanked",
1240
+ (fact) => fact.ranked
1241
+ ),
1242
+ status: retrievalProjection(
1243
+ graph,
1244
+ snapshot,
1245
+ `${name}/status`,
1246
+ "memoryRetrievalStatus",
1247
+ (fact) => fact.status
1248
+ ),
1249
+ errors: retrievalProjection(
1250
+ graph,
1251
+ snapshot,
1252
+ `${name}/errors`,
1253
+ "memoryRetrievalErrors",
1254
+ (fact) => fact.errors
1255
+ ),
1256
+ cursor: retrievalProjection(
1257
+ graph,
1258
+ snapshot,
1259
+ `${name}/cursor`,
1260
+ "memoryRetrievalCursor",
1261
+ (fact) => fact.cursor
1262
+ )
1263
+ };
1264
+ }
1265
+ function knowledgeGraphReducerBundle(graph, opts) {
1266
+ const name = opts.name ?? "knowledgeGraph";
1267
+ const deps = opts.policy === void 0 ? [opts.assertions] : [opts.assertions, opts.policy];
1268
+ const snapshot = graph.node(
1269
+ deps,
1270
+ (ctx) => {
1271
+ const state = ctx.state.get() ?? { evaluation: 0 };
1272
+ state.evaluation += 1;
1273
+ const policy = validateKnowledgeGraphPolicy(
1274
+ opts.policy === void 0 ? void 0 : depLatest(ctx, 1)
1275
+ );
1276
+ const reduced = reduceKnowledgeAssertions(depLatest(ctx, 0), policy.policy);
1277
+ const pendingErrors = [...policy.errors, ...reduced.errors];
1278
+ const cursor = Object.freeze({
1279
+ evaluation: state.evaluation,
1280
+ validAssertions: reduced.assertions.length,
1281
+ invalidAssertions: reduced.invalidAssertions,
1282
+ entityCount: reduced.entities.length,
1283
+ relationCount: reduced.relations.length,
1284
+ predicateCount: reduced.topics.length
1285
+ });
1286
+ const errors = Object.freeze(
1287
+ pendingErrors.map(
1288
+ (error) => Object.freeze({
1289
+ ...error,
1290
+ ...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
1291
+ cursor
1292
+ })
1293
+ )
1294
+ );
1295
+ const status = Object.freeze({
1296
+ state: reduced.assertions.length === 0 && errors.length === 0 ? "empty" : errors.length === 0 ? "ready" : reduced.assertions.length > 0 ? "partial" : "error",
1297
+ cursor
1298
+ });
1299
+ ctx.state.set(state);
1300
+ ctx.down([
1301
+ [
1302
+ "DATA",
1303
+ Object.freeze({
1304
+ assertions: Object.freeze(reduced.assertions),
1305
+ entities: Object.freeze(reduced.entities),
1306
+ relations: Object.freeze(reduced.relations),
1307
+ topics: Object.freeze(reduced.topics),
1308
+ index: reduced.index,
1309
+ status,
1310
+ errors,
1311
+ cursor
1312
+ })
1313
+ ]
1314
+ ]);
1315
+ },
1316
+ {
1317
+ name: `${name}/snapshot`,
1318
+ factory: "knowledgeGraphReducerSnapshot",
1319
+ completeWhenDepsComplete: false,
1320
+ errorWhenDepsError: false
1321
+ }
1322
+ );
1323
+ return {
1324
+ input: {
1325
+ assertions: opts.assertions,
1326
+ ...opts.policy === void 0 ? {} : { policy: opts.policy }
1327
+ },
1328
+ snapshot,
1329
+ assertions: kgProjection(
1330
+ graph,
1331
+ snapshot,
1332
+ `${name}/assertions`,
1333
+ "knowledgeGraphAssertions",
1334
+ (fact) => fact.assertions
1335
+ ),
1336
+ entities: kgProjection(
1337
+ graph,
1338
+ snapshot,
1339
+ `${name}/entities`,
1340
+ "knowledgeGraphEntities",
1341
+ (fact) => fact.entities
1342
+ ),
1343
+ relations: kgProjection(
1344
+ graph,
1345
+ snapshot,
1346
+ `${name}/relations`,
1347
+ "knowledgeGraphRelations",
1348
+ (fact) => fact.relations
1349
+ ),
1350
+ topics: kgProjection(
1351
+ graph,
1352
+ snapshot,
1353
+ `${name}/topics`,
1354
+ "knowledgeGraphTopics",
1355
+ (fact) => fact.topics
1356
+ ),
1357
+ index: kgProjection(
1358
+ graph,
1359
+ snapshot,
1360
+ `${name}/index`,
1361
+ "knowledgeGraphIndex",
1362
+ (fact) => fact.index
1363
+ ),
1364
+ status: kgProjection(
1365
+ graph,
1366
+ snapshot,
1367
+ `${name}/status`,
1368
+ "knowledgeGraphStatus",
1369
+ (fact) => fact.status
1370
+ ),
1371
+ errors: kgProjection(
1372
+ graph,
1373
+ snapshot,
1374
+ `${name}/errors`,
1375
+ "knowledgeGraphErrors",
1376
+ (fact) => fact.errors
1377
+ ),
1378
+ cursor: kgProjection(
1379
+ graph,
1380
+ snapshot,
1381
+ `${name}/cursor`,
1382
+ "knowledgeGraphCursor",
1383
+ (fact) => fact.cursor
1384
+ )
1385
+ };
1386
+ }
1387
+ function retrievalProjection(graph, snapshot, name, factory, select) {
1388
+ return graph.node(
1389
+ [snapshot],
1390
+ (ctx) => {
1391
+ for (const raw of depBatch(ctx, 0) ?? []) {
1392
+ const fact = raw;
1393
+ const selected = select(fact);
1394
+ if (selected !== void 0) ctx.down([["DATA", selected]]);
1395
+ }
1396
+ },
1397
+ {
1398
+ name,
1399
+ factory,
1400
+ completeWhenDepsComplete: false,
1401
+ errorWhenDepsError: false
1402
+ }
1403
+ );
1404
+ }
1405
+ function kgProjection(graph, snapshot, name, factory, select) {
1406
+ return graph.node(
1407
+ [snapshot],
1408
+ (ctx) => {
1409
+ for (const raw of depBatch(ctx, 0) ?? []) {
1410
+ ctx.down([["DATA", select(raw)]]);
1411
+ }
1412
+ },
1413
+ {
1414
+ name,
1415
+ factory,
1416
+ completeWhenDepsComplete: false,
1417
+ errorWhenDepsError: false
1418
+ }
1419
+ );
1420
+ }
1433
1421
  // Annotate the CommonJS export names for ESM import in node:
1434
1422
  0 && (module.exports = {
1435
1423
  admissionFilter3D,