@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
depBatch,
|
|
3
3
|
depLatest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WQIA3GFB.js";
|
|
5
5
|
|
|
6
6
|
// src/patterns/semantic-memory.ts
|
|
7
7
|
function cosineSimilarity(a, b) {
|
|
@@ -142,466 +142,158 @@ function scoreAtLeast(score, min) {
|
|
|
142
142
|
return Number.isFinite(score) && score >= min;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
// src/patterns/semantic-memory-graph.ts
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const rawQuery = depLatest(ctx, 1);
|
|
156
|
-
const queryValidation = validateMemoryRetrievalQuery(rawQuery);
|
|
157
|
-
const currentQuery = queryValidation.query;
|
|
158
|
-
const valid = [];
|
|
159
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
160
|
-
const errors = [...queryValidation.errors];
|
|
161
|
-
if (!Array.isArray(rawFragments)) {
|
|
162
|
-
errors.push({
|
|
163
|
-
code: "invalid-fragments-input",
|
|
164
|
-
message: "memoryRetrievalBundle: fragments input must be an array",
|
|
165
|
-
fragment: rawFragments
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
const length = safeArrayLength(rawFragments);
|
|
169
|
-
if (length === void 0) {
|
|
170
|
-
errors.push({
|
|
171
|
-
code: "invalid-fragments-input",
|
|
172
|
-
message: "memoryRetrievalBundle: fragments input length could not be read",
|
|
173
|
-
fragment: rawFragments
|
|
174
|
-
});
|
|
145
|
+
// src/patterns/semantic-memory-graph-utils.ts
|
|
146
|
+
function validateKnowledgeGraphPolicy(value) {
|
|
147
|
+
if (value === void 0) return { policy: void 0, errors: [] };
|
|
148
|
+
if (!isPlainObject(value)) {
|
|
149
|
+
return {
|
|
150
|
+
errors: [
|
|
151
|
+
{
|
|
152
|
+
code: "invalid-policy",
|
|
153
|
+
message: "knowledgeGraphReducerBundle: policy must be an object",
|
|
154
|
+
assertion: value
|
|
175
155
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
156
|
+
]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const errors = [];
|
|
160
|
+
const policy = value;
|
|
161
|
+
if (policy.allowedPredicates !== void 0 && !isDenseArrayOf2(policy.allowedPredicates, (item) => typeof item === "string")) {
|
|
162
|
+
errors.push("allowedPredicates must be a readonly string array");
|
|
163
|
+
}
|
|
164
|
+
if (policy.requireEntityTypes !== void 0 && typeof policy.requireEntityTypes !== "boolean") {
|
|
165
|
+
errors.push("requireEntityTypes must be a boolean when present");
|
|
166
|
+
}
|
|
167
|
+
if (errors.length > 0) {
|
|
168
|
+
return {
|
|
169
|
+
errors: [
|
|
170
|
+
{
|
|
171
|
+
code: "invalid-policy",
|
|
172
|
+
message: "knowledgeGraphReducerBundle: policy is invalid",
|
|
173
|
+
assertion: value,
|
|
174
|
+
validationErrors: Object.freeze(errors)
|
|
195
175
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
176
|
+
]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
policy: Object.freeze({
|
|
181
|
+
...policy.allowedPredicates === void 0 ? {} : { allowedPredicates: Object.freeze([...policy.allowedPredicates]) },
|
|
182
|
+
...policy.requireEntityTypes === void 0 ? {} : { requireEntityTypes: policy.requireEntityTypes }
|
|
183
|
+
}),
|
|
184
|
+
errors: []
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function reduceKnowledgeAssertions(value, policy) {
|
|
188
|
+
const assertions = [];
|
|
189
|
+
const errors = [];
|
|
190
|
+
const seenAssertions = /* @__PURE__ */ new Set();
|
|
191
|
+
if (!Array.isArray(value)) {
|
|
192
|
+
return {
|
|
193
|
+
assertions,
|
|
194
|
+
entities: [],
|
|
195
|
+
relations: [],
|
|
196
|
+
topics: [],
|
|
197
|
+
index: emptyKnowledgeGraphIndex(),
|
|
198
|
+
errors: [
|
|
199
|
+
{
|
|
200
|
+
code: "invalid-assertions-input",
|
|
201
|
+
message: "knowledgeGraphReducerBundle: assertions input must be an array",
|
|
202
|
+
assertion: value
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
invalidAssertions: 0
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const length = safeArrayLength(value);
|
|
209
|
+
if (length === void 0) {
|
|
210
|
+
return {
|
|
211
|
+
assertions,
|
|
212
|
+
entities: [],
|
|
213
|
+
relations: [],
|
|
214
|
+
topics: [],
|
|
215
|
+
index: emptyKnowledgeGraphIndex(),
|
|
216
|
+
errors: [
|
|
217
|
+
{
|
|
218
|
+
code: "invalid-assertions-input",
|
|
219
|
+
message: "knowledgeGraphReducerBundle: assertions input length could not be read",
|
|
220
|
+
assertion: value
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
invalidAssertions: 0
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
for (let i = 0; i < length; i += 1) {
|
|
227
|
+
const result = validateKnowledgeAssertion(value[i], i, policy);
|
|
228
|
+
if (result.error !== void 0) {
|
|
229
|
+
errors.push(result.error);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
const assertion = result.assertion;
|
|
233
|
+
if (seenAssertions.has(assertion.id)) {
|
|
234
|
+
errors.push({
|
|
235
|
+
code: "duplicate-assertion-id",
|
|
236
|
+
message: "knowledgeGraphReducerBundle: duplicate assertion id",
|
|
237
|
+
index: i,
|
|
238
|
+
assertionId: assertion.id,
|
|
239
|
+
assertion,
|
|
240
|
+
validationErrors: Object.freeze([`duplicate assertion id '${assertion.id}'`])
|
|
220
241
|
});
|
|
221
|
-
|
|
222
|
-
errors.map(
|
|
223
|
-
(error) => Object.freeze({
|
|
224
|
-
...error,
|
|
225
|
-
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
226
|
-
cursor
|
|
227
|
-
})
|
|
228
|
-
)
|
|
229
|
-
);
|
|
230
|
-
ctx.down([
|
|
231
|
-
[
|
|
232
|
-
"DATA",
|
|
233
|
-
Object.freeze({
|
|
234
|
-
fragments: Object.freeze([...valid]),
|
|
235
|
-
indexed,
|
|
236
|
-
ranked: answer,
|
|
237
|
-
status,
|
|
238
|
-
errors: errorFacts,
|
|
239
|
-
cursor
|
|
240
|
-
})
|
|
241
|
-
]
|
|
242
|
-
]);
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: `${name}/snapshot`,
|
|
246
|
-
factory: "memoryRetrievalSnapshot",
|
|
247
|
-
completeWhenDepsComplete: false,
|
|
248
|
-
errorWhenDepsError: false
|
|
242
|
+
continue;
|
|
249
243
|
}
|
|
250
|
-
|
|
244
|
+
seenAssertions.add(assertion.id);
|
|
245
|
+
assertions.push(assertion);
|
|
246
|
+
}
|
|
247
|
+
const materialized = materializeKnowledgeGraph(assertions);
|
|
251
248
|
return {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
snapshot,
|
|
257
|
-
`${name}/fragments`,
|
|
258
|
-
"memoryRetrievalFragments",
|
|
259
|
-
(fact) => fact.fragments
|
|
260
|
-
),
|
|
261
|
-
indexed: retrievalProjection(
|
|
262
|
-
graph,
|
|
263
|
-
snapshot,
|
|
264
|
-
`${name}/indexed`,
|
|
265
|
-
"memoryRetrievalIndexed",
|
|
266
|
-
(fact) => fact.indexed
|
|
267
|
-
),
|
|
268
|
-
ranked: retrievalProjection(
|
|
269
|
-
graph,
|
|
270
|
-
snapshot,
|
|
271
|
-
`${name}/ranked`,
|
|
272
|
-
"memoryRetrievalRanked",
|
|
273
|
-
(fact) => fact.ranked
|
|
274
|
-
),
|
|
275
|
-
status: retrievalProjection(
|
|
276
|
-
graph,
|
|
277
|
-
snapshot,
|
|
278
|
-
`${name}/status`,
|
|
279
|
-
"memoryRetrievalStatus",
|
|
280
|
-
(fact) => fact.status
|
|
281
|
-
),
|
|
282
|
-
errors: retrievalProjection(
|
|
283
|
-
graph,
|
|
284
|
-
snapshot,
|
|
285
|
-
`${name}/errors`,
|
|
286
|
-
"memoryRetrievalErrors",
|
|
287
|
-
(fact) => fact.errors
|
|
288
|
-
),
|
|
289
|
-
cursor: retrievalProjection(
|
|
290
|
-
graph,
|
|
291
|
-
snapshot,
|
|
292
|
-
`${name}/cursor`,
|
|
293
|
-
"memoryRetrievalCursor",
|
|
294
|
-
(fact) => fact.cursor
|
|
295
|
-
)
|
|
249
|
+
assertions: Object.freeze(assertions),
|
|
250
|
+
...materialized,
|
|
251
|
+
errors,
|
|
252
|
+
invalidAssertions: errors.filter((error) => error.code !== "invalid-policy").length
|
|
296
253
|
};
|
|
297
254
|
}
|
|
298
|
-
function
|
|
299
|
-
const name = opts.name ?? "knowledgeGraph";
|
|
300
|
-
const deps = opts.policy === void 0 ? [opts.assertions] : [opts.assertions, opts.policy];
|
|
301
|
-
const snapshot = graph.node(
|
|
302
|
-
deps,
|
|
303
|
-
(ctx) => {
|
|
304
|
-
const state = ctx.state.get() ?? { evaluation: 0 };
|
|
305
|
-
state.evaluation += 1;
|
|
306
|
-
const policy = validateKnowledgeGraphPolicy(
|
|
307
|
-
opts.policy === void 0 ? void 0 : depLatest(ctx, 1)
|
|
308
|
-
);
|
|
309
|
-
const reduced = reduceKnowledgeAssertions(depLatest(ctx, 0), policy.policy);
|
|
310
|
-
const pendingErrors = [...policy.errors, ...reduced.errors];
|
|
311
|
-
const cursor = Object.freeze({
|
|
312
|
-
evaluation: state.evaluation,
|
|
313
|
-
validAssertions: reduced.assertions.length,
|
|
314
|
-
invalidAssertions: reduced.invalidAssertions,
|
|
315
|
-
entityCount: reduced.entities.length,
|
|
316
|
-
relationCount: reduced.relations.length,
|
|
317
|
-
predicateCount: reduced.topics.length
|
|
318
|
-
});
|
|
319
|
-
const errors = Object.freeze(
|
|
320
|
-
pendingErrors.map(
|
|
321
|
-
(error) => Object.freeze({
|
|
322
|
-
...error,
|
|
323
|
-
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
324
|
-
cursor
|
|
325
|
-
})
|
|
326
|
-
)
|
|
327
|
-
);
|
|
328
|
-
const status = Object.freeze({
|
|
329
|
-
state: reduced.assertions.length === 0 && errors.length === 0 ? "empty" : errors.length === 0 ? "ready" : reduced.assertions.length > 0 ? "partial" : "error",
|
|
330
|
-
cursor
|
|
331
|
-
});
|
|
332
|
-
ctx.state.set(state);
|
|
333
|
-
ctx.down([
|
|
334
|
-
[
|
|
335
|
-
"DATA",
|
|
336
|
-
Object.freeze({
|
|
337
|
-
assertions: Object.freeze(reduced.assertions),
|
|
338
|
-
entities: Object.freeze(reduced.entities),
|
|
339
|
-
relations: Object.freeze(reduced.relations),
|
|
340
|
-
topics: Object.freeze(reduced.topics),
|
|
341
|
-
index: reduced.index,
|
|
342
|
-
status,
|
|
343
|
-
errors,
|
|
344
|
-
cursor
|
|
345
|
-
})
|
|
346
|
-
]
|
|
347
|
-
]);
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
name: `${name}/snapshot`,
|
|
351
|
-
factory: "knowledgeGraphReducerSnapshot",
|
|
352
|
-
completeWhenDepsComplete: false,
|
|
353
|
-
errorWhenDepsError: false
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
return {
|
|
357
|
-
input: {
|
|
358
|
-
assertions: opts.assertions,
|
|
359
|
-
...opts.policy === void 0 ? {} : { policy: opts.policy }
|
|
360
|
-
},
|
|
361
|
-
snapshot,
|
|
362
|
-
assertions: kgProjection(
|
|
363
|
-
graph,
|
|
364
|
-
snapshot,
|
|
365
|
-
`${name}/assertions`,
|
|
366
|
-
"knowledgeGraphAssertions",
|
|
367
|
-
(fact) => fact.assertions
|
|
368
|
-
),
|
|
369
|
-
entities: kgProjection(
|
|
370
|
-
graph,
|
|
371
|
-
snapshot,
|
|
372
|
-
`${name}/entities`,
|
|
373
|
-
"knowledgeGraphEntities",
|
|
374
|
-
(fact) => fact.entities
|
|
375
|
-
),
|
|
376
|
-
relations: kgProjection(
|
|
377
|
-
graph,
|
|
378
|
-
snapshot,
|
|
379
|
-
`${name}/relations`,
|
|
380
|
-
"knowledgeGraphRelations",
|
|
381
|
-
(fact) => fact.relations
|
|
382
|
-
),
|
|
383
|
-
topics: kgProjection(
|
|
384
|
-
graph,
|
|
385
|
-
snapshot,
|
|
386
|
-
`${name}/topics`,
|
|
387
|
-
"knowledgeGraphTopics",
|
|
388
|
-
(fact) => fact.topics
|
|
389
|
-
),
|
|
390
|
-
index: kgProjection(
|
|
391
|
-
graph,
|
|
392
|
-
snapshot,
|
|
393
|
-
`${name}/index`,
|
|
394
|
-
"knowledgeGraphIndex",
|
|
395
|
-
(fact) => fact.index
|
|
396
|
-
),
|
|
397
|
-
status: kgProjection(
|
|
398
|
-
graph,
|
|
399
|
-
snapshot,
|
|
400
|
-
`${name}/status`,
|
|
401
|
-
"knowledgeGraphStatus",
|
|
402
|
-
(fact) => fact.status
|
|
403
|
-
),
|
|
404
|
-
errors: kgProjection(
|
|
405
|
-
graph,
|
|
406
|
-
snapshot,
|
|
407
|
-
`${name}/errors`,
|
|
408
|
-
"knowledgeGraphErrors",
|
|
409
|
-
(fact) => fact.errors
|
|
410
|
-
),
|
|
411
|
-
cursor: kgProjection(
|
|
412
|
-
graph,
|
|
413
|
-
snapshot,
|
|
414
|
-
`${name}/cursor`,
|
|
415
|
-
"knowledgeGraphCursor",
|
|
416
|
-
(fact) => fact.cursor
|
|
417
|
-
)
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
function retrievalProjection(graph, snapshot, name, factory, select) {
|
|
421
|
-
return graph.node(
|
|
422
|
-
[snapshot],
|
|
423
|
-
(ctx) => {
|
|
424
|
-
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
425
|
-
const fact = raw;
|
|
426
|
-
const selected = select(fact);
|
|
427
|
-
if (selected !== void 0) ctx.down([["DATA", selected]]);
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name,
|
|
432
|
-
factory,
|
|
433
|
-
completeWhenDepsComplete: false,
|
|
434
|
-
errorWhenDepsError: false
|
|
435
|
-
}
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
function kgProjection(graph, snapshot, name, factory, select) {
|
|
439
|
-
return graph.node(
|
|
440
|
-
[snapshot],
|
|
441
|
-
(ctx) => {
|
|
442
|
-
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
443
|
-
ctx.down([["DATA", select(raw)]]);
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
name,
|
|
448
|
-
factory,
|
|
449
|
-
completeWhenDepsComplete: false,
|
|
450
|
-
errorWhenDepsError: false
|
|
451
|
-
}
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
function validateKnowledgeGraphPolicy(value) {
|
|
455
|
-
if (value === void 0) return { policy: void 0, errors: [] };
|
|
255
|
+
function validateKnowledgeAssertion(value, index, policy) {
|
|
456
256
|
if (!isPlainObject(value)) {
|
|
457
|
-
return
|
|
458
|
-
errors: [
|
|
459
|
-
{
|
|
460
|
-
code: "invalid-policy",
|
|
461
|
-
message: "knowledgeGraphReducerBundle: policy must be an object",
|
|
462
|
-
assertion: value
|
|
463
|
-
}
|
|
464
|
-
]
|
|
465
|
-
};
|
|
257
|
+
return invalidKnowledgeAssertion(index, value, ["assertion must be an object"]);
|
|
466
258
|
}
|
|
259
|
+
const raw = value;
|
|
467
260
|
const errors = [];
|
|
468
|
-
|
|
469
|
-
if (
|
|
470
|
-
|
|
261
|
+
if (!isNonEmptyString(raw.id)) errors.push("id must be a non-empty string");
|
|
262
|
+
if (!isKnowledgeSubject(raw.subject)) errors.push("subject.id must be a non-empty string");
|
|
263
|
+
if (!isNonEmptyString(raw.predicate)) errors.push("predicate must be a non-empty string");
|
|
264
|
+
if (!isKnowledgeObject(raw.object)) errors.push("object shape is invalid");
|
|
265
|
+
if (raw.confidence !== void 0 && (!Number.isFinite(raw.confidence) || raw.confidence < 0 || raw.confidence > 1)) {
|
|
266
|
+
errors.push("confidence must be a finite number in [0, 1] when present");
|
|
471
267
|
}
|
|
472
|
-
if (
|
|
473
|
-
errors.push("
|
|
268
|
+
if (raw.sources !== void 0 && !isDenseArrayOf2(raw.sources, isNonEmptyString)) {
|
|
269
|
+
errors.push("sources must be a readonly non-empty string array when present");
|
|
270
|
+
}
|
|
271
|
+
if (policy?.allowedPredicates !== void 0 && !policy.allowedPredicates.includes(raw.predicate ?? "")) {
|
|
272
|
+
errors.push(`predicate '${String(raw.predicate)}' is not allowed by policy`);
|
|
273
|
+
}
|
|
274
|
+
if (policy?.requireEntityTypes === true) {
|
|
275
|
+
if (isKnowledgeSubject(raw.subject) && raw.subject.type === void 0) {
|
|
276
|
+
errors.push("subject.type is required by policy");
|
|
277
|
+
}
|
|
278
|
+
if (isKnowledgeObject(raw.object) && raw.object.kind === "entity" && raw.object.type === void 0) {
|
|
279
|
+
errors.push("object.type is required by policy for entity objects");
|
|
280
|
+
}
|
|
474
281
|
}
|
|
475
282
|
if (errors.length > 0) {
|
|
476
|
-
return
|
|
477
|
-
errors: [
|
|
478
|
-
{
|
|
479
|
-
code: "invalid-policy",
|
|
480
|
-
message: "knowledgeGraphReducerBundle: policy is invalid",
|
|
481
|
-
assertion: value,
|
|
482
|
-
validationErrors: Object.freeze(errors)
|
|
483
|
-
}
|
|
484
|
-
]
|
|
485
|
-
};
|
|
283
|
+
return invalidKnowledgeAssertion(index, value, errors, raw.id);
|
|
486
284
|
}
|
|
487
285
|
return {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
...
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (!Array.isArray(value)) {
|
|
500
|
-
return {
|
|
501
|
-
assertions,
|
|
502
|
-
entities: [],
|
|
503
|
-
relations: [],
|
|
504
|
-
topics: [],
|
|
505
|
-
index: emptyKnowledgeGraphIndex(),
|
|
506
|
-
errors: [
|
|
507
|
-
{
|
|
508
|
-
code: "invalid-assertions-input",
|
|
509
|
-
message: "knowledgeGraphReducerBundle: assertions input must be an array",
|
|
510
|
-
assertion: value
|
|
511
|
-
}
|
|
512
|
-
],
|
|
513
|
-
invalidAssertions: 0
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
const length = safeArrayLength(value);
|
|
517
|
-
if (length === void 0) {
|
|
518
|
-
return {
|
|
519
|
-
assertions,
|
|
520
|
-
entities: [],
|
|
521
|
-
relations: [],
|
|
522
|
-
topics: [],
|
|
523
|
-
index: emptyKnowledgeGraphIndex(),
|
|
524
|
-
errors: [
|
|
525
|
-
{
|
|
526
|
-
code: "invalid-assertions-input",
|
|
527
|
-
message: "knowledgeGraphReducerBundle: assertions input length could not be read",
|
|
528
|
-
assertion: value
|
|
529
|
-
}
|
|
530
|
-
],
|
|
531
|
-
invalidAssertions: 0
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
for (let i = 0; i < length; i += 1) {
|
|
535
|
-
const result = validateKnowledgeAssertion(value[i], i, policy);
|
|
536
|
-
if (result.error !== void 0) {
|
|
537
|
-
errors.push(result.error);
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
const assertion = result.assertion;
|
|
541
|
-
if (seenAssertions.has(assertion.id)) {
|
|
542
|
-
errors.push({
|
|
543
|
-
code: "duplicate-assertion-id",
|
|
544
|
-
message: "knowledgeGraphReducerBundle: duplicate assertion id",
|
|
545
|
-
index: i,
|
|
546
|
-
assertionId: assertion.id,
|
|
547
|
-
assertion,
|
|
548
|
-
validationErrors: Object.freeze([`duplicate assertion id '${assertion.id}'`])
|
|
549
|
-
});
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
seenAssertions.add(assertion.id);
|
|
553
|
-
assertions.push(assertion);
|
|
554
|
-
}
|
|
555
|
-
const materialized = materializeKnowledgeGraph(assertions);
|
|
556
|
-
return {
|
|
557
|
-
assertions: Object.freeze(assertions),
|
|
558
|
-
...materialized,
|
|
559
|
-
errors,
|
|
560
|
-
invalidAssertions: errors.filter((error) => error.code !== "invalid-policy").length
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
function validateKnowledgeAssertion(value, index, policy) {
|
|
564
|
-
if (!isPlainObject(value)) {
|
|
565
|
-
return invalidKnowledgeAssertion(index, value, ["assertion must be an object"]);
|
|
566
|
-
}
|
|
567
|
-
const raw = value;
|
|
568
|
-
const errors = [];
|
|
569
|
-
if (!isNonEmptyString(raw.id)) errors.push("id must be a non-empty string");
|
|
570
|
-
if (!isKnowledgeSubject(raw.subject)) errors.push("subject.id must be a non-empty string");
|
|
571
|
-
if (!isNonEmptyString(raw.predicate)) errors.push("predicate must be a non-empty string");
|
|
572
|
-
if (!isKnowledgeObject(raw.object)) errors.push("object shape is invalid");
|
|
573
|
-
if (raw.confidence !== void 0 && (!Number.isFinite(raw.confidence) || raw.confidence < 0 || raw.confidence > 1)) {
|
|
574
|
-
errors.push("confidence must be a finite number in [0, 1] when present");
|
|
575
|
-
}
|
|
576
|
-
if (raw.sources !== void 0 && !isDenseArrayOf2(raw.sources, isNonEmptyString)) {
|
|
577
|
-
errors.push("sources must be a readonly non-empty string array when present");
|
|
578
|
-
}
|
|
579
|
-
if (policy?.allowedPredicates !== void 0 && !policy.allowedPredicates.includes(raw.predicate ?? "")) {
|
|
580
|
-
errors.push(`predicate '${String(raw.predicate)}' is not allowed by policy`);
|
|
581
|
-
}
|
|
582
|
-
if (policy?.requireEntityTypes === true) {
|
|
583
|
-
if (isKnowledgeSubject(raw.subject) && raw.subject.type === void 0) {
|
|
584
|
-
errors.push("subject.type is required by policy");
|
|
585
|
-
}
|
|
586
|
-
if (isKnowledgeObject(raw.object) && raw.object.kind === "entity" && raw.object.type === void 0) {
|
|
587
|
-
errors.push("object.type is required by policy for entity objects");
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
if (errors.length > 0) {
|
|
591
|
-
return invalidKnowledgeAssertion(index, value, errors, raw.id);
|
|
592
|
-
}
|
|
593
|
-
return {
|
|
594
|
-
assertion: Object.freeze({
|
|
595
|
-
id: raw.id,
|
|
596
|
-
...raw.recordId === void 0 ? {} : { recordId: raw.recordId },
|
|
597
|
-
...raw.fragmentId === void 0 ? {} : { fragmentId: raw.fragmentId },
|
|
598
|
-
subject: snapshotSubject(raw.subject),
|
|
599
|
-
predicate: raw.predicate,
|
|
600
|
-
object: snapshotObject(raw.object),
|
|
601
|
-
...raw.confidence === void 0 ? {} : { confidence: raw.confidence },
|
|
602
|
-
sources: Object.freeze([...raw.sources ?? []]),
|
|
603
|
-
...raw.provenance === void 0 ? {} : { provenance: raw.provenance }
|
|
604
|
-
})
|
|
286
|
+
assertion: Object.freeze({
|
|
287
|
+
id: raw.id,
|
|
288
|
+
...raw.recordId === void 0 ? {} : { recordId: raw.recordId },
|
|
289
|
+
...raw.fragmentId === void 0 ? {} : { fragmentId: raw.fragmentId },
|
|
290
|
+
subject: snapshotSubject(raw.subject),
|
|
291
|
+
predicate: raw.predicate,
|
|
292
|
+
object: snapshotObject(raw.object),
|
|
293
|
+
...raw.confidence === void 0 ? {} : { confidence: raw.confidence },
|
|
294
|
+
sources: Object.freeze([...raw.sources ?? []]),
|
|
295
|
+
...raw.provenance === void 0 ? {} : { provenance: raw.provenance }
|
|
296
|
+
})
|
|
605
297
|
};
|
|
606
298
|
}
|
|
607
299
|
function invalidKnowledgeAssertion(index, assertion, validationErrors, assertionId) {
|
|
@@ -949,6 +641,316 @@ function compareBigIntDesc2(a, b) {
|
|
|
949
641
|
return a > b ? -1 : 1;
|
|
950
642
|
}
|
|
951
643
|
|
|
644
|
+
// src/patterns/semantic-memory-graph.ts
|
|
645
|
+
function memoryRetrievalBundle(graph, opts) {
|
|
646
|
+
const name = opts.name ?? "memoryRetrieval";
|
|
647
|
+
const { fragments, query } = opts;
|
|
648
|
+
const snapshot = graph.node(
|
|
649
|
+
[fragments, query],
|
|
650
|
+
(ctx) => {
|
|
651
|
+
const state = ctx.state.get() ?? { evaluation: 0 };
|
|
652
|
+
state.evaluation += 1;
|
|
653
|
+
const rawFragments = depLatest(ctx, 0);
|
|
654
|
+
const rawQuery = depLatest(ctx, 1);
|
|
655
|
+
const queryValidation = validateMemoryRetrievalQuery(rawQuery);
|
|
656
|
+
const currentQuery = queryValidation.query;
|
|
657
|
+
const valid = [];
|
|
658
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
659
|
+
const errors = [...queryValidation.errors];
|
|
660
|
+
if (!Array.isArray(rawFragments)) {
|
|
661
|
+
errors.push({
|
|
662
|
+
code: "invalid-fragments-input",
|
|
663
|
+
message: "memoryRetrievalBundle: fragments input must be an array",
|
|
664
|
+
fragment: rawFragments
|
|
665
|
+
});
|
|
666
|
+
} else {
|
|
667
|
+
const length = safeArrayLength(rawFragments);
|
|
668
|
+
if (length === void 0) {
|
|
669
|
+
errors.push({
|
|
670
|
+
code: "invalid-fragments-input",
|
|
671
|
+
message: "memoryRetrievalBundle: fragments input length could not be read",
|
|
672
|
+
fragment: rawFragments
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
for (let i = 0; i < (length ?? 0); i += 1) {
|
|
676
|
+
const result = validateAndSnapshotFragment(rawFragments, i);
|
|
677
|
+
if (result.error !== void 0) {
|
|
678
|
+
errors.push(result.error);
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
const fragment = result.fragment;
|
|
682
|
+
if (seenIds.has(fragment.id)) {
|
|
683
|
+
errors.push({
|
|
684
|
+
code: "duplicate-fragment-id",
|
|
685
|
+
message: "memoryRetrievalBundle: duplicate fragment id",
|
|
686
|
+
index: i,
|
|
687
|
+
fragment,
|
|
688
|
+
validationErrors: [`duplicate fragment id '${fragment.id}'`]
|
|
689
|
+
});
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
seenIds.add(fragment.id);
|
|
693
|
+
valid.push(fragment);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
const ranked = errors.some((error) => !isRecoverableFragmentError(error)) ? [] : rankFragments(valid, currentQuery);
|
|
697
|
+
const cursor = Object.freeze({
|
|
698
|
+
evaluation: state.evaluation,
|
|
699
|
+
validFragments: valid.length,
|
|
700
|
+
invalidFragments: errors.filter(
|
|
701
|
+
(error) => error.code === "invalid-fragment" || error.code === "duplicate-fragment-id"
|
|
702
|
+
).length,
|
|
703
|
+
resultCount: ranked.length
|
|
704
|
+
});
|
|
705
|
+
ctx.state.set(state);
|
|
706
|
+
const answer = Object.freeze({
|
|
707
|
+
query: currentQuery,
|
|
708
|
+
results: Object.freeze(ranked)
|
|
709
|
+
});
|
|
710
|
+
const status = Object.freeze({
|
|
711
|
+
state: statusState(errors, ranked.length),
|
|
712
|
+
query: currentQuery,
|
|
713
|
+
cursor
|
|
714
|
+
});
|
|
715
|
+
const indexed = Object.freeze({
|
|
716
|
+
ids: Object.freeze(valid.map((fragment) => fragment.id)),
|
|
717
|
+
byId: indexById(valid),
|
|
718
|
+
cursor
|
|
719
|
+
});
|
|
720
|
+
const errorFacts = Object.freeze(
|
|
721
|
+
errors.map(
|
|
722
|
+
(error) => Object.freeze({
|
|
723
|
+
...error,
|
|
724
|
+
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
725
|
+
cursor
|
|
726
|
+
})
|
|
727
|
+
)
|
|
728
|
+
);
|
|
729
|
+
ctx.down([
|
|
730
|
+
[
|
|
731
|
+
"DATA",
|
|
732
|
+
Object.freeze({
|
|
733
|
+
fragments: Object.freeze([...valid]),
|
|
734
|
+
indexed,
|
|
735
|
+
ranked: answer,
|
|
736
|
+
status,
|
|
737
|
+
errors: errorFacts,
|
|
738
|
+
cursor
|
|
739
|
+
})
|
|
740
|
+
]
|
|
741
|
+
]);
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
name: `${name}/snapshot`,
|
|
745
|
+
factory: "memoryRetrievalSnapshot",
|
|
746
|
+
completeWhenDepsComplete: false,
|
|
747
|
+
errorWhenDepsError: false
|
|
748
|
+
}
|
|
749
|
+
);
|
|
750
|
+
return {
|
|
751
|
+
input: { fragments, query },
|
|
752
|
+
snapshot,
|
|
753
|
+
fragments: retrievalProjection(
|
|
754
|
+
graph,
|
|
755
|
+
snapshot,
|
|
756
|
+
`${name}/fragments`,
|
|
757
|
+
"memoryRetrievalFragments",
|
|
758
|
+
(fact) => fact.fragments
|
|
759
|
+
),
|
|
760
|
+
indexed: retrievalProjection(
|
|
761
|
+
graph,
|
|
762
|
+
snapshot,
|
|
763
|
+
`${name}/indexed`,
|
|
764
|
+
"memoryRetrievalIndexed",
|
|
765
|
+
(fact) => fact.indexed
|
|
766
|
+
),
|
|
767
|
+
ranked: retrievalProjection(
|
|
768
|
+
graph,
|
|
769
|
+
snapshot,
|
|
770
|
+
`${name}/ranked`,
|
|
771
|
+
"memoryRetrievalRanked",
|
|
772
|
+
(fact) => fact.ranked
|
|
773
|
+
),
|
|
774
|
+
status: retrievalProjection(
|
|
775
|
+
graph,
|
|
776
|
+
snapshot,
|
|
777
|
+
`${name}/status`,
|
|
778
|
+
"memoryRetrievalStatus",
|
|
779
|
+
(fact) => fact.status
|
|
780
|
+
),
|
|
781
|
+
errors: retrievalProjection(
|
|
782
|
+
graph,
|
|
783
|
+
snapshot,
|
|
784
|
+
`${name}/errors`,
|
|
785
|
+
"memoryRetrievalErrors",
|
|
786
|
+
(fact) => fact.errors
|
|
787
|
+
),
|
|
788
|
+
cursor: retrievalProjection(
|
|
789
|
+
graph,
|
|
790
|
+
snapshot,
|
|
791
|
+
`${name}/cursor`,
|
|
792
|
+
"memoryRetrievalCursor",
|
|
793
|
+
(fact) => fact.cursor
|
|
794
|
+
)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function knowledgeGraphReducerBundle(graph, opts) {
|
|
798
|
+
const name = opts.name ?? "knowledgeGraph";
|
|
799
|
+
const deps = opts.policy === void 0 ? [opts.assertions] : [opts.assertions, opts.policy];
|
|
800
|
+
const snapshot = graph.node(
|
|
801
|
+
deps,
|
|
802
|
+
(ctx) => {
|
|
803
|
+
const state = ctx.state.get() ?? { evaluation: 0 };
|
|
804
|
+
state.evaluation += 1;
|
|
805
|
+
const policy = validateKnowledgeGraphPolicy(
|
|
806
|
+
opts.policy === void 0 ? void 0 : depLatest(ctx, 1)
|
|
807
|
+
);
|
|
808
|
+
const reduced = reduceKnowledgeAssertions(depLatest(ctx, 0), policy.policy);
|
|
809
|
+
const pendingErrors = [...policy.errors, ...reduced.errors];
|
|
810
|
+
const cursor = Object.freeze({
|
|
811
|
+
evaluation: state.evaluation,
|
|
812
|
+
validAssertions: reduced.assertions.length,
|
|
813
|
+
invalidAssertions: reduced.invalidAssertions,
|
|
814
|
+
entityCount: reduced.entities.length,
|
|
815
|
+
relationCount: reduced.relations.length,
|
|
816
|
+
predicateCount: reduced.topics.length
|
|
817
|
+
});
|
|
818
|
+
const errors = Object.freeze(
|
|
819
|
+
pendingErrors.map(
|
|
820
|
+
(error) => Object.freeze({
|
|
821
|
+
...error,
|
|
822
|
+
...error.validationErrors === void 0 ? {} : { validationErrors: Object.freeze([...error.validationErrors]) },
|
|
823
|
+
cursor
|
|
824
|
+
})
|
|
825
|
+
)
|
|
826
|
+
);
|
|
827
|
+
const status = Object.freeze({
|
|
828
|
+
state: reduced.assertions.length === 0 && errors.length === 0 ? "empty" : errors.length === 0 ? "ready" : reduced.assertions.length > 0 ? "partial" : "error",
|
|
829
|
+
cursor
|
|
830
|
+
});
|
|
831
|
+
ctx.state.set(state);
|
|
832
|
+
ctx.down([
|
|
833
|
+
[
|
|
834
|
+
"DATA",
|
|
835
|
+
Object.freeze({
|
|
836
|
+
assertions: Object.freeze(reduced.assertions),
|
|
837
|
+
entities: Object.freeze(reduced.entities),
|
|
838
|
+
relations: Object.freeze(reduced.relations),
|
|
839
|
+
topics: Object.freeze(reduced.topics),
|
|
840
|
+
index: reduced.index,
|
|
841
|
+
status,
|
|
842
|
+
errors,
|
|
843
|
+
cursor
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
]);
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
name: `${name}/snapshot`,
|
|
850
|
+
factory: "knowledgeGraphReducerSnapshot",
|
|
851
|
+
completeWhenDepsComplete: false,
|
|
852
|
+
errorWhenDepsError: false
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
return {
|
|
856
|
+
input: {
|
|
857
|
+
assertions: opts.assertions,
|
|
858
|
+
...opts.policy === void 0 ? {} : { policy: opts.policy }
|
|
859
|
+
},
|
|
860
|
+
snapshot,
|
|
861
|
+
assertions: kgProjection(
|
|
862
|
+
graph,
|
|
863
|
+
snapshot,
|
|
864
|
+
`${name}/assertions`,
|
|
865
|
+
"knowledgeGraphAssertions",
|
|
866
|
+
(fact) => fact.assertions
|
|
867
|
+
),
|
|
868
|
+
entities: kgProjection(
|
|
869
|
+
graph,
|
|
870
|
+
snapshot,
|
|
871
|
+
`${name}/entities`,
|
|
872
|
+
"knowledgeGraphEntities",
|
|
873
|
+
(fact) => fact.entities
|
|
874
|
+
),
|
|
875
|
+
relations: kgProjection(
|
|
876
|
+
graph,
|
|
877
|
+
snapshot,
|
|
878
|
+
`${name}/relations`,
|
|
879
|
+
"knowledgeGraphRelations",
|
|
880
|
+
(fact) => fact.relations
|
|
881
|
+
),
|
|
882
|
+
topics: kgProjection(
|
|
883
|
+
graph,
|
|
884
|
+
snapshot,
|
|
885
|
+
`${name}/topics`,
|
|
886
|
+
"knowledgeGraphTopics",
|
|
887
|
+
(fact) => fact.topics
|
|
888
|
+
),
|
|
889
|
+
index: kgProjection(
|
|
890
|
+
graph,
|
|
891
|
+
snapshot,
|
|
892
|
+
`${name}/index`,
|
|
893
|
+
"knowledgeGraphIndex",
|
|
894
|
+
(fact) => fact.index
|
|
895
|
+
),
|
|
896
|
+
status: kgProjection(
|
|
897
|
+
graph,
|
|
898
|
+
snapshot,
|
|
899
|
+
`${name}/status`,
|
|
900
|
+
"knowledgeGraphStatus",
|
|
901
|
+
(fact) => fact.status
|
|
902
|
+
),
|
|
903
|
+
errors: kgProjection(
|
|
904
|
+
graph,
|
|
905
|
+
snapshot,
|
|
906
|
+
`${name}/errors`,
|
|
907
|
+
"knowledgeGraphErrors",
|
|
908
|
+
(fact) => fact.errors
|
|
909
|
+
),
|
|
910
|
+
cursor: kgProjection(
|
|
911
|
+
graph,
|
|
912
|
+
snapshot,
|
|
913
|
+
`${name}/cursor`,
|
|
914
|
+
"knowledgeGraphCursor",
|
|
915
|
+
(fact) => fact.cursor
|
|
916
|
+
)
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function retrievalProjection(graph, snapshot, name, factory, select) {
|
|
920
|
+
return graph.node(
|
|
921
|
+
[snapshot],
|
|
922
|
+
(ctx) => {
|
|
923
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
924
|
+
const fact = raw;
|
|
925
|
+
const selected = select(fact);
|
|
926
|
+
if (selected !== void 0) ctx.down([["DATA", selected]]);
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
name,
|
|
931
|
+
factory,
|
|
932
|
+
completeWhenDepsComplete: false,
|
|
933
|
+
errorWhenDepsError: false
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
function kgProjection(graph, snapshot, name, factory, select) {
|
|
938
|
+
return graph.node(
|
|
939
|
+
[snapshot],
|
|
940
|
+
(ctx) => {
|
|
941
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
942
|
+
ctx.down([["DATA", select(raw)]]);
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
name,
|
|
947
|
+
factory,
|
|
948
|
+
completeWhenDepsComplete: false,
|
|
949
|
+
errorWhenDepsError: false
|
|
950
|
+
}
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
|
|
952
954
|
export {
|
|
953
955
|
cosineSimilarity,
|
|
954
956
|
memoryFragmentValidAt,
|
|
@@ -962,4 +964,4 @@ export {
|
|
|
962
964
|
memoryRetrievalBundle,
|
|
963
965
|
knowledgeGraphReducerBundle
|
|
964
966
|
};
|
|
965
|
-
//# sourceMappingURL=chunk-
|
|
967
|
+
//# sourceMappingURL=chunk-E4QCH32M.js.map
|