@graphrefly/ts 0.0.0 → 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.
- package/README.md +135 -0
- package/dist/actions-types-CSC3NMDl.d.ts +657 -0
- package/dist/actions-types-wl9Mgkmr.d.cts +657 -0
- package/dist/adapters/index.cjs +5219 -2974
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +204 -192
- package/dist/adapters/index.d.ts +204 -192
- package/dist/adapters/index.js +3685 -1833
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/nestjs/microservices.cjs +841 -0
- package/dist/adapters/nestjs/microservices.cjs.map +1 -0
- package/dist/adapters/nestjs/microservices.d.cts +45 -0
- package/dist/adapters/nestjs/microservices.d.ts +45 -0
- package/dist/adapters/nestjs/microservices.js +206 -0
- package/dist/adapters/nestjs/microservices.js.map +1 -0
- package/dist/adapters/nestjs/native.cjs +1391 -0
- package/dist/adapters/nestjs/native.cjs.map +1 -0
- package/dist/adapters/nestjs/native.d.cts +111 -0
- package/dist/adapters/nestjs/native.d.ts +111 -0
- package/dist/adapters/nestjs/native.js +577 -0
- package/dist/adapters/nestjs/native.js.map +1 -0
- package/dist/adapters/nestjs/websockets.cjs +924 -0
- package/dist/adapters/nestjs/websockets.cjs.map +1 -0
- package/dist/adapters/nestjs/websockets.d.cts +47 -0
- package/dist/adapters/nestjs/websockets.d.ts +47 -0
- package/dist/adapters/nestjs/websockets.js +286 -0
- package/dist/adapters/nestjs/websockets.js.map +1 -0
- package/dist/adapters/nestjs.cjs +1085 -0
- package/dist/adapters/nestjs.cjs.map +1 -0
- package/dist/adapters/nestjs.d.cts +385 -0
- package/dist/adapters/nestjs.d.ts +385 -0
- package/dist/adapters/nestjs.js +112 -0
- package/dist/adapters/nestjs.js.map +1 -0
- package/dist/adapters/observe-storage.d.cts +4 -4
- package/dist/adapters/observe-storage.d.ts +4 -4
- package/dist/adapters/observe-storage.js +5 -4
- package/dist/adapters/observe-storage.js.map +1 -1
- package/dist/adapters/react.cjs +166 -0
- package/dist/adapters/react.cjs.map +1 -0
- package/dist/adapters/react.d.cts +31 -0
- package/dist/adapters/react.d.ts +31 -0
- package/dist/adapters/react.js +51 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/solid.cjs +157 -0
- package/dist/adapters/solid.cjs.map +1 -0
- package/dist/adapters/solid.d.cts +26 -0
- package/dist/adapters/solid.d.ts +26 -0
- package/dist/adapters/solid.js +48 -0
- package/dist/adapters/solid.js.map +1 -0
- package/dist/adapters/svelte.cjs +148 -0
- package/dist/adapters/svelte.cjs.map +1 -0
- package/dist/adapters/svelte.d.cts +31 -0
- package/dist/adapters/svelte.d.ts +31 -0
- package/dist/adapters/svelte.js +46 -0
- package/dist/adapters/svelte.js.map +1 -0
- package/dist/adapters/vue.cjs +155 -0
- package/dist/adapters/vue.cjs.map +1 -0
- package/dist/adapters/vue.d.cts +26 -0
- package/dist/adapters/vue.d.ts +26 -0
- package/dist/adapters/vue.js +46 -0
- package/dist/adapters/vue.js.map +1 -0
- package/dist/agent-runtime-types-core-CaXfKNtY.d.cts +406 -0
- package/dist/agent-runtime-types-core-hU299uIC.d.ts +406 -0
- package/dist/agent-runtime-types-tool-BEpSINol.d.ts +695 -0
- package/dist/agent-runtime-types-tool-DninPEzk.d.cts +695 -0
- package/dist/agentic-memory-retention-BmGX368S.d.ts +14 -0
- package/dist/agentic-memory-retention-Ih1qhX9Z.d.cts +14 -0
- package/dist/agentic-memory-types-CVSUS6XR.d.ts +473 -0
- package/dist/agentic-memory-types-FnnYlVUs.d.cts +473 -0
- package/dist/capability-admission-BW2CziT6.d.ts +102 -0
- package/dist/capability-admission-lwSecxXs.d.cts +102 -0
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/chunk-2NJP6GO4.js +1320 -0
- package/dist/chunk-2NJP6GO4.js.map +1 -0
- package/dist/{chunk-GDL26N2T.js → chunk-3KN7NJDR.js} +2 -2
- package/dist/{chunk-COHO25CZ.js → chunk-4NWSNI4K.js} +2232 -1672
- package/dist/chunk-4NWSNI4K.js.map +1 -0
- package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
- package/dist/chunk-6E76H4OU.js +132 -0
- package/dist/chunk-6E76H4OU.js.map +1 -0
- package/dist/chunk-7GOTIIQ7.js +819 -0
- package/dist/chunk-7GOTIIQ7.js.map +1 -0
- package/dist/{chunk-D6BG7U6A.js → chunk-7HZRJMN6.js} +3 -3
- package/dist/{chunk-SCRFRCGR.js → chunk-BSQGE5PS.js} +1 -1
- package/dist/{chunk-PKVBHGBM.js → chunk-CJIFGJQG.js} +7 -7
- package/dist/{chunk-G4M3NHRJ.js → chunk-CX6B6PO2.js} +93 -10
- package/dist/chunk-CX6B6PO2.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/{chunk-JIMUDQN3.js → chunk-E4QCH32M.js} +449 -447
- package/dist/chunk-E4QCH32M.js.map +1 -0
- package/dist/{chunk-RIIOUTGM.js → chunk-ECURQ3HD.js} +19 -129
- package/dist/chunk-ECURQ3HD.js.map +1 -0
- package/dist/{chunk-2ILL7HQI.js → chunk-EOKT4QFF.js} +134 -128
- package/dist/chunk-EOKT4QFF.js.map +1 -0
- package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
- package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
- package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
- package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
- package/dist/chunk-K7FB3JTD.js.map +1 -0
- package/dist/chunk-L6LDXRWE.js +219 -0
- package/dist/chunk-L6LDXRWE.js.map +1 -0
- package/dist/chunk-M7J6Z4IJ.js +1930 -0
- package/dist/chunk-M7J6Z4IJ.js.map +1 -0
- package/dist/chunk-MQEQMS7B.js +1009 -0
- package/dist/chunk-MQEQMS7B.js.map +1 -0
- package/dist/chunk-MTELVIYR.js +1421 -0
- package/dist/chunk-MTELVIYR.js.map +1 -0
- package/dist/chunk-PVC7WDKI.js +885 -0
- package/dist/chunk-PVC7WDKI.js.map +1 -0
- package/dist/chunk-RAHNUYA5.js +368 -0
- package/dist/chunk-RAHNUYA5.js.map +1 -0
- package/dist/{chunk-DK554R7P.js → chunk-S6HXABGL.js} +2 -1
- package/dist/chunk-S6HXABGL.js.map +1 -0
- package/dist/{chunk-I3IHOHCJ.js → chunk-SHZDP2MQ.js} +1181 -1001
- package/dist/chunk-SHZDP2MQ.js.map +1 -0
- package/dist/{chunk-Y3ZLRGHC.js → chunk-SIDJO2T4.js} +16 -16
- package/dist/chunk-STXRMPW4.js +4131 -0
- package/dist/chunk-STXRMPW4.js.map +1 -0
- package/dist/{chunk-JR4IKCR2.js → chunk-TPND5MJS.js} +5 -5
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/chunk-UT3MHJCW.js +49 -0
- package/dist/chunk-UT3MHJCW.js.map +1 -0
- package/dist/{chunk-TEW47IVR.js → chunk-VPEFSDME.js} +2 -2
- package/dist/{chunk-SWTLEQL6.js → chunk-WQIA3GFB.js} +2 -2
- package/dist/chunk-WQIA3GFB.js.map +1 -0
- package/dist/{chunk-DJC4CHLQ.js → chunk-YDWBXXQZ.js} +5 -5
- package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
- package/dist/composition/index.cjs +1256 -1059
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +4 -4
- package/dist/composition/index.d.ts +4 -4
- package/dist/composition/index.js +7 -6
- package/dist/core/index.cjs +1218 -1021
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +5 -4
- package/dist/cqrs/index.cjs.map +1 -1
- package/dist/cqrs/index.d.cts +4 -4
- package/dist/cqrs/index.d.ts +4 -4
- package/dist/cqrs/index.js +3 -2
- package/dist/cqrs/index.js.map +1 -1
- package/dist/cqrs/messaging.cjs +312 -0
- package/dist/cqrs/messaging.cjs.map +1 -0
- package/dist/cqrs/messaging.d.cts +57 -0
- package/dist/cqrs/messaging.d.ts +57 -0
- package/dist/cqrs/messaging.js +274 -0
- package/dist/cqrs/messaging.js.map +1 -0
- package/dist/cqrs/work-queue.cjs +329 -0
- package/dist/cqrs/work-queue.cjs.map +1 -0
- package/dist/cqrs/work-queue.d.cts +90 -0
- package/dist/cqrs/work-queue.d.ts +90 -0
- package/dist/cqrs/work-queue.js +292 -0
- package/dist/cqrs/work-queue.js.map +1 -0
- package/dist/data/index.cjs +19 -0
- package/dist/data/index.cjs.map +1 -0
- package/dist/data/index.d.cts +36 -0
- package/dist/data/index.d.ts +36 -0
- package/dist/data/index.js +1 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data-structures/index.cjs +1252 -1052
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +9 -8
- package/dist/data-structures/index.d.ts +9 -8
- package/dist/data-structures/index.js +9 -7
- package/dist/{describe-BZb7AS2y.d.ts → describe-B_A5fbXH.d.ts} +1 -1
- package/dist/{describe-Ciu8SUnN.d.cts → describe-CQRrkv-Q.d.cts} +1 -1
- package/dist/executors/tool-provider-adapters.cjs +3091 -0
- package/dist/executors/tool-provider-adapters.cjs.map +1 -0
- package/dist/executors/tool-provider-adapters.d.cts +174 -0
- package/dist/executors/tool-provider-adapters.d.ts +174 -0
- package/dist/executors/tool-provider-adapters.js +1336 -0
- package/dist/executors/tool-provider-adapters.js.map +1 -0
- package/dist/executors/tool-provider-runtime.cjs +5178 -0
- package/dist/executors/tool-provider-runtime.cjs.map +1 -0
- package/dist/executors/tool-provider-runtime.d.cts +17 -0
- package/dist/executors/tool-provider-runtime.d.ts +17 -0
- package/dist/executors/tool-provider-runtime.js +15 -0
- package/dist/executors/tool-provider-runtime.js.map +1 -0
- package/dist/executors/tool-provider.cjs +6392 -0
- package/dist/executors/tool-provider.cjs.map +1 -0
- package/dist/executors/tool-provider.d.cts +60 -0
- package/dist/executors/tool-provider.d.ts +60 -0
- package/dist/executors/tool-provider.js +89 -0
- package/dist/executors/tool-provider.js.map +1 -0
- package/dist/executors/work-queue.cjs +342 -0
- package/dist/executors/work-queue.cjs.map +1 -0
- package/dist/executors/work-queue.d.cts +90 -0
- package/dist/executors/work-queue.d.ts +90 -0
- package/dist/executors/work-queue.js +306 -0
- package/dist/executors/work-queue.js.map +1 -0
- package/dist/graph/index.cjs +1536 -1324
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +10 -9
- package/dist/graph/index.d.ts +10 -9
- package/dist/graph/index.js +22 -20
- package/dist/{graph-s23RbbFO.d.cts → graph-CWK3HLPB.d.cts} +134 -132
- package/dist/{graph-DfdF9zy4.d.ts → graph-ho5sotHP.d.ts} +134 -132
- package/dist/{index-SnzZu3x7.d.ts → index-CQWcE0Dw.d.ts} +18 -4
- package/dist/{index-CAEmLCYF.d.cts → index-DHA1i67c.d.cts} +18 -4
- package/dist/index.cjs +3331 -3020
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +114 -108
- package/dist/inspection/boundary.cjs +98 -0
- package/dist/inspection/boundary.cjs.map +1 -0
- package/dist/inspection/boundary.d.cts +61 -0
- package/dist/inspection/boundary.d.ts +61 -0
- package/dist/inspection/boundary.js +75 -0
- package/dist/inspection/boundary.js.map +1 -0
- package/dist/measurements-C0mAvWU1.d.cts +164 -0
- package/dist/measurements-OMpCeBwh.d.ts +164 -0
- package/dist/{messages-BZqrGGm1.d.ts → messages-CAzUPPJM.d.cts} +10 -5
- package/dist/{messages-BZqrGGm1.d.cts → messages-CAzUPPJM.d.ts} +10 -5
- package/dist/messaging/index.cjs +756 -619
- package/dist/messaging/index.cjs.map +1 -1
- package/dist/messaging/index.d.cts +17 -226
- package/dist/messaging/index.d.ts +17 -226
- package/dist/messaging/index.js +19 -749
- package/dist/messaging/index.js.map +1 -1
- package/dist/operators/index.cjs +1256 -1059
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +6 -6
- package/dist/operators/index.d.ts +6 -6
- package/dist/operators/index.js +9 -8
- package/dist/orchestration/index.cjs +8664 -2617
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +171 -221
- package/dist/orchestration/index.d.ts +171 -221
- package/dist/orchestration/index.js +74 -982
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/messaging.cjs +314 -0
- package/dist/orchestration/messaging.cjs.map +1 -0
- package/dist/orchestration/messaging.d.cts +56 -0
- package/dist/orchestration/messaging.d.ts +56 -0
- package/dist/orchestration/messaging.js +276 -0
- package/dist/orchestration/messaging.js.map +1 -0
- package/dist/orchestration/work-queue.cjs +1500 -0
- package/dist/orchestration/work-queue.cjs.map +1 -0
- package/dist/orchestration/work-queue.d.cts +196 -0
- package/dist/orchestration/work-queue.d.ts +196 -0
- package/dist/orchestration/work-queue.js +1289 -0
- package/dist/orchestration/work-queue.js.map +1 -0
- package/dist/patterns/event-flow.cjs +433 -0
- package/dist/patterns/event-flow.cjs.map +1 -0
- package/dist/patterns/event-flow.d.cts +115 -0
- package/dist/patterns/event-flow.d.ts +115 -0
- package/dist/patterns/event-flow.js +14 -0
- package/dist/patterns/event-flow.js.map +1 -0
- package/dist/patterns/index.cjs +748 -355
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +9 -5
- package/dist/patterns/index.d.ts +9 -5
- package/dist/patterns/index.js +13 -4
- package/dist/process-types-C9uMYz3i.d.ts +200 -0
- package/dist/process-types-h3uRlzDc.d.cts +200 -0
- package/dist/{reactive-collection-BxBqtIOE.d.cts → reactive-collection-B9R0Bl1P.d.cts} +11 -41
- package/dist/{reactive-collection-Cb1II1Fi.d.ts → reactive-collection-BXFrH0U2.d.ts} +11 -41
- package/dist/{reactive-collection-storage-D-KmjE0J.d.cts → reactive-collection-storage-BLGv8Xp8.d.cts} +5 -5
- package/dist/{reactive-collection-storage-BNiEc-Gd.d.ts → reactive-collection-storage-a4zD3665.d.ts} +5 -5
- package/dist/{reactive-map-BcB4KsQR.d.ts → reactive-map-C_8sOfdS.d.cts} +7 -6
- package/dist/{reactive-map-D-g3dv8I.d.cts → reactive-map-jle5dnok.d.ts} +7 -6
- package/dist/render/index.d.cts +3 -3
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.js +1 -0
- package/dist/scheduled-readiness-5rwQlyjV.d.ts +91 -0
- package/dist/scheduled-readiness-DpRY8jI0.d.cts +91 -0
- package/dist/semantic-memory-graph-C2ZUwIlq.d.ts +30 -0
- package/dist/semantic-memory-graph-DlZBD_Eu.d.cts +30 -0
- package/dist/{semantic-memory-graph-BYoIlP35.d.cts → semantic-memory-graph-types-BvzdqmkY.d.cts} +2 -28
- package/dist/{semantic-memory-graph-CxyXLms3.d.ts → semantic-memory-graph-types-Ci-OtahO.d.ts} +2 -28
- package/dist/solutions/index.cjs +6788 -2128
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +15 -519
- package/dist/solutions/index.d.ts +15 -519
- package/dist/solutions/index.js +91 -7
- package/dist/solutions/reactive-layout/browser/index.cjs +457 -0
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/browser/index.d.cts +44 -0
- package/dist/solutions/reactive-layout/browser/index.d.ts +44 -0
- package/dist/solutions/reactive-layout/browser/index.js +69 -0
- package/dist/solutions/reactive-layout/browser/index.js.map +1 -0
- package/dist/solutions/reactive-layout/index.cjs +4494 -0
- package/dist/solutions/reactive-layout/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/index.d.cts +37 -0
- package/dist/solutions/reactive-layout/index.d.ts +37 -0
- package/dist/solutions/reactive-layout/index.js +146 -0
- package/dist/solutions/reactive-layout/index.js.map +1 -0
- package/dist/solutions/reactive-layout/node-canvas/index.cjs +555 -0
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +54 -0
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +54 -0
- package/dist/solutions/reactive-layout/node-canvas/index.js +131 -0
- package/dist/solutions/reactive-layout/node-canvas/index.js.map +1 -0
- package/dist/solutions/reactive-layout/react-native/index.cjs +504 -0
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/react-native/index.d.cts +51 -0
- package/dist/solutions/reactive-layout/react-native/index.d.ts +51 -0
- package/dist/solutions/reactive-layout/react-native/index.js +77 -0
- package/dist/solutions/reactive-layout/react-native/index.js.map +1 -0
- package/dist/solutions/reactive-layout/skia/index.cjs +557 -0
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/skia/index.d.cts +64 -0
- package/dist/solutions/reactive-layout/skia/index.d.ts +64 -0
- package/dist/solutions/reactive-layout/skia/index.js +70 -0
- package/dist/solutions/reactive-layout/skia/index.js.map +1 -0
- package/dist/solutions/work-item/actions.cjs +2345 -0
- package/dist/solutions/work-item/actions.cjs.map +1 -0
- package/dist/solutions/work-item/actions.d.cts +40 -0
- package/dist/solutions/work-item/actions.d.ts +40 -0
- package/dist/solutions/work-item/actions.js +2078 -0
- package/dist/solutions/work-item/actions.js.map +1 -0
- package/dist/solutions/work-item/scheduling.cjs +9797 -0
- package/dist/solutions/work-item/scheduling.cjs.map +1 -0
- package/dist/solutions/work-item/scheduling.d.cts +1868 -0
- package/dist/solutions/work-item/scheduling.d.ts +1868 -0
- package/dist/solutions/work-item/scheduling.js +146 -0
- package/dist/solutions/work-item/scheduling.js.map +1 -0
- package/dist/solutions/work-item/work-queue.cjs +306 -0
- package/dist/solutions/work-item/work-queue.cjs.map +1 -0
- package/dist/solutions/work-item/work-queue.d.cts +71 -0
- package/dist/solutions/work-item/work-queue.d.ts +71 -0
- package/dist/solutions/work-item/work-queue.js +270 -0
- package/dist/solutions/work-item/work-queue.js.map +1 -0
- package/dist/sources/browser.cjs +1399 -1052
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +33 -6
- package/dist/sources/browser.d.ts +33 -6
- package/dist/sources/browser.js +73 -6
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs +1345 -1065
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +5 -5
- package/dist/sources/index.d.ts +5 -5
- package/dist/sources/index.js +7 -6
- package/dist/sources/node.cjs.map +1 -1
- package/dist/sources/node.d.cts +4 -4
- package/dist/sources/node.d.ts +4 -4
- package/dist/sources/node.js +2 -1
- package/dist/sources/node.js.map +1 -1
- package/dist/storage/browser.cjs +16 -0
- package/dist/storage/browser.cjs.map +1 -1
- package/dist/storage/browser.js +4 -3
- package/dist/storage/browser.js.map +1 -1
- package/dist/storage/index.cjs +16 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +6 -5
- package/dist/storage/index.d.ts +6 -5
- package/dist/storage/index.js +10 -9
- package/dist/storage/node.cjs +16 -0
- package/dist/storage/node.cjs.map +1 -1
- package/dist/storage/node.js +4 -3
- package/dist/storage/node.js.map +1 -1
- package/dist/store-BmtEs9mG.d.ts +123 -0
- package/dist/store-PAAsYvML.d.cts +123 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +3 -2
- package/dist/types-BRNKoFHj.d.ts +357 -0
- package/dist/{types-h12mNYbq.d.ts → types-BS6CyR-x.d.cts} +49 -130
- package/dist/types-BWK2ay3e.d.cts +457 -0
- package/dist/types-BXKSAoE1.d.cts +357 -0
- package/dist/types-BaPpZItj.d.ts +457 -0
- package/dist/types-BhveCMg5.d.cts +274 -0
- package/dist/{types-bNMSWKqF.d.cts → types-C9NOgNJw.d.ts} +49 -130
- package/dist/types-CTsQ8Ww4.d.ts +274 -0
- package/dist/types-DL_05n2M.d.ts +34 -0
- package/dist/types-XDoqxYO9.d.cts +34 -0
- package/dist/work-item-runtime-types-BqtWnSCS.d.ts +138 -0
- package/dist/work-item-runtime-types-CHO03AKh.d.cts +138 -0
- package/dist/work-queue/index.cjs +1136 -0
- package/dist/work-queue/index.cjs.map +1 -0
- package/dist/work-queue/index.d.cts +21 -0
- package/dist/work-queue/index.d.ts +21 -0
- package/dist/work-queue/index.js +1082 -0
- package/dist/work-queue/index.js.map +1 -0
- package/package.json +603 -249
- package/dist/chunk-2ILL7HQI.js.map +0 -1
- package/dist/chunk-4VLAQHZI.js.map +0 -1
- package/dist/chunk-COHO25CZ.js.map +0 -1
- package/dist/chunk-DK554R7P.js.map +0 -1
- package/dist/chunk-G4M3NHRJ.js.map +0 -1
- package/dist/chunk-I3IHOHCJ.js.map +0 -1
- package/dist/chunk-JIMUDQN3.js.map +0 -1
- package/dist/chunk-RIIOUTGM.js.map +0 -1
- package/dist/chunk-SWTLEQL6.js.map +0 -1
- /package/dist/{chunk-GDL26N2T.js.map → chunk-3KN7NJDR.js.map} +0 -0
- /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-D6BG7U6A.js.map → chunk-7HZRJMN6.js.map} +0 -0
- /package/dist/{chunk-SCRFRCGR.js.map → chunk-BSQGE5PS.js.map} +0 -0
- /package/dist/{chunk-PKVBHGBM.js.map → chunk-CJIFGJQG.js.map} +0 -0
- /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
- /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
- /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
- /package/dist/{chunk-Y3ZLRGHC.js.map → chunk-SIDJO2T4.js.map} +0 -0
- /package/dist/{chunk-JR4IKCR2.js.map → chunk-TPND5MJS.js.map} +0 -0
- /package/dist/{chunk-TEW47IVR.js.map → chunk-VPEFSDME.js.map} +0 -0
- /package/dist/{chunk-DJC4CHLQ.js.map → chunk-YDWBXXQZ.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
package/dist/patterns/index.cjs
CHANGED
|
@@ -23,6 +23,8 @@ __export(patterns_exports, {
|
|
|
23
23
|
admissionFilter3D: () => admissionFilter3D,
|
|
24
24
|
admissionScored: () => admissionScored,
|
|
25
25
|
cosineSimilarity: () => cosineSimilarity,
|
|
26
|
+
eventFlow: () => eventFlow,
|
|
27
|
+
eventFlowProjection: () => eventFlowProjection,
|
|
26
28
|
filterMemoryFragments: () => filterMemoryFragments,
|
|
27
29
|
isMemoryFragment: () => isMemoryFragment,
|
|
28
30
|
knowledgeGraphReducerBundle: () => knowledgeGraphReducerBundle,
|
|
@@ -35,6 +37,411 @@ __export(patterns_exports, {
|
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(patterns_exports);
|
|
37
39
|
|
|
40
|
+
// src/protocol/messages.ts
|
|
41
|
+
var SENTINEL = void 0;
|
|
42
|
+
|
|
43
|
+
// src/ctx/types.ts
|
|
44
|
+
var CTX_DEP_CACHE = /* @__PURE__ */ Symbol("graphrefly.ctx.depCache");
|
|
45
|
+
function depWaves(ctx, depIndex) {
|
|
46
|
+
return ctx.waveData[depIndex] ?? [];
|
|
47
|
+
}
|
|
48
|
+
function depBatch(ctx, depIndex) {
|
|
49
|
+
const waves = depWaves(ctx, depIndex);
|
|
50
|
+
if (waves.length === 0) return null;
|
|
51
|
+
const flattened = waves.flat().filter((v) => v !== SENTINEL);
|
|
52
|
+
return flattened.length === 0 ? [] : flattened;
|
|
53
|
+
}
|
|
54
|
+
function depLatest(ctx, depIndex) {
|
|
55
|
+
return ctx[CTX_DEP_CACHE]?.latest[depIndex];
|
|
56
|
+
}
|
|
57
|
+
|
|
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
|
|
64
|
+
function eventMessageIssue(value) {
|
|
65
|
+
if (!isObjectRecord(value)) {
|
|
66
|
+
return eventIssue("event message must be an object");
|
|
67
|
+
}
|
|
68
|
+
if (typeof value.id !== "string" || value.id.length === 0) {
|
|
69
|
+
return eventIssue("event message id must be a non-empty string");
|
|
70
|
+
}
|
|
71
|
+
if (typeof value.type !== "string" || value.type.length === 0) {
|
|
72
|
+
return eventIssue("event message type must be a non-empty string");
|
|
73
|
+
}
|
|
74
|
+
if (!("payload" in value)) {
|
|
75
|
+
return eventIssue("event message payload field is required");
|
|
76
|
+
}
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
function eventIssue(message) {
|
|
80
|
+
return {
|
|
81
|
+
kind: "issue",
|
|
82
|
+
code: "malformed-event-message",
|
|
83
|
+
message,
|
|
84
|
+
severity: "error",
|
|
85
|
+
source: "messageBus.eventMessage"
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/patterns/event-flow.ts
|
|
90
|
+
function eventFlow(graph, opts) {
|
|
91
|
+
const name = opts.name ?? opts.flowId ?? "eventFlow";
|
|
92
|
+
const flowId = opts.flowId ?? name;
|
|
93
|
+
const now = opts.now ?? Date.now;
|
|
94
|
+
const sources = normalizeSources(opts.sources);
|
|
95
|
+
const runtime = graph.node(
|
|
96
|
+
sources.map((source) => source.node),
|
|
97
|
+
(ctx) => {
|
|
98
|
+
const state = ctx.state.get() ?? {
|
|
99
|
+
recordSeq: 0,
|
|
100
|
+
auditSeq: 0,
|
|
101
|
+
highWater: /* @__PURE__ */ new Map()
|
|
102
|
+
};
|
|
103
|
+
ctx.state.persist(true);
|
|
104
|
+
for (let i = 0; i < sources.length; i++) {
|
|
105
|
+
const source = sources[i];
|
|
106
|
+
for (const raw of depBatch(ctx, i) ?? []) {
|
|
107
|
+
reduceEventSource(
|
|
108
|
+
raw,
|
|
109
|
+
source.source,
|
|
110
|
+
flowId,
|
|
111
|
+
now(),
|
|
112
|
+
state,
|
|
113
|
+
(fact) => ctx.down([["DATA", fact]])
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
ctx.state.set(state);
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: `${name}/runtime`,
|
|
121
|
+
factory: "eventFlowRuntime",
|
|
122
|
+
meta: { flowId, sources: sources.map((source) => source.source) },
|
|
123
|
+
partial: true,
|
|
124
|
+
completeWhenDepsComplete: false,
|
|
125
|
+
errorWhenDepsError: false
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
return {
|
|
129
|
+
records: runtimeProjection(graph, runtime, "record", `${name}/records`, "eventFlowRecords"),
|
|
130
|
+
status: runtimeProjection(graph, runtime, "status", `${name}/status`, "eventFlowStatus"),
|
|
131
|
+
issues: runtimeProjection(graph, runtime, "issue", `${name}/issues`, "eventFlowIssues"),
|
|
132
|
+
audit: runtimeProjection(graph, runtime, "audit", `${name}/audit`, "eventFlowAudit"),
|
|
133
|
+
highWater: runtimeProjection(
|
|
134
|
+
graph,
|
|
135
|
+
runtime,
|
|
136
|
+
"high-water",
|
|
137
|
+
`${name}/highWater`,
|
|
138
|
+
"eventFlowHighWater"
|
|
139
|
+
)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function eventFlowProjection(graph, flowOrRecords, opts) {
|
|
143
|
+
const records = isEventFlowBundle(flowOrRecords) ? flowOrRecords.records : flowOrRecords;
|
|
144
|
+
const name = opts.name ?? opts.projectionId ?? "eventFlowProjection";
|
|
145
|
+
const projectionId = opts.projectionId ?? name;
|
|
146
|
+
const now = opts.now ?? Date.now;
|
|
147
|
+
const runtime = graph.node(
|
|
148
|
+
[records],
|
|
149
|
+
(ctx) => {
|
|
150
|
+
const state = ctx.state.get() ?? {
|
|
151
|
+
value: opts.initial,
|
|
152
|
+
highWater: emptyHighWater(projectionId),
|
|
153
|
+
sourceHighWater: /* @__PURE__ */ new Map()
|
|
154
|
+
};
|
|
155
|
+
ctx.state.persist(true);
|
|
156
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
157
|
+
const record = raw;
|
|
158
|
+
try {
|
|
159
|
+
state.value = opts.reduce(state.value, record);
|
|
160
|
+
state.highWater = projectionHighWater(projectionId, record, state.sourceHighWater);
|
|
161
|
+
ctx.down([
|
|
162
|
+
["DATA", { kind: "frame", frame: { state: state.value, highWater: state.highWater } }],
|
|
163
|
+
[
|
|
164
|
+
"DATA",
|
|
165
|
+
{
|
|
166
|
+
kind: "status",
|
|
167
|
+
status: {
|
|
168
|
+
kind: "projected",
|
|
169
|
+
projectionId,
|
|
170
|
+
recordSeq: record.recordSeq,
|
|
171
|
+
timestampMs: now()
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
["DATA", { kind: "high-water", highWater: state.highWater }]
|
|
176
|
+
]);
|
|
177
|
+
} catch (error) {
|
|
178
|
+
const issue = dataIssue(
|
|
179
|
+
"event-flow-projection-threw",
|
|
180
|
+
error instanceof Error ? error.message : "eventFlowProjection reducer threw",
|
|
181
|
+
{ projectionId, record }
|
|
182
|
+
);
|
|
183
|
+
ctx.down([
|
|
184
|
+
["DATA", { kind: "issue", issue }],
|
|
185
|
+
[
|
|
186
|
+
"DATA",
|
|
187
|
+
{
|
|
188
|
+
kind: "status",
|
|
189
|
+
status: {
|
|
190
|
+
kind: "rejected",
|
|
191
|
+
projectionId,
|
|
192
|
+
recordSeq: record.recordSeq,
|
|
193
|
+
issueCode: issue.code,
|
|
194
|
+
timestampMs: now()
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
ctx.state.set(state);
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: `${name}/runtime`,
|
|
205
|
+
factory: "eventFlowProjectionRuntime",
|
|
206
|
+
meta: { projectionId },
|
|
207
|
+
completeWhenDepsComplete: false,
|
|
208
|
+
errorWhenDepsError: false
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
return {
|
|
212
|
+
frames: projectionRuntime(
|
|
213
|
+
graph,
|
|
214
|
+
runtime,
|
|
215
|
+
"frame",
|
|
216
|
+
`${name}/frames`,
|
|
217
|
+
"eventFlowProjectionFrames"
|
|
218
|
+
),
|
|
219
|
+
snapshot: projectionRuntime(
|
|
220
|
+
graph,
|
|
221
|
+
runtime,
|
|
222
|
+
"frame",
|
|
223
|
+
`${name}/snapshot`,
|
|
224
|
+
"eventFlowProjectionSnapshot",
|
|
225
|
+
(fact) => fact.frame.state
|
|
226
|
+
),
|
|
227
|
+
status: projectionRuntime(
|
|
228
|
+
graph,
|
|
229
|
+
runtime,
|
|
230
|
+
"status",
|
|
231
|
+
`${name}/status`,
|
|
232
|
+
"eventFlowProjectionStatus"
|
|
233
|
+
),
|
|
234
|
+
issues: projectionRuntime(
|
|
235
|
+
graph,
|
|
236
|
+
runtime,
|
|
237
|
+
"issue",
|
|
238
|
+
`${name}/issues`,
|
|
239
|
+
"eventFlowProjectionIssues"
|
|
240
|
+
),
|
|
241
|
+
highWater: projectionRuntime(
|
|
242
|
+
graph,
|
|
243
|
+
runtime,
|
|
244
|
+
"high-water",
|
|
245
|
+
`${name}/highWater`,
|
|
246
|
+
"eventFlowProjectionHighWater"
|
|
247
|
+
)
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function reduceEventSource(raw, source, flowId, timestampMs, state, emit) {
|
|
251
|
+
const normalized = normalizeInput(raw, source);
|
|
252
|
+
if (normalized.issue !== void 0) {
|
|
253
|
+
const status2 = {
|
|
254
|
+
kind: "rejected",
|
|
255
|
+
flowId,
|
|
256
|
+
source: normalized.source,
|
|
257
|
+
issueCode: normalized.issue.code,
|
|
258
|
+
timestampMs
|
|
259
|
+
};
|
|
260
|
+
const audit2 = auditRecord(flowId, state, "rejected", timestampMs, {
|
|
261
|
+
source: normalized.source,
|
|
262
|
+
issueCode: normalized.issue.code
|
|
263
|
+
});
|
|
264
|
+
emit({ kind: "issue", issue: normalized.issue });
|
|
265
|
+
emit({ kind: "status", status: status2 });
|
|
266
|
+
emit({ kind: "audit", audit: audit2 });
|
|
267
|
+
emit({ kind: "high-water", highWater: highWaterSnapshot(flowId, state) });
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const recordSeq = ++state.recordSeq;
|
|
271
|
+
const record = {
|
|
272
|
+
recordSeq,
|
|
273
|
+
flowId,
|
|
274
|
+
event: normalized.event,
|
|
275
|
+
source: normalized.source,
|
|
276
|
+
observedAtMs: timestampMs,
|
|
277
|
+
...normalized.event.correlationId === void 0 ? {} : { correlationId: normalized.event.correlationId },
|
|
278
|
+
...normalized.event.causationId === void 0 ? {} : { causationId: normalized.event.causationId }
|
|
279
|
+
};
|
|
280
|
+
state.highWater.set(sourceKey(normalized.source), {
|
|
281
|
+
source: normalized.source.source,
|
|
282
|
+
...normalized.source.topic === void 0 ? {} : { topic: normalized.source.topic },
|
|
283
|
+
...normalized.source.seq === void 0 ? {} : { seq: normalized.source.seq },
|
|
284
|
+
messageId: normalized.event.id,
|
|
285
|
+
recordSeq
|
|
286
|
+
});
|
|
287
|
+
const audit = auditRecord(flowId, state, "recorded", timestampMs, {
|
|
288
|
+
source: normalized.source,
|
|
289
|
+
eventId: normalized.event.id,
|
|
290
|
+
eventType: normalized.event.type
|
|
291
|
+
});
|
|
292
|
+
const highWater = highWaterSnapshot(flowId, state);
|
|
293
|
+
const status = {
|
|
294
|
+
kind: "recorded",
|
|
295
|
+
flowId,
|
|
296
|
+
recordSeq,
|
|
297
|
+
eventId: normalized.event.id,
|
|
298
|
+
eventType: normalized.event.type,
|
|
299
|
+
source: normalized.source,
|
|
300
|
+
timestampMs
|
|
301
|
+
};
|
|
302
|
+
emit({ kind: "record", record });
|
|
303
|
+
emit({ kind: "status", status });
|
|
304
|
+
emit({ kind: "audit", audit });
|
|
305
|
+
emit({ kind: "high-water", highWater });
|
|
306
|
+
}
|
|
307
|
+
function normalizeInput(raw, source) {
|
|
308
|
+
const envelope = messageEnvelopeOf(raw);
|
|
309
|
+
const value = envelope?.payload ?? raw;
|
|
310
|
+
const sourceRef = envelope === void 0 ? { source, ...eventIdOf(value) === void 0 ? {} : { messageId: eventIdOf(value) } } : {
|
|
311
|
+
source,
|
|
312
|
+
topic: envelope.topic,
|
|
313
|
+
seq: envelope.seq,
|
|
314
|
+
messageId: envelope.payload.id,
|
|
315
|
+
...envelope.idempotencyKey === void 0 ? {} : { idempotencyKey: envelope.idempotencyKey }
|
|
316
|
+
};
|
|
317
|
+
const issue = eventMessageIssue(value);
|
|
318
|
+
if (issue !== void 0) {
|
|
319
|
+
return {
|
|
320
|
+
source: sourceRef,
|
|
321
|
+
issue: dataIssue(issue.code, issue.message, { source: sourceRef, value })
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return { event: value, source: sourceRef };
|
|
325
|
+
}
|
|
326
|
+
function messageEnvelopeOf(value) {
|
|
327
|
+
if (!isRecord(value)) return void 0;
|
|
328
|
+
if (typeof value.topic !== "string" || !Number.isInteger(value.seq) || typeof value.timestampMs !== "number" || !("payload" in value)) {
|
|
329
|
+
return void 0;
|
|
330
|
+
}
|
|
331
|
+
const payloadIssue = eventMessageIssue(value.payload);
|
|
332
|
+
return payloadIssue === void 0 ? value : void 0;
|
|
333
|
+
}
|
|
334
|
+
function normalizeSources(sources) {
|
|
335
|
+
if (sources.length === 0) throw new Error("eventFlow: sources must be non-empty");
|
|
336
|
+
return sources.map((source, index) => {
|
|
337
|
+
if (isRecord(source) && "node" in source) {
|
|
338
|
+
if (typeof source.source !== "string" || source.source.length === 0) {
|
|
339
|
+
throw new Error("eventFlow: source name must be non-empty");
|
|
340
|
+
}
|
|
341
|
+
return source;
|
|
342
|
+
}
|
|
343
|
+
return { source: `source-${index}`, node: source };
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
function runtimeProjection(graph, runtime, kind, name, factory) {
|
|
347
|
+
return graph.node(
|
|
348
|
+
[runtime],
|
|
349
|
+
(ctx) => {
|
|
350
|
+
for (const fact of depBatch(ctx, 0) ?? []) {
|
|
351
|
+
const typed = fact;
|
|
352
|
+
if (typed.kind === kind) ctx.down([["DATA", valueOfRuntimeFact(typed)]]);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
{ name, factory, completeWhenDepsComplete: false, errorWhenDepsError: false }
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
function projectionRuntime(graph, runtime, kind, name, factory, map = valueOfRuntimeFact) {
|
|
359
|
+
return graph.node(
|
|
360
|
+
[runtime],
|
|
361
|
+
(ctx) => {
|
|
362
|
+
for (const fact of depBatch(ctx, 0) ?? []) {
|
|
363
|
+
const typed = fact;
|
|
364
|
+
if (typed.kind === kind) ctx.down([["DATA", map(typed)]]);
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
{ name, factory, completeWhenDepsComplete: false, errorWhenDepsError: false }
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
function valueOfRuntimeFact(fact) {
|
|
371
|
+
if ("record" in fact) return fact.record;
|
|
372
|
+
if ("status" in fact) return fact.status;
|
|
373
|
+
if ("issue" in fact) return fact.issue;
|
|
374
|
+
if ("audit" in fact) return fact.audit;
|
|
375
|
+
if ("highWater" in fact) return fact.highWater;
|
|
376
|
+
if ("frame" in fact) return fact.frame;
|
|
377
|
+
return void 0;
|
|
378
|
+
}
|
|
379
|
+
function auditRecord(flowId, state, outcome, timestampMs, opts) {
|
|
380
|
+
return {
|
|
381
|
+
seq: ++state.auditSeq,
|
|
382
|
+
flowId,
|
|
383
|
+
outcome,
|
|
384
|
+
...opts.eventId === void 0 ? {} : { eventId: opts.eventId },
|
|
385
|
+
...opts.eventType === void 0 ? {} : { eventType: opts.eventType },
|
|
386
|
+
...opts.issueCode === void 0 ? {} : { issueCode: opts.issueCode },
|
|
387
|
+
...opts.source === void 0 ? {} : { source: opts.source },
|
|
388
|
+
highWater: highWaterSnapshot(flowId, state),
|
|
389
|
+
timestampMs
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function highWaterSnapshot(flowId, state) {
|
|
393
|
+
return {
|
|
394
|
+
flowId,
|
|
395
|
+
recordSeq: state.recordSeq,
|
|
396
|
+
auditSeq: state.auditSeq,
|
|
397
|
+
sources: [...state.highWater.values()].sort(
|
|
398
|
+
(a, b) => a.source.localeCompare(b.source) || (a.topic ?? "").localeCompare(b.topic ?? "")
|
|
399
|
+
)
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function emptyHighWater(flowId) {
|
|
403
|
+
return { flowId, recordSeq: 0, auditSeq: 0, sources: [] };
|
|
404
|
+
}
|
|
405
|
+
function projectionHighWater(flowId, record, sourceHighWater) {
|
|
406
|
+
sourceHighWater.set(sourceKey(record.source), {
|
|
407
|
+
source: record.source.source,
|
|
408
|
+
...record.source.topic === void 0 ? {} : { topic: record.source.topic },
|
|
409
|
+
...record.source.seq === void 0 ? {} : { seq: record.source.seq },
|
|
410
|
+
messageId: record.event.id,
|
|
411
|
+
recordSeq: record.recordSeq
|
|
412
|
+
});
|
|
413
|
+
return {
|
|
414
|
+
flowId,
|
|
415
|
+
recordSeq: record.recordSeq,
|
|
416
|
+
auditSeq: 0,
|
|
417
|
+
sources: [...sourceHighWater.values()].sort(
|
|
418
|
+
(a, b) => a.source.localeCompare(b.source) || (a.topic ?? "").localeCompare(b.topic ?? "")
|
|
419
|
+
)
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function sourceKey(source) {
|
|
423
|
+
return `${source.source}\0${source.topic ?? ""}`;
|
|
424
|
+
}
|
|
425
|
+
function eventIdOf(value) {
|
|
426
|
+
return isRecord(value) && typeof value.id === "string" ? value.id : void 0;
|
|
427
|
+
}
|
|
428
|
+
function dataIssue(code, message, details) {
|
|
429
|
+
return {
|
|
430
|
+
kind: "issue",
|
|
431
|
+
code,
|
|
432
|
+
message,
|
|
433
|
+
severity: "error",
|
|
434
|
+
source: "eventFlow",
|
|
435
|
+
...details === void 0 ? {} : { details }
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function isEventFlowBundle(value) {
|
|
439
|
+
return isRecord(value) && "records" in value && "highWater" in value;
|
|
440
|
+
}
|
|
441
|
+
function isRecord(value) {
|
|
442
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
443
|
+
}
|
|
444
|
+
|
|
38
445
|
// src/patterns/inspection.ts
|
|
39
446
|
function profileSummary(graph, opts = {}) {
|
|
40
447
|
const profile = graph.profile();
|
|
@@ -203,362 +610,36 @@ function scoreAtLeast(score, min) {
|
|
|
203
610
|
return Number.isFinite(score) && score >= min;
|
|
204
611
|
}
|
|
205
612
|
|
|
206
|
-
// src/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (waves.length === 0) return null;
|
|
217
|
-
const flattened = waves.flat().filter((v) => v !== SENTINEL);
|
|
218
|
-
return flattened.length === 0 ? [] : flattened;
|
|
219
|
-
}
|
|
220
|
-
function depLatest(ctx, depIndex) {
|
|
221
|
-
return ctx[CTX_DEP_CACHE]?.latest[depIndex];
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// src/patterns/semantic-memory-graph.ts
|
|
225
|
-
function memoryRetrievalBundle(graph, opts) {
|
|
226
|
-
const name = opts.name ?? "memoryRetrieval";
|
|
227
|
-
const { fragments, query } = opts;
|
|
228
|
-
const snapshot = graph.node(
|
|
229
|
-
[fragments, query],
|
|
230
|
-
(ctx) => {
|
|
231
|
-
const state = ctx.state.get() ?? { evaluation: 0 };
|
|
232
|
-
state.evaluation += 1;
|
|
233
|
-
const rawFragments = depLatest(ctx, 0);
|
|
234
|
-
const rawQuery = depLatest(ctx, 1);
|
|
235
|
-
const queryValidation = validateMemoryRetrievalQuery(rawQuery);
|
|
236
|
-
const currentQuery = queryValidation.query;
|
|
237
|
-
const valid = [];
|
|
238
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
239
|
-
const errors = [...queryValidation.errors];
|
|
240
|
-
if (!Array.isArray(rawFragments)) {
|
|
241
|
-
errors.push({
|
|
242
|
-
code: "invalid-fragments-input",
|
|
243
|
-
message: "memoryRetrievalBundle: fragments input must be an array",
|
|
244
|
-
fragment: rawFragments
|
|
245
|
-
});
|
|
246
|
-
} else {
|
|
247
|
-
const length = safeArrayLength(rawFragments);
|
|
248
|
-
if (length === void 0) {
|
|
249
|
-
errors.push({
|
|
250
|
-
code: "invalid-fragments-input",
|
|
251
|
-
message: "memoryRetrievalBundle: fragments input length could not be read",
|
|
252
|
-
fragment: rawFragments
|
|
253
|
-
});
|
|
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
|
|
254
623
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
const ranked = errors.some((error) => !isRecoverableFragmentError(error)) ? [] : rankFragments(valid, currentQuery);
|
|
277
|
-
const cursor = Object.freeze({
|
|
278
|
-
evaluation: state.evaluation,
|
|
279
|
-
validFragments: valid.length,
|
|
280
|
-
invalidFragments: errors.filter(
|
|
281
|
-
(error) => error.code === "invalid-fragment" || error.code === "duplicate-fragment-id"
|
|
282
|
-
).length,
|
|
283
|
-
resultCount: ranked.length
|
|
284
|
-
});
|
|
285
|
-
ctx.state.set(state);
|
|
286
|
-
const answer = Object.freeze({
|
|
287
|
-
query: currentQuery,
|
|
288
|
-
results: Object.freeze(ranked)
|
|
289
|
-
});
|
|
290
|
-
const status = Object.freeze({
|
|
291
|
-
state: statusState(errors, ranked.length),
|
|
292
|
-
query: currentQuery,
|
|
293
|
-
cursor
|
|
294
|
-
});
|
|
295
|
-
const indexed = Object.freeze({
|
|
296
|
-
ids: Object.freeze(valid.map((fragment) => fragment.id)),
|
|
297
|
-
byId: indexById(valid),
|
|
298
|
-
cursor
|
|
299
|
-
});
|
|
300
|
-
const errorFacts = Object.freeze(
|
|
301
|
-
errors.map(
|
|
302
|
-
(error) => Object.freeze({
|
|
303
|
-
...error,
|
|
304
|
-
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
305
|
-
cursor
|
|
306
|
-
})
|
|
307
|
-
)
|
|
308
|
-
);
|
|
309
|
-
ctx.down([
|
|
310
|
-
[
|
|
311
|
-
"DATA",
|
|
312
|
-
Object.freeze({
|
|
313
|
-
fragments: Object.freeze([...valid]),
|
|
314
|
-
indexed,
|
|
315
|
-
ranked: answer,
|
|
316
|
-
status,
|
|
317
|
-
errors: errorFacts,
|
|
318
|
-
cursor
|
|
319
|
-
})
|
|
320
|
-
]
|
|
321
|
-
]);
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
name: `${name}/snapshot`,
|
|
325
|
-
factory: "memoryRetrievalSnapshot",
|
|
326
|
-
completeWhenDepsComplete: false,
|
|
327
|
-
errorWhenDepsError: false
|
|
328
|
-
}
|
|
329
|
-
);
|
|
330
|
-
return {
|
|
331
|
-
input: { fragments, query },
|
|
332
|
-
snapshot,
|
|
333
|
-
fragments: retrievalProjection(
|
|
334
|
-
graph,
|
|
335
|
-
snapshot,
|
|
336
|
-
`${name}/fragments`,
|
|
337
|
-
"memoryRetrievalFragments",
|
|
338
|
-
(fact) => fact.fragments
|
|
339
|
-
),
|
|
340
|
-
indexed: retrievalProjection(
|
|
341
|
-
graph,
|
|
342
|
-
snapshot,
|
|
343
|
-
`${name}/indexed`,
|
|
344
|
-
"memoryRetrievalIndexed",
|
|
345
|
-
(fact) => fact.indexed
|
|
346
|
-
),
|
|
347
|
-
ranked: retrievalProjection(
|
|
348
|
-
graph,
|
|
349
|
-
snapshot,
|
|
350
|
-
`${name}/ranked`,
|
|
351
|
-
"memoryRetrievalRanked",
|
|
352
|
-
(fact) => fact.ranked
|
|
353
|
-
),
|
|
354
|
-
status: retrievalProjection(
|
|
355
|
-
graph,
|
|
356
|
-
snapshot,
|
|
357
|
-
`${name}/status`,
|
|
358
|
-
"memoryRetrievalStatus",
|
|
359
|
-
(fact) => fact.status
|
|
360
|
-
),
|
|
361
|
-
errors: retrievalProjection(
|
|
362
|
-
graph,
|
|
363
|
-
snapshot,
|
|
364
|
-
`${name}/errors`,
|
|
365
|
-
"memoryRetrievalErrors",
|
|
366
|
-
(fact) => fact.errors
|
|
367
|
-
),
|
|
368
|
-
cursor: retrievalProjection(
|
|
369
|
-
graph,
|
|
370
|
-
snapshot,
|
|
371
|
-
`${name}/cursor`,
|
|
372
|
-
"memoryRetrievalCursor",
|
|
373
|
-
(fact) => fact.cursor
|
|
374
|
-
)
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
function knowledgeGraphReducerBundle(graph, opts) {
|
|
378
|
-
const name = opts.name ?? "knowledgeGraph";
|
|
379
|
-
const deps = opts.policy === void 0 ? [opts.assertions] : [opts.assertions, opts.policy];
|
|
380
|
-
const snapshot = graph.node(
|
|
381
|
-
deps,
|
|
382
|
-
(ctx) => {
|
|
383
|
-
const state = ctx.state.get() ?? { evaluation: 0 };
|
|
384
|
-
state.evaluation += 1;
|
|
385
|
-
const policy = validateKnowledgeGraphPolicy(
|
|
386
|
-
opts.policy === void 0 ? void 0 : depLatest(ctx, 1)
|
|
387
|
-
);
|
|
388
|
-
const reduced = reduceKnowledgeAssertions(depLatest(ctx, 0), policy.policy);
|
|
389
|
-
const pendingErrors = [...policy.errors, ...reduced.errors];
|
|
390
|
-
const cursor = Object.freeze({
|
|
391
|
-
evaluation: state.evaluation,
|
|
392
|
-
validAssertions: reduced.assertions.length,
|
|
393
|
-
invalidAssertions: reduced.invalidAssertions,
|
|
394
|
-
entityCount: reduced.entities.length,
|
|
395
|
-
relationCount: reduced.relations.length,
|
|
396
|
-
predicateCount: reduced.topics.length
|
|
397
|
-
});
|
|
398
|
-
const errors = Object.freeze(
|
|
399
|
-
pendingErrors.map(
|
|
400
|
-
(error) => Object.freeze({
|
|
401
|
-
...error,
|
|
402
|
-
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
403
|
-
cursor
|
|
404
|
-
})
|
|
405
|
-
)
|
|
406
|
-
);
|
|
407
|
-
const status = Object.freeze({
|
|
408
|
-
state: reduced.assertions.length === 0 && errors.length === 0 ? "empty" : errors.length === 0 ? "ready" : reduced.assertions.length > 0 ? "partial" : "error",
|
|
409
|
-
cursor
|
|
410
|
-
});
|
|
411
|
-
ctx.state.set(state);
|
|
412
|
-
ctx.down([
|
|
413
|
-
[
|
|
414
|
-
"DATA",
|
|
415
|
-
Object.freeze({
|
|
416
|
-
assertions: Object.freeze(reduced.assertions),
|
|
417
|
-
entities: Object.freeze(reduced.entities),
|
|
418
|
-
relations: Object.freeze(reduced.relations),
|
|
419
|
-
topics: Object.freeze(reduced.topics),
|
|
420
|
-
index: reduced.index,
|
|
421
|
-
status,
|
|
422
|
-
errors,
|
|
423
|
-
cursor
|
|
424
|
-
})
|
|
425
|
-
]
|
|
426
|
-
]);
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: `${name}/snapshot`,
|
|
430
|
-
factory: "knowledgeGraphReducerSnapshot",
|
|
431
|
-
completeWhenDepsComplete: false,
|
|
432
|
-
errorWhenDepsError: false
|
|
433
|
-
}
|
|
434
|
-
);
|
|
435
|
-
return {
|
|
436
|
-
input: {
|
|
437
|
-
assertions: opts.assertions,
|
|
438
|
-
...opts.policy === void 0 ? {} : { policy: opts.policy }
|
|
439
|
-
},
|
|
440
|
-
snapshot,
|
|
441
|
-
assertions: kgProjection(
|
|
442
|
-
graph,
|
|
443
|
-
snapshot,
|
|
444
|
-
`${name}/assertions`,
|
|
445
|
-
"knowledgeGraphAssertions",
|
|
446
|
-
(fact) => fact.assertions
|
|
447
|
-
),
|
|
448
|
-
entities: kgProjection(
|
|
449
|
-
graph,
|
|
450
|
-
snapshot,
|
|
451
|
-
`${name}/entities`,
|
|
452
|
-
"knowledgeGraphEntities",
|
|
453
|
-
(fact) => fact.entities
|
|
454
|
-
),
|
|
455
|
-
relations: kgProjection(
|
|
456
|
-
graph,
|
|
457
|
-
snapshot,
|
|
458
|
-
`${name}/relations`,
|
|
459
|
-
"knowledgeGraphRelations",
|
|
460
|
-
(fact) => fact.relations
|
|
461
|
-
),
|
|
462
|
-
topics: kgProjection(
|
|
463
|
-
graph,
|
|
464
|
-
snapshot,
|
|
465
|
-
`${name}/topics`,
|
|
466
|
-
"knowledgeGraphTopics",
|
|
467
|
-
(fact) => fact.topics
|
|
468
|
-
),
|
|
469
|
-
index: kgProjection(
|
|
470
|
-
graph,
|
|
471
|
-
snapshot,
|
|
472
|
-
`${name}/index`,
|
|
473
|
-
"knowledgeGraphIndex",
|
|
474
|
-
(fact) => fact.index
|
|
475
|
-
),
|
|
476
|
-
status: kgProjection(
|
|
477
|
-
graph,
|
|
478
|
-
snapshot,
|
|
479
|
-
`${name}/status`,
|
|
480
|
-
"knowledgeGraphStatus",
|
|
481
|
-
(fact) => fact.status
|
|
482
|
-
),
|
|
483
|
-
errors: kgProjection(
|
|
484
|
-
graph,
|
|
485
|
-
snapshot,
|
|
486
|
-
`${name}/errors`,
|
|
487
|
-
"knowledgeGraphErrors",
|
|
488
|
-
(fact) => fact.errors
|
|
489
|
-
),
|
|
490
|
-
cursor: kgProjection(
|
|
491
|
-
graph,
|
|
492
|
-
snapshot,
|
|
493
|
-
`${name}/cursor`,
|
|
494
|
-
"knowledgeGraphCursor",
|
|
495
|
-
(fact) => fact.cursor
|
|
496
|
-
)
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
function retrievalProjection(graph, snapshot, name, factory, select) {
|
|
500
|
-
return graph.node(
|
|
501
|
-
[snapshot],
|
|
502
|
-
(ctx) => {
|
|
503
|
-
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
504
|
-
const fact = raw;
|
|
505
|
-
const selected = select(fact);
|
|
506
|
-
if (selected !== void 0) ctx.down([["DATA", selected]]);
|
|
507
|
-
}
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
name,
|
|
511
|
-
factory,
|
|
512
|
-
completeWhenDepsComplete: false,
|
|
513
|
-
errorWhenDepsError: false
|
|
514
|
-
}
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
function kgProjection(graph, snapshot, name, factory, select) {
|
|
518
|
-
return graph.node(
|
|
519
|
-
[snapshot],
|
|
520
|
-
(ctx) => {
|
|
521
|
-
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
522
|
-
ctx.down([["DATA", select(raw)]]);
|
|
523
|
-
}
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
name,
|
|
527
|
-
factory,
|
|
528
|
-
completeWhenDepsComplete: false,
|
|
529
|
-
errorWhenDepsError: false
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
function validateKnowledgeGraphPolicy(value) {
|
|
534
|
-
if (value === void 0) return { policy: void 0, errors: [] };
|
|
535
|
-
if (!isPlainObject(value)) {
|
|
536
|
-
return {
|
|
537
|
-
errors: [
|
|
538
|
-
{
|
|
539
|
-
code: "invalid-policy",
|
|
540
|
-
message: "knowledgeGraphReducerBundle: policy must be an object",
|
|
541
|
-
assertion: value
|
|
542
|
-
}
|
|
543
|
-
]
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
const errors = [];
|
|
547
|
-
const policy = value;
|
|
548
|
-
if (policy.allowedPredicates !== void 0 && !isDenseArrayOf2(policy.allowedPredicates, (item) => typeof item === "string")) {
|
|
549
|
-
errors.push("allowedPredicates must be a readonly string array");
|
|
550
|
-
}
|
|
551
|
-
if (policy.requireEntityTypes !== void 0 && typeof policy.requireEntityTypes !== "boolean") {
|
|
552
|
-
errors.push("requireEntityTypes must be a boolean when present");
|
|
553
|
-
}
|
|
554
|
-
if (errors.length > 0) {
|
|
555
|
-
return {
|
|
556
|
-
errors: [
|
|
557
|
-
{
|
|
558
|
-
code: "invalid-policy",
|
|
559
|
-
message: "knowledgeGraphReducerBundle: policy is invalid",
|
|
560
|
-
assertion: value,
|
|
561
|
-
validationErrors: Object.freeze(errors)
|
|
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)
|
|
562
643
|
}
|
|
563
644
|
]
|
|
564
645
|
};
|
|
@@ -1027,11 +1108,323 @@ function compareBigIntDesc2(a, b) {
|
|
|
1027
1108
|
if (a === b) return 0;
|
|
1028
1109
|
return a > b ? -1 : 1;
|
|
1029
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
|
+
}
|
|
1030
1421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1031
1422
|
0 && (module.exports = {
|
|
1032
1423
|
admissionFilter3D,
|
|
1033
1424
|
admissionScored,
|
|
1034
1425
|
cosineSimilarity,
|
|
1426
|
+
eventFlow,
|
|
1427
|
+
eventFlowProjection,
|
|
1035
1428
|
filterMemoryFragments,
|
|
1036
1429
|
isMemoryFragment,
|
|
1037
1430
|
knowledgeGraphReducerBundle,
|